material-inspired-component-library 2.0.0 → 3.0.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.
Files changed (71) hide show
  1. package/CODE_OF_CONDUCT.md +128 -0
  2. package/README.md +14 -0
  3. package/components/README.md +2 -0
  4. package/components/appbar/README.md +94 -0
  5. package/components/appbar/index.scss +216 -0
  6. package/components/badge/README.md +5 -5
  7. package/components/badge/index.scss +20 -27
  8. package/components/bottomsheet/README.md +29 -17
  9. package/components/bottomsheet/index.scss +23 -23
  10. package/components/bottomsheet/index.ts +25 -24
  11. package/components/button/README.md +1 -1
  12. package/components/button/index.scss +70 -65
  13. package/components/button/index.ts +1 -1
  14. package/components/card/index.scss +1 -1
  15. package/components/checkbox/index.scss +4 -0
  16. package/components/dialog/README.md +9 -9
  17. package/components/iconbutton/index.scss +111 -111
  18. package/components/iconbutton/index.ts +1 -1
  19. package/components/navigationrail/README.md +16 -16
  20. package/components/navigationrail/index.scss +20 -12
  21. package/components/radio/index.scss +1 -1
  22. package/components/sidesheet/README.md +32 -17
  23. package/components/sidesheet/index.scss +43 -47
  24. package/components/slider/README.md +5 -5
  25. package/dist/appbar.css +1 -0
  26. package/dist/appbar.js +1 -0
  27. package/dist/badge.css +1 -1
  28. package/dist/bottomsheet.css +1 -1
  29. package/dist/button.css +1 -1
  30. package/dist/card.css +1 -1
  31. package/dist/checkbox.css +1 -1
  32. package/dist/dialog.css +1 -1
  33. package/dist/iconbutton.css +1 -1
  34. package/dist/list.css +1 -1
  35. package/dist/micl.css +1 -1
  36. package/dist/micl.js +1 -1
  37. package/dist/navigationrail.css +1 -1
  38. package/dist/radio.css +1 -1
  39. package/dist/select.css +1 -1
  40. package/dist/sidesheet.css +1 -1
  41. package/dist/slider.css +1 -1
  42. package/dist/switch.css +1 -1
  43. package/dist/textfield.css +1 -1
  44. package/docs/accordion.html +298 -254
  45. package/docs/bottomsheet.html +194 -114
  46. package/docs/button.html +210 -182
  47. package/docs/card.html +107 -72
  48. package/docs/checkbox.html +92 -65
  49. package/docs/dialog.html +154 -123
  50. package/docs/divider.html +96 -67
  51. package/docs/docs.css +14 -24
  52. package/docs/docs.js +4 -2
  53. package/docs/iconbutton.html +196 -171
  54. package/docs/index.html +298 -288
  55. package/docs/list.html +260 -216
  56. package/docs/menu.html +260 -220
  57. package/docs/micl.css +1 -1
  58. package/docs/micl.js +1 -1
  59. package/docs/navigationrail.html +38 -36
  60. package/docs/radio.html +93 -68
  61. package/docs/select.html +213 -173
  62. package/docs/sidesheet.html +105 -73
  63. package/docs/slider.html +105 -72
  64. package/docs/switch.html +126 -101
  65. package/docs/textfield.html +181 -138
  66. package/layout/README.md +122 -0
  67. package/layout/index.scss +258 -0
  68. package/package.json +1 -1
  69. package/styles/statelayer.scss +2 -0
  70. package/styles.scss +13 -0
  71. package/styles/layout.scss +0 -74
@@ -25,8 +25,11 @@
25
25
  @use '../../styles/statelayer';
26
26
 
27
27
  button.micl-iconbutton-standard-xs,
28
+ a.micl-iconbutton-standard-xs,
28
29
  button.micl-iconbutton-standard-s,
30
+ a.micl-iconbutton-standard-s,
29
31
  button.micl-iconbutton-standard-m,
32
+ a.micl-iconbutton-standard-m,
30
33
  button.micl-iconbutton-standard-l,
31
34
  button.micl-iconbutton-standard-xl,
32
35
  button.micl-iconbutton-filled-xs,
@@ -90,134 +93,127 @@ button.micl-iconbutton-outlined-xl {
90
93
  }
