diff --git a/.csslintrc b/.csslintrc index 46d6b60..3e2af48 100644 --- a/.csslintrc +++ b/.csslintrc @@ -1,5 +1,6 @@ { "box-sizing" : false, "display-property-grouping": false, - "star-property-hack" : false + "star-property-hack" : false, + "unqualified-attributes" : false } diff --git a/.travis.yml b/.travis.yml index 57642bf..6e5919d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ language: node_js node_js: - "0.10" -before_script: - - npm install -g grunt-cli -script: grunt test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c39ada..4a8f46b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ Building Pure is easy, run `grunt`: $ grunt ``` -Pure use [CSSLint][] for basic testing to make sure we're shipping valid CSS +Pure uses [CSSLint][] for basic testing to make sure we're shipping valid CSS which complies with standard best practices. To run Pure's tests, run `grunt test`: diff --git a/Gruntfile.js b/Gruntfile.js index 7277ea1..b33416d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,71 +1,45 @@ -var path = require('path'); - module.exports = function (grunt) { // -- Config ------------------------------------------------------------------- grunt.initConfig({ - pkg : grunt.file.readJSON('package.json'), - normalize: grunt.file.readJSON('src/base/bower.json'), + pkg : grunt.file.readJSON('package.json'), + bower: grunt.file.readJSON('bower.json'), - // -- Constants ------------------------------------------------------------ + // -- bower.json Config --------------------------------------------------------- - BUILD_COMMENT: 'THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT!', + bower_json: { + release: { + values: { + main: 'pure.css' + }, + + dest: 'build/' + } + }, // -- Clean Config --------------------------------------------------------- clean: { build : ['build/'], build_res: ['build/*-r.css'], - release : ['release/<%= pkg.version %>/'], - base : ['src/base/css/', 'src/base/bower.json', 'src/base/LICENSE.md'] + release : ['release/<%= pkg.version %>/'] }, // -- Copy Config ---------------------------------------------------------- copy: { build: { - expand : true, - flatten: true, src : 'src/**/css/*.css', dest : 'build/', - - rename: function (dest, src) { - // normalize -> base - src = src.replace(/^normalize(-.+\.css|\.css)$/, 'base$1'); - return path.join(dest, src); - } + expand : true, + flatten: true }, - normalize: { - expand : true, - flatten: true, - cwd : 'bower_components/normalize-css/', - src : '{bower.json,LICENSE.md,normalize.css}', - dest : 'src/base/', - - rename: function (dest, file) { - if (grunt.file.isMatch('*.css', file)) { - return path.join(dest, 'css', file); - } - - return path.join(dest, file); - }, - - options: { - processContent: function (content, file) { - var comment = grunt.config('BUILD_COMMENT'); - - if (grunt.file.isMatch({matchBase: true}, '*.css', file)) { - content = '/* ' + comment + ' */\n' + content; - } else if (grunt.file.isMatch({matchBase: true}, '*.html', file)) { - content = '\n' + content; - } - - return content; - } - } + release: { + src : '{LICENSE.md,README.md,HISTORY.md}', + dest: 'build/' } }, @@ -74,13 +48,17 @@ grunt.initConfig({ concat: { build: { files: [ + {'build/base.css': [ + 'bower_components/normalize-css/normalize.css', + 'build/base.css' + ]}, + {'build/buttons.css': [ 'build/buttons-core.css', 'build/buttons.css' ]}, {'build/forms-nr.css': [ - 'build/forms-core.css', 'build/forms.css' ]}, @@ -89,16 +67,11 @@ grunt.initConfig({ 'build/forms-r.css' ]}, - {'build/grids-nr.css': [ + {'build/grids.css': [ 'build/grids-core.css', 'build/grids-units.css' ]}, - {'build/grids.css': [ - 'build/grids-nr.css', - 'build/grids-r.css' - ]}, - {'build/menus-nr.css': [ 'build/menus-core.css', 'build/menus.css', @@ -108,30 +81,28 @@ grunt.initConfig({ {'build/menus.css': [ 'build/menus-nr.css', 'build/menus-r.css' + ]}, + + // Rollups + + {'build/<%= pkg.name %>.css': [ + 'build/base.css', + 'build/grids.css', + 'build/buttons.css', + 'build/forms.css', + 'build/menus.css', + 'build/tables.css' + ]}, + + {'build/<%= pkg.name %>-nr.css': [ + 'build/base.css', + 'build/grids.css', + 'build/buttons.css', + 'build/forms-nr.css', + 'build/menus-nr.css', + 'build/tables.css' ]} ] - }, - - all: { - files: { - 'build/<%= pkg.name %>-min.css': [ - 'build/base-min.css', - 'build/buttons-min.css', - 'build/forms-min.css', - 'build/grids-min.css', - 'build/menus-min.css', - 'build/tables-min.css' - ], - - 'build/<%= pkg.name %>-nr-min.css': [ - 'build/base-min.css', - 'build/buttons-min.css', - 'build/forms-nr-min.css', - 'build/grids-nr-min.css', - 'build/menus-nr-min.css', - 'build/tables-min.css' - ] - } } }, @@ -142,20 +113,19 @@ grunt.initConfig({ csslintrc: '.csslintrc' }, - src: { - src: [ - 'src/**/css/*.css', - '!src/base/css/*', - '!src/forms/css/forms-core.css' - ] - } + base : ['src/base/css/*.css'], + buttons: ['src/buttons/css/*.css'], + forms : ['src/forms/css/*.css'], + grids : ['src/grids/css/*.css'], + menus : ['src/menus/css/*.css'], + tables : ['src/tables/css/*.css'] }, // -- CSSMin Config -------------------------------------------------------- cssmin: { options: { - // report: 'gzip' + noAdvanced: true }, files: { @@ -170,12 +140,12 @@ grunt.initConfig({ compress: { release: { options: { - archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.zip' + archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz' }, expand : true, flatten: true, - src : 'build/*.css', + src : 'build/*', dest : '<%= pkg.name %>/<%= pkg.version %>/' } }, @@ -187,7 +157,7 @@ grunt.initConfig({ options: { banner: [ '/*!', - 'normalize.css v<%= normalize.version %> | MIT License | git.io/normalize', + 'normalize.css v<%= bower.devDependencies["normalize-css"] %> | MIT License | git.io/normalize', 'Copyright (c) Nicolas Gallagher and Jonathan Neal', '*/\n' ].join('\n') @@ -195,7 +165,7 @@ grunt.initConfig({ expand: true, cwd : 'build/', - src : ['base*.css', 'forms*.css', 'tables*.css', '<%= pkg.name %>*.css'] + src : ['base*.css', '<%= pkg.name %>*.css'] }, yahoo: { @@ -203,7 +173,7 @@ grunt.initConfig({ banner: [ '/*!', 'Pure v<%= pkg.version %>', - 'Copyright 2013 Yahoo! Inc. All rights reserved.', + 'Copyright 2014 Yahoo! Inc. All rights reserved.', 'Licensed under the BSD License.', 'https://github.com/yui/pure/blob/master/LICENSE.md', '*/\n' @@ -215,16 +185,52 @@ grunt.initConfig({ } }, - // -- Contextualize Config ------------------------------------------------- + // -- Pure Grids Units Config ---------------------------------------------- - contextualize: { - normalize: { - src : 'src/base/css/normalize.css', - dest: 'src/base/css/normalize-context.css', + pure_grids: { + default_units: { + dest: 'build/grids-units.css', options: { - prefix: '.pure', - banner: '/* <%= BUILD_COMMENT %> */\n' + units: [5, 24] + } + }, + + responsive: { + dest: 'build/grids-responsive.css', + + options: { + mediaQueries: { + sm: 'screen and (min-width: 35.5em)', // 568px + md: 'screen and (min-width: 48em)', // 768px + lg: 'screen and (min-width: 64em)', // 1024px + xl: 'screen and (min-width: 80em)' // 1280px + } + } + } + }, + + // -- Strip Media Queries Config ------------------------------------------- + + stripmq: { + all: { + files: { + //follows the pattern 'destination': ['source'] + 'build/grids-responsive-old-ie.css': + ['build/grids-responsive.css'] + } + } + }, + + // -- CSS Selectors Config ------------------------------------------------- + + css_selectors: { + base: { + src : 'build/base.css', + dest: 'build/base-context.css', + + options: { + mutations: [{prefix: '.pure'}] } } }, @@ -234,7 +240,7 @@ grunt.initConfig({ observe: { src: { files: 'src/**/css/*.css', - tasks: ['test', 'suppress', 'default'], + tasks: ['test', 'suppress', 'build'], options: { interrupt: true @@ -245,6 +251,7 @@ grunt.initConfig({ // -- Main Tasks --------------------------------------------------------------- +// npm tasks. grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-concat'); @@ -252,169 +259,38 @@ grunt.loadNpmTasks('grunt-contrib-csslint'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-watch'); +grunt.loadNpmTasks('grunt-css-selectors'); +grunt.loadNpmTasks('grunt-pure-grids'); +grunt.loadNpmTasks('grunt-stripmq'); -grunt.registerTask('default', [ +// Local tasks. +grunt.loadTasks('tasks/'); + +grunt.registerTask('default', ['import', 'test', 'build']); +grunt.registerTask('import', ['bower_install']); +grunt.registerTask('test', ['csslint']); +grunt.registerTask('build', [ 'clean:build', 'copy:build', + 'pure_grids', + 'stripmq', 'concat:build', 'clean:build_res', + 'css_selectors:base', 'cssmin', - 'concat:all', 'license' ]); -grunt.registerTask('test', [ - 'csslint' -]); - // Makes the `watch` task run a build first. grunt.renameTask('watch', 'observe'); grunt.registerTask('watch', ['default', 'observe']); -grunt.registerTask('import', [ - 'bower-install', - 'import-normalize' -]); - grunt.registerTask('release', [ - 'test', 'default', 'clean:release', + 'copy:release', + 'bower_json:release', 'compress:release' ]); -// -- Suppress Task ------------------------------------------------------------ - -grunt.registerTask('suppress', function () { - var allowed = ['success', 'fail', 'warn', 'error']; - - grunt.util.hooker.hook(grunt.log, { - passName: true, - - pre: function (name) { - if (allowed.indexOf(name) === -1) { - grunt.log.muted = true; - } - }, - - post: function () { - grunt.log.muted = false; - } - }); -}); - -// -- Import Tasks ------------------------------------------------------------- - -grunt.registerTask('import-normalize', [ - 'clean:base', - 'copy:normalize', - 'contextualize:normalize' -]); - -// -- Bower Task --------------------------------------------------------------- - -grunt.registerTask('bower-install', 'Installs Bower dependencies.', function () { - var bower = require('bower'), - done = this.async(); - - bower.commands.install() - .on('data', function (data) { grunt.log.write(data); }) - .on('end', done); -}); - -// -- License Task ------------------------------------------------------------- - -grunt.registerMultiTask('license', 'Stamps license banners on files.', function () { - var options = this.options({banner: ''}), - banner = grunt.template.process(options.banner), - tally = 0; - - this.files.forEach(function (filePair) { - filePair.src.forEach(function (file) { - grunt.file.write(file, banner + grunt.file.read(file)); - tally += 1; - }); - }); - - grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.'); -}); - -// -- Contextualize Task ------------------------------------------------------- - -grunt.registerMultiTask('contextualize', 'Makes Contextualized CSS files.', function () { - var Parser = require('parserlib').css.Parser, - done = this.async(), - options = this.options({banner: ''}), - banner = grunt.template.process(options.banner), - processing = 0; - - function oneDone() { - if (!(processing -= 1)) { - done(); - } - } - - this.files.forEach(function (filePair) { - filePair.src.forEach(function (file) { - var src = grunt.file.read(file), - contextual = banner, - parser = new Parser(); - - parser.addListener('endstylesheet', function () { - grunt.file.write(filePair.dest, contextual); - grunt.log.writeln('File "' + filePair.dest + '" created.'); - oneDone(); - }); - - // Fired right before CSS properties are parsed for a certain rule. - // Go through and add all the selectors to the `css` string. - parser.addListener('startrule', function (event) { - var prefix = options.prefix; - - event.selectors.forEach(function (selector, i) { - var nextSelector = event.selectors[i + 1]; - - // If the selector does not contain the html selector, we - // can go ahead and prepend `prefix` in front of it. - if (selector.text.indexOf('html') === -1) { - contextual += prefix + ' ' + selector.text; - } else if (selector.text.indexOf('html') !== -1) { - // If it contains `html`, replace the `html` with the - // `prefix`. Replace multiple spaces with a single - // space. This is for the case where - // `html input[type='button']` comes through as - // `html input[type='button']`. - contextual += selector.text.replace('html', prefix).replace(/ +/g, ' '); - } - - // If theres another selector, add a comma. - if (nextSelector) { - contextual += ',\n'; - } else { - // Otherwise, add an opening bracket for properties - contextual += ' {\n'; - } - }); - }); - - // Fired right after CSS properties are parsed for a certain rule. - // Add the closing bracket to end the CSS Rule. - parser.addListener('endrule', function (event) { - contextual += '}\n'; - }); - - // Fired for each property that the parser encounters. Add these - // properties to the `css` string with 4 spaces. - parser.addListener('property', function (event) { - // Add 4 spaces tab. - contextual += ' ' + event.property + ': ' + event.value + ';\n'; - }); - - // Do the parsing. - processing += 1; - parser.parse(src); - }); - }); -}); - }; diff --git a/HISTORY.md b/HISTORY.md index a373b45..445de01 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,10 +1,243 @@ Pure Change History =================== -NEXT ----- +0.5.0 (2014-05-27) +------------------ + +### Base + +* Added the `.pure-img` class name for make images scale with the viewport in + fluid layouts. + +### Grids + +* __[!]__ Removed `.pure-g-r` from core, in favor of a mobile-first responsive + grid system. ([#24][], [#267][]) + + To use the mobile-first grid system, you need to pull in `pure.css`, along + with `grids-responsive.css`. We also have `grids-responsive-old-ie.css` that + you can serve to IE < 9 users so that they can view a desktop-version of your + website: + + ```html + + + + + + + ``` + + Find out more about the new grid system at . + +### Tables + +* Switched cell padding in Tables from `px` to `em` units, and also increased + the amount of padding to `padding: 0.5em 1em`. +[#24]: https://github.com/yui/pure/issues/24 +[#267]: https://github.com/yui/pure/pull/267 + + +0.4.2 (2014-02-13) +------------------ + +* Added `main` to Pure's `bower.json` file to allow easier integration with + build processes and tooling. ([#286][] @stevenvachon) + +### Forms + +* Improved how `` elements look in Chrome by fixing + paddings. ([#283][] @jpetto) + +* Removed `font-size` rules from ``, ``, and `
` + elements within `.pure-form`. Font sizes are now inherited from the + application's CSS file. ([#265][]) + +* Invalid `` elements within a Pure Form no longer explicitly set a + `border-width`. ([#295][] @kwando) + + +[#265]: https://github.com/yui/pure/issues/265 +[#283]: https://github.com/yui/pure/issues/283 +[#286]: https://github.com/yui/pure/issues/286 +[#295]: https://github.com/yui/pure/issues/295 + + +0.4.1 (2014-02-06) +------------------ + +### Base + +* Elements that have Pure classnames which set a `display` declaration _and_ use + the `hidden` HTML attribute will now properly be hidden. With these changes, + the following button will be hidden from view: + + ```html + + ``` + + A new rule for the `[hidden]` selector has been added with the declaration: + `display: none !important;`. This is a time where it's appropriate for a + project like Pure to use `!important`. ([#177][]) + +### Buttons + +* Removed all the occurrences of `-ms-linear-gradient()` from Buttons since it + has never been in the final version of IE 10. ([#200][]: @AurelioDeRosa) + +* `` Buttons now have the same height as non-input buttons. + `font-family: inherit;` has been added to the `.pure-button` selector to + normalize the difference in height. ([#221][] @narcis-radu) + +* Buttons now have visually uniform default `padding` on all four sides. The + left/right padding is 2x the top/bottom padding. ([#191][] @achalv) + +### Forms + +* Added `vertical-align: top;` to `

