@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,166 +1,134 @@
|
|
|
1
1
|
// https://material.io/archive/guidelines/components/selection-controls.html#selection-controls-switch
|
|
2
2
|
|
|
3
3
|
@use '../../core/_platform.scss' as platform;
|
|
4
|
-
@use '../../core/theme/_mixins.scss' as theme;
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fallback-check-color: (('background', '50', 1.00), ('background','900',1.0)),
|
|
11
|
-
ripple-color: (('foreground-light', 1.00), ('foreground-dark', 1.00)),
|
|
5
|
+
.mdw-theme {
|
|
6
|
+
--mdw-selection__icon-color: var(--mdw-medium-color);
|
|
7
|
+
--mdw-selection__track-on-opacity: 0.50;
|
|
8
|
+
--mdw-selection__track-off-color: RGBA(var(--mdw-ink-default), 1.00);
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
thumb-off-color: (('background', '50', 1.00), ('background','400',1.0)),
|
|
18
|
-
thumb-disabled-color: (('background', '400', 1.00), ('background','800',1.00)),
|
|
19
|
-
|
|
20
|
-
disabled-opacity: (0.38, 0.50),
|
|
21
|
-
|
|
22
|
-
hover-opacity: (0.04, 0.08),
|
|
23
|
-
focus-opacity: (0.12, 0.24),
|
|
24
|
-
selected-opacity: (0.08, 0.16),
|
|
25
|
-
|
|
26
|
-
hover-focus-opacity: (0.04 + 0.12, 0.08 + 0.24),
|
|
10
|
+
--mdw-selection__hover-opacity: var(--mdw-selection__hover-opacity-value);
|
|
11
|
+
--mdw-selection__focus-opacity: var(--mdw-selection__focus-opacity-value);
|
|
12
|
+
--mdw-selection__selected-opacity: var(--mdw-selection__selected-opacity-value);
|
|
13
|
+
}
|
|
27
14
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
.mdw-theme[mdw-light] {
|
|
16
|
+
--mdw-selection__track-off-opacity: 0.38;
|
|
17
|
+
--mdw-selection__thumb-off-color: RGBA(var(--mdw-alias-background-50), 1.00);
|
|
18
|
+
--mdw-selection__thumb-disabled-color: RGBA(var(--mdw-alias-background-400), 1.00);
|
|
19
|
+
--mdw-selection__disabled-opacity: 0.38;
|
|
20
|
+
--mdw-selection__hover-opacity-value: 0.04;
|
|
21
|
+
--mdw-selection__focus-opacity-value: 0.12;
|
|
22
|
+
--mdw-selection__selected-opacity-value: 0.08;
|
|
23
|
+
}
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
.mdw-theme[mdw-dark] {
|
|
26
|
+
--mdw-selection__track-off-opacity: 0.30;
|
|
27
|
+
--mdw-selection__thumb-off-color: RGBA(var(--mdw-alias-background-400), 1.00);
|
|
28
|
+
--mdw-selection__thumb-disabled-color: RGBA(var(--mdw-alias-background-800), 1.00);
|
|
29
|
+
--mdw-selection__disabled-opacity: 0.50;
|
|
30
|
+
--mdw-selection__hover-opacity-value: 0.08;
|
|
31
|
+
--mdw-selection__focus-opacity-value: 0.24;
|
|
32
|
+
--mdw-selection__selected-opacity-value: 0.16;
|
|
33
|
+
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
.mdw-selection[aria-checked="true"],
|
|
36
|
+
.mdw-selection__input:checked, {
|
|
37
|
+
--mdw-selection__icon-color: RGB(var(--mdw-ink));
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
opacity: 0;
|
|
41
|
-
}
|
|
40
|
+
.mdw-selection__input {
|
|
41
|
+
opacity: calc(var(--mdw-selection__hover-opacity) + var(--mdw-selection__focus-opacity) + var(--mdw-selection__selected-opacity));
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
color:
|
|
43
|
+
&,
|
|
44
|
+
&.mdw-theme {
|
|
45
|
+
color: var(--mdw-selection__icon-color);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
opacity:
|
|
48
|
+
&[mdw-overlay-off~="hover"],
|
|
49
|
+
&:not(:hover) {
|
|
50
|
+
--mdw-selection__hover-opacity-value: 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
&:not([mdw-overlay-touch="true"]):focus:not([mdw-overlay-off~="focus"]):not([mdw-overlay-off~="selected"]) {
|
|
57
|
-
opacity: getThemeValue("selected-focus-opacity", $type);
|
|
58
|
-
}
|
|
53
|
+
&[mdw-overlay-off~="focus"],
|
|
54
|
+
&:not(:focus) {
|
|
55
|
+
--mdw-selection__focus-opacity-value: 0;
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
&:focus:not([mdw-overlay-off~="focus"]) {
|
|
68
|
-
opacity: getThemeValue("hover-focus-opacity", $type);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
58
|
+
// Unselected (unchecked) state
|
|
59
|
+
&:not([aria-checked="true"]):not(:checked),
|
|
60
|
+
&[aria-checked="false"],
|
|
61
|
+
&[mdw-overlay-touch="true"],
|
|
62
|
+
&[mdw-overlay-off~="selected"] {
|
|
63
|
+
--mdw-selection__selected-opacity-value: 0;
|
|
72
64
|
}
|
|
73
65
|
|
|
74
|
-
//
|
|
75
|
-
.mdw-selection
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
&:focus:not([mdw-overlay-off~="focus"]) {
|
|
83
|
-
opacity: getThemeValue("selected-hover-focus-opacity", $type);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
66
|
+
// No overlay when disabled, touch, not hovered, or not focused
|
|
67
|
+
.mdw-selection[aria-disabled="true"] > &,
|
|
68
|
+
&[aria-disabled="true"],
|
|
69
|
+
&[disabled],
|
|
70
|
+
&[mdw-overlay-touch="true"],
|
|
71
|
+
&:not(:focus):not(:hover) {
|
|
72
|
+
opacity: 0;
|
|
88
73
|
}
|
|
74
|
+
}
|
|
89
75
|
|
|
90
|
-
|
|
76
|
+
.mdw-selection__icon {
|
|
91
77
|
// Checkbox check default
|
|
92
|
-
|
|
78
|
+
&[mdw-checkbox]::after {
|
|
93
79
|
// Checkbox color is based on currently filled background-color
|
|
94
|
-
|
|
95
|
-
@include platform.ifEdge() {
|
|
96
|
-
// Edge will not inherit css variables for border in psuedos
|
|
97
|
-
border-color: RGBA(getThemeValue("fallback-check-color", $type));
|
|
98
|
-
}
|
|
99
|
-
border-color: RGB(var(--mdw-surface));
|
|
100
|
-
} @else {
|
|
101
|
-
border-color: RGBA(getThemeValue("fallback-check-color", $type));
|
|
102
|
-
}
|
|
80
|
+
border-color: RGB(var(--mdw-surface));
|
|
103
81
|
}
|
|
104
82
|
|
|
105
83
|
// Switch track default
|
|
106
|
-
|
|
107
|
-
opacity:
|
|
84
|
+
&[mdw-switch]::after {
|
|
85
|
+
opacity: var(--mdw-selection__track-on-opacity);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mdw-selection[aria-disabled="true"] &,
|
|
89
|
+
.mdw-selection__input:disabled ~ & {
|
|
90
|
+
opacity: var(--mdw-selection__disabled-opacity);
|
|
91
|
+
|
|
92
|
+
&[mdw-switch] {
|
|
93
|
+
// Thumb
|
|
94
|
+
&::before {
|
|
95
|
+
background-color: var(--mdw-selection__thumb-disabled-color);
|
|
96
|
+
}
|
|
97
|
+
// Track
|
|
98
|
+
&::after {
|
|
99
|
+
background-color: var(--mdw-selection__track-off-color);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
108
102
|
}
|
|
109
103
|
|
|
110
104
|
// Unchecked or disabled HTMLInputElement
|
|
111
|
-
.mdw-selection[aria-checked="false"]
|
|
112
|
-
.mdw-selection[aria-disabled="true"]
|
|
113
|
-
|
|
114
|
-
.mdw-selection__input:
|
|
105
|
+
.mdw-selection[aria-checked="false"] &,
|
|
106
|
+
.mdw-selection[aria-disabled="true"] &,
|
|
107
|
+
.mdw-selection__input:disabled ~ &,
|
|
108
|
+
input.mdw-selection__input:not(:checked) ~ & {
|
|
115
109
|
&[mdw-checkbox],
|
|
116
110
|
&[mdw-radio] {
|
|
117
|
-
color:
|
|
111
|
+
color: var(--mdw-selection__icon-color);
|
|
118
112
|
}
|
|
119
113
|
|
|
120
114
|
&[mdw-switch] {
|
|
121
115
|
// Thumb
|
|
122
116
|
&::before {
|
|
123
|
-
background-color:
|
|
117
|
+
background-color: var(--mdw-selection__thumb-off-color);
|
|
124
118
|
}
|
|
125
119
|
// Track
|
|
126
120
|
&::after {
|
|
127
|
-
opacity:
|
|
121
|
+
opacity: var(--mdw-selection__track-off-opacity);
|
|
128
122
|
|
|
129
|
-
background-color:
|
|
123
|
+
background-color: var(--mdw-selection__track-off-color);
|
|
130
124
|
}
|
|
131
125
|
}
|
|
132
126
|
}
|
|
133
|
-
|
|
134
|
-
// Disabled HTMLInputElement
|
|
135
|
-
.mdw-selection[aria-disabled="true"] .mdw-selection__label,
|
|
136
|
-
.mdw-selection[aria-disabled="true"] .mdw-selection__icon,
|
|
137
|
-
.mdw-selection__input:disabled ~ .mdw-selection__label,
|
|
138
|
-
.mdw-selection__input:disabled ~ .mdw-selection__icon {
|
|
139
|
-
opacity: getThemeValue("disabled-opacity", $type);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Disabled switch colors
|
|
143
|
-
.mdw-selection[aria-disabled="true"] .mdw-selection__icon[mdw-switch],
|
|
144
|
-
.mdw-selection__input:disabled ~ .mdw-selection__icon[mdw-switch] {
|
|
145
|
-
// Thumb
|
|
146
|
-
&::before {
|
|
147
|
-
background-color: RGBA(getThemeValue("thumb-disabled-color", $type));
|
|
148
|
-
}
|
|
149
|
-
// Track
|
|
150
|
-
&::after {
|
|
151
|
-
background-color: RGBA(getThemeValue("track-off-color", $type));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
127
|
}
|
|
155
128
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
@include addThemeRules('dark');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@include theme.addComponentCSSVariableRules('selection', $themeValues) {
|
|
165
|
-
@include addThemeRules();
|
|
129
|
+
.mdw-selection__label {
|
|
130
|
+
.mdw-selection[aria-disabled="true"] &,
|
|
131
|
+
.mdw-selection__input:disabled ~ & {
|
|
132
|
+
opacity: var(--mdw-selection__disabled-opacity);
|
|
133
|
+
}
|
|
166
134
|
}
|
|
@@ -31,8 +31,7 @@ function onActivateEvent(event) {
|
|
|
31
31
|
event.stopPropagation();
|
|
32
32
|
event.preventDefault();
|
|
33
33
|
}
|
|
34
|
-
/** @type {HTMLElement} */
|
|
35
|
-
const selectionElement = (event.currentTarget);
|
|
34
|
+
const selectionElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
36
35
|
if (Attributes.isDisabled(selectionElement)) {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
@@ -42,28 +41,23 @@ function onActivateEvent(event) {
|
|
|
42
41
|
if (!selectionElement.hasAttribute('aria-checked')) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
if (event.type === 'click' || event.type === SelectionInput.CLICK_EVENT)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
44
|
+
if ((event.type === 'click' || event.type === SelectionInput.CLICK_EVENT)
|
|
45
|
+
&& selectionElement.hasAttribute('mdw-no-autocheck')) return;
|
|
46
|
+
|
|
50
47
|
const role = selectionElement.getAttribute('role');
|
|
51
|
-
if (event.type === 'focus' || event.type === SelectionInput.FOCUS_EVENT)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
}
|
|
48
|
+
if ((event.type === 'focus' || event.type === SelectionInput.FOCUS_EVENT)
|
|
49
|
+
&& role !== 'radio') return;
|
|
50
|
+
|
|
56
51
|
const newValue = (role === 'radio' ? true : !Attributes.isChecked(selectionElement));
|
|
57
52
|
setChecked(selectionElement, newValue, true);
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
/**
|
|
61
|
-
* @param {
|
|
56
|
+
* @param {Element} element
|
|
62
57
|
* @return {void}
|
|
63
58
|
*/
|
|
64
59
|
export function attach(element) {
|
|
65
|
-
/** @type {HTMLElement} */
|
|
66
|
-
const inputElement = (element.getElementsByClassName('mdw-selection__input')[0]);
|
|
60
|
+
const inputElement = /** @type {HTMLElement} */ (element.getElementsByClassName('mdw-selection__input')[0]);
|
|
67
61
|
if (inputElement) {
|
|
68
62
|
SelectionInput.attach(inputElement);
|
|
69
63
|
}
|
|
@@ -10,11 +10,9 @@ export const FOCUS_EVENT = 'mdw:selectioninput-focus';
|
|
|
10
10
|
* @return {void}
|
|
11
11
|
*/
|
|
12
12
|
function onKeyDown(event) {
|
|
13
|
-
if (event.target instanceof HTMLInputElement) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
}
|
|
13
|
+
if (event.target instanceof HTMLInputElement && (event.key === ' ' || event.key === 'Spacebar')) {
|
|
14
|
+
// Don't pass up Spacebar on native input elements
|
|
15
|
+
event.stopPropagation();
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { iterateArrayLike } from '../../core/dom.js';
|
|
2
|
-
|
|
3
1
|
import * as Selection from './index.js';
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -7,31 +5,26 @@ import * as Selection from './index.js';
|
|
|
7
5
|
* @return {void}
|
|
8
6
|
*/
|
|
9
7
|
function onCheckedChange(event) {
|
|
10
|
-
|
|
11
|
-
if (detail.value === 'false') {
|
|
8
|
+
if (event.detail.value === 'false') {
|
|
12
9
|
return;
|
|
13
10
|
}
|
|
14
|
-
/** @type {HTMLElement} */
|
|
15
|
-
const
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
const itemElement = (event.target);
|
|
11
|
+
const radiogroupElement = /** @type {HTMLElement} */ (event.currentTarget);
|
|
12
|
+
const itemElement = /** @type {HTMLElement} */ (event.target);
|
|
18
13
|
setTimeout(() => {
|
|
19
14
|
// Wait to see if event is cancelled
|
|
20
15
|
if (event.defaultPrevented) {
|
|
21
16
|
return;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
(item)
|
|
25
|
-
if (item === itemElement) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
18
|
+
for (const item of radiogroupElement.querySelectorAll('[role="radio"][aria-checked="true"]')) {
|
|
19
|
+
if (item !== itemElement) {
|
|
28
20
|
item.setAttribute('aria-checked', 'false');
|
|
29
|
-
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
30
23
|
});
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
/**
|
|
34
|
-
* @param {
|
|
27
|
+
* @param {Element} element
|
|
35
28
|
* @return {void}
|
|
36
29
|
*/
|
|
37
30
|
export function attach(element) {
|
|
@@ -3,62 +3,57 @@
|
|
|
3
3
|
@use '../../core/_length.scss' as *;
|
|
4
4
|
|
|
5
5
|
@mixin track {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
block-size: 2px;
|
|
7
|
+
inline-size: 100%;
|
|
8
|
+
|
|
8
9
|
background-color: currentColor;
|
|
9
10
|
border-color: transparent;
|
|
10
11
|
color: inherit;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
@mixin thumb {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
block-size: 12px;
|
|
16
|
+
inline-size: 12px;
|
|
17
|
+
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
|
|
17
20
|
background-color: currentColor;
|
|
21
|
+
border-radius: 50%;
|
|
18
22
|
color: inherit;
|
|
19
|
-
cursor: pointer;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.mdw-slider__input {
|
|
26
|
+
inline-size: 100%;
|
|
27
|
+
|
|
23
28
|
-moz-appearance: none;
|
|
24
29
|
-webkit-appearance: none;
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
appearance: none;
|
|
31
|
+
|
|
27
32
|
background: transparent;
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
color: inherit;
|
|
34
|
+
|
|
30
35
|
&:focus {
|
|
31
36
|
outline: none;
|
|
32
37
|
}
|
|
33
|
-
|
|
34
|
-
&::-ms-track {
|
|
35
|
-
width: 100%;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
|
|
38
|
-
background: transparent;
|
|
39
|
-
border-color: transparent;
|
|
40
|
-
color: transparent;
|
|
41
|
-
}
|
|
42
|
-
|
|
38
|
+
|
|
43
39
|
&::-moz-range-track {
|
|
44
40
|
@include track;
|
|
45
41
|
}
|
|
46
|
-
|
|
47
|
-
@include track;
|
|
48
|
-
}
|
|
42
|
+
|
|
49
43
|
&::-webkit-slider-runnable-track {
|
|
50
44
|
@include track;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
|
-
@include thumb;
|
|
54
|
-
}
|
|
46
|
+
|
|
55
47
|
&::-moz-range-thumb {
|
|
56
48
|
@include thumb;
|
|
49
|
+
border: none;
|
|
57
50
|
}
|
|
51
|
+
|
|
58
52
|
&::-webkit-slider-thumb {
|
|
59
53
|
@include thumb;
|
|
54
|
+
margin-block-start: -5px;
|
|
55
|
+
|
|
56
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
60
57
|
-webkit-appearance: none;
|
|
61
|
-
margin-top: dp(-5);
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
|
-
|
|
@@ -18,9 +18,8 @@ $scale-initial: 0.85 !default;
|
|
|
18
18
|
.mdw-snackbar__container {
|
|
19
19
|
display: flex;
|
|
20
20
|
position: absolute;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
left: 0;
|
|
21
|
+
inset-block-end: 0;
|
|
22
|
+
inset-inline: 0;
|
|
24
23
|
flex-direction: row;
|
|
25
24
|
justify-content: flex-start;
|
|
26
25
|
|
|
@@ -33,21 +32,23 @@ $scale-initial: 0.85 !default;
|
|
|
33
32
|
&[mdw-position="center"] {
|
|
34
33
|
justify-content: center;
|
|
35
34
|
}
|
|
36
|
-
}
|
|
35
|
+
}
|
|
37
36
|
|
|
38
37
|
.mdw-snackbar {
|
|
39
38
|
@include type.addRules('body-2');
|
|
40
39
|
|
|
41
40
|
display: flex;
|
|
42
41
|
position: absolute;
|
|
43
|
-
|
|
42
|
+
inset-block-end: 0;
|
|
44
43
|
align-items: center;
|
|
45
44
|
justify-content: space-between;
|
|
46
45
|
|
|
47
|
-
min-
|
|
48
|
-
max-
|
|
49
|
-
padding-
|
|
50
|
-
|
|
46
|
+
min-block-size: 48px;
|
|
47
|
+
max-inline-size: 100%;
|
|
48
|
+
padding-inline: 8px;
|
|
49
|
+
|
|
50
|
+
// Default state is hidden
|
|
51
|
+
pointer-events: auto;
|
|
51
52
|
|
|
52
53
|
animation-name: none;
|
|
53
54
|
animation-duration: motion.$fadeInDuration;
|
|
@@ -57,14 +58,11 @@ $scale-initial: 0.85 !default;
|
|
|
57
58
|
will-change: opacity, transform, visibility;
|
|
58
59
|
|
|
59
60
|
opacity: 0;
|
|
60
|
-
|
|
61
|
-
// Default state is hidden
|
|
62
|
-
pointer-events: auto;
|
|
63
61
|
transform: scale($scale-initial);
|
|
64
62
|
visibility: hidden;
|
|
65
63
|
|
|
66
|
-
border-radius:
|
|
67
|
-
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
|
|
68
66
|
box-shadow: elevation.boxShadow(6);
|
|
69
67
|
|
|
70
68
|
&[aria-hidden="false"] {
|
|
@@ -119,22 +117,21 @@ $scale-initial: 0.85 !default;
|
|
|
119
117
|
order: 1;
|
|
120
118
|
|
|
121
119
|
flex: none;
|
|
122
|
-
margin:
|
|
120
|
+
margin: 6px 0;
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
.mdw-snackbar > span {
|
|
126
124
|
@include type.textTopToTop(16);
|
|
127
125
|
@include type.baselineToBottom(48 - 30);
|
|
128
126
|
box-sizing: border-box;
|
|
129
|
-
padding: 0
|
|
127
|
+
padding: 0 8px;
|
|
130
128
|
|
|
131
129
|
white-space: pre-line;
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
@include breakpoint.isXSmallWindow() {
|
|
135
133
|
.mdw-snackbar {
|
|
136
|
-
|
|
137
|
-
left: 0;
|
|
134
|
+
inset-inline: 0;
|
|
138
135
|
|
|
139
136
|
&[mdw-stacked] {
|
|
140
137
|
align-items: flex-end;
|
|
@@ -142,54 +139,12 @@ $scale-initial: 0.85 !default;
|
|
|
142
139
|
justify-content: center;
|
|
143
140
|
|
|
144
141
|
> span {
|
|
145
|
-
|
|
142
|
+
inline-size: 100%;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
145
|
.mdw-button {
|
|
149
|
-
margin-
|
|
150
|
-
margin-bottom: dp(8);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
@include platform.ifIE() {
|
|
157
|
-
// Fix IE flexbug
|
|
158
|
-
.mdw-snackbar {
|
|
159
|
-
&::after {
|
|
160
|
-
min-height: inherit;
|
|
161
|
-
min-width: 0;
|
|
162
|
-
content: '';
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.mdw-snackbar__container[mdw-position="center"] {
|
|
167
|
-
.mdw-snackbar {
|
|
168
|
-
transform: translateX(-50%);
|
|
169
|
-
|
|
170
|
-
html[dir="rtl"] & {
|
|
171
|
-
transform: translateX(50%);
|
|
172
|
-
|
|
173
|
-
&[mdw-hide] {
|
|
174
|
-
transform: translateX(50%) scale($scale-initial);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
&[mdw-hide] {
|
|
179
|
-
transform: translateX(-50%) scale($scale-initial);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.mdw-snackbar__container[mdw-position="end"] {
|
|
185
|
-
.mdw-snackbar {
|
|
186
|
-
right: 0;
|
|
187
|
-
|
|
188
|
-
html[dir="rtl"] & {
|
|
189
|
-
right: auto;
|
|
190
|
-
left: 0;
|
|
146
|
+
margin-block: 2px 8px;
|
|
191
147
|
}
|
|
192
148
|
}
|
|
193
149
|
}
|
|
194
|
-
|
|
195
150
|
}
|