material-inspired-component-library 8.1.0 → 8.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.
@@ -25,7 +25,7 @@ Or import all MICL styles:
25
25
  ```
26
26
 
27
27
  ### JavaScript
28
- This component requires JavaScript for interactive features like the **toggle logic**:
28
+ This component requires JavaScript for to support the **toggle logic**:
29
29
 
30
30
  ```JavaScript
31
31
  import micl from "material-inspired-component-library/dist/micl";
@@ -60,9 +60,9 @@ To reduce the width of an icon button, add the `micl-iconbutton--narrow` class.
60
60
  Adding the `disabled` boolean attribute to the button causes the button to be displayed in a disabled state.
61
61
 
62
62
  ### Toggle Button
63
- A toggle button has two states: **on** (selected) and **off** (unselected). To create one, add the `micl-button--toggle` class.
64
- - **Off state**: The button has the `micl-button--toggle` class.
65
- - **On state**: The button has both the `micl-button--toggle` and `micl-button--selected` classes.
63
+ A toggle button has two states: **on** (pressed) and **off** (unpressed). To create one, add the `micl-button--toggle` class and an `aria-pressed` attribute.
64
+ - **Off state**: The button has the `micl-button--toggle` class and `aria-pressed="false"`.
65
+ - **On state**: The button has the `micl-button--toggle` class and `aria-pressed="true"`.
66
66
 
67
67
  **Example: A selected toggle button**
68
68
 
@@ -70,21 +70,22 @@ A toggle button has two states: **on** (selected) and **off** (unselected). To c
70
70
  <button
71
71
  type="button"
72
72
  id="id0"
73
- class="micl-iconbutton-outlined-l micl-button--toggle micl-button--selected material-symbols-outlined"
73
+ class="micl-iconbutton-outlined-l micl-button--toggle material-symbols-outlined"
74
+ aria-pressed="true"
74
75
  commandfor="id0"
75
76
  command="--micl-toggle"
76
77
  aria-label="Control Panel"
77
78
  >settings</button>
78
79
  ```
79
80
 
80
- The self-targeting `command` property (`--micl-toggle`) toggles the button state whenever the user interacts with the button.
81
+ The self-targeting `command` property (`--micl-toggle`) flips `aria-pressed` whenever the user interacts with the button.
81
82
 
82
- To use different icons for the **on** state and the **off** state, remove the icon name from the button and add the `data-miclicon` (the name of the **on** icon) and `data-micliconselected` (the name of the **off** icon) attributes:
83
+ To use different icons for the **on** state and the **off** state, remove the icon name from the button and add the `data-miclicon` (the name of the **off** icon) and `data-micliconselected` (the name of the **on** icon) attributes:
83
84
 
84
85
  ```HTML
85
86
  ...
86
- data-miclicon="icon_for_on"
87
- data-micliconselected="icon_for_off"
87
+ data-miclicon="icon_for_off"
88
+ data-micliconselected="icon_for_on"
88
89
  ></button>
89
90
  ```
90
91
 
@@ -105,5 +106,50 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
105
106
  </button>
106
107
  ```
107
108
 
