@shortfuse/materialdesignweb 0.7.1-0 → 0.7.1-1
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/bin/generate-css.js +1 -2
- package/components/Badge.js +40 -3
- package/components/Body.js +16 -2
- package/components/BottomAppBar.js +25 -2
- package/components/Box.js +33 -3
- package/components/Button.js +146 -9
- package/components/Card.js +111 -3
- package/components/Checkbox.js +91 -3
- package/components/CheckboxIcon.js +92 -4
- package/components/Chip.js +38 -2
- package/components/Dialog.js +237 -3
- package/components/DialogActions.js +3 -2
- package/components/Divider.js +44 -3
- package/components/ExtendedFab.js +27 -2
- package/components/Fab.js +26 -2
- package/components/FilterChip.js +83 -2
- package/components/Headline.js +16 -2
- package/components/Icon.js +80 -4
- package/components/IconButton.js +153 -2
- package/components/Label.js +16 -2
- package/components/Layout.js +21 -3
- package/components/List.js +15 -2
- package/components/ListItem.js +229 -3
- package/components/ListOption.js +37 -3
- package/components/ListSelect.js +12 -2
- package/components/Menu.js +173 -3
- package/components/MenuItem.js +55 -2
- package/components/Nav.js +19 -2
- package/components/NavBar.js +37 -2
- package/components/NavBarItem.js +44 -2
- package/components/NavDrawer.js +34 -2
- package/components/NavDrawerItem.js +44 -2
- package/components/NavItem.js +183 -3
- package/components/NavRail.js +50 -2
- package/components/NavRailItem.js +25 -2
- package/components/Pane.js +263 -3
- package/components/Progress.js +469 -10
- package/components/Radio.js +97 -3
- package/components/RadioIcon.js +77 -5
- package/components/Ripple.js +76 -3
- package/components/SegmentedButton.js +97 -2
- package/components/SegmentedButtonGroup.js +15 -2
- package/components/Select.js +54 -2
- package/components/Shape.js +55 -18
- package/components/Slider.js +309 -3
- package/components/Snackbar.js +82 -2
- package/components/Surface.js +13 -4
- package/components/Switch.js +67 -4
- package/components/SwitchIcon.js +272 -5
- package/components/Tab.js +87 -3
- package/components/TabContent.js +21 -21
- package/components/TabList.js +131 -2
- package/components/TextArea.js +97 -3
- package/components/Title.js +16 -2
- package/components/Tooltip.js +42 -2
- package/components/TopAppBar.js +212 -3
- package/core/template.js +36 -9
- package/mixins/ControlMixin.js +65 -2
- package/mixins/DensityMixin.js +17 -3
- package/mixins/FlexableMixin.js +81 -3
- package/mixins/RippleMixin.js +15 -4
- package/mixins/ShapeMixin.js +279 -8
- package/mixins/StateMixin.js +87 -5
- package/mixins/SurfaceMixin.js +152 -3
- package/mixins/TextFieldMixin.js +661 -2
- package/mixins/ThemableMixin.js +206 -3
- package/mixins/TooltipTriggerMixin.js +30 -4
- package/mixins/TouchTargetMixin.js +29 -4
- package/package.json +2 -1
- package/theming/loader.js +0 -2
- package/components/Badge.css +0 -38
- package/components/Body.css +0 -14
- package/components/BottomAppBar.css +0 -23
- package/components/Box.css +0 -31
- package/components/Button.css +0 -147
- package/components/Card.css +0 -109
- package/components/Checkbox.css +0 -89
- package/components/CheckboxIcon.css +0 -90
- package/components/Chip.css +0 -35
- package/components/Dialog.css +0 -235
- package/components/Divider.css +0 -41
- package/components/ExtendedFab.css +0 -24
- package/components/Fab.css +0 -23
- package/components/FilterChip.css +0 -80
- package/components/Headline.css +0 -14
- package/components/Icon.css +0 -76
- package/components/IconButton.css +0 -150
- package/components/Label.css +0 -14
- package/components/Layout.css +0 -19
- package/components/List.css +0 -12
- package/components/ListItem.css +0 -224
- package/components/ListOption.css +0 -34
- package/components/ListSelect.css +0 -9
- package/components/Menu.css +0 -171
- package/components/MenuItem.css +0 -53
- package/components/Nav.css +0 -17
- package/components/NavBar.css +0 -34
- package/components/NavBarItem.css +0 -41
- package/components/NavDrawer.css +0 -31
- package/components/NavDrawerItem.css +0 -42
- package/components/NavItem.css +0 -181
- package/components/NavRail.css +0 -47
- package/components/NavRailItem.css +0 -25
- package/components/Outline.css +0 -138
- package/components/Pane.css +0 -261
- package/components/Progress.css +0 -75
- package/components/ProgressCircle.css +0 -226
- package/components/ProgressLine.css +0 -155
- package/components/Radio.css +0 -95
- package/components/RadioIcon.css +0 -73
- package/components/Ripple.css +0 -74
- package/components/SegmentedButton.css +0 -94
- package/components/SegmentedButtonGroup.css +0 -12
- package/components/Select.css +0 -52
- package/components/Shape.css +0 -132
- package/components/Slider.css +0 -307
- package/components/Snackbar.css +0 -80
- package/components/Surface.css +0 -10
- package/components/Switch.css +0 -64
- package/components/SwitchIcon.css +0 -178
- package/components/SwitchIconAnimations.css +0 -89
- package/components/Tab.css +0 -85
- package/components/TabList.css +0 -129
- package/components/TextArea.css +0 -93
- package/components/Title.css +0 -14
- package/components/Tooltip.css +0 -40
- package/components/TopAppBar.css +0 -209
- package/mixins/ControlMixin.css +0 -57
- package/mixins/DensityMixin.css +0 -40
- package/mixins/FlexableMixin.css +0 -79
- package/mixins/RippleMixin.css +0 -12
- package/mixins/ShapeMixin.css +0 -135
- package/mixins/StateMixin.css +0 -82
- package/mixins/SurfaceMixin.css +0 -150
- package/mixins/TextFieldMixin.css +0 -657
- package/mixins/ThemableMixin.css +0 -204
- package/mixins/TooltipTriggerMixin.css +0 -27
- package/mixins/TouchTargetMixin.css +0 -26
package/components/Menu.js
CHANGED
|
@@ -7,8 +7,6 @@ import DensityMixin from '../mixins/DensityMixin.js';
|
|
|
7
7
|
import KeyboardNavMixin from '../mixins/KeyboardNavMixin.js';
|
|
8
8
|
import { canAnchorPopup } from '../utils/popup.js';
|
|
9
9
|
|
|
10
|
-
import styles from './Menu.css' assert { type: 'css' };
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* @typedef {Object} MenuStack
|
|
14
12
|
* @prop {HTMLElement} element
|
|
@@ -110,7 +108,6 @@ export default CustomElement
|
|
|
110
108
|
},
|
|
111
109
|
},
|
|
112
110
|
})
|
|
113
|
-
.css(styles)
|
|
114
111
|
.html/* html */`
|
|
115
112
|
<dialog id=dialog role=menu aria-hidden=${({ open }) => (open ? 'false' : 'true')}>
|
|
116
113
|
<div id=scrim aria-hidden=true modal={modal}></div>
|
|
@@ -124,6 +121,179 @@ export default CustomElement
|
|
|
124
121
|
</form>
|
|
125
122
|
</dialog>
|
|
126
123
|
`
|
|
124
|
+
.css`
|
|
125
|
+
/* https://m3.material.io/components/menus/specs */
|
|
126
|
+
|
|
127
|
+
:host {
|
|
128
|
+
--mdw-menu__transform-origin-inline-start: left;
|
|
129
|
+
--mdw-menu__transform-origin-inline-end: right;
|
|
130
|
+
/* Normal */
|
|
131
|
+
--mdw-menu__transform-origin-x: var(--mdw-menu__transform-origin-inline-start);
|
|
132
|
+
/* Down */
|
|
133
|
+
--mdw-menu__transform-origin-y: top;
|
|
134
|
+
--mdw-menu__inline-base: 56px;
|
|
135
|
+
--mdw-menu__size: 2;
|
|
136
|
+
--mdw-bg: var(--mdw-color__surface);
|
|
137
|
+
--mdw-ink: var(--mdw-color__on-surface);
|
|
138
|
+
position: absolute;
|
|
139
|
+
/* Default position is bottom */
|
|
140
|
+
/* Default direction is start */
|
|
141
|
+
inset-block: 100% auto;
|
|
142
|
+
inset-inline: auto 0;
|
|
143
|
+
|
|
144
|
+
display: block;
|
|
145
|
+
/* Hide scrollbar */
|
|
146
|
+
-ms-overflow-style: none;
|
|
147
|
+
/* Scroll mask */
|
|
148
|
+
overscroll-behavior: none;
|
|
149
|
+
overscroll-behavior: contain;
|
|
150
|
+
scrollbar-width: none;
|
|
151
|
+
|
|
152
|
+
pointer-events: none;
|
|
153
|
+
|
|
154
|
+
transform-origin: var(--mdw-menu__transform-origin-x) var(--mdw-menu__transform-origin-y);
|
|
155
|
+
|
|
156
|
+
transition-duration: motion.$fadeOutDuration;
|
|
157
|
+
transition-property: none;
|
|
158
|
+
transition-timing-function: motion.$decelerateEasing;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host(::after) {
|
|
162
|
+
content: '';
|
|
163
|
+
|
|
164
|
+
display: block;
|
|
165
|
+
|
|
166
|
+
block-size: 200%;
|
|
167
|
+
inline-size: 200%;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:host(::-webkit-scrollbar) {
|
|
171
|
+
display: none;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
dialog {
|
|
175
|
+
position: fixed;
|
|
176
|
+
inset: 0;
|
|
177
|
+
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
block-size:100%;
|
|
180
|
+
max-block-size: none;
|
|
181
|
+
inline-size:100%;
|
|
182
|
+
max-inline-size: none;
|
|
183
|
+
margin: 0;
|
|
184
|
+
border: none;
|
|
185
|
+
padding: 0;
|
|
186
|
+
|
|
187
|
+
opacity: 0;
|
|
188
|
+
visibility: hidden;
|
|
189
|
+
z-index: 24;
|
|
190
|
+
|
|
191
|
+
background-color: transparent;
|
|
192
|
+
|
|
193
|
+
transition: none;
|
|
194
|
+
transition-property: opacity;
|
|
195
|
+
will-change: opacity;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
dialog::backdrop {
|
|
199
|
+
/** Use scrim instead */
|
|
200
|
+
display: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
dialog[aria-hidden="false"],
|
|
204
|
+
dialog:modal {
|
|
205
|
+
display: block;
|
|
206
|
+
|
|
207
|
+
pointer-events: none;
|
|
208
|
+
|
|
209
|
+
opacity: 1;
|
|
210
|
+
visibility: visible;
|
|
211
|
+
|
|
212
|
+
transition-duration: var(--mdw-dialog__fade-in-duration);
|
|
213
|
+
transition-property: opacity;
|
|
214
|
+
transition-timing-function: var(--mdw-dialog__deceleration-easing);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
#scrim {
|
|
218
|
+
position: fixed;
|
|
219
|
+
inset: 0;
|
|
220
|
+
|
|
221
|
+
overflow-y: scroll;
|
|
222
|
+
overscroll-behavior: none;
|
|
223
|
+
overscroll-behavior: contain;
|
|
224
|
+
scrollbar-width: none;
|
|
225
|
+
|
|
226
|
+
block-size: 100%;
|
|
227
|
+
inline-size: 100%;
|
|
228
|
+
|
|
229
|
+
cursor: default;
|
|
230
|
+
pointer-events: auto;
|
|
231
|
+
-webkit-tap-highlight-color: transparent;
|
|
232
|
+
|
|
233
|
+
visibility: hidden; /* Only show if [modal] */
|
|
234
|
+
|
|
235
|
+
z-index:0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
#form {
|
|
239
|
+
display: contents;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#scrim::-webkit-scrollbar {
|
|
243
|
+
display: none;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
#scrim::after {
|
|
247
|
+
content: '';
|
|
248
|
+
|
|
249
|
+
display: block;
|
|
250
|
+
|
|
251
|
+
block-size: 200%;
|
|
252
|
+
inline-size: 200%;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#surface {
|
|
256
|
+
--mdw-shape__size: var(--mdw-shape__extra-small);
|
|
257
|
+
position: sticky;
|
|
258
|
+
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
|
|
262
|
+
inline-size: calc(var(--mdw-menu__size) * var(--mdw-menu__inline-base));
|
|
263
|
+
min-inline-size: calc(var(--mdw-menu__inline-base) * 2);
|
|
264
|
+
max-inline-size: 100vw;
|
|
265
|
+
flex:1;
|
|
266
|
+
|
|
267
|
+
pointer-events: auto;
|
|
268
|
+
/* background-color: rgb(var(--mdw-color__surface)); */
|
|
269
|
+
/* color: rgb(var(--mdw-color__on-surface)); */
|
|
270
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
271
|
+
will-change: top, left;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@supports(-moz-appearance: none) {
|
|
275
|
+
#surface {
|
|
276
|
+
position: absolute;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
#scroller {
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: stretch;
|
|
283
|
+
flex-direction: column;
|
|
284
|
+
overflow-y: auto;
|
|
285
|
+
overscroll-behavior: none;
|
|
286
|
+
overscroll-behavior: contain;
|
|
287
|
+
|
|
288
|
+
flex: 1;
|
|
289
|
+
|
|
290
|
+
padding-block: 8px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
#scrim[modal] {
|
|
294
|
+
visibility: visible;
|
|
295
|
+
}
|
|
296
|
+
`
|
|
127
297
|
.methods({
|
|
128
298
|
focus() {
|
|
129
299
|
const [firstItem] = this.kbdNavChildren;
|
package/components/MenuItem.js
CHANGED
|
@@ -4,7 +4,6 @@ import FormAssociatedMixin from '../mixins/FormAssociatedMixin.js';
|
|
|
4
4
|
|
|
5
5
|
import './Icon.js';
|
|
6
6
|
import ListOption from './ListOption.js';
|
|
7
|
-
import styles from './MenuItem.css' assert { type: 'css' };
|
|
8
7
|
|
|
9
8
|
export default class MenuItem extends ListOption
|
|
10
9
|
.mixin(FormAssociatedMixin)
|
|
@@ -101,7 +100,6 @@ export default class MenuItem extends ListOption
|
|
|
101
100
|
this._cascading = false;
|
|
102
101
|
},
|
|
103
102
|
})
|
|
104
|
-
.css(styles)
|
|
105
103
|
.on({
|
|
106
104
|
_selectedChanged(oldValue, newValue) {
|
|
107
105
|
console.log('_selectedChanged', oldValue, newValue);
|
|
@@ -206,6 +204,61 @@ export default class MenuItem extends ListOption
|
|
|
206
204
|
trailingIcon.textContent = '{computeTrailingIcon}';
|
|
207
205
|
},
|
|
208
206
|
})
|
|
207
|
+
.css`
|
|
208
|
+
/* https://m3.material.io/components/menus/specs */
|
|
209
|
+
|
|
210
|
+
:host {
|
|
211
|
+
gap: 12px;
|
|
212
|
+
|
|
213
|
+
padding-inline: 12px;
|
|
214
|
+
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
|
|
217
|
+
white-space: nowrap;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#content {
|
|
221
|
+
padding-block: calc(4px + (var(--mdw-density) * 2px))
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#icon {
|
|
225
|
+
transition-duration: 100ms;
|
|
226
|
+
transition-property: opacity;
|
|
227
|
+
will-change: opacity;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#trailing,
|
|
231
|
+
#icon {
|
|
232
|
+
color: rgb(var(--mdw-color__on-surface-variant));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
#selection {
|
|
236
|
+
opacity: 0;
|
|
237
|
+
|
|
238
|
+
font-size: 18px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
#selection.trailing {
|
|
242
|
+
font-size: 24px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
#selection[selected] {
|
|
246
|
+
opacity: 1;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:host([disabled]) {
|
|
250
|
+
cursor: not-allowed;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
#anchor[selected] {
|
|
254
|
+
background-color: transparent;
|
|
255
|
+
color: inherit;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
#content[selected] {
|
|
259
|
+
color: inherit;
|
|
260
|
+
}
|
|
261
|
+
`
|
|
209
262
|
.autoRegister('mdw-menu-item')
|
|
210
263
|
.tsClassFix() {
|
|
211
264
|
formResetCallback() {
|
package/components/Nav.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import styles from './Nav.css' assert { type: 'css' };
|
|
2
1
|
import NavItem from './NavItem.js';
|
|
3
2
|
import Surface from './Surface.js';
|
|
4
3
|
|
|
5
4
|
export default Surface
|
|
6
5
|
.extend()
|
|
7
|
-
.css
|
|
6
|
+
.css`
|
|
7
|
+
/* https://m3.material.io/components/navigation-bar/specs */
|
|
8
|
+
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
9
|
+
/* https://m3.material.io/components/navigation-rail/specs */
|
|
10
|
+
|
|
11
|
+
:host {
|
|
12
|
+
--mdw-surface__tint: var(--mdw-surface__tint__2);
|
|
13
|
+
--mdw-surface__tint__raised: var(--mdw-surface__tint__2);
|
|
14
|
+
--mdw-ink: var(--mdw-color__on-surface);
|
|
15
|
+
--mdw-bg: var(--mdw-color__surface);
|
|
16
|
+
|
|
17
|
+
z-index:2;
|
|
18
|
+
|
|
19
|
+
color: rgb(var(--mdw-ink));
|
|
20
|
+
|
|
21
|
+
font: var(--mdw-typescale__label-medium__font);
|
|
22
|
+
letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
|
|
23
|
+
}
|
|
24
|
+
`
|
|
8
25
|
.set({
|
|
9
26
|
elevated: true,
|
|
10
27
|
color: 'surface',
|
package/components/NavBar.js
CHANGED
|
@@ -2,7 +2,6 @@ import { ELEMENT_STYLER_TYPE } from '../core/customTypes.js';
|
|
|
2
2
|
import ScrollListenerMixin from '../mixins/ScrollListenerMixin.js';
|
|
3
3
|
|
|
4
4
|
import Nav from './Nav.js';
|
|
5
|
-
import styles from './NavBar.css' assert { type: 'css' };
|
|
6
5
|
|
|
7
6
|
export default Nav
|
|
8
7
|
.mixin(ScrollListenerMixin)
|
|
@@ -50,7 +49,43 @@ export default Nav
|
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
})
|
|
53
|
-
.css
|
|
52
|
+
.css`
|
|
53
|
+
/* https://m3.material.io/components/navigation-bar/specs */
|
|
54
|
+
|
|
55
|
+
:host {
|
|
56
|
+
position: sticky;
|
|
57
|
+
inset-block-end: 0;
|
|
58
|
+
order:1; /* Nav Bars are at top of tab order, but bottom of page */
|
|
59
|
+
|
|
60
|
+
display: grid;
|
|
61
|
+
align-content: flex-start;
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
grid-auto-columns: minmax(48px, 1fr);
|
|
65
|
+
grid-auto-flow: column;
|
|
66
|
+
|
|
67
|
+
overflow: hidden; /* Don't expand viewport when contents translates */
|
|
68
|
+
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
min-block-size: 80px;
|
|
71
|
+
inline-size: 100%;
|
|
72
|
+
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
|
|
77
|
+
box-shadow: none;
|
|
78
|
+
|
|
79
|
+
text-align: center;
|
|
80
|
+
|
|
81
|
+
will-change: transform;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#slot {
|
|
85
|
+
pointer-events: auto;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
`
|
|
54
89
|
.on({
|
|
55
90
|
connected() {
|
|
56
91
|
if (this.hideOnScroll) {
|
package/components/NavBarItem.js
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
|
-
import styles from './NavBarItem.css' assert { type: 'css' };
|
|
2
1
|
import NavItem from './NavItem.js';
|
|
3
2
|
|
|
4
3
|
export default NavItem
|
|
5
4
|
.extend()
|
|
6
|
-
.css
|
|
5
|
+
.css`
|
|
6
|
+
/* https://m3.material.io/components/navigation-bar/specs */
|
|
7
|
+
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
8
|
+
/* https://m3.material.io/components/navigation-rail/specs */
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
grid-auto-rows: minmax(20px, min-content);
|
|
12
|
+
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
13
|
+
grid-template-columns: auto [icon] minmax(56px, 1fr) auto;
|
|
14
|
+
|
|
15
|
+
padding-block: 12px; /* Spec 16px bottom is based on 1em not 1lh */
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#slot {
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host(:empty) {
|
|
23
|
+
font-size: 0;
|
|
24
|
+
line-height: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#slot[show-label] {
|
|
28
|
+
grid-column: 1 /4;
|
|
29
|
+
|
|
30
|
+
grid-row: 2;
|
|
31
|
+
|
|
32
|
+
opacity: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#shape {
|
|
36
|
+
grid-column: 2;
|
|
37
|
+
grid-row: 1 / 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#slot[show-label="never"] {
|
|
41
|
+
block-size: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#slot[show-label="active"][active] {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
`
|
|
7
49
|
.autoRegister('mdw-nav-bar-item');
|
package/components/NavDrawer.js
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
|
-
import styles from './NavDrawer.css' assert { type: 'css' };
|
|
2
1
|
import NavRail from './NavRail.js';
|
|
3
2
|
|
|
4
3
|
export default NavRail
|
|
5
4
|
.extend()
|
|
6
|
-
.css(styles)
|
|
7
5
|
.observe({
|
|
8
6
|
shapeEnd: {
|
|
9
7
|
type: 'boolean',
|
|
10
8
|
empty: true,
|
|
11
9
|
},
|
|
12
10
|
})
|
|
11
|
+
.css`
|
|
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);
|
|
17
|
+
--mdw-shape__size: var(--mdw-shape__large, 16px);
|
|
18
|
+
--mdw-shape__size__top-start-size: 0px;
|
|
19
|
+
--mdw-shape__size__bottom-start-size: 0px;
|
|
20
|
+
|
|
21
|
+
--mdw-nav-item__badge__position: static;
|
|
22
|
+
--mdw-nav-item__badge__transform: none;
|
|
23
|
+
--mdw-nav-item__badge__grid-area: badge;
|
|
24
|
+
--mdw-nav-item__label__padding-block: 18px;
|
|
25
|
+
--mdw-nav-item__label__padding-inline: 52px 0;
|
|
26
|
+
--mdw-nav-item__anchor__display: block;
|
|
27
|
+
--mdw-nav-item__indicator__grid-area: auto;
|
|
28
|
+
|
|
29
|
+
display: block;
|
|
30
|
+
grid-template-rows: min-content;
|
|
31
|
+
grid-template-columns: minmax(360px, min-content);
|
|
32
|
+
|
|
33
|
+
min-inline-size: 360px;
|
|
34
|
+
padding-inline: 12px;
|
|
35
|
+
|
|
36
|
+
box-shadow: none;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#slot {
|
|
41
|
+
gap: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
`
|
|
13
45
|
.autoRegister('mdw-nav-drawer');
|
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import styles from './NavDrawerItem.css' assert { type: 'css' };
|
|
2
1
|
import NavItem from './NavItem.js';
|
|
3
2
|
|
|
4
3
|
export default NavItem
|
|
5
4
|
.extend()
|
|
6
|
-
.css
|
|
5
|
+
.css`
|
|
6
|
+
/* https://m3.material.io/components/navigation-bar/specs */
|
|
7
|
+
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
8
|
+
/* https://m3.material.io/components/navigation-rail/specs */
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
align-self: stretch;
|
|
12
|
+
|
|
13
|
+
display: grid;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 12px;
|
|
17
|
+
grid-template:
|
|
18
|
+
"icon label badge" minmax(56px, min-content)
|
|
19
|
+
/ 24px 1fr minmax(0, min-content);
|
|
20
|
+
justify-items: flex-start;
|
|
21
|
+
|
|
22
|
+
padding-inline: 16px 24px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#icon {
|
|
26
|
+
grid-area: icon;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#slot {
|
|
30
|
+
display: block;
|
|
31
|
+
|
|
32
|
+
text-align: start;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([active]) {
|
|
36
|
+
color: rgb(var(--mdw-ink));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#shape {
|
|
40
|
+
max-inline-size: none;
|
|
41
|
+
grid-column: auto;
|
|
42
|
+
grid-row: 1 / 2;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#badge-text {
|
|
46
|
+
z-index: 1;
|
|
47
|
+
}
|
|
48
|
+
`
|
|
7
49
|
.on({
|
|
8
50
|
composed({ html }) {
|
|
9
51
|
this.refs.badge.replaceWith(html`<span id="badge-text">{badge}</span>`);
|
package/components/NavItem.js
CHANGED
|
@@ -8,8 +8,6 @@ import ShapeMixin from '../mixins/ShapeMixin.js';
|
|
|
8
8
|
import StateMixin from '../mixins/StateMixin.js';
|
|
9
9
|
import ThemableMixin from '../mixins/ThemableMixin.js';
|
|
10
10
|
|
|
11
|
-
import styles from './NavItem.css' assert { type: 'css' };
|
|
12
|
-
|
|
13
11
|
/** @typedef {'charset'|'coords'|'name'|'shape'} DeprecatedHTMLAnchorElementProperties */
|
|
14
12
|
|
|
15
13
|
export default class NavItem extends CustomElement
|
|
@@ -36,7 +34,6 @@ export default class NavItem extends CustomElement
|
|
|
36
34
|
this.refs.anchor.focus(options);
|
|
37
35
|
},
|
|
38
36
|
})
|
|
39
|
-
.css(styles)
|
|
40
37
|
.html/* html */`
|
|
41
38
|
<mdw-icon id=icon aria-hidden=true src={src} active={active}>{icon}</mdw-icon>
|
|
42
39
|
<a id=anchor
|
|
@@ -61,6 +58,189 @@ export default class NavItem extends CustomElement
|
|
|
61
58
|
shape.removeAttribute('color');
|
|
62
59
|
},
|
|
63
60
|
})
|
|
61
|
+
.css`
|
|
62
|
+
/* https://m3.material.io/components/navigation-bar/specs */
|
|
63
|
+
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
64
|
+
/* https://m3.material.io/components/navigation-rail/specs */
|
|
65
|
+
|
|
66
|
+
:host {
|
|
67
|
+
--mdw-badge__scale: 0;
|
|
68
|
+
--mdw-shape__size: var(--mdw-shape__full);
|
|
69
|
+
--mdw-nav-item__offset-y: 0;
|
|
70
|
+
position: relative;
|
|
71
|
+
|
|
72
|
+
display: grid;
|
|
73
|
+
align-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
grid-auto-flow: row;
|
|
76
|
+
grid-auto-rows: minmax(20px, min-content);
|
|
77
|
+
grid-template-rows: [icon] minmax(32px, 1fr);
|
|
78
|
+
grid-template-columns: [icon] minmax(56px, 1fr);
|
|
79
|
+
|
|
80
|
+
justify-items: center;
|
|
81
|
+
row-gap: 4px;
|
|
82
|
+
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
min-block-size: 56px;
|
|
85
|
+
|
|
86
|
+
padding-inline: 0;
|
|
87
|
+
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
90
|
+
user-select: none;
|
|
91
|
+
|
|
92
|
+
font: var(--mdw-typescale__label-large__font);
|
|
93
|
+
letter-spacing: var(--mdw-typescale__label-large__letter-spacing);
|
|
94
|
+
|
|
95
|
+
text-align: center;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host(:not([color])) {
|
|
99
|
+
--mdw-ink: var(--mdw-color__on-secondary-container);
|
|
100
|
+
--mdw-bg: var(--mdw-color__secondary-container);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([color]) {
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
color: rgb(var(--mdw-color__on-surface-variant));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#slot {
|
|
109
|
+
display: contents;
|
|
110
|
+
align-items: center;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
grid-area: label;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
|
|
115
|
+
grid-column: 1 /4;
|
|
116
|
+
|
|
117
|
+
grid-row: 2;
|
|
118
|
+
|
|
119
|
+
flex: 1;
|
|
120
|
+
|
|
121
|
+
cursor: inherit;
|
|
122
|
+
outline: none;
|
|
123
|
+
|
|
124
|
+
transform: translateY(var(--mdw-nav-item__offset-y));
|
|
125
|
+
|
|
126
|
+
color: rgb(var(--mdw-color__on-surface-variant));
|
|
127
|
+
|
|
128
|
+
transition: opacity, color, transform 200ms;
|
|
129
|
+
will-change: opacity, transform;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#anchor {
|
|
133
|
+
position: absolute;
|
|
134
|
+
inset: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#shape {
|
|
138
|
+
position: absolute;
|
|
139
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
140
|
+
top: 50%;
|
|
141
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
142
|
+
left: 50%;
|
|
143
|
+
|
|
144
|
+
block-size: 100%;
|
|
145
|
+
inline-size: 100%;
|
|
146
|
+
max-inline-size: 56px;
|
|
147
|
+
|
|
148
|
+
grid-column: icon;
|
|
149
|
+
grid-row: 1 / 1;
|
|
150
|
+
|
|
151
|
+
transform: translateX(-50%) translateY(-50%) translateY(var(--mdw-nav-item__offset-y));
|
|
152
|
+
z-index: 0;
|
|
153
|
+
|
|
154
|
+
background-color: transparent;
|
|
155
|
+
|
|
156
|
+
transition: transform 200ms;
|
|
157
|
+
will-change: transform;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#icon {
|
|
161
|
+
position: relative;
|
|
162
|
+
align-self: center;
|
|
163
|
+
|
|
164
|
+
grid-area: icon;
|
|
165
|
+
|
|
166
|
+
transform: translateY(var(--mdw-nav-item__offset-y));
|
|
167
|
+
z-index: 3;
|
|
168
|
+
|
|
169
|
+
color: rgb(var(--mdw-color__on-surface-variant));
|
|
170
|
+
|
|
171
|
+
font-size: 24px;
|
|
172
|
+
font-variation-settings: 'FILL' 0;
|
|
173
|
+
|
|
174
|
+
transition: transform 200ms;
|
|
175
|
+
will-change: transform;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#state {
|
|
179
|
+
z-index: 2;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
#badge {
|
|
183
|
+
--mdw-badge__scale: 0;
|
|
184
|
+
position: absolute;
|
|
185
|
+
inset-block-start: 50%;
|
|
186
|
+
inset-inline-start: 50%;
|
|
187
|
+
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
|
|
190
|
+
max-inline-size: 50%;
|
|
191
|
+
grid-column: 1 / 4;
|
|
192
|
+
|
|
193
|
+
grid-row: 1 / 2;
|
|
194
|
+
|
|
195
|
+
transform: translateY(-100%) translateY(var(--mdw-nav-item__offset-y)) scale(var(--mdw-badge__scale));
|
|
196
|
+
z-index: 4;
|
|
197
|
+
|
|
198
|
+
text-align: start;
|
|
199
|
+
text-overflow: ellipsis;
|
|
200
|
+
text-transform: none;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
word-break: normal;
|
|
203
|
+
|
|
204
|
+
transition: transform 200ms;
|
|
205
|
+
will-change: transform;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
#badge[badge] {
|
|
209
|
+
--mdw-badge__scale: 1;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#ripple {
|
|
213
|
+
opacity: 1;
|
|
214
|
+
|
|
215
|
+
color: rgb(var(--mdw-bg));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
#ripple-container {
|
|
219
|
+
z-index:1;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#shape[active] {
|
|
223
|
+
color: rgb(var(--mdw-ink));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
#icon[active] {
|
|
227
|
+
color: rgb(var(--mdw-ink));
|
|
228
|
+
|
|
229
|
+
font-variation-settings: 'FILL' 1;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#slot[active] {
|
|
233
|
+
color: inherit;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
:host([show-label]) {
|
|
237
|
+
--mdw-nav-item__offset-y: 12px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
:host([show-label="active"][active]) {
|
|
241
|
+
--mdw-nav-item__offset-y: 0;
|
|
242
|
+
}
|
|
243
|
+
`
|
|
64
244
|
.childEvents({
|
|
65
245
|
anchor: {
|
|
66
246
|
click() {
|