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.
- package/.claude/settings.local.json +4 -1
- package/components/button/README.md +68 -10
- package/components/button/index.scss +94 -174
- package/components/button/index.ts +4 -4
- package/components/iconbutton/README.md +55 -9
- package/components/iconbutton/index.scss +103 -161
- package/components/iconbutton/index.ts +4 -4
- package/components/list/index.scss +2 -2
- package/components/navigationrail/README.md +2 -1
- package/components/navigationrail/index.scss +2 -2
- package/dist/bottomsheet.js +1 -1
- package/dist/button.css +1 -1
- package/dist/button.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/iconbutton/index.d.ts +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/iconbutton.js +1 -1
- package/dist/list.css +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/navigationrail.css +1 -1
- package/dist/navigationrail.js +1 -1
- package/dist/progressindicator.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/textfield.js +1 -1
- package/dist/timepicker.js +1 -1
- package/docs/button.html +18 -17
- package/docs/iconbutton.html +12 -10
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/package.json +1 -1
- package/webpack.config.js +58 -3
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"WebFetch(domain:android.googlesource.com)",
|
|
9
9
|
"WebFetch(domain:m3.material.io)",
|
|
10
10
|
"WebFetch(domain:github.com)",
|
|
11
|
-
"Bash(xargs grep -l \"body\\\\|html\")"
|
|
11
|
+
"Bash(xargs grep -l \"body\\\\|html\")",
|
|
12
|
+
"WebFetch(domain:androidx.tech)",
|
|
13
|
+
"WebFetch(domain:cs.android.com)",
|
|
14
|
+
"WebFetch(domain:api.github.com)"
|
|
12
15
|
]
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -23,7 +23,7 @@ Or import all MICL styles:
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### JavaScript
|
|
26
|
-
This component requires JavaScript
|
|
26
|
+
This component requires JavaScript to support the **toggle logic**:
|
|
27
27
|
|
|
28
28
|
```JavaScript
|
|
29
29
|
import micl from "material-inspired-component-library/dist/micl";
|
|
@@ -40,7 +40,7 @@ Buttons come in **five sizes**: extra small (`xs`), small (`s`), medium (`m`), l
|
|
|
40
40
|
**Example: An extra-large text button**
|
|
41
41
|
|
|
42
42
|
```HTML
|
|
43
|
-
<button type="button" class="micl-button-text-xl>Save</button>
|
|
43
|
+
<button type="button" class="micl-button-text-xl">Save</button>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Material Design provides **five distinct styles**: `text`, `elevated`, `filled`, `tonal` and `outlined`. To use a style other than the `text` style used above, apply the corresponding class to the button:
|
|
@@ -56,9 +56,9 @@ By default, buttons have a **rounded shape**. For a more square-like appearance,
|
|
|
56
56
|
Adding the `disabled` boolean attribute to the button causes the button to be displayed in a disabled state.
|
|
57
57
|
|
|
58
58
|
### Toggle Button
|
|
59
|
-
A toggle button has two states: **on** (
|
|
60
|
-
- **Off state**: The button has the `micl-button--toggle` class
|
|
61
|
-
- **On state**: The button has
|
|
59
|
+
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.
|
|
60
|
+
- **Off state**: The button has the `micl-button--toggle` class and `aria-pressed="false"`.
|
|
61
|
+
- **On state**: The button has the `micl-button--toggle` class and `aria-pressed="true"`.
|
|
62
62
|
|
|
63
63
|
**Example: A selected toggle button**
|
|
64
64
|
|
|
@@ -66,13 +66,14 @@ A toggle button has two states: **on** (selected) and **off** (unselected). To c
|
|
|
66
66
|
<button
|
|
67
67
|
type="button"
|
|
68
68
|
id="id0"
|
|
69
|
-
class="micl-button-tonal-s micl-button--toggle
|
|
69
|
+
class="micl-button-tonal-s micl-button--toggle"
|
|
70
|
+
aria-pressed="true"
|
|
70
71
|
commandfor="id0"
|
|
71
72
|
command="--micl-toggle"
|
|
72
73
|
>Selected</button>
|
|
73
74
|
```
|
|
74
75
|
|
|
75
|
-
The self-targeting `command` property (`--micl-toggle`)
|
|
76
|
+
The self-targeting `command` property (`--micl-toggle`) flips `aria-pressed` whenever the user interacts with the button.
|
|
76
77
|
|
|
77
78
|
## Icons
|
|
78
79
|
To add a leading icon to a button, include an element with the `micl-button__icon` class inside the `<button>`:
|
|
@@ -84,14 +85,14 @@ To add a leading icon to a button, include an element with the `micl-button__ico
|
|
|
84
85
|
</button>
|
|
85
86
|
```
|
|
86
87
|
|
|
87
|
-
To use different icons for the **on** state and the **off** state in a toggle button, remove the icon name from the `micl-button__icon` element and add the `data-miclicon` (the name of the **
|
|
88
|
+
To use different icons for the **on** state and the **off** state in a toggle button, remove the icon name from the `micl-button__icon` element and add the `data-miclicon` (the name of the **off** icon) and `data-micliconselected` (the name of the **on** icon) attributes:
|
|
88
89
|
|
|
89
90
|
```HTML
|
|
90
91
|
...
|
|
91
92
|
<span
|
|
92
93
|
class="micl-button__icon material-symbols-outlined"
|
|
93
|
-
data-miclicon="
|
|
94
|
-
data-micliconselected="
|
|
94
|
+
data-miclicon="icon_for_off"
|
|
95
|
+
data-micliconselected="icon_for_on"
|
|
95
96
|
aria-hidden="true"
|
|
96
97
|
><span>
|
|
97
98
|
...
|
|
@@ -114,5 +115,62 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
|
|
|
114
115
|
</button>
|
|
115
116
|
```
|
|
116
117
|
|
|
118
|
+
## Theming
|
|
119
|
+
Each 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).
|
|
120
|
+
|
|
121
|
+
### Text
|
|
122
|
+
| Custom property | Meaning | Default |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `--md-comp-text-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
125
|
+
| `--md-comp-text-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
126
|
+
| `--md-comp-text-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
127
|
+
|
|
128
|
+
### Elevated
|
|
129
|
+
| Custom property | Meaning | Default |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| `--md-comp-elevated-button-container-color` | Container background | `--md-sys-color-surface-container-low` |
|
|
132
|
+
| `--md-comp-elevated-button-container-elevation` | Container elevation (shadow) | `--md-sys-elevation-level1` |
|
|
133
|
+
| `--md-comp-elevated-button-label-text-color` | Label & icon colour | `--md-sys-color-primary` |
|
|
134
|
+
| `--md-comp-elevated-button-selected-container-color` | Container background when selected | `--md-sys-color-primary` |
|
|
135
|
+
| `--md-comp-elevated-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-primary` |
|
|
136
|
+
| `--md-comp-elevated-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
137
|
+
| `--md-comp-elevated-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
138
|
+
| `--md-comp-elevated-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
139
|
+
| `--md-comp-elevated-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
140
|
+
|
|
141
|
+
### Filled
|
|
142
|
+
| Custom property | Meaning | Default |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| `--md-comp-filled-button-container-color` | Container background (also the selected state) | `--md-sys-color-primary` |
|
|
145
|
+
| `--md-comp-filled-button-label-text-color` | Label & icon colour (also the selected state) | `--md-sys-color-on-primary` |
|
|
146
|
+
| `--md-comp-filled-button-unselected-container-color` | Container background when an unselected toggle | `--md-sys-color-surface-container` |
|
|
147
|
+
| `--md-comp-filled-button-unselected-label-text-color` | Label & icon colour when an unselected toggle | `--md-sys-color-on-surface-variant` |
|
|
148
|
+
| `--md-comp-filled-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
149
|
+
| `--md-comp-filled-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
150
|
+
| `--md-comp-filled-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
151
|
+
| `--md-comp-filled-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
152
|
+
|
|
153
|
+
### Tonal
|
|
154
|
+
| Custom property | Meaning | Default |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `--md-comp-filled-tonal-button-container-color` | Container background | `--md-sys-color-secondary-container` |
|
|
157
|
+
| `--md-comp-filled-tonal-button-label-text-color` | Label & icon colour | `--md-sys-color-on-secondary-container` |
|
|
158
|
+
| `--md-comp-filled-tonal-button-selected-container-color` | Container background when selected | `--md-sys-color-secondary` |
|
|
159
|
+
| `--md-comp-filled-tonal-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-on-secondary` |
|
|
160
|
+
| `--md-comp-filled-tonal-button-disabled-container-color` | Container background when disabled | `--md-sys-color-on-surface` |
|
|
161
|
+
| `--md-comp-filled-tonal-button-disabled-container-opacity` | Container opacity when disabled | `10%` |
|
|
162
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
163
|
+
| `--md-comp-filled-tonal-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
164
|
+
|
|
165
|
+
### Outlined
|
|
166
|
+
| Custom property | Meaning | Default |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `--md-comp-outlined-button-outline-color` | Outline (border) colour | `--md-sys-color-outline-variant` |
|
|
169
|
+
| `--md-comp-outlined-button-label-text-color` | Label & icon colour | `--md-sys-color-on-surface-variant` |
|
|
170
|
+
| `--md-comp-outlined-button-selected-container-color` | Container background when selected | `--md-sys-color-inverse-surface` |
|
|
171
|
+
| `--md-comp-outlined-button-selected-label-text-color` | Label & icon colour when selected | `--md-sys-color-inverse-on-surface` |
|
|
172
|
+
| `--md-comp-outlined-button-disabled-label-text-color` | Label & icon colour when disabled | `--md-sys-color-on-surface` |
|
|
173
|
+
| `--md-comp-outlined-button-disabled-label-text-opacity` | Label & icon opacity when disabled | `38%` |
|
|
174
|
+
|
|
117
175
|
## Compatibility
|
|
118
176
|
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.
|
|
@@ -49,32 +49,11 @@
|
|
|
49
49
|
@include typography.scale('title-medium');
|
|
50
50
|
@include typography.scale('label-large');
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.micl-button-text-xl,
|
|
58
|
-
.micl-button-elevated-xs,
|
|
59
|
-
.micl-button-elevated-s,
|
|
60
|
-
.micl-button-elevated-m,
|
|
61
|
-
.micl-button-elevated-l,
|
|
62
|
-
.micl-button-elevated-xl,
|
|
63
|
-
.micl-button-filled-xs,
|
|
64
|
-
.micl-button-filled-s,
|
|
65
|
-
.micl-button-filled-m,
|
|
66
|
-
.micl-button-filled-l,
|
|
67
|
-
.micl-button-filled-xl,
|
|
68
|
-
.micl-button-tonal-xs,
|
|
69
|
-
.micl-button-tonal-s,
|
|
70
|
-
.micl-button-tonal-m,
|
|
71
|
-
.micl-button-tonal-l,
|
|
72
|
-
.micl-button-tonal-xl,
|
|
73
|
-
.micl-button-outlined-xs,
|
|
74
|
-
.micl-button-outlined-s,
|
|
75
|
-
.micl-button-outlined-m,
|
|
76
|
-
.micl-button-outlined-l,
|
|
77
|
-
.micl-button-outlined-xl {
|
|
52
|
+
[class*="micl-button-text-"],
|
|
53
|
+
[class*="micl-button-elevated-"],
|
|
54
|
+
[class*="micl-button-filled-"],
|
|
55
|
+
[class*="micl-button-tonal-"],
|
|
56
|
+
[class*="micl-button-outlined-"] {
|
|
78
57
|
--md-sys-button-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
79
58
|
--md-sys-button-motion-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
80
59
|
--md-sys-button-motion-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
@@ -106,16 +85,26 @@
|
|
|
106
85
|
--statelayer-opacity var(--md-sys-button-motion-duration) linear;
|
|
107
86
|
|
|
108
87
|
&:disabled {
|
|
109
|
-
background-color: rgb(from var(--md-sys-color-on-surface) r g b / 10%);
|
|
110
|
-
color: rgb(from var(--md-sys-color-on-surface) r g b / var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
111
88
|
box-shadow: var(--md-sys-elevation-level0);
|
|
112
89
|
cursor: default;
|
|
113
90
|
}
|
|
114
91
|
&:not(:disabled) {
|
|
92
|
+
&:hover {
|
|
93
|
+
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
94
|
+
|
|
95
|
+
.micl-button__icon {
|
|
96
|
+
font-variation-settings: 'FILL' 1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
115
99
|
&:focus-visible {
|
|
100
|
+
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
101
|
+
|
|
116
102
|
outline: var(--md-sys-state-focus-indicator-thickness, 3px) solid var(--md-sys-color-secondary);
|
|
117
103
|
outline-offset: 3px;
|
|
118
104
|
}
|
|
105
|
+
&:active {
|
|
106
|
+
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
107
|
+
}
|
|
119
108
|
&.micl-rippling {
|
|
120
109
|
animation: micl-ripple var(--md-sys-state-ripple-duration) motion.$md-sys-motion-easing-standard;
|
|
121
110
|
}
|
|
@@ -124,10 +113,10 @@
|
|
|
124
113
|
font-variation-settings: 'FILL' 0;
|
|
125
114
|
transition: font-variation-settings var(--md-sys-button-motion-duration) linear;
|
|
126
115
|
}
|
|
127
|
-
&.micl-button--toggle:not(
|
|
116
|
+
&.micl-button--toggle:not([aria-pressed="true"]) .micl-button__icon::before {
|
|
128
117
|
content: attr(data-miclicon);
|
|
129
118
|
}
|
|
130
|
-
&.micl-button--toggle
|
|
119
|
+
&.micl-button--toggle[aria-pressed="true"] .micl-button__icon::before {
|
|
131
120
|
content: attr(data-micliconselected);
|
|
132
121
|
}
|
|
133
122
|
}
|
|
@@ -158,18 +147,19 @@
|
|
|
158
147
|
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);
|
|
159
148
|
background-color: transparent;
|
|
160
149
|
}
|
|
161
|
-
&.micl-button--toggle
|
|
150
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
162
151
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
163
152
|
}
|
|
164
153
|
&.micl-button--square {
|
|
165
154
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
166
155
|
|
|
167
|
-
&.micl-button--toggle
|
|
156
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
168
157
|
border-radius: calc(var(--micl-height) / 2);
|
|
169
158
|
}
|
|
170
159
|
}
|
|
171
|
-
&:not(:disabled) {
|
|
172
|
-
|
|
160
|
+
&:not(:disabled):active {
|
|
161
|
+
&,
|
|
162
|
+
&.micl-button--square {
|
|
173
163
|
border-radius: var(--md-sys-shape-corner-small);
|
|
174
164
|
}
|
|
175
165
|
}
|
|
@@ -204,18 +194,19 @@
|
|
|
204
194
|
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);
|
|
205
195
|
background-color: transparent;
|
|
206
196
|
}
|
|
207
|
-
&.micl-button--toggle
|
|
197
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
208
198
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
209
199
|
}
|
|
210
200
|
&.micl-button--square {
|
|
211
201
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
212
202
|
|
|
213
|
-
&.micl-button--toggle
|
|
203
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
214
204
|
border-radius: calc(var(--micl-height) / 2);
|
|
215
205
|
}
|
|
216
206
|
}
|
|
217
|
-
&:not(:disabled) {
|
|
218
|
-
|
|
207
|
+
&:not(:disabled):active {
|
|
208
|
+
&,
|
|
209
|
+
&.micl-button--square {
|
|
219
210
|
border-radius: var(--md-sys-shape-corner-small);
|
|
220
211
|
}
|
|
221
212
|
}
|
|
@@ -241,18 +232,19 @@
|
|
|
241
232
|
column-gap: 8px;
|
|
242
233
|
padding-inline: 24px;
|
|
243
234
|
|
|
244
|
-
&.micl-button--toggle
|
|
235
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
245
236
|
border-radius: var(--md-sys-shape-corner-large);
|
|
246
237
|
}
|
|
247
238
|
&.micl-button--square {
|
|
248
239
|
border-radius: var(--md-sys-shape-corner-large);
|
|
249
240
|
|
|
250
|
-
&.micl-button--toggle
|
|
241
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
251
242
|
border-radius: calc(var(--micl-height) / 2);
|
|
252
243
|
}
|
|
253
244
|
}
|
|
254
|
-
&:not(:disabled) {
|
|
255
|
-
|
|
245
|
+
&:not(:disabled):active {
|
|
246
|
+
&,
|
|
247
|
+
&.micl-button--square {
|
|
256
248
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
257
249
|
}
|
|
258
250
|
}
|
|
@@ -278,18 +270,19 @@
|
|
|
278
270
|
column-gap: 12px;
|
|
279
271
|
padding-inline: 48px;
|
|
280
272
|
|
|
281
|
-
&.micl-button--toggle
|
|
273
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
282
274
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
283
275
|
}
|
|
284
276
|
&.micl-button--square {
|
|
285
277
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
286
278
|
|
|
287
|
-
&.micl-button--toggle
|
|
279
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
288
280
|
border-radius: calc(var(--micl-height) / 2);
|
|
289
281
|
}
|
|
290
282
|
}
|
|
291
|
-
&:not(:disabled) {
|
|
292
|
-
|
|
283
|
+
&:not(:disabled):active {
|
|
284
|
+
&,
|
|
285
|
+
&.micl-button--square {
|
|
293
286
|
border-radius: var(--md-sys-shape-corner-large);
|
|
294
287
|
}
|
|
295
288
|
}
|
|
@@ -315,18 +308,19 @@
|
|
|
315
308
|
column-gap: 16px;
|
|
316
309
|
padding-inline: 64px;
|
|
317
310
|
|
|
318
|
-
&.micl-button--toggle
|
|
311
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
319
312
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
320
313
|
}
|
|
321
314
|
&.micl-button--square {
|
|
322
315
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
323
316
|
|
|
324
|
-
&.micl-button--toggle
|
|
317
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
325
318
|
border-radius: calc(var(--micl-height) / 2);
|
|
326
319
|
}
|
|
327
320
|
}
|
|
328
|
-
&:not(:disabled) {
|
|
329
|
-
|
|
321
|
+
&:not(:disabled):active {
|
|
322
|
+
&,
|
|
323
|
+
&.micl-button--square {
|
|
330
324
|
border-radius: var(--md-sys-shape-corner-large);
|
|
331
325
|
}
|
|
332
326
|
}
|
|
@@ -336,199 +330,125 @@
|
|
|
336
330
|
}
|
|
337
331
|
}
|
|
338
332
|
|
|
339
|
-
|
|
340
|
-
.micl-button-text-s,
|
|
341
|
-
.micl-button-text-m,
|
|
342
|
-
.micl-button-text-l,
|
|
343
|
-
.micl-button-text-xl {
|
|
333
|
+
[class*="micl-button-text-"] {
|
|
344
334
|
--statelayer-color: var(--md-sys-color-primary);
|
|
345
335
|
|
|
346
336
|
background-color: transparent;
|
|
347
|
-
color: var(--md-sys-color-primary);
|
|
337
|
+
color: var(--md-comp-text-button-label-text-color, var(--md-sys-color-primary));
|
|
348
338
|
text-decoration: none;
|
|
349
339
|
|
|
350
|
-
&:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
.micl-button__icon {
|
|
355
|
-
font-variation-settings: 'FILL' 1;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
&:focus-visible {
|
|
359
|
-
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
360
|
-
}
|
|
361
|
-
&:active {
|
|
362
|
-
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
363
|
-
}
|
|
340
|
+
&:disabled {
|
|
341
|
+
background-color: transparent;
|
|
342
|
+
color: var(--md-comp-text-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-text-button-disabled-label-text-opacity, 38%)));
|
|
364
343
|
}
|
|
365
344
|
}
|
|
366
345
|
|
|
367
|
-
|
|
368
|
-
.micl-button-elevated-s,
|
|
369
|
-
.micl-button-elevated-m,
|
|
370
|
-
.micl-button-elevated-l,
|
|
371
|
-
.micl-button-elevated-xl {
|
|
346
|
+
[class*="micl-button-elevated-"] {
|
|
372
347
|
--statelayer-color: var(--md-sys-color-primary);
|
|
373
348
|
|
|
374
|
-
background-color: var(--md-sys-color-surface-container-low);
|
|
375
|
-
color: var(--md-sys-color-primary);
|
|
376
|
-
box-shadow: var(--md-sys-elevation-level1);
|
|
349
|
+
background-color: var(--md-comp-elevated-button-container-color, var(--md-sys-color-surface-container-low));
|
|
350
|
+
color: var(--md-comp-elevated-button-label-text-color, var(--md-sys-color-primary));
|
|
351
|
+
box-shadow: var(--md-comp-elevated-button-container-elevation, var(--md-sys-elevation-level1));
|
|
377
352
|
|
|
353
|
+
&:disabled {
|
|
354
|
+
background-color: var(--md-comp-elevated-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-elevated-button-disabled-container-opacity, 10%)));
|
|
355
|
+
color: var(--md-comp-elevated-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-elevated-button-disabled-label-text-opacity, 38%)));
|
|
356
|
+
}
|
|
378
357
|
&:not(:disabled) {
|
|
379
|
-
&.micl-button--toggle
|
|
358
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
380
359
|
--statelayer-color: var(--md-sys-color-on-primary);
|
|
381
360
|
|
|
382
|
-
background-color: var(--md-sys-color-primary);
|
|
383
|
-
color: var(--md-sys-color-on-primary);
|
|
384
|
-
|
|
385
|
-
.micl-button__icon {
|
|
386
|
-
font-variation-settings: 'FILL' 1;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
&:hover {
|
|
390
|
-
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
361
|
+
background-color: var(--md-comp-elevated-button-selected-container-color, var(--md-sys-color-primary));
|
|
362
|
+
color: var(--md-comp-elevated-button-selected-label-text-color, var(--md-sys-color-on-primary));
|
|
391
363
|
|
|
392
364
|
.micl-button__icon {
|
|
393
365
|
font-variation-settings: 'FILL' 1;
|
|
394
366
|
}
|
|
395
367
|
}
|
|
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%);
|
|
401
|
-
}
|
|
402
368
|
}
|
|
403
369
|
}
|
|
404
|
-
.micl-button-elevated-xs {
|
|
405
|
-
block-size: 32px;
|
|
406
|
-
border: none;
|
|
407
|
-
}
|
|
408
|
-
.micl-button-elevated-s {
|
|
409
|
-
block-size: 40px;
|
|
410
|
-
border: none;
|
|
411
|
-
}
|
|
412
370
|
|
|
413
|
-
|
|
414
|
-
.micl-button-filled-s,
|
|
415
|
-
.micl-button-filled-m,
|
|
416
|
-
.micl-button-filled-l,
|
|
417
|
-
.micl-button-filled-xl {
|
|
371
|
+
[class*="micl-button-filled-"] {
|
|
418
372
|
--statelayer-color: var(--md-sys-color-on-primary);
|
|
419
373
|
|
|
420
|
-
background-color: var(--md-sys-color-primary);
|
|
421
|
-
color: var(--md-sys-color-on-primary);
|
|
374
|
+
background-color: var(--md-comp-filled-button-container-color, var(--md-sys-color-primary));
|
|
375
|
+
color: var(--md-comp-filled-button-label-text-color, var(--md-sys-color-on-primary));
|
|
422
376
|
|
|
377
|
+
&:disabled {
|
|
378
|
+
background-color: var(--md-comp-filled-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-button-disabled-container-opacity, 10%)));
|
|
379
|
+
color: var(--md-comp-filled-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-button-disabled-label-text-opacity, 38%)));
|
|
380
|
+
}
|
|
423
381
|
&:not(:disabled) {
|
|
424
|
-
&.micl-button--toggle
|
|
382
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
425
383
|
.micl-button__icon {
|
|
426
384
|
font-variation-settings: 'FILL' 1;
|
|
427
385
|
}
|
|
428
386
|
}
|
|
429
|
-
&.micl-button--toggle:not(
|
|
387
|
+
&.micl-button--toggle:not([aria-pressed="true"]) {
|
|
430
388
|
--statelayer-color: var(--md-sys-color-on-surface-variant);
|
|
431
389
|
|
|
432
|
-
background-color: var(--md-sys-color-surface-container);
|
|
433
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
434
|
-
}
|
|
435
|
-
&:hover {
|
|
436
|
-
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
437
|
-
|
|
438
|
-
.micl-button__icon {
|
|
439
|
-
font-variation-settings: 'FILL' 1;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
&:focus-visible {
|
|
443
|
-
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
444
|
-
}
|
|
445
|
-
&:active {
|
|
446
|
-
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
390
|
+
background-color: var(--md-comp-filled-button-unselected-container-color, var(--md-sys-color-surface-container));
|
|
391
|
+
color: var(--md-comp-filled-button-unselected-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
447
392
|
}
|
|
448
393
|
}
|
|
449
394
|
}
|
|
450
395
|
|
|
451
|
-
|
|
452
|
-
.micl-button-tonal-s,
|
|
453
|
-
.micl-button-tonal-m,
|
|
454
|
-
.micl-button-tonal-l,
|
|
455
|
-
.micl-button-tonal-xl {
|
|
396
|
+
[class*="micl-button-tonal-"] {
|
|
456
397
|
--statelayer-color: var(--md-sys-color-on-secondary-container);
|
|
457
398
|
|
|
458
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
459
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
399
|
+
background-color: var(--md-comp-filled-tonal-button-container-color, var(--md-sys-color-secondary-container));
|
|
400
|
+
color: var(--md-comp-filled-tonal-button-label-text-color, var(--md-sys-color-on-secondary-container));
|
|
460
401
|
|
|
402
|
+
&:disabled {
|
|
403
|
+
background-color: var(--md-comp-filled-tonal-button-disabled-container-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-tonal-button-disabled-container-opacity, 10%)));
|
|
404
|
+
color: var(--md-comp-filled-tonal-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-filled-tonal-button-disabled-label-text-opacity, 38%)));
|
|
405
|
+
}
|
|
461
406
|
&:not(:disabled) {
|
|
462
|
-
&.micl-button--toggle
|
|
407
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
463
408
|
--statelayer-color: var(--md-sys-color-on-secondary);
|
|
464
409
|
|
|
465
|
-
background-color: var(--md-sys-color-secondary);
|
|
466
|
-
color: var(--md-sys-color-on-secondary);
|
|
467
|
-
|
|
468
|
-
.micl-button__icon {
|
|
469
|
-
font-variation-settings: 'FILL' 1;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
&:hover {
|
|
473
|
-
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
410
|
+
background-color: var(--md-comp-filled-tonal-button-selected-container-color, var(--md-sys-color-secondary));
|
|
411
|
+
color: var(--md-comp-filled-tonal-button-selected-label-text-color, var(--md-sys-color-on-secondary));
|
|
474
412
|
|
|
475
413
|
.micl-button__icon {
|
|
476
414
|
font-variation-settings: 'FILL' 1;
|
|
477
415
|
}
|
|
478
416
|
}
|
|
479
|
-
&:focus-visible {
|
|
480
|
-
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
481
|
-
}
|
|
482
|
-
&:active {
|
|
483
|
-
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
484
|
-
}
|
|
485
417
|
}
|
|
486
418
|
}
|
|
487
419
|
|
|
488
|
-
|
|
489
|
-
.micl-button-outlined-s,
|
|
490
|
-
.micl-button-outlined-m,
|
|
491
|
-
.micl-button-outlined-l,
|
|
492
|
-
.micl-button-outlined-xl {
|
|
420
|
+
[class*="micl-button-outlined-"] {
|
|
493
421
|
--statelayer-color: var(--md-sys-color-on-surface-variant);
|
|
494
422
|
|
|
495
423
|
background-color: transparent;
|
|
496
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
424
|
+
color: var(--md-comp-outlined-button-label-text-color, var(--md-sys-color-on-surface-variant));
|
|
497
425
|
|
|
426
|
+
&:disabled {
|
|
427
|
+
background-color: transparent;
|
|
428
|
+
color: var(--md-comp-outlined-button-disabled-label-text-color, rgb(from var(--md-sys-color-on-surface) r g b / var(--md-comp-outlined-button-disabled-label-text-opacity, 38%)));
|
|
429
|
+
}
|
|
498
430
|
&:not(:disabled) {
|
|
499
|
-
&.micl-button--toggle
|
|
431
|
+
&.micl-button--toggle[aria-pressed="true"] {
|
|
500
432
|
--statelayer-color: var(--md-sys-color-inverse-on-surface);
|
|
501
433
|
|
|
502
|
-
|
|
503
|
-
color: var(--md-sys-color-inverse-
|
|
504
|
-
|
|
505
|
-
.micl-button__icon {
|
|
506
|
-
font-variation-settings: 'FILL' 1;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
&:hover {
|
|
510
|
-
--statelayer-opacity: var(--md-sys-state-hover-state-layer-opacity, 8%);
|
|
434
|
+
border: none;
|
|
435
|
+
background-color: var(--md-comp-outlined-button-selected-container-color, var(--md-sys-color-inverse-surface));
|
|
436
|
+
color: var(--md-comp-outlined-button-selected-label-text-color, var(--md-sys-color-inverse-on-surface));
|
|
511
437
|
|
|
512
438
|
.micl-button__icon {
|
|
513
439
|
font-variation-settings: 'FILL' 1;
|
|
514
440
|
}
|
|
515
441
|
}
|
|
516
|
-
&:focus-visible {
|
|
517
|
-
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
518
|
-
}
|
|
519
|
-
&:active {
|
|
520
|
-
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
521
|
-
}
|
|
522
442
|
}
|
|
523
443
|
}
|
|
524
444
|
.micl-button-outlined-xs,
|
|
525
445
|
.micl-button-outlined-s,
|
|
526
446
|
.micl-button-outlined-m {
|
|
527
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
447
|
+
border: 1px solid var(--md-comp-outlined-button-outline-color, var(--md-sys-color-outline-variant));
|
|
528
448
|
}
|
|
529
449
|
.micl-button-outlined-l {
|
|
530
|
-
border: 2px solid var(--md-sys-color-outline-variant);
|
|
450
|
+
border: 2px solid var(--md-comp-outlined-button-outline-color, var(--md-sys-color-outline-variant));
|
|
531
451
|
}
|
|
532
452
|
.micl-button-outlined-xl {
|
|
533
|
-
border: 3px solid var(--md-sys-color-outline-variant);
|
|
453
|
+
border: 3px solid var(--md-comp-outlined-button-outline-color, var(--md-sys-color-outline-variant));
|
|
534
454
|
}
|
|
@@ -19,13 +19,13 @@
|
|
|
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 = '
|
|
22
|
+
export const buttonSelector = '.micl-button--toggle';
|
|
23
23
|
|
|
24
24
|
const toggleIcon = (button: HTMLButtonElement): void =>
|
|
25
25
|
{
|
|
26
26
|
const element = button.querySelector<HTMLElement>('.micl-button__icon') ?? button;
|
|
27
27
|
|
|
28
|
-
const selected = button.
|
|
28
|
+
const selected = button.getAttribute('aria-pressed') === 'true';
|
|
29
29
|
if (element.dataset.micliconselected) {
|
|
30
30
|
element.classList.toggle(element.dataset.micliconselected, selected);
|
|
31
31
|
}
|
|
@@ -47,7 +47,7 @@ export default (() =>
|
|
|
47
47
|
&& (event as any).command === '--micl-toggle'
|
|
48
48
|
) {
|
|
49
49
|
target.classList.add('micl-button--toggled');
|
|
50
|
-
target.
|
|
50
|
+
target.setAttribute('aria-pressed', String(target.getAttribute('aria-pressed') !== 'true'));
|
|
51
51
|
|
|
52
52
|
toggleIcon(target);
|
|
53
53
|
}
|
|
@@ -71,7 +71,7 @@ export default (() =>
|
|
|
71
71
|
cleanup: function(element: HTMLButtonElement): void
|
|
72
72
|
{
|
|
73
73
|
if (element.matches(buttonSelector)) {
|
|
74
|
-
|
|
74
|
+
element.removeEventListener('command', this.command);
|
|
75
75
|
delete element.dataset.miclinitialized;
|
|
76
76
|
}
|
|
77
77
|
}
|