-
- -
- Inputs as siblings of labels -

-

-

-

-

-

-

-

- -

-

-

-

- -

-

-
- -
- Clickable inputs and buttons -

-

-

-

-

- - -

-

-

-

-
- -
- box-sizing tests -
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
-
-
- - - - diff --git a/src/buttons/css/buttons.css b/src/buttons/css/buttons.css index a7355e8..95e2fd8 100644 --- a/src/buttons/css/buttons.css +++ b/src/buttons/css/buttons.css @@ -1,10 +1,11 @@ -/*csslint unqualified-attributes:false, outline-none:false*/ +/*csslint outline-none:false*/ .pure-button { + font-family: inherit; font-size: 100%; *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ - padding: 0.5em 1.5em 0.5em; + padding: 0.5em 1em; color: #444; /* rgba not supported (IE 8) */ color: rgba(0, 0, 0, 0.80); /* rgba supported */ *color: #444; /* IE 6 & 7 */ @@ -13,13 +14,6 @@ background-color: #E6E6E6; text-decoration: none; border-radius: 2px; - -webkit-font-smoothing: antialiased; - /* Transitions */ - -webkit-transition: 0.1s linear -webkit-box-shadow; - -moz-transition: 0.1s linear -moz-box-shadow; - -ms-transition: 0.1s linear box-shadow; - -o-transition: 0.1s linear box-shadow; - transition: 0.1s linear box-shadow; } .pure-button-hover, @@ -29,7 +23,6 @@ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); - background-image: -ms-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); } diff --git a/src/buttons/tests/manual/button.html b/src/buttons/tests/manual/button.html index c9766f6..22ffb95 100644 --- a/src/buttons/tests/manual/button.html +++ b/src/buttons/tests/manual/button.html @@ -1,10 +1,14 @@ - Button Manual Tests - - - + + Buttons Tests + + + + + + -

Test Button Styles

+

Buttons Tests

Regular Buttons

@@ -89,13 +97,13 @@

- - + Start Playing Movie

@@ -108,5 +116,14 @@

+ +

Primary Form Buttons (Custom Fonts)

+

+ Anchor + + + + +

diff --git a/src/forms/css/forms-core.css b/src/forms/css/forms-core.css deleted file mode 100644 index e52055e..0000000 --- a/src/forms/css/forms-core.css +++ /dev/null @@ -1,149 +0,0 @@ -/* This page has Normalize.css form-specific style rules applied to a .pure-form context */ - -/* ========== - Forms Core - =========*/ - -/* - * Corrects margin displayed oddly in IE 6/7. - */ - -.pure-form { - margin: 0; -} - -/* - * Define consistent border, margin, and padding. - */ - -.pure-form fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/* - * 1. Corrects color not being inherited in IE 6/7/8/9. - * 2. Corrects text not wrapping in Firefox 3. - * 3. Corrects alignment displayed oddly in IE 6/7. - */ - -.pure-form legend { - border: 0; /* 1 */ - padding: 0; - white-space: normal; /* 2 */ - *margin-left: -7px; /* 3 */ -} - -/* - * 1. Corrects font size not being inherited in all browsers. - * 2. Addresses margins set differently in IE 6/7, Firefox 3+, Safari 5, - * and Chrome. - * 3. Improves appearance and consistency in all browsers. - */ - -.pure-form button, -.pure-form input, -.pure-form select, -.pure-form textarea { - font-size: 100%; /* 1 */ - margin: 0; /* 2 */ - vertical-align: baseline; /* 3 */ - *vertical-align: middle; /* 3 */ -} - -/* - * Addresses Firefox 3+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -.pure-form button, -.pure-form input { - line-height: normal; -} - -/* - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Corrects inability to style clickable `input` types in iOS. - * 3. Improves usability and consistency of cursor style between image-type - * `input` and others. - * 4. Removes inner spacing in IE 7 without affecting normal text inputs. - * Known issue: inner spacing remains in IE 6. - */ - -.pure-form button, -.pure-form input[type="button"], /* 1 */ -.pure-form input[type="reset"], -.pure-form input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ - *overflow: visible; /* 4 */ -} - -/* - * Re-set default cursor for disabled elements. - */ - -.pure-form button[disabled], -.pure-form input[disabled] { - cursor: default; -} - -/* - * 1. Addresses box sizing set to content-box in IE 8/9. - * 2. Removes excess padding in IE 8/9. - * 3. Removes excess padding in IE 7. - * Known issue: excess padding remains in IE 6. - */ - -.pure-form input[type="checkbox"], -.pure-form input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ - *height: 13px; /* 3 */ - *width: 13px; /* 3 */ -} - -/* - * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. - * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome - * (include `-moz` to future-proof). - */ - -.pure-form input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; -} - -/* - * Removes inner padding and search cancel button in Safari 5 and Chrome - * on OS X. - */ - -.pure-form input[type="search"]::-webkit-search-cancel-button, -.pure-form input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* - * Removes inner padding and border in Firefox 3+. - */ - -.pure-form button::-moz-focus-inner, -.pure-form input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/* - * 1. Removes default vertical scrollbar in IE 6/7/8/9. - * 2. Improves readability and alignment in all browsers. - */ - -.pure-form textarea { - overflow: auto; /* 1 */ - vertical-align: top; /* 2 */ -} diff --git a/src/forms/css/forms-r.css b/src/forms/css/forms-r.css index 4e42e11..dab2758 100644 --- a/src/forms/css/forms-r.css +++ b/src/forms/css/forms-r.css @@ -3,6 +3,7 @@ margin: 0.7em 0 0; } + .pure-form input:not([type]), .pure-form input[type="text"], .pure-form input[type="password"], .pure-form input[type="email"], @@ -22,6 +23,7 @@ display: block; } + .pure-group input:not([type]), .pure-group input[type="text"], .pure-group input[type="password"], .pure-group input[type="email"], @@ -55,7 +57,7 @@ .pure-form-message-inline, .pure-form-message { display: block; - font-size: 80%; + font-size: 0.75em; /* Increased bottom padding to make it group with its related input element. */ padding: 0.2em 0 0.8em; } diff --git a/src/forms/css/forms.css b/src/forms/css/forms.css index 79d7b3c..d70e17f 100644 --- a/src/forms/css/forms.css +++ b/src/forms/css/forms.css @@ -17,20 +17,36 @@ padding: 0.5em 0.6em; display: inline-block; border: 1px solid #ccc; - font-size: 0.8em; box-shadow: inset 0 1px 3px #ddd; border-radius: 4px; - -webkit-transition: 0.3s linear border; - -moz-transition: 0.3s linear border; - -ms-transition: 0.3s linear border; - -o-transition: 0.3s linear border; - transition: 0.3s linear border; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; - -webkit-font-smoothing: antialiased; } +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]) { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +/* Chrome (as of v.32/34 on OS X) needs additional room for color to display. */ +/* May be able to remove this tweak as color inputs become more standardized across browsers. */ +.pure-form input[type="color"] { + padding: 0.2em 0.5em; +} + + .pure-form input[type="text"]:focus, .pure-form input[type="password"]:focus, .pure-form input[type="email"]:focus, @@ -52,6 +68,16 @@ border-color: #129FEA; } +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]):focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + .pure-form input[type="file"]:focus, .pure-form input[type="radio"]:focus, .pure-form input[type="checkbox"]:focus { @@ -63,6 +89,7 @@ margin: 0.5em 0; display: block; } + .pure-form input[type="text"][disabled], .pure-form input[type="password"][disabled], .pure-form input[type="email"][disabled], @@ -83,23 +110,29 @@ background-color: #eaeded; color: #cad2d3; } + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type])[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} .pure-form input[readonly], .pure-form select[readonly], -.pure-form textarea[readonly], -.pure-form input[readonly]:focus, -.pure-form select[readonly]:focus, -.pure-form textarea[readonly]:focus { +.pure-form textarea[readonly] { background: #eee; /* menu hover bg color */ color: #777; /* menu text color */ border-color: #ccc; } - .pure-form input:focus:invalid, .pure-form textarea:focus:invalid, .pure-form select:focus:invalid { color: #b94a48; - border: 1px solid #ee5f5b; + border-color: #ee5f5b; } .pure-form input:focus:invalid:focus, .pure-form textarea:focus:invalid:focus, @@ -120,7 +153,6 @@ } .pure-form label { margin: 0.5em 0 0.2em; - font-size: 90%; } .pure-form fieldset { margin: 0; @@ -132,7 +164,6 @@ width: 100%; padding: 0.3em 0; margin-bottom: 0.3em; - font-size: 125%; color: #333; border-bottom: 1px solid #e5e5e5; } @@ -158,6 +189,14 @@ margin: 0.25em 0; } +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form-stacked input:not([type]) { + display: block; + margin: 0.25em 0; +} .pure-form-aligned input, .pure-form-aligned textarea, .pure-form-aligned select, @@ -169,6 +208,9 @@ *zoom: 1; vertical-align: middle; } +.pure-form-aligned textarea { + vertical-align: top; +} /* Aligned Forms */ .pure-form-aligned .pure-control-group { @@ -243,12 +285,12 @@ padding-left: 0.3em; color: #666; vertical-align: middle; - font-size: 90%; + font-size: 0.875em; } /* Block help for forms */ .pure-form-message { display: block; color: #666; - font-size: 90%; + font-size: 0.875em; } diff --git a/src/forms/tests/manual/forms.html b/src/forms/tests/manual/forms.html index 9a8e722..f8384cc 100644 --- a/src/forms/tests/manual/forms.html +++ b/src/forms/tests/manual/forms.html @@ -1,334 +1,349 @@ - - - Forms CSS Manual Test - - - - + + + Forms Tests - + + + + + - -
+ +

