material-inspired-component-library 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/README.md +42 -3
- package/components/alert/README.md +19 -7
- package/components/button/README.md +1 -1
- package/components/button/index.scss +23 -20
- package/components/dialog/README.md +5 -5
- package/components/divider/index.scss +9 -3
- package/components/iconbutton/README.md +1 -1
- package/components/iconbutton/index.scss +20 -17
- package/components/list/README.md +18 -16
- package/components/list/index.scss +90 -68
- package/components/menu/README.md +2 -1
- package/components/menu/index.scss +6 -18
- package/components/select/README.md +7 -2
- package/components/select/index.scss +2 -3
- package/components/sidesheet/README.md +13 -19
- package/components/sidesheet/index.scss +15 -16
- package/components/textfield/index.ts +26 -0
- package/components/timepicker/index.scss +268 -0
- package/components/timepicker/index.ts +113 -0
- package/dist/button.css +1 -1
- package/dist/components/timepicker/index.d.ts +5 -0
- package/dist/divider.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/list.css +1 -1
- package/dist/menu.css +1 -1
- package/dist/micl.css +1 -1
- package/dist/micl.js +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/timepicker.css +1 -0
- package/dist/timepicker.js +1 -0
- package/docs/accordion.html +31 -17
- package/docs/button.html +42 -15
- package/docs/iconbutton.html +258 -164
- package/docs/index.html +11 -8
- package/docs/list.html +52 -44
- package/docs/menu.html +2 -1
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/sidesheet.html +3 -2
- package/docs/timepicker.html +113 -0
- package/micl.ts +3 -1
- package/package.json +2 -4
- package/styles.scss +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Accordion
|
|
2
|
-
This component implements the [Material Design 3 Expressive Expandable Lists](https://m3.material.io/components/lists/
|
|
2
|
+
This component implements the [Material Design 3 Expressive Expandable Lists](https://m3.material.io/components/lists/guidelines#b5697cef-6e9f-4699-ae10-c3f49649593e) design. Accordions are vertically stacked lists that allow you to show and hide sections of content.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
@@ -46,7 +46,7 @@ This component requires JavaScript to support keyboard navigation:
|
|
|
46
46
|
import micl from "material-inspired-component-library/dist/micl";
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
This will initialize any
|
|
49
|
+
This will initialize any Accordion component, including those that will be added to the DOM later on.
|
|
50
50
|
|
|
51
51
|
### Live Demo
|
|
52
52
|
A live example of the [Accordion component](https://henkpb.github.io/micl/accordion.html) is available to interact with.
|
|
@@ -70,6 +70,7 @@ To ensure that only one accordion item within a group can be open at a time, add
|
|
|
70
70
|
</div>
|
|
71
71
|
</div>
|
|
72
72
|
</details>
|
|
73
|
+
<hr class="micl-divider">
|
|
73
74
|
<details name="mygroup">
|
|
74
75
|
<summary class="micl-list-item-two" tabindex="-1">
|
|
75
76
|
<span class="micl-list-item__text">
|
|
@@ -87,11 +88,49 @@ To ensure that only one accordion item within a group can be open at a time, add
|
|
|
87
88
|
</div>
|
|
88
89
|
```
|
|
89
90
|
|
|
91
|
+
Add a trailing icon to an accordion item to indicate that the item can be expanded. If you add the `micl-list-item__icon--expander` class to the icon, the icon will rotate 180 degrees when the accordion panel is opened or closed.
|
|
92
|
+
|
|
93
|
+
```HTML
|
|
94
|
+
<div class="micl-list" role="listbox">
|
|
95
|
+
<details>
|
|
96
|
+
<summary class="micl-list-item-one">
|
|
97
|
+
<span class="micl-list-item__text">
|
|
98
|
+
<span class="micl-list-item__headline">Heading</span>
|
|
99
|
+
</span>
|
|
100
|
+
<span class="micl-list-item__icon micl-list-item__icon--expander material-symbols-outlined" aria-hidden="true">keyboard_arrow_down</span>
|
|
101
|
+
</summary>
|
|
102
|
+
<div class="micl-list-item__content">
|
|
103
|
+
...content...
|
|
104
|
+
</div>
|
|
105
|
+
</details>
|
|
106
|
+
</div>
|
|
107
|
+
```
|
|
108
|
+
|
|
90
109
|
Adding the `micl-list-item--disabled` class to the `<summary>` element causes the accordion item to be displayed in a disabled state.
|
|
91
110
|
|
|
92
|
-
|
|
111
|
+
Use a [Divider component](../divider/README.md) to separate neighbouring accordion items by a divider.
|
|
93
112
|
|
|
94
113
|
Since the Accordion is based on the List component, you can use the same utility classes for content structure and styling. Refer to the [List component documentation](../list/README.md) for details on how to add icons, avatars, images, and other features to your accordion items.
|
|
95
114
|
|
|
115
|
+
## Customizations
|
|
116
|
+
You can customize the appearance of the Accordion component by overriding its own global CSS variables and those from the List component. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child accordions.
|
|
117
|
+
|
|
118
|
+
| Variable name | Default Value | Description |
|
|
119
|
+
| ------------- | ------------- | ----------- |
|
|
120
|
+
| --md-sys-accordion-item-space | 0px | The space between an opened accordion item and its next neighbour. |
|
|
121
|
+
|
|
122
|
+
**Example: Changing the margin between an opened item and the next**
|
|
123
|
+
|
|
124
|
+
```HTML
|
|
125
|
+
<div class="micl-list" role="listbox" style="--md-sys-accordion-item-space:4px">
|
|
126
|
+
<details>
|
|
127
|
+
...
|
|
128
|
+
</details>
|
|
129
|
+
<details>
|
|
130
|
+
...
|
|
131
|
+
</details>
|
|
132
|
+
</div>
|
|
133
|
+
```
|
|
134
|
+
|
|
96
135
|
## Compatibility
|
|
97
136
|
The Card component uses the `interpolate-size` CSS property to smoothly open and close the detail area of a Details disclosure element, which might not be supported in your browser. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/interpolate-size#browser_compatibility) for details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Alert
|
|
2
|
-
|
|
2
|
+
Alerts are used to inform the user of important changes in a prominent way. This component is inspired by [Material Design 3 Expressive](https://m3.material.io/components).
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
@@ -46,16 +46,28 @@ Alerts are available in **three distinct styles**:
|
|
|
46
46
|
|
|
47
47
|
- `micl-alert-tonal`: An alert with a lighter background color. This is the style shown in the Basic Usage section.
|
|
48
48
|
|
|
49
|
-
- `micl-alert-outlined`: An alert with a clear border, typically used for less prominent content.
|
|
49
|
+
- `micl-alert-outlined`: An alert with a clear border and a transparent background, typically used for less prominent content.
|
|
50
|
+
|
|
51
|
+
You can change the component's color to reflect different semantic meanings or states.
|
|
52
|
+
|
|
53
|
+
**By default, all alert styles use the error-style color scheme.**
|
|
54
|
+
|
|
55
|
+
To change the color, add one of the following modifier classes to the main `<div>` element.
|
|
56
|
+
|
|
57
|
+
| Class name | Description |
|
|
58
|
+
| ---------- | ----------- |
|
|
59
|
+
| micl-alert--primary | Uses the main color scheme of your application |
|
|
60
|
+
| micl-alert--secondary | Uses a color scheme that is less prominent than the main one |
|
|
61
|
+
| micl-alert--tertiary | Uses a color scheme that provides contrasting accents |
|
|
50
62
|
|
|
51
63
|
### Alert Content Structure
|
|
52
|
-
The
|
|
64
|
+
The Alert component is built with a few key structural elements.
|
|
53
65
|
|
|
54
|
-
- `micl-alert__icon
|
|
66
|
+
- `micl-alert__icon` (optional): A container for an icon, typically from a library like Material Symbols. It appears before the alert text.
|
|
55
67
|
|
|
56
|
-
- `micl-alert__text`: A container for the main alert heading (`<h1>`-`<h6>`) and
|
|
68
|
+
- `micl-alert__text`: A container for the main alert heading (`<h1>`-`<h6>`) and supporting text.
|
|
57
69
|
|
|
58
|
-
- `micl-alert__supporting-text
|
|
70
|
+
- `micl-alert__supporting-text` (optional): Used for a short description or supplementary information. It is displayed in a smaller font.
|
|
59
71
|
|
|
60
72
|
## Customizations
|
|
61
73
|
You can customize the appearance of the Alert component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child alert.
|
|
@@ -63,7 +75,7 @@ You can customize the appearance of the Alert component by overriding its global
|
|
|
63
75
|
| Variable name | Default Value | Description |
|
|
64
76
|
| ------------- | ------------- | ----------- |
|
|
65
77
|
| --md-sys-alert-padding | 16px | The inner padding between the alert's edge and its content |
|
|
66
|
-
| --md-sys-alert-space | 16px |
|
|
78
|
+
| --md-sys-alert-space | 16px | The spacing between the optional icon and the text container |
|
|
67
79
|
|
|
68
80
|
**Example: Changing the padding**
|
|
69
81
|
|
|
@@ -92,4 +92,4 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
|
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
## Compatibility
|
|
95
|
-
This component
|
|
95
|
+
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.
|
|
@@ -63,6 +63,7 @@ button.micl-button-outlined-xl {
|
|
|
63
63
|
position: relative;
|
|
64
64
|
display: inline-flex;
|
|
65
65
|
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
66
67
|
padding: 0;
|
|
67
68
|
border: none;
|
|
68
69
|
border-radius: calc(var(--micl-height) / 2);
|
|
@@ -115,15 +116,16 @@ button.micl-button-outlined-xs {
|
|
|
115
116
|
min-inline-size: var(--micl-width);
|
|
116
117
|
block-size: var(--micl-height);
|
|
117
118
|
min-block-size: var(--micl-height);
|
|
118
|
-
column-gap:
|
|
119
|
+
column-gap: 4px;
|
|
119
120
|
padding-inline: 12px;
|
|
120
121
|
|
|
121
122
|
&::before {
|
|
122
123
|
content: "";
|
|
123
124
|
position: absolute;
|
|
124
|
-
block-size: var(--md-sys-target-size);
|
|
125
|
-
inline-size:
|
|
126
|
-
|
|
125
|
+
block-size: var(--md-sys-target-size, 48px);
|
|
126
|
+
inline-size: 100%;
|
|
127
|
+
min-inline-size: var(--md-sys-target-size, 48px);
|
|
128
|
+
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);
|
|
127
129
|
background-color: transparent;
|
|
128
130
|
}
|
|
129
131
|
&.micl-button--toggle.micl-button--selected {
|
|
@@ -133,7 +135,7 @@ button.micl-button-outlined-xs {
|
|
|
133
135
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
134
136
|
|
|
135
137
|
&.micl-button--toggle.micl-button--selected {
|
|
136
|
-
border-radius: var(--
|
|
138
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
&:not(:disabled) {
|
|
@@ -143,7 +145,7 @@ button.micl-button-outlined-xs {
|
|
|
143
145
|
}
|
|
144
146
|
.micl-button__icon {
|
|
145
147
|
font-size: 20px;
|
|
146
|
-
|
|
148
|
+
inline-size: 20px;
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
|
|
@@ -167,9 +169,10 @@ button.micl-button-outlined-s {
|
|
|
167
169
|
&::before {
|
|
168
170
|
content: "";
|
|
169
171
|
position: absolute;
|
|
170
|
-
block-size: var(--md-sys-target-size);
|
|
171
|
-
inline-size:
|
|
172
|
-
|
|
172
|
+
block-size: var(--md-sys-target-size, 48px);
|
|
173
|
+
inline-size: 100%;
|
|
174
|
+
min-inline-size: var(--md-sys-target-size, 48px);
|
|
175
|
+
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);
|
|
173
176
|
background-color: transparent;
|
|
174
177
|
}
|
|
175
178
|
&.micl-button--toggle.micl-button--selected {
|
|
@@ -179,7 +182,7 @@ button.micl-button-outlined-s {
|
|
|
179
182
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
180
183
|
|
|
181
184
|
&.micl-button--toggle.micl-button--selected {
|
|
182
|
-
border-radius: var(--
|
|
185
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
&:not(:disabled) {
|
|
@@ -189,7 +192,7 @@ button.micl-button-outlined-s {
|
|
|
189
192
|
}
|
|
190
193
|
.micl-button__icon {
|
|
191
194
|
font-size: 20px;
|
|
192
|
-
|
|
195
|
+
inline-size: 20px;
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
|
|
@@ -217,17 +220,17 @@ button.micl-button-outlined-m {
|
|
|
217
220
|
border-radius: var(--md-sys-shape-corner-large);
|
|
218
221
|
|
|
219
222
|
&.micl-button--toggle.micl-button--selected {
|
|
220
|
-
border-radius: var(--
|
|
223
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
221
224
|
}
|
|
222
225
|
}
|
|
223
226
|
&:not(:disabled) {
|
|
224
227
|
&:active {
|
|
225
|
-
border-radius: var(--md-sys-shape-corner-
|
|
228
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
231
|
.micl-button__icon {
|
|
229
232
|
font-size: var(--md-sys-layout-icon-size, 24px);
|
|
230
|
-
|
|
233
|
+
inline-size: var(--md-sys-layout-icon-size, 24px);
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
|
|
@@ -254,7 +257,7 @@ button.micl-button-outlined-l {
|
|
|
254
257
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
255
258
|
|
|
256
259
|
&.micl-button--toggle.micl-button--selected {
|
|
257
|
-
border-radius: var(--
|
|
260
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
&:not(:disabled) {
|
|
@@ -264,7 +267,7 @@ button.micl-button-outlined-l {
|
|
|
264
267
|
}
|
|
265
268
|
.micl-button__icon {
|
|
266
269
|
font-size: 32px;
|
|
267
|
-
|
|
270
|
+
inline-size: 32px;
|
|
268
271
|
}
|
|
269
272
|
}
|
|
270
273
|
|
|
@@ -291,7 +294,7 @@ button.micl-button-outlined-xl {
|
|
|
291
294
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
292
295
|
|
|
293
296
|
&.micl-button--toggle.micl-button--selected {
|
|
294
|
-
border-radius: var(--
|
|
297
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
300
|
&:not(:disabled) {
|
|
@@ -301,7 +304,7 @@ button.micl-button-outlined-xl {
|
|
|
301
304
|
}
|
|
302
305
|
.micl-button__icon {
|
|
303
306
|
font-size: 40px;
|
|
304
|
-
|
|
307
|
+
inline-size: 40px;
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
|
|
@@ -373,11 +376,11 @@ button.micl-button-elevated-xl {
|
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
378
|
button.micl-button-elevated-xs {
|
|
376
|
-
|
|
379
|
+
block-size: 32px;
|
|
377
380
|
border: none;
|
|
378
381
|
}
|
|
379
382
|
button.micl-button-elevated-s {
|
|
380
|
-
|
|
383
|
+
block-size: 40px;
|
|
381
384
|
border: none;
|
|
382
385
|
}
|
|
383
386
|
|
|
@@ -53,8 +53,8 @@ Removing the `popover` attribute creates a more intrusive **modal** dialog. This
|
|
|
53
53
|
</div>
|
|
54
54
|
<div class="micl-dialog__actions">
|
|
55
55
|
<form method="dialog">
|
|
56
|
-
<button class="micl-button">Cancel</button>
|
|
57
|
-
<button class="micl-button">Save</button>
|
|
56
|
+
<button class="micl-button-text-s">Cancel</button>
|
|
57
|
+
<button class="micl-button-text-s">Save</button>
|
|
58
58
|
</form>
|
|
59
59
|
</div>
|
|
60
60
|
</dialog>
|
|
@@ -100,14 +100,14 @@ A full-screen dialog covers the entire viewport, primarily on smaller screens. O
|
|
|
100
100
|
<button type="button" class="micl-iconbutton-s material-symbols-outlined" popovertarget="mydialog" aria-label="Close">close</button>
|
|
101
101
|
<span class="micl-dialog__icon material-symbols-outlined" aria-hidden="true">person</span>
|
|
102
102
|
<h2 id="mytitle">Full-screen dialog</h2>
|
|
103
|
-
<button class="micl-button" value="dosave">Save</button>
|
|
103
|
+
<button class="micl-button-text-s" value="dosave">Save</button>
|
|
104
104
|
</form>
|
|
105
105
|
<div class="micl-dialog__content">
|
|
106
106
|
<span id="mydesc" class="micl-dialog__supporting-text">This dialog covers the whole screen.</span>
|
|
107
107
|
</div>
|
|
108
108
|
<form method="dialog" class="micl-dialog__actions">
|
|
109
|
-
<button type="button" class="micl-button" popovertarget="mydialog">Cancel</button>
|
|
110
|
-
<button class="micl-button" value="dosave">Save</button>
|
|
109
|
+
<button type="button" class="micl-button-text-s" popovertarget="mydialog">Cancel</button>
|
|
110
|
+
<button class="micl-button-text-s" value="dosave">Save</button>
|
|
111
111
|
</form>
|
|
112
112
|
</dialog>
|
|
113
113
|
|
|
@@ -34,9 +34,9 @@ body {
|
|
|
34
34
|
.micl-divider-inset-end {
|
|
35
35
|
inline-size: 100%;
|
|
36
36
|
block-size: 0;
|
|
37
|
-
margin-block: calc(var(--md-sys-divider-space, 4px) -
|
|
37
|
+
margin-block: calc(var(--md-sys-divider-space, 4px) - 0.5px) calc(var(--md-sys-divider-space, 4px) - 0.5px);
|
|
38
38
|
margin-inline: 0;
|
|
39
|
-
border:
|
|
39
|
+
border: none;
|
|
40
40
|
border-block-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -60,6 +60,12 @@ body {
|
|
|
60
60
|
inline-size: 0;
|
|
61
61
|
margin-block: 0;
|
|
62
62
|
margin-inline: calc(2 * var(--md-sys-divider-space, 4px));
|
|
63
|
-
border:
|
|
63
|
+
border: none;
|
|
64
64
|
border-inline-start: var(--md-sys-divider-thickness, 1px) solid var(--md-sys-divider-color, gray);
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
li.micl-divider {
|
|
68
|
+
list-style: none;
|
|
69
|
+
box-shadow: 0 calc(-1 * var(--md-sys-divider-space, 4px) / 2) 0 calc(var(--md-sys-divider-space, 4px) / 2) var(--md-sys-list-item-container-color),
|
|
70
|
+
0 calc(var(--md-sys-divider-space, 4px) / 2) 0 calc(var(--md-sys-divider-space, 4px) / 2) var(--md-sys-list-item-container-color);
|
|
71
|
+
}
|
|
@@ -86,4 +86,4 @@ You can also use other icon libraries. For example, with the [Bootstrap Icons li
|
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
## Compatibility
|
|
89
|
-
This component
|
|
89
|
+
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.
|
|
@@ -111,9 +111,10 @@ button.micl-iconbutton-outlined-xs {
|
|
|
111
111
|
&::before {
|
|
112
112
|
content: "";
|
|
113
113
|
position: absolute;
|
|
114
|
-
block-size: var(--md-sys-target-size);
|
|
115
|
-
inline-size:
|
|
116
|
-
|
|
114
|
+
block-size: var(--md-sys-target-size, 48px);
|
|
115
|
+
inline-size: 100%;
|
|
116
|
+
min-inline-size: var(--md-sys-target-size, 48px);
|
|
117
|
+
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);
|
|
117
118
|
background-color: transparent;
|
|
118
119
|
}
|
|
119
120
|
&.micl-button--toggle.micl-button--selected {
|
|
@@ -125,7 +126,7 @@ button.micl-iconbutton-outlined-xs {
|
|
|
125
126
|
}
|
|
126
127
|
&.micl-iconbutton--wide {
|
|
127
128
|
--micl-width: 40px;
|
|
128
|
-
border-radius: calc(var(--micl-
|
|
129
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
129
130
|
}
|
|
130
131
|
&.micl-button--square {
|
|
131
132
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
@@ -158,9 +159,10 @@ button.micl-iconbutton-outlined-s {
|
|
|
158
159
|
&::before {
|
|
159
160
|
content: "";
|
|
160
161
|
position: absolute;
|
|
161
|
-
block-size: var(--md-sys-target-size);
|
|
162
|
-
inline-size:
|
|
163
|
-
|
|
162
|
+
block-size: var(--md-sys-target-size, 48px);
|
|
163
|
+
inline-size: 100%;
|
|
164
|
+
min-inline-size: var(--md-sys-target-size, 48px);
|
|
165
|
+
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);
|
|
164
166
|
background-color: transparent;
|
|
165
167
|
}
|
|
166
168
|
&.micl-button--toggle.micl-button--selected {
|
|
@@ -172,12 +174,7 @@ button.micl-iconbutton-outlined-s {
|
|
|
172
174
|
}
|
|
173
175
|
&.micl-iconbutton--wide {
|
|
174
176
|
--micl-width: 52px;
|
|
175
|
-
border-radius: calc(var(--micl-
|
|
176
|
-
|
|
177
|
-
&::before {
|
|
178
|
-
inline-size: var(--micl-width);
|
|
179
|
-
inset: calc((40px - var(--md-sys-target-size)) / 2) 0 0 0;
|
|
180
|
-
}
|
|
177
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
181
178
|
}
|
|
182
179
|
&.micl-button--square {
|
|
183
180
|
border-radius: var(--md-sys-shape-corner-medium);
|
|
@@ -215,7 +212,7 @@ button.micl-iconbutton-outlined-m {
|
|
|
215
212
|
}
|
|
216
213
|
&.micl-iconbutton--wide {
|
|
217
214
|
--micl-width: 72px;
|
|
218
|
-
border-radius: calc(var(--micl-
|
|
215
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
219
216
|
}
|
|
220
217
|
&.micl-button--square {
|
|
221
218
|
border-radius: var(--md-sys-shape-corner-large);
|
|
@@ -226,7 +223,7 @@ button.micl-iconbutton-outlined-m {
|
|
|
226
223
|
}
|
|
227
224
|
&:not(:disabled) {
|
|
228
225
|
&:active {
|
|
229
|
-
border-radius: var(--md-sys-shape-corner-
|
|
226
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
230
227
|
}
|
|
231
228
|
}
|
|
232
229
|
}
|
|
@@ -252,7 +249,7 @@ button.micl-iconbutton-outlined-l {
|
|
|
252
249
|
}
|
|
253
250
|
&.micl-iconbutton--wide {
|
|
254
251
|
--micl-width: 128px;
|
|
255
|
-
border-radius: calc(var(--micl-
|
|
252
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
256
253
|
}
|
|
257
254
|
&.micl-button--square {
|
|
258
255
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
@@ -289,7 +286,7 @@ button.micl-iconbutton-outlined-xl {
|
|
|
289
286
|
}
|
|
290
287
|
&.micl-iconbutton--wide {
|
|
291
288
|
--micl-width: 184px;
|
|
292
|
-
border-radius: calc(var(--micl-
|
|
289
|
+
border-radius: calc(var(--micl-height) / 2);
|
|
293
290
|
}
|
|
294
291
|
&.micl-button--square {
|
|
295
292
|
border-radius: var(--md-sys-shape-corner-extra-large);
|
|
@@ -315,6 +312,9 @@ button.micl-iconbutton-standard-l,
|
|
|
315
312
|
button.micl-iconbutton-standard-xl {
|
|
316
313
|
--statelayer-color: var(--md-sys-color-on-surface-variant);
|
|
317
314
|
|
|
315
|
+
&:disabled {
|
|
316
|
+
background-color: transparent;
|
|
317
|
+
}
|
|
318
318
|
&:not(:disabled) {
|
|
319
319
|
&.micl-button--toggle.micl-button--selected {
|
|
320
320
|
--statelayer-color: var(--md-sys-color-primary);
|
|
@@ -416,6 +416,9 @@ button.micl-iconbutton-outlined-xl {
|
|
|
416
416
|
// border: 3px solid var(--md-sys-color-outline);
|
|
417
417
|
border: 3px solid var(--md-sys-color-outline-variant);
|
|
418
418
|
}
|
|
419
|
+
&:disabled {
|
|
420
|
+
background-color: transparent;
|
|
421
|
+
}
|
|
419
422
|
&:not(:disabled) {
|
|
420
423
|
&.micl-button--toggle.micl-button--selected {
|
|
421
424
|
--statelayer-color: var(--md-sys-color-inverse-on-surface);
|
|
@@ -7,7 +7,7 @@ This component implements the [Material Design 3 Expressive List](https://m3.mat
|
|
|
7
7
|
To create a basic list, use the `<ul>` element with the `micl-list` class and individual `<li>` elements for each list item. For a basic single-line item, use the `micl-list-item-one` class:
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
|
-
<ul class="micl-list"
|
|
10
|
+
<ul class="micl-list">
|
|
11
11
|
<li class="micl-list-item-one" tabindex="0">
|
|
12
12
|
<span class="micl-list-item__text">
|
|
13
13
|
<span class="micl-list-item__headline">A single-line item</span>
|
|
@@ -16,8 +16,6 @@ To create a basic list, use the `<ul>` element with the `micl-list` class and in
|
|
|
16
16
|
</ul>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
- The `role="listbox"` is used for accessibility, indicating a selectable list.
|
|
20
|
-
|
|
21
19
|
- `tabindex="0"` on the `<li>` makes the list item focusable and allows keyboard navigation.
|
|
22
20
|
|
|
23
21
|
### CSS
|
|
@@ -54,8 +52,8 @@ The List component offers three CSS classes to control the height and content ca
|
|
|
54
52
|
| micl-list-item-three | For three-line items, accommodating up to three lines of text. |
|
|
55
53
|
|
|
56
54
|
```HTML
|
|
57
|
-
<ul class="micl-list"
|
|
58
|
-
<li class="micl-list-item-three"
|
|
55
|
+
<ul class="micl-list">
|
|
56
|
+
<li class="micl-list-item-three">
|
|
59
57
|
<span class="micl-list-item__text">
|
|
60
58
|
<span class="micl-list-item__headline">A three-line item</span>
|
|
61
59
|
<span class="micl-list-item__supporting-text">Supporting text that is long enough to fill up multiple lines of text with words and sentences.</span>
|
|
@@ -67,7 +65,7 @@ The List component offers three CSS classes to control the height and content ca
|
|
|
67
65
|
Use the anchor element to convert a list item into a hyperlink:
|
|
68
66
|
|
|
69
67
|
```HTML
|
|
70
|
-
<ul class="micl-list"
|
|
68
|
+
<ul class="micl-list">
|
|
71
69
|
<li class="micl-list-item-one" tabindex="0">
|
|
72
70
|
<a href="https://www.thetimes.com" tabindex="-1">
|
|
73
71
|
<span class="micl-list-item__text">
|
|
@@ -80,14 +78,14 @@ Use the anchor element to convert a list item into a hyperlink:
|
|
|
80
78
|
|
|
81
79
|
Adding the `micl-list-item--disabled` class to the `<li>` element causes the list item to be displayed in a disabled state.
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
Use a [Divider component](../divider/README.md) to separate neighbouring list items by a divider.
|
|
84
82
|
|
|
85
83
|
### Leading Content
|
|
86
84
|
The text content of a list item can be preceded by various media elements:
|
|
87
85
|
|
|
88
86
|
- **Icon**: Use `micl-list-item__icon` with a (Material Symbols) icon.
|
|
89
87
|
```HTML
|
|
90
|
-
<li class="micl-list-item-two"
|
|
88
|
+
<li class="micl-list-item-two">
|
|
91
89
|
<span class="material-symbols-outlined micl-list-item__icon" aria-hidden="true">person</span>
|
|
92
90
|
<span class="micl-list-item__text">
|
|
93
91
|
<span class="micl-list-item__headline">Bill Jones</span>
|
|
@@ -98,7 +96,7 @@ The text content of a list item can be preceded by various media elements:
|
|
|
98
96
|
|
|
99
97
|
- **Avatar**: Use `micl-list-item__avatar` with a text.
|
|
100
98
|
```HTML
|
|
101
|
-
<li class="micl-list-item-two"
|
|
99
|
+
<li class="micl-list-item-two">
|
|
102
100
|
<span class="micl-list-item__avatar">BJ</span>
|
|
103
101
|
<span class="micl-list-item__text">
|
|
104
102
|
<span class="micl-list-item__headline">Bill Jones</span>
|
|
@@ -109,7 +107,7 @@ The text content of a list item can be preceded by various media elements:
|
|
|
109
107
|
|
|
110
108
|
- **Image**: Use `micl-list-item__image` with a background image.
|
|
111
109
|
```HTML
|
|
112
|
-
<li class="micl-list-item-two"
|
|
110
|
+
<li class="micl-list-item-two">
|
|
113
111
|
<span class="micl-list-item__image" style="background-image:url(https://...jpg)"></span>
|
|
114
112
|
<span class="micl-list-item__text">
|
|
115
113
|
<span class="micl-list-item__headline">Bill Jones</span>
|
|
@@ -120,7 +118,7 @@ The text content of a list item can be preceded by various media elements:
|
|
|
120
118
|
|
|
121
119
|
- **Thumbnail (Video)**: Use `micl-list-item__thumbnail` for video previews with a background-image.
|
|
122
120
|
```HTML
|
|
123
|
-
<li class="micl-list-item-two"
|
|
121
|
+
<li class="micl-list-item-two">
|
|
124
122
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://...mp4)"></span>
|
|
125
123
|
<span class="micl-list-item__text">
|
|
126
124
|
<span class="micl-list-item__headline">Bill Jones</span>
|
|
@@ -145,7 +143,7 @@ The text of a list item may be followed by a trailing text, imagery or other ele
|
|
|
145
143
|
|
|
146
144
|
- **Text**: Use `micl-list-item__trailing-text` with a short text.
|
|
147
145
|
```HTML
|
|
148
|
-
<li class="micl-list-item-one"
|
|
146
|
+
<li class="micl-list-item-one">
|
|
149
147
|
<span class="micl-list-item__text">
|
|
150
148
|
<span class="micl-list-item__headline">To-do items</span>
|
|
151
149
|
</span>
|
|
@@ -154,10 +152,10 @@ The text of a list item may be followed by a trailing text, imagery or other ele
|
|
|
154
152
|
````
|
|
155
153
|
|
|
156
154
|
### Selecting List Items
|
|
157
|
-
To enable selection of list items, integrate a
|
|
155
|
+
To enable selection of list items, integrate a Checkbox or Switch component within the `<li>` element.
|
|
158
156
|
|
|
159
157
|
```HTML
|
|
160
|
-
<ul class="micl-list
|
|
158
|
+
<ul class="micl-list" role="listbox">
|
|
161
159
|
<li class="micl-list-item-two" tabindex="0">
|
|
162
160
|
<label>
|
|
163
161
|
<span class="micl-list-item__text">
|
|
@@ -167,7 +165,8 @@ To enable selection of list items, integrate a checkbox or switch component with
|
|
|
167
165
|
<input type="checkbox" id="mycheckbox" class="micl-checkbox" value="cb1" tabindex="-1" aria-labelledby="hd1">
|
|
168
166
|
</span>
|
|
169
167
|
</li>
|
|
170
|
-
<li
|
|
168
|
+
<li role="separator" class="micl-divider"></li>
|
|
169
|
+
<li class="micl-list-item-two">
|
|
171
170
|
<label>
|
|
172
171
|
<span class="micl-list-item__text">
|
|
173
172
|
<span id="hd2" class="micl-list-item__headline">Red car</span>
|
|
@@ -181,11 +180,14 @@ To enable selection of list items, integrate a checkbox or switch component with
|
|
|
181
180
|
|
|
182
181
|
- `tabindex="-1"` on the `input` is important here, as the `<li>` should handle the focus for accessibility.
|
|
183
182
|
|
|
183
|
+
- The `role="listbox"` is used for accessibility, indicating a selectable list.
|
|
184
|
+
|
|
184
185
|
## Customizations
|
|
185
186
|
You can customize the appearance of the List component by overriding its global CSS variables. These variables are declared on the `:root` pseudo-class and can be changed on any appropriate parent element to affect its child lists.
|
|
186
187
|
|
|
187
188
|
| Variable name | Default Value | Description |
|
|
188
189
|
| ------------- | ------------- | ----------- |
|
|
190
|
+
| --md-sys-list-padding | 8px | The vertical padding of a list. |
|
|
189
191
|
| --md-sys-list-item-one-height | 56px | The height for a single-line list item. |
|
|
190
192
|
| --md-sys-list-item-two-height | 72px | The height for a two-line list item. |
|
|
191
193
|
| --md-sys-list-item-three-height | 88px | The height for a three-line list item. |
|
|
@@ -199,7 +201,7 @@ You can customize the appearance of the List component by overriding its global
|
|
|
199
201
|
```HTML
|
|
200
202
|
<div style="--md-sys-list-item-one-height:60px">
|
|
201
203
|
<ul class="micl-list">
|
|
202
|
-
<li class="micl-list-item-one"
|
|
204
|
+
<li class="micl-list-item-one">
|
|
203
205
|
<span class="micl-list-item__text">
|
|
204
206
|
<span class="micl-list-item__headline">A single-line item</span>
|
|
205
207
|
</span>
|