material-sass 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/material.js +48 -92
  4. data/assets/javascripts/material.min.js +4 -4
  5. data/assets/javascripts/material/components/floating-label.js +1 -1
  6. data/assets/javascripts/material/components/nav-drawer.js +12 -39
  7. data/assets/javascripts/material/components/pickdate.js +1 -1
  8. data/assets/javascripts/material/components/tab-switch.js +2 -12
  9. data/assets/javascripts/material/components/util.js +7 -21
  10. data/assets/stylesheets/material/base/_base.scss +0 -1
  11. data/assets/stylesheets/material/bootstrap/_form.scss +41 -17
  12. data/assets/stylesheets/material/material.scss +0 -1
  13. data/assets/stylesheets/material/material/_expansion-panel.scss +1 -0
  14. data/assets/stylesheets/material/material/_selection-control.scss +8 -1
  15. data/assets/stylesheets/material/material/_text-field-box.scss +65 -30
  16. data/assets/stylesheets/material/material/_text-field-floating-label.scss +114 -21
  17. data/assets/stylesheets/material/material/_text-field-input-group.scss +59 -33
  18. data/assets/stylesheets/material/material/_text-field.scss +150 -84
  19. data/assets/stylesheets/material/material/_toolbar.scss +6 -5
  20. data/assets/stylesheets/material/mixins/_form.scss +32 -57
  21. data/assets/stylesheets/material/mixins/_grid-framework.scss +9 -8
  22. data/assets/stylesheets/material/mixins/_text-hide.scss +4 -2
  23. data/assets/stylesheets/material/utilities/_position.scss +5 -3
  24. data/assets/stylesheets/material/utilities/_text.scss +1 -1
  25. data/assets/stylesheets/material/variables/_spacer.scss +5 -5
  26. data/assets/stylesheets/material/variables/_variable-material.scss +6 -3
  27. data/lib/material-sass/version.rb +1 -1
  28. metadata +3 -4
  29. data/assets/stylesheets/material/bootstrap/_custom-form.scss +0 -59
@@ -9,6 +9,7 @@
9
9
  > .custom-select,
10
10
  > .floating-label,
11
11
  > .form-control,
12
+ > .form-control-file,
12
13
  > .textfield-box {
13
14
  flex: 1 1 auto;
14
15
  margin-bottom: 0;
@@ -18,6 +19,7 @@
18
19
  + .custom-select,
19
20
  + .floating-label,
20
21
  + .form-control,
22
+ + .form-control-file,
21
23
  + .textfield-box {
22
24
  margin-left: $input-group-inner-spacer-x;
23
25
  }
@@ -94,25 +96,48 @@
94
96
  }
95
97
 
96
98
  .floating-label:not(.textfield-box) ~ & {
97
- margin-top: $floating-label-font-size-focus;
99
+ margin-top: $floating-label-font-size;
98
100
  }
99
101
  }
100
102
 
101
103
  // Size
102
104
 
103
105
  .input-group-lg {
104
- > .form-control {
105
- @extend %form-control-lg;
106
- }
107
-
108
106
  > .floating-label {
109
107
  @extend .floating-label-lg;
110
108
 
111
109
  &.has-value label,
112
110
  &.is-focused label {
113
- line-height: 1;
114
111
  top: 0;
115
112
  }
113
+
114
+ &.textfield-box.has-value label,
115
+ &.textfield-box.is-focused label {
116
+ top: $textfield-box-label-spacer-y;
117
+ }
118
+
119
+ &:not(.textfield-box) ~ .input-group-icon {
120
+ margin-top: $floating-label-font-size-lg;
121
+ }
122
+ }
123
+
124
+ > %form-control {
125
+ font-size: $textfield-font-size-lg;
126
+ line-height: $textfield-line-height-lg;
127
+ padding: $textfield-padding-y-lg $textfield-padding-x-lg calc(#{$textfield-padding-y-lg} - #{$textfield-border-width});
128
+ }
129
+
130
+ > %form-select {
131
+ padding-right: $textfield-select-bg-size;
132
+ }
133
+
134
+ > %form-textarea {
135
+ padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width});
136
+ }
137
+
138
+ > .form-control[type='file'],
139
+ > .form-control-file {
140
+ max-height: $textfield-box-height-lg;
116
141
  }