Forms Tests

Default Form

-
- A default inline form. - - - - -
+
+ A default inline form. + + + + + + + +
-

Multi-Column Form (with YUI Grids)

-

- Multi-column forms such as the one below can be created by pulling down YUI Grids. -

+

Multi-Column Form with Grids

-
-
- Legend + +
+ Legend -
-
- - -
-
- - -
-
- - -
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
-
- - -
+ -
- - -
-
- - - -
- + + +
+

Stacked Form

-

- Apply stacked label styling to any form by applying the pure-form-stacked classname. -

-
- Legend - - - - - - - - - - +
+ Legend - - - - - + + -
- + + -

Aligned Form

+ + + -

Aligned forms are great for standard forms that look well-aligned. The labels are right-aligned against the form input controls.

+ + + -
-
-
- - - -
+ + -
- - - -
+ + -
- - -
-
- - -
+ -
- - -
- -
- - -
-
-
- -

Grouped Inputs

- -

Grouped inputs are great for grouping small sets of text-based input elements. They work well for sign-up forms, and look natural on mobile devices.

- -
-
- - - -
-
- - - -
-
- - - - -

Input Sizing

- -

You can take advantage of YUI Grids and the pure-input-block class to create fluid width inputs in practically any size that you want.

- -
-
-
-
-
-
-
- -
-
-
- -
-
- -
- - -
- -
-
- -
- - -
- -
-
- -
-
- -
-
- -
- - -
- -
-
- -
-
- -
- -
- -
-
-
- -