109
+ ## Theming
110
+ Each icon button style can be themed with CSS custom properties that follow the Material Design 3 component-token naming convention. Note that the `selected-*` and `unselected-*` properties only apply to [toggle buttons](#toggle-button).
111
+
112
+ ### Standard
113
+ | Custom property | Meaning | Default |
114
+ |---|---|---|
115
+ | `--md-comp-icon-button-icon-color` | Icon colour | `--md-sys-color-on-surface-variant` |
116
+ | `--md-comp-icon-button-selected-icon-color` | Icon colour when selected | `--md-sys-color-primary` |
117
+ | `--md-comp-icon-button-disabled-icon-color` | Icon colour when disabled | `--md-sys-color-on-surface` |
118
+ | `--md-comp-icon-button-disabled-icon-opacity` | Icon opacity when disabled | `38%` |
119
+
120
+ ### Filled
121
+ | Custom property | Meaning | Default |
122
+ |---|---|---|
123
+ | `--md-comp-filled-icon-button-container-color` | Container background (also the selected state) | `--md-sys-color-primary` |
124
+ | `--md-comp-filled-icon-button-icon-color` | Icon colour (also the selected state) | `--md-sys-color-on-primary` |
125
+ | `--md-comp-filled-icon-button-unselected-container-color` | Container background when an unselected toggle | `--md-sys-color-surface-container` |
126
+ | `--md-comp-filled-icon-button-unselected-icon-color` | Icon colour when an unselected toggle | `--md-sys-color-on-surface-variant` |
127
+ | `--md-comp-filled-icon-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
128
+ | `--md-comp-filled-icon-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
129
+ | `--md-comp-filled-icon-button-disabled-icon-color` | Icon colour when disabled | `--md-sys-color-on-surface` |
130
+ | `--md-comp-filled-icon-button-disabled-icon-opacity` | Icon opacity when disabled | `38%` |
131
+
132
+ ### Tonal
133
+ | Custom property | Meaning | Default |
134
+ |---|---|---|
135
+ | `--md-comp-filled-tonal-icon-button-container-color` | Container background | `--md-sys-color-secondary-container` |
136
+ | `--md-comp-filled-tonal-icon-button-icon-color` | Icon colour | `--md-sys-color-on-secondary-container` |
137
+ | `--md-comp-filled-tonal-icon-button-selected-container-color` | Container background when selected | `--md-sys-color-secondary` |
138
+ | `--md-comp-filled-tonal-icon-button-selected-icon-color` | Icon colour when selected | `--md-sys-color-on-secondary` |
139
+ | `--md-comp-filled-tonal-icon-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
140
+ | `--md-comp-filled-tonal-icon-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
141
+ | `--md-comp-filled-tonal-icon-button-disabled-icon-color` | Icon colour when disabled | `--md-sys-color-on-surface` |
142
+ | `--md-comp-filled-tonal-icon-button-disabled-icon-opacity` | Icon opacity when disabled | `38%` |
143
+
144
+ ### Outlined
145
+ | Custom property | Meaning | Default |
146
+ |---|---|---|
147
+ | `--md-comp-outlined-icon-button-icon-color` | Icon colour | `--md-sys-color-on-surface-variant` |
148
+ | `--md-comp-outlined-icon-button-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
149
+ | `--md-comp-outlined-icon-button-selected-container-color` | Container background when selected | `--md-sys-color-inverse-surface` |
150
+ | `--md-comp-outlined-icon-button-selected-icon-color` | Icon colour when selected | `--md-sys-color-inverse-on-surface` |
151
+ | `--md-comp-outlined-icon-button-disabled-icon-color` | Icon colour when disabled | `--md-sys-color-on-surface` |
152
+ | `--md-comp-outlined-icon-button-disabled-icon-opacity` | Icon opacity when disabled | `38%` |
153
+
108
154
  ## Compatibility
109
155
  This component utilizes relative RGB color values, which may not be fully supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#browser_compatibility) for details.
@@ -43,29 +43,10 @@
43
43
  @include statelayer.property;
44
44
  @include statelayer.keyframes;
45
45
 
46
- button.micl-iconbutton-standard-xs,
47
- a.micl-iconbutton-standard-xs,
48
- button.micl-iconbutton-standard-s,
49
- a.micl-iconbutton-standard-s,
50
- button.micl-iconbutton-standard-m,
51
- a.micl-iconbutton-standard-m,
52
- button.micl-iconbutton-standard-l,
53
- button.micl-iconbutton-standard-xl,
54
- button.micl-iconbutton-filled-xs,
55
- button.micl-iconbutton-filled-s,
56
- button.micl-iconbutton-filled-m,
57
- button.micl-iconbutton-filled-l,
58
- button.micl-iconbutton-filled-xl,
59
- button.micl-iconbutton-tonal-xs,
60
- button.micl-iconbutton-tonal-s,
61
- button.micl-iconbutton-tonal-m,
62
- button.micl-iconbutton-tonal-l,
63
- button.micl-iconbutton-tonal-xl,
64
- button.micl-iconbutton-outlined-xs,
65
- button.micl-iconbutton-outlined-s,
66
- button.micl-iconbutton-outlined-m,
67
- button.micl-iconbutton-outlined-l,
68
- button.micl-iconbutton-outlined-xl {
46
+ [class*="micl-iconbutton-standard-"],
47
+ [class*="micl-iconbutton-filled-"],
48
+ [class*="micl-iconbutton-tonal-"],
49
+ [class*="micl-iconbutton-outlined-"] {
69
50
  --md-sys-iconbutton-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
70
51
  --md-sys-iconbutton-motion-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
71
52
  --md-sys-iconbutton-motion-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
@@ -89,7 +70,7 @@ button.micl-iconbutton-outlined-xl {
89
70
  background-repeat: no-repeat;
90
71
  background-size: 0%, 100%;
91
72
  -webkit-tap-highlight-color: transparent;
92
- color: var(--md-sys-color-on-surface-variant);
73
+ color: var(--md-comp-icon-button-icon-color, var(--md-sys-color-on-surface-variant));
93
74
  font-variation-settings: 'FILL' 0;
94
75
  cursor: pointer;
95
76
  transition:
@@ -99,37 +80,42 @@ button.micl-iconbutton-outlined-xl {
99
80
  --statelayer-opacity var(--md-sys-iconbutton-motion-duration) linear;
100
81
 
101
82
  &:disabled {
102
- background-color: rgb(from var(--md-sys-color-on-surface) r g b / 10%);
103
- color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
104
83
  box-shadow: var(--md-sys-elevation-level0);
105
84
  cursor: default;
106
85
  }
107
86
  &:not(:disabled) {
87
+ &:hover {
88
+ --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
89
+ }
108
90
  &:focus-visible {
91
+ --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
92
+
109
93
  outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
110
94
  outline-offset: 3px;
111
95
  }
96
+ &:active {
97
+ --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
98
+ }
112
99
  &.micl-rippling {
113
100
  animation: micl-ripple var(--md-sys-state-ripple-duration) motion.$md-sys-motion-easing-standard;
114
101
  }
115
102
  }
116
103
  &:hover:not(:disabled),
117
- &.micl-button--toggle.micl-button--selected {
104
+ &.micl-button--toggle[aria-pressed="true"] {
118
105
  font-variation-settings: 'FILL' 1;
119
106
  }
120
- &.micl-button--toggle:not(.micl-button--selected)::before {
107
+ &.micl-button--toggle:not([aria-pressed="true"])::before {
121
108
  content: attr(data-miclicon);
122
109
  }
123
- &.micl-button--toggle.micl-button--selected::before {
110
+ &.micl-button--toggle[aria-pressed="true"]::before {
124
111
  content: attr(data-micliconselected);
125
112
  }
126
113
  }
127
114
 
128
- button.micl-iconbutton-standard-xs,
129
- a.micl-iconbutton-standard-xs,
130
- button.micl-iconbutton-filled-xs,
131
- button.micl-iconbutton-tonal-xs,
132
- button.micl-iconbutton-outlined-xs {
115
+ .micl-iconbutton-standard-xs,
116
+ .micl-iconbutton-filled-xs,
117
+ .micl-iconbutton-tonal-xs,
118
+ .micl-iconbutton-outlined-xs {
133
119
  --micl-width: 32px;
134
120
  --micl-height: 32px;
135
121
 
@@ -151,7 +137,7 @@ button.micl-iconbutton-outlined-xs {
151
137
  inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
152
138
  background-color: transparent;
153
139
  }
154
- &.micl-button--toggle.micl-button--selected {
140
+ &.micl-button--toggle[aria-pressed="true"] {
155
141
  border-radius: var(--md-sys-shape-corner-medium);
156
142
  }
157
143
  &.micl-iconbutton--narrow {
@@ -165,22 +151,22 @@ button.micl-iconbutton-outlined-xs {
165
151
  &.micl-button--square {
166
152
  border-radius: var(--md-sys-shape-corner-medium);
167
153
 
168
- &.micl-button--toggle.micl-button--selected {
154
+ &.micl-button--toggle[aria-pressed="true"] {
169
155
  border-radius: var(--md-sys-shape-corner-full);
170
156
  }
171
157
  }
172
- &:not(:disabled) {
173
- &:active {
158
+ &:not(:disabled):active {
159
+ &,
160
+ &.micl-button--square {
174
161
  border-radius: var(--md-sys-shape-corner-small);
175
162
  }
176
163
  }
177
164
  }
178
165
 
179
- button.micl-iconbutton-standard-s,
180
- a.micl-iconbutton-standard-s,
181
- button.micl-iconbutton-filled-s,
182
- button.micl-iconbutton-tonal-s,
183
- button.micl-iconbutton-outlined-s {
166
+ .micl-iconbutton-standard-s,
167
+ .micl-iconbutton-filled-s,
168
+ .micl-iconbutton-tonal-s,
169
+ .micl-iconbutton-outlined-s {
184
170
  --micl-width: 40px;
185
171
  --micl-height: 40px;
186
172
 
@@ -202,7 +188,7 @@ button.micl-iconbutton-outlined-s {
202
188
  inset: calc((var(--micl-height) - var(--md-sys-target-size, 48px)) / 2) 0 0 calc((min(100%, var(--md-sys-target-size, 48px)) - var(--md-sys-target-size, 48px)) / 2);
203
189
  background-color: transparent;
204
190
  }
205
- &.micl-button--toggle.micl-button--selected {
191
+ &.micl-button--toggle[aria-pressed="true"] {
206
192
  border-radius: var(--md-sys-shape-corner-medium);
207
193
  }
208
194
  &.micl-iconbutton--narrow {
@@ -216,22 +202,22 @@ button.micl-iconbutton-outlined-s {
216
202
  &.micl-button--square {
217
203
  border-radius: var(--md-sys-shape-corner-medium);
218
204
 
219
- &.micl-button--toggle.micl-button--selected {
205
+ &.micl-button--toggle[aria-pressed="true"] {
220
206
  border-radius: var(--md-sys-shape-corner-full);
221
207
  }
222
208
  }
223
- &:not(:disabled) {
224
- &:active {
209
+ &:not(:disabled):active {
210
+ &,
211
+ &.micl-button--square {
225
212
  border-radius: var(--md-sys-shape-corner-small);
226
213
  }
227
214
  }
228
215
  }
229
216
 
230
- button.micl-iconbutton-standard-m,
231
- a.micl-iconbutton-standard-m,
232
- button.micl-iconbutton-filled-m,
233
- button.micl-iconbutton-tonal-m,
234
- button.micl-iconbutton-outlined-m {
217
+ .micl-iconbutton-standard-m,
218
+ .micl-iconbutton-filled-m,
219
+ .micl-iconbutton-tonal-m,
220
+ .micl-iconbutton-outlined-m {
235
221
  --micl-width: 56px;
236
222
  --micl-height: 56px;
237
223
 
@@ -240,7 +226,7 @@ button.micl-iconbutton-outlined-m {
240
226
  block-size: var(--micl-height);
241
227
  font-size: var(--md-sys-icon-size, 24px);
242
228
 
243
- &.micl-button--toggle.micl-button--selected {
229
+ &.micl-button--toggle[aria-pressed="true"] {
244
230
  border-radius: var(--md-sys-shape-corner-large);
245
231
  }
246
232
  &.micl-iconbutton--narrow {
@@ -254,21 +240,22 @@ button.micl-iconbutton-outlined-m {
254
240
  &.micl-button--square {
255
241
  border-radius: var(--md-sys-shape-corner-large);
256
242
 
257
- &.micl-button--toggle.micl-button--selected {
243
+ &.micl-button--toggle[aria-pressed="true"] {
258
244
  border-radius: var(--md-sys-shape-corner-full);
259
245
  }
260
246
  }
261
- &:not(:disabled) {
262
- &:active {
247
+ &:not(:disabled):active {
248
+ &,
249
+ &.micl-button--square {
263
250
  border-radius: var(--md-sys-shape-corner-medium);
264
251
  }
265
252
  }
266
253
  }
267
254
 
268
- button.micl-iconbutton-standard-l,
269
- button.micl-iconbutton-filled-l,
270
- button.micl-iconbutton-tonal-l,
271
- button.micl-iconbutton-outlined-l {
255
+ .micl-iconbutton-standard-l,
256
+ .micl-iconbutton-filled-l,
257
+ .micl-iconbutton-tonal-l,
258
+ .micl-iconbutton-outlined-l {
272
259
  --micl-width: 96px;
273
260
  --micl-height: 96px;
274
261
 
@@ -277,7 +264,7 @@ button.micl-iconbutton-outlined-l {
277
264
  block-size: var(--micl-height);
278
265
  font-size: 32px;
279
266
 
280
- &.micl-button--toggle.micl-button--selected {
267
+ &.micl-button--toggle[aria-pressed="true"] {
281
268
  border-radius: var(--md-sys-shape-corner-extra-large);
282
269
  }
283
270
  &.micl-iconbutton--narrow {
@@ -291,21 +278,22 @@ button.micl-iconbutton-outlined-l {
291
278
  &.micl-button--square {
292
279
  border-radius: var(--md-sys-shape-corner-extra-large);
293
280
 
294
- &.micl-button--toggle.micl-button--selected {
281
+ &.micl-button--toggle[aria-pressed="true"] {
295
282
  border-radius: var(--md-sys-shape-corner-full);
296
283
  }
297
284
  }
298
- &:not(:disabled) {
299
- &:active {
285
+ &:not(:disabled):active {
286
+ &,
287
+ &.micl-button--square {
300
288
  border-radius: var(--md-sys-shape-corner-large);
301
289
  }
302
290
  }
303
291
  }
304
292
 
305
- button.micl-iconbutton-standard-xl,
306
- button.micl-iconbutton-filled-xl,
307
- button.micl-iconbutton-tonal-xl,
308
- button.micl-iconbutton-outlined-xl {
293
+ .micl-iconbutton-standard-xl,
294
+ .micl-iconbutton-filled-xl,
295
+ .micl-iconbutton-tonal-xl,
296
+ .micl-iconbutton-outlined-xl {
309
297
  --micl-width: 136px;
310
298
  --micl-height: 136px;
311
299
 
@@ -314,7 +302,7 @@ button.micl-iconbutton-outlined-xl {
314
302
  block-size: var(--micl-height);
315
303
  font-size: 40px;
316
304
 
317
- &.micl-button--toggle.micl-button--selected {
305
+ &.micl-button--toggle[aria-pressed="true"] {
318
306
  border-radius: var(--md-sys-shape-corner-extra-large);
319
307
  }
320
308
  &.micl-iconbutton--narrow {
@@ -328,151 +316,105 @@ button.micl-iconbutton-outlined-xl {
328
316
  &.micl-button--square {
329
317
  border-radius: var(--md-sys-shape-corner-extra-large);
330
318
 
331
- &.micl-button--toggle.micl-button--selected {
319
+ &.micl-button--toggle[aria-pressed="true"] {
332
320
  border-radius: var(--md-sys-shape-corner-full);
333
321
  }
334
322
  }
335
- &:not(:disabled) {
336
- &:active {
323
+ &:not(:disabled):active {
324
+ &,
325
+ &.micl-button--square {
337
326
  border-radius: var(--md-sys-shape-corner-large);
338
327
  }
339
328
  }
340
329
  }
341
330
 
342
- button.micl-iconbutton-standard-xs,
343
- a.micl-iconbutton-standard-xs,
344
- button.micl-iconbutton-standard-s,
345
- a.micl-iconbutton-standard-s,
346
- button.micl-iconbutton-standard-m,
347
- a.micl-iconbutton-standard-m,
348
- button.micl-iconbutton-standard-l,
349
- button.micl-iconbutton-standard-xl {
331
+ [class*="micl-iconbutton-standard-"] {
350
332
  --statelayer-color: var(--md-sys-color-on-surface-variant);
351
333
 
352
334
  text-decoration: none;
353
335
 
354
336
  &:disabled {
355
337
  background-color: transparent;
338
+ color: var(--md-comp-icon-button-disabled-icon-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-icon-button-disabled-icon-opacity, 38%)));
356
339
  }
357
340
  &:not(:disabled) {
358
- &.micl-button--toggle.micl-button--selected {
341
+ &.micl-button--toggle[aria-pressed="true"] {
359
342
  --statelayer-color: var(--md-sys-color-primary);
360
343
 
361
- color: var(--md-sys-color-primary);
362
- }
363
- &:hover {
364
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
365
- }
366
- &:focus-visible {
367
- --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
368
- }
369
- &:active {
370
- --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
344
+ color: var(--md-comp-icon-button-selected-icon-color, var(--md-sys-color-primary));
371
345
  }
372
346
  }
373
347
  }
374
348
 
375
349
 
376
- button.micl-iconbutton-filled-xs,
377
- button.micl-iconbutton-filled-s,
378
- button.micl-iconbutton-filled-m,
379
- button.micl-iconbutton-filled-l,
380
- button.micl-iconbutton-filled-xl {
350
+ [class*="micl-iconbutton-filled-"] {
381
351
  --statelayer-color: var(--md-sys-color-on-primary);
382
352
 
383
- background-color: var(--md-sys-color-primary);
384
- color: var(--md-sys-color-on-primary);
353
+ background-color: var(--md-comp-filled-icon-button-container-color, var(--md-sys-color-primary));
354
+ color: var(--md-comp-filled-icon-button-icon-color, var(--md-sys-color-on-primary));
385
355
 
356
+ &:disabled {
357
+ background-color: var(--md-comp-filled-icon-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-icon-button-disabled-container-opacity, 10%)));
358
+ color: var(--md-comp-filled-icon-button-disabled-icon-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-icon-button-disabled-icon-opacity, 38%)));
359
+ }
386
360
  &:not(:disabled) {
387
- &.micl-button--toggle:not(.micl-button--selected) {
361
+ &.micl-button--toggle:not([aria-pressed="true"]) {
388
362
  --statelayer-color: var(--md-sys-color-on-surface-variant);
389
363
 
390
- background-color: var(--md-sys-color-surface-container);
391
- color: var(--md-sys-color-on-surface-variant);
392
- }
393
- &:hover {
394
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
395
- }
396
- &:focus-visible {
397
- --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
398
- }
399
- &:active {
400
- --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
364
+ background-color: var(--md-comp-filled-icon-button-unselected-container-color, var(--md-sys-color-surface-container));
365
+ color: var(--md-comp-filled-icon-button-unselected-icon-color, var(--md-sys-color-on-surface-variant));
401
366
  }
402
367
  }
403
368
  }
404
369
 
405
- button.micl-iconbutton-tonal-xs,
406
- button.micl-iconbutton-tonal-s,
407
- button.micl-iconbutton-tonal-m,
408
- button.micl-iconbutton-tonal-l,
409
- button.micl-iconbutton-tonal-xl {
370
+ [class*="micl-iconbutton-tonal-"] {
410
371
  --statelayer-color: var(--md-sys-color-on-secondary-container);
411
372
 
412
- background-color: var(--md-sys-color-secondary-container);
413
- color: var(--md-sys-color-on-secondary-container);
373
+ background-color: var(--md-comp-filled-tonal-icon-button-container-color, var(--md-sys-color-secondary-container));
374
+ color: var(--md-comp-filled-tonal-icon-button-icon-color, var(--md-sys-color-on-secondary-container));
414
375
 
376
+ &:disabled {
377
+ background-color: var(--md-comp-filled-tonal-icon-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-tonal-icon-button-disabled-container-opacity, 10%)));
378
+ color: var(--md-comp-filled-tonal-icon-button-disabled-icon-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-tonal-icon-button-disabled-icon-opacity, 38%)));
379
+ }
415
380
  &:not(:disabled) {
416
- &.micl-button--toggle.micl-button--selected {
381
+ &.micl-button--toggle[aria-pressed="true"] {
417
382
  --statelayer-color: var(--md-sys-color-on-secondary);
418
383
 
419
- background-color: var(--md-sys-color-secondary);
420
- color: var(--md-sys-color-on-secondary);
421
- }
422
- &:hover {
423
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
424
- }
425
- &:focus-visible {
426
- --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
427
- }
428
- &:active {
429
- --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
384
+ background-color: var(--md-comp-filled-tonal-icon-button-selected-container-color, var(--md-sys-color-secondary));
385
+ color: var(--md-comp-filled-tonal-icon-button-selected-icon-color, var(--md-sys-color-on-secondary));
430
386
  }
431
387
  }
432
388
  }
433
389
 
434
- button.micl-iconbutton-outlined-xs,
435
- button.micl-iconbutton-outlined-s,
436
- button.micl-iconbutton-outlined-m,
437
- button.micl-iconbutton-outlined-l,
438
- button.micl-iconbutton-outlined-xl {
390
+ [class*="micl-iconbutton-outlined-"] {
439
391
  --statelayer-color: var(--md-sys-color-on-surface-variant);
440
392
 
441
393
  background-color: transparent;
442
- color: var(--md-sys-color-on-surface-variant);
394
+ color: var(--md-comp-outlined-icon-button-icon-color, var(--md-sys-color-on-surface-variant));
443
395
 
444
- &.micl-iconbutton-outlined-xs,
445
- &.micl-iconbutton-outlined-s,
446
- &.micl-iconbutton-outlined-m {
447
- // border-color: var(--md-sys-color-outline);
448
- border: 1px solid var(--md-sys-color-outline-variant);
449
- }
450
- &.micl-iconbutton-outlined-l {
451
- // border: 2px solid var(--md-sys-color-outline);
452
- border: 2px solid var(--md-sys-color-outline-variant);
453
- }
454
- &.micl-iconbutton-outlined-xl {
455
- // border: 3px solid var(--md-sys-color-outline);
456
- border: 3px solid var(--md-sys-color-outline-variant);
457
- }
458
396
  &:disabled {
459
397
  background-color: transparent;
398
+ color: var(--md-comp-outlined-icon-button-disabled-icon-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-outlined-icon-button-disabled-icon-opacity, 38%)));
460
399
  }
461
400
  &:not(:disabled) {
462
- &.micl-button--toggle.micl-button--selected {
401
+ &.micl-button--toggle[aria-pressed="true"] {
463
402
  --statelayer-color: var(--md-sys-color-inverse-on-surface);
464
403
 
465
- background-color: var(--md-sys-color-inverse-surface);
466
- color: var(--md-sys-color-inverse-on-surface);
467
- }
468
- &:hover {
469
- --statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
470
- }
471
- &:focus-visible {
472
- --statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
473
- }
474
- &:active {
475
- --statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
404
+ border: none;
405
+ background-color: var(--md-comp-outlined-icon-button-selected-container-color, var(--md-sys-color-inverse-surface));
406
+ color: var(--md-comp-outlined-icon-button-selected-icon-color, var(--md-sys-color-inverse-on-surface));
476
407
  }
477
408
  }
478
409
  }
410
+ .micl-iconbutton-outlined-xs,
411
+ .micl-iconbutton-outlined-s,
412
+ .micl-iconbutton-outlined-m {
413
+ border: 1px solid var(--md-comp-outlined-icon-button-outline-color, var(--md-sys-color-outline-variant));
414
+ }
415
+ .micl-iconbutton-outlined-l {
416
+ border: 2px solid var(--md-comp-outlined-icon-button-outline-color, var(--md-sys-color-outline-variant));
417
+ }
418
+ .micl-iconbutton-outlined-xl {
419
+ border: 3px solid var(--md-comp-outlined-icon-button-outline-color, var(--md-sys-color-outline-variant));
420
+ }
@@ -19,11 +19,11 @@
19
19
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
20
  // SOFTWARE.
21
21
 
22
- export const buttonSelector = 'button.micl-button--toggle';
22
+ export const buttonSelector = '.micl-button--toggle';
23
23
 
24
24
  const toggleIcon = (button: HTMLButtonElement): void =>
25
25
  {
26
- const selected = button.classList.contains('micl-button--selected');
26
+ const selected = button.getAttribute('aria-pressed') === 'true';
27
27
  if (button.dataset.micliconselected) {
28
28
  button.classList.toggle(button.dataset.micliconselected, selected);
29
29
  }
@@ -45,7 +45,7 @@ export default (() =>
45
45
  && (event as any).command === '--micl-toggle'
46
46
  ) {
47
47
  target.classList.add('micl-button--toggled');
48
- target.classList.toggle('micl-button--selected');
48
+ target.setAttribute('aria-pressed', String(target.getAttribute('aria-pressed') !== 'true'));
49
49
 
50
50
  toggleIcon(target);
51
51
  }
@@ -69,7 +69,7 @@ export default (() =>
69
69
  cleanup: function(element: HTMLButtonElement): void
70
70
  {
71
71
  if (element.matches(buttonSelector)) {
72
- document.removeEventListener('command', this.command);
72
+ element.removeEventListener('command', this.command);
73
73
  delete element.dataset.miclinitialized;
74
74
  }
75
75
  }
@@ -229,8 +229,8 @@ $open-accordion: ':where(details[open] > *)';
229
229
  }
230
230
  }
231
231
 
232
- .micl-list:has(.micl-list-item-one[tabindex], .micl-list-item-two[tabindex], .micl-list-item-three[tabindex]), select {
233
- .micl-list-item-one, .micl-list-item-two, .micl-list-item-three {
232
+ .micl-list:has(> .micl-list-item-one[tabindex], > .micl-list-item-two[tabindex], > .micl-list-item-three[tabindex]), select {
233
+ > .micl-list-item-one, > .micl-list-item-two, > .micl-list-item-three {
234
234
  &:not(:disabled):not(.micl-list-item--disabled) {
235
235
  @extend %shared-interactive-states;
236
236
  }
@@ -53,6 +53,7 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
53
53
  type="button"
54
54
  id="mybutton"
55
55
  class="micl-iconbutton-standard-s micl-button--toggle material-symbols-outlined"
56
+ aria-pressed="false"
56
57
  command="--micl-toggle"
57
58
  commandfor="mybutton"
58
59
  data-miclicon="menu"
@@ -66,7 +67,7 @@ The basic example creates a **collapsed** navigation rail. Add a menu button to
66
67
  </nav>
67
68
  ```
68
69
 
69
- 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.
70
+ When the user clicks the menu button, the navigation rail is expanded and the toggle button is given `aria-pressed="true"` and the `micl-button--toggled` class that indicates that the toggle button has been clicked at least once.
70
71
 
71
72
  ### Modal navigation rail
72
73
 
@@ -261,7 +261,7 @@
261
261
  }
