concisecss 0.0.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -8
  3. data/app/assets/javascripts/concisecss/dropdown.js +17 -8
  4. data/app/assets/javascripts/concisecss/naver.js +8 -8
  5. data/app/assets/javascripts/concisecss/navigation.js +5 -5
  6. data/app/assets/javascripts/concisecss/non-responsive.js +8 -8
  7. data/app/assets/stylesheets/base/_headings.scss +129 -119
  8. data/app/assets/stylesheets/base/_main.scss +15 -13
  9. data/app/assets/stylesheets/{generic → base}/_print.scss +38 -56
  10. data/app/assets/stylesheets/base/_selection.scss +15 -9
  11. data/app/assets/stylesheets/base/_type.scss +21 -19
  12. data/app/assets/stylesheets/{generic/_shared.scss → base/_vertical-rhythm.scss} +9 -10
  13. data/app/assets/stylesheets/components/_buttons.scss +174 -0
  14. data/app/assets/stylesheets/components/_colors.scss +25 -0
  15. data/app/assets/stylesheets/{objects → components}/_dropdowns.scss +67 -79
  16. data/app/assets/stylesheets/components/_navigation.scss +133 -0
  17. data/app/assets/stylesheets/concise.scss +31 -31
  18. data/app/assets/stylesheets/{generic → helpers}/_clearfix.scss +2 -6
  19. data/app/assets/stylesheets/helpers/_conditional.scss +128 -0
  20. data/app/assets/stylesheets/helpers/_functions.scss +32 -0
  21. data/app/assets/stylesheets/{generic/_helper.scss → helpers/_helpers.scss} +29 -38
  22. data/app/assets/stylesheets/helpers/_mixins.scss +315 -0
  23. data/app/assets/stylesheets/{generic → helpers}/_normalize.scss +35 -35
  24. data/app/assets/stylesheets/{_defaults.scss → helpers/_variables.scss} +68 -78
  25. data/app/assets/stylesheets/layout/_container.scss +17 -0
  26. data/app/assets/stylesheets/layout/_forms.scss +103 -0
  27. data/app/assets/stylesheets/layout/_grid.scss +71 -0
  28. data/app/assets/stylesheets/layout/_lists.scss +88 -0
  29. data/app/assets/stylesheets/layout/tables.scss +63 -0
  30. data/lib/concisecss/concisecss_source.rb +30 -40
  31. data/lib/concisecss/version.rb +1 -1
  32. metadata +21 -20
  33. data/app/assets/stylesheets/generic/_conditional.scss +0 -126
  34. data/app/assets/stylesheets/generic/_mixins.scss +0 -157
  35. data/app/assets/stylesheets/objects/_badges.scss +0 -53
  36. data/app/assets/stylesheets/objects/_breadcrumbs.scss +0 -35
  37. data/app/assets/stylesheets/objects/_buttons.scss +0 -287
  38. data/app/assets/stylesheets/objects/_colors.scss +0 -48
  39. data/app/assets/stylesheets/objects/_groups.scss +0 -102
  40. data/app/assets/stylesheets/objects/_navigation.scss +0 -382
  41. data/app/assets/stylesheets/objects/_progress.scss +0 -106
  42. data/app/assets/stylesheets/objects/_wells.scss +0 -103
@@ -3,10 +3,6 @@
3
3
  // CLEARFIX
4
4
  //------------------------------------
5
5
  .clearfix {
6
- &:after{
7
- content: "";
8
- display: table;
9
- clear: both;
10
- }
6
+ @include clearfix();
11
7
  }