91
94
 
92
95
  button.micl-iconbutton-standard-xs,
96
+ a.micl-iconbutton-standard-xs,
93
97
  button.micl-iconbutton-filled-xs,
94
98
  button.micl-iconbutton-tonal-xs,
95
99
  button.micl-iconbutton-outlined-xs {
96
- width: var(--md-sys-target-size);
97
- min-width: var(--md-sys-target-size);
98
- height: var(--md-sys-target-size);
100
+ --micl-width: 32px;
101
+ --micl-height: 32px;
102
+
103
+ position: relative;
104
+ inline-size: var(--micl-width);
105
+ min-inline-size: var(--micl-width);
106
+ block-size: var(--micl-height);
99
107
  font-size: 20px;
100
- border: 8px solid transparent;
101
- background-clip: content-box;
102
108
 
103
- &.micl-button--toggle.micl-button--selected {
104
- // border-radius: var(--md-sys-shape-corner-medium);
105
- border-radius: var(--md-sys-shape-corner-large);
109
+ &::before {
110
+ content: "";
111
+ position: absolute;
112
+ block-size: var(--md-sys-target-size);
113
+ inline-size: var(--md-sys-target-size);
114
+ inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
115
+ background-color: transparent;
106
116
  }
107
- &:not(:disabled) {
108
- &:active {
109
- // border-radius: var(--md-sys-shape-corner-small);
110
- border-radius: var(--md-sys-shape-corner-medium);
111
- }
112
- &:focus-visible {
113
- outline-offset: -6px;
114
- }
117
+ &.micl-button--toggle.micl-button--selected {
118
+ border-radius: var(--md-sys-shape-corner-medium);
115
119
  }
116
120
  &.micl-iconbutton--narrow {
117
- height: calc(var(--md-sys-target-size) + 10px);
118
- border-width: 10px;
119
- border-radius: calc(var(--md-sys-target-size) / 2);
120
-
121
- &:focus-visible {
122
- outline-offset: -8px;
123
- }
121
+ --micl-width: 28px;
122
+ border-radius: calc(var(--micl-width) / 2);
124
123
  }
125
124
  &.micl-iconbutton--wide {
126
- width: calc(var(--md-sys-target-size) + 8px);
127
- border-radius: calc(var(--md-sys-target-size) / 2);
128
-
129
- &:focus-visible {
130
- outline-offset: -6px;
131
- }
125
+ --micl-width: 40px;
126
+ border-radius: calc(var(--micl-width) / 2);
132
127
  }
133
128
  &.micl-button--square {
134
- // border-radius: var(--md-sys-shape-corner-medium);
135
- border-radius: var(--md-sys-shape-corner-large);
129
+ border-radius: var(--md-sys-shape-corner-medium);
136
130
 
137
131
  &.micl-button--toggle.micl-button--selected {
138
132
  border-radius: var(--md-sys-shape-corner-full);
139
133
  }
140
134
  }
135
+ &:not(:disabled) {
136
+ &:active {
137
+ border-radius: var(--md-sys-shape-corner-small);
138
+ }
139
+ }
141
140
  }
142
141
 
143
142
  button.micl-iconbutton-standard-s,
143
+ a.micl-iconbutton-standard-s,
144
144
  button.micl-iconbutton-filled-s,
145
145
  button.micl-iconbutton-tonal-s,
146
146
  button.micl-iconbutton-outlined-s {
147
- width: var(--md-sys-target-size);
148
- min-width: var(--md-sys-target-size);
149
- height: var(--md-sys-target-size);
147
+ --micl-width: 40px;
148
+ --micl-height: 40px;
149
+
150
+ position: relative;
151
+ inline-size: var(--micl-width);
152
+ min-inline-size: var(--micl-width);
153
+ block-size: var(--micl-height);
150
154
  font-size: 24px;
151
- border: 4px solid transparent;
152
- background-clip: content-box;
153
155
 
154
- &.micl-button--toggle.micl-button--selected {
155
- // border-radius: var(--md-sys-shape-corner-medium);
156
- border-radius: var(--md-sys-shape-corner-large);
156
+ &::before {
157
+ content: "";
158
+ position: absolute;
159
+ block-size: var(--md-sys-target-size);
160
+ inline-size: var(--md-sys-target-size);
161
+ inset: calc((var(--micl-height) - var(--md-sys-target-size)) / 2) 0 0 calc((var(--micl-width) - var(--md-sys-target-size)) / 2);
162
+ background-color: transparent;
157
163
  }
158
- &:not(:disabled) {
159
- &:active {
160
- // border-radius: var(--md-sys-shape-corner-small);
161
- border-radius: var(--md-sys-shape-corner-medium);
162
- }
163
- &:focus-visible {
164
- outline-offset: -2px;
165
- }
164
+ &.micl-button--toggle.micl-button--selected {
165
+ border-radius: var(--md-sys-shape-corner-medium);
166
166
  }
167
167
  &.micl-iconbutton--narrow {
168
- height: calc(var(--md-sys-target-size) + 8px);
169
- border-width: 8px;
170
- border-radius: calc(var(--md-sys-target-size) / 2);
171
-
172
- &:focus-visible {
173
- outline-offset: -6px;
174
- }
168
+ --micl-width: 32px;
169
+ border-radius: calc(var(--micl-width) / 2);
175
170
  }
176
171
  &.micl-iconbutton--wide {
177
- width: calc(var(--md-sys-target-size) + 12px);
178
- border-radius: 26px;
172
+ --micl-width: 52px;
173
+ border-radius: calc(var(--micl-width) / 2);
179
174
 
180
- &:focus-visible {
181
- outline-offset: -2px;
175
+ &::before {
176
+ inline-size: var(--micl-width);
177
+ inset: calc((40px - var(--md-sys-target-size)) / 2) 0 0 0;
182
178
  }
183
179
  }
184
180
  &.micl-button--square {
185
- // border-radius: var(--md-sys-shape-corner-medium);
186
- border-radius: var(--md-sys-shape-corner-large);
181
+ border-radius: var(--md-sys-shape-corner-medium);
187
182
 
188
183
  &.micl-button--toggle.micl-button--selected {
189
184
  border-radius: var(--md-sys-shape-corner-full);
190
185
  }
191
186
  }
187
+ &:not(:disabled) {
188
+ &:active {
189
+ border-radius: var(--md-sys-shape-corner-small);
190
+ }
191
+ }
192
192
  }
193
193
 
194
194
  button.micl-iconbutton-standard-m,
195
+ a.micl-iconbutton-standard-m,
195
196
  button.micl-iconbutton-filled-m,
196
197
  button.micl-iconbutton-tonal-m,
197
198
  button.micl-iconbutton-outlined-m {
198
- width: 56px;
199
- min-width: 56px;
200
- height: 56px;
199
+ --micl-width: 56px;
200
+ --micl-height: 56px;
201
+
202
+ inline-size: var(--micl-width);
203
+ min-inline-size: var(--micl-width);
204
+ block-size: var(--micl-height);
201
205
  font-size: 24px;
202
206
 
203
207
  &.micl-button--toggle.micl-button--selected {
204
208
  border-radius: var(--md-sys-shape-corner-large);
205
209
  }
206
- &:not(:disabled) {
207
- &:active {
208
- // border-radius: var(--md-sys-shape-corner-small);
209
- border-radius: var(--md-sys-shape-corner-medium);
210
- }
211
- }
212
210
  &.micl-iconbutton--narrow {
213
- width: var(--md-sys-target-size);
214
- min-width: var(--md-sys-target-size);
215
- border-radius: calc(var(--md-sys-target-size) / 2);
211
+ --micl-width: 48px;
212
+ border-radius: calc(var(--micl-width) / 2);
216
213
  }
217
214
  &.micl-iconbutton--wide {
218
- width: 72px;
219
- min-width: 72px;
220
- border-radius: 36px;
215
+ --micl-width: 72px;
216
+ border-radius: calc(var(--micl-width) / 2);
221
217
  }
222
218
  &.micl-button--square {
223
219
  border-radius: var(--md-sys-shape-corner-large);
@@ -226,34 +222,35 @@ button.micl-iconbutton-outlined-m {
226
222
  border-radius: var(--md-sys-shape-corner-full);
227
223
  }
228
224
  }
225
+ &:not(:disabled) {
226
+ &:active {
227
+ border-radius: var(--md-sys-shape-corner-small);
228
+ }
229
+ }
229
230
  }
230
231
 
231
232
  button.micl-iconbutton-standard-l,
232
233
  button.micl-iconbutton-filled-l,
233
234
  button.micl-iconbutton-tonal-l,
234
235
  button.micl-iconbutton-outlined-l {
235
- width: 96px;
236
- min-width: 96px;
237
- height: 96px;
236
+ --micl-width: 96px;
237
+ --micl-height: 96px;
238
+
239
+ inline-size: var(--micl-width);
240
+ min-inline-size: var(--micl-width);
241
+ block-size: var(--micl-height);
238
242
  font-size: 32px;
239
243
 
240
244
  &.micl-button--toggle.micl-button--selected {
241
245
  border-radius: var(--md-sys-shape-corner-extra-large);
242
246
  }
243
- &:not(:disabled) {
244
- &:active {
245
- border-radius: var(--md-sys-shape-corner-large);
246
- }
247
- }
248
247
  &.micl-iconbutton--narrow {
249
- width: 64px;
250
- min-width: 64px;
251
- border-radius: 32px;
248
+ --micl-width: 64px;
249
+ border-radius: calc(var(--micl-width) / 2);
252
250
  }
253
251
  &.micl-iconbutton--wide {
254
- width: 128px;
255
- min-width: 128px;
256
- border-radius: 64px;
252
+ --micl-width: 128px;
253
+ border-radius: calc(var(--micl-width) / 2);
257
254
  }
258
255
  &.micl-button--square {
259
256
  border-radius: var(--md-sys-shape-corner-extra-large);
@@ -262,34 +259,35 @@ button.micl-iconbutton-outlined-l {
262
259
  border-radius: var(--md-sys-shape-corner-full);
263
260
  }
264
261
  }
262
+ &:not(:disabled) {
263
+ &:active {
264
+ border-radius: var(--md-sys-shape-corner-large);
265
+ }
266
+ }
265
267
  }
266
268
 
267
269
  button.micl-iconbutton-standard-xl,
268
270
  button.micl-iconbutton-filled-xl,
269
271
  button.micl-iconbutton-tonal-xl,
270
272
  button.micl-iconbutton-outlined-xl {
271
- width: 136px;
272
- min-width: 136px;
273
- height: 136px;
273
+ --micl-width: 136px;
274
+ --micl-height: 136px;
275
+
276
+ inline-size: var(--micl-width);
277
+ min-inline-size: var(--micl-width);
278
+ block-size: var(--micl-height);
274
279
  font-size: 40px;
275
280
 
276
281
  &.micl-button--toggle.micl-button--selected {
277
282
  border-radius: var(--md-sys-shape-corner-extra-large);
278
283
  }
279
- &:not(:disabled) {
280
- &:active {
281
- border-radius: var(--md-sys-shape-corner-large);
282
- }
283
- }
284
284
  &.micl-iconbutton--narrow {
285
- width: 104px;
286
- min-width: 104px;
287
- border-radius: 52px;
285
+ --micl-width: 104px;
286
+ border-radius: calc(var(--micl-width) / 2);
288
287
  }
289
288
  &.micl-iconbutton--wide {
290
- width: 184px;
291
- min-width: 184px;
292
- border-radius: 92px;
289
+ --micl-width: 184px;
290
+ border-radius: calc(var(--micl-width) / 2);
293
291
  }
294
292
  &.micl-button--square {
295
293
  border-radius: var(--md-sys-shape-corner-extra-large);
@@ -298,11 +296,19 @@ button.micl-iconbutton-outlined-xl {
298
296
  border-radius: var(--md-sys-shape-corner-full);
299
297
  }
300
298
  }
299
+ &:not(:disabled) {
300
+ &:active {
301
+ border-radius: var(--md-sys-shape-corner-large);
302
+ }
303
+ }
301
304
  }
302
305
 
303
306
  button.micl-iconbutton-standard-xs,
307
+ a.micl-iconbutton-standard-xs,
304
308
  button.micl-iconbutton-standard-s,
309
+ a.micl-iconbutton-standard-s,
305
310
  button.micl-iconbutton-standard-m,
311
+ a.micl-iconbutton-standard-m,
306
312
  button.micl-iconbutton-standard-l,
307
313
  button.micl-iconbutton-standard-xl {
308
314
  --statelayer-color: var(--md-sys-color-on-surface-variant);
@@ -395,15 +401,9 @@ button.micl-iconbutton-outlined-xl {
395
401
  color: var(--md-sys-color-on-surface-variant);
396
402
 
397
403
  &.micl-iconbutton-outlined-xs,
398
- &.micl-iconbutton-outlined-s {
399
- // border-color: var(--md-sys-color-outline);
400
- box-shadow: inset 1px 0px var(--md-sys-color-outline-variant),
401
- inset -1px 0px var(--md-sys-color-outline-variant),
402
- inset 0px -1px var(--md-sys-color-outline-variant),
403
- inset 0px 1px var(--md-sys-color-outline-variant);
404
- }
404
+ &.micl-iconbutton-outlined-s,
405
405
  &.micl-iconbutton-outlined-m {
406
- // border: 1px solid var(--md-sys-color-outline);
406
+ // border-color: var(--md-sys-color-outline);
407
407
  border: 1px solid var(--md-sys-color-outline-variant);
408
408
  }
409
409
  &.micl-iconbutton-outlined-l {
@@ -40,7 +40,7 @@ export default (() =>
40
40
  event.target.classList.add('micl-button--toggled');
41
41
  event.target.classList.toggle('micl-button--selected');
42
42
  if (!!event.target.dataset.miclalt) {
43
- [event.target.textContent, event.target.dataset.miclalt] =
43
+ [event.target.textContent, event.target.dataset.miclalt] =
44
44
  [event.target.dataset.miclalt, event.target.textContent];
45
45
  }
46
46
  }
@@ -4,10 +4,10 @@ This component implements the the [Material Design 3 Expressive Navigation rail]
4
4
  ## Basic Usage
5
5
 
6
6
  ### HTML
7
- To create a simple navigation rail, use a `<div>` element with the `micl-navigationrail` class. Inside, use an `input type="radio"` group to create the selectable navigation items. The `input` elements must share the same `name` attribute to ensure that only one item can be selected at a time. The `label` elements are associated with their respective inputs using the `for` attribute.
7
+ To create a simple navigation rail, use a `<nav>` element with the `micl-navigationrail` class. Inside, use an `input type="radio"` group to create the selectable navigation items. The `input` elements must share the same `name` attribute to ensure that only one item can be selected at a time. The `label` elements are associated with their respective inputs using the `for` attribute.
8
8
 
9
9
  ```HTML
10
- <div id="mynavigationrail" class="micl-navigationrail">
10
+ <nav id="mynavigationrail" class="micl-navigationrail">
11
11
  <div class="micl-navigationrail__content">
12
12
  <input type="radio" id="item1" name="navitem" value="email_inbox" checked>
13
13
  <label for="item1" class="micl-navigationrail__item" tabindex="0">
@@ -20,7 +20,7 @@ To create a simple navigation rail, use a `<div>` element with the `micl-navigat
20
20
  <span class="micl-navigationrail__text">Outbox</span>
21
21
  </label>
22
22
  </div>
23
- </div>
23
+ </nav>
24
24
  ```
25
25
 
26
26
  ### CSS
@@ -44,7 +44,7 @@ A live example of the [Navigation rail component](https://henkpb.github.io/micl/
44
44
  The basic example creates a **collapsed** navigation rail. Add a menu button to allow the user to toggle between a **collapsed** and an **expanded** view.
45
45
 
46
46
  ```HTML
47
- <div id="mynavigationrail" class="micl-navigationrail">
47
+ <nav id="mynavigationrail" class="micl-navigationrail">
48
48
  <div class="micl-navigationrail__headline">
49
49
  <button
50
50
  type="button"
@@ -56,7 +56,7 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
56
56
  <div class="micl-navigationrail__content">
57
57
  ...
58
58
  </div>
59
- </div>
59
+ </nav>
60
60
  ```
61
61
 
62
62
  When the user clicks the menu button, the navigation rail is expanded and the toggle button is given the `micl-button--selected` class and the `micl-button--toggled` class that indicates that the toggle button has been clicked at least once.
@@ -66,7 +66,7 @@ When the user clicks the menu button, the navigation rail is expanded and the to
66
66
  Add the `popover` attribute to the navigation rail, and the `popovertarget` attribute to the menu button. The value of the `popovertarget` attribute must be the `id` of the navigation rail.
67
67
 
68
68
  ```HTML
69
- <div id="mynavigationrail" class="micl-navigationrail" popover="manual">
69
+ <nav id="mynavigationrail" class="micl-navigationrail" popover="manual">
70
70
  <div class="micl-navigationrail__headline">
71
71
  <button
72
72
  type="button"
@@ -79,19 +79,19 @@ Add the `popover` attribute to the navigation rail, and the `popovertarget` attr
79
79
  <div class="micl-navigationrail__content">
80
80
  ...
81
81
  </div>
82
- </div>
82
+ </nav>
83
83
  ```
84
84
 
85
- [!WARNING]
86
- The **popover** navigation rail component adds CSS rules to the `<body>` element to properly resize the main content area when the navigation rail is collapsed. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
87
-
88
- ```CSS
89
- margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
90
- ```
85
+ > [!WARNING]
86
+ > The **popover** navigation rail component adds CSS rules to the element with the `.micl-window` class to properly resize the main content area when the navigation rail is collapsed. Overriding these rules may cause the component to behave unexpectedly. The rules that are applied are:
87
+ >
88
+ > ```CSS
89
+ > margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
90
+ > ```
91
91
 
92
92
  ### Modal navigation rail
93
93
 
94
- A **modal** navigation rail is hidden until the user clicks a menu button. When shown, the **expanded** navigation rail is displayed on top of other page content. Use a `<dialog>` element instead of a `<div>`.
94
+ A **modal** navigation rail is hidden until the user clicks a menu button. When shown, the **expanded** navigation rail is displayed on top of other page content. Use a `<dialog>` element instead of a `<nav>`.
95
95
 
96
96
  ```HTML
97
97
  <dialog id="mynavigationrail" class="micl-navigationrail" closedby="closerequest">
@@ -132,9 +132,9 @@ You can customize the appearance of the Navigation rail component by overriding
132
132
 
133
133
  ```HTML
134
134
  <div style="--md-sys-navigationrail-collapsed-width:80px">
135
- <div id="mynavigationrail" class="micl-navigationrail">
135
+ <nav id="mynavigationrail" class="micl-navigationrail">
136
136
  ...
137
- </div>
137
+ </nav>
138
138
  </div>
139
139
  ```
140
140
 
@@ -53,7 +53,7 @@
53
53
  block-size: 100vh;
54
54
  min-block-size: 100%;
55
55
  margin-block: 0;
56
- margin-inline: 0 auto;
56
+ margin-inline: calc(-1 * var(--md-sys-layout-window-margin, 0px)) auto;
57
57
  padding-block: var(--md-sys-navigationrail-top-space) 0;
58
58
  padding-inline: 0;
59
59
  background-color: var(--md-sys-color-surface);
@@ -61,6 +61,7 @@
61
61
  box-shadow: var(--md-sys-elevation-level0);
62
62
  opacity: 100%;
63
63
  overflow: hidden;
64
+ z-index: 9;
64
65
  interpolate-size: allow-keywords;
65
66
 
66
67
  &> .micl-navigationrail__headline {
@@ -74,7 +75,7 @@
74
75
  align-items: flex-start;
75
76
  row-gap: var(--md-sys-navigationrail-item-space);
76
77
  inline-size: 100%;
77
- padding-block: var(--md-sys-navigationrail-header-space) 0;
78
+ padding-block: var(--md-sys-navigationrail-header-space) 16px;
78
79
  padding-inline: 20px 0;
79
80
  overflow: hidden auto;
80
81
  transition: row-gap var(--md-sys-navigationrail-morph-duration-reverse) linear;
@@ -158,13 +159,13 @@
158
159
  --statelayer-opacity var(--md-sys-navigationrail-motion-duration) linear;
159
160
  }
160
161
  &> .micl-navigationrail__text {
161
- color: var(--md-sys-color-secondary);
162
+ color: var(--md-sys-color-on-secondary-container);
162
163
  }
163
164
  }
164
165
  }
165
166
  }
166
167
  dialog.micl-navigationrail,
167
- div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
168
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
168
169
  max-inline-size: var(--md-sys-navigationrail-expanded-maxwidth);
169
170
  min-inline-size: var(--md-sys-navigationrail-expanded-minwidth);
170
171
 
@@ -210,7 +211,7 @@ div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
210
211
  }
211
212
  }
212
213
  }
213
- div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
214
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
214
215
  &> .micl-navigationrail__content {
215
216
  transition: row-gap var(--md-sys-navigationrail-morph-duration) linear;
216
217
 
@@ -232,7 +233,7 @@ div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
232
233
  }
233
234
  }
234
235
  }