262
262
 
263
263
  dialog.micl-navigationrail,
264
- nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
264
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle[aria-pressed="true"]) {
265
265
  --_navigationrail-current-max-width: var(--md-comp-nav-rail-expanded-container-width-maximum, 360px);
266
266
  --_navigationrail-current-min-width: var(--md-comp-nav-rail-expanded-container-width-minimum, 220px);
267
267
  --_navigationrail-item-direction: row;
@@ -303,7 +303,7 @@ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
303
303
  }
304
304
  }
305
305
 
306
- nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled:not(.micl-button--selected)) {
306
+ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled:not([aria-pressed="true"])) {
307
307
  --_navigationrail-morph-speed: var(--md-comp-nav-rail-morph-duration-reverse);
308
308
  --_navigationrail-text-animation: var(--_navigationrail-morph-speed) linear forwards navigationrail-text-to-collapsed;
309
309
  }
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.micl=o():e.micl=o()}(self,()=>(()=>{"use strict";var e={};return(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e),e})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.micl=t():e.micl=t()}(self,()=>(()=>{"use strict";var e={d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};return(()=>{e.r(t),e.d(t,{bottomsheetSelector:()=>i,default:()=>o});const i="dialog.micl-bottomsheet",o=(()=>{const e=e=>{let t=parseInt(e.dataset.miclfitheight||"0",10),i=parseInt(window.getComputedStyle(e).getPropertyValue("max-block-size"),10),o=(e.dataset.miclsnapheights||"").split(",").map(Number).filter(e=>!isNaN(e)&&e>=0&&e<=i);return t<1&&(t=Math.min(e.getBoundingClientRect().height,i),e.dataset.miclfitheight=`${t}`),[...new Set(o.concat([t]).sort())]},t=(t,i)=>{let o=t.getBoundingClientRect().height,n=e(t);return n.filter(e=>e>o+4)[0]||n[i?n.length-1:0]},o=(e,t)=>{t<1?(delete e.dataset.miclfitheight,e.style.removeProperty("--md-sys-bottomsheet-height"),e[e.popover?"hidePopover":"close"]()):e.style.setProperty("--md-sys-bottomsheet-height",`${t}px`)};return{initialize:n=>{if(!n.matches(i)||n.dataset.miclinitialized)return;n.dataset.miclinitialized="1";const s=n.querySelector(".micl-bottomsheet__headline");if(!s)return;const l=s.querySelector(".micl-bottomsheet__draghandle");l?.addEventListener("click",()=>{o(n,t(n,!1))});let r,c,a=!1,d=!1;function m(e){const t=e.clientY;a&&Math.abs(r-t)>4&&(a=!1,d=!0,n.classList.add("micl-bottomsheet--resizing")),d&&o(n,c+r-t)}function h(i){a=!1,n.classList.remove("micl-bottomsheet--resizing"),d&&(d=!1,i.clientY<r?o(n,t(n,!0)):n.getBoundingClientRect().height<48?o(n,0):o(n,(t=>{let i=t.getBoundingClientRect().height,o=e(t),n=o.filter(e=>e<i-4);return n[n.length-1]||o[0]})(n)),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h))}s.addEventListener("mousedown",e=>{e.eventPhase===Event.AT_TARGET&&(a=!0,e.preventDefault(),r=e.clientY,c=n.getBoundingClientRect().height,document.addEventListener("mousemove",m),document.addEventListener("mouseup",h))})},cleanup:e=>{e.matches(i)&&(e.classList.remove("micl-bottomsheet--resizing"),delete e.dataset.miclinitialized,delete e.dataset.miclfitheight)}}})()})(),t})());