Invalid Inputs

-

Add the required attribute to any form control.

-
- -
- -

Disabled Inputs

-

Add the disabled attribute to any form control.

-
- -
- -

Readonly Inputs

-

Add the readonly attribute to any form control.

-
- -
- -

Rounded Form

-

Add the pure-input-rounded classname to any form control.

- -
- - - - - - + + +
-

Selects

-
- +

Aligned Form

+ + +
+
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+
+
- - +

Grouped Inputs

-

Checkboxes and Radios

-
- + +
+ + + +
- - -
+
+ + + +
+ -

Help text

-
-
- - - -
-
-
-
-
-
- Anchor - - - - -
-
-
+

Input Sizing

+ +
+
+
+
+
+
+
+ + +
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ + +

Invalid Inputs

+ +
+ +
+ + +

Disabled Inputs

+ +
+ +
+ + +

Readonly Inputs

+ +
+ +
+ + +

Rounded Form

+ +
+ + + + + + + + +
+ + +

Selects

+ +
+ + + +
+ + +

Checkboxes and Radios

+ +
+ + + + + +
+ + +

Help text

+ +
+
+ + + +
+
+ + +

Buttons

+ +
+ Anchor + + + + +
diff --git a/src/grids/README.md b/src/grids/README.md new file mode 100644 index 0000000..04397bf --- /dev/null +++ b/src/grids/README.md @@ -0,0 +1,13 @@ +Pure Grids +========== + +Pure Grids ship with build-in 5ths- and 24ths-based units styles. The unit style +rules are generated via Pure's [`rework-pure-grids`][rework-pure-grids] +[Rework][] plugin. + +The tooling used by Pure to generate its built-in Grids can also be used to +create custom Grids that use any nth-unit base. + + +[rework-pure-grids]: https://github.com/ericf/rework-pure-grids +[Rework]: https://github.com/visionmedia/rework diff --git a/src/grids/css/grids-core.css b/src/grids/css/grids-core.css index 5b8cb8c..d9362f4 100644 --- a/src/grids/css/grids-core.css +++ b/src/grids/css/grids-core.css @@ -1,8 +1,42 @@ +/*csslint regex-selectors:false, known-properties:false, duplicate-properties:false*/ + .pure-g { letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ *letter-spacing: normal; /* reset IE < 8 */ *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ + + /* + Sets the font stack to fonts known to work properly with the above letter + and word spacings. See: https://github.com/yui/pure/issues/41/ + + The following font stack makes Pure Grids work on all known environments. + + * FreeSans: Ships with many Linux distros, including Ubuntu + + * Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and + Arial to get picked up by the browser, even though neither is available + in Chrome OS. + + * Droid Sans: Ships with all versions of Android. + + * Helvetica, Arial, sans-serif: Common font stack on OS X and Windows. + */ + font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; + + /* + Use flexbox when possible to avoid `letter-spacing` side-effects. + + NOTE: Firefox (as of 25) does not currently support flex-wrap, so the + `-moz-` prefix version is omitted. + */ + + display: -webkit-flex; + -webkit-flex-flow: row wrap; + + /* IE10 uses display: flexbox */ + display: -ms-flexbox; + -ms-flex-flow: row wrap; } /* Opera as of 12 on Windows needs word-spacing. @@ -23,3 +57,11 @@ vertical-align: top; text-rendering: auto; } + +/* +Resets the font family back to the OS/browser's default sans-serif font, +this the same font stack that Normalize.css sets for the `body`. +*/ +.pure-g [class *= "pure-u"] { + font-family: sans-serif; +} diff --git a/src/grids/css/grids-r.css b/src/grids/css/grids-r.css deleted file mode 100644 index abccefd..0000000 --- a/src/grids/css/grids-r.css +++ /dev/null @@ -1,61 +0,0 @@ -/*csslint regex-selectors:false, unqualified-attributes:false*/ - -.pure-g-r { - letter-spacing: -0.31em; - *letter-spacing: normal; - *word-spacing: -0.43em; -} - -/* Opera as of 12 on Windows needs word-spacing. - The ".opera-only" selector is used to prevent actual prefocus styling - and is not required in markup. -*/ -.opera-only :-o-prefocus, -.pure-g-r { - word-spacing: -0.43em; -} - -.pure-g-r img { - max-width: 100%; -} - -@media (min-width: 980px) { - .pure-visible-phone { - display: none; - } - .pure-visible-tablet { - display: none; - } - .pure-hidden-desktop { - display: none; - } -} - -@media (max-width: 480px) { - .pure-g-r > .pure-u, - .pure-g-r > [class *= "pure-u-"] { - width: 100%; - } -} - -@media (max-width: 767px) { - .pure-g-r > .pure-u, - .pure-g-r > [class *= "pure-u-"] { - width: 100%; - } - .pure-hidden-phone { - display: none; - } - .pure-visible-desktop { - display: none; - } -} - -@media (min-width: 768px) and (max-width: 979px) { - .pure-hidden-tablet { - display: none; - } - .pure-visible-desktop { - display: none; - } -} diff --git a/src/grids/css/grids-units.css b/src/grids/css/grids-units.css deleted file mode 100644 index 23f5858..0000000 --- a/src/grids/css/grids-units.css +++ /dev/null @@ -1,148 +0,0 @@ -.pure-u-1, -.pure-u-1-2, -.pure-u-1-3, -.pure-u-2-3, -.pure-u-1-4, -.pure-u-3-4, -.pure-u-1-5, -.pure-u-2-5, -.pure-u-3-5, -.pure-u-4-5, -.pure-u-1-6, -.pure-u-5-6, -.pure-u-1-8, -.pure-u-3-8, -.pure-u-5-8, -.pure-u-7-8, -.pure-u-1-12, -.pure-u-5-12, -.pure-u-7-12, -.pure-u-11-12, -.pure-u-1-24, -.pure-u-5-24, -.pure-u-7-24, -.pure-u-11-24, -.pure-u-13-24, -.pure-u-17-24, -.pure-u-19-24, -.pure-u-23-24 { - display: inline-block; - *display: inline; /* IE < 8: fake inline-block */ - zoom: 1; - letter-spacing: normal; - word-spacing: normal; - vertical-align: top; - text-rendering: auto; -} - -.pure-u-1 { - width: 100%; -} - -.pure-u-1-2 { - width: 50%; -} - -.pure-u-1-3 { - width: 33.33333%; -} - -.pure-u-2-3 { - width: 66.66666%; -} - -.pure-u-1-4 { - width: 25%; -} - -.pure-u-3-4 { - width: 75%; -} - -.pure-u-1-5 { - width: 20%; -} - -.pure-u-2-5 { - width: 40%; -} - -.pure-u-3-5 { - width: 60%; -} - -.pure-u-4-5 { - width: 80%; -} - -.pure-u-1-6 { - width: 16.666%; -} - -.pure-u-5-6 { - width: 83.33%; -} - -.pure-u-1-8 { - width: 12.5%; -} - -.pure-u-3-8 { - width: 37.5%; -} - -.pure-u-5-8 { - width: 62.5%; -} - -.pure-u-7-8 { - width: 87.5%; -} - -.pure-u-1-12 { - width: 8.3333%; -} - -.pure-u-5-12 { - width: 41.6666%; -} - -.pure-u-7-12 { - width: 58.3333%; -} - -.pure-u-11-12 { - width: 91.6666%; -} - -.pure-u-1-24 { - width: 4.1666%; -} - -.pure-u-5-24 { - width: 20.8333%; -} - -.pure-u-7-24 { - width: 29.1666%; -} - -.pure-u-11-24 { - width: 45.8333%; -} - -.pure-u-13-24 { - width: 54.1666%; -} - -.pure-u-17-24 { - width: 70.8333%; -} - -.pure-u-19-24 { - width: 79.1666%; -} - -.pure-u-23-24 { - width: 95.8333%; -} diff --git a/src/grids/tests/manual/responsive.html b/src/grids/tests/manual/responsive.html index 361907e..4d4342a 100644 --- a/src/grids/tests/manual/responsive.html +++ b/src/grids/tests/manual/responsive.html @@ -1,174 +1,450 @@ - - Responsive Grids Test + + + Responsive Grids Tests + + + + + + + + + + - -
+ +

