material-inspired-component-library 7.0.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +42 -0
- package/README.md +6 -0
- package/components/accordion/README.md +6 -3
- package/components/button/index.scss +10 -6
- package/components/card/README.md +4 -0
- package/components/card/index.scss +159 -150
- package/components/checkbox/index.scss +11 -6
- package/components/datepicker/index.ts +9 -9
- package/components/dialog/index.scss +5 -6
- package/components/iconbutton/index.scss +10 -6
- package/components/list/README.md +191 -32
- package/components/list/index.scss +256 -190
- package/components/list/index.ts +100 -100
- package/components/menu/README.md +199 -10
- package/components/menu/index.scss +224 -47
- package/components/menu/index.ts +74 -37
- package/components/navigationrail/index.scss +75 -69
- package/components/radio/index.scss +11 -6
- package/components/select/README.md +42 -5
- package/components/select/index.scss +39 -79
- package/components/stepper/index.scss +1 -5
- package/components/textfield/index.scss +1 -1
- package/components/textfield/index.ts +2 -2
- package/dist/alert.css +1 -1
- package/dist/appbar.css +1 -1
- package/dist/badge.css +1 -1
- package/dist/bottomsheet.css +1 -1
- package/dist/button.css +1 -1
- package/dist/card.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/components/list/index.d.ts +2 -2
- package/dist/datepicker.css +1 -1
- package/dist/dialog.css +1 -1
- package/dist/divider.css +1 -1
- package/dist/foundations.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/navigationrail.css +1 -1
- package/dist/radio.css +1 -1
- package/dist/select.css +1 -1
- package/dist/sidesheet.css +1 -1
- package/dist/slider.css +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/stepper.css +1 -1
- package/dist/switch.css +1 -1
- package/dist/textfield.css +1 -1
- package/dist/timepicker.css +1 -1
- package/docs/accordion.html +24 -24
- package/docs/bottomsheet.html +1 -4
- package/docs/dialog.html +1 -1
- package/docs/index.html +4 -4
- package/docs/list.html +38 -22
- package/docs/menu.html +246 -41
- package/docs/micl.css +1 -1
- package/docs/micl.js +1 -1
- package/docs/select.html +68 -19
- package/docs/shapes.html +85 -0
- package/foundations/index.scss +0 -1
- package/micl.ts +6 -1
- package/package.json +3 -3
- package/styles/README.md +4 -4
- package/styles/shapes.scss +81 -0
- package/styles/statelayer.scss +10 -0
|
@@ -36,19 +36,18 @@
|
|
|
36
36
|
--md-comp-nav-rail-morph-duration: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
37
37
|
--md-comp-nav-rail-morph-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
38
38
|
|
|
39
|
-
--
|
|
40
|
-
--
|
|
41
|
-
--
|
|
42
|
-
--
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
--
|
|
47
|
-
--
|
|
48
|
-
--
|
|
49
|
-
--
|
|
50
|
-
--
|
|
51
|
-
--_expanded-text-margin: calc(var(--md-comp-nav-rail-item-active-indicator-icon-label-space, 8px) - 16px);
|
|
39
|
+
--_navigationrail-current-max-width: var(--md-comp-nav-rail-collapsed-container-width, 96px);
|
|
40
|
+
--_navigationrail-current-min-width: var(--md-comp-nav-rail-collapsed-container-width, 96px);
|
|
41
|
+
--_navigationrail-item-direction: column;
|
|
42
|
+
--_navigationrail-item-width: var(--md-comp-nav-rail-item-short-container-height, 56px);
|
|
43
|
+
--_navigationrail-item-target-height: var(--_navigationrail-item-base-height);
|
|
44
|
+
|
|
45
|
+
--_navigationrail-content-gap: var(--md-comp-nav-rail-item-container-vertical-space, 6px);
|
|
46
|
+
--_navigationrail-morph-speed: var(--md-comp-nav-rail-morph-duration-reverse);
|
|
47
|
+
--_navigationrail-container-delay: calc(var(--_navigationrail-morph-speed) / 2);
|
|
48
|
+
--_navigationrail-item-delay: 0ms;
|
|
49
|
+
--_navigationrail-text-animation: none;
|
|
50
|
+
--_navigationrail-expanded-text-margin: calc(var(--md-comp-nav-rail-item-active-indicator-icon-label-space, 8px) - 16px);
|
|
52
51
|
|
|
53
52
|
box-sizing: border-box;
|
|
54
53
|
display: flex;
|
|
@@ -70,11 +69,11 @@
|
|
|
70
69
|
interpolate-size: allow-keywords;
|
|
71
70
|
|
|
72
71
|
transition:
|
|
73
|
-
min-inline-size var(--
|
|
74
|
-
max-inline-size var(--
|
|
75
|
-
padding-block-start var(--
|
|
76
|
-
min-inline-size: var(--
|
|
77
|
-
max-inline-size: var(--
|
|
72
|
+
min-inline-size var(--_navigationrail-morph-speed) var(--_navigationrail-container-delay) linear,
|
|
73
|
+
max-inline-size var(--_navigationrail-morph-speed) var(--_navigationrail-container-delay) linear,
|
|
74
|
+
padding-block-start var(--_navigationrail-morph-speed) var(--_navigationrail-container-delay) linear;
|
|
75
|
+
min-inline-size: var(--_navigationrail-current-min-width);
|
|
76
|
+
max-inline-size: var(--_navigationrail-current-max-width);
|
|
78
77
|
|
|
79
78
|
&> .micl-navigationrail__headline {
|
|
80
79
|
padding-inline-start: 28px;
|
|
@@ -87,12 +86,12 @@
|
|
|
87
86
|
flex: 1 1 auto;
|
|
88
87
|
align-items: flex-start;
|
|
89
88
|
inline-size: 100%;
|
|
90
|
-
row-gap: var(--
|
|
89
|
+
row-gap: var(--_navigationrail-content-gap);
|
|
91
90
|
padding-block: var(--md-comp-nav-rail-item-header-space-minimum, 40px) 16px;
|
|
92
91
|
padding-inline: 20px 0;
|
|
93
92
|
|
|
94
93
|
overflow: hidden auto;
|
|
95
|
-
transition: row-gap var(--
|
|
94
|
+
transition: row-gap var(--_navigationrail-morph-speed) linear;
|
|
96
95
|
|
|
97
96
|
&> a.micl-navigationrail__item:focus-visible {
|
|
98
97
|
--statelayer-opacity: var(--md-sys-state-focus-state-layer-opacity, 10%);
|
|
@@ -101,9 +100,9 @@
|
|
|
101
100
|
&> a.micl-navigationrail__item {
|
|
102
101
|
--micl-ripple: 1;
|
|
103
102
|
--statelayer-color: var(--md-sys-color-on-secondary-container);
|
|
104
|
-
--
|
|
105
|
-
--
|
|
106
|
-
--
|
|
103
|
+
--_navigationrail-item-base-height: var(--md-comp-nav-rail-item-short-container-height, 56px);
|
|
104
|
+
--_navigationrail-item-margin-bottom: 0px;
|
|
105
|
+
--_navigationrail-item-padding-block: 12px;
|
|
107
106
|
|
|
108
107
|
box-sizing: border-box;
|
|
109
108
|
display: flex;
|
|
@@ -117,20 +116,25 @@
|
|
|
117
116
|
overflow: visible;
|
|
118
117
|
background-color: transparent;
|
|
119
118
|
background-image:
|
|
120
|
-
radial-gradient(
|
|
119
|
+
radial-gradient(
|
|
120
|
+
circle at var(--micl-x, center) var(--micl-y, center),
|
|
121
|
+
transparent 0%,
|
|
122
|
+
rgb(from var(--statelayer-color) r g b / calc(var(--statelayer-opacity) * var(--md-sys-state-ripple-opacity-factor))) 10%,
|
|
123
|
+
transparent 10%
|
|
124
|
+
),
|
|
121
125
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
122
126
|
background-repeat: no-repeat;
|
|
123
|
-
background-size:
|
|
127
|
+
background-size: 0%, 100%;
|
|
124
128
|
|
|
125
129
|
&:has(.micl-navigationrail__text) {
|
|
126
|
-
--
|
|
127
|
-
--
|
|
128
|
-
--
|
|
130
|
+
--_navigationrail-item-base-height: var(--md-comp-nav-rail-item-vertical-active-indicator-height, 32px);
|
|
131
|
+
--_navigationrail-item-margin-bottom: 40px;
|
|
132
|
+
--_navigationrail-item-padding-block: 0px;
|
|
129
133
|
}
|
|
130
134
|
&:not(:has(.micl-navigationrail__icon)) {
|
|
131
|
-
--
|
|
132
|
-
--
|
|
133
|
-
--
|
|
135
|
+
--_navigationrail-item-base-height: var(--md-comp-nav-rail-item-short-container-height, 56px);
|
|
136
|
+
--_navigationrail-item-margin-bottom: 0px;
|
|
137
|
+
--_navigationrail-item-padding-block: 0px;
|
|
134
138
|
|
|
135
139
|
justify-content: center;
|
|
136
140
|
|
|
@@ -146,28 +150,28 @@
|
|
|
146
150
|
animation: none !important;
|
|
147
151
|
|
|
148
152
|
transition:
|
|
149
|
-
padding-inline calc(var(--
|
|
150
|
-
margin-inline calc(var(--
|
|
153
|
+
padding-inline calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
154
|
+
margin-inline calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear;
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
|
|
154
|
-
inline-size: var(--
|
|
155
|
-
block-size: var(--
|
|
156
|
-
margin-block-end: var(--
|
|
157
|
-
padding-block: var(--
|
|
158
|
-
flex-direction: var(--
|
|
158
|
+
inline-size: var(--_navigationrail-item-width);
|
|
159
|
+
block-size: var(--_navigationrail-item-target-height, var(--_navigationrail-item-base-height));
|
|
160
|
+
margin-block-end: var(--_navigationrail-item-target-margin, var(--_navigationrail-item-margin-bottom));
|
|
161
|
+
padding-block: var(--_navigationrail-item-target-padding, var(--_navigationrail-item-padding-block));
|
|
162
|
+
flex-direction: var(--_navigationrail-item-direction);
|
|
159
163
|
|
|
160
|
-
border-radius: calc(var(--
|
|
164
|
+
border-radius: calc(var(--_navigationrail-item-target-height, var(--_navigationrail-item-base-height)) / 2);
|
|
161
165
|
|
|
162
166
|
transition:
|
|
163
|
-
inline-size calc(var(--
|
|
164
|
-
block-size calc(var(--
|
|
165
|
-
margin-block-end calc(var(--
|
|
166
|
-
padding-block calc(var(--
|
|
167
|
-
border-radius calc(var(--
|
|
168
|
-
flex-direction 0s calc(var(--
|
|
169
|
-
background-color calc(var(--
|
|
170
|
-
background-size
|
|
167
|
+
inline-size calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
168
|
+
block-size calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
169
|
+
margin-block-end calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
170
|
+
padding-block calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
171
|
+
border-radius calc(var(--_navigationrail-morph-speed) / 2) var(--_navigationrail-item-delay) linear,
|
|
172
|
+
flex-direction 0s calc(var(--_navigationrail-morph-speed) / 2) linear allow-discrete,
|
|
173
|
+
background-color calc(var(--_navigationrail-morph-speed) / 2) linear,
|
|
174
|
+
background-size 0ms,
|
|
171
175
|
--statelayer-opacity var(--md-comp-nav-rail-motion-duration) linear;
|
|
172
176
|
|
|
173
177
|
.micl-navigationrail__icon {
|
|
@@ -185,7 +189,7 @@
|
|
|
185
189
|
margin: 4px 0px 0px 0px;
|
|
186
190
|
color: var(--md-sys-color-on-surface-variant);
|
|
187
191
|
overflow: hidden;
|
|
188
|
-
animation: var(--
|
|
192
|
+
animation: var(--_navigationrail-text-animation);
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
&:hover {
|
|
@@ -193,8 +197,10 @@
|
|
|
193
197
|
}
|
|
194
198
|
&:active {
|
|
195
199
|
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
196
|
-
|
|
197
|
-
|
|
200
|
+
transition-duration: 0ms, 0ms, 0ms, calc(var(--_navigationrail-morph-speed) / 2), 0ms, var(--md-comp-nav-rail-motion-duration);
|
|
201
|
+
}
|
|
202
|
+
&.micl-rippling {
|
|
203
|
+
animation: micl-ripple var(--md-sys-state-ripple-duration) motion.$md-sys-motion-easing-standard;
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -239,20 +245,20 @@
|
|
|
239
245
|
|
|
240
246
|
dialog.micl-navigationrail,
|
|
241
247
|
nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--selected) {
|
|
242
|
-
--
|
|
243
|
-
--
|
|
244
|
-
--
|
|
245
|
-
--
|
|
248
|
+
--_navigationrail-current-max-width: var(--md-comp-nav-rail-expanded-container-width-maximum, 360px);
|
|
249
|
+
--_navigationrail-current-min-width: var(--md-comp-nav-rail-expanded-container-width-minimum, 220px);
|
|
250
|
+
--_navigationrail-item-direction: row;
|
|
251
|
+
--_navigationrail-item-width: fit-content;
|
|
246
252
|
|
|
247
|
-
--
|
|
248
|
-
--
|
|
249
|
-
--
|
|
253
|
+
--_navigationrail-item-target-height: var(--md-comp-nav-rail-item-short-container-height, 56px);
|
|
254
|
+
--_navigationrail-item-target-margin: 0px;
|
|
255
|
+
--_navigationrail-item-target-padding: 16px;
|
|
250
256
|
|
|
251
|
-
--
|
|
252
|
-
--
|
|
253
|
-
--
|
|
254
|
-
--
|
|
255
|
-
--
|
|
257
|
+
--_navigationrail-content-gap: 0px;
|
|
258
|
+
--_navigationrail-morph-speed: var(--md-comp-nav-rail-morph-duration);
|
|
259
|
+
--_navigationrail-container-delay: 0ms;
|
|
260
|
+
--_navigationrail-item-delay: calc(var(--_navigationrail-morph-speed) / 2);
|
|
261
|
+
--_navigationrail-text-animation: var(--_navigationrail-morph-speed) linear forwards navigationrail-text-to-expanded;
|
|
256
262
|
|
|
257
263
|
padding-block: var(--md-comp-nav-rail-expanded-top-space, 44px) 0;
|
|
258
264
|
border-radius: var(--md-comp-nav-rail-expanded-container-shape, 0px);
|
|
@@ -269,7 +275,7 @@ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
|
|
|
269
275
|
}
|
|
270
276
|
.micl-navigationrail__text {
|
|
271
277
|
@include typography.label-large;
|
|
272
|
-
margin-inline-start: var(--
|
|
278
|
+
margin-inline-start: var(--_navigationrail-expanded-text-margin);
|
|
273
279
|
padding-inline-end: 16px;
|
|
274
280
|
}
|
|
275
281
|
|
|
@@ -281,8 +287,8 @@ nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggl
|
|
|
281
287
|
}
|
|
282
288
|
|
|
283
289
|
nav.micl-navigationrail:has(> .micl-navigationrail__headline .micl-button--toggle.micl-button--toggled:not(.micl-button--selected)) {
|
|
284
|
-
--
|
|
285
|
-
--
|
|
290
|
+
--_navigationrail-morph-speed: var(--md-comp-nav-rail-morph-duration-reverse);
|
|
291
|
+
--_navigationrail-text-animation: var(--_navigationrail-morph-speed) linear forwards navigationrail-text-to-collapsed;
|
|
286
292
|
}
|
|
287
293
|
|
|
288
294
|
nav.micl-navigationrail {
|
|
@@ -324,14 +330,14 @@ dialog.micl-navigationrail {
|
|
|
324
330
|
0% {
|
|
325
331
|
@include typography.label-large;
|
|
326
332
|
margin-block-start: 0;
|
|
327
|
-
margin-inline-start: var(--
|
|
333
|
+
margin-inline-start: var(--_navigationrail-expanded-text-margin);
|
|
328
334
|
padding-inline-end: 16px;
|
|
329
335
|
opacity: 100%
|
|
330
336
|
}
|
|
331
337
|
49.9% {
|
|
332
338
|
@include typography.label-large;
|
|
333
339
|
margin-block-start: 0;
|
|
334
|
-
margin-inline-start: var(--
|
|
340
|
+
margin-inline-start: var(--_navigationrail-expanded-text-margin);
|
|
335
341
|
padding-inline-end: 16px;
|
|
336
342
|
opacity: 0%;
|
|
337
343
|
}
|
|
@@ -373,14 +379,14 @@ dialog.micl-navigationrail {
|
|
|
373
379
|
50.1% {
|
|
374
380
|
@include typography.label-large;
|
|
375
381
|
margin-block-start: 0px;
|
|
376
|
-
margin-inline-start: var(--
|
|
382
|
+
margin-inline-start: var(--_navigationrail-expanded-text-margin);
|
|
377
383
|
padding-inline-end: 16px;
|
|
378
384
|
opacity: 0%;
|
|
379
385
|
}
|
|
380
386
|
100% {
|
|
381
387
|
@include typography.label-large;
|
|
382
388
|
margin-block-start: 0px;
|
|
383
|
-
margin-inline-start: var(--
|
|
389
|
+
margin-inline-start: var(--_navigationrail-expanded-text-margin);
|
|
384
390
|
padding-inline-end: 16px;
|
|
385
391
|
opacity: 100%;
|
|
386
392
|
}
|
|
@@ -77,13 +77,18 @@ input[type=radio].micl-radio {
|
|
|
77
77
|
--micl-ripple: 1;
|
|
78
78
|
|
|
79
79
|
background-image:
|
|
80
|
-
radial-gradient(
|
|
80
|
+
radial-gradient(
|
|
81
|
+
circle at var(--micl-x, center) var(--micl-y, center),
|
|
82
|
+
transparent 0%,
|
|
83
|
+
rgb(from var(--statelayer-color) r g b / calc(var(--statelayer-opacity) * var(--md-sys-state-ripple-opacity-factor))) 10%,
|
|
84
|
+
transparent 10%
|
|
85
|
+
),
|
|
81
86
|
linear-gradient(rgb(from var(--statelayer-color) r g b / var(--statelayer-opacity)));
|
|
82
87
|
background-repeat: no-repeat;
|
|
83
|
-
background-size:
|
|
88
|
+
background-size: 0%, 100%;
|
|
84
89
|
cursor: pointer;
|
|
85
90
|
transition:
|
|
86
|
-
background-size
|
|
91
|
+
background-size 0ms,
|
|
87
92
|
--statelayer-opacity var(--md-sys-radio-motion-duration) linear;
|
|
88
93
|
|
|
89
94
|
&:hover,
|
|
@@ -111,9 +116,9 @@ input[type=radio].micl-radio {
|
|
|
111
116
|
}
|
|
112
117
|
&:active {
|
|
113
118
|
--statelayer-opacity: var(--md-sys-state-pressed-state-layer-opacity, 10%);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
}
|
|
120
|
+
&.micl-rippling {
|
|
121
|
+
animation: micl-ripple var(--md-sys-state-ripple-duration) motion.$md-sys-motion-easing-standard;
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
&:disabled {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Select
|
|
2
|
-
This component implements the [Material Design 3 Expressive Select](https://m3.material.io/components/menus/guidelines#ee2f3664-c926-47ab-acbf-2ab675506932) design. A select component is used to
|
|
2
|
+
This component implements the [Material Design 3 Expressive Select](https://m3.material.io/components/menus/guidelines#ee2f3664-c926-47ab-acbf-2ab675506932) design. A select component is used to present the user with a set of options from which one can be chosen.
|
|
3
3
|
|
|
4
4
|
## Basic Usage
|
|
5
5
|
|
|
6
6
|
### HTML
|
|
7
|
-
The Select component is an extension of the [Text field](../textfield/README.md) and the [
|
|
7
|
+
The Select component is an extension of the [Text field](../textfield/README.md) and the [Menu](../menu/README.md) components. It can be either `filled` or `outlined`. To create a basic select, use the following HTML and swap the class name to change the style.
|
|
8
8
|
|
|
9
9
|
```HTML
|
|
10
10
|
<div class="micl-textfield-filled">
|
|
@@ -21,10 +21,11 @@ The Select component is an extension of the [Text field](../textfield/README.md)
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### CSS
|
|
24
|
-
The Select component relies on styles from the text field and list components. Be sure to import all
|
|
24
|
+
The Select component relies on styles from the text field, menu and list components. Be sure to import all four styles into your project.
|
|
25
25
|
|
|
26
26
|
```CSS
|
|
27
27
|
@use "material-inspired-component-library/dist/list";
|
|
28
|
+
@use "material-inspired-component-library/dist/menu";
|
|
28
29
|
@use "material-inspired-component-library/dist/textfield";
|
|
29
30
|
@use "material-inspired-component-library/dist/select";
|
|
30
31
|
```
|
|
@@ -61,7 +62,7 @@ You can add [Dividers](../divider/README.md) into the list of options and they w
|
|
|
61
62
|
<option class="micl-list-item-two" value="AR">
|
|
62
63
|
<span class="micl-list-item__text">Argentina</span>
|
|
63
64
|
</option>
|
|
64
|
-
<hr class="micl-divider">
|
|
65
|
+
<hr class="micl-divider-inset">
|
|
65
66
|
<option class="micl-list-item-two" value="BO">
|
|
66
67
|
<span class="micl-list-item__text">Bolivia</span>
|
|
67
68
|
</option>
|
|
@@ -97,7 +98,7 @@ The text content of an option can be preceded by various media elements:
|
|
|
97
98
|
</option>
|
|
98
99
|
```
|
|
99
100
|
|
|
100
|
-
- **Thumbnail**: Use `micl-list-item__thumbnail` for video previews
|
|
101
|
+
- **Thumbnail**: Use `micl-list-item__thumbnail` for thumbnail imagery (e.g. video previews or photos).
|
|
101
102
|
```HTML
|
|
102
103
|
<option class="micl-list-item-two" value="AR">
|
|
103
104
|
<span class="micl-list-item__thumbnail" style="background-image:url(https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Flag_of_Argentina.svg/330px-Flag_of_Argentina.svg.png)"></span>
|
|
@@ -105,5 +106,41 @@ The text content of an option can be preceded by various media elements:
|
|
|
105
106
|
</option>
|
|
106
107
|
```
|
|
107
108
|
|
|
109
|
+
**Example: Grouping options**
|
|
110
|
+
|
|
111
|
+
Options can be grouped by using the `<optgroup>` element. Add a `<legend>` element with the `micl-menu__section` class to provide a label for the option group.
|
|
112
|
+
|
|
113
|
+
```HTML
|
|
114
|
+
<div class="micl-textfield-outlined">
|
|
115
|
+
<label for="myselect">Country</label>
|
|
116
|
+
<select id="myselect">
|
|
117
|
+
<option class="micl-list-item-one" value=""></option>
|
|
118
|
+
<optgroup>
|
|
119
|
+
<legend class="micl-menu__section">North American Countries</legend>
|
|
120
|
+
<option class="micl-list-item-one" value="CA">
|
|
121
|
+
<span class="micl-list-item__text">Canada</span>
|
|
122
|
+
</option>
|
|
123
|
+
</optgroup>
|
|
124
|
+
<hr class="micl-divider-inset">
|
|
125
|
+
<optgroup>
|
|
126
|
+
<legend class="micl-menu__section">South American Countries</legend>
|
|
127
|
+
<option class="micl-list-item-two" value="CL">
|
|
128
|
+
<span class="micl-list-item__text">Chile</span>
|
|
129
|
+
</option>
|
|
130
|
+
</optgroup>
|
|
131
|
+
</select>
|
|
132
|
+
</div>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Customizations
|
|
136
|
+
You can customize the appearance of the Select 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 selects.
|
|
137
|
+
|
|
138
|
+
| Variable name | Default Value | Description |
|
|
139
|
+
| ------------------------------ | ------------- | ----------- |
|
|
140
|
+
| --md-comp-select-line-height | | The vertical line-height applied to the closed `<select>` element |
|
|
141
|
+
| --md-comp-select-picker-origin | left top | The transform-origin used for the open/close scale animation of the option pick-list |
|
|
142
|
+
|
|
143
|
+
The Select component supports the CSS variables listed for the [Menu](../menu/README.md) component.
|
|
144
|
+
|
|
108
145
|
## Compatibility
|
|
109
146
|
This component uses modern browser features to style the `<select>` element, which may not be fully supported in all browsers. Browsers that do not support these features will display a default select menu. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/::picker#browser_compatibility) for details.
|
|
@@ -27,27 +27,24 @@
|
|
|
27
27
|
@use '../../styles/typography';
|
|
28
28
|
|
|
29
29
|
.micl-textfield-filled > select {
|
|
30
|
-
--md-
|
|
30
|
+
--md-comp-select-line-height: calc(var(--md-sys-textfield-height) - 18px - 3px);
|
|
31
31
|
}
|
|
32
32
|
.micl-textfield-outlined > select {
|
|
33
|
-
--md-
|
|
33
|
+
--md-comp-select-line-height: var(--md-sys-textfield-height);
|
|
34
34
|
}
|
|
35
35
|
.micl-textfield-filled > select,
|
|
36
36
|
.micl-textfield-outlined > select {
|
|
37
37
|
--md-sys-divider-space: 8px;
|
|
38
|
-
--md-
|
|
39
|
-
--md-
|
|
40
|
-
--md-sys-select-motion-duration: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
41
|
-
--md-sys-select-motion-duration-reverse: #{motion.$md-sys-motion-expressive-fast-spatial-duration};
|
|
42
|
-
--md-sys-select-picker-origin: left top;
|
|
38
|
+
--md-comp-list-motion-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
39
|
+
--md-comp-select-picker-origin: left top;
|
|
43
40
|
|
|
44
41
|
appearance: base-select;
|
|
45
|
-
line-height: var(--md-
|
|
42
|
+
line-height: var(--md-comp-select-line-height);
|
|
46
43
|
|
|
47
44
|
&::picker-icon {
|
|
48
45
|
color: var(--md-sys-color-on-surface-variant);
|
|
49
46
|
transition: motion.$md-sys-motion-duration-medium4 rotate;
|
|
50
|
-
transform-origin: 50% calc((var(--md-
|
|
47
|
+
transform-origin: 50% calc((var(--md-comp-select-line-height) / 2) - 1px);
|
|
51
48
|
}
|
|
52
49
|
&:disabled::picker-icon {
|
|
53
50
|
color: rgb(from var(--md-sys-color-on-surface-variant) r g b/var(--md-sys-state-disabled-state-layer-opacity, 38%));
|
|
@@ -55,35 +52,48 @@
|
|
|
55
52
|
&:open::picker-icon {
|
|
56
53
|
rotate: 180deg;
|
|
57
54
|
}
|
|
55
|
+
|
|
58
56
|
&::picker(select) {
|
|
57
|
+
--md-comp-list-motion-effects: #{motion.$md-sys-motion-expressive-fast-spatial};
|
|
58
|
+
--md-comp-list-motion-duration: #{motion.$md-sys-motion-expressive-default-effects-duration};
|
|
59
|
+
--md-sys-divider-space: 0.5px;
|
|
60
|
+
--_list-shape: var(--md-comp-list-container-shape, var(--md-sys-shape-corner-large, 16px));
|
|
61
|
+
--_list-item-background-color: var(--md-comp-list-item-container-color, transparent);
|
|
62
|
+
--_list-item-background-opacity: 0%;
|
|
63
|
+
|
|
59
64
|
appearance: base-select;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
position-try: most-block-size
|
|
63
|
-
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
position-try-order: most-block-size;
|
|
68
|
+
position-try-fallbacks: flip-block, flip-inline;
|
|
69
|
+
min-inline-size: max(anchor-size(self-inline), var(--md-comp-menu-width-min, 112px));
|
|
70
|
+
max-inline-size: var(--md-comp-menu-width-max, 320px);
|
|
71
|
+
gap: var(--md-comp-menu-gap, 2px);
|
|
72
|
+
padding: 4px;
|
|
73
|
+
border-radius: var(--_list-shape);
|
|
64
74
|
border: none;
|
|
65
|
-
|
|
66
|
-
background-color: var(--md-sys-color-surface-container);
|
|
67
|
-
box-shadow: var(--md-sys-elevation-level2);
|
|
75
|
+
outline: none;
|
|
76
|
+
background-color: var(--md-comp-menu-standard-container-color, var(--md-sys-color-surface-container-low));
|
|
77
|
+
box-shadow: var(--md-comp-menu-container-elevation, var(--md-sys-elevation-level2));
|
|
68
78
|
opacity: 0;
|
|
69
79
|
overflow-x: hidden;
|
|
70
80
|
overflow-y: auto;
|
|
71
81
|
transform: scaleY(0);
|
|
72
|
-
transform-origin: var(--md-
|
|
82
|
+
transform-origin: var(--md-comp-select-picker-origin, left top);
|
|
73
83
|
transition:
|
|
74
|
-
opacity var(--md-
|
|
75
|
-
transform var(--md-
|
|
76
|
-
overlay var(--md-
|
|
77
|
-
display var(--md-
|
|
84
|
+
opacity var(--md-comp-menu-motion-spatial-duration-reverse) linear,
|
|
85
|
+
transform var(--md-comp-menu-motion-spatial-duration-reverse) var(--md-comp-menu-motion-spatial),
|
|
86
|
+
overlay var(--md-comp-menu-motion-spatial-duration-reverse) linear allow-discrete,
|
|
87
|
+
display var(--md-comp-menu-motion-spatial-duration-reverse) linear allow-discrete;
|
|
78
88
|
|
|
79
89
|
&:popover-open {
|
|
80
90
|
opacity: 1;
|
|
81
91
|
transform: scaleY(1);
|
|
82
92
|
transition:
|
|
83
|
-
opacity var(--md-
|
|
84
|
-
transform var(--md-
|
|
85
|
-
overlay var(--md-
|
|
86
|
-
display var(--md-
|
|
93
|
+
opacity var(--md-comp-menu-motion-spatial-duration) motion.$md-sys-motion-easing-emphasized-decelerate,
|
|
94
|
+
transform var(--md-comp-menu-motion-spatial-duration) var(--md-comp-menu-motion-spatial),
|
|
95
|
+
overlay var(--md-comp-menu-motion-spatial-duration) linear allow-discrete,
|
|
96
|
+
display var(--md-comp-menu-motion-spatial-duration) linear allow-discrete;
|
|
87
97
|
|
|
88
98
|
@starting-style {
|
|
89
99
|
opacity: 0;
|
|
@@ -93,50 +103,10 @@
|
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
option {
|
|
96
|
-
--md-sys-list-item-one-height: 48px;
|
|
97
|
-
--md-sys-list-item-two-height: 64px;
|
|
98
|
-
--md-sys-list-item-one-padding: 0;
|
|
99
|
-
--md-sys-list-item-two-padding: 0;
|
|
100
|
-
--md-sys-list-item-space: 12px;
|
|
101
|
-
--md-sys-list-item-container-color: var(--md-sys-color-surface-container);
|
|
102
|
-
|
|
103
106
|
line-height: normal;
|
|
104
|
-
background-color: transparent;
|
|
105
|
-
|
|
106
|
-
&:not(:disabled) {
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
}
|
|
109
|
-
&:checked {
|
|
110
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
111
|
-
|
|
112
|
-
.micl-list-item__text {
|
|
113
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
114
|
-
|
|
115
|
-
&::after {
|
|
116
|
-
color: var(--md-sys-color-on-surface);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
&:focus-visible {
|
|
121
|
-
outline-offset: calc(-1 * var(--md-sys-state-focus-indicator-thickness, 3px));
|
|
122
|
-
z-index: 1;
|
|
123
|
-
}
|
|
124
107
|
|
|
125
|
-
.micl-list-item__text {
|
|
126
|
-
@include typography.body-large;
|
|
127
|
-
|
|
128
|
-
color: var(--md-sys-color-on-surface);
|
|
129
|
-
white-space: normal;
|
|
130
|
-
}
|
|
131
108
|
.micl-list-item__text::after {
|
|
132
|
-
@include typography.body-medium;
|
|
133
|
-
|
|
134
109
|
content: attr(aria-description);
|
|
135
|
-
display: block;
|
|
136
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
137
|
-
overflow-x: hidden;
|
|
138
|
-
text-overflow: ellipsis;
|
|
139
|
-
white-space: nowrap;
|
|
140
110
|
}
|
|
141
111
|
&::checkmark {
|
|
142
112
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -144,20 +114,10 @@
|
|
|
144
114
|
}
|
|
145
115
|
}
|
|
146
116
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/* inset-block-start: 0; */
|
|
152
|
-
/* inset-inline-start: 0; */
|
|
153
|
-
/* margin: auto; */
|
|
154
|
-
/* transform: scale(50%); */
|
|
155
|
-
|
|
156
|
-
/* &:popover-open, */
|
|
157
|
-
/* &[open] { */
|
|
158
|
-
/* transform: scale(100%); */
|
|
159
|
-
/* } */
|
|
160
|
-
/* } */
|
|
117
|
+
[inert] .micl-textfield-filled > select::picker-icon,
|
|
118
|
+
[inert] .micl-textfield-outlined > select::picker-icon {
|
|
119
|
+
display: none;
|
|
120
|
+
}
|
|
161
121
|
|
|
162
122
|
[dir=rtl] {
|
|
163
123
|
.micl-textfield-filled > select,
|
|
@@ -41,7 +41,6 @@ body {
|
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
row-gap: var(--md-sys-padding-xl, 24px);
|
|
43
43
|
margin: 0;
|
|
44
|
-
background-color: inherit;
|
|
45
44
|
|
|
46
45
|
.micl-stepper__header {
|
|
47
46
|
--md-sys-stepper-dot-size: 24px;
|
|
@@ -50,7 +49,6 @@ body {
|
|
|
50
49
|
justify-content: space-between;
|
|
51
50
|
align-items: flex-start;
|
|
52
51
|
margin-inline: -10px;
|
|
53
|
-
background-color: inherit;
|
|
54
52
|
background-image: linear-gradient(90deg, var(--md-sys-divider-color), var(--md-sys-divider-color));
|
|
55
53
|
background-position: center;
|
|
56
54
|
background-repeat: no-repeat;
|
|
@@ -58,7 +56,7 @@ body {
|
|
|
58
56
|
counter-reset: dotnumber;
|
|
59
57
|
|
|
60
58
|
button {
|
|
61
|
-
background-color: inherit;
|
|
59
|
+
background-color: var(--_card-background-color, inherit);
|
|
62
60
|
pointer-events: none;
|
|
63
61
|
|
|
64
62
|
&.micl-stepper__progress--done {
|
|
@@ -76,7 +74,6 @@ body {
|
|
|
76
74
|
display: grid;
|
|
77
75
|
grid-template-areas: "stepper-steps";
|
|
78
76
|
overflow-x: hidden;
|
|
79
|
-
background-color: inherit;
|
|
80
77
|
|
|
81
78
|
.micl-stepper__step {
|
|
82
79
|
grid-area: stepper-steps;
|
|
@@ -87,7 +84,6 @@ body {
|
|
|
87
84
|
padding: 0;
|
|
88
85
|
border: none;
|
|
89
86
|
opacity: 0%;
|
|
90
|
-
background-color: inherit;
|
|
91
87
|
transform: translateX(100%);
|
|
92
88
|
transition:
|
|
93
89
|
opacity var(--md-sys-stepper-motion-duration) linear,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
margin-block-start: calc((var(--md-sys-textfield-height) - var(--md-sys-typescale-body-large-line-height)) / 2);
|
|
54
54
|
margin-inline: 12px 4px;
|
|
55
55
|
border-radius: 4px;
|
|
56
|
-
background-color: inherit;
|
|
56
|
+
background-color: var(--_dialog-background-color, var(--_card-background-color, inherit));
|
|
57
57
|
color: var(--md-sys-color-on-surface-variant);
|
|
58
58
|
z-index: 1;
|
|
59
59
|
transition:
|
|
@@ -72,7 +72,7 @@ export default (() =>
|
|
|
72
72
|
const segment = value.substring(valueIndex, valueIndex + comp.length);
|
|
73
73
|
formattedValue += segment;
|
|
74
74
|
valueIndex += segment.length;
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
if (segment.length === comp.length && comp.separator) {
|
|
77
77
|
formattedValue += comp.separator;
|
|
78
78
|
}
|
|
@@ -140,7 +140,7 @@ export default (() =>
|
|
|
140
140
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
141
141
|
|
|
142
142
|
!input.matches(':open') && input.style.setProperty(
|
|
143
|
-
'--md-
|
|
143
|
+
'--md-comp-select-picker-origin',
|
|
144
144
|
spaceAbove > spaceBelow ? 'left bottom' : 'left top'
|
|
145
145
|
);
|
|
146
146
|
});
|