12
- }
8
+ }
@@ -0,0 +1,128 @@
1
+ //------------------------------------
2
+ // CONDITIONAL
3
+ //------------------------------------
4
+
5
+ // Silent Classes
6
+ // (mixins have to be used instead of proper silent classes
7
+ // because of the scope of `@include` inside of media queries.)
8
+ @mixin show-conditional {
9
+ display: block;
10
+ visibility: visible;
11
+ }
12
+
13
+ @mixin hide-conditional {
14
+ display: none;
15
+ visibility: hidden;
16
+ }
17
+
18
+
19
+ @if $use-conditional == true {
20
+ // Thanks to Bootstrap for having a good method of
21
+ // showing/hiding content via breakpoints
22
+ // (http://getbootstrap.com/css/#responsive-utilities)
23
+ .show-extra-small,
24
+ .hide-small,
25
+ .hide-medium,
26
+ .hide-large,
27
+ .hide-extra-large,
28
+ .hide-print,
29
+ .hide-hd {
30
+ @include show-conditional;
31
+ }
32
+
33
+ .hide-extra-small,
34
+ .show-small,
35
+ .show-medium,
36
+ .show-large,
37
+ .show-extra-large,
38
+ .show-print,
39
+ .show-hd {
40
+ @include hide-conditional;
41
+ }
42
+
43
+ @include breakpoint(small) {
44
+ .show-small,
45
+ .hide-extra-small,
46
+ .hide-medium,
47
+ .hide-large,
48
+ .hide-extra-large {
49
+ @include show-conditional;
50
+ }
51
+
52
+ .hide-small,
53
+ .show-extra-small,
54
+ .show-medium,
55
+ .show-large,
56
+ .show-extra-large {
57
+ @include hide-conditional;
58
+ }
59
+ }
60
+
61
+ @include breakpoint(medium) {
62
+ .show-medium,
63
+ .hide-small,
64
+ .hide-extra-small,
65
+ .hide-large,
66
+ .hide-extra-large {
67
+ @include show-conditional;
68
+ }
69
+
70
+ .hide-medium,
71
+ .show-small,
72
+ .show-extra-small,
73
+ .show-large,
74
+ .show-extra-large {
75
+ @include hide-conditional;
76
+ }
77
+ }
78
+
79
+ @include breakpoint(large) {
80
+ .show-large,
81
+ .hide-extra-small,
82
+ .hide-small,
83
+ .hide-medium,
84
+ .hide-extra-large {
85
+ @include show-conditional;
86
+ }
87
+
88
+ .hide-large,
89
+ .show-extra-small,
90
+ .show-small,
91
+ .show-medium,
92
+ .show-extra-large {
93
+ @include hide-conditional;
94
+ }
95
+ }
96
+
97
+ @include breakpoint(extra-large) {
98
+ .show-extra-large,
99
+ .hide-extra-small,
100
+ .hide-small,
101
+ .hide-medium,
102
+ .hide-large {
103
+ @include show-conditional;
104
+ }
105
+
106
+ .hide-extra-large,
107
+ .show-extra-small,
108
+ .show-small,
109
+ .show-medium,
110
+ .show-large {
111
+ @include hide-conditional;
112
+ }
113
+ }
114
+
115
+ // HiDPI and retina
116
+ @media only screen and (-moz-min-device-pixel-ratio: 1.5),
117
+ only screen and (-o-min-device-pixel-ratio: 3 / 2),
118
+ only screen and (-webkit-min-device-pixel-ratio: 1.5),
119
+ only screen and (min-device-pixel-ratio: 1.5) {
120
+ .show-hd {
121
+ @include show-conditional;
122
+ }
123
+
124
+ .hide-hd {
125
+ @include hide-conditional;
126
+ }
127
+ }
128
+ }
@@ -0,0 +1,32 @@
1
+ //------------------------------------
2
+ // FUNCTIONS
3
+ //------------------------------------
4
+
5
+ //
6
+ // Calculates proper rem font-size given
7
+ // a pixel amount.
8
+ //
9
+ @function calculate-rem($font-size) {
10
+ $rem-size: ($font-size / $base-font-size) * 1rem;
11
+
12
+ @return $rem-size;
13
+ }
14
+
15
+
16
+ //
17
+ // Calculates proper line-height given a
18
+ // font-size to maintain vertical rhythm.
19
+ //
20
+ @function calculate-line-height($font-size) {
21
+ $line-height-size: ceil($font-size / $base-line-height) * ($base-line-height / $font-size);
22
+
23
+ @return $line-height-size;
24
+ }
25
+
26
+
27
+ //
28
+ // Strips the units from a value (px, em, etc).
29
+ //
30
+ @function strip-units($value) {
31
+ @return $value / ($value * 0 + 1);
32
+ }
@@ -2,42 +2,47 @@
2
2
  //------------------------------------
3
3
  // HELPER
4
4
  //------------------------------------
5
+
5
6
  // Add/remove floats
6
- .float-left { float: left !important; }
7
+ .float-left { float: left; }
7
8
 
8
- .float-right { float: right !important; }
9
+ .float-right { float: right; }
9
10
 
10
- .float-none { float: none !important; }
11
+ .float-none { float: none; }
11
12
 
12
13
 
13
14
  // Position elements