Grids Tests

-

Pure Responsive Grids

-

An example of making your Pure Grids behave responsively.

+

Base Grid

+
+
+
1/2
+
+
+
1/2
+
-
-

How does it work?

-
-
-

Pure Responsive Grids builds on top of the existing Pure Grids implementation. It adds a single new class name called .pure-g-r. You can use this instead of using .pure-g as you normally do. All elements with a class name of .pure-u-*-* will automatically become responsive if they are direct descendents of a .pure-g-r.

- -

The HTML

-

The first gist shows how regular Pure grids are written. These grids are unresponsive. They'll always be one-thirds irrespective of the width of the screen. The second gist replaces the pure-g with pure-g-r, thereby making the one-third columns collapse to full width on lower screen widths.

-
+
+
+
1/4
- - -

Features.

-
-
-
    -
  • Adds configurable media queries for different screen widths (Desktops, Landscape Tablets, Portrait Tablets, Phones)
  • -
  • Collapses elements to 100% if smaller than a certain width (767px by default)
  • -
  • Adjusts images to fit on smaller screens
  • -
  • Works with as many columns as you want (or as few)
  • -
+
+
1/4
+
+
+
1/4
+
+
+
1/4
-
-
-

Example.

-
-
-

Fast

-

YUI's lightweight core and modular architecture make it scalable, fast, and robust. Built by frontend engineers at Yahoo!, YUI powers the most popular websites in the world.

