@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.
- package/.browserslistrc +2 -1
- package/.eslintrc.json +59 -8
- package/.stylelintrc.json +94 -49
- package/CHANGELOG.md +12 -0
- package/README.md +1 -3
- package/adapters/datatable/column.js +27 -54
- package/adapters/datatable/index.js +69 -81
- package/adapters/dom/index.js +32 -47
- package/adapters/search/index.js +107 -133
- package/components/appbar/_spec.scss +77 -137
- package/components/banner/_spec.scss +28 -63
- package/components/bottomnav/_spec.scss +46 -54
- package/components/bottomnav/index.js +15 -20
- package/components/bottomnav/item.js +4 -5
- package/components/button/README.md +1 -1
- package/components/button/_spec.scss +43 -42
- package/components/button/_theme.scss +27 -50
- package/components/card/_spec.scss +61 -69
- package/components/chip/_spec.scss +21 -44
- package/components/chip/_theme.scss +79 -151
- package/components/chip/index.js +6 -4
- package/components/datatable/_spec.scss +36 -99
- package/components/datatable/_theme.scss +98 -124
- package/components/datatable/cell.js +1 -2
- package/components/datatable/columnheader.js +1 -2
- package/components/datatable/index.js +33 -47
- package/components/datatable/row.js +4 -5
- package/components/dialog/_spec.scss +53 -63
- package/components/dialog/_theme.scss +7 -0
- package/components/dialog/index.js +62 -88
- package/components/divider/_spec.scss +6 -8
- package/components/elevation/_spec.scss +1 -1
- package/components/fab/_spec.scss +30 -42
- package/components/fab/index.js +4 -8
- package/components/grid/_spec.scss +68 -211
- package/components/layout/_mixins.scss +0 -22
- package/components/layout/_spec.scss +267 -363
- package/components/layout/_theme.scss +10 -35
- package/components/layout/index.js +40 -50
- package/components/list/_spec.scss +57 -91
- package/components/list/_theme.scss +75 -84
- package/components/list/content.js +9 -13
- package/components/list/index.js +34 -38
- package/components/list/item.js +8 -11
- package/components/list/secondary.js +8 -9
- package/components/menu/_spec.scss +134 -167
- package/components/menu/index.js +45 -61
- package/components/menu/item.js +11 -19
- package/components/progress/_spec.scss +43 -34
- package/components/selection/_spec.scss +123 -133
- package/components/selection/_theme.scss +88 -120
- package/components/selection/index.js +9 -15
- package/components/selection/input.js +3 -5
- package/components/selection/radiogroup.js +8 -15
- package/components/slider/_spec.scss +23 -28
- package/components/snackbar/_spec.scss +17 -62
- package/components/snackbar/index.js +15 -21
- package/components/tab/_spec.scss +35 -50
- package/components/tab/content.js +33 -28
- package/components/tab/index.js +30 -33
- package/components/tab/item.js +4 -5
- package/components/tab/list.js +22 -36
- package/components/textfield/README.md +2 -2
- package/components/textfield/_spec.scss +241 -287
- package/components/textfield/_theme.scss +197 -232
- package/components/textfield/index.js +8 -16
- package/components/tooltip/_spec.scss +23 -26
- package/components/type/_spec.scss +19 -16
- package/core/_breakpoint.scss +33 -33
- package/core/_elevation.scss +40 -0
- package/core/_length.scss +0 -1
- package/core/_platform.scss +0 -22
- package/core/_type.scss +7 -6
- package/core/aria/button.js +4 -5
- package/core/aria/keyboard.js +1 -2
- package/core/aria/rovingtabindex.js +14 -17
- package/core/aria/tab.js +1 -2
- package/core/dom.js +18 -109
- package/core/overlay/_spec.scss +5 -8
- package/core/overlay/_theme.scss +126 -150
- package/core/overlay/index.js +19 -32
- package/core/ripple/_spec.scss +16 -17
- package/core/ripple/_theme.scss +13 -33
- package/core/ripple/index.js +36 -44
- package/core/theme/_aliases.scss +15 -0
- package/core/theme/_config.scss +8 -2
- package/core/theme/_functions.scss +22 -0
- package/core/theme/_palettes.scss +0 -1
- package/core/{color → theme}/_spec.scss +0 -0
- package/core/theme/_theme.scss +268 -0
- package/core/theme/index.scss +4 -0
- package/core/transition/index.js +73 -76
- package/docs/_flex.scss +7 -1
- package/docs/_menuoptions.js +2 -2
- package/docs/_partials/_appbar.eta +12 -14
- package/docs/_partials/_header.eta +41 -44
- package/docs/_sample-utils.js +15 -20
- package/docs/docs.scss +123 -87
- package/docs/framework.scss +26 -0
- package/docs/index.eta +2 -6
- package/docs/index.js +7 -0
- package/docs/pages/appbar.eta +22 -28
- package/docs/pages/bottomnav.js +17 -14
- package/docs/pages/button.js +10 -10
- package/docs/pages/card.js +20 -22
- package/docs/pages/chip.js +11 -13
- package/docs/pages/color.js +35 -36
- package/docs/pages/datatable.js +11 -15
- package/docs/pages/dialog.eta +9 -11
- package/docs/pages/dialog.js +6 -9
- package/docs/pages/dom.js +6 -9
- package/docs/pages/elevation.eta +10 -10
- package/docs/pages/fab.js +2 -3
- package/docs/pages/grid.js +5 -5
- package/docs/pages/list.js +1 -2
- package/docs/pages/menu.eta +17 -19
- package/docs/pages/menu.js +7 -11
- package/docs/pages/overlay.js +1 -2
- package/docs/pages/progress.eta +2 -2
- package/docs/pages/progress.js +1 -1
- package/docs/pages/ripple.js +1 -2
- package/docs/pages/search.eta +20 -24
- package/docs/pages/search.js +24 -41
- package/docs/pages/selection.eta +2 -6
- package/docs/pages/selection.js +3 -4
- package/docs/pages/snackbar.js +3 -4
- package/docs/pages/tab.eta +61 -75
- package/docs/pages/tab.js +16 -15
- package/docs/pages/textfield.eta +9 -8
- package/docs/pages/textfield.js +26 -23
- package/docs/pages/tooltip.eta +10 -12
- package/docs/pages/transition.js +5 -7
- package/docs/postrender.js +7 -5
- package/docs/pwa/pwa.eta +14 -16
- package/docs/pwa/pwa.js +19 -27
- package/docs/pwa/pwa.scss +12 -7
- package/docs/themes/theme-colored.scss +9 -11
- package/docs/themes/theme-default.scss +0 -14
- package/index.scss +27 -0
- package/jsconfig.json +7 -3
- package/package.json +26 -15
- package/tsconfig.json +16 -0
- package/{webpack.config.cjs → webpack.config.js} +105 -58
- package/components/template/_theme.scss +0 -27
- package/components/textfield/_mixins.scss +0 -52
- package/core/color/_theme.scss +0 -390
- package/core/color/index.scss +0 -2
- package/core/theme/_mixins.scss +0 -172
- package/core/theme/_variables.scss +0 -24
- package/docs/_mixins.pug +0 -155
- package/docs/pages/appbar.pug +0 -78
- package/docs/pages/bottomnav.pug +0 -137
- package/docs/pages/button.pug +0 -121
- package/docs/pages/card.pug +0 -74
- package/docs/pages/chip.pug +0 -91
- package/docs/pages/color.pug +0 -121
- package/docs/pages/datatable.pug +0 -283
- package/docs/pages/dialog.pug +0 -132
- package/docs/pages/dom.pug +0 -22
- package/docs/pages/elevation.pug +0 -25
- package/docs/pages/fab.pug +0 -66
- package/docs/pages/grid.pug +0 -95
- package/docs/pages/layout.pug +0 -7
- package/docs/pages/list.pug +0 -326
- package/docs/pages/menu.pug +0 -205
- package/docs/pages/overlay.pug +0 -55
- package/docs/pages/progress.pug +0 -16
- package/docs/pages/ripple.pug +0 -21
- package/docs/pages/search.pug +0 -165
- package/docs/pages/selection.pug +0 -74
- package/docs/pages/slider.pug +0 -17
- package/docs/pages/snackbar.pug +0 -60
- package/docs/pages/tab.pug +0 -304
- package/docs/pages/textfield.pug +0 -360
- package/docs/pages/tooltip.pug +0 -78
- package/docs/pages/transition.pug +0 -76
- package/docs/pages/type.pug +0 -29
- package/docs/pwa/_dialogs.pug +0 -96
- package/docs/pwa/_menus.pug +0 -11
- package/docs/pwa/pwa.pug +0 -325
- package/docs/spec.scss +0 -26
- package/docs/themes/_component-themes.scss +0 -26
- package/docs/themes/theme-colored-fallbacks.scss +0 -17
- package/docs/themes/theme-default-fallbacks.scss +0 -17
|
@@ -1,299 +1,264 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
text-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
78
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
& ~ .mdw-textfield__border {
|
|
81
|
+
border-block-end-color: inherit;
|
|
82
|
+
color: inherit;
|
|
83
|
+
}
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
& ~ .mdw-textfield__border .mdw-textfield__label {
|
|
86
|
+
color: inherit;
|
|
87
|
+
}
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
& ~ .mdw-textfield__border::before {
|
|
90
|
+
color: inherit;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
100
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
114
|
-
|
|
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
|
-
|
|
122
|
-
|
|
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
|
-
|
|
126
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
.mdw-textfield[mdw-value-empty] > input.mdw-textfield__input:not(:focus) {
|
|
130
|
+
color: transparent;
|
|
131
|
+
}
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
input.mdw-textfield__input:not(:focus):placeholder-shown {
|
|
134
|
+
color: transparent;
|
|
135
|
+
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
.mdw-textfield__input::-webkit-calendar-picker-indicator {
|
|
138
|
+
filter: var(--mdw-textfield__date-picker-filter);
|
|
139
|
+
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
164
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
238
|
-
color:
|
|
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
|
-
|
|
243
|
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
220
|
+
.mdw-textfield__helper-text {
|
|
221
|
+
color: RGBA(var(--mdw-textfield__text-rgb), var(--mdw-textfield__secondary-text-opacity));
|
|
222
|
+
}
|
|
254
223
|
|
|
255
|
-
|
|
256
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
228
|
+
.mdw-textfield__input:focus:invalid ~ .mdw-textfield__helper-text {
|
|
229
|
+
color: transparent;
|
|
230
|
+
}
|
|
262
231
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
232
|
+
.mdw-textfield {
|
|
233
|
+
&:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::placeholder {
|
|
234
|
+
color: transparent;
|
|
235
|
+
}
|
|
266
236
|
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
277
|
-
|
|
278
|
-
|
|
241
|
+
&:not([mdw-solo]) > .mdw-textfield__input:not(:focus)::-ms-input-placeholder {
|
|
242
|
+
color: transparent !important;
|
|
243
|
+
}
|
|
279
244
|
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
291
|
-
|
|
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
|
-
|
|
298
|
-
|
|
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,
|
|
145
|
+
input.addEventListener('input', onInput, { passive: true });
|
|
154
146
|
onInput({ currentTarget: input });
|
|
155
147
|
}
|
|
156
148
|
}
|