14
- .align-center {
15
+ .align-center,
16
+ %align-center {
15
17
  display: block;
16
18
  margin-left: auto;
17
19
  margin-right: auto;
18
20
  }
19
21
 
20
- .no-margin { margin: 0 !important; }
21
-
22
- .icon-alone { display: inline-block; }
22
+ .no-margin { margin: 0; }
23
23
 
24
24
 
25
25
  // Displaying content
26
- .inline { display: block; }
27
-
28
- @include breakpoint(extra-small) { .inline { display: inline; } }
26
+ .inline { display: inline; }
29
27
 
30
- .show {
28
+ .show,
29
+ %show {
31
30
  display: block;
32
31
  visibility: visible;
33
32
  }
34
33
 
35
- .hide {
34
+ .hide,
35
+ %hide {
36
36
  display: none;
37
37
  visibility: hidden;
38
38
  }
39
39
 
40
- .screen-reader {
40
+
41
+ // Hide text
42
+ .screen-reader,
43
+ %screen-reader,
44
+ .text-hide,
45
+ %text-hide {
41
46
  border: 0;
42
47
  clip: rect(0 0 0 0);
43
48
  height: 1px;
@@ -50,9 +55,10 @@
50
55
 
51
56
 
52
57
  // Full-width elements
53
- .full { width: 100%; }
58
+ .full-width { width: 100%; }
54
59
 
55
- img.full {
60
+ img.full-width,
61
+ %full-width-image {
56
62
  max-width: 100%;
57
63
  height: auto;
58
64
  display: block;
@@ -71,11 +77,14 @@
71
77
 
72
78
 
73
79
  // Font weights
74
- .weight-light { font-weight: 300 !important; }
80
+ .weight-light,
81
+ %weight-light { font-weight: 300; }
75
82
 
76
- .weight-normal { font-weight: 400 !important; }
83
+ .weight-normal,
84
+ %weight-normal { font-weight: 400; }
77
85
 
78
- .weight-semibold { font-weight: 600 !important; }
86
+ .weight-semibold,
87
+ %weight-semibold { font-weight: 600; }
79
88
 
80
89
 
81
90
  // All-caps text
@@ -83,17 +92,7 @@
83
92
 
84
93
 
85
94
  // Stylized ampersand
86
- .amp { font: italic 110% Baskerville, "Goudy Old Style", "Palatino", "Book Antiqua", serif !important; }
87
-
88
-
89
- // Hide text
90
- .text-hide {
91
- border: 0;
92
- background-color: transparent;
93
- color: transparent;
94
- font: 0 / 0 a;
95
- text-shadow: none;
96
- }
95
+ .amp { font: italic 110% Baskerville, "Goudy Old Style", "Palatino", "Book Antiqua", serif; }
97
96
 
98
97
 
99
98
  // Caret icon
@@ -106,12 +105,4 @@
106
105
  vertical-align: middle;
107
106
  width: 0;
108
107
  }
109
-
110
-
111
- // Border radius
112
- .border-radius { border-radius: $border-radius; }
113
-
114
-
115
- // Pill style
116
- .pill { border-radius: 25px; }
117
- }
108
+ }
@@ -0,0 +1,315 @@
1
+ //------------------------------------
2
+ // MIXINS
3
+ //------------------------------------
4
+
5
+ //
6
+ // Uses `calculate-rem()` to calculate rem font-size and px
7
+ // fallback. line-height is calculated with `calculate-line-height()`
8
+ // but passing `false` will prevent that.
9
+ //
10
+ // Parameters:
11
+ // $font-size: the font size (in pixels) to be converted to rem
12
+ // $rem-sizing: if you want to convert the font-size to rem or not (default is true)
13
+ // $line-height: set to false if you wish not to output a calculated line-height (defalt is true)
14
+ //
15
+ // Example:
16
+ // `@include font-size(24px);`
17
+ //
18
+ //
19
+ // Big thanks to inuitcss for inspiration behind this
20
+ // (https://github.com/csswizardry/inuit.css/blob/master/generic/_mixins.scss)
21
+ @mixin font-size($font-size, $rem-sizing: true, $line-height: true) {
22
+ font-size: $font-size;
23
+
24
+ @if $rem-sizing == true {
25
+ font-size: calculate-rem($font-size);
26
+ }
27
+
28
+ @if $line-height == true {
29
+ line-height: calculate-line-height($font-size);
30
+ }
31
+ }
32
+
33
+
34
+ //
35
+ // Proper vendor prefixes are created by passing
36
+ // a property, property value, and browser
37
+ // vendor (webkit, moz, ms, o, etc).
38
+ //
39
+ // Parameters:
40
+ // $property: what CSS property to generate vendor prefixes for
41
+ // $value: the value of what was defined in `$property`
42
+ // $vendors: what vendor prefixes to generate (default is none)
43
+ //
44
+ // Example:
45
+ // `@include vendor(border-radius, 4px, webkit moz ms)`
46
+ //
47
+ //
48
+ @mixin vendor($property, $value, $vendors: "") {
49
+ @each $vendor in $vendors {
50
+ @if $vendor != "" {
51
+ -#{$vendor}-#{$property}: $value;
52
+ }
53
+ }
54
+
55
+ #{$property}: $value;
56
+ }
57
+
58
+
59
+ //
60
+ // Loops through all of the values in the `$breakpoints`
61
+ // map and outputs conditional statements used to generate
62
+ // media query code.
63
+ //
64
+ // When calling the mixin, if the parameter matches a key
65
+ // from the `breakpoints` map, a media query is output with
66
+ // that key's value. If an explicit value is set (ex: 360px)
67
+ // then a media query is output with that value.
68
+ //
69
+ // Parameters:
70
+ // $point: the breakpoint value for the media query output
71
+ //
72
+ // Example:
73
+ // `@include breakpoint(extra-small) { ... }`
74
+ //
75
+ // `@include breakpoint(360px) { ... }`
76
+ //
77
+ //
78
+ @mixin breakpoint($point) {
79
+ @if type-of($point) == string {
80
+ @each $breakpoint-name, $breakpoint-value in $breakpoint-map {
81
+ @if $point == $breakpoint-name {
82
+ @media (min-width: $breakpoint-value) {
83
+ @content;
84
+ }
85
+ }
86
+ }
87
+ } @else {
88
+ @media (min-width: $point) {
89
+ @content;
90
+ }
91
+ }
92
+ }
93
+
94
+
95
+ //
96
+ // Generates property media queries for any CSS property,
97
+ // value, and set of breakpoints. Allows you to easily change
98
+ // property values based a set of breakpoints.
99
+ //
100
+ // Parameters:
101
+ // $properties: what CSS property to output inside of the media queries (can have multiple)
102
+ // $values: the value for each property (can have multiple)
103
+ // $responsive-values: what breakpoints to generate media queries for
104
+ // $use-available-mixins: whether or not to use mixin outputs for properties like `font-size` or `line-height` (default is true)
105
+ //
106
+ // Example:
107
+ // @include responsive("font-size", 11px,
108
+ // (
109
+ // "small" : 12px,
110
+ // 450px : 13px,
111
+ // 1100px : 14px,
112
+ // "large" : 15px,
113
+ // 1600px : 16px,
114
+ // )
115
+ // );
116
+ //
117
+ //
118
+ @mixin responsive($properties, $values, $responsive-values, $use-available-mixins: true) {
119
+ @each $property in $properties {
120
+ @if $property == "font-size" and $use-available-mixins == true {
121
+ #{$property}: $values;
122
+ #{$property}: ($values / $base-font-size) * 1rem;
123
+ } @else if $property == "line-height" and $use-available-mixins == true {
124
+ #{$property}: ceil($values / $base-line-height) * ($base-line-height / $values);
125
+ } @else {
126
+ #{$property}: $values;
127
+ }
128
+ }
129
+
130
+ @each $breakpoint, $value in $responsive-values {
131
+ @if type-of($breakpoint) == string {
132
+ @if(map-has-key($breakpoint-map, $breakpoint)) {
133
+ $breakpoint: map-get($breakpoint-map, $breakpoint);
134
+ } @else {
135
+ $breakpoint: "null";
136
+ @warn "Couldn't find breakpoint: " + $breakpoint;
137
+ }
138
+ }
139
+
140
+ @if $breakpoint != "null" {
141
+ @media (min-width: $breakpoint) {
142
+ @each $property in $properties {
143
+ @if $property == "font-size" and $use-available-mixins == true {
144
+ #{$property}: #{$value};
145
+ #{$property}: ($value / $base-font-size) * 1rem;
146
+ } @else if $property == "line-height" and $use-available-mixins == true {
147
+ #{$property}: ceil($value / $base-line-height) * ($base-line-height / $value);
148
+ } @else {
149
+ #{$property}: #{$value};
150
+ }
151
+ }
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+
158
+ //
159
+ // Generates CSS to wrap semantic columns
160
+ // in a row.
161
+ //
162
+ // Example:
163
+ // `@include row()`
164
+ //
165
+ //
166
+ @mixin row() {
167
+ width: 100%;
168
+
169
+ &:after {
170
+ clear: both;
171
+ content: " ";
172
+ display: table;
173
+ }
174
+ }
175
+
176
+
177
+ //
178
+ // Generates CSS for semantic columns.
179
+ //
180
+ // Parameters:
181
+ // $column: the number of this particular column (determines width)
182
+ // $number-columns: number of columns in the row (default is `$column-number`)
183
+ // $first-column: set to `true` if it's the first column in a row (default is false)
184
+ // $use-gutters: set to `true` if you want column gutters (default is false)
185
+ // $gutter-value: percentage value of the gutters to be applied (default is `$gutters` variable)
186
+ //
187
+ // Example:
188
+ // `@include column(16, 4, false, true, 4)`
189
+ //
190
+ //
191
+ @mixin column($column, $number-columns: $column-number, $first-column: false, $use-gutters: false, $gutter-value: strip-units($gutters)) {
192
+ @include vendor(background-clip, padding-box, webkit);
193
+
194
+ @include breakpoint(small) {
195
+ @if $use-gutters == true {
196
+ $gutter-size: percentage($gutter-value) * 0.01;
197
+ $width-of-column: (100% - $gutter-size * ($number-columns - 1)) / $number-columns;
198
+
199
+ float: left;
200
+ @if $first-column == false {
201
+ margin-left: $gutter-size;
202
+ }
203
+ width: $width-of-column * $column + $gutter-size * ($column - 1);
204
+ } @else {
205
+ float: left;
206
+ width: percentage(100 / $number-columns * $column) * .01;
207
+ }
208
+ }
209
+ }
210
+
211
+
212
+ //
213
+ // Generates CSS for pushing a semantic column left or right.
214
+ //
215
+ // Parameters:
216
+ // $option: set to `push` or `pull` to generate proper styles
217
+ // $column: the column number
218
+ // $number-columns: the number of columns in the row (default is $column-number)
219
+ // $use-gutters: set to `true` if your column has gutters (default is false)
220
+ // $gutter-value: percentage value of the gutters to be applied (default is `$gutters` variable)
221
+ //
222
+ // Example:
223
+ // `@include push-pull(push, 4, 16, true)`
224
+ //
225
+ //
226
+ @mixin push-pull($option, $column, $number-columns: $column-number, $use-gutters: false, $gutter-value: strip-units($gutters)) {
227
+ $property: "";
228
+
229
+ @if $option == "push" {
230
+ $property: "left";
231
+ } @else {
232
+ $property: "right";
233
+ }
234
+
235
+ @if $use-gutters == true {
236
+ #{$property}: 100% / $number-columns * $column - $gutter-value;
237
+ } @else {
238
+ #{$property}: 100% / $number-columns * $column;
239
+ }
240
+ }
241
+
242
+
243
+ //
244
+ // Generates CSS that will clear both left
245
+ // and right floats.
246
+ //
247
+ // Example:
248
+ // `@include clearfix()`
249
+ //
250
+ //
251
+ @mixin clearfix() {
252
+ & {
253
+ &:after{
254
+ content: "";
255
+ display: table;
256
+ clear: both;
257
+ }
258
+ }
259
+ }
260
+
261
+
262
+ //
263
+ // Create variable-number grid columns given the value
264
+ // for variable `$column-number`.
265
+ //
266
+ // NOTE:
267
+ // This is a setup mixin for the Concise grid. If you
268
+ // wish to set up a grid, please use the `row()` and
269
+ // `column()` mixins.
270
+ //
271
+ @mixin grid-setup($number: $column-number) {
272
+ @for $i from 1 through $number {
273
+ $column-width-gutters: (100% - $gutters * ($number - 1)) / $number;
274
+
275
+ .#{$column-prefix + $i} {
276
+ width: 100% / $number * $i;
277
+
278
+ .gutters & {
279
+ width: $column-width-gutters * $i + $gutters * ($i - 1);
280
+ }
281
+ }
282
+ }
283
+ }
284
+
285
+
286
+ //
287
+ // Create `.push-` and `.pull-` classes given
288
+ // the value for variabls `$option` and
289
+ // `$column-number`.
290
+ //
291
+ // NOTE:
292
+ // This is a setup mixin for the push and pull
293
+ // functionality in the Concise grid. If you wish
294
+ // to use that functionality, please use the
295
+ // `push-pull()` mixin.
296
+ //
297
+ @mixin push-pull-setup($option, $number: $column-number) {
298
+ $property: "";
299
+
300
+ @if $option == "push" {
301
+ $property: "left";
302
+ } @else {
303
+ $property: "right";
304
+ }
305
+
306
+ @for $i from 1 to $number {
307
+ .#{$option}-#{$i} {
308
+ #{$property}: 100% / $number * $i;
309
+
310
+ .gutters & {
311
+ #{$property}: 100% / $number * $i - $gutters;
312
+ }
313
+ }
314
+ }
315
+ }