-
-
- -
-
-

Complete

-

YUI's intuitive and well-documented API takes you from basic DOM handling to building performant and maintainable applications on desktop browsers, mobile devices, and servers.

-
-
-
-
-

Industrial Strength

-

A thriving community, a carefully architected infrastructure, and a comprehensive suite of tools help you code like a pro, from simple web pages to complex web applications.

-
-
-
-
-

Free and Open

-

YUI is free for all uses and is developed in the open on GitHub. Core team members can always be found in the forums and the #yui IRC channel on Freenode. Pull requests welcome!

-
-
- -
- test image +
+
+
3/4
+
+
1/4
+
+
+
+
+
1/3
+
+
+
1/3
+
+
+
1/3
+
+
+ +
+
+
1/3
+
+
+
2/3
+
+
+ +
+
+
1/5
+
-
-

Two-Fifth Column

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fermentum dui turpis. Duis nulla dolor, suscipit in venenatis vitae, auctor eu nibh. Proin lobortis arcu nec tellus vehicula vitae pellentesque nisi molestie. Aenean felis ligula, hendrerit id dictum sed, ornare nec leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec non lectus et quam porttitor dignissim vitae ac odio. Aenean mattis dui porta lacus egestas ultricies. Mauris vel dolor libero, sit amet rhoncus nibh.