235
- div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled.micl-button--selected) {
236
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled.micl-button--selected) {
236
237
  animation: var(--md-sys-navigationrail-morph-duration) linear forwards navigationrail-to-expanded;
237
238
 
238
239
  &> .micl-navigationrail__content > label.micl-navigationrail__item {
@@ -243,7 +244,7 @@ div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
243
244
  }
244
245
  }
245
246
  }
246
- div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled:not(.micl-button--selected)) {
247
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled:not(.micl-button--selected)) {
247
248
  animation: var(--md-sys-navigationrail-morph-duration-reverse) linear forwards navigationrail-to-collapsed;
248
249
 
249
250
  &> .micl-navigationrail__content {
@@ -265,7 +266,7 @@ div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
265
266
  }
266
267
  }
267
268
  }
268
- div.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle:not(.micl-button--selected)) {
269
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle:not(.micl-button--selected)) {
269
270
  &> .micl-navigationrail__content > label.micl-navigationrail__item {
270
271
  &:hover {
271
272
  &> .micl-navigationrail__icon {
@@ -316,7 +317,7 @@ dialog.micl-navigationrail {
316
317
  }
317
318
  }
318
319
  }
319
- div.micl-navigationrail {
320
+ nav.micl-navigationrail {
320
321
  position: sticky;
321
322
  float: inline-start;
322
323
  inset: unset;
@@ -324,8 +325,9 @@ div.micl-navigationrail {
324
325
  inset-inline-start: 0;
325
326
  border-inline-end: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
326
327
  }
327
- div.micl-navigationrail[popover] {
328
+ nav.micl-navigationrail[popover] {
328
329
  position: fixed;
330
+ margin-inline-start: 0;
329
331
  }
330
332
  .micl-navigationrail {
331
333
  &[open],
@@ -356,8 +358,14 @@ div.micl-navigationrail[popover] {
356
358
  display var(--md-sys-navigationrail-motion-duration) linear allow-discrete;
357
359
  }
358
360
  }
359
- body:has(div.micl-navigationrail[popover]) {
360
- margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
361
+ .micl-window:has(nav.micl-navigationrail[popover]) {
362
+ padding-inline-start: var(--md-sys-navigationrail-collapsed-width);
363
+ }
364
+ .micl-window.micl-window--explicit-containment nav.micl-navigationrail {
365
+ block-size: fit-content;
366
+ min-block-size: fit-content;
367
+ padding-block: 16px;
368
+ border-radius: calc(var(--md-sys-navigationrail-collapsed-width) / 2);
361
369
  }
362
370
 
363
371
  @keyframes navigationrail-to-expanded {
@@ -148,6 +148,6 @@ label:has(+ input[type=radio].micl-radio:not(:disabled)) {
148
148
  cursor: pointer;
149
149
  }
150
150
  input[type=radio].micl-radio + label,
151
- label + input[type=radio].micl-radio {
151
+ label:has(+ input[type=radio].micl-radio) {
152
152
  color: var(--md-sys-color-on-surface);
153
153
  }
@@ -1,20 +1,19 @@
1
1
  # Side sheet
2
- This component implements the the [Material Design 3 Expressive Side sheet](https://m3.material.io/components/side-sheets/overview) design.
2
+ This component implements the the [Material Design 3 Expressive Side sheet](https://m3.material.io/components/side-sheets/overview) design. Side sheets provide optional content and actions without interrupting the main content.
3
3
 
4
4
  ## Basic Usage
5
5
 
6
6
  ### HTML
7
- To create a standard side sheet, use the `<dialog>` element with the `popover` attribute. The `closedby="any"` attribute allows the user to dismiss the side sheet by clicking anywhere outside of it.
7
+ To create a standard side sheet, use the `<dialog>` element with the `popover` attribute.
8
8
 
9
9
  ```HTML
10
- <dialog id="mysidesheet" class="micl-sidesheet" closedby="any" popover>
10
+ <dialog id="mysidesheet" class="micl-sidesheet" popover aria-labelledby="mytitle">
11
11
  <div class="micl-sidesheet__headline">
12
- <h2>Title</h2>
12
+ <h2 id="mytitle">Title</h2>
13
13
  <button
14
14
  type="button"
15
15
  class="micl-iconbutton-s material-symbols-outlined"
16
16
  popovertarget="mysidesheet"
17
- aria-label="Close"
18
17
  >close</button>
19
18
  </div>
20
19
  <div class="micl-sidesheet__content">
@@ -42,26 +41,24 @@ A **modal** side sheet blocks access to the rest of the page and must be dismiss
42
41
  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.
43
42
 
44
43
  ```HTML
45
- <dialog id="mysidesheet" class="micl-sidesheet" closedby="closerequest">
44
+ <dialog id="mysidesheet" class="micl-sidesheet" closedby="closerequest" aria-labelledby="mytitle">
46
45
  <div class="micl-sidesheet__headline">
47
46
  <button
48
47
  type="button"
49
48
  class="micl-iconbutton-s material-symbols-outlined"
50
- aria-label="Go back"
51
49
  >arrow_back</button>
52
- <h2>Title</h2>
50
+ <h2 id="mytitle">Title</h2>
53
51
  <button
54
52
  type="button"
55
53
  class="micl-iconbutton-s material-symbols-outlined"
56
54
  popovertarget="mysidesheet"
57
- aria-label="Close"
58
55
  >close</button>
59
56
  </div>
60
57
  <div class="micl-sidesheet__content">
61
58
  ...your content...
62
59
  </div>
63
60
  <div class="micl-sidesheet__actions">
64
- <button type="button" class="micl-button">Save</button>
61
+ <button type="button" class="micl-button-filled-s">Save</button>
65
62
  </div>
66
63
  </dialog>
67
64
  ```
@@ -74,13 +71,13 @@ To open either a standard or modal side sheet, link a button to the side sheet's
74
71
  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:
75
72
  ```CSS
76
73
  #mysidesheet {
77
- --md-sys-sidesheet-divider-width: 0;
74
+ --md-sys-divider-thickness: 0;
78
75
  }
79
76
  ```
80
77
  To remove the horizontal divider of the actions-container:
81
78
  ```CSS
82
- #mysidesheet {
83
- --md-sys-sidesheet-actions-divider-width: 0;
79
+ #mysidesheet .micl-sidesheet__actions {
80
+ --md-sys-divider-thickness: 0;
84
81
  }
85
82
  ```
86
83
 
@@ -89,10 +86,28 @@ The **standard** side sheet component adds CSS rules to the `<body>` element to
89
86
 
90
87
  ```CSS
91
88
  box-sizing: border-box;
92
- margin-left: 0px;
93
- margin-right: 0px;
94
- max-width: ...varies depending on if the side sheet is opened...
95
- transition: ...transition on max-width...
89
+ margin: 0;
90
+ max-inline-size: ...varies depending on if the side sheet is opened...
91
+ transition: ...transition on max-inline-size...
92
+ ```
93
+
94
+ ## Customizations
95
+ 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.
96
+
97
+ | Variable name | Default Value | Description |
98
+ | ------------- | ------------- | ----------- |
99
+ | --md-sys-sidesheet-width | 256px | The default (and minimum allowed) width of the side sheet |
100
+ | --md-sys-sidesheet-maxwidth | 400px | The largest allowed width of tthe side sheet |
101
+ | --md-sys-sidesheet-padding-standard | 24px | The amount of space between the vertical edges and the content |
102
+
103
+ **Example: Changing the width of the sidesheet**
104
+
105
+ ```HTML
106
+ <body style="--md-sys-sidesheet-width:320px">
107
+ <dialog id="mysidesheet" class="micl-sidesheet" popover>
108
+ ...
109
+ </dialog>
110
+ </body>
96
111
  ```
97
112
 
98
113
  ## Compatibility