@shortfuse/materialdesignweb 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/.browserslistrc +2 -1
  2. package/.eslintrc.json +59 -8
  3. package/.stylelintrc.json +94 -49
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +1 -3
  6. package/adapters/datatable/column.js +27 -54
  7. package/adapters/datatable/index.js +69 -81
  8. package/adapters/dom/index.js +32 -47
  9. package/adapters/search/index.js +107 -133
  10. package/components/appbar/_spec.scss +77 -137
  11. package/components/banner/_spec.scss +28 -63
  12. package/components/bottomnav/_spec.scss +46 -54
  13. package/components/bottomnav/index.js +15 -20
  14. package/components/bottomnav/item.js +4 -5
  15. package/components/button/README.md +1 -1
  16. package/components/button/_spec.scss +43 -42
  17. package/components/button/_theme.scss +27 -50
  18. package/components/card/_spec.scss +61 -69
  19. package/components/chip/_spec.scss +21 -44
  20. package/components/chip/_theme.scss +79 -151
  21. package/components/chip/index.js +6 -4
  22. package/components/datatable/_spec.scss +36 -99
  23. package/components/datatable/_theme.scss +98 -124
  24. package/components/datatable/cell.js +1 -2
  25. package/components/datatable/columnheader.js +1 -2
  26. package/components/datatable/index.js +33 -47
  27. package/components/datatable/row.js +4 -5
  28. package/components/dialog/_spec.scss +53 -63
  29. package/components/dialog/_theme.scss +7 -0
  30. package/components/dialog/index.js +62 -88
  31. package/components/divider/_spec.scss +6 -8
  32. package/components/elevation/_spec.scss +1 -1
  33. package/components/fab/_spec.scss +30 -42
  34. package/components/fab/index.js +4 -8
  35. package/components/grid/_spec.scss +68 -211
  36. package/components/layout/_mixins.scss +0 -22
  37. package/components/layout/_spec.scss +267 -363
  38. package/components/layout/_theme.scss +10 -35
  39. package/components/layout/index.js +40 -50
  40. package/components/list/_spec.scss +57 -91
  41. package/components/list/_theme.scss +75 -84
  42. package/components/list/content.js +9 -13
  43. package/components/list/index.js +34 -38
  44. package/components/list/item.js +8 -11
  45. package/components/list/secondary.js +8 -9
  46. package/components/menu/_spec.scss +134 -167
  47. package/components/menu/index.js +45 -61
  48. package/components/menu/item.js +11 -19
  49. package/components/progress/_spec.scss +43 -34
  50. package/components/selection/_spec.scss +123 -133
  51. package/components/selection/_theme.scss +88 -120
  52. package/components/selection/index.js +9 -15
  53. package/components/selection/input.js +3 -5
  54. package/components/selection/radiogroup.js +8 -15
  55. package/components/slider/_spec.scss +23 -28
  56. package/components/snackbar/_spec.scss +17 -62
  57. package/components/snackbar/index.js +15 -21
  58. package/components/tab/_spec.scss +35 -50
  59. package/components/tab/content.js +33 -28
  60. package/components/tab/index.js +30 -33
  61. package/components/tab/item.js +4 -5
  62. package/components/tab/list.js +22 -36
  63. package/components/textfield/README.md +2 -2
  64. package/components/textfield/_spec.scss +241 -287
  65. package/components/textfield/_theme.scss +197 -232
  66. package/components/textfield/index.js +8 -16
  67. package/components/tooltip/_spec.scss +23 -26
  68. package/components/type/_spec.scss +19 -16
  69. package/core/_breakpoint.scss +33 -33
  70. package/core/_elevation.scss +40 -0
  71. package/core/_length.scss +0 -1
  72. package/core/_platform.scss +0 -22
  73. package/core/_type.scss +7 -6
  74. package/core/aria/button.js +4 -5
  75. package/core/aria/keyboard.js +1 -2
  76. package/core/aria/rovingtabindex.js +14 -17
  77. package/core/aria/tab.js +1 -2
  78. package/core/dom.js +18 -109
  79. package/core/overlay/_spec.scss +5 -8
  80. package/core/overlay/_theme.scss +126 -150
  81. package/core/overlay/index.js +19 -32
  82. package/core/ripple/_spec.scss +16 -17
  83. package/core/ripple/_theme.scss +13 -33
  84. package/core/ripple/index.js +36 -44
  85. package/core/theme/_aliases.scss +15 -0
  86. package/core/theme/_config.scss +8 -2
  87. package/core/theme/_functions.scss +22 -0
  88. package/core/theme/_palettes.scss +0 -1
  89. package/core/{color → theme}/_spec.scss +0 -0
  90. package/core/theme/_theme.scss +268 -0
  91. package/core/theme/index.scss +4 -0
  92. package/core/transition/index.js +73 -76
  93. package/docs/_flex.scss +7 -1
  94. package/docs/_menuoptions.js +2 -2
  95. package/docs/_partials/_appbar.eta +12 -14
  96. package/docs/_partials/_header.eta +41 -44
  97. package/docs/_sample-utils.js +15 -20
  98. package/docs/docs.scss +123 -87
  99. package/docs/framework.scss +26 -0
  100. package/docs/index.eta +2 -6
  101. package/docs/index.js +7 -0
  102. package/docs/pages/appbar.eta +22 -28
  103. package/docs/pages/bottomnav.js +17 -14
  104. package/docs/pages/button.js +10 -10
  105. package/docs/pages/card.js +20 -22
  106. package/docs/pages/chip.js +11 -13
  107. package/docs/pages/color.js +35 -36
  108. package/docs/pages/datatable.js +11 -15
  109. package/docs/pages/dialog.eta +9 -11
  110. package/docs/pages/dialog.js +6 -9
  111. package/docs/pages/dom.js +6 -9
  112. package/docs/pages/elevation.eta +10 -10
  113. package/docs/pages/fab.js +2 -3
  114. package/docs/pages/grid.js +5 -5
  115. package/docs/pages/list.js +1 -2
  116. package/docs/pages/menu.eta +17 -19
  117. package/docs/pages/menu.js +7 -11
  118. package/docs/pages/overlay.js +1 -2
  119. package/docs/pages/progress.eta +2 -2
  120. package/docs/pages/progress.js +1 -1
  121. package/docs/pages/ripple.js +1 -2
  122. package/docs/pages/search.eta +20 -24
  123. package/docs/pages/search.js +24 -41
  124. package/docs/pages/selection.eta +2 -6
  125. package/docs/pages/selection.js +3 -4
  126. package/docs/pages/snackbar.js +3 -4
  127. package/docs/pages/tab.eta +61 -75
  128. package/docs/pages/tab.js +16 -15
  129. package/docs/pages/textfield.eta +9 -8
  130. package/docs/pages/textfield.js +26 -23
  131. package/docs/pages/tooltip.eta +10 -12
  132. package/docs/pages/transition.js +5 -7
  133. package/docs/postrender.js +7 -5
  134. package/docs/pwa/pwa.eta +14 -16
  135. package/docs/pwa/pwa.js +19 -27
  136. package/docs/pwa/pwa.scss +12 -7
  137. package/docs/themes/theme-colored.scss +9 -11
  138. package/docs/themes/theme-default.scss +0 -14
  139. package/index.scss +27 -0
  140. package/jsconfig.json +7 -3
  141. package/package.json +26 -15
  142. package/tsconfig.json +16 -0
  143. package/{webpack.config.cjs → webpack.config.js} +105 -58
  144. package/components/template/_theme.scss +0 -27
  145. package/components/textfield/_mixins.scss +0 -52
  146. package/core/color/_theme.scss +0 -390
  147. package/core/color/index.scss +0 -2
  148. package/core/theme/_mixins.scss +0 -172
  149. package/core/theme/_variables.scss +0 -24
  150. package/docs/_mixins.pug +0 -155
  151. package/docs/pages/appbar.pug +0 -78
  152. package/docs/pages/bottomnav.pug +0 -137
  153. package/docs/pages/button.pug +0 -121
  154. package/docs/pages/card.pug +0 -74
  155. package/docs/pages/chip.pug +0 -91
  156. package/docs/pages/color.pug +0 -121
  157. package/docs/pages/datatable.pug +0 -283
  158. package/docs/pages/dialog.pug +0 -132
  159. package/docs/pages/dom.pug +0 -22
  160. package/docs/pages/elevation.pug +0 -25
  161. package/docs/pages/fab.pug +0 -66
  162. package/docs/pages/grid.pug +0 -95
  163. package/docs/pages/layout.pug +0 -7
  164. package/docs/pages/list.pug +0 -326
  165. package/docs/pages/menu.pug +0 -205
  166. package/docs/pages/overlay.pug +0 -55
  167. package/docs/pages/progress.pug +0 -16
  168. package/docs/pages/ripple.pug +0 -21
  169. package/docs/pages/search.pug +0 -165
  170. package/docs/pages/selection.pug +0 -74
  171. package/docs/pages/slider.pug +0 -17
  172. package/docs/pages/snackbar.pug +0 -60
  173. package/docs/pages/tab.pug +0 -304
  174. package/docs/pages/textfield.pug +0 -360
  175. package/docs/pages/tooltip.pug +0 -78
  176. package/docs/pages/transition.pug +0 -76
  177. package/docs/pages/type.pug +0 -29
  178. package/docs/pwa/_dialogs.pug +0 -96
  179. package/docs/pwa/_menus.pug +0 -11
  180. package/docs/pwa/pwa.pug +0 -325
  181. package/docs/spec.scss +0 -26
  182. package/docs/themes/_component-themes.scss +0 -26
  183. package/docs/themes/theme-colored-fallbacks.scss +0 -17
  184. package/docs/themes/theme-default-fallbacks.scss +0 -17
