material-inspired-component-library 2.0.1 → 3.0.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.
Files changed (76) hide show
  1. package/README.md +14 -0
  2. package/components/README.md +2 -0
  3. package/components/appbar/README.md +94 -0
  4. package/components/appbar/index.scss +216 -0
  5. package/components/button/index.scss +70 -65
  6. package/components/button/index.ts +1 -1
  7. package/components/card/index.scss +1 -1
  8. package/components/checkbox/README.md +9 -0
  9. package/components/checkbox/index.scss +4 -0
  10. package/components/divider/index.scss +10 -10
  11. package/components/iconbutton/index.scss +111 -111
  12. package/components/iconbutton/index.ts +1 -1
  13. package/components/list/README.md +4 -4
  14. package/components/list/index.scss +3 -3
  15. package/components/navigationrail/README.md +11 -11
  16. package/components/navigationrail/index.scss +20 -12
  17. package/components/radio/README.md +13 -4
  18. package/components/radio/index.scss +7 -5
  19. package/components/select/README.md +28 -6
  20. package/components/select/index.scss +56 -10
  21. package/components/textfield/index.scss +3 -9
  22. package/components/textfield/index.ts +29 -22
  23. package/dist/appbar.css +1 -0
  24. package/dist/appbar.js +1 -0
  25. package/dist/bottomsheet.css +1 -1
  26. package/dist/button.css +1 -1
  27. package/dist/card.css +1 -1
  28. package/dist/checkbox.css +1 -1
  29. package/dist/components/textfield/index.d.ts +1 -1
  30. package/dist/dialog.css +1 -1
  31. package/dist/divider.css +1 -1
  32. package/dist/iconbutton.css +1 -1
  33. package/dist/layout.css +1 -0
  34. package/dist/layout.js +1 -0
  35. package/dist/list.css +1 -1
  36. package/dist/menu.css +1 -1
  37. package/dist/micl.css +1 -1
  38. package/dist/micl.js +1 -1
  39. package/dist/navigationrail.css +1 -1
  40. package/dist/radio.css +1 -1
  41. package/dist/select.css +1 -1
  42. package/dist/sidesheet.css +1 -1
  43. package/dist/slider.css +1 -1
  44. package/dist/switch.css +1 -1
  45. package/dist/textfield.css +1 -1
  46. package/docs/accordion.html +298 -254
  47. package/docs/bottomsheet.html +174 -145
  48. package/docs/button.html +210 -182
  49. package/docs/card.html +107 -72
  50. package/docs/checkbox.html +92 -69
  51. package/docs/dialog.html +154 -123
  52. package/docs/divider.html +96 -67
  53. package/docs/docs.css +14 -24
  54. package/docs/docs.js +4 -2
  55. package/docs/iconbutton.html +196 -171
  56. package/docs/index.html +296 -286
  57. package/docs/list.html +260 -216
  58. package/docs/menu.html +260 -220
  59. package/docs/micl.css +1 -1
  60. package/docs/micl.js +1 -1
  61. package/docs/navigationrail.html +36 -34
  62. package/docs/radio.html +93 -72
  63. package/docs/select.html +253 -173
  64. package/docs/sidesheet.html +104 -87
  65. package/docs/slider.html +105 -72
  66. package/docs/switch.html +126 -101
  67. package/docs/textfield.html +181 -138
  68. package/layout/README.md +122 -0
  69. package/layout/index.scss +259 -0
  70. package/micl.ts +1 -1
  71. package/package.json +4 -1
  72. package/styles/shapes.scss +0 -2
  73. package/styles/statelayer.scss +2 -0
  74. package/styles.scss +13 -0
  75. package/webpack.config.js +1 -1
  76. package/styles/layout.scss +0 -74