117
142
 
118
143
  > .input-group-append,
@@ -134,33 +159,45 @@
134
159
 
135
160
  > .textfield-box {
136
161
  @extend .textfield-box-lg;
137
-
138
- &.floating-label {
139
- &.has-value label,
140
- &.is-focused label {
141
- top: $textfield-box-label-spacer-y;
142
- }
143
-
144
- .form-control {
145
- padding-bottom: ($textfield-box-label-spacer-y - $textfield-border-width / $font-size-root * 1rem);
146
- }
147
- }
148
162
  }
149
163
  }
150
164
 
151
165
  .input-group-sm {
152
- > .form-control {
153
- @extend %form-control-sm;
154
- }
155
-
156
166
  > .floating-label {
157
167
  @extend .floating-label-sm;
158
168
 
159
169
  &.has-value label,
160
170
  &.is-focused label {
161
- line-height: 1;
162
171
  top: 0;
163
172
  }
173
+
174
+ &.textfield-box.has-value label,
175
+ &.textfield-box.is-focused label {
176
+ top: $textfield-box-label-spacer-y;
177
+ }
178
+
179
+ &:not(.textfield-box) ~ .input-group-icon {
180
+ margin-top: $floating-label-font-size-sm;
181
+ }
182
+ }
183
+
184
+ > %form-control {
185
+ font-size: $textfield-font-size-sm;
186
+ line-height: $textfield-line-height-sm;
187
+ padding: $textfield-padding-y-sm $textfield-padding-x-sm calc(#{$textfield-padding-y-sm} - #{$textfield-border-width});
188
+ }
189
+
190
+ > %form-select {
191
+ padding-right: $textfield-select-bg-size;
192
+ }
193
+
194
+ > %form-textarea {
195
+ padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width});
196
+ }
197
+
198
+ > .form-control[type='file'],
199
+ > .form-control-file {
200
+ max-height: $textfield-box-height-sm;
164
201
  }
165
202
 
166
203
  > .input-group-append,
@@ -182,16 +219,5 @@
182
219
 
183
220
  > .textfield-box {
184
221
  @extend .textfield-box-sm;
185
-
186
- &.floating-label {
187
- &.has-value label,
188
- &.is-focused label {
189
- top: $textfield-box-label-spacer-y;
190
- }
191
-
192
- .form-control {
193
- padding-bottom: ($textfield-box-label-spacer-y - $textfield-border-width / $font-size-root * 1rem);
194
- }
195
- }
196
222
  }
197
223
  }