@@ -1,299 +1,264 @@
1
- // https://material.io/archive/guidelines/components/text-fields.html#text-fields-states
1
+ /* https://material.io/archive/guidelines/components/text-fields.html#text-fields-states */
2
2
 
3
- @use '../../core/theme/_mixins.scss' as theme;
4
3
  @use '../../core/_platform.scss' as platform;
5
4
 
6
- $themeValues: (
7
-
8
- text-color: theme.$foreground,
9
- default-text-opacity: theme.$high-opacity,
10
- secondary-text-opacity: theme.$medium-opacity,
11
- disabled-opacity: theme.$inactive-opacity,
12
-
13
- placeholder-color__focus: (('foreground-light', 0.42), ('foreground-dark', 0.50)),
14
- filled-disabled-border-color: (('foreground-light', 0.10), ('foreground-dark', 0.30)),
15
- filled-disabled-background-color: (('foreground-light', 0.03), ('foreground-dark', 0.05)),
16
- fill-color: (('foreground-light', 0.06), ('foreground-dark', 0.10)),
17
- fill-color__hover: (('foreground-light', 0.12), ('foreground-dark', 0.20)),
18
- border-line-color: (('foreground-light', 0.42), ('foreground-dark', 0.70)),
19
- border-line-color__hover: (('foreground-light', 0.87), ('foreground-dark', 1.00)),
20
-
21
- warn-color: (('warn', 'A700', 1.00), ('warn', 'A200', 1.00)),
22
- warn-color__selection: (('warn', 'A700', 0.20), ('warn', 'A200', 0.40)),
23
-
24
- selection-opacity: (0.08 + 0.12, 0.16 + 0.24),
25
- ) !default;
26
-
27
- @function getThemeValue($key, $type) {
28
- @return theme.getThemeValue('textfield', $themeValues, $key, $type);
5
+ .mdw-theme {
6
+ --mdw-textfield__text-rgb: var(--mdw-ink-default);
7
+ --mdw-textfield__default-text-opacity: var(--mdw-high-opacity);
8
+ --mdw-textfield__secondary-text-opacity: var(--mdw-medium-opacity);
9
+ --mdw-textfield__disabled-opacity: var(--mdw-inactive-opacity);
29
10
  }
30
11
 
31
- @mixin addThemeRules($type: 'var') {
32
- .mdw-textfield[mdw-outlined] {
33
- &:active > .mdw-textfield__input:not(:disabled),
34
- & > .mdw-textfield__input:not(:disabled):focus {
35
- & ~ .mdw-textfield__border {
36
- color: inherit;
37
- }
38
- }
12
+ .mdw-theme[mdw-light] {
13
+ --mdw-textfield__placeholder-color__focus: RGBA(var(--mdw-ink-default), 0.42);
14
+ --mdw-textfield__filled-disabled-border-color: RGBA(var(--mdw-ink-default), 0.10);
15
+ --mdw-textfield__filled-disabled-background-color: RGBA(var(--mdw-ink-default), 0.03);
16
+ --mdw-textfield__fill-color: RGBA(var(--mdw-ink-default), 0.06);
17
+ --mdw-textfield__fill-color__hover: RGBA(var(--mdw-ink-default), 0.12);
18
+ --mdw-textfield__border-line-color: RGBA(var(--mdw-ink-default), 0.42);
19
+ --mdw-textfield__border-line-color__hover: RGBA(var(--mdw-ink-default), 0.87);
39
20
 
40
- &,
41
- &[mdw-ink] {
42
- &:active > .mdw-textfield__input:not(:disabled),
43
- & > .mdw-textfield__input:not(:disabled):focus {
44
- &:invalid {
45
- & ~ .mdw-textfield__border,
46
- & ~ .mdw-textfield__border::before {
47
- color: RGBA(getThemeValue("warn-color", $type));
48
- }
49
- }
50
- }
51
- }
52
- }
21
+ --mdw-textfield__warn-color: RGBA(var(--mdw-alias-warn-A700), 1.00);
22
+ --mdw-textfield__warn-color__selection: RGBA(var(--mdw-alias-warn-A700), 0.20);
23
+
24
+ --mdw-textfield__selection-opacity: #{0.08 + 0.12};
25
+
26
+ --mdw-textfield__date-picker-filter: none;
27
+ }
28
+
29
+ .mdw-theme[mdw-dark] {
30
+ --mdw-textfield__placeholder-color__focus: RGBA(var(--mdw-ink-default), 0.50);
31
+ --mdw-textfield__filled-disabled-border-color: RGBA(var(--mdw-ink-default), 0.30);
32
+ --mdw-textfield__filled-disabled-background-color: RGBA(var(--mdw-ink-default), 0.05);
33
+ --mdw-textfield__fill-color: RGBA(var(--mdw-ink-default), 0.10);
34
+ --mdw-textfield__fill-color__hover: RGBA(var(--mdw-ink-default), 0.20);
35
+ --mdw-textfield__border-line-color: RGBA(var(--mdw-ink-default), 0.70);
36
+ --mdw-textfield__border-line-color__hover: RGBA(var(--mdw-ink-default), 1.00);
37
+
38
+ --mdw-textfield__warn-color: RGBA(var(--mdw-alias-warn-A200), 1.00);
39
+ --mdw-textfield__warn-color__selection: RGBA(var(--mdw-alias-warn-A200), 0.40);
53
40
 
54
- .mdw-textfield__error-text {
55
- color: RGBA(getThemeValue("warn-color", $type));
41
+ --mdw-textfield__selection-opacity: #{0.16 + 0.24};
42
+ --mdw-textfield__date-picker-filter: invert(1);
43
+ }
44
+
45
+ .mdw-textfield[mdw-outlined] {
46
+ &:active > .mdw-textfield__input:not(:disabled),
47
+ & > .mdw-textfield__input:not(:disabled):focus {
48
+ & ~ .mdw-textfield__border {
49
+ color: inherit;
50
+ }
56
51
  }
57
52
 
58
- .mdw-textfield {
59
- // Focus
53
+ &,
54
+ &[mdw-ink] {
60
55
  &:active > .mdw-textfield__input:not(:disabled),
61
- & > .mdw-textfield__input:not(:disabled):active,
62
56
  & > .mdw-textfield__input:not(:disabled):focus {
63
- @if($type == 'var') {
64
- &::selection {
65
- background-color: RGBA(var(--mdw-ink), getThemeValue("selection-opacity", $type));
57
+ &:invalid {
58
+ & ~ .mdw-textfield__border,
59
+ & ~ .mdw-textfield__border::before {
60
+ color: var(--mdw-textfield__warn-color);
66
61
  }
67
62
  }
63
+ }
64
+ }
65
+ }
68
66
 
69
- & ~ .mdw-textfield__border {
70
- border-bottom-color: inherit;
71
- color: inherit;
72
- }
73
- & ~ .mdw-textfield__border .mdw-textfield__label {
74
- color: inherit;
75
- }
67
+ .mdw-textfield__error-text {
68
+ color: var(--mdw-textfield__warn-color);
69
+ }
76
70
 
77
- & ~ .mdw-textfield__border::before {
78
- color: inherit;
79
- }
71
+ .mdw-textfield {
72
+ // Focus
73
+ &:active > .mdw-textfield__input:not(:disabled),
74
+ & > .mdw-textfield__input:not(:disabled):active,
75
+ & > .mdw-textfield__input:not(:disabled):focus {
76
+ &::selection {
77
+ background-color: RGBA(var(--mdw-ink), var(--mdw-textfield__selection-opacity));
80
78
  }
81
79
 
82
- &:active > .mdw-textfield__input:not(:disabled):invalid,
83
- & > .mdw-textfield__input:not(:disabled):focus:invalid {
84
- caret-color: RGBA(getThemeValue("warn-color", $type));
80
+ & ~ .mdw-textfield__border {
81
+ border-block-end-color: inherit;
82
+ color: inherit;
83
+ }
85
84
 
86
- &::selection {
87
- background-color: RGBA(getThemeValue("warn-color__selection", $type));
88
- }
85
+ & ~ .mdw-textfield__border .mdw-textfield__label {
86
+ color: inherit;
87
+ }
89
88
 
90
- & ~ .mdw-textfield__border {
91
- border-bottom-color: currentColor;
92
- color: RGBA(getThemeValue("warn-color", $type));
93
- }
89
+ & ~ .mdw-textfield__border::before {
90
+ color: inherit;
91
+ }
92
+ }
94
93
 
95
- & ~ .mdw-textfield__border .mdw-textfield__label {
96
- // color: getThemeValue("warn-color", $type);
97
- }
94
+ &:active > .mdw-textfield__input:not(:disabled):invalid,
95
+ & > .mdw-textfield__input:not(:disabled):focus:invalid {
96
+ caret-color: var(--mdw-textfield__warn-color);
98
97
 
99
- & ~ .mdw-textfield__border::after {
100
- color: RGBA(getThemeValue("warn-color", $type));
101
- }
98
+ &::selection {
99
+ background-color: var(--mdw-textfield__warn-color__selection);
100
+ }
102
101
 
102
+ & ~ .mdw-textfield__border {
103
+ border-block-end-color: currentColor;
104
+ color: var(--mdw-textfield__warn-color);
103
105
  }
104
- }
105
106
 
106
- .mdw-textfield__signifier,
107
- .mdw-textfield__label,
108
- .mdw-textfield__prefix,
109
- .mdw-textfield__suffix {
110
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
111
- }
107
+ & ~ .mdw-textfield__border .mdw-textfield__label {
108
+ // color: var(--mdw-textfield__warn-color);
109
+ }
112
110
 
113
- .mdw-textfield__icon[mdw-dropdown] {
114
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
115
- }
111
+ & ~ .mdw-textfield__border::after {
112
+ color: var(--mdw-textfield__warn-color);
113
+ }
116
114
 
117
- .mdw-textfield[mdw-value-empty] > input.mdw-textfield__input:not(:focus) {
118
- color: transparent;
119
115
  }
116
+ }
120
117
 
121
- input.mdw-textfield__input:not(:focus):placeholder-shown {
122
- color: transparent;
123
- }
118
+ .mdw-textfield__signifier,
119
+ .mdw-textfield__label,
120
+ .mdw-textfield__prefix,
121
+ .mdw-textfield__suffix {
122
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
123
+ }
124
124
 
125
- .mdw-textfield__input::selection {
126
- // color: inherit;
127
- }
125
+ .mdw-textfield__icon[mdw-dropdown] {
126
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
127
+ }
128
128
 
129
- .mdw-textfield__input::placeholder {
130
- color: RGBA(getThemeValue("placeholder-color__focus", $type));
131
- }
129
+ .mdw-textfield[mdw-value-empty] > input.mdw-textfield__input:not(:focus) {
130
+ color: transparent;
131
+ }
132
132
 
133
- .mdw-textfield__input:-ms-input-placeholder {
134
- color: RGBA(getThemeValue("placeholder-color__focus", $type)) !important;
135
- }
133
+ input.mdw-textfield__input:not(:focus):placeholder-shown {
134
+ color: transparent;
135
+ }
136
136
 
137
- .mdw-textfield__input::-ms-input-placeholder {
138
- color: RGBA(getThemeValue("placeholder-color__focus", $type)) !important;
139
- }
137
+ .mdw-textfield__input::-webkit-calendar-picker-indicator {
138
+ filter: var(--mdw-textfield__date-picker-filter);
139
+ }
140
140
 
141
- .mdw-textfield__input {
142
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("default-text-opacity", $type));
143
- @if ($type == 'var') {
144
- caret-color: RGBA(var(--mdw-ink));
145
- } @else {
146
- caret-color: inherit;
147
- }
141
+ .mdw-textfield__input::selection {
142
+ // color: inherit;
143
+ }
148
144
 
149
- // Disabled
150
- &:disabled,
151
- &[aria-disabled="true"] {
152
- &,
153
- & ~ .mdw-textfield__border,
154
- & ~ .mdw-textfield__border .mdw-textfield__label,
155
- & ~ .mdw-textfield__signifier,
156
- & ~ .mdw-textfield__prefix,
157
- & ~ .mdw-textfield__suffix,
158
- & ~ .mdw-textfield__icon {
159
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("disabled-opacity", $type));
160
- }
161
- }
145
+ .mdw-textfield__input::placeholder {
146
+ color: var(--mdw-textfield__placeholder-color__focus);
147
+ }
162
148
 
163
- // Hover
164
- &:not(:focus):hover:not(:disabled):not(:active) ~ .mdw-textfield__border,
165
- &:not(:focus):not(:disabled):not(:active) ~ .mdw-textfield__border:hover {
166
- color: RGBA(getThemeValue("border-line-color__hover", $type));
167
- }
168
-
169
- &:not(:focus) {
170
- /* Rules must be separated for IE11 support */
171
- &:placeholder-shown ~ .mdw-textfield__prefix,
172
- &:placeholder-shown ~ .mdw-textfield__suffix {
173
- color: transparent;
174
- }
149
+ .mdw-textfield__input {
150
+ caret-color: RGBA(var(--mdw-ink));
175
151
 
176
- .mdw-textfield[mdw-value-empty] > & ~ .mdw-textfield__prefix,
177
- .mdw-textfield[mdw-value-empty] > & ~ .mdw-textfield__suffix {
178
- color: transparent;
179
- }
152
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__default-text-opacity));
153
+
154
+ // Disabled
155
+ &:disabled,
156
+ &[aria-disabled="true"] {
157
+ &,
158
+ & ~ .mdw-textfield__border,
159
+ & ~ .mdw-textfield__border .mdw-textfield__label,
160
+ & ~ .mdw-textfield__signifier,
161
+ & ~ .mdw-textfield__prefix,
162
+ & ~ .mdw-textfield__suffix,
163
+ & ~ .mdw-textfield__icon {
164
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__disabled-opacity));
180
165
  }
181
166
  }
182
167
 
183
- select.mdw-textfield__input {
184
- // Firefox focusring styling workaround
185
- // https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/extension.css
186
- .mdw-textfield[mdw-value-empty] > & {
187
- color: RGBA(getThemeValue("placeholder-color__focus", $type));
188
-
189
- &:focus {
190
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
191
- }
192
-
193
- &:-moz-focusring {
194
- color: transparent;
195
- text-shadow: 0 0 0 RGBA(getThemeValue("placeholder-color__focus", $type));
196
- }
168
+ // Hover
169
+ &:not(:focus):hover:not(:disabled):not(:active) ~ .mdw-textfield__border,
170
+ &:not(:focus):not(:disabled):not(:active) ~ .mdw-textfield__border:hover {
171
+ color: var(--mdw-textfield__border-line-color__hover);
172
+ }
197
173
 
198
- &:focus:-moz-focusring {
199
- color: transparent;
200
- text-shadow: 0 0 0 RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
201
- }
174
+ &:not(:focus) {
175
+ /* Rules must be separated for IE11 support */
176
+ &:placeholder-shown ~ .mdw-textfield__prefix,
177
+ &:placeholder-shown ~ .mdw-textfield__suffix {
178
+ color: transparent;
202
179
  }
203
180
 
204
- &:-moz-focusring {
181
+ .mdw-textfield[mdw-value-empty] > & ~ .mdw-textfield__prefix,
182
+ .mdw-textfield[mdw-value-empty] > & ~ .mdw-textfield__suffix {
205
183
  color: transparent;
206
- text-shadow: 0 0 0 RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
207
184
  }
185
+ }
186
+ }
208
187
 
209
- // On MS Browsers, color rule represents the dropdown popup's foreground color
210
- @include platform.ifEdge() {
211
- color: #000;
212
- }
213
- @media screen and (-ms-high-contrast: none) {
214
- color: #000;
215
- }
216
- @media screen and (-ms-high-contrast: active) {
217
- color: #fff;
188
+ select.mdw-textfield__input {
189
+ // Firefox focusring styling workaround
190
+ // https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/extension.css
191
+ .mdw-textfield[mdw-value-empty] > & {
192
+ color: var(--mdw-textfield__placeholder-color__focus);
193
+
194
+ &:focus {
195
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
218
196
  }
219
-
220
197
 
221
- // ::ms-value represents the closed state color
222
- &::-ms-value {
223
- background: transparent;
224
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("default-text-opacity", $type));
198
+ &:-moz-focusring {
199
+ color: transparent;
200
+ text-shadow: 0 0 0 var(--mdw-textfield__placeholder-color__focus);
225
201
  }
226
202
 
227
- // Dropdown caret
228
- &::-ms-expand {
229
- display: none;
203
+ &:focus:-moz-focusring {
204
+ color: transparent;
205
+ text-shadow: 0 0 0 RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
230
206
  }
231
207
  }
232
-
233
- .mdw-textfield__border {
234
- color: RGBA(getThemeValue("border-line-color", $type));
235
- }
236
208
 
237
- .mdw-textfield__helper-text {
238
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
209
+ &:-moz-focusring {
210
+ color: transparent;
211
+ text-shadow: 0 0 0 RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
239
212
  }
240
213
 
214
+ }
241
215
 
242
- .mdw-textfield__input:disabled ~ .mdw-textfield__helper-text {
243
- color: RGBA(getThemeValue("text-color", $type), getThemeValue("disabled-opacity", $type));
244
- }
245
-
246
- .mdw-textfield__input:focus:invalid ~ .mdw-textfield__helper-text {
247
- color: transparent;
248
- }
216
+ .mdw-textfield__border {
217
+ color: var(--mdw-textfield__border-line-color);
218
+ }
249
219
 
250
- .mdw-textfield {
251
- @if ($type != 'var') {
252
- caret-color: currentColor;
253
- }
220
+ .mdw-textfield__helper-text {
221
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
222
+ }
254
223
 
255
- &:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::placeholder {
256
- color: transparent;
257
- }
224
+ .mdw-textfield__input:disabled ~ .mdw-textfield__helper-text {
225
+ color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__disabled-opacity));
226
+ }
258
227
 
259
- &:not([mdw-solo]) > .mdw-textfield__input:not(:focus):-ms-input-placeholder {
260
- color: transparent !important;
261
- }
228
+ .mdw-textfield__input:focus:invalid ~ .mdw-textfield__helper-text {
229
+ color: transparent;
230
+ }
262
231
 
263
- &:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::-ms-input-placeholder {
264
- color: transparent !important;
265
- }
232
+ .mdw-textfield {
233
+ &:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::placeholder {
234
+ color: transparent;
235
+ }
266
236
 
267
- .mdw-textfield__input:not(:focus) ~ .mdw-textfield__border {
268
- color: RGBA(getThemeValue("border-line-color", $type));
269
- }
270
-
271
- .mdw-textfield__input:disabled ~ .mdw-textfield__border {
272
- background-color: RGBA(getThemeValue("filled-disabled-background-color", $type));
273
- color: RGBA(getThemeValue("filled-disabled-border-color", $type));
274
- }
237
+ &:not([mdw-solo]) > .mdw-textfield__input:not(:focus):-ms-input-placeholder {
238
+ color: transparent !important;
239
+ }
275
240
 
276
- &:not([mdw-outlined]) > .mdw-textfield__border {
277
- background-color: RGBA(getThemeValue("fill-color", $type));
278
- }
241
+ &:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::-ms-input-placeholder {
242
+ color: transparent !important;
243
+ }
279
244
 
280
- &:not([mdw-outlined]) > .mdw-textfield__input:not(:disabled) {
281
- & ~ .mdw-textfield__border:hover,
282
- &:hover ~ .mdw-textfield__border {
283
- background-color: RGBA(getThemeValue("fill-color__hover", $type));
284
- }
285
- }
245
+ .mdw-textfield__input:not(:focus) ~ .mdw-textfield__border {
246
+ color: var(--mdw-textfield__border-line-color);
286
247
  }
287
- }
288
248
 
249
+ .mdw-textfield__input:disabled ~ .mdw-textfield__border {
250
+ background-color: var(--mdw-textfield__filled-disabled-background-color);
251
+ color: var(--mdw-textfield__filled-disabled-border-color);
252
+ }
289
253
 
290
- @include theme.addComponentFallbackRules('light') {
291
- @include addThemeRules('light');
292
- }
293
- @include theme.addComponentFallbackRules('dark') {
294
- @include addThemeRules('dark');
295
- }
254
+ &:not([mdw-outlined]) > .mdw-textfield__border {
255
+ background-color: var(--mdw-textfield__fill-color);
256
+ }
296
257
 
297
- @include theme.addComponentCSSVariableRules('textfield', $themeValues) {
298
- @include addThemeRules();
258
+ &:not([mdw-outlined]) > .mdw-textfield__input:not(:disabled) {
259
+ & ~ .mdw-textfield__border:hover,
260
+ &:hover ~ .mdw-textfield__border {
261
+ background-color: var(--mdw-textfield__fill-color__hover);
262
+ }
263
+ }
299
264
  }
@@ -1,5 +1,3 @@
1
- import { getPassiveEventListenerOption } from '../../core/dom.js';
2
-
3
1
  /**
4
2
  * @param {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} inputElement
5
3
  * @return {void}
@@ -22,7 +20,6 @@ export function updateInputEmptyState(inputElement) {
22
20
  */
23
21
  export function updateTextAreaSize(inputElement) {
24
22
  const previousRowsAttrValue = inputElement.getAttribute('rows');
25
- // eslint-disable-next-line no-param-reassign
26
23
  inputElement.rows = 1;
27
24
  const { height, paddingTop } = window.getComputedStyle(inputElement);
28
25
  if (!height || height === 'auto') {
@@ -33,9 +30,8 @@ export function updateTextAreaSize(inputElement) {
33
30
  }
34
31
  return -1;
35
32
  }
36
- const heightPx = parseInt(height.replace('px', ''), 10);
37
- const paddingTopPx = parseInt(paddingTop.replace('px', ''), 10);
38
- // eslint-disable-next-line no-param-reassign
33
+ const heightPx = Number.parseInt(height.replace('px', ''), 10);
34
+ const paddingTopPx = Number.parseInt(paddingTop.replace('px', ''), 10);
39
35
  inputElement.rows = Math.floor((inputElement.scrollHeight - paddingTopPx) / heightPx);
40
36
  return heightPx;
41
37
  }
@@ -45,8 +41,7 @@ export function updateTextAreaSize(inputElement) {
45
41
  * @return {void}
46
42
  */
47
43
  export function onInput(event) {
48
- /** @type {HTMLInputElement|HTMLTextAreaElement} */
49
- const inputElement = (event.currentTarget);
44
+ const inputElement = /** @type {HTMLInputElement|HTMLTextAreaElement} */ (event.currentTarget);
50
45
  if (inputElement.parentElement.hasAttribute('mdw-autosize')) {
51
46
  updateTextAreaSize(/** @type {HTMLTextAreaElement} */ (inputElement));
52
47
  }
@@ -58,8 +53,7 @@ export function onInput(event) {
58
53
  * @return {string|Date|number}
59
54
  */
60
55
  export function getValue(textfieldElement) {
61
- /** @type {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} */
62
- const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
56
+ const input = /** @type {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} */ (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
63
57
  if ((input instanceof HTMLTextAreaElement) || (input instanceof HTMLSelectElement)) {
64
58
  return input.value;
65
59
  }
@@ -83,12 +77,11 @@ export function getValue(textfieldElement) {
83
77
 
84
78
  /**
85
79
  * @param {Element} textfieldElement
86
- * @param {string|Date|number} [value]
80
+ * @param {string|Date|number|null} [value]
87
81
  * @return {void}
88
82
  */
89
83
  export function setValue(textfieldElement, value) {
90
- /** @type {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} */
91
- const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
84
+ const input = /** @type {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} */ (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
92
85
  if (value == null) {
93
86
  input.value = null;
94
87
  } else if (input instanceof HTMLTextAreaElement || input instanceof HTMLSelectElement) {
@@ -147,10 +140,9 @@ export function setValue(textfieldElement, value) {
147
140
  * @return {void}
148
141
  */
149
142
  export function attach(textfieldElement) {
150
- /** @type {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} */
151
- const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
143
+ const input = /** @type {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} */ (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
152
144
  if (input) {
153
- input.addEventListener('input', onInput, getPassiveEventListenerOption());
145
+ input.addEventListener('input', onInput, { passive: true });
154
146
  onInput({ currentTarget: input });
155
147
  }
156
148
  }