-
+
2/5
+
+
2/5
+
+
+
-
-

Three-Fifth Column

-

Quisque ac magna eget est porta varius ut eget quam. Curabitur tincidunt gravida nisl, vitae luctus velit vulputate vel. Aliquam sed sodales orci. Proin varius placerat magna tristique tincidunt. Morbi non dignissim felis. Proin bibendum libero nec felis eleifend porttitor. Morbi auctor venenatis justo, molestie luctus mi pulvinar nec. Pellentesque vitae ornare lacus. Nulla hendrerit tempor auctor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus facilisis cursus. Integer in lacinia dui. Phasellus ullamcorper, sem at congue pretium, velit sapien ornare mi, eu eleifend risus sapien ac eros.

+
3/5
+
+
+
2/5
+
+
-

Fusce accumsan, sem vitae tempus tempor, nulla lectus interdum felis, eget molestie urna mauris vel elit. Curabitur vel ipsum nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam viverra, augue et sollicitudin dignissim, lectus tellus imperdiet lectus, a tempor ipsum mauris vitae augue. Nullam vel nulla a purus cursus consequat. Nulla orci elit, malesuada nec egestas non, ornare quis nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

+
+
+
1/6
+
+
+
1/6
+
+
+
1/6
+
+
+
1/6
+
+
+
1/6
+
+
+
1/6
+
+
+ +
+
+
1/6
+
+
+
5/6
+
+
+ +
+
+
1/8
+
+
+
3/8
+
+
+
3/8
+
+
+
1/8
+
+
+ +
+
+
3/8
+
+
+
5/8
+
+
+ +
+
+
7/8
+
+
+
1/8
+
+
+ +
+
+
1/4
+
+
+
1/2
+
+
+
1/4
+
+
+ +
+
+
1/8
+
+
+
1/2
+
+
+
1/8
+
+
+
1/4
+
+
+ +
+
+
1/12
+
+
+
5/12
+
+
+
1/12
+
+
+
5/12
+
+
+ +
+
+
7/12
+
+
+
5/12
+
+
+ +
+
+
1/12
+
+
+
11/12
+
+
+ +
+
+
1/24
+
+
+
5/24
+
+
+
7/24
+
+
+
11/24
+
+
+ +
+
+
17/24
+
+
+
7/24
+
+
+ +
+
+
19/24
+
+
+
5/24
+
+
+ +
+
+
1/24
+
+
+
23/24
+
+
+ + +

Custom Font and Grids

+ +
+

+ Grids with a serif font stack. +

+ +
+
+
+
+
+
Nested 1/2
+
+
+
Nested 1/2
+
+
+
+
+ +
+
+
+
+
r1/4
+
+
+
r1/4
+
+
+
r1/4
+
+
+
r1/4
+
+
+
-
-

Grids on mobile

-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
-
-
-
-

Thirds

-

This cell will be a grid even on mobile devices.

-
+ +
+

+ Grids with a monospace font stack. +

+ +
+
+
+
+
+
Nested 1/2
+
+
+
Nested 1/2
+
+
+
+
+ +
+
+
+
+
r1/4
+
+
+
r1/4
+
+
+
r1/4
+
+
+
r1/4
+
+
+
+
-
-

Helper Classes

-
-
-

No Phones Allowed

-

Should be hidden on phones

-
+

Wrapping Grids

+ +
+
+
Wrapping 1/2
-
-
-

No Tablets Allowed

-

Should be hidden on tablets

-
+
+
Wrapping 1/2
-
-
-

No big screens allowed.

-

Should be hidden on desktops/laptops

-
+
+
Wrapping 1/3
+ +

Responsive Grids

+
+
+
1 -> 1/2 -> 1/4
+
+
+
1 -> 1/2 -> 1/4
+
+
+
1 -> 1/2 -> 1/4
+
+
+
1 -> 1/2 -> 1/4
+
+
+ +

Nested Responsive Grids

+
+
+
+
+
+
1 -> 1/2
+
+
+
1 -> 1/2
+
+
+
+
+ +
+
+
+
+
1/4 -> 1/8
+
+
+
1/4 -> 1/8
+
+
+
1/4 -> 3/8
+
+
+
1/4 -> 3/8
+
+
+
+
+
+ +

