@shortfuse/materialdesignweb 0.7.6 → 0.8.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/README.md +57 -68
- package/components/Badge.js +2 -2
- package/components/BottomAppBar.js +3 -5
- package/components/Box.js +33 -3
- package/components/Button.js +48 -21
- package/components/Button.md +9 -9
- package/components/Card.js +9 -16
- package/components/Checkbox.js +45 -36
- package/components/CheckboxIcon.js +2 -2
- package/components/Chip.js +1 -1
- package/components/Dialog.js +228 -359
- package/components/DialogActions.js +2 -2
- package/components/Divider.js +3 -3
- package/components/ExtendedFab.js +4 -8
- package/components/Fab.js +1 -2
- package/components/FilterChip.js +4 -4
- package/components/Headline.js +1 -1
- package/components/Icon.js +8 -8
- package/components/IconButton.js +9 -14
- package/components/Input.js +273 -1
- package/components/Layout.js +485 -16
- package/components/List.js +6 -4
- package/components/ListItem.js +12 -12
- package/components/ListOption.js +21 -5
- package/components/Listbox.js +239 -0
- package/components/Menu.js +77 -526
- package/components/MenuItem.js +12 -14
- package/components/Nav.js +0 -2
- package/components/NavBar.js +8 -79
- package/components/NavDrawer.js +12 -11
- package/components/NavDrawerItem.js +2 -1
- package/components/NavItem.js +18 -8
- package/components/NavRail.js +15 -7
- package/components/NavRailItem.js +3 -1
- package/components/Popup.js +20 -0
- package/components/Progress.js +24 -23
- package/components/Radio.js +42 -35
- package/components/RadioIcon.js +3 -3
- package/components/Ripple.js +2 -3
- package/components/Search.js +85 -0
- package/components/SegmentedButton.js +1 -10
- package/components/SegmentedButtonGroup.js +16 -10
- package/components/Select.js +4 -4
- package/components/Shape.js +1 -1
- package/components/Slider.js +43 -50
- package/components/Snackbar.js +4 -5
- package/components/Surface.js +3 -3
- package/components/Switch.js +55 -21
- package/components/SwitchIcon.js +10 -8
- package/components/Tab.js +11 -9
- package/components/TabContent.js +4 -3
- package/components/TabList.js +2 -2
- package/components/TabPanel.js +11 -8
- package/components/TextArea.js +38 -35
- package/components/Tooltip.js +2 -2
- package/components/TopAppBar.js +65 -147
- package/core/Composition.js +985 -628
- package/core/CompositionAdapter.js +315 -0
- package/core/CustomElement.js +153 -90
- package/core/DomAdapter.js +586 -0
- package/core/ICustomElement.d.ts +2 -2
- package/core/css.js +8 -7
- package/core/customTypes.js +53 -31
- package/{utils → core}/jsonMergePatch.js +36 -14
- package/core/observe.js +111 -57
- package/core/optimizations.js +23 -0
- package/core/template.js +17 -11
- package/core/test.js +126 -0
- package/core/typings.d.ts +11 -5
- package/core/uid.js +13 -0
- package/dist/index.min.js +83 -152
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/mixins/AriaReflectorMixin.js +1 -2
- package/mixins/AriaToolbarMixin.js +2 -3
- package/mixins/ControlMixin.js +25 -17
- package/mixins/DensityMixin.js +0 -1
- package/mixins/FlexableMixin.js +1 -2
- package/mixins/FormAssociatedMixin.js +13 -10
- package/mixins/InputMixin.js +2 -9
- package/mixins/KeyboardNavMixin.js +14 -1
- package/mixins/PopupMixin.js +757 -0
- package/mixins/RTLObserverMixin.js +0 -1
- package/mixins/ResizeObserverMixin.js +0 -1
- package/mixins/RippleMixin.js +3 -4
- package/mixins/ScrollListenerMixin.js +41 -32
- package/mixins/SemiStickyMixin.js +151 -0
- package/mixins/ShapeMixin.js +29 -24
- package/mixins/StateMixin.js +11 -6
- package/mixins/SurfaceMixin.js +3 -57
- package/mixins/TextFieldMixin.js +57 -65
- package/mixins/ThemableMixin.js +78 -156
- package/mixins/TooltipTriggerMixin.js +7 -13
- package/mixins/TouchTargetMixin.js +4 -3
- package/package.json +9 -5
- package/theming/index.js +1 -1
- package/theming/themableMixinLoader.js +12 -0
- package/utils/{hct → material-color}/blend.js +8 -10
- package/utils/{hct → material-color/hct}/Cam16.js +196 -69
- package/utils/{hct → material-color/hct}/Hct.js +61 -19
- package/utils/{hct → material-color/hct}/ViewingConditions.js +3 -3
- package/utils/{hct → material-color/hct}/hctSolver.js +9 -16
- package/utils/{hct → material-color}/helper.js +11 -18
- package/utils/{hct → material-color/palettes}/CorePalette.js +79 -19
- package/utils/{hct → material-color/palettes}/TonalPalette.js +12 -4
- package/utils/material-color/scheme/Scheme.js +376 -0
- package/utils/{hct/colorUtils.js → material-color/utils/color.js} +61 -1
- package/utils/popup.js +46 -25
- package/components/ListSelect.js +0 -220
- package/components/Option.js +0 -91
- package/components/Pane.js +0 -281
- package/core/identify.js +0 -40
- package/utils/hct/Scheme.js +0 -587
- /package/utils/{hct/mathUtils.js → material-color/utils/math.js} +0 -0
package/components/MenuItem.js
CHANGED
|
@@ -6,8 +6,8 @@ import './Icon.js';
|
|
|
6
6
|
import ListOption from './ListOption.js';
|
|
7
7
|
|
|
8
8
|
export default class MenuItem extends ListOption
|
|
9
|
-
.mixin(FormAssociatedMixin)
|
|
10
9
|
.extend()
|
|
10
|
+
.mixin(FormAssociatedMixin)
|
|
11
11
|
.set({
|
|
12
12
|
_cascadeTimeout: null,
|
|
13
13
|
CASCADE_TIMEOUT: 500,
|
|
@@ -96,7 +96,9 @@ export default class MenuItem extends ListOption
|
|
|
96
96
|
cascade() {
|
|
97
97
|
this.unscheduleCascade();
|
|
98
98
|
this._cascading = true;
|
|
99
|
-
|
|
99
|
+
// Dispatch event asking for cascade.
|
|
100
|
+
// Captured by parent mdw-menu and used to track current submenu
|
|
101
|
+
this.dispatchEvent(new CustomEvent('mdw-menu-item:cascade', { detail: this.cascades, bubbles: true }));
|
|
100
102
|
this._cascading = false;
|
|
101
103
|
},
|
|
102
104
|
})
|
|
@@ -170,10 +172,7 @@ export default class MenuItem extends ListOption
|
|
|
170
172
|
blur() {
|
|
171
173
|
if (!this.cascades) return;
|
|
172
174
|
if (this._cascading) return;
|
|
173
|
-
|
|
174
|
-
if (submenuElement.matches(':focus-within')) return;
|
|
175
|
-
console.debug('closing submenu via cascader blur');
|
|
176
|
-
submenuElement.close(false);
|
|
175
|
+
this.dispatchEvent(new CustomEvent('mdw-menu-item:cascader-blur', { detail: this.cascades, bubbles: true }));
|
|
177
176
|
},
|
|
178
177
|
})
|
|
179
178
|
.on({
|
|
@@ -193,16 +192,20 @@ export default class MenuItem extends ListOption
|
|
|
193
192
|
|
|
194
193
|
anchor.after(html`
|
|
195
194
|
<mdw-icon id=selection
|
|
196
|
-
|
|
195
|
+
mdw-if=${({ checkbox, radio }) => checkbox ?? radio ?? false}
|
|
197
196
|
class=${({ checkbox, radio }) => checkbox || radio || 'leading'}
|
|
198
197
|
selected={selected}>check</mdw-icon>
|
|
199
198
|
`);
|
|
200
199
|
|
|
201
200
|
trailing.setAttribute('type-style', 'label-large');
|
|
202
201
|
|
|
203
|
-
trailingIcon.setAttribute('
|
|
202
|
+
trailingIcon.setAttribute('mdw-if', '{computeTrailingIcon}');
|
|
204
203
|
trailingIcon.textContent = '{computeTrailingIcon}';
|
|
205
204
|
},
|
|
205
|
+
_formResetChanged(oldValue, newValue) {
|
|
206
|
+
if (!newValue) return;
|
|
207
|
+
this._selected = this.defaultSelected;
|
|
208
|
+
},
|
|
206
209
|
})
|
|
207
210
|
.css`
|
|
208
211
|
/* https://m3.material.io/components/menus/specs */
|
|
@@ -260,9 +263,4 @@ export default class MenuItem extends ListOption
|
|
|
260
263
|
}
|
|
261
264
|
`
|
|
262
265
|
.autoRegister('mdw-menu-item')
|
|
263
|
-
.tsClassFix() {
|
|
264
|
-
formResetCallback() {
|
|
265
|
-
this._selected = this.defaultSelected;
|
|
266
|
-
super.formResetCallback();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
266
|
+
.tsClassFix() {}
|
package/components/Nav.js
CHANGED
|
@@ -9,8 +9,6 @@ export default Surface
|
|
|
9
9
|
/* https://m3.material.io/components/navigation-rail/specs */
|
|
10
10
|
|
|
11
11
|
:host {
|
|
12
|
-
--mdw-surface__tint: var(--mdw-surface__tint__2);
|
|
13
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__2);
|
|
14
12
|
--mdw-ink: var(--mdw-color__on-surface);
|
|
15
13
|
--mdw-bg: var(--mdw-color__surface);
|
|
16
14
|
|
package/components/NavBar.js
CHANGED
|
@@ -1,58 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ScrollListenerMixin from '../mixins/ScrollListenerMixin.js';
|
|
1
|
+
import SemiStickyMixin from '../mixins/SemiStickyMixin.js';
|
|
3
2
|
|
|
4
3
|
import Nav from './Nav.js';
|
|
5
4
|
|
|
6
5
|
export default Nav
|
|
7
|
-
.
|
|
6
|
+
.extend()
|
|
7
|
+
.mixin(SemiStickyMixin)
|
|
8
8
|
.observe({
|
|
9
|
-
|
|
10
|
-
_translateY: { type: 'float', empty: 0 },
|
|
11
|
-
_transition: { empty: 'none' },
|
|
12
|
-
})
|
|
13
|
-
.observe({
|
|
14
|
-
_positioningStyle: {
|
|
15
|
-
...ELEMENT_STYLER_TYPE,
|
|
16
|
-
get({ _translateY, _transition }) {
|
|
17
|
-
return {
|
|
18
|
-
styles: {
|
|
19
|
-
transform: `translateY(${_translateY}px)`,
|
|
20
|
-
transition: _transition,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
.methods({
|
|
27
|
-
onScrollerResize() {
|
|
28
|
-
console.log('onScrollerResize');
|
|
29
|
-
// Chrome Bug: When window resizes bottom sticky needs to be recomputed
|
|
30
|
-
// Force style recalculation
|
|
31
|
-
this.style.setProperty('bottom', 'auto');
|
|
32
|
-
// eslint-disable-next-line no-unused-expressions
|
|
33
|
-
this.clientHeight;
|
|
34
|
-
this.style.removeProperty('bottom');
|
|
35
|
-
this.propChangedCallback('scrollListenerPositionY', this.scrollListenerPositionY, this.scrollListenerPositionY);
|
|
36
|
-
},
|
|
37
|
-
onScrollIdle() {
|
|
38
|
-
const max = this.scrollHeight;
|
|
39
|
-
const visibility = (max - this._translateY) / max;
|
|
40
|
-
if (visibility <= 0) return;
|
|
41
|
-
if (visibility >= 1) return;
|
|
42
|
-
if (visibility >= 0.5) {
|
|
43
|
-
// Reveal all
|
|
44
|
-
this._translateY = 0;
|
|
45
|
-
this._transition = 'transform 250ms ease-in';
|
|
46
|
-
} else {
|
|
47
|
-
this._translateY = max;
|
|
48
|
-
this._transition = 'transform 200ms ease-out';
|
|
49
|
-
}
|
|
50
|
-
},
|
|
9
|
+
_semiStickyAnchor: { empty: 'bottom' },
|
|
51
10
|
})
|
|
52
11
|
.css`
|
|
53
12
|
/* https://m3.material.io/components/navigation-bar/specs */
|
|
54
13
|
|
|
55
14
|
:host {
|
|
15
|
+
--mdw-bg: var(--mdw-color__surface-container);
|
|
16
|
+
|
|
56
17
|
position: sticky;
|
|
57
18
|
inset-block-end: 0;
|
|
58
19
|
order:1; /* Nav Bars are at top of tab order, but bottom of page */
|
|
@@ -61,6 +22,8 @@ export default Nav
|
|
|
61
22
|
align-content: flex-start;
|
|
62
23
|
align-items: flex-start;
|
|
63
24
|
gap: 8px;
|
|
25
|
+
|
|
26
|
+
grid-area: nav-bar;
|
|
64
27
|
grid-auto-columns: minmax(48px, 1fr);
|
|
65
28
|
grid-auto-flow: column;
|
|
66
29
|
|
|
@@ -86,38 +49,4 @@ export default Nav
|
|
|
86
49
|
}
|
|
87
50
|
|
|
88
51
|
`
|
|
89
|
-
.on({
|
|
90
|
-
connected() {
|
|
91
|
-
if (this.hideOnScroll) {
|
|
92
|
-
if (this.offsetParent) {
|
|
93
|
-
this.startScrollListener(this.offsetParent ?? window);
|
|
94
|
-
} else {
|
|
95
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
96
|
-
this.startScrollListener(this.offsetParent ?? window);
|
|
97
|
-
resizeObserver.disconnect();
|
|
98
|
-
});
|
|
99
|
-
resizeObserver.observe(this);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
disconnected() {
|
|
104
|
-
this.clearScrollListener();
|
|
105
|
-
},
|
|
106
|
-
scrollListenerPositionYChanged(oldValue, newValue) {
|
|
107
|
-
if (!this.hideOnScroll) return;
|
|
108
|
-
const delta = newValue - oldValue;
|
|
109
|
-
const rate = 1;
|
|
110
|
-
const shift = rate * delta;
|
|
111
|
-
|
|
112
|
-
const bottom = this.getScrollingElementScrollHeight() - this.getScrollingElementClientHeight();
|
|
113
|
-
const breakpoint = bottom - this.scrollHeight;
|
|
114
|
-
let max = this.scrollHeight;
|
|
115
|
-
if (newValue >= breakpoint) {
|
|
116
|
-
// Scrolling to bottom always shows Nav Bar (ensures content isn't occluded)
|
|
117
|
-
max -= (newValue - breakpoint);
|
|
118
|
-
}
|
|
119
|
-
this._transition = 'none';
|
|
120
|
-
this._translateY = Math.max(0, Math.min(this._translateY + shift, max));
|
|
121
|
-
},
|
|
122
|
-
})
|
|
123
52
|
.autoRegister('mdw-nav-bar');
|
package/components/NavDrawer.js
CHANGED
|
@@ -10,13 +10,9 @@ export default NavRail
|
|
|
10
10
|
})
|
|
11
11
|
.css`
|
|
12
12
|
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
13
|
-
|
|
14
|
-
:host([open]) {
|
|
15
|
-
--mdw-surface__tint: var(--mdw-surface__tint__0);
|
|
16
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__1);
|
|
13
|
+
:host {
|
|
17
14
|
--mdw-shape__size: var(--mdw-shape__large, 16px);
|
|
18
15
|
--mdw-shape__size__top-start-size: 0px;
|
|
19
|
-
--mdw-shape__size__bottom-start-size: 0px;
|
|
20
16
|
|
|
21
17
|
--mdw-nav-item__badge__position: static;
|
|
22
18
|
--mdw-nav-item__badge__transform: none;
|
|
@@ -25,20 +21,25 @@ export default NavRail
|
|
|
25
21
|
--mdw-nav-item__label__padding-inline: 52px 0;
|
|
26
22
|
--mdw-nav-item__anchor__display: block;
|
|
27
23
|
--mdw-nav-item__indicator__grid-area: auto;
|
|
24
|
+
--mdw-bg: var(--mdw-color__surface-container-low);
|
|
28
25
|
|
|
29
|
-
display:
|
|
30
|
-
grid-template-
|
|
31
|
-
grid-template-columns: minmax(360px, min-content);
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: 1fr;
|
|
32
28
|
|
|
33
|
-
min-
|
|
34
|
-
|
|
29
|
+
min-block-size: 100vh;
|
|
30
|
+
max-block-size: 100vh;
|
|
31
|
+
inline-size: 360px;
|
|
32
|
+
max-inline-size: calc(100vw - 56px);
|
|
33
|
+
padding-inline: 0;
|
|
35
34
|
|
|
36
35
|
box-shadow: none;
|
|
37
|
-
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
#slot {
|
|
41
39
|
gap: 0;
|
|
40
|
+
|
|
41
|
+
inline-size: auto;
|
|
42
|
+
padding-inline: 12px;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
`
|
|
@@ -10,7 +10,6 @@ export default NavItem
|
|
|
10
10
|
:host {
|
|
11
11
|
align-self: stretch;
|
|
12
12
|
|
|
13
|
-
display: grid;
|
|
14
13
|
display: flex;
|
|
15
14
|
align-items: center;
|
|
16
15
|
gap: 12px;
|
|
@@ -19,6 +18,8 @@ export default NavItem
|
|
|
19
18
|
/ 24px 1fr minmax(0, min-content);
|
|
20
19
|
justify-items: flex-start;
|
|
21
20
|
|
|
21
|
+
min-block-size: 56px;
|
|
22
|
+
|
|
22
23
|
padding-inline: 16px 24px;
|
|
23
24
|
}
|
|
24
25
|
|
package/components/NavItem.js
CHANGED
|
@@ -11,11 +11,11 @@ import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
|
11
11
|
/** @typedef {'charset'|'coords'|'name'|'shape'} DeprecatedHTMLAnchorElementProperties */
|
|
12
12
|
|
|
13
13
|
export default class NavItem extends CustomElement
|
|
14
|
+
.extend()
|
|
14
15
|
.mixin(ThemableMixin)
|
|
15
16
|
.mixin(StateMixin)
|
|
16
17
|
.mixin(RippleMixin)
|
|
17
18
|
.mixin(ShapeMixin)
|
|
18
|
-
.extend()
|
|
19
19
|
.set({
|
|
20
20
|
delegatesFocus: true,
|
|
21
21
|
stateLayer: true,
|
|
@@ -30,11 +30,12 @@ export default class NavItem extends CustomElement
|
|
|
30
30
|
ariaLabel: 'string', // watch attribute and emit callback
|
|
31
31
|
})
|
|
32
32
|
.methods({
|
|
33
|
-
focus
|
|
34
|
-
|
|
33
|
+
/** @type {HTMLElement['focus']} */
|
|
34
|
+
focus(...args) {
|
|
35
|
+
this.refs.anchor.focus(...args);
|
|
35
36
|
},
|
|
36
37
|
})
|
|
37
|
-
.html
|
|
38
|
+
.html`
|
|
38
39
|
<mdw-icon id=icon aria-hidden=true src={src} active={active}>{icon}</mdw-icon>
|
|
39
40
|
<a id=anchor
|
|
40
41
|
aria-current=${({ active }) => (active ? 'page' : null)}
|
|
@@ -71,7 +72,7 @@ export default class NavItem extends CustomElement
|
|
|
71
72
|
|
|
72
73
|
display: grid;
|
|
73
74
|
align-content: center;
|
|
74
|
-
align-items:
|
|
75
|
+
align-items: flex-start;
|
|
75
76
|
grid-auto-flow: row;
|
|
76
77
|
grid-auto-rows: minmax(20px, min-content);
|
|
77
78
|
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
@@ -81,7 +82,6 @@ export default class NavItem extends CustomElement
|
|
|
81
82
|
row-gap: 4px;
|
|
82
83
|
|
|
83
84
|
box-sizing: border-box;
|
|
84
|
-
min-block-size: 56px;
|
|
85
85
|
|
|
86
86
|
padding-inline: 0;
|
|
87
87
|
|
|
@@ -132,6 +132,10 @@ export default class NavItem extends CustomElement
|
|
|
132
132
|
#anchor {
|
|
133
133
|
position: absolute;
|
|
134
134
|
inset: 0;
|
|
135
|
+
|
|
136
|
+
outline: none;
|
|
137
|
+
|
|
138
|
+
z-index: 5;
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
#shape {
|
|
@@ -139,6 +143,10 @@ export default class NavItem extends CustomElement
|
|
|
139
143
|
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
140
144
|
top: 50%;
|
|
141
145
|
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
146
|
+
right: auto;
|
|
147
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
148
|
+
bottom: auto;
|
|
149
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
142
150
|
left: 50%;
|
|
143
151
|
|
|
144
152
|
block-size: 100%;
|
|
@@ -182,8 +190,10 @@ export default class NavItem extends CustomElement
|
|
|
182
190
|
#badge {
|
|
183
191
|
--mdw-badge__scale: 0;
|
|
184
192
|
position: absolute;
|
|
185
|
-
|
|
186
|
-
|
|
193
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
194
|
+
top: 50%;
|
|
195
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
196
|
+
left: 50%;
|
|
187
197
|
|
|
188
198
|
overflow: hidden;
|
|
189
199
|
|
package/components/NavRail.js
CHANGED
|
@@ -16,13 +16,25 @@ export default Nav
|
|
|
16
16
|
/* https://m3.material.io/components/navigation-rail/specs */
|
|
17
17
|
|
|
18
18
|
:host{
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
inset-block-start: 0;
|
|
22
|
+
inset-inline-start: 0;
|
|
23
|
+
align-self: flex-start;
|
|
24
|
+
|
|
19
25
|
display: grid;
|
|
20
26
|
align-content: flex-start;
|
|
21
27
|
flex-direction: column;
|
|
28
|
+
gap:0;
|
|
22
29
|
grid-template-rows: auto minmax(0,1fr);
|
|
23
|
-
grid-template-columns:
|
|
30
|
+
grid-template-columns: 100%;
|
|
24
31
|
justify-items: stretch;
|
|
25
32
|
|
|
33
|
+
min-block-size: 100vh;
|
|
34
|
+
max-block-size: 100vh;
|
|
35
|
+
min-inline-size: 80px;
|
|
36
|
+
max-inline-size: 80px;
|
|
37
|
+
|
|
26
38
|
text-align: center;
|
|
27
39
|
}
|
|
28
40
|
|
|
@@ -31,9 +43,6 @@ export default Nav
|
|
|
31
43
|
align-items: center;
|
|
32
44
|
flex-direction: column;
|
|
33
45
|
gap: 12px;
|
|
34
|
-
|
|
35
|
-
padding-block-start: 12px;
|
|
36
|
-
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
#slot {
|
|
@@ -47,10 +56,9 @@ export default Nav
|
|
|
47
56
|
overflow-y: auto;
|
|
48
57
|
|
|
49
58
|
box-sizing: border-box;
|
|
59
|
+
max-block-size: 100%;
|
|
60
|
+
inline-size: min-content;
|
|
50
61
|
|
|
51
|
-
inline-size: 100%;
|
|
52
|
-
|
|
53
|
-
padding-block: 12px;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
#slot[align="start"] {
|
|
@@ -7,10 +7,12 @@ export default NavItem
|
|
|
7
7
|
.css`
|
|
8
8
|
:host {
|
|
9
9
|
grid-auto-flow: row;
|
|
10
|
-
grid-auto-rows: minmax(20px,
|
|
10
|
+
grid-auto-rows: minmax(20px, auto);
|
|
11
11
|
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
12
12
|
grid-template-columns: [icon] minmax(56px, 1fr);
|
|
13
13
|
|
|
14
|
+
min-block-size: 56px;
|
|
15
|
+
flex: none;
|
|
14
16
|
padding-inline: 12px;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import CustomElement from '../core/CustomElement.js';
|
|
2
|
+
import PopupMixin from '../mixins/PopupMixin.js';
|
|
3
|
+
import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
4
|
+
import SurfaceMixin from '../mixins/SurfaceMixin.js';
|
|
5
|
+
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
6
|
+
|
|
7
|
+
export default CustomElement
|
|
8
|
+
.extend()
|
|
9
|
+
.mixin(ThemableMixin)
|
|
10
|
+
.mixin(SurfaceMixin)
|
|
11
|
+
.mixin(ShapeMixin)
|
|
12
|
+
.mixin(PopupMixin)
|
|
13
|
+
.on({
|
|
14
|
+
composed() {
|
|
15
|
+
const { shape, surface, dialog } = this.refs;
|
|
16
|
+
surface.append(shape);
|
|
17
|
+
dialog.prepend(surface);
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
.autoRegister('mdw-popup');
|
package/components/Progress.js
CHANGED
|
@@ -6,8 +6,8 @@ import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
|
6
6
|
// https://html.spec.whatwg.org/multipage/form-elements.html#the-progress-element
|
|
7
7
|
|
|
8
8
|
export default CustomElement
|
|
9
|
-
.mixin(ThemableMixin)
|
|
10
9
|
.extend()
|
|
10
|
+
.mixin(ThemableMixin)
|
|
11
11
|
.observe({
|
|
12
12
|
circle: 'boolean',
|
|
13
13
|
value: 'float',
|
|
@@ -37,20 +37,20 @@ export default CustomElement
|
|
|
37
37
|
return /** @type {HTMLProgressElement} */ (this.refs.progress).labels;
|
|
38
38
|
},
|
|
39
39
|
})
|
|
40
|
-
.html
|
|
40
|
+
.html`
|
|
41
41
|
<div id=determinate style="{_determinateStyle}">
|
|
42
42
|
<progress id=progress value={value} max={max} circle={circle}></progress>
|
|
43
|
-
<div
|
|
43
|
+
<div mdw-if={circle} id=circle>
|
|
44
44
|
<div id=semi1 class=semi></div>
|
|
45
45
|
<div id=semi2 class=semi></div>
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
|
-
<div
|
|
49
|
-
<div
|
|
48
|
+
<div mdw-if={!value} id=indeterminate>
|
|
49
|
+
<div mdw-if={!circle} id=indeterminate-line>
|
|
50
50
|
<div id=line1 class=line value={value}></div>
|
|
51
51
|
<div id=line2 class=line value={value}></div>
|
|
52
52
|
</div>
|
|
53
|
-
<div
|
|
53
|
+
<div mdw-if={circle} id=indeterminate-circle>
|
|
54
54
|
<div id=arc2 class=arc></div>
|
|
55
55
|
<div id=arc3 class=arc></div>
|
|
56
56
|
<div id=arc4 class=arc></div>
|
|
@@ -61,7 +61,7 @@ export default CustomElement
|
|
|
61
61
|
/* Base Styles */
|
|
62
62
|
|
|
63
63
|
:host {
|
|
64
|
-
--mdw-bg: var(--mdw-color__surface-
|
|
64
|
+
--mdw-bg: var(--mdw-color__surface-container-highest);
|
|
65
65
|
--mdw-ink: var(--mdw-color__primary);
|
|
66
66
|
--mdw-progress__opacity__duration: 500ms;
|
|
67
67
|
position: relative;
|
|
@@ -296,6 +296,7 @@ export default CustomElement
|
|
|
296
296
|
`
|
|
297
297
|
.css`
|
|
298
298
|
/* Circle Styles */
|
|
299
|
+
/* stylelint-disable liberty/use-logical-spec */
|
|
299
300
|
/** https://github.com/material-components/material-components-android/blob/ed77ab36ccac98df24e55060d58406c5981a9062/lib/java/com/google/android/material/progressindicator/CircularIndeterminateAnimatorDelegate.java */
|
|
300
301
|
|
|
301
302
|
:host {
|
|
@@ -357,11 +358,11 @@ export default CustomElement
|
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
#semi1 {
|
|
360
|
-
|
|
361
|
+
left: 50%;
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
#semi2 {
|
|
364
|
-
|
|
365
|
+
right: 50%;
|
|
365
366
|
}
|
|
366
367
|
|
|
367
368
|
.semi::after {
|
|
@@ -384,7 +385,7 @@ export default CustomElement
|
|
|
384
385
|
|
|
385
386
|
#semi1::after {
|
|
386
387
|
--rotation: min(180deg, calc(var(--value) * 360deg));
|
|
387
|
-
|
|
388
|
+
left: -100%;
|
|
388
389
|
|
|
389
390
|
clip-path: inset(0 50% 0 0);
|
|
390
391
|
|
|
@@ -394,7 +395,7 @@ export default CustomElement
|
|
|
394
395
|
|
|
395
396
|
#semi2::after {
|
|
396
397
|
--rotation: max(0deg, calc(var(--value) * 360deg - 180deg));
|
|
397
|
-
|
|
398
|
+
right: -100%;
|
|
398
399
|
|
|
399
400
|
clip-path: inset(0 0 0 50%);
|
|
400
401
|
|
|
@@ -438,43 +439,43 @@ export default CustomElement
|
|
|
438
439
|
}
|
|
439
440
|
|
|
440
441
|
#arc2 {
|
|
441
|
-
|
|
442
|
-
|
|
442
|
+
bottom: 50%;
|
|
443
|
+
left: 50%;
|
|
443
444
|
|
|
444
445
|
transform-origin: 0 100%;
|
|
445
446
|
}
|
|
446
447
|
|
|
447
448
|
#arc3 {
|
|
448
|
-
|
|
449
|
-
|
|
449
|
+
top: 50%;
|
|
450
|
+
right: 50%;
|
|
450
451
|
|
|
451
452
|
transform-origin: 100% 0;
|
|
452
453
|
}
|
|
453
454
|
|
|
454
455
|
#arc4 {
|
|
455
|
-
|
|
456
|
-
|
|
456
|
+
top: 50%;
|
|
457
|
+
left: 50%;
|
|
457
458
|
|
|
458
459
|
transform-origin: 0 0;
|
|
459
460
|
}
|
|
460
461
|
|
|
461
462
|
#arc2:after {
|
|
462
|
-
|
|
463
|
-
|
|
463
|
+
bottom: -100%;
|
|
464
|
+
left: -100%;
|
|
464
465
|
|
|
465
466
|
clip-path: polygon(0% 0%, 50% 0%, 50% 50%, 100% 50%, 100% 100%, 0% 100%);
|
|
466
467
|
}
|
|
467
468
|
|
|
468
469
|
#arc3:after {
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
top: -100%;
|
|
471
|
+
right: -100%;
|
|
471
472
|
|
|
472
473
|
clip-path: inset(0 50% 50% 0);
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
#arc4:after {
|
|
476
|
-
|
|
477
|
-
|
|
477
|
+
top: -100%;
|
|
478
|
+
left: -100%;
|
|
478
479
|
|
|
479
480
|
clip-path: inset(0 50% 0 0);
|
|
480
481
|
}
|
package/components/Radio.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* https://m3.material.io/components/radio/specs */
|
|
2
|
+
|
|
1
3
|
import './RadioIcon.js';
|
|
2
4
|
|
|
3
5
|
import CustomElement from '../core/CustomElement.js';
|
|
@@ -8,34 +10,41 @@ import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
|
8
10
|
import TouchTargetMixin from '../mixins/TouchTargetMixin.js';
|
|
9
11
|
|
|
10
12
|
export default CustomElement
|
|
13
|
+
.extend()
|
|
11
14
|
.mixin(ThemableMixin)
|
|
12
15
|
.mixin(StateMixin)
|
|
13
16
|
.mixin(RippleMixin)
|
|
14
17
|
.mixin(InputMixin)
|
|
15
18
|
.mixin(TouchTargetMixin)
|
|
16
|
-
.extend()
|
|
17
19
|
.set({
|
|
18
20
|
type: 'radio',
|
|
19
21
|
stateLayer: true,
|
|
20
22
|
})
|
|
23
|
+
.html`
|
|
24
|
+
<div id=radio errored={erroredState} selected={checked}>
|
|
25
|
+
<mdw-radio-icon id=icon errored={erroredState} disabled={disabledState}
|
|
26
|
+
selected={checked} focused={focusedState} hovered={hoveredState}></mdw-radio-icon>
|
|
27
|
+
</div>
|
|
28
|
+
<slot id=slot></slot>
|
|
29
|
+
`
|
|
30
|
+
.rootEvents({
|
|
31
|
+
click(event) {
|
|
32
|
+
const { control } = this.refs;
|
|
33
|
+
if (event.target !== control) {
|
|
34
|
+
// Label-like click
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
control.click();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
})
|
|
21
40
|
.on({
|
|
22
|
-
composed(
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
${touchTarget}
|
|
26
|
-
${control}
|
|
27
|
-
<div id=radio errored={erroredState} selected={checked}>
|
|
28
|
-
<mdw-radio-icon id=icon errored={erroredState} disabled={disabledState}
|
|
29
|
-
selected={checked} focused={focusedState} hovered={hoveredState}></mdw-radio-icon>
|
|
30
|
-
${state}
|
|
31
|
-
${rippleContainer}
|
|
32
|
-
</div>
|
|
33
|
-
<slot id=slot></slot>
|
|
34
|
-
`);
|
|
41
|
+
composed() {
|
|
42
|
+
const { radio, rippleContainer, state } = this.refs;
|
|
43
|
+
radio.append(state, rippleContainer);
|
|
35
44
|
},
|
|
36
45
|
})
|
|
37
46
|
.css`
|
|
38
|
-
/*
|
|
47
|
+
/* stylelint-disable liberty/use-logical-spec */
|
|
39
48
|
|
|
40
49
|
:host {
|
|
41
50
|
--mdw-ink: var(--mdw-color__primary);
|
|
@@ -53,38 +62,38 @@ export default CustomElement
|
|
|
53
62
|
transition: none 100ms cubic-bezier(0.4, 0.0, 1, 1);
|
|
54
63
|
}
|
|
55
64
|
|
|
65
|
+
:host(:disabled) {
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
|
|
68
|
+
opacity: 0.38;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([internals-disabled]) {
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
|
|
74
|
+
opacity: 0.38;
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
:host(:empty) {
|
|
57
78
|
vertical-align: -11.5%;
|
|
58
79
|
|
|
59
80
|
line-height: 20px;
|
|
60
81
|
}
|
|
61
82
|
|
|
62
|
-
:host(:empty) #radio {
|
|
63
|
-
transform: none;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
83
|
#control {
|
|
67
84
|
grid-column: 1/1;
|
|
68
85
|
|
|
69
86
|
cursor: inherit;
|
|
70
87
|
}
|
|
71
88
|
|
|
72
|
-
#label {
|
|
73
|
-
cursor: inherit;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#label[disabled] {
|
|
77
|
-
cursor: not-allowed;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
89
|
#state {
|
|
81
90
|
pointer-events: auto;
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
#state,
|
|
85
94
|
#ripple-container {
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
top: 50%;
|
|
96
|
+
left: 50%;
|
|
88
97
|
|
|
89
98
|
block-size: 40px;
|
|
90
99
|
inline-size: 40px;
|
|
@@ -94,12 +103,6 @@ export default CustomElement
|
|
|
94
103
|
border-radius: 50%;
|
|
95
104
|
}
|
|
96
105
|
|
|
97
|
-
:host([disabled]) {
|
|
98
|
-
cursor: not-allowed;
|
|
99
|
-
|
|
100
|
-
opacity: 0.38;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
106
|
#radio {
|
|
104
107
|
position: relative;
|
|
105
108
|
|
|
@@ -126,6 +129,10 @@ export default CustomElement
|
|
|
126
129
|
color: rgb(var(--mdw-color__error));
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
:host(:empty) #radio {
|
|
133
|
+
transform: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
129
136
|
#icon {
|
|
130
137
|
--mdw-ink: inherit;
|
|
131
138
|
--disabled-opacity: 1;
|