@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/Button.md
CHANGED
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
|
|
42
42
|
## Custom
|
|
43
43
|
```html
|
|
44
|
-
<mdw-button
|
|
45
|
-
<mdw-button
|
|
46
|
-
<mdw-button
|
|
47
|
-
<mdw-button
|
|
48
|
-
<mdw-button
|
|
44
|
+
<mdw-button ink=yellow>Custom text</mdw-button>
|
|
45
|
+
<mdw-button elevated ink=yellow>Custom elevated</mdw-button>
|
|
46
|
+
<mdw-button filled color=yellow>Custom filled</mdw-button>
|
|
47
|
+
<mdw-button filled=tonal icon=add color=yellow-container>Custom tonal</mdw-button>
|
|
48
|
+
<mdw-button outlined ink=yellow>Custom outlined</mdw-button>
|
|
49
49
|
<mdw-button disabled outlined>Outlined (Disabled)</mdw-button>
|
|
50
50
|
<mdw-button disabled outlined icon=add>Outlined icon (Disabled)</mdw-button>
|
|
51
|
-
<mdw-button disabled
|
|
52
|
-
<mdw-button disabled
|
|
53
|
-
<mdw-button disabled filled
|
|
54
|
-
<mdw-button disabled filled=tonal
|
|
51
|
+
<mdw-button disabled ink=yellow>Custom text</mdw-button>
|
|
52
|
+
<mdw-button disabled elevated=yellow>Custom elevated</mdw-button>
|
|
53
|
+
<mdw-button disabled filled color=yellow>Custom filled</mdw-button>
|
|
54
|
+
<mdw-button disabled filled=tonal icon=add color=yellow-container>Custom tonal</mdw-button>
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
```js
|
package/components/Card.js
CHANGED
|
@@ -11,6 +11,7 @@ import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
|
11
11
|
const SUPPORTS_INERT = 'inert' in HTMLElement.prototype;
|
|
12
12
|
|
|
13
13
|
export default CustomElement
|
|
14
|
+
.extend()
|
|
14
15
|
.mixin(ThemableMixin)
|
|
15
16
|
.mixin(FlexableMixin)
|
|
16
17
|
.mixin(SurfaceMixin)
|
|
@@ -18,7 +19,6 @@ export default CustomElement
|
|
|
18
19
|
.mixin(FormAssociatedMixin) // Tap into FormAssociated for disabledState
|
|
19
20
|
.mixin(StateMixin)
|
|
20
21
|
.mixin(AriaReflectorMixin)
|
|
21
|
-
.extend()
|
|
22
22
|
.setStatic({
|
|
23
23
|
delegatesFocus: true,
|
|
24
24
|
})
|
|
@@ -43,9 +43,9 @@ export default CustomElement
|
|
|
43
43
|
if (this.actionable) this.refs.action.focus();
|
|
44
44
|
},
|
|
45
45
|
})
|
|
46
|
-
.html
|
|
47
|
-
<mdw-button
|
|
48
|
-
<div
|
|
46
|
+
.html`
|
|
47
|
+
<mdw-button mdw-if={actionable} aria-label={actionLabel} id=action disabled={disabledState}></mdw-button>
|
|
48
|
+
<div mdw-if={showBlocker} id=inert-blocker></div>
|
|
49
49
|
<slot id=slot disabled={disabledState}></slot>
|
|
50
50
|
`
|
|
51
51
|
.css`
|
|
@@ -53,14 +53,12 @@ export default CustomElement
|
|
|
53
53
|
|
|
54
54
|
:host {
|
|
55
55
|
--mdw-shape__size: 12px;
|
|
56
|
-
--mdw-surface__tint: var(--mdw-surface__tint__0);
|
|
57
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint);
|
|
58
56
|
|
|
59
57
|
--mdw-surface__shadow__resting: none;
|
|
60
58
|
--mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
|
|
61
59
|
/* padding-inline: 12px; */
|
|
62
60
|
|
|
63
|
-
--mdw-bg: var(--mdw-color__surface);
|
|
61
|
+
--mdw-bg: var(--mdw-color__surface-container);
|
|
64
62
|
--mdw-ink: var(--mdw-color__on-surface);
|
|
65
63
|
position: relative;
|
|
66
64
|
|
|
@@ -77,32 +75,28 @@ export default CustomElement
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
:host(:where([filled])) {
|
|
80
|
-
--mdw-bg: var(--mdw-color__surface-
|
|
78
|
+
--mdw-bg: var(--mdw-color__surface-container-highest);
|
|
81
79
|
--mdw-ink: var(--mdw-color__on-surface-variant);
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
:host(:where([elevated])) {
|
|
85
|
-
--mdw-bg: var(--mdw-color__surface);
|
|
83
|
+
--mdw-bg: var(--mdw-color__surface-container-low);
|
|
86
84
|
--mdw-ink: var(--mdw-color__on-surface);
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
:host([filled]) {
|
|
90
|
-
--mdw-surface__tint: var(--mdw-surface__tint__0);
|
|
91
88
|
--mdw-surface__shadow__resting: var(--mdw-surface__shadow__0);
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
:host([filled][actionable]) {
|
|
95
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__1);
|
|
96
92
|
--mdw-surface__shadow__raised: var(--mdw-surface__shadow__1);
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
:host([elevated]) {
|
|
100
|
-
--mdw-surface__tint: var(--mdw-surface__tint__1);
|
|
101
96
|
--mdw-surface__shadow__resting: var(--mdw-surface__shadow__1);
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
:host([elevated][actionable]) {
|
|
105
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__2);
|
|
106
100
|
--mdw-surface__shadow__raised: var(--mdw-surface__shadow__2);
|
|
107
101
|
}
|
|
108
102
|
|
|
@@ -142,7 +136,7 @@ export default CustomElement
|
|
|
142
136
|
}
|
|
143
137
|
|
|
144
138
|
#shape[disabled][elevated] {
|
|
145
|
-
background-color: rgba(var(--mdw-color__surface-
|
|
139
|
+
background-color: rgba(var(--mdw-color__surface-container-highest));
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
#action {
|
|
@@ -161,8 +155,7 @@ export default CustomElement
|
|
|
161
155
|
`
|
|
162
156
|
.on({
|
|
163
157
|
composed() {
|
|
164
|
-
const { slot, surface,
|
|
165
|
-
shape.append(surfaceTint);
|
|
158
|
+
const { slot, surface, shape, outline } = this.refs;
|
|
166
159
|
surface.append(shape);
|
|
167
160
|
outline.removeAttribute('pressed');
|
|
168
161
|
outline.removeAttribute('focused');
|
package/components/Checkbox.js
CHANGED
|
@@ -8,12 +8,12 @@ import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
|
8
8
|
import TouchTargetMixin from '../mixins/TouchTargetMixin.js';
|
|
9
9
|
|
|
10
10
|
export default CustomElement
|
|
11
|
+
.extend()
|
|
11
12
|
.mixin(ThemableMixin)
|
|
12
13
|
.mixin(StateMixin)
|
|
13
14
|
.mixin(RippleMixin)
|
|
14
15
|
.mixin(InputMixin)
|
|
15
16
|
.mixin(TouchTargetMixin)
|
|
16
|
-
.extend()
|
|
17
17
|
.set({
|
|
18
18
|
stateLayer: true,
|
|
19
19
|
type: 'checkbox',
|
|
@@ -32,6 +32,33 @@ export default CustomElement
|
|
|
32
32
|
return (indeterminate ? indeterminateIcon : icon);
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
|
+
.html`
|
|
36
|
+
<div id=checkbox errored={erroredState} selected={checked}>
|
|
37
|
+
<mdw-checkbox-icon id=icon errored={erroredState} disabled={disabledState}
|
|
38
|
+
icon={_determinateIcon} selected={checked}>
|
|
39
|
+
</mdw-checkbox-icon>
|
|
40
|
+
</div>
|
|
41
|
+
<slot id=slot></slot>
|
|
42
|
+
`
|
|
43
|
+
.rootEvents({
|
|
44
|
+
click(event) {
|
|
45
|
+
const { control } = this.refs;
|
|
46
|
+
if (event.target !== control) {
|
|
47
|
+
// Label-like click
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
control.click();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
.on({
|
|
54
|
+
composed() {
|
|
55
|
+
const { control, checkbox, state, rippleContainer } = this.refs;
|
|
56
|
+
checkbox.append(state, rippleContainer);
|
|
57
|
+
|
|
58
|
+
// Indeterminate must be manually expressed for ARIA
|
|
59
|
+
control.setAttribute('aria-checked', '{_ariaChecked}');
|
|
60
|
+
},
|
|
61
|
+
})
|
|
35
62
|
.css`
|
|
36
63
|
/* https://m3.material.io/components/checkbox/specs */
|
|
37
64
|
|
|
@@ -50,7 +77,15 @@ export default CustomElement
|
|
|
50
77
|
transition: none 100ms cubic-bezier(0.4, 0.0, 1, 1);
|
|
51
78
|
}
|
|
52
79
|
|
|
53
|
-
:host(
|
|
80
|
+
:host(:disabled) {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
|
|
83
|
+
opacity: 0.38;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host([internals-disabled]) {
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
|
|
54
89
|
opacity: 0.38;
|
|
55
90
|
}
|
|
56
91
|
|
|
@@ -60,28 +95,18 @@ export default CustomElement
|
|
|
60
95
|
line-height: 18px;
|
|
61
96
|
}
|
|
62
97
|
|
|
63
|
-
:host(:empty) #checkbox {
|
|
64
|
-
transform: none;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
98
|
#control {
|
|
68
99
|
grid-column: 1/1;
|
|
69
100
|
|
|
70
101
|
cursor: inherit;
|
|
71
102
|
}
|
|
72
103
|
|
|
73
|
-
#label {
|
|
74
|
-
cursor: inherit;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
#label[disabled] {
|
|
78
|
-
cursor: not-allowed;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
104
|
#state,
|
|
82
105
|
#ripple-container {
|
|
83
|
-
|
|
84
|
-
|
|
106
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
107
|
+
top: 50%;
|
|
108
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
109
|
+
left: 50%;
|
|
85
110
|
|
|
86
111
|
block-size: 40px;
|
|
87
112
|
inline-size: 40px;
|
|
@@ -117,30 +142,14 @@ export default CustomElement
|
|
|
117
142
|
color: rgb(var(--mdw-color__error));
|
|
118
143
|
}
|
|
119
144
|
|
|
145
|
+
:host(:empty) #checkbox {
|
|
146
|
+
transform: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
120
149
|
#icon {
|
|
121
150
|
--mdw-ink: inherit;
|
|
122
151
|
--mdw-bg: inherit;
|
|
123
152
|
--disabled-opacity: 1;
|
|
124
153
|
}
|
|
125
154
|
`
|
|
126
|
-
.on({
|
|
127
|
-
composed({ html }) {
|
|
128
|
-
const { label, control, state, rippleContainer, touchTarget } = this.refs;
|
|
129
|
-
label.append(html`
|
|
130
|
-
${touchTarget}
|
|
131
|
-
${control}
|
|
132
|
-
<div id=checkbox errored={erroredState} selected={checked}>
|
|
133
|
-
<mdw-checkbox-icon id=icon errored={erroredState} disabled={disabledState}
|
|
134
|
-
icon={_determinateIcon} selected={checked}>
|
|
135
|
-
</mdw-checkbox-icon>
|
|
136
|
-
${state}
|
|
137
|
-
${rippleContainer}
|
|
138
|
-
</div>
|
|
139
|
-
<slot id=slot></slot>
|
|
140
|
-
`);
|
|
141
|
-
|
|
142
|
-
// Indeterminate must be manually expressed for ARIA
|
|
143
|
-
control.setAttribute('aria-checked', '{_ariaChecked}');
|
|
144
|
-
},
|
|
145
|
-
})
|
|
146
155
|
.autoRegister('mdw-checkbox');
|
|
@@ -4,6 +4,7 @@ import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
|
4
4
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
5
5
|
|
|
6
6
|
export default CustomElement
|
|
7
|
+
.extend()
|
|
7
8
|
.mixin(ThemableMixin)
|
|
8
9
|
.mixin(ShapeMixin)
|
|
9
10
|
.observe({
|
|
@@ -114,7 +115,7 @@ export default CustomElement
|
|
|
114
115
|
.on({
|
|
115
116
|
composed({ html }) {
|
|
116
117
|
const { outline, shape } = this.refs;
|
|
117
|
-
outline.removeAttribute('
|
|
118
|
+
outline.removeAttribute('mdw-if');
|
|
118
119
|
outline.setAttribute('selected', '{selected}');
|
|
119
120
|
outline.setAttribute('errored', '{errored}');
|
|
120
121
|
outline.setAttribute('disabled', '{disabled}');
|
|
@@ -125,5 +126,4 @@ export default CustomElement
|
|
|
125
126
|
`);
|
|
126
127
|
},
|
|
127
128
|
})
|
|
128
|
-
.extend()
|
|
129
129
|
.autoRegister('mdw-checkbox-icon');
|
package/components/Chip.js
CHANGED
|
@@ -49,7 +49,7 @@ export default Button
|
|
|
49
49
|
slot.setAttribute('disabled', '{disabledState}');
|
|
50
50
|
slot.removeAttribute('ink');
|
|
51
51
|
slot.removeAttribute('color');
|
|
52
|
-
outline.setAttribute('
|
|
52
|
+
outline.setAttribute('mdw-if', '{!elevated}');
|
|
53
53
|
outline.setAttribute('ink', '{ink}');
|
|
54
54
|
outline.setAttribute('color', '{color}');
|
|
55
55
|
icon.setAttribute('ink', inline(({ ink, iconInk }) => iconInk ?? ink ?? 'primary'));
|