@@ -31,44 +31,44 @@ body {
31
31
  .micl-divider {
32
32
  width: 100%;
33
33
  height: 0;
34
- margin-block: var(--md-sys-divider-space);
34
+ margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
35
35
  margin-inline: 0;
36
36
  border: 0;
37
- border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
37
+ border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
38
38
  }
39
39
 
40
40
  .micl-divider-inset {
41
41
  width: calc(100% - 2 * var(--md-sys-divider-inset-margin));
42
42
  height: 0;
43
- margin-block: var(--md-sys-divider-space);
43
+ margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
44
44
  margin-inline: var(--md-sys-divider-inset-margin);
45
45
  border: 0;
46
- border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
46
+ border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
47
47
  }
48
48
 
49
49
  .micl-divider-inset--start {
50
50
  width: calc(100% - var(--md-sys-divider-inset-margin));
51
51
  height: 0;
52
- margin-block: var(--md-sys-divider-space);
52
+ margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
53
53
  margin-inline: var(--md-sys-divider-inset-margin) 0;
54
54
  border: 0;
55
- border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
55
+ border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
56
56
  }
57
57
 
58
58
  .micl-divider-inset--end {
59
59
  width: calc(100% - var(--md-sys-divider-inset-margin));
60
60
  height: 0;
61
- margin-block: var(--md-sys-divider-space);
61
+ margin-block: calc(var(--md-sys-divider-space, 4px) - 1px) var(--md-sys-divider-space, 4px);
62
62
  margin-inline: 0 var(--md-sys-divider-inset-margin);
63
63
  border: 0;
64
- border-block-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
64
+ border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
65
65
  }
66
66
 
67
67
  .micl-divider-vertical {
68
68
  min-height: 100%;
69
69
  width: 0;
70
70
  margin-block: 0;
71
- margin-inline: calc(2 * var(--md-sys-divider-space));
71
+ margin-inline: calc(2 * var(--md-sys-divider-space, 4px));
72
72
  border: 0;
73
- border-inline-start: var(--md-sys-divider-thickness) solid var(--md-sys-divider-color);
73
+ border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color);
74
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
  }
@@ -156,19 +156,19 @@ To enable selection of list items, integrate a checkbox or switch component with
156
156
  <li class="micl-list-item-two" tabindex="0">
157
157
  <label>
158
158
  <span class="micl-list-item__text">
159
- <span class="micl-list-item__headline">Blue car</span>
159
+ <span id="hd1" class="micl-list-item__headline">Blue car</span>
160
160
  <span class="micl-list-item__supporting-text">A blue car with four wheels.</span>
161
161
  </label>
162
- <input type="checkbox" id="mycheckbox" class="micl-checkbox" value="cb1" tabindex="-1">
162
+ <input type="checkbox" id="mycheckbox" class="micl-checkbox" value="cb1" tabindex="-1" aria-labelledby="hd1">
163
163
  </span>
164
164
  </li>
165
165
  <li class="micl-list-item-two" tabindex="0">
166
166
  <label>
167
167
  <span class="micl-list-item__text">
168
- <span class="micl-list-item__headline">Red car</span>
168
+ <span id="hd2" class="micl-list-item__headline">Red car</span>
169
169
  <span class="micl-list-item__supporting-text">A red car with tinted windows.</span>
170
170
  </label>
171
- <input type="checkbox" id="checkbox2" class="micl-switch" value="cb2" tabindex="-1">
171
+ <input type="checkbox" id="checkbox2" class="micl-switch" value="cb2" tabindex="-1" aria-labelledby="hd2">
172
172
  </label>
173
173
  </li>
174
174
  </ul>
@@ -104,7 +104,7 @@
104
104
  column-gap: var(--md-sys-list-item-space);
105
105
  padding-inline: var(--md-sys-list-item-space);
106
106
  border: none;
107
- border-radius: var(--md-sys-shape-corner-none);
107
+ border-radius: var(--md-sys-shape-corner-none, 0px);
108
108
  background-color: var(--md-sys-list-item-container-color);
109
109
  background-image:
110
110
  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%),
@@ -330,7 +330,7 @@
330
330
  display: inline-block;
331
331
  height: 56px;
332
332
  min-width: 56px;
333
- border-radius: var(--md-sys-shape-corner-none);
333
+ border-radius: var(--md-sys-shape-corner-none, 0px);
334
334
  background-position: center;
335
335
  background-repeat: no-repeat;
336
336
  background-size: cover;
@@ -339,7 +339,7 @@
339
339
  display: inline-block;
340
340
  height: 64px;
341
341
  min-width: calc(64px * var(--md-sys-list-item-thumbnail-aspect-ratio));
342
- border-radius: var(--md-sys-shape-corner-none);
342
+ border-radius: var(--md-sys-shape-corner-none, 0px);
343
343
  background-position: center;
344
344
  background-repeat: no-repeat;
345
345
  background-size: contain;
@@ -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,11 +79,11 @@ 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
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:
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
87
  >
88
88
  > ```CSS
89
89
  > margin-inline-start: var(--md-sys-navigationrail-collapsed-width);
@@ -91,7 +91,7 @@ Add the `popover` attribute to the navigation rail, and the `popovertarget` attr
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 {