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
@@ -202,7 +202,7 @@ var PickDate = function ($) {
202
202
 
203
203
  PickDate._jQueryInterface = function _jQueryInterface(config) {
204
204
  return this.each(function () {
205
- var _config = _extends({}, PickDate.Default, $(this).data(), typeof config === 'object' && config);
205
+ var _config = _extends({}, Default, $(this).data(), typeof config === 'object' && config ? config : {});
206
206
 
207
207
  var data = $(this).data(DATA_KEY);
208
208
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Tab indicator animation
3
- * Requires Bootstrap's (v4.1.0) `tab.js`
3
+ * Requires Bootstrap's (v4.1.X) `tab.js`
4
4
  */
5
5
  var TabSwitch = function ($) {
6
6
  // constants >>>
@@ -41,7 +41,6 @@ var TabSwitch = function ($) {
41
41
  var navLeft = $(this._nav).offset().left;
42
42
  var navScrollLeft = $(this._nav).scrollLeft();
43
43
  var navWidth = $(this._nav).outerWidth();
44
- var supportsTransition = Util.supportsTransitionEnd();
45
44
 
46
45
  if (!this._navindicator) {
47
46
  this._createIndicator(navLeft, navScrollLeft, navWidth, relatedTarget);
@@ -55,11 +54,7 @@ var TabSwitch = function ($) {
55
54
  var elWidth = $(element).outerWidth();
56
55
  $(this._navindicator).addClass(ClassName.SHOW);
57
56
  Util.reflow(this._navindicator);
58
-
59
- if (supportsTransition) {
60
- $(this._nav).addClass(ClassName.ANIMATE);
61
- }
62
-
57
+ $(this._nav).addClass(ClassName.ANIMATE);
63
58
  $(this._navindicator).css({
64
59
  left: elLeft + navScrollLeft - navLeft,
65
60
  right: navWidth - (elLeft + navScrollLeft - navLeft + elWidth)
@@ -70,11 +65,6 @@ var TabSwitch = function ($) {
70
65
  $(_this._navindicator).removeClass(ClassName.SHOW);
71
66
  };
72
67
 
73
- if (!supportsTransition) {
74
- complete();
75
- return;
76
- }
77
-
78
68
  var transitionDuration = Util.getTransitionDurationFromElement(this._navindicator);
79
69
  $(this._navindicator).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
80
70
  };
@@ -1,16 +1,16 @@
1
1
  /*
2
2
  * Global util js
3
- * Based on Bootstrap's (v4.1.0) `util.js`
3
+ * Based on Bootstrap's (v4.1.X) `util.js`
4
4
  */
5
5
  var Util = function ($) {
6
6
  var MAX_UID = 1000000;
7
7
  var MILLISECONDS_MULTIPLIER = 1000;
8
- var transition = false;
8
+ var TRANSITION_END = 'transitionend';
9
9
 
10
10
  function getSpecialTransitionEndEvent() {
11
11
  return {
12
- bindType: transition.end,
13
- delegateType: transition.end,
12
+ bindType: TRANSITION_END,
13
+ delegateType: TRANSITION_END,
14
14
  handle: function handle(event) {
15
15
  if ($(event.target).is(this)) {
16
16
  return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
@@ -22,12 +22,8 @@ var Util = function ($) {
22
22
  }
23
23
 
24
24
  function setTransitionEndSupport() {
25
- transition = transitionEndTest();
26
25
  $.fn.emulateTransitionEnd = transitionEndEmulator;
27
-
28
- if (Util.supportsTransitionEnd()) {
29
- $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
30
- }
26
+ $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
31
27
  }
32
28
 
33
29
  function toType(obj) {
@@ -49,16 +45,6 @@ var Util = function ($) {
49
45
  return this;
50
46
  }
51
47
 
52
- function transitionEndTest() {
53
- if (typeof window !== 'undefined' && window.QUnit) {
54
- return false;
55
- }
56
-
57
- return {
58
- end: 'transitionend'
59
- };
60
- }
61
-
62
48
  var Util = {
63
49
  TRANSITION_END: 'mdTransitionEnd',
64
50
  getSelectorFromElement: function getSelectorFromElement(element) {
@@ -104,10 +90,10 @@ var Util = function ($) {
104
90
  return element.offsetHeight;
105
91
  },
106
92
  supportsTransitionEnd: function supportsTransitionEnd() {
107
- return Boolean(transition);
93
+ return Boolean(TRANSITION_END);
108
94
  },
109
95
  triggerTransitionEnd: function triggerTransitionEnd(element) {
110
- $(element).trigger(transition.end);
96
+ $(element).trigger(TRANSITION_END);
111
97
  },
112
98
  typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
113
99
  for (var property in configTypes) {
@@ -43,7 +43,6 @@
43
43
 
44
44
  article,
45
45
  aside,
46
- dialog,
47
46
  figcaption,
48
47
  figure,
49
48
  footer,
@@ -65,7 +65,8 @@
65
65
  width: auto;
66
66
  }
67
67
 
68
- .form-control {
68
+ .form-control,
69
+ .form-control-file {
69
70
  display: inline-block;
70
71
  vertical-align: middle;
71
72
  width: auto;
@@ -121,29 +122,52 @@
121
122
  display: block;
122
123
  margin-top: $textfield-margin-y;
123
124
 
124
- .form-control-lg + & {
125
+ .custom-select-lg + &,
126
+ .floating-label-lg + &,
127
+ .floating-label-lg .custom-select + &,
128
+ .floating-label-lg .form-control + &,
129
+ .floating-label-lg .form-control-file + &,
130
+ .form-control-lg + &,
131
+ .textfield-box-lg + &,
132
+ .textfield-box-lg .custom-select + &,
133
+ .textfield-box-lg .form-control + &,
134
+ .textfield-box-lg .form-control-file + & {
125
135
  margin-top: $textfield-margin-y-lg;
126
136
  }
127
137
 
128
- .form-control-sm + & {
138
+ .custom-select-sm + &,
139
+ .floating-label-sm + &,
140
+ .floating-label-sm .custom-select + &,
141
+ .floating-label-sm .form-control + &,
142
+ .floating-label-sm .form-control-file + &,
143
+ .form-control-sm + &,
144
+ .textfield-box-sm + &,
145
+ .textfield-box-sm .custom-select + &,
146
+ .textfield-box-sm .form-control + &,
147
+ .textfield-box-sm .form-control-file + & {
129
148
  margin-top: $textfield-margin-y-sm;
130
149
  }
131
150
  }
132
151
 
133
- .form-control-file,
134
- .form-control-range {
135
- display: block;
136
- }
152
+ // Readonly control as plain text
137
153
 
138
- .form-control-file {
139
- @extend %form-control;
140
-
141
- &::-webkit-file-upload-button {
142
- background-color: transparent;
143
- background-image: none;
144
- border: 0;
145
- color: $textfield-hint-color;
146
- height: auto;
147
- padding: 0;
154
+ .form-control-plaintext {
155
+ background-color: transparent;
156
+ border-color: transparent;
157
+ border-radius: 0;
158
+ border-style: solid;
159
+ border-width: 0 0 $textfield-border-width;
160
+ box-shadow: none;
161
+ color: $textfield-plaintext-color;
162
+ display: block;
163
+ font-size: $textfield-font-size;
164
+ line-height: $textfield-line-height;
165
+ padding: $textfield-padding-y 0 calc(#{$textfield-padding-y} - #{$textfield-border-width});
166
+ width: 100%;
167
+
168
+ &.form-control-sm,
169
+ &.form-control-lg {
170
+ padding-right: 0;
171
+ padding-left: 0;
148
172
  }
149
173
  }
@@ -18,7 +18,6 @@
18
18
  @import 'bootstrap/carousel';
19
19
  @import 'bootstrap/close';
20
20
  @import 'bootstrap/code';
21
- @import 'bootstrap/custom-form';
22
21
  @import 'bootstrap/form';
23
22
  @import 'bootstrap/image';
24
23
  @import 'bootstrap/jumbotron';
@@ -202,6 +202,7 @@
202
202
  color: inherit;
203
203
  display: flex;
204
204
  justify-content: space-between;
205
+ min-height: $expansion-panel-height;
205
206
  padding: $expansion-panel-padding-y $expansion-panel-padding-x;
206
207
  text-align: inherit;
207
208
  width: 100%;
@@ -1,14 +1,21 @@
1
1
  .custom-control {
2
2
  display: block;
3
- margin-bottom: $selection-control-spacer-y;
4
3
  min-height: ($font-size-base * $line-height-base);
5
4
  padding-left: ($selection-control-indicator-size + $selection-control-spacer-x);
6
5
  position: relative;
6
+
7
+ + .custom-control {
8
+ margin-top: $selection-control-spacer-y;
9
+ }
7
10
  }
8
11
 
9
12
  .custom-control-inline {
10
13
  display: inline-flex;
11
14
  margin-right: ($selection-control-spacer-x * 2);
15
+
16
+ + .custom-control-inline {
17
+ margin-top: 0;
18
+ }
12
19
  }
13
20
 
14
21
  // Base styles for custom control indicators
@@ -1,59 +1,94 @@
1
1
  .textfield-box {
2
- &.floating-label {
3
- @include textfield-box-size($textfield-font-size, $textfield-box-height, $textfield-line-height, $textfield-box-padding-x, $textfield-box-padding-y);
2
+ %form-control {
3
+ background-color: $textfield-box-bg;
4
+ border-radius: $textfield-box-border-radius;
5
+ padding: $textfield-box-padding-y $textfield-box-padding-x calc(#{$textfield-box-padding-y} - #{$textfield-border-width});
6
+ }
7
+
8
+ %form-select {
9
+ padding-right: $textfield-select-bg-size;
10
+ }
4
11
 
5
- padding-top: 0;
12
+ %form-textarea {
13
+ border-width: 0 0 $textfield-border-width;
14
+ padding: $textfield-box-padding-y $textfield-box-padding-x calc(#{$textfield-box-padding-y} - #{$textfield-border-width});
6
15
 
7
- &.has-value label,
8
- &.is-focused label {
9
- top: $textfield-box-label-spacer-y;
16
+ @include hover {
17
+ box-shadow: inset 0 ($textfield-border-width-hover * -1) 0 ($textfield-border-width * -1) $textfield-border-color-hover;
10
18
  }
11
19
 
12
- .form-control {
13
- padding-bottom: ($textfield-box-label-spacer-y - $textfield-border-width / $font-size-root * 1rem);
20
+ &:focus {
21
+ box-shadow: inset 0 ($textfield-border-width-focus * -1) 0 ($textfield-border-width * -1) $textfield-border-color-focus;
14
22
  }
15
23
  }
16
24
 
17
- // stylelint-disable-next-line selector-no-qualifying-type
18
- select.form-control:not([multiple]):not([size]) {
19
- @include form-select-size($textfield-font-size, $textfield-box-height, $textfield-box-padding-x);
20
- }
25
+ // Form control sizing
21
26
 
22
- .form-control {
23
- @include form-control-size($textfield-font-size, $textfield-box-height, $textfield-line-height, $textfield-box-padding-x, $textfield-box-padding-y);
27
+ // stylelint-disable-next-line order/order, selector-no-qualifying-type
28
+ textarea.form-control {
29
+ min-height: $textfield-box-height;
30
+ }
24
31
 
25
- background-color: $textfield-box-bg;
26
- border-radius: $textfield-box-border-radius;
32
+ .form-control[type='file'],
33
+ .form-control-file {
34
+ max-height: $textfield-box-height;
27
35
  }
28
36
  }
29
37
 
30
38
  // Size
39
+
31
40
  .textfield-box-lg {
32
- &.floating-label {
33
- @include textfield-box-size($textfield-font-size-lg, $textfield-box-height-lg, $textfield-line-height-lg, $textfield-box-padding-x-lg, $textfield-box-padding-y-lg);
41
+ %form-control {
42
+ font-size: $textfield-font-size-lg;
43
+ line-height: $textfield-line-height-lg;
44
+ padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width});
34
45
  }
35
46
 
36
- // stylelint-disable-next-line selector-no-qualifying-type
37
- select.form-control:not([multiple]):not([size]) {
38
- @include form-select-size($textfield-font-size-lg, $textfield-box-height-lg, $textfield-box-padding-x-lg);
47
+ %form-textarea {
48
+ padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width});
39
49
  }
40
50
 
41
- .form-control {
42
- @include form-control-size($textfield-font-size-lg, $textfield-box-height-lg, $textfield-line-height-lg, $textfield-box-padding-x-lg, $textfield-box-padding-y-lg);
51
+ // Form control sizing
52
+
53
+ // stylelint-disable-next-line order/order, selector-no-qualifying-type
54
+ textarea.form-control {
55
+ min-height: $textfield-box-height-lg;
56
+ }
57
+
58
+ .custom-select {
59
+ padding-right: $textfield-select-bg-size;
60
+ }
61
+
62
+ .form-control[type='file'],
63
+ .form-control-file {
64
+ max-height: $textfield-box-height-lg;
43
65
  }
44
66
  }
45
67
 
46
68
  .textfield-box-sm {
47
- &.floating-label {
48
- @include textfield-box-size($textfield-font-size-sm, $textfield-box-height-sm, $textfield-line-height-sm, $textfield-box-padding-x-sm, $textfield-box-padding-y-sm);
69
+ %form-control {
70
+ font-size: $textfield-font-size-sm;
71
+ line-height: $textfield-line-height-sm;
72
+ padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width});
73
+ }
74
+
75
+ %form-textarea {
76
+ padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width});
77
+ }
78
+
79
+ // Form control sizing
80
+
81
+ // stylelint-disable-next-line order/order, selector-no-qualifying-type
82
+ textarea.form-control {
83
+ min-height: $textfield-box-height-sm;
49
84
  }
50
85
 
51
- // stylelint-disable-next-line selector-no-qualifying-type
52
- select.form-control:not([multiple]):not([size]) {
53
- @include form-select-size($textfield-font-size-sm, $textfield-box-height-sm, $textfield-box-padding-x-sm);
86
+ .custom-select {
87
+ padding-right: $textfield-select-bg-size;
54
88
  }
55
89
 
56
- .form-control {
57
- @include form-control-size($textfield-font-size-sm, $textfield-box-height-sm, $textfield-line-height-sm, $textfield-box-padding-x-sm, $textfield-box-padding-y-sm);
90
+ .form-control[type='file'],
91
+ .form-control-file {
92
+ max-height: $textfield-box-height-sm;
58
93
  }
59
94
  }
@@ -1,13 +1,11 @@
1
1
  .floating-label {
2
- @include floating-label-size($textfield-font-size, $textfield-height, $textfield-line-height, $textfield-padding-y);
3
-
4
- padding-top: $floating-label-font-size-focus;
2
+ padding-top: $floating-label-font-size;
5
3
  position: relative;
6
4
 
7
5
  &.has-value label,
8
6
  &.is-focused label {
9
- line-height: 1;
10
7
  top: 0;
8
+ transform: scale($floating-label-font-size / $textfield-font-size);
11
9
  }
12
10
 
13
11
  &.is-focused label {
@@ -23,30 +21,23 @@
23
21
  }
24
22
 
25
23
  label {
26
- @include text-truncate;
27
24
  @include transition-standard(color, top, transform);
28
25
 
29
26
  color: $floating-label-color;
30
27
  display: block;
28
+ font-size: $textfield-font-size;
29
+ line-height: $textfield-line-height;
31
30
  margin: 0;
32
31
  padding: 0;
33
32
  position: absolute;
33
+ top: ($floating-label-font-size + $textfield-padding-y);
34
34
  left: 0;
35
35
  transform-origin: 0 0;
36
36
  }
37
37
 
38
- .form-control {
38
+ %form-control {
39
39
  position: relative;
40
40
 
41
- &[type='file']::-webkit-file-upload-button {
42
- background-color: transparent;
43
- background-image: none;
44
- border: 0;
45
- color: $floating-label-color;
46
- height: auto;
47
- padding: 0;
48
- }
49
-
50
41
  &:focus {
51
42
  &::placeholder {
52
43
  color: $textfield-hint-color;
@@ -63,18 +54,120 @@
63
54
  }
64
55
  }
65
56
 
57
+ // Size
58
+
66
59
  .floating-label-lg {
67
- @include floating-label-size($textfield-font-size-lg, $textfield-height-lg, $textfield-line-height-lg, $textfield-padding-y-lg);
60
+ &.has-value label,
61
+ &.is-focused label {
62
+ transform: scale($floating-label-font-size-lg / $textfield-font-size-lg);
63
+ }
64
+
65
+ label {
66
+ font-size: $textfield-font-size-lg;
67
+ line-height: $textfield-line-height-lg;
68
+ top: ($floating-label-font-size-lg + $textfield-padding-y-lg);
69
+ }
70
+
71
+ %form-control {
72
+ font-size: $textfield-font-size-lg;
73
+ line-height: $textfield-line-height-lg;
74
+ padding: $textfield-padding-y-lg $textfield-padding-x-lg calc(#{$textfield-padding-y-lg} - #{$textfield-border-width});
75
+ }
76
+
77
+ %form-select {
78
+ padding-right: $textfield-select-bg-size;
79
+ }
68
80
 
69
- .form-control {
70
- @extend %form-control-lg;
81
+ %form-textarea {
82
+ padding: $textfield-box-padding-y-lg $textfield-box-padding-x-lg calc(#{$textfield-box-padding-y-lg} - #{$textfield-border-width});
71
83
  }
72
84
  }
73
85
 
74
86
  .floating-label-sm {
75
- @include floating-label-size($textfield-font-size-sm, $textfield-height-sm, $textfield-line-height-sm, $textfield-padding-y-sm);
87
+ &.has-value label,
88
+ &.is-focused label {
89
+ transform: scale($floating-label-font-size-sm / $textfield-font-size-sm);
90
+ }
91
+
92
+ label {
93
+ font-size: $textfield-font-size-sm;
94
+ line-height: $textfield-line-height-sm;
95
+ top: ($floating-label-font-size-sm + $textfield-padding-y-sm);
96
+ }
97
+
98
+ %form-control {
99
+ font-size: $textfield-font-size-sm;
100
+ line-height: $textfield-line-height-sm;
101
+ padding: $textfield-padding-y-sm $textfield-padding-x-sm calc(#{$textfield-padding-y-sm} - #{$textfield-border-width});
102
+ }
103
+
104
+ %form-select {
105
+ padding-right: $textfield-select-bg-size;
106
+ }
107
+
108
+ %form-textarea {
109
+ padding: $textfield-box-padding-y-sm $textfield-box-padding-x-sm calc(#{$textfield-box-padding-y-sm} - #{$textfield-border-width});
110
+ }
111
+ }
112
+
113
+ // Floating label with textfield box
114
+
115
+ .floating-label.textfield-box {
116
+ padding-top: 0;
117
+
118
+ &.has-value label,
119
+ &.is-focused label {
120
+ line-height: 1;
121
+ top: $textfield-box-label-spacer-y;
122
+ }
123
+
124
+ label {
125
+ top: $textfield-box-padding-y;
126
+ left: $textfield-box-padding-x;
127
+ }
128
+
129
+ %form-control,
130
+ %form-textarea {
131
+ padding-top: ($textfield-box-height - $textfield-box-label-spacer-y - $textfield-font-size * $textfield-line-height);
132
+ }
133
+
134
+ %form-control {
135
+ padding-bottom: calc(#{$textfield-box-label-spacer-y} - #{$textfield-border-width});
136
+ }
137
+ }
138
+
139
+ .floating-label-lg.textfield-box {
140
+ label {
141
+ top: $textfield-box-padding-y-lg;
142
+ left: $textfield-box-padding-x-lg;
143
+ }
144
+
145
+ %form-control,
146
+ %form-textarea {
147
+ padding-top: ($textfield-box-height-lg - $textfield-box-label-spacer-y - $textfield-font-size-lg * $textfield-line-height-lg);
148
+ padding-right: $textfield-box-padding-x-lg;
149
+ padding-left: $textfield-box-padding-x-lg;
150
+ }
151
+
152
+ %form-select {
153
+ padding-right: $textfield-select-bg-size;
154
+ }
155
+ }
156
+
157
+ .floating-label-sm.textfield-box {
158
+ label {
159
+ top: $textfield-box-padding-y-sm;
160
+ left: $textfield-box-padding-x-sm;
161
+ }
162
+
163
+ %form-control,
164
+ %form-textarea {
165
+ padding-top: ($textfield-box-height-sm - $textfield-box-label-spacer-y - $textfield-font-size-sm * $textfield-line-height-sm);
166
+ padding-right: $textfield-box-padding-x-sm;
167
+ padding-left: $textfield-box-padding-x-sm;
168
+ }
76
169
 
77
- .form-control {
78
- @extend %form-control-sm;
170
+ %form-select {
171
+ padding-right: $textfield-select-bg-size;
79
172
  }
80
173
  }