@@ -1,10 +1,6 @@
1
- .form-control,
2
1
  %form-control {
3
- @include form-control-size($textfield-font-size, $textfield-height, $textfield-line-height, $textfield-padding-x, $textfield-padding-y);
4
-
5
2
  background-clip: padding-box;
6
3
  background-color: transparent;
7
- background-image: none;
8
4
  border-color: $textfield-border-color;
9
5
  border-radius: 0;
10
6
  border-style: solid;
@@ -12,6 +8,9 @@
12
8
  box-shadow: none;
13
9
  color: $textfield-color;
14
10
  display: block;
11
+ font-size: $textfield-font-size;
12
+ line-height: $textfield-line-height;
13
+ padding: $textfield-padding-y $textfield-padding-x calc(#{$textfield-padding-y} - #{$textfield-border-width});
15
14
  width: 100%;
16
15
 
17
16
  @include hover {
@@ -35,12 +34,7 @@
35
34
  color: $textfield-color-disabled;
36
35
  opacity: 1;
37
36
 
38
- @include hover {
39
- border-color: $textfield-border-color;
40
- box-shadow: none;
41
- }
42
-
43
- &:focus {
37
+ @include focus-hover {
44
38
  border-color: $textfield-border-color;
45
39
  box-shadow: none;
46
40
  }
@@ -57,147 +51,219 @@
57
51
  }
58
52
  }
59
53
 
60
- @each $color, $values in $theme-colors {
61
- .form-control-#{$color} {
62
- border-color: theme-color($color);
54
+ .form-control {
55
+ @extend %form-control;
63
56
 
64
- @include focus-hover {
65
- border-color: theme-color($color);
66
- box-shadow: inset 0 ($textfield-border-width-focus * -1) 0 ($textfield-border-width * -1) theme-color($color);
67
- }
57
+ &[type='file'] {
58
+ max-height: $textfield-height;
68
59
  }
69
60
  }
70
61
 
71
- .form-control-lg,
72
- %form-control-lg {
73
- @include form-control-size($textfield-font-size-lg, $textfield-height-lg, $textfield-line-height-lg, $textfield-padding-x-lg, $textfield-padding-y-lg);
62
+ // Form control sizing
63
+
64
+ .form-control-lg {
65
+ font-size: $textfield-font-size-lg;
66
+ line-height: $textfield-line-height-lg;
67
+ padding: $textfield-padding-y-lg $textfield-padding-x-lg calc(#{$textfield-padding-y-lg} - #{$textfield-border-width});
68
+
69
+ &[type='file'] {
70
+ max-height: $textfield-height-lg;
71
+ }
74
72
  }
75
73
 
76
- .form-control-sm,
77
- %form-control-sm {
78
- @include form-control-size($textfield-font-size-sm, $textfield-height-sm, $textfield-line-height-sm, $textfield-padding-x-sm, $textfield-padding-y-sm);
74
+ .form-control-sm {
75
+ font-size: $textfield-font-size-sm;
76
+ line-height: $textfield-line-height-sm;
77
+ padding: $textfield-padding-y-sm $textfield-padding-x-sm calc(#{$textfield-padding-y-sm} - #{$textfield-border-width});
78
+
79
+ &[type='file'] {
80
+ max-height: $textfield-height-sm;
81
+ }
79
82
  }
80
83
 
81
- %form-select {
82
- @include form-select-size($textfield-font-size, $textfield-height, $textfield-padding-x);
84
+ // Select and textarea
83
85
 
86
+ %form-select {
84
87
  appearance: none;
85
88
 
86
89
  @include media-moz-webkit {
87
90
  background-image: $caret-bg;
91
+ background-position: 100% 50%;
88
92
  background-repeat: no-repeat;
89
- }
90
-
91
- &.form-control-lg {
92
- @include form-select-size($textfield-font-size-lg, $textfield-height-lg, $textfield-padding-x-lg);
93
- }
93
+ background-size: $textfield-select-bg-size $textfield-select-bg-size;
94
+ padding-right: $textfield-select-bg-size;
94
95
 
95
- &.form-control-sm {
96
- @include form-select-size($textfield-font-size-sm, $textfield-height-sm, $textfield-padding-x-sm);
96
+ &[multiple],
97
+ &[size]:not([size='1']) {
98
+ background-image: none;
99
+ }
97
100
  }
98
101
  }
99
102
 
100
103
  %form-textarea {
101
104
  border-radius: $textfield-box-border-radius;
102
105
  border-width: $textfield-border-width;
103
- height: auto;
104
- padding: $textfield-box-padding-y $textfield-box-padding-x;
106
+ min-height: $textfield-box-height;
107
+ padding: calc(#{$textfield-box-padding-y} - #{$textfield-border-width}) $textfield-box-padding-x;
105
108
 
106
109
  @include hover {
107
110
  box-shadow: inset $textfield-border-width-hover $textfield-border-width-hover 0 ($textfield-border-width * -1) $textfield-border-color-hover, inset ($textfield-border-width-hover * -1) ($textfield-border-width-hover * -1) 0 ($textfield-border-width * -1) $textfield-border-color-hover;
108
111
  }
109
112
 
110
- &.form-control-lg {
111
- padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg;
112
- }
113
-
114
- &.form-control-sm {
115
- padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm;
116
- }
117
-
118
113
  &:focus {
119
114
  box-shadow: inset $textfield-border-width-focus $textfield-border-width-focus 0 ($textfield-border-width * -1) $textfield-border-color-focus, inset ($textfield-border-width-focus * -1) ($textfield-border-width-focus * -1) 0 ($textfield-border-width * -1) $textfield-border-color-focus;
120
115
  }
121
116
  }
122
117
 
123
118
  // stylelint-disable selector-no-qualifying-type
124
- select.form-control {
125
- &[multiple],
126
- &[size] {
127
- @extend %form-textarea;
119
+ select {
120
+ &.form-control {
121
+ @extend %form-select;
122
+
123
+ &[multiple],
124
+ &[size]:not([size='1']) {
125
+ @extend %form-textarea;
126
+ }
128
127
  }
129
128
 
130
- &:not([multiple]):not([size]) {
131
- @extend %form-select;
129
+ &.form-control-lg {
130
+ &[multiple],
131
+ &[size]:not([size='1']) {
132
+ padding: calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width}) $textfield-box-padding-x-lg;
133
+ }
132
134
  }
133
- }
134
135
 
135
- textarea.form-control:not(.textarea-autosize) {
136
- @extend %form-textarea;
136
+ &.form-control-sm {
137
+ &[multiple],
138
+ &[size]:not([size='1']) {
139
+ padding: calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width}) $textfield-box-padding-x-sm;
140
+ }
141
+ }
137
142
  }
138
- // stylelint-enable
139
-
140
- // Form control static
141
143
 
142
- .form-control-plaintext {
143
- @include form-control-size($textfield-font-size, $textfield-height, $textfield-line-height, $textfield-padding-x, $textfield-padding-y);
144
+ textarea {
145
+ &.form-control {
146
+ min-height: $textfield-height;
144
147
 
145
- border-color: transparent;
146
- color: $textfield-plaintext-color;
147
- display: block;
148
- width: 100%;
148
+ &:not([rows='1']) {
149
+ @extend %form-textarea;
150
+ }
151
+ }
149
152
 
150
153
  &.form-control-lg {
151
- @include form-control-size($textfield-font-size-lg, $textfield-height-lg, $textfield-line-height-lg, $textfield-padding-x-lg, $textfield-padding-y-lg);
154
+ min-height: $textfield-height-lg;
155
+
156
+ &:not([rows='1']) {
157
+ min-height: $textfield-box-height-lg;
158
+ padding: calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width}) $textfield-box-padding-x-lg;
159
+ }
152
160
  }
153
161
 
154
162
  &.form-control-sm {
155
- @include form-control-size($textfield-font-size-sm, $textfield-height-sm, $textfield-line-height-sm, $textfield-padding-x-sm, $textfield-padding-y-sm);
163
+ min-height: $textfield-height-sm;
164
+
165
+ &:not([rows='1']) {
166
+ min-height: $textfield-box-height-sm;
167
+ padding: calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width}) $textfield-box-padding-x-sm;
168
+ }
156
169
  }
157
170
  }
171
+ // stylelint-enable
158
172
 
159
- // Form validation
173
+ .custom-file {
174
+ display: inline-block;
175
+ height: $textfield-height;
176
+ margin-bottom: 0;
177
+ position: relative;
178
+ width: 100%;
179
+ }
160
180
 
161
- @include form-validation-state('invalid', $form-feedback-invalid-color);
162
- @include form-validation-state('valid', $form-feedback-valid-color);
181
+ .custom-file-input {
182
+ height: $textfield-height;
183
+ margin: 0;
184
+ opacity: 0;
185
+ position: relative;
186
+ width: 100%;
187
+ z-index: 1;
163
188
 
164
- // Style of Material design `select` should also be applied to `.custom-select`
189
+ @include focus-hover {
190
+ ~ .custom-file-label {
191
+ border-bottom-color: $textfield-border-color-focus;
192
+ box-shadow: inset 0 ($textfield-border-width-focus * -1) 0 ($textfield-border-width * -1) $textfield-border-color-focus;
193
+ }
194
+ }
195
+ }
196
+
197
+ .custom-file-label {
198
+ @include text-truncate;
199
+ @include transition-standard(border-color, box-shadow);
200
+
201
+ border-bottom: $textfield-border-width solid $textfield-border-color;
202
+ color: $textfield-hint-color;
203
+ font-size: $textfield-font-size;
204
+ height: $textfield-height;
205
+ line-height: $textfield-line-height;
206
+ padding: $textfield-padding-y ($material-icon-size + $selection-control-spacer-x) calc(#{$textfield-padding-y} - #{$textfield-border-width}) $textfield-padding-x;
207
+ position: absolute;
208
+ top: 0;
209
+ right: 0;
210
+ left: 0;
211
+
212
+ &::after {
213
+ @include set-material-icons;
214
+
215
+ content: $custom-file-button-icon;
216
+ position: absolute;
217
+ top: 50%;
218
+ right: 0;
219
+ transform: translateY(-50%);
220
+ }
221
+ }
165
222
 
166
223
  .custom-select {
167
224
  @extend %form-control;
225
+ @extend %form-select;
168
226
 
169
227
  &[multiple],
170
- &[size] {
228
+ &[size]:not([size='1']) {
171
229
  @extend %form-textarea;
172
230
  }
173
-
174
- &:not([multiple]):not([size]) {
175
- @extend %form-select;
176
- }
177
231
  }
178
232
 
179
233
  .custom-select-lg {
180
- @extend %form-control-lg;
234
+ font-size: $textfield-font-size-lg;
235
+ line-height: $textfield-line-height-lg;
236
+ padding: $textfield-padding-y-lg $textfield-select-bg-size calc(#{$textfield-padding-y-lg} - #{$textfield-border-width}) $textfield-padding-x-lg;
181
237
 
182
238
  &[multiple],
183
- &[size] {
184
- padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg;
185
- }
186
-
187
- &:not([multiple]):not([size]) {
188
- @include form-select-size($textfield-font-size-lg, $textfield-height-lg, $textfield-padding-x-lg);
239
+ &[size]:not([size='1']) {
240
+ padding: calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width}) $textfield-box-padding-x-lg;
189
241
  }
190
242
  }
191
243
 
192
244
  .custom-select-sm {
193
- @extend %form-control-sm;
245
+ font-size: $textfield-font-size-sm;
246
+ line-height: $textfield-line-height-sm;
247
+ padding: $textfield-padding-y-sm $textfield-select-bg-size calc(#{$textfield-padding-y-sm} - #{$textfield-border-width}) $textfield-padding-x-sm;
194
248
 
195
249
  &[multiple],
196
- &[size] {
197
- padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm;
250
+ &[size]:not([size='1']) {
251
+ padding: calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width}) $textfield-box-padding-x-sm;
198
252
  }
253
+ }
199
254
 
200
- &:not([multiple]):not([size]) {
201
- @include form-select-size($textfield-font-size-sm, $textfield-height-sm, $textfield-padding-x-sm);
202
- }
255
+ .form-control-file {
256
+ @extend %form-control;
257
+
258
+ max-height: $textfield-height;
259
+ }
260
+
261
+ .form-control-range {
262
+ display: block;
263
+ width: 100%;
203
264
  }
265
+
266
+ // Validation
267
+
268
+ @include form-validation-state('invalid', $form-feedback-invalid-color);
269
+ @include form-validation-state('valid', $form-feedback-valid-color);