.pure-img Images

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ diff --git a/src/menus/css/menus-core.css b/src/menus/css/menus-core.css index cff3cef..5eff72f 100644 --- a/src/menus/css/menus-core.css +++ b/src/menus/css/menus-core.css @@ -4,22 +4,26 @@ -moz-box-sizing: border-box; box-sizing: border-box; } + .pure-menu-list, .pure-menu-item { position: relative; } + .pure-menu-list { list-style: none; margin: 0; padding: 0; display: inline-block; } + .pure-menu-item { padding: 0; margin: 0; height: 100%; text-align: left; } + .pure-menu-link, .pure-menu-heading, .pure-menu-responsive-toggle { @@ -36,7 +40,6 @@ vertical-align: middle; } - /* FIXED MENU */ .pure-menu-fixed { position: fixed; @@ -45,7 +48,6 @@ width: 100%; } - /* HORIZONTAL MENU */ .pure-menu-horizontal { width: 100%; diff --git a/src/menus/tests/manual/menus.html b/src/menus/tests/manual/menus.html index b8a6527..398a2ed 100644 --- a/src/menus/tests/manual/menus.html +++ b/src/menus/tests/manual/menus.html @@ -49,9 +49,6 @@ margin-right: 15px; color: white; } - - - diff --git a/src/tables/css/tables.css b/src/tables/css/tables.css index 5d8d81d..ef4ba92 100644 --- a/src/tables/css/tables.css +++ b/src/tables/css/tables.css @@ -20,7 +20,7 @@ font-size: inherit; margin: 0; overflow: visible; /*to make ths where the title is really long work*/ - padding: 6px 12px; /* cell padding */ + padding: 0.5em 1em; /* cell padding */ } .pure-table td:first-child, .pure-table th:first-child { @@ -55,8 +55,7 @@ striping: .pure-table-bordered td { border-bottom: 1px solid #cbcbcb; } -.pure-table-bordered tbody > tr:last-child td, -.pure-table-horizontal tbody > tr:last-child td { +.pure-table-bordered tbody > tr:last-child > td { border-bottom-width: 0; } @@ -68,6 +67,6 @@ striping: border-width: 0 0 1px 0; border-bottom: 1px solid #cbcbcb; } -.pure-table-horizontal tbody > tr:last-child td { +.pure-table-horizontal tbody > tr:last-child > td { border-bottom-width: 0; } diff --git a/src/tables/tests/manual/tables.html b/src/tables/tests/manual/tables.html index 3f4b459..54f4f36 100644 --- a/src/tables/tests/manual/tables.html +++ b/src/tables/tests/manual/tables.html @@ -1,251 +1,329 @@ - - - + + + -
-

Pure Table CSS

-

- Simple CSS for HTML Tables -

-
+

Tables Tests

-

Default Table

+

Default Table

-

Add the pure-table classname to a table to style an HTML table This class adds appropriate padding and borders to table elements, and increases the emphasis on the header.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
-

Bordered Table

-

To add horizontal and vertical borders to all cells, add the pure-table-bordered classname to the table element.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
+

Bordered Table

-

Table with Horizontal Borders

-

If you prefer to just have horizontal lines, add the pure-table-horizontal classname to the table element.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
-

Striped Table

-

Large tables are easier to parse visually if rows are easily distinguishable. Adding the pure-table-odd class name to every other tr element changes the background of the row and creates a zebra-styled effect.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
4FordFocus2008
5NissanSentra2011
6BMWM32009
7HondaCivic2010
8KiaSoul2010
+

Table with Horizontal Borders

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
+

Striped Table

-

Nth Child Selector Styling

-

Here's a striped table that's zebra-styled using nth-child selectors.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
4FordFocus2008
5NissanSentra2011
6BMWM32009
7HondaCivic2010
8KiaSoul2010
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
4FordFocus2008
5NissanSentra2011
6BMWM32009
7HondaCivic2010
8KiaSoul2010
+

Nth Child Selector Styling

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelYear
1HondaAccord2009
2ToyotaCamry2012
3HyundaiElantra2010
4FordFocus2008
5NissanSentra2011
6BMWM32009
7HondaCivic2010
8KiaSoul2010
+ +

Nested Table

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#MakeModelType
1HondaAccord + + + + + + + + + + + + + + + + + +
FuelYear
Diesel2009
Petrol2009
+
2ToyotaCamry + + + + + + + + + + + + + + + + + +
FuelYear
Diesel2012
Petrol2012
+
3HyundaiElantra + + + + + + + + + + + + + + + + + +
FuelYear
Diesel2010
Petrol2010
+
diff --git a/tasks/bower_install.js b/tasks/bower_install.js new file mode 100644 index 0000000..97ab5c3 --- /dev/null +++ b/tasks/bower_install.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = function (grunt) { + grunt.registerTask('bower_install', 'Installs Bower dependencies.', function () { + var bower = require('bower'), + done = this.async(); + + bower.commands.install() + .on('log', function (data) { + if (data.id !== 'install') { return; } + grunt.log.writeln('bower ' + data.id.cyan + ' ' + data.message); + }) + .on('end', function (results) { + if (!Object.keys(results).length) { + grunt.log.writeln('No bower packages to install.'); + } + + done(); + }); + }); +}; diff --git a/tasks/bower_json.js b/tasks/bower_json.js new file mode 100644 index 0000000..9aa339d --- /dev/null +++ b/tasks/bower_json.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require('path'); + +module.exports = function (grunt) { + grunt.registerMultiTask('bower_json', 'Modifies bower.json file.', function (target) { + var values = this.data.values; + + Object.keys(values).forEach(function (key) { + grunt.config.set('bower.' + key, values[key]); + grunt.log.writeln('Updated Bower ' + + String(key).cyan + ': ' + String(values[key]).cyan); + }); + + grunt.file.write(path.join(this.data.dest, 'bower.json'), + JSON.stringify(grunt.config('bower'), null, ' ')); + }); +}; diff --git a/tasks/license.js b/tasks/license.js new file mode 100644 index 0000000..8564cc9 --- /dev/null +++ b/tasks/license.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function (grunt) { + grunt.registerMultiTask('license', 'Stamps license banners on files.', function () { + var options = this.options({banner: ''}), + banner = grunt.template.process(options.banner), + tally = 0; + + this.files.forEach(function (filePair) { + filePair.src.forEach(function (file) { + grunt.file.write(file, banner + grunt.file.read(file)); + tally += 1; + }); + }); + + grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.'); + }); +}; diff --git a/tasks/suppress.js b/tasks/suppress.js new file mode 100644 index 0000000..46602c6 --- /dev/null +++ b/tasks/suppress.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = function (grunt) { + grunt.registerTask('suppress', 'Suppresses noisy logs', function () { + var allowed = ['success', 'fail', 'warn', 'error']; + + grunt.util.hooker.hook(grunt.log, { + passName: true, + + pre: function (name) { + if (allowed.indexOf(name) === -1) { + grunt.log.muted = true; + } + }, + + post: function () { + grunt.log.muted = false; + } + }); + }); +};