material-inspired-component-library 4.0.0 → 4.0.2
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/components/accordion/README.md +42 -3
- package/components/alert/README.md +19 -7
- package/components/button/README.md +1 -1
- package/components/button/index.scss +23 -20
- package/components/dialog/README.md +5 -5
- package/components/divider/index.scss +9 -3
- package/components/iconbutton/README.md +1 -1
- package/components/iconbutton/index.scss +20 -17
- package/components/list/README.md +18 -16
- package/components/list/index.scss +90 -68
- package/components/menu/README.md +2 -1
- package/components/menu/index.scss +6 -18
- package/components/select/README.md +7 -2
- package/components/select/index.scss +2 -3
- package/components/sidesheet/README.md +13 -19
- package/components/sidesheet/index.scss +15 -16
- package/components/textfield/index.ts +26 -0
- package/components/timepicker/index.scss +268 -0
- package/components/timepicker/index.ts +113 -0
- package/dist/button.css +1 -1
- package/dist/components/timepicker/index.d.ts +5 -0
- package/dist/divider.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/menu.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/timepicker.css +1 -0
- package/dist/timepicker.js +1 -0
- package/docs/accordion.html +31 -17
- package/docs/button.html +42 -15
- package/docs/iconbutton.html +258 -164
- package/docs/index.html +11 -8
- package/docs/list.html +52 -44
- package/docs/menu.html +2 -1
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/sidesheet.html +3 -2
- package/docs/timepicker.html +113 -0
- package/micl.ts +3 -1
- package/package.json +2 -4
- package/styles.scss +1 -0
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
--md-sys-list-item-three-padding: 12px;
|
|
36
36
|
--md-sys-list-item-space: 16px;
|
|
37
37
|
--md-sys-list-item-padding-inline: 16px;
|
|
38
|
+
--md-sys-accordion-item-space: 0px;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
.micl-list {
|
|
@@ -42,22 +43,28 @@
|
|
|
42
43
|
--md-sys-list-motion-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
43
44
|
--md-sys-accordion-motion-spatial: #{motion.$md-sys-motion-expressive-default-spatial};
|
|
44
45
|
--md-sys-accordion-motion-duration: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
46
|
+
--md-sys-divider-space: 8px;
|
|
45
47
|
|
|
46
48
|
margin: 0;
|
|
47
|
-
padding: var(--md-sys-list-padding) 0;
|
|
49
|
+
padding: var(--md-sys-list-padding, 8px) 0;
|
|
48
50
|
interpolate-size: allow-keywords;
|
|
49
51
|
list-style-type: none;
|
|
52
|
+
overflow-x: hidden;
|
|
50
53
|
|
|
51
54
|
&> details {
|
|
52
55
|
&::details-content {
|
|
53
|
-
|
|
56
|
+
block-size: 0;
|
|
54
57
|
overflow: hidden;
|
|
55
58
|
transition:
|
|
56
|
-
|
|
59
|
+
block-size var( --md-sys-accordion-motion-duration) var(--md-sys-accordion-motion-spatial),
|
|
57
60
|
content-visibility var(--md-sys-accordion-motion-duration) linear allow-discrete;
|
|
58
61
|
}
|
|
59
62
|
&[open]::details-content {
|
|
60
|
-
|
|
63
|
+
block-size: auto;
|
|
64
|
+
margin-block-end: var(--md-sys-accordion-item-space, 0px);
|
|
65
|
+
}
|
|
66
|
+
&[open] .micl-list-item__icon--expander {
|
|
67
|
+
transform: rotate(180deg);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
&> summary.micl-list-item-one,
|
|
@@ -78,18 +85,46 @@
|
|
|
78
85
|
}
|
|
79
86
|
.micl-list-item__content {
|
|
80
87
|
box-sizing: border-box;
|
|
81
|
-
padding-inline: var(--md-sys-list-item-padding-inline);
|
|
88
|
+
padding-inline: var(--md-sys-list-item-padding-inline, 16px);
|
|
82
89
|
background-color: var(--md-sys-list-item-container-color);
|
|
83
90
|
overflow: hidden;
|
|
84
91
|
}
|
|
85
92
|
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.micl-list:has(.micl-list-item-one[tabindex], .micl-list-item-two[tabindex], .micl-list-item-three[tabindex]),
|
|
96
|
+
select {
|
|
97
|
+
.micl-list-item-one:not(:disabled):not(.micl-list-item--disabled),
|
|
98
|
+
.micl-list-item-two:not(:disabled):not(.micl-list-item--disabled),
|
|
99
|
+
.micl-list-item-three:not(:disabled):not(.micl-list-item--disabled) {
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
|
|
102
|
+
&:hover {
|
|
103
|
+
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
|
|
104
|
+
|
|
105
|
+
.micl-list-item__icon {
|
|
106
|
+
font-variation-settings: 'FILL' 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
&:focus-visible {
|
|
110
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
|
|
111
|
+
|
|
112
|
+
outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
|
|
113
|
+
outline-offset: var(--md-sys-state-focus-indicator-inner-offset);
|
|
86
114
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
115
|
+
.micl-list-item__icon {
|
|
116
|
+
font-variation-settings: 'FILL' 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
&:active {
|
|
120
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
|
|
121
|
+
|
|
122
|
+
background-size: 0%, 100%;
|
|
123
|
+
transition: background-size 0ms;
|
|
124
|
+
|
|
125
|
+
.micl-list-item__icon {
|
|
126
|
+
font-variation-settings: 'FILL' 1;
|
|
127
|
+
}
|
|
93
128
|
}
|
|
94
129
|
}
|
|
95
130
|
}
|
|
@@ -103,10 +138,11 @@
|
|
|
103
138
|
box-sizing: border-box;
|
|
104
139
|
display: flex;
|
|
105
140
|
align-items: center;
|
|
106
|
-
column-gap: var(--md-sys-list-item-space);
|
|
107
|
-
padding-inline: var(--md-sys-list-item-space);
|
|
141
|
+
column-gap: var(--md-sys-list-item-space, 16px);
|
|
142
|
+
padding-inline: var(--md-sys-list-item-space, 16px);
|
|
108
143
|
border: none;
|
|
109
144
|
border-radius: var(--md-sys-shape-corner-none, 0px);
|
|
145
|
+
outline: none;
|
|
110
146
|
background-color: var(--md-sys-list-item-container-color);
|
|
111
147
|
background-image:
|
|
112
148
|
radial-gradient(circle at var(--micl-x, center) var(--micl-y, center), transparent 0%, rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)) 10%, transparent 10%),
|
|
@@ -128,9 +164,9 @@
|
|
|
128
164
|
display: inherit;
|
|
129
165
|
align-items: inherit;
|
|
130
166
|
column-gap: inherit;
|
|
131
|
-
min-
|
|
167
|
+
min-block-size: inherit;
|
|
132
168
|
inline-size: 100%;
|
|
133
|
-
padding-inline: var(--md-sys-list-item-space);
|
|
169
|
+
padding-inline: var(--md-sys-list-item-space, 16px);
|
|
134
170
|
border: none;
|
|
135
171
|
border-radius: inherit;
|
|
136
172
|
background-color: transparent;
|
|
@@ -143,9 +179,9 @@
|
|
|
143
179
|
&:disabled,
|
|
144
180
|
&.micl-list-item--disabled {
|
|
145
181
|
.micl-list-item__icon,
|
|
182
|
+
.micl-list-item__headline,
|
|
183
|
+
.micl-list-item__supporting-text,
|
|
146
184
|
.micl-list-item__text,
|
|
147
|
-
.micl-list-item__text .micl-list-item__headline,
|
|
148
|
-
.micl-list-item__text .micl-list-item__supporting-text,
|
|
149
185
|
.micl-list-item__text::after,
|
|
150
186
|
.micl-list-item__trailing-text {
|
|
151
187
|
color: rgb(from var(--md-sys-color-on-surface) r g b / 38%);
|
|
@@ -160,36 +196,6 @@
|
|
|
160
196
|
}
|
|
161
197
|
}
|
|
162
198
|
&:not(:disabled):not(.micl-list-item--disabled) {
|
|
163
|
-
&:hover {
|
|
164
|
-
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity);
|
|
165
|
-
|
|
166
|
-
&:has(input[type=checkbox]) {
|
|
167
|
-
cursor: pointer;
|
|
168
|
-
}
|
|
169
|
-
.micl-list-item__icon {
|
|
170
|
-
font-variation-settings: 'FILL' 1;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
&:focus-visible {
|
|
174
|
-
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity);
|
|
175
|
-
|
|
176
|
-
outline: var(--md-sys-state-focus-indicator-thickness) solid var(--md-sys-color-secondary);
|
|
177
|
-
outline-offset: var(--md-sys-state-focus-indicator-inner-offset);
|
|
178
|
-
|
|
179
|
-
.micl-list-item__icon {
|
|
180
|
-
font-variation-settings: 'FILL' 1;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
&:active {
|
|
184
|
-
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity);
|
|
185
|
-
|
|
186
|
-
background-size: 0%, 100%;
|
|
187
|
-
transition: background-size 0ms;
|
|
188
|
-
|
|
189
|
-
.micl-list-item__icon {
|
|
190
|
-
font-variation-settings: 'FILL' 1;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
199
|
&:has(input[type=checkbox]:checked) {
|
|
194
200
|
background-color: var(--md-sys-color-secondary-container);
|
|
195
201
|
|
|
@@ -204,14 +210,17 @@
|
|
|
204
210
|
}
|
|
205
211
|
input[type=checkbox]:not(:disabled):hover,
|
|
206
212
|
input[type=checkbox]:not(:disabled):active {
|
|
207
|
-
--
|
|
208
|
-
|
|
213
|
+
--statelayer-opacity: 0%;
|
|
214
|
+
|
|
215
|
+
&.micl-switch::after {
|
|
216
|
+
border-color: transparent;
|
|
217
|
+
}
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
221
|
|
|
213
222
|
.micl-list-item-one {
|
|
214
|
-
min-
|
|
223
|
+
min-block-size: var(--md-sys-list-item-one-height);
|
|
215
224
|
|
|
216
225
|
&:not(:has(> a,> button,> label)) {
|
|
217
226
|
padding-block-start: var(--md-sys-list-item-one-padding);
|
|
@@ -237,7 +246,7 @@
|
|
|
237
246
|
}
|
|
238
247
|
}
|
|
239
248
|
.micl-list-item-two {
|
|
240
|
-
min-
|
|
249
|
+
min-block-size: var(--md-sys-list-item-two-height);
|
|
241
250
|
|
|
242
251
|
&:not(:has(> a,> button,> label)) {
|
|
243
252
|
padding-block-start: var(--md-sys-list-item-two-padding);
|
|
@@ -266,9 +275,16 @@
|
|
|
266
275
|
overflow: hidden;
|
|
267
276
|
text-overflow: ellipsis;
|
|
268
277
|
}
|
|
278
|
+
input[type=checkbox].micl-checkbox {
|
|
279
|
+
block-size: 24px;
|
|
280
|
+
min-block-size: 24px;
|
|
281
|
+
inline-size: 24px;
|
|
282
|
+
min-inline-size: 24px;
|
|
283
|
+
}
|
|
269
284
|
}
|
|
270
285
|
.micl-list-item-three {
|
|
271
|
-
min-
|
|
286
|
+
min-block-size: var(--md-sys-list-item-three-height);
|
|
287
|
+
align-items: flex-start;
|
|
272
288
|
|
|
273
289
|
&:not(:has(> a,> button,> label)) {
|
|
274
290
|
padding-block-start: var(--md-sys-list-item-three-padding);
|
|
@@ -292,29 +308,31 @@
|
|
|
292
308
|
padding-inline-start: 0px;
|
|
293
309
|
}
|
|
294
310
|
}
|
|
295
|
-
.micl-list-item__icon,
|
|
296
|
-
.micl-list-item__avatar,
|
|
297
|
-
.micl-list-item__image {
|
|
298
|
-
align-self: flex-start;
|
|
299
|
-
}
|
|
300
311
|
.micl-list-item__supporting-text {
|
|
301
312
|
display: -webkit-box;
|
|
302
313
|
overflow: hidden;
|
|
303
314
|
-webkit-box-orient: vertical;
|
|
304
315
|
-webkit-line-clamp: 2;
|
|
305
316
|
}
|
|
306
|
-
input[type=checkbox] {
|
|
307
|
-
|
|
308
|
-
|
|
317
|
+
input[type=checkbox].micl-checkbox {
|
|
318
|
+
block-size: 24px;
|
|
319
|
+
min-block-size: 24px;
|
|
320
|
+
inline-size: 24px;
|
|
321
|
+
min-inline-size: 24px;
|
|
309
322
|
}
|
|
310
323
|
}
|
|
311
324
|
|
|
312
325
|
.micl-list-item__icon {
|
|
313
|
-
min-
|
|
326
|
+
min-inline-size: var(--md-sys-layout-icon-size, 24px);
|
|
314
327
|
font-size: var(--md-sys-layout-icon-size, 24px);
|
|
315
328
|
font-variation-settings: 'FILL' 0;
|
|
316
329
|
color: var(--md-sys-color-on-surface-variant);
|
|
317
330
|
transition: font-variation-settings var(--md-sys-list-motion-duration) linear;
|
|
331
|
+
|
|
332
|
+
&.micl-list-item__icon--expander {
|
|
333
|
+
transform: rotate(0deg);
|
|
334
|
+
transition: transform var(--md-sys-list-motion-duration) linear;
|
|
335
|
+
}
|
|
318
336
|
}
|
|
319
337
|
.micl-list-item__avatar {
|
|
320
338
|
@include typography.title-medium;
|
|
@@ -324,14 +342,14 @@
|
|
|
324
342
|
justify-content: center;
|
|
325
343
|
block-size: 40px;
|
|
326
344
|
min-inline-size: 40px;
|
|
327
|
-
border-radius: var(--md-sys-shape-corner-full);
|
|
345
|
+
border-radius: var(--md-sys-shape-corner-full, 50%);
|
|
328
346
|
color: var(--md-sys-color-on-primary-container);
|
|
329
347
|
background-color: var(--md-sys-color-primary-container);
|
|
330
348
|
}
|
|
331
349
|
.micl-list-item__image {
|
|
332
350
|
display: inline-block;
|
|
333
|
-
|
|
334
|
-
min-
|
|
351
|
+
block-size: 56px;
|
|
352
|
+
min-inline-size: 56px;
|
|
335
353
|
border-radius: var(--md-sys-shape-corner-none, 0px);
|
|
336
354
|
background-position: center;
|
|
337
355
|
background-repeat: no-repeat;
|
|
@@ -339,19 +357,19 @@
|
|
|
339
357
|
}
|
|
340
358
|
.micl-list-item__thumbnail {
|
|
341
359
|
display: inline-block;
|
|
342
|
-
|
|
343
|
-
min-
|
|
360
|
+
block-size: 64px;
|
|
361
|
+
min-inline-size: calc(64px * var(--md-sys-list-item-thumbnail-aspect-ratio));
|
|
344
362
|
border-radius: var(--md-sys-shape-corner-none, 0px);
|
|
345
363
|
background-position: center;
|
|
346
364
|
background-repeat: no-repeat;
|
|
347
|
-
background-size:
|
|
365
|
+
background-size: cover;
|
|
348
366
|
}
|
|
349
367
|
|
|
350
368
|
.micl-list-item__text {
|
|
351
369
|
display: flex;
|
|
352
370
|
flex-direction: column;
|
|
353
371
|
flex-basis: 100%;
|
|
354
|
-
min-
|
|
372
|
+
min-inline-size: 0;
|
|
355
373
|
text-align: start;
|
|
356
374
|
|
|
357
375
|
.micl-list-item__headline {
|
|
@@ -371,3 +389,7 @@
|
|
|
371
389
|
|
|
372
390
|
color: var(--md-sys-color-on-surface-variant);
|
|
373
391
|
}
|
|
392
|
+
|
|
393
|
+
[dir=rtl] .micl-list details[open] .micl-list-item__icon--expander {
|
|
394
|
+
transform: rotate(-180deg);
|
|
395
|
+
}
|
|
@@ -113,6 +113,7 @@ A menu item may trigger opening a submenu when invoked by a button. Wrap the men
|
|
|
113
113
|
<span class="micl-list-item__headline">Item 1-1</span>
|
|
114
114
|
</span>
|
|
115
115
|
</li>
|
|
116
|
+
<li role="separator" class="micl-divider"></li>
|
|
116
117
|
<li class="micl-list-item-one" tabindex="0">
|
|
117
118
|
<span class="micl-list-item__text">
|
|
118
119
|
<span class="micl-list-item__headline">Item 1-2</span>
|
|
@@ -132,7 +133,7 @@ A menu item may trigger opening a submenu when invoked by a button. Wrap the men
|
|
|
132
133
|
|
|
133
134
|
Adding the `micl-list-item--disabled` class to a menu item causes the item to be displayed in a disabled state.
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
Use a [Divider component](../divider/README.md) to separate neighbouring menu items by a divider.
|
|
136
137
|
|
|
137
138
|
## Customizations
|
|
138
139
|
You can customize the appearance of the Menu component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child menus.
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
inset-block-start: anchor(end);
|
|
38
38
|
inset-inline-start: anchor(start);
|
|
39
39
|
position-try: most-block-size flip-block, flip-inline;
|
|
40
|
-
min-
|
|
41
|
-
max-
|
|
40
|
+
min-inline-size: var(--md-sys-menu-width-min, 112px);
|
|
41
|
+
max-inline-size: var(--md-sys-menu-width-max, 280px);
|
|
42
42
|
padding: 0;
|
|
43
43
|
border: none;
|
|
44
44
|
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
45
|
+
outline: none;
|
|
45
46
|
background-color: var(--md-sys-color-surface-container);
|
|
46
47
|
box-shadow: var(--md-sys-elevation-level2);
|
|
47
48
|
opacity: 0;
|
|
@@ -84,7 +85,6 @@
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
&> .micl-list {
|
|
87
|
-
--md-sys-list-padding: 4px;
|
|
88
88
|
--md-sys-list-item-one-height: 48px;
|
|
89
89
|
--md-sys-list-item-one-padding: 0;
|
|
90
90
|
--md-sys-list-item-two-padding: 0;
|
|
@@ -94,21 +94,6 @@
|
|
|
94
94
|
.micl-list-item-one,
|
|
95
95
|
.micl-list-item-two,
|
|
96
96
|
.micl-list-item-three {
|
|
97
|
-
&.micl-list-item__divider {
|
|
98
|
-
position: relative;
|
|
99
|
-
margin-block-start: 16px;
|
|
100
|
-
overflow: clip;
|
|
101
|
-
overflow-clip-margin: 8px;
|
|
102
|
-
|
|
103
|
-
&::after {
|
|
104
|
-
content: "";
|
|
105
|
-
position: absolute;
|
|
106
|
-
inset-block-start: -8px;
|
|
107
|
-
inset-inline-start: 0;
|
|
108
|
-
width: 100%;
|
|
109
|
-
border-top: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
97
|
&> .micl-menu[popover] {
|
|
113
98
|
transform: scaleX(0);
|
|
114
99
|
|
|
@@ -129,3 +114,6 @@
|
|
|
129
114
|
}
|
|
130
115
|
}
|
|
131
116
|
|
|
117
|
+
[dir=rtl] .micl-menu[popover] > .micl-list button[popovertarget] .micl-list-item__icon {
|
|
118
|
+
transform: rotate(180deg);
|
|
119
|
+
}
|
|
@@ -29,6 +29,11 @@ The Select component relies on styles from the text field and list components. B
|
|
|
29
29
|
@use "material-inspired-component-library/dist/select";
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Or import all MICL styles:
|
|
33
|
+
```CSS
|
|
34
|
+
@use "material-inspired-component-library/styles";
|
|
35
|
+
```
|
|
36
|
+
|
|
32
37
|
### JavaScript
|
|
33
38
|
This component requires JavaScript for functionality:
|
|
34
39
|
|
|
@@ -42,7 +47,7 @@ This will initialize any Select component, including those that will be added to
|
|
|
42
47
|
A live example of the [Select component](https://henkpb.github.io/micl/select.html) is available to interact with.
|
|
43
48
|
|
|
44
49
|
## Variants
|
|
45
|
-
A Select
|
|
50
|
+
A Select component can be disabled by adding the `disabled` attribute to the `<select>` element. An option within the component can be disabled by adding the `disabled` attribute to the `<option>` element.
|
|
46
51
|
|
|
47
52
|
You can add [Dividers](../divider/README.md) into the list of options and they will appear as separators to help visually break up the options.
|
|
48
53
|
|
|
@@ -52,7 +57,7 @@ You can add [Dividers](../divider/README.md) into the list of options and they w
|
|
|
52
57
|
<div class="micl-textfield-outlined">
|
|
53
58
|
<label for="myselect">Country</label>
|
|
54
59
|
<select id="myselect">
|
|
55
|
-
<option class="micl-list-item-two" value=""></option>
|
|
60
|
+
<option class="micl-list-item-two" value="" label="(none)"></option>
|
|
56
61
|
<option class="micl-list-item-two" value="AR">
|
|
57
62
|
<span class="micl-list-item__text">Argentina</span>
|
|
58
63
|
</option>
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
min-inline-size: max(anchor-size(self-inline), 112px);
|
|
57
57
|
max-inline-size: 280px;
|
|
58
58
|
position-try: most-block-size flip-block;
|
|
59
|
-
padding: 8px 0;
|
|
59
|
+
padding: var(--md-sys-list-padding, 8px) 0;
|
|
60
60
|
border: none;
|
|
61
|
-
border-radius: var(--md-sys-shape-corner-extra-small);
|
|
61
|
+
border-radius: var(--md-sys-shape-corner-extra-small, 4px);
|
|
62
62
|
background-color: var(--md-sys-color-surface-container);
|
|
63
63
|
box-shadow: var(--md-sys-elevation-level2);
|
|
64
64
|
opacity: 0;
|
|
@@ -94,7 +94,6 @@
|
|
|
94
94
|
--md-sys-list-item-one-padding: 0;
|
|
95
95
|
--md-sys-list-item-two-padding: 0;
|
|
96
96
|
--md-sys-list-item-space: 12px;
|
|
97
|
-
--md-sys-list-item-padding-inline: 16px;
|
|
98
97
|
--md-sys-list-item-container-color: var(--md-sys-color-surface-container);
|
|
99
98
|
|
|
100
99
|
line-height: normal;
|
|
@@ -43,7 +43,7 @@ A live example of the [Side sheet component](https://henkpb.github.io/micl/sides
|
|
|
43
43
|
## Variants
|
|
44
44
|
A **modal** side sheet blocks access to the rest of the page and must be dismissed explicitly by the user. This is suitable for critical tasks or information that requires a user's full attention.
|
|
45
45
|
|
|
46
|
-
To create a modal side sheet, use the `<dialog>` element without the `popover` attribute. Use `closedby="closerequest"` to prevent the side sheet from being dismissed by clicking outside of it. You'll also need a button or other control with popovertarget to close it.
|
|
46
|
+
To create a modal side sheet, use the `<dialog>` element without the `popover` attribute. Use `closedby="closerequest"` to prevent the side sheet from being dismissed by clicking outside of it. You'll also need a button or other control with `popovertarget` to close it.
|
|
47
47
|
|
|
48
48
|
```HTML
|
|
49
49
|
<dialog id="mysidesheet" class="micl-sidesheet" closedby="closerequest" aria-labelledby="mytitle">
|
|
@@ -62,39 +62,33 @@ To create a modal side sheet, use the `<dialog>` element without the `popover` a
|
|
|
62
62
|
<div class="micl-sidesheet__content">
|
|
63
63
|
...your content...
|
|
64
64
|
</div>
|
|
65
|
+
<hr class="micl-divider">
|
|
65
66
|
<div class="micl-sidesheet__actions">
|
|
66
67
|
<button type="button" class="micl-button-filled-s">Save</button>
|
|
67
68
|
</div>
|
|
68
69
|
</dialog>
|
|
69
70
|
```
|
|
70
71
|
|
|
71
|
-
To open
|
|
72
|
+
To open a standard or modal side sheet, link a button to the side sheet's ID using the `popovertarget` attribute:
|
|
72
73
|
```HTML
|
|
73
74
|
<button type="button" popovertarget="mysidesheet">Open Side Sheet</button>
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
The back-button and the actions-container are optional. To remove the vertical divider of the
|
|
77
|
+
The back-button and the actions-container are optional. To remove the vertical divider of the standard side sheet, assign zero to the following CSS variable:
|
|
77
78
|
```CSS
|
|
78
79
|
#mysidesheet {
|
|
79
80
|
--md-sys-divider-thickness: 0;
|
|
80
81
|
}
|
|
81
82
|
```
|
|
82
|
-
To remove the horizontal divider of the actions-container:
|
|
83
|
-
```CSS
|
|
84
|
-
#mysidesheet .micl-sidesheet__actions {
|
|
85
|
-
--md-sys-divider-thickness: 0;
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
83
|
|
|
89
|
-
|
|
90
|
-
The **standard** side sheet component adds CSS rules to the `<body>` element to properly resize the main content area when the side sheet is open. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```
|
|
84
|
+
> [!WARNING]
|
|
85
|
+
> The **standard** side sheet component adds CSS rules to the `<body>` element to properly resize the main content area when the side sheet is open. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
|
|
86
|
+
> ```CSS
|
|
87
|
+
> box-sizing: border-box;
|
|
88
|
+
> margin: 0;
|
|
89
|
+
> max-inline-size: ...varies depending on if the side sheet is opened...
|
|
90
|
+
> transition: ...transition on max-inline-size...
|
|
91
|
+
> ```
|
|
98
92
|
|
|
99
93
|
## Customizations
|
|
100
94
|
You can customize the appearance of the Side sheet component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child side sheets.
|
|
@@ -102,7 +96,7 @@ You can customize the appearance of the Side sheet component by overriding its g
|
|
|
102
96
|
| Variable name | Default Value | Description |
|
|
103
97
|
| ------------- | ------------- | ----------- |
|
|
104
98
|
| --md-sys-sidesheet-width | 256px | The default (and minimum allowed) width of the side sheet |
|
|
105
|
-
| --md-sys-sidesheet-maxwidth | 400px | The largest allowed width of
|
|
99
|
+
| --md-sys-sidesheet-maxwidth | 400px | The largest allowed width of the side sheet |
|
|
106
100
|
| --md-sys-sidesheet-padding-standard | 24px | The amount of space between the vertical edges and the content |
|
|
107
101
|
|
|
108
102
|
**Example: Changing the width of the sidesheet**
|
|
@@ -27,14 +27,17 @@
|
|
|
27
27
|
:root {
|
|
28
28
|
--md-sys-sidesheet-width: 256px;
|
|
29
29
|
--md-sys-sidesheet-maxwidth: 400px;
|
|
30
|
-
--md-sys-sidesheet-
|
|
31
|
-
|
|
30
|
+
--md-sys-sidesheet-padding-standard: var(--md-sys-layout-window-margin, 24px);
|
|
31
|
+
}
|
|
32
|
+
body {
|
|
32
33
|
--md-sys-sidesheet-motion-spatial: #{motion.$md-sys-motion-expressive-slow-spatial};
|
|
33
34
|
--md-sys-sidesheet-motion-duration: #{motion.$md-sys-motion-expressive-slow-spatial-duration};
|
|
34
35
|
--md-sys-sidesheet-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
dialog.micl-sidesheet {
|
|
39
|
+
--md-sys-sidesheet-spring-buffer: 40px;
|
|
40
|
+
|
|
38
41
|
box-sizing: border-box;
|
|
39
42
|
display: none;
|
|
40
43
|
flex-direction: column;
|
|
@@ -47,7 +50,7 @@ dialog.micl-sidesheet {
|
|
|
47
50
|
margin-block: 0;
|
|
48
51
|
margin-inline-start: auto;
|
|
49
52
|
margin-inline-end: calc(-1 * (var(--md-sys-sidesheet-maxwidth) + var(--md-sys-sidesheet-spring-buffer)));
|
|
50
|
-
padding-block:
|
|
53
|
+
padding-block: var(--md-sys-sidesheet-padding-standard) 0;
|
|
51
54
|
padding-inline: 0 var(--md-sys-sidesheet-spring-buffer);
|
|
52
55
|
background-color: var(--md-sys-color-surface);
|
|
53
56
|
border: none;
|
|
@@ -64,7 +67,9 @@ dialog.micl-sidesheet {
|
|
|
64
67
|
.micl-sidesheet__headline {
|
|
65
68
|
display: flex;
|
|
66
69
|
align-items: center;
|
|
70
|
+
block-size: var(--md-sys-typescale-title-large-line-height);
|
|
67
71
|
padding-inline: var(--md-sys-sidesheet-padding-standard);
|
|
72
|
+
margin-block-end: 16px;
|
|
68
73
|
column-gap: 12px;
|
|
69
74
|
color: var(--md-sys-color-on-surface-variant);
|
|
70
75
|
|
|
@@ -82,14 +87,12 @@ dialog.micl-sidesheet {
|
|
|
82
87
|
margin-inline: -12px;
|
|
83
88
|
}
|
|
84
89
|
button:first-child {
|
|
85
|
-
margin-inline-start: -
|
|
90
|
+
margin-inline-start: -16px;
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
93
|
.micl-sidesheet__content {
|
|
89
94
|
box-sizing: border-box;
|
|
90
95
|
flex: 1 1 auto;
|
|
91
|
-
inline-size: 100%;
|
|
92
|
-
max-inline-size: 100%;
|
|
93
96
|
padding-inline: var(--md-sys-sidesheet-padding-standard);
|
|
94
97
|
overflow: hidden auto;
|
|
95
98
|
}
|
|
@@ -99,12 +102,10 @@ dialog.micl-sidesheet {
|
|
|
99
102
|
flex-shrink: 0;
|
|
100
103
|
align-items: center;
|
|
101
104
|
justify-content: start;
|
|
102
|
-
|
|
103
|
-
max-inline-size: 100%;
|
|
104
|
-
padding-block: 16px 24px;
|
|
105
|
+
padding-block: 16px var(--md-sys-sidesheet-padding-standard);
|
|
105
106
|
padding-inline: var(--md-sys-sidesheet-padding-standard);
|
|
107
|
+
column-gap: 8px;
|
|
106
108
|
overflow: hidden;
|
|
107
|
-
border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
&[open] {
|
|
@@ -114,9 +115,9 @@ dialog.micl-sidesheet {
|
|
|
114
115
|
box-shadow: var(--md-sys-elevation-level1);
|
|
115
116
|
}
|
|
116
117
|
&:popover-open {
|
|
117
|
-
--md-sys-divider-color: var(--md-sys-color-outline);
|
|
118
|
+
--md-sys-divider-color: var(--md-sys-color-outline, gray);
|
|
118
119
|
|
|
119
|
-
border-inline-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
|
|
120
|
+
border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
|
|
120
121
|
}
|
|
121
122
|
&:popover-open,
|
|
122
123
|
&[open] {
|
|
@@ -136,13 +137,11 @@ dialog.micl-sidesheet {
|
|
|
136
137
|
}
|
|
137
138
|
&::backdrop {
|
|
138
139
|
background-color: rgba(0, 0, 0, 0);
|
|
139
|
-
transition:
|
|
140
|
-
background-color var(--md-sys-sidesheet-motion-duration) linear,
|
|
141
|
-
overlay var(--md-sys-sidesheet-motion-duration) linear allow-discrete,
|
|
142
|
-
display var(--md-sys-sidesheet-motion-duration) linear allow-discrete;
|
|
140
|
+
transition: background-color var(--md-sys-sidesheet-motion-duration-reverse) linear;
|
|
143
141
|
}
|
|
144
142
|
&[open]::backdrop {
|
|
145
143
|
background-color: rgba(0, 0, 0, 0.2);
|
|
144
|
+
transition: background-color var(--md-sys-sidesheet-motion-duration) linear;
|
|
146
145
|
|
|
147
146
|
@starting-style {
|
|
148
147
|
background-color: rgba(0, 0, 0, 0);
|
|
@@ -70,6 +70,32 @@ export default (() =>
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
if (input.matches('input[type=time][data-timepicker]')) {
|
|
74
|
+
const timePicker = !input.dataset.timepicker ? null :
|
|
75
|
+
document.getElementById(input.dataset.timepicker);
|
|
76
|
+
if (timePicker instanceof HTMLDialogElement) {
|
|
77
|
+
input.addEventListener('click', (event: Event) =>
|
|
78
|
+
{
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
timePicker.showModal();
|
|
81
|
+
});
|
|
82
|
+
input.addEventListener('keydown', (event: Event) =>
|
|
83
|
+
{
|
|
84
|
+
if (!(event instanceof KeyboardEvent)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
switch (event.key) {
|
|
88
|
+
case 'Enter':
|
|
89
|
+
case ' ':
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
timePicker.showModal();
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
73
99
|
setCounter(input);
|
|
74
100
|
},
|
|
75
101
|
|