@shortfuse/materialdesignweb 0.3.0 → 0.4.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/.eslintrc.json +136 -30
- package/.stylelintrc.json +6 -40
- package/.vscode/launch.json +20 -5
- package/CHANGELOG.md +24 -0
- package/README.md +12 -9
- package/adapters/datatable/column.js +82 -74
- package/adapters/datatable/index.js +173 -131
- package/adapters/dom/index.js +529 -75
- package/adapters/list/index.js +25 -12
- package/adapters/search/index.js +13 -13
- package/components/appbar/_spec.scss +87 -64
- package/components/appbar/index.scss +2 -2
- package/components/banner/_spec.scss +8 -8
- package/components/banner/index.scss +2 -2
- package/components/bottomnav/_spec.scss +22 -17
- package/components/bottomnav/index.js +61 -52
- package/components/bottomnav/index.scss +2 -2
- package/components/bottomnav/item.js +44 -25
- package/components/button/README.md +14 -14
- package/components/button/_spec.scss +23 -22
- package/components/button/_theme.scss +37 -21
- package/components/button/index.eta +32 -0
- package/components/button/index.js +12 -12
- package/components/button/index.scss +2 -2
- package/components/card/_spec.scss +40 -36
- package/components/card/index.scss +2 -2
- package/components/chip/_spec.scss +7 -8
- package/components/chip/_theme.scss +31 -31
- package/components/chip/index.js +3 -2
- package/components/chip/index.scss +2 -2
- package/components/chip/item.js +1 -16
- package/components/datatable/_spec.scss +71 -85
- package/components/datatable/_theme.scss +61 -156
- package/components/datatable/cell.js +45 -0
- package/components/datatable/columnheader.js +47 -0
- package/components/datatable/index.js +279 -366
- package/components/datatable/index.scss +2 -2
- package/components/datatable/row.js +49 -0
- package/components/datatable/rowheader.js +18 -0
- package/components/dialog/_spec.scss +61 -41
- package/components/dialog/index.js +325 -297
- package/components/dialog/index.scss +2 -2
- package/components/divider/_spec.scss +8 -6
- package/components/divider/index.scss +2 -2
- package/components/elevation/_spec.scss +2 -2
- package/components/elevation/index.scss +2 -2
- package/components/fab/_spec.scss +23 -24
- package/components/fab/index.js +50 -50
- package/components/fab/index.scss +2 -2
- package/components/grid/_spec.scss +33 -31
- package/components/grid/index.scss +2 -2
- package/components/layout/_mixins.scss +5 -5
- package/components/layout/_spec.scss +206 -176
- package/components/layout/_theme.scss +14 -16
- package/components/layout/index.js +181 -153
- package/components/layout/index.scss +2 -2
- package/components/list/_spec.scss +117 -104
- package/components/list/_theme.scss +31 -34
- package/components/list/content.js +68 -52
- package/components/list/index.js +194 -61
- package/components/list/index.scss +2 -2
- package/components/list/item.js +136 -12
- package/components/list/secondary.js +46 -0
- package/components/menu/_spec.scss +32 -19
- package/components/menu/index.js +242 -229
- package/components/menu/index.scss +2 -2
- package/components/menu/item.js +95 -110
- package/components/progress/_spec.scss +35 -27
- package/components/progress/index.js +21 -0
- package/components/progress/index.scss +2 -1
- package/components/selection/_spec.scss +242 -224
- package/components/selection/_theme.scss +100 -95
- package/components/selection/index.eta +60 -0
- package/components/selection/index.js +76 -0
- package/components/selection/index.pug +15 -8
- package/components/selection/index.scss +2 -2
- package/components/selection/input.js +56 -0
- package/components/selection/radiogroup.js +47 -0
- package/components/slider/_spec.scss +10 -8
- package/components/slider/index.scss +2 -2
- package/components/snackbar/_spec.scss +22 -21
- package/components/snackbar/index.js +102 -111
- package/components/snackbar/index.scss +2 -2
- package/components/tab/_spec.scss +20 -19
- package/components/tab/content.js +41 -40
- package/components/tab/index.js +192 -99
- package/components/tab/index.scss +2 -2
- package/components/tab/item.js +38 -55
- package/components/tab/list.js +96 -72
- package/components/tab/panel.js +12 -13
- package/components/template/_theme.scss +11 -11
- package/components/textfield/_mixins.scss +52 -0
- package/components/textfield/_spec.scss +215 -266
- package/components/textfield/_theme.scss +95 -72
- package/components/textfield/index.eta +74 -0
- package/components/textfield/index.js +63 -57
- package/components/textfield/index.scss +2 -2
- package/components/tooltip/_spec.scss +27 -25
- package/components/tooltip/index.scss +2 -2
- package/components/type/_spec.scss +51 -38
- package/components/type/index.scss +2 -2
- package/core/_breakpoint.scss +75 -91
- package/core/_elevation.scss +10 -10
- package/core/_length.scss +9 -0
- package/core/_motion.scss +14 -14
- package/core/_platform.scss +9 -15
- package/core/_type.scss +33 -32
- package/core/aria/attributes.js +125 -25
- package/core/aria/button.js +23 -23
- package/core/aria/keyboard.js +93 -0
- package/core/aria/rovingtabindex.js +69 -154
- package/core/aria/tab.js +31 -28
- package/core/color/_theme.scss +240 -280
- package/core/color/index.scss +2 -2
- package/core/document/index.js +39 -0
- package/core/dom.js +12 -12
- package/core/overlay/_spec.scss +0 -3
- package/core/overlay/_theme.scss +56 -74
- package/core/overlay/index.js +49 -18
- package/core/overlay/index.scss +2 -2
- package/core/ripple/_spec.scss +22 -39
- package/core/ripple/_theme.scss +13 -13
- package/core/ripple/index.js +137 -134
- package/core/ripple/index.scss +2 -2
- package/core/theme/_config.scss +2 -0
- package/core/theme/_mixins.scss +172 -0
- package/core/theme/_palettes.scss +155 -135
- package/core/theme/_variables.scss +24 -15
- package/core/theme/index.js +50 -0
- package/core/throttler.js +1 -1
- package/core/transition/index.js +36 -20
- package/{docs-src → docs}/_flex.scss +0 -0
- package/{docs-src → docs}/_menuoptions.js +21 -34
- package/{docs-src → docs}/_mixins.pug +39 -26
- package/docs/_partials/_androidnavbar.eta +5 -0
- package/docs/_partials/_androidstatusbar.eta +13 -0
- package/docs/_partials/_appbar.eta +29 -0
- package/docs/_partials/_buttontest.eta +31 -0
- package/docs/_partials/_header.eta +149 -0
- package/docs/_partials/_navlistitem.eta +16 -0
- package/docs/_partials/_target.eta +1 -0
- package/{docs-src → docs}/_sample-utils.js +8 -6
- package/{docs-src → docs}/_storage.js +0 -0
- package/{docs-src → docs}/docs.scss +5 -2
- package/docs/index.eta +16 -0
- package/{docs-src → docs}/index.js +0 -0
- package/docs/pages/appbar.eta +114 -0
- package/{docs-src/components → docs/pages}/appbar.js +0 -0
- package/{docs-src/components → docs/pages}/appbar.pug +15 -18
- package/docs/pages/bottomnav.eta +188 -0
- package/{docs-src/components → docs/pages}/bottomnav.js +23 -24
- package/{docs-src/components → docs/pages}/bottomnav.pug +4 -4
- package/docs/pages/button.eta +124 -0
- package/{docs-src/components → docs/pages}/button.js +19 -19
- package/{docs-src/components → docs/pages}/button.pug +15 -15
- package/docs/pages/card.eta +90 -0
- package/{docs-src/components → docs/pages}/card.js +3 -3
- package/{docs-src/components → docs/pages}/card.pug +7 -7
- package/docs/pages/chip.eta +122 -0
- package/{docs-src/components → docs/pages}/chip.js +3 -6
- package/{docs-src/components → docs/pages}/chip.pug +2 -2
- package/docs/pages/color.eta +143 -0
- package/{docs-src/core → docs/pages}/color.js +95 -20
- package/docs/pages/color.pug +121 -0
- package/docs/pages/datatable.eta +323 -0
- package/{docs-src/components → docs/pages}/datatable.js +26 -13
- package/docs/pages/datatable.pug +283 -0
- package/docs/pages/dialog.eta +186 -0
- package/{docs-src/components → docs/pages}/dialog.js +26 -13
- package/{docs-src/components → docs/pages}/dialog.pug +46 -28
- package/docs/pages/dom.eta +26 -0
- package/docs/pages/dom.js +143 -0
- package/docs/pages/dom.pug +22 -0
- package/docs/pages/elevation.eta +35 -0
- package/{docs-src/components → docs/pages}/elevation.js +0 -0
- package/{docs-src/components → docs/pages}/elevation.pug +0 -0
- package/docs/pages/fab.eta +99 -0
- package/{docs-src/components → docs/pages}/fab.js +3 -3
- package/{docs-src/components → docs/pages}/fab.pug +2 -2
- package/docs/pages/grid.eta +135 -0
- package/{docs-src/components → docs/pages}/grid.js +1 -1
- package/{docs-src/components → docs/pages}/grid.pug +3 -3
- package/docs/pages/layout.eta +8 -0
- package/{docs-src/components → docs/pages}/layout.js +0 -0
- package/{docs-src/components → docs/pages}/layout.pug +0 -0
- package/docs/pages/list.eta +465 -0
- package/{docs-src/components → docs/pages}/list.js +2 -2
- package/{docs-src/components → docs/pages}/list.pug +7 -14
- package/docs/pages/menu.eta +276 -0
- package/{docs-src/components → docs/pages}/menu.js +14 -10
- package/{docs-src/components → docs/pages}/menu.pug +0 -0
- package/docs/pages/overlay.eta +69 -0
- package/docs/pages/overlay.js +4 -0
- package/{docs-src/core → docs/pages}/overlay.pug +14 -11
- package/docs/pages/progress.eta +23 -0
- package/{docs-src/components → docs/pages}/progress.js +1 -1
- package/{docs-src/components → docs/pages}/progress.pug +1 -1
- package/docs/pages/ripple.eta +27 -0
- package/docs/pages/ripple.js +4 -0
- package/{docs-src/core → docs/pages}/ripple.pug +4 -4
- package/docs/pages/search.eta +246 -0
- package/{docs-src/components → docs/pages}/search.js +59 -42
- package/{docs-src/components → docs/pages}/search.pug +50 -51
- package/docs/pages/selection.eta +111 -0
- package/docs/pages/selection.js +13 -0
- package/docs/pages/selection.pug +74 -0
- package/docs/pages/slider.eta +23 -0
- package/{docs-src/components → docs/pages}/slider.js +0 -0
- package/{docs-src/components → docs/pages}/slider.pug +0 -0
- package/docs/pages/snackbar.eta +83 -0
- package/{docs-src/components → docs/pages}/snackbar.js +3 -3
- package/{docs-src/components → docs/pages}/snackbar.pug +0 -0
- package/docs/pages/tab.eta +421 -0
- package/{docs-src/components → docs/pages}/tab.js +18 -35
- package/{docs-src/components → docs/pages}/tab.pug +4 -4
- package/docs/pages/textfield.eta +486 -0
- package/{docs-src/components → docs/pages}/textfield.js +3 -4
- package/{docs-src/components → docs/pages}/textfield.pug +87 -35
- package/docs/pages/tooltip.eta +94 -0
- package/{docs-src/components → docs/pages}/tooltip.js +0 -0
- package/{docs-src/components → docs/pages}/tooltip.pug +0 -1
- package/docs/pages/transition.eta +117 -0
- package/{docs-src/core → docs/pages}/transition.js +7 -8
- package/{docs-src/core → docs/pages}/transition.pug +0 -0
- package/docs/pages/type.eta +31 -0
- package/{docs-src/components → docs/pages}/type.js +0 -0
- package/{docs-src/components → docs/pages}/type.pug +0 -1
- package/docs/postrender.js +39 -0
- package/{docs-src → docs}/prerender.js +3 -9
- package/docs/pwa/_dialogs.eta +143 -0
- package/docs/pwa/_dialogs.pug +96 -0
- package/docs/pwa/_menus.eta +16 -0
- package/{docs-src → docs}/pwa/_menus.pug +0 -0
- package/docs/pwa/pwa-prerender.js +3 -0
- package/docs/pwa/pwa.eta +480 -0
- package/docs/pwa/pwa.js +306 -0
- package/{docs-src → docs}/pwa/pwa.pug +166 -263
- package/docs/pwa/pwa.scss +26 -0
- package/docs/spec.scss +26 -0
- package/docs/themes/_component-themes.scss +26 -0
- package/docs/themes/theme-colored-fallbacks.scss +17 -0
- package/docs/themes/theme-colored.scss +17 -0
- package/docs/themes/theme-default-fallbacks.scss +17 -0
- package/docs/themes/theme-default.scss +17 -0
- package/jsconfig.json +4 -2
- package/package.json +40 -27
- package/scripts/deploy-docs.sh +9 -0
- package/templates/index.eta +2 -0
- package/utils/function.js +3 -0
- package/webpack.config.cjs +257 -0
- package/_spec.scss +0 -27
- package/_theme.scss +0 -27
- package/components/list/expander.js +0 -142
- package/components/list/itemgroup.js +0 -22
- package/core/theme/_builder.scss +0 -116
- package/core/theme/index.scss +0 -68
- package/docs/appbar.html +0 -1
- package/docs/appbar.min.js +0 -2
- package/docs/appbar.min.js.map +0 -1
- package/docs/bottomnav.html +0 -1
- package/docs/bottomnav.min.js +0 -2
- package/docs/bottomnav.min.js.map +0 -1
- package/docs/button.html +0 -1
- package/docs/button.min.js +0 -2
- package/docs/button.min.js.map +0 -1
- package/docs/card.html +0 -1
- package/docs/card.min.js +0 -2
- package/docs/card.min.js.map +0 -1
- package/docs/chip.html +0 -1
- package/docs/chip.min.js +0 -2
- package/docs/chip.min.js.map +0 -1
- package/docs/color.html +0 -1
- package/docs/color.min.js +0 -2
- package/docs/color.min.js.map +0 -1
- package/docs/datatable.html +0 -1
- package/docs/datatable.min.js +0 -2
- package/docs/datatable.min.js.map +0 -1
- package/docs/default.common.min.js +0 -2
- package/docs/default.common.min.js.map +0 -1
- package/docs/dialog.html +0 -1
- package/docs/dialog.min.js +0 -2
- package/docs/dialog.min.js.map +0 -1
- package/docs/docs.min.css +0 -1
- package/docs/docs.min.js +0 -2
- package/docs/docs.min.js.map +0 -1
- package/docs/elevation.html +0 -1
- package/docs/elevation.min.js +0 -2
- package/docs/elevation.min.js.map +0 -1
- package/docs/fab.html +0 -1
- package/docs/fab.min.js +0 -2
- package/docs/fab.min.js.map +0 -1
- package/docs/grid.html +0 -1
- package/docs/grid.min.js +0 -2
- package/docs/grid.min.js.map +0 -1
- package/docs/index.html +0 -1
- package/docs/index.min.js +0 -2
- package/docs/index.min.js.map +0 -1
- package/docs/ink.html +0 -1
- package/docs/ink.min.js +0 -2
- package/docs/ink.min.js.map +0 -1
- package/docs/layout.html +0 -1
- package/docs/layout.min.js +0 -2
- package/docs/layout.min.js.map +0 -1
- package/docs/list.html +0 -1
- package/docs/list.min.js +0 -2
- package/docs/list.min.js.map +0 -1
- package/docs/menu.html +0 -1
- package/docs/menu.min.js +0 -2
- package/docs/menu.min.js.map +0 -1
- package/docs/overlay.html +0 -1
- package/docs/overlay.min.js +0 -2
- package/docs/overlay.min.js.map +0 -1
- package/docs/prerender.common.min.js +0 -2
- package/docs/prerender.common.min.js.map +0 -1
- package/docs/prerender.min.js +0 -2
- package/docs/prerender.min.js.map +0 -1
- package/docs/progress.html +0 -1
- package/docs/progress.min.js +0 -2
- package/docs/progress.min.js.map +0 -1
- package/docs/pwa-prerender.min.js +0 -2
- package/docs/pwa-prerender.min.js.map +0 -1
- package/docs/pwa.html +0 -11
- package/docs/pwa.min.css +0 -1
- package/docs/pwa.min.js +0 -2
- package/docs/pwa.min.js.map +0 -1
- package/docs/ripple.html +0 -1
- package/docs/ripple.min.js +0 -2
- package/docs/ripple.min.js.map +0 -1
- package/docs/search.html +0 -1
- package/docs/search.min.js +0 -2
- package/docs/search.min.js.map +0 -1
- package/docs/selection.html +0 -1
- package/docs/selection.min.js +0 -2
- package/docs/selection.min.js.map +0 -1
- package/docs/slider.html +0 -1
- package/docs/slider.min.js +0 -2
- package/docs/slider.min.js.map +0 -1
- package/docs/snackbar.html +0 -1
- package/docs/snackbar.min.js +0 -2
- package/docs/snackbar.min.js.map +0 -1
- package/docs/spec.min.css +0 -1
- package/docs/spec.min.js +0 -2
- package/docs/spec.min.js.map +0 -1
- package/docs/surface.html +0 -1
- package/docs/surface.min.js +0 -2
- package/docs/surface.min.js.map +0 -1
- package/docs/tab.html +0 -1
- package/docs/tab.min.js +0 -2
- package/docs/tab.min.js.map +0 -1
- package/docs/textfield.html +0 -2
- package/docs/textfield.min.js +0 -2
- package/docs/textfield.min.js.map +0 -1
- package/docs/theme-colored-fallbacks.min.css +0 -1
- package/docs/theme-colored-fallbacks.min.js +0 -2
- package/docs/theme-colored-fallbacks.min.js.map +0 -1
- package/docs/theme-colored.min.css +0 -1
- package/docs/theme-colored.min.js +0 -2
- package/docs/theme-colored.min.js.map +0 -1
- package/docs/theme-default-fallbacks.min.css +0 -1
- package/docs/theme-default-fallbacks.min.js +0 -2
- package/docs/theme-default-fallbacks.min.js.map +0 -1
- package/docs/theme-default.min.css +0 -1
- package/docs/theme-default.min.js +0 -2
- package/docs/theme-default.min.js.map +0 -1
- package/docs/themes-fallbacks.min.css +0 -1
- package/docs/themes-fallbacks.min.js +0 -2
- package/docs/themes-fallbacks.min.js.map +0 -1
- package/docs/themes.min.css +0 -1
- package/docs/themes.min.js +0 -2
- package/docs/themes.min.js.map +0 -1
- package/docs/tooltip.html +0 -1
- package/docs/tooltip.min.js +0 -2
- package/docs/tooltip.min.js.map +0 -1
- package/docs/transition.html +0 -1
- package/docs/transition.min.js +0 -2
- package/docs/transition.min.js.map +0 -1
- package/docs/type.html +0 -1
- package/docs/type.min.js +0 -2
- package/docs/type.min.js.map +0 -1
- package/docs-src/components/datatable.pug +0 -327
- package/docs-src/components/selection.js +0 -9
- package/docs-src/components/selection.pug +0 -77
- package/docs-src/core/color.pug +0 -201
- package/docs-src/core/overlay.js +0 -4
- package/docs-src/core/ripple.js +0 -4
- package/docs-src/index.pug +0 -9
- package/docs-src/pwa/_dialogs.pug +0 -15
- package/docs-src/pwa/pwa-prerender.js +0 -3
- package/docs-src/pwa/pwa.js +0 -182
- package/docs-src/pwa/pwa.scss +0 -25
- package/docs-src/spec.scss +0 -1
- package/docs-src/themes/theme-colored-fallbacks.scss +0 -14
- package/docs-src/themes/theme-colored.scss +0 -14
- package/docs-src/themes/theme-default-fallbacks.scss +0 -14
- package/docs-src/themes/theme-default.scss +0 -14
- package/index.js +0 -51
- package/index.scss +0 -2
- package/webpack.config.js +0 -187
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// https://material.io/archive/guidelines/components/text-fields.html#text-fields-states
|
|
2
2
|
|
|
3
|
-
@
|
|
3
|
+
@use '../../core/theme/_mixins.scss' as theme;
|
|
4
|
+
@use '../../core/_platform.scss' as platform;
|
|
4
5
|
|
|
5
|
-
$
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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,
|
|
9
12
|
|
|
10
13
|
placeholder-color__focus: (('foreground-light', 0.42), ('foreground-dark', 0.50)),
|
|
11
14
|
filled-disabled-border-color: (('foreground-light', 0.10), ('foreground-dark', 0.30)),
|
|
@@ -21,11 +24,11 @@ $mdw-textfield__theme-values: (
|
|
|
21
24
|
selection-opacity: (0.08 + 0.12, 0.16 + 0.24),
|
|
22
25
|
) !default;
|
|
23
26
|
|
|
24
|
-
@function
|
|
25
|
-
@return
|
|
27
|
+
@function getThemeValue($key, $type) {
|
|
28
|
+
@return theme.getThemeValue('textfield', $themeValues, $key, $type);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
@mixin
|
|
31
|
+
@mixin addThemeRules($type: 'var') {
|
|
29
32
|
.mdw-textfield[mdw-outlined] {
|
|
30
33
|
&:active > .mdw-textfield__input:not(:disabled),
|
|
31
34
|
& > .mdw-textfield__input:not(:disabled):focus {
|
|
@@ -41,7 +44,7 @@ $mdw-textfield__theme-values: (
|
|
|
41
44
|
&:invalid {
|
|
42
45
|
& ~ .mdw-textfield__border,
|
|
43
46
|
& ~ .mdw-textfield__border::before {
|
|
44
|
-
color:
|
|
47
|
+
color: RGBA(getThemeValue("warn-color", $type));
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -49,7 +52,7 @@ $mdw-textfield__theme-values: (
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
.mdw-textfield__error-text {
|
|
52
|
-
color:
|
|
55
|
+
color: RGBA(getThemeValue("warn-color", $type));
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
.mdw-textfield {
|
|
@@ -59,7 +62,7 @@ $mdw-textfield__theme-values: (
|
|
|
59
62
|
& > .mdw-textfield__input:not(:disabled):focus {
|
|
60
63
|
@if($type == 'var') {
|
|
61
64
|
&::selection {
|
|
62
|
-
background-color: RGBA(var(--ink
|
|
65
|
+
background-color: RGBA(var(--mdw-ink), getThemeValue("selection-opacity", $type));
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
|
|
@@ -78,67 +81,37 @@ $mdw-textfield__theme-values: (
|
|
|
78
81
|
|
|
79
82
|
&:active > .mdw-textfield__input:not(:disabled):invalid,
|
|
80
83
|
& > .mdw-textfield__input:not(:disabled):focus:invalid {
|
|
81
|
-
caret-color:
|
|
84
|
+
caret-color: RGBA(getThemeValue("warn-color", $type));
|
|
82
85
|
|
|
83
86
|
&::selection {
|
|
84
|
-
background-color:
|
|
87
|
+
background-color: RGBA(getThemeValue("warn-color__selection", $type));
|
|
85
88
|
}
|
|
89
|
+
|
|
86
90
|
& ~ .mdw-textfield__border {
|
|
87
|
-
color: mdwTextfieldThemeValue("warn-color", $type);
|
|
88
91
|
border-bottom-color: currentColor;
|
|
89
|
-
|
|
92
|
+
color: RGBA(getThemeValue("warn-color", $type));
|
|
90
93
|
}
|
|
94
|
+
|
|
91
95
|
& ~ .mdw-textfield__border .mdw-textfield__label {
|
|
92
|
-
// color:
|
|
96
|
+
// color: getThemeValue("warn-color", $type);
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
& ~ .mdw-textfield__border::after {
|
|
96
|
-
color:
|
|
100
|
+
color: RGBA(getThemeValue("warn-color", $type));
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
.mdw-textfield__signifier,
|
|
103
|
-
.mdw-textfield__label
|
|
104
|
-
color: mdwTextfieldThemeValue("secondary-text-color", $type);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
+
.mdw-textfield__label,
|
|
107
108
|
.mdw-textfield__prefix,
|
|
108
109
|
.mdw-textfield__suffix {
|
|
109
|
-
color:
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
select.mdw-textfield__input {
|
|
113
|
-
// Firefox focusring styling workaround
|
|
114
|
-
// https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/extension.css
|
|
115
|
-
.mdw-textfield[mdw-value-empty] > & {
|
|
116
|
-
color: mdwTextfieldThemeValue("placeholder-color__focus", $type);
|
|
117
|
-
|
|
118
|
-
&:focus {
|
|
119
|
-
color: mdwTextfieldThemeValue("secondary-text-color", $type);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:-moz-focusring {
|
|
123
|
-
color: transparent;
|
|
124
|
-
text-shadow: 0 0 0 mdwTextfieldThemeValue("placeholder-color__focus", $type);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&:focus:-moz-focusring {
|
|
128
|
-
color: transparent;
|
|
129
|
-
text-shadow: 0 0 0 mdwTextfieldThemeValue("secondary-text-color", $type);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
&:-moz-focusring {
|
|
134
|
-
color: transparent;
|
|
135
|
-
text-shadow: 0 0 0 mdwTextfieldThemeValue("text-color", $type);
|
|
136
|
-
}
|
|
137
|
-
|
|
110
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
|
|
138
111
|
}
|
|
139
112
|
|
|
140
113
|
.mdw-textfield__icon[mdw-dropdown] {
|
|
141
|
-
color:
|
|
114
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
|
|
142
115
|
}
|
|
143
116
|
|
|
144
117
|
.mdw-textfield[mdw-value-empty] > input.mdw-textfield__input:not(:focus) {
|
|
@@ -154,21 +127,21 @@ $mdw-textfield__theme-values: (
|
|
|
154
127
|
}
|
|
155
128
|
|
|
156
129
|
.mdw-textfield__input::placeholder {
|
|
157
|
-
color:
|
|
130
|
+
color: RGBA(getThemeValue("placeholder-color__focus", $type));
|
|
158
131
|
}
|
|
159
132
|
|
|
160
133
|
.mdw-textfield__input:-ms-input-placeholder {
|
|
161
|
-
color:
|
|
134
|
+
color: RGBA(getThemeValue("placeholder-color__focus", $type)) !important;
|
|
162
135
|
}
|
|
163
136
|
|
|
164
137
|
.mdw-textfield__input::-ms-input-placeholder {
|
|
165
|
-
color:
|
|
138
|
+
color: RGBA(getThemeValue("placeholder-color__focus", $type)) !important;
|
|
166
139
|
}
|
|
167
140
|
|
|
168
141
|
.mdw-textfield__input {
|
|
169
|
-
color:
|
|
142
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("default-text-opacity", $type));
|
|
170
143
|
@if ($type == 'var') {
|
|
171
|
-
caret-color: RGBA(var(--ink
|
|
144
|
+
caret-color: RGBA(var(--mdw-ink));
|
|
172
145
|
} @else {
|
|
173
146
|
caret-color: inherit;
|
|
174
147
|
}
|
|
@@ -183,14 +156,14 @@ $mdw-textfield__theme-values: (
|
|
|
183
156
|
& ~ .mdw-textfield__prefix,
|
|
184
157
|
& ~ .mdw-textfield__suffix,
|
|
185
158
|
& ~ .mdw-textfield__icon {
|
|
186
|
-
color:
|
|
159
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("disabled-opacity", $type));
|
|
187
160
|
}
|
|
188
161
|
}
|
|
189
162
|
|
|
190
163
|
// Hover
|
|
191
164
|
&:not(:focus):hover:not(:disabled):not(:active) ~ .mdw-textfield__border,
|
|
192
165
|
&:not(:focus):not(:disabled):not(:active) ~ .mdw-textfield__border:hover {
|
|
193
|
-
color:
|
|
166
|
+
color: RGBA(getThemeValue("border-line-color__hover", $type));
|
|
194
167
|
}
|
|
195
168
|
|
|
196
169
|
&:not(:focus) {
|
|
@@ -206,18 +179,68 @@ $mdw-textfield__theme-values: (
|
|
|
206
179
|
}
|
|
207
180
|
}
|
|
208
181
|
}
|
|
182
|
+
|
|
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
|
+
}
|
|
197
|
+
|
|
198
|
+
&:focus:-moz-focusring {
|
|
199
|
+
color: transparent;
|
|
200
|
+
text-shadow: 0 0 0 RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&:-moz-focusring {
|
|
205
|
+
color: transparent;
|
|
206
|
+
text-shadow: 0 0 0 RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
|
|
207
|
+
}
|
|
208
|
+
|
|
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;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
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));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Dropdown caret
|
|
228
|
+
&::-ms-expand {
|
|
229
|
+
display: none;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
209
232
|
|
|
210
233
|
.mdw-textfield__border {
|
|
211
|
-
color:
|
|
234
|
+
color: RGBA(getThemeValue("border-line-color", $type));
|
|
212
235
|
}
|
|
213
236
|
|
|
214
237
|
.mdw-textfield__helper-text {
|
|
215
|
-
color:
|
|
238
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("secondary-text-opacity", $type));
|
|
216
239
|
}
|
|
217
240
|
|
|
218
241
|
|
|
219
242
|
.mdw-textfield__input:disabled ~ .mdw-textfield__helper-text {
|
|
220
|
-
color:
|
|
243
|
+
color: RGBA(getThemeValue("text-color", $type), getThemeValue("disabled-opacity", $type));
|
|
221
244
|
}
|
|
222
245
|
|
|
223
246
|
.mdw-textfield__input:focus:invalid ~ .mdw-textfield__helper-text {
|
|
@@ -242,35 +265,35 @@ $mdw-textfield__theme-values: (
|
|
|
242
265
|
}
|
|
243
266
|
|
|
244
267
|
.mdw-textfield__input:not(:focus) ~ .mdw-textfield__border {
|
|
245
|
-
color:
|
|
268
|
+
color: RGBA(getThemeValue("border-line-color", $type));
|
|
246
269
|
}
|
|
247
270
|
|
|
248
271
|
.mdw-textfield__input:disabled ~ .mdw-textfield__border {
|
|
249
|
-
background-color:
|
|
250
|
-
color:
|
|
272
|
+
background-color: RGBA(getThemeValue("filled-disabled-background-color", $type));
|
|
273
|
+
color: RGBA(getThemeValue("filled-disabled-border-color", $type));
|
|
251
274
|
}
|
|
252
275
|
|
|
253
276
|
&:not([mdw-outlined]) > .mdw-textfield__border {
|
|
254
|
-
background-color:
|
|
277
|
+
background-color: RGBA(getThemeValue("fill-color", $type));
|
|
255
278
|
}
|
|
256
279
|
|
|
257
280
|
&:not([mdw-outlined]) > .mdw-textfield__input:not(:disabled) {
|
|
258
281
|
& ~ .mdw-textfield__border:hover,
|
|
259
282
|
&:hover ~ .mdw-textfield__border {
|
|
260
|
-
background-color:
|
|
283
|
+
background-color: RGBA(getThemeValue("fill-color__hover", $type));
|
|
261
284
|
}
|
|
262
285
|
}
|
|
263
286
|
}
|
|
264
287
|
}
|
|
265
288
|
|
|
266
289
|
|
|
267
|
-
@include
|
|
268
|
-
@include
|
|
290
|
+
@include theme.addComponentFallbackRules('light') {
|
|
291
|
+
@include addThemeRules('light');
|
|
269
292
|
}
|
|
270
|
-
@include
|
|
271
|
-
@include
|
|
293
|
+
@include theme.addComponentFallbackRules('dark') {
|
|
294
|
+
@include addThemeRules('dark');
|
|
272
295
|
}
|
|
273
296
|
|
|
274
|
-
@include
|
|
275
|
-
@include
|
|
297
|
+
@include theme.addComponentCSSVariableRules('textfield', $themeValues) {
|
|
298
|
+
@include addThemeRules();
|
|
276
299
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<label <%~ Object.entries({
|
|
2
|
+
'class': [
|
|
3
|
+
'mdw-textfield',
|
|
4
|
+
it?.ink || it?.theme ? 'mdw-theme' : '',
|
|
5
|
+
it?.labelClass,
|
|
6
|
+
].filter(v=>v).join(' '),
|
|
7
|
+
'mdw-outlined': it?.outlined,
|
|
8
|
+
'mdw-autosize': it?.autosize,
|
|
9
|
+
'mdw-ink': it?.ink,
|
|
10
|
+
...it?.labelAttributes,
|
|
11
|
+
}).map(([key, value]) => {
|
|
12
|
+
if (value === true) return key;
|
|
13
|
+
if (value === false || value == null) return false;
|
|
14
|
+
return `${key}="${value}"`
|
|
15
|
+
}).filter(v=>v).join(' ')-%>>
|
|
16
|
+
|
|
17
|
+
<%_ if (it?.signifier) { _%>
|
|
18
|
+
<div <%~ Object.entries({
|
|
19
|
+
'class': [
|
|
20
|
+
'mdw-textfield__signifier',
|
|
21
|
+
it?.signifier.class,
|
|
22
|
+
].join(' '),
|
|
23
|
+
...it?.signifier.attributes,
|
|
24
|
+
}).map(([key, value]) => {
|
|
25
|
+
if (value === true) return key;
|
|
26
|
+
if (value === false || value == null) return false;
|
|
27
|
+
return `${key}="${value}"`;
|
|
28
|
+
}).filter(v=>v).join(' ')-%>><%~ it?.signifier.body ?? '' %><%= it?.signifier.text ?? '' %></div>
|
|
29
|
+
<%_ } _%>
|
|
30
|
+
|
|
31
|
+
<input <%~ Object.entries({
|
|
32
|
+
'class': [
|
|
33
|
+
'mdw-textfield__input',
|
|
34
|
+
it?.class,
|
|
35
|
+
].filter(v=>v).join(' '),
|
|
36
|
+
'disabled': it?.disabled && it?.disabled !== 'false',
|
|
37
|
+
'aria-disabled': it?.disabled === true ? 'true' : it?.disabled,
|
|
38
|
+
'minlength': it?.minlength,
|
|
39
|
+
'placeholder': it?.placeholder ?? ' ',
|
|
40
|
+
'required': it?.required,
|
|
41
|
+
'name': it?.name,
|
|
42
|
+
'type': it?.type ?? 'text',
|
|
43
|
+
'value': it?.value,
|
|
44
|
+
...it?.attributes,
|
|
45
|
+
}).map(([key, value]) => {
|
|
46
|
+
if (value === true) return key;
|
|
47
|
+
if (value === false || value == null) return false;
|
|
48
|
+
return `${key}="${value}"`;
|
|
49
|
+
}).filter(v=>v).join(' ')-%> />
|
|
50
|
+
|
|
51
|
+
<%_ _%>
|
|
52
|
+
|
|
53
|
+
<div class="mdw-textfield__border">
|
|
54
|
+
<div class="mdw-textfield__outline-gap">
|
|
55
|
+
<div class="mdw-textfield__label"><%= it?.body ?? '' %><%= it?.text ?? '' %></div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<%_ if (it?.prefix) { _%>
|
|
60
|
+
<div class="mdw-textfield__prefix"><%= it?.prefix %></div>
|
|
61
|
+
<%_ } _%>
|
|
62
|
+
|
|
63
|
+
<%_ if (it?.suffix) { _%>
|
|
64
|
+
<div class="mdw-textfield__suffix"><%= it?.suffix %></div>
|
|
65
|
+
<% } %>
|
|
66
|
+
|
|
67
|
+
<%_ if (it?.helper) { _%>
|
|
68
|
+
<div class="mdw-textfield__helper-text"><%= it?.helper %></div>
|
|
69
|
+
<%_ } _%>
|
|
70
|
+
|
|
71
|
+
<%_ if (it?.error) { _%>
|
|
72
|
+
<div class="mdw-textfield__error-text"><%= it?.error %></div>
|
|
73
|
+
<%_ } _%>
|
|
74
|
+
</label>
|
|
@@ -1,74 +1,58 @@
|
|
|
1
|
-
import { getPassiveEventListenerOption } from '../../core/dom';
|
|
1
|
+
import { getPassiveEventListenerOption } from '../../core/dom.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
5
|
-
* @return {void}
|
|
6
|
-
*/
|
|
7
|
-
export function attach(textfieldElement) {
|
|
8
|
-
/** @type {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} */
|
|
9
|
-
const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
|
|
10
|
-
if (input) {
|
|
11
|
-
input.addEventListener('input', onInput, getPassiveEventListenerOption());
|
|
12
|
-
onInput({ currentTarget: input });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {Element} textfieldElement
|
|
18
|
-
* @return {void}
|
|
19
|
-
*/
|
|
20
|
-
export function detach(textfieldElement) {
|
|
21
|
-
textfieldElement.removeAttribute('mdw-value-empty');
|
|
22
|
-
const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
|
|
23
|
-
if (input) {
|
|
24
|
-
input.removeEventListener('input', onInput);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {Event|{currentTarget}} event
|
|
4
|
+
* @param {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} inputElement
|
|
30
5
|
* @return {void}
|
|
31
6
|
*/
|
|
32
|
-
export function onInput(event) {
|
|
33
|
-
const inputElement = event.currentTarget;
|
|
34
|
-
if (inputElement.parentElement.hasAttribute('mdw-autosize')) {
|
|
35
|
-
updateTextAreaSize(inputElement);
|
|
36
|
-
}
|
|
37
|
-
updateInputEmptyState(inputElement);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @param {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} inputElement
|
|
42
|
-
* @return {void} */
|
|
43
7
|
export function updateInputEmptyState(inputElement) {
|
|
44
|
-
const
|
|
8
|
+
const attrName = 'mdw-value-empty';
|
|
45
9
|
const textfieldElement = inputElement.parentElement;
|
|
46
10
|
if (inputElement.value) {
|
|
47
|
-
if (textfieldElement.hasAttribute(
|
|
48
|
-
textfieldElement.removeAttribute(
|
|
11
|
+
if (textfieldElement.hasAttribute(attrName)) {
|
|
12
|
+
textfieldElement.removeAttribute(attrName);
|
|
49
13
|
}
|
|
50
|
-
} else if (!textfieldElement.hasAttribute(
|
|
51
|
-
textfieldElement.setAttribute(
|
|
14
|
+
} else if (!textfieldElement.hasAttribute(attrName)) {
|
|
15
|
+
textfieldElement.setAttribute(attrName, '');
|
|
52
16
|
}
|
|
53
17
|
}
|
|
54
18
|
|
|
55
19
|
/**
|
|
56
20
|
* @param {HTMLTextAreaElement} inputElement
|
|
57
|
-
* @return {number} Single row height
|
|
21
|
+
* @return {number} Single row height
|
|
22
|
+
*/
|
|
58
23
|
export function updateTextAreaSize(inputElement) {
|
|
59
|
-
const
|
|
60
|
-
|
|
24
|
+
const previousRowsAttrValue = inputElement.getAttribute('rows');
|
|
25
|
+
// eslint-disable-next-line no-param-reassign
|
|
26
|
+
inputElement.rows = 1;
|
|
61
27
|
const { height, paddingTop } = window.getComputedStyle(inputElement);
|
|
62
28
|
if (!height || height === 'auto') {
|
|
63
|
-
|
|
29
|
+
if (previousRowsAttrValue == null) {
|
|
30
|
+
inputElement.removeAttribute('rows');
|
|
31
|
+
} else {
|
|
32
|
+
inputElement.setAttribute('rows', previousRowsAttrValue);
|
|
33
|
+
}
|
|
64
34
|
return -1;
|
|
65
35
|
}
|
|
66
36
|
const heightPx = parseInt(height.replace('px', ''), 10);
|
|
67
37
|
const paddingTopPx = parseInt(paddingTop.replace('px', ''), 10);
|
|
68
|
-
|
|
38
|
+
// eslint-disable-next-line no-param-reassign
|
|
39
|
+
inputElement.rows = Math.floor((inputElement.scrollHeight - paddingTopPx) / heightPx);
|
|
69
40
|
return heightPx;
|
|
70
41
|
}
|
|
71
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @param {Event|{currentTarget:HTMLElement}} event
|
|
45
|
+
* @return {void}
|
|
46
|
+
*/
|
|
47
|
+
export function onInput(event) {
|
|
48
|
+
/** @type {HTMLInputElement|HTMLTextAreaElement} */
|
|
49
|
+
const inputElement = (event.currentTarget);
|
|
50
|
+
if (inputElement.parentElement.hasAttribute('mdw-autosize')) {
|
|
51
|
+
updateTextAreaSize(/** @type {HTMLTextAreaElement} */ (inputElement));
|
|
52
|
+
}
|
|
53
|
+
updateInputEmptyState(inputElement);
|
|
54
|
+
}
|
|
55
|
+
|
|
72
56
|
/**
|
|
73
57
|
* @param {Element} textfieldElement
|
|
74
58
|
* @return {string|Date|number}
|
|
@@ -79,8 +63,7 @@ export function getValue(textfieldElement) {
|
|
|
79
63
|
if ((input instanceof HTMLTextAreaElement) || (input instanceof HTMLSelectElement)) {
|
|
80
64
|
return input.value;
|
|
81
65
|
}
|
|
82
|
-
|
|
83
|
-
switch (type) {
|
|
66
|
+
switch (input.type) {
|
|
84
67
|
case 'number':
|
|
85
68
|
case 'range':
|
|
86
69
|
return Number.isNaN(input.valueAsNumber) ? null : input.valueAsNumber;
|
|
@@ -91,7 +74,7 @@ export function getValue(textfieldElement) {
|
|
|
91
74
|
return null;
|
|
92
75
|
}
|
|
93
76
|
return new Date(
|
|
94
|
-
(new Date(input.valueAsNumber).getTimezoneOffset() * 60 * 1000) + input.valueAsNumber
|
|
77
|
+
(new Date(input.valueAsNumber).getTimezoneOffset() * 60 * 1000) + input.valueAsNumber,
|
|
95
78
|
);
|
|
96
79
|
default:
|
|
97
80
|
return input.value;
|
|
@@ -100,7 +83,7 @@ export function getValue(textfieldElement) {
|
|
|
100
83
|
|
|
101
84
|
/**
|
|
102
85
|
* @param {Element} textfieldElement
|
|
103
|
-
* @param {
|
|
86
|
+
* @param {string|Date|number} [value]
|
|
104
87
|
* @return {void}
|
|
105
88
|
*/
|
|
106
89
|
export function setValue(textfieldElement, value) {
|
|
@@ -117,14 +100,13 @@ export function setValue(textfieldElement, value) {
|
|
|
117
100
|
input.value = value.toString(10);
|
|
118
101
|
}
|
|
119
102
|
} else if (value instanceof Date) {
|
|
120
|
-
|
|
121
|
-
if (type === 'time') {
|
|
103
|
+
if (input.type === 'time') {
|
|
122
104
|
const hoursStr = `${value.getHours() < 10 ? '0' : ''}${value.getHours()}`;
|
|
123
105
|
const minutesStr = `${value.getMinutes() < 10 ? '0' : ''}${value.getMinutes()}`;
|
|
124
106
|
const secondsStr = `${value.getSeconds() < 10 ? '0' : ''}${value.getSeconds()}`;
|
|
125
107
|
input.value = `${hoursStr}:${minutesStr}:${secondsStr}.${value.getMilliseconds()}`;
|
|
126
108
|
} else {
|
|
127
|
-
switch (type) {
|
|
109
|
+
switch (input.type) {
|
|
128
110
|
case 'date':
|
|
129
111
|
input.valueAsDate = value;
|
|
130
112
|
break;
|
|
@@ -142,8 +124,7 @@ export function setValue(textfieldElement, value) {
|
|
|
142
124
|
} else if (typeof value === 'string') {
|
|
143
125
|
input.value = value;
|
|
144
126
|
} else {
|
|
145
|
-
|
|
146
|
-
switch (type) {
|
|
127
|
+
switch (input.type) {
|
|
147
128
|
case 'date':
|
|
148
129
|
case 'time':
|
|
149
130
|
case 'datetime-local':
|
|
@@ -160,3 +141,28 @@ export function setValue(textfieldElement, value) {
|
|
|
160
141
|
updateTextAreaSize(input);
|
|
161
142
|
}
|
|
162
143
|
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {Element} textfieldElement
|
|
147
|
+
* @return {void}
|
|
148
|
+
*/
|
|
149
|
+
export function attach(textfieldElement) {
|
|
150
|
+
/** @type {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} */
|
|
151
|
+
const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
|
|
152
|
+
if (input) {
|
|
153
|
+
input.addEventListener('input', onInput, getPassiveEventListenerOption());
|
|
154
|
+
onInput({ currentTarget: input });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @param {Element} textfieldElement
|
|
160
|
+
* @return {void}
|
|
161
|
+
*/
|
|
162
|
+
export function detach(textfieldElement) {
|
|
163
|
+
textfieldElement.removeAttribute('mdw-value-empty');
|
|
164
|
+
const input = (textfieldElement.getElementsByClassName('mdw-textfield__input')[0]);
|
|
165
|
+
if (input) {
|
|
166
|
+
input.removeEventListener('input', onInput);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@forward './_spec.scss';
|
|
2
|
+
@forward './_theme.scss';
|