material-inspired-component-library 9.1.1 → 9.1.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/appbar/index.scss +1 -1
- package/components/badge/README.md +43 -12
- package/components/badge/index.scss +15 -21
- package/components/bottomsheet/README.md +53 -22
- package/components/bottomsheet/index.scss +61 -44
- package/components/button/_shared.scss +6 -6
- package/components/card/README.md +1 -1
- package/components/checkbox/index.scss +10 -10
- package/components/datepicker/README.md +184 -59
- package/components/datepicker/index.scss +84 -20
- package/components/dialog/README.md +151 -56
- package/components/dialog/index.scss +50 -62
- package/components/iconbutton/index.scss +5 -5
- package/components/list/index.scss +6 -6
- package/components/menu/index.scss +13 -13
- package/components/navigationbar/index.scss +7 -1
- package/components/navigationrail/index.scss +27 -22
- package/components/radio/index.scss +8 -8
- package/components/select/index.scss +3 -3
- package/components/sidesheet/README.md +90 -37
- package/components/sidesheet/index.scss +51 -41
- package/components/slider/README.md +35 -9
- package/components/slider/index.scss +182 -153
- package/components/snackbar/README.md +43 -25
- package/components/snackbar/index.scss +22 -27
- package/components/stepper/index.scss +4 -4
- package/components/switch/index.scss +13 -13
- package/components/timepicker/README.md +131 -55
- package/components/timepicker/index.scss +46 -25
- package/dist/appbar.css +1 -1
- package/dist/badge.css +1 -1
- package/dist/bottomsheet.css +1 -1
- package/dist/bottomsheet.js +1 -1
- package/dist/button.css +1 -1
- package/dist/checkbox.css +1 -1
- package/dist/chip.css +1 -1
- package/dist/datepicker.css +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/dialog.css +1 -1
- package/dist/iconbutton.css +1 -1
- package/dist/layout.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/navigationbar.css +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/slider.js +1 -1
- package/dist/snackbar.css +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/stepper.css +1 -1
- package/dist/switch.css +1 -1
- package/dist/timepicker.css +1 -1
- package/dist/timepicker.js +1 -1
- package/foundations/layout/_tokens.scss +55 -0
- package/foundations/layout/index.scss +2 -35
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
20
|
// SOFTWARE.
|
|
21
21
|
|
|
22
|
-
@use '../../foundations/layout';
|
|
22
|
+
@use '../../foundations/layout/tokens';
|
|
23
23
|
@use '../../styles/elevation';
|
|
24
24
|
@use '../../styles/motion';
|
|
25
25
|
@use '../../styles/shape';
|
|
@@ -36,33 +36,32 @@
|
|
|
36
36
|
|
|
37
37
|
@include typography.scale('title-large');
|
|
38
38
|
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
--md-comp-sidesheet-container-max-width: 400px;
|
|
42
|
-
--md-comp-sidesheet-padding: var(--md-sys-layout-window-margin, 24px);
|
|
43
|
-
}
|
|
44
|
-
body {
|
|
45
|
-
--md-comp-sidesheet-motion-spatial: #{motion.$md-sys-motion-expressive-slow-spatial};
|
|
46
|
-
--md-comp-sidesheet-motion-duration: #{motion.$md-sys-motion-expressive-slow-spatial-duration};
|
|
47
|
-
--md-comp-sidesheet-motion-duration-reverse: #{motion.$md-sys-motion-expressive-default-spatial-duration};
|
|
48
|
-
}
|
|
39
|
+
$container-width: 256px;
|
|
40
|
+
$container-max-width: 400px;
|
|
49
41
|
|
|
50
42
|
dialog.micl-sidesheet {
|
|
43
|
+
--_width: min(var(--md-comp-sidesheet-container-width, #{$container-width}), var(--md-comp-sidesheet-container-max-width, #{$container-max-width}));
|
|
44
|
+
--_padding: var(--md-comp-sidesheet-padding, var(--md-sys-layout-window-margin, 24px));
|
|
45
|
+
--_motion-spatial: var(--md-comp-sidesheet-motion-spatial, #{motion.$md-sys-motion-expressive-slow-spatial});
|
|
46
|
+
--_motion-duration: var(--md-comp-sidesheet-motion-duration, #{motion.$md-sys-motion-expressive-slow-spatial-duration});
|
|
47
|
+
--_motion-duration-reverse: var(--md-comp-sidesheet-motion-duration-reverse, #{motion.$md-sys-motion-expressive-default-spatial-duration});
|
|
48
|
+
|
|
51
49
|
--micl-spring-buffer: 40px;
|
|
52
|
-
--micl-duration: var(--
|
|
50
|
+
--micl-duration: var(--_motion-duration-reverse);
|
|
53
51
|
|
|
54
52
|
box-sizing: border-box;
|
|
55
53
|
display: none;
|
|
56
54
|
flex-direction: column;
|
|
57
|
-
|
|
58
|
-
max-inline-size:
|
|
59
|
-
block-size:
|
|
60
|
-
|
|
55
|
+
inline-size: calc(var(--_width) + var(--micl-spring-buffer));
|
|
56
|
+
max-inline-size: none;
|
|
57
|
+
block-size: 100dvb;
|
|
58
|
+
max-block-size: none;
|
|
61
59
|
margin-block: 0;
|
|
62
60
|
margin-inline-start: auto;
|
|
63
|
-
margin-inline-end: calc(-1 * (var(--
|
|
64
|
-
padding-block: var(--
|
|
61
|
+
margin-inline-end: calc(-1 * (var(--_width) + var(--micl-spring-buffer)));
|
|
62
|
+
padding-block: var(--_padding) 0;
|
|
65
63
|
padding-inline: 0 var(--micl-spring-buffer);
|
|
64
|
+
color: var(--md-comp-sidesheet-content-color, var(--md-sys-color-on-surface));
|
|
66
65
|
background-color: var(--md-comp-sidesheet-standard-container-color, var(--md-sys-color-surface));
|
|
67
66
|
border: none;
|
|
68
67
|
border-radius: var(--md-comp-sidesheet-container-shape, var(--md-sys-shape-corner-none));
|
|
@@ -71,15 +70,15 @@ dialog.micl-sidesheet {
|
|
|
71
70
|
overflow: hidden;
|
|
72
71
|
transition:
|
|
73
72
|
opacity var(--micl-duration) linear,
|
|
74
|
-
margin-inline-end var(--micl-duration) var(--
|
|
73
|
+
margin-inline-end var(--micl-duration) var(--_motion-spatial),
|
|
75
74
|
overlay var(--micl-duration) linear allow-discrete,
|
|
76
75
|
display var(--micl-duration) linear allow-discrete;
|
|
77
76
|
|
|
78
77
|
.micl-sidesheet__headline {
|
|
79
78
|
display: flex;
|
|
80
79
|
align-items: center;
|
|
81
|
-
block-size: var(--md-
|
|
82
|
-
padding-inline: var(--
|
|
80
|
+
min-block-size: var(--md-comp-sidesheet-headline-height, 40px);
|
|
81
|
+
padding-inline: var(--_padding);
|
|
83
82
|
margin-block-end: 16px;
|
|
84
83
|
column-gap: 12px;
|
|
85
84
|
color: var(--md-sys-color-on-surface-variant);
|
|
@@ -92,19 +91,16 @@ dialog.micl-sidesheet {
|
|
|
92
91
|
overflow: hidden;
|
|
93
92
|
text-overflow: ellipsis;
|
|
94
93
|
white-space: nowrap;
|
|
95
|
-
user-select: none;
|
|
96
94
|
}
|
|
97
95
|
button {
|
|
98
|
-
margin-inline: -
|
|
99
|
-
}
|
|
100
|
-
button:first-child {
|
|
101
|
-
margin-inline-start: -16px;
|
|
96
|
+
margin-inline: -8px;
|
|
102
97
|
}
|
|
103
98
|
}
|
|
104
99
|
.micl-sidesheet__content {
|
|
105
100
|
box-sizing: border-box;
|
|
106
101
|
flex: 1 1 auto;
|
|
107
|
-
padding-
|
|
102
|
+
padding-block-end: var(--_padding);
|
|
103
|
+
padding-inline: var(--_padding);
|
|
108
104
|
overflow: hidden auto;
|
|
109
105
|
}
|
|
110
106
|
.micl-sidesheet__actions {
|
|
@@ -113,8 +109,8 @@ dialog.micl-sidesheet {
|
|
|
113
109
|
flex-shrink: 0;
|
|
114
110
|
align-items: center;
|
|
115
111
|
justify-content: start;
|
|
116
|
-
padding-block: 16px var(--
|
|
117
|
-
padding-inline: var(--
|
|
112
|
+
padding-block: 16px var(--_padding);
|
|
113
|
+
padding-inline: var(--_padding);
|
|
118
114
|
column-gap: 8px;
|
|
119
115
|
overflow: hidden;
|
|
120
116
|
}
|
|
@@ -126,18 +122,18 @@ dialog.micl-sidesheet {
|
|
|
126
122
|
box-shadow: var(--md-comp-sidesheet-modal-container-elevation, var(--md-sys-elevation-level1));
|
|
127
123
|
}
|
|
128
124
|
&:popover-open {
|
|
129
|
-
border-inline-start: var(--md-comp-sidesheet-divider-thickness, 1px) solid var(--md-comp-sidesheet-divider-color, var(--md-sys-color-outline, gray));
|
|
125
|
+
border-inline-start: var(--md-comp-sidesheet-divider-thickness, 1px) solid var(--md-comp-sidesheet-divider-color, var(--md-sys-color-outline-variant, gray));
|
|
130
126
|
}
|
|
131
127
|
&:popover-open,
|
|
132
128
|
&[open] {
|
|
133
|
-
--micl-duration: var(--
|
|
129
|
+
--micl-duration: var(--_motion-duration);
|
|
134
130
|
|
|
135
131
|
display: flex;
|
|
136
132
|
margin-inline-end: calc(-1 * var(--micl-spring-buffer));
|
|
137
133
|
opacity: 100%;
|
|
138
134
|
|
|
139
135
|
@starting-style {
|
|
140
|
-
margin-inline-end: calc(-1 * (var(--
|
|
136
|
+
margin-inline-end: calc(-1 * (var(--_width) + var(--micl-spring-buffer)));
|
|
141
137
|
opacity: 0;
|
|
142
138
|
}
|
|
143
139
|
}
|
|
@@ -152,15 +148,29 @@ dialog.micl-sidesheet {
|
|
|
152
148
|
background-color: rgba(0, 0, 0, 0);
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
|
-
}
|
|
156
151
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
transition: max-inline-size var(--md-comp-sidesheet-motion-duration-reverse);
|
|
152
|
+
@media (prefers-reduced-motion: reduce) {
|
|
153
|
+
--_motion-duration: 0ms;
|
|
154
|
+
--_motion-duration-reverse: 0ms;
|
|
155
|
+
}
|
|
162
156
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
|
|
158
|
+
@media (min-width: tokens.$md-sys-breakpoint-medium-min) {
|
|
159
|
+
body:has(dialog.micl-sidesheet[popover]) {
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
max-inline-size: 100%;
|
|
162
|
+
margin: 0;
|
|
163
|
+
transition: max-inline-size var(--md-comp-sidesheet-motion-duration-reverse, #{motion.$md-sys-motion-expressive-default-spatial-duration});
|
|
164
|
+
}
|
|
165
|
+
body:has(dialog.micl-sidesheet:popover-open) {
|
|
166
|
+
max-inline-size: calc(100% - min(var(--md-comp-sidesheet-container-width, #{$container-width}), var(--md-comp-sidesheet-container-max-width, #{$container-max-width})));
|
|
167
|
+
transition: max-inline-size var(--md-comp-sidesheet-motion-duration, #{motion.$md-sys-motion-expressive-slow-spatial-duration}) var(--md-comp-sidesheet-motion-spatial, #{motion.$md-sys-motion-expressive-slow-spatial});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media (prefers-reduced-motion: reduce) {
|
|
171
|
+
body:has(dialog.micl-sidesheet[popover]),
|
|
172
|
+
body:has(dialog.micl-sidesheet:popover-open) {
|
|
173
|
+
transition-duration: 0s;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
166
176
|
}
|
|
@@ -35,13 +35,18 @@ This will initialize any Slider component, including those that will be added to
|
|
|
35
35
|
A live example of the [Slider component](https://henkpb.github.io/micl/slider.html) is available to interact with.
|
|
36
36
|
|
|
37
37
|
## Variants
|
|
38
|
-
Sliders come in **five different sizes**: extra small (`xs`), small (`s`), medium (`m`), large (`l`), and extra large (`xl`). To set a specific size, append the appropriate
|
|
38
|
+
Sliders come in **five different sizes**: extra small (`xs`), small (`s`), medium (`m`), large (`l`), and extra large (`xl`). To set a specific size, append the appropriate size suffix to the `micl-slider` CSS class name:
|
|
39
39
|
|
|
40
40
|
```HTML
|
|
41
41
|
<input type="range" class="micl-slider-s" min="1" max="10" step="1" value="6">
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
By default, the slider is displayed **horizontally**. To display the slider **vertically**, add the `micl-slider--vertical` CSS class.
|
|
45
|
+
|
|
46
|
+
Adding the `disabled` boolean attribute to the `input` element causes the slider to be displayed in a disabled state.
|
|
47
|
+
|
|
48
|
+
Every slider shows a **stop indicator** at the end of its track. Add a `<datalist>` element and reference it with the `list` attribute to get a discrete slider, which shows a stop indicator at each listed value. The values do not have to be evenly spaced.
|
|
49
|
+
|
|
45
50
|
```HTML
|
|
46
51
|
<input type="range" class="micl-slider-l" min="0" max="100" value="25" step="25" list="markers">
|
|
47
52
|
<datalist id="markers">
|
|
@@ -53,7 +58,20 @@ Add a `<datalist>` element to suggest predefined values. The slider will show ti
|
|
|
53
58
|
</datalist>
|
|
54
59
|
```
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> The listed values are suggestions, not stopping points: browsers move the value by `step` and do not snap to the datalist. Give the slider a `step` that matches the listed values if users should only be able to select those.
|
|
63
|
+
> The datalist is read once, when the slider is initialized. The script mirrors the slider's value on every `input` event. When a slider's value is changed programmatically or via a form reset, you must manually dispatch an `input` event so the track and value indicator update to reflect the new value:
|
|
64
|
+
>
|
|
65
|
+
> ```JavaScript
|
|
66
|
+
> slider.value = 40;
|
|
67
|
+
> slider.dispatchEvent(new Event("input", { bubbles: true }));
|
|
68
|
+
> ```
|
|
69
|
+
|
|
70
|
+
By default, a slider relies on the browser's default dimensions. You can adjust its length by setting the CSS `inline-size` property (this controls the width of a horizontal slider or the height of a vertical one).
|
|
71
|
+
|
|
72
|
+
```HTML
|
|
73
|
+
<input type="range" class="micl-slider-m micl-slider--vertical" style="inline-size:240px" aria-label="Volume">
|
|
74
|
+
```
|
|
57
75
|
|
|
58
76
|
For displaying an icon inside a medium-, large- or extra large-sized slider, wrap the icon and the slider inside a slider container:
|
|
59
77
|
|
|
@@ -64,8 +82,6 @@ For displaying an icon inside a medium-, large- or extra large-sized slider, wra
|
|
|
64
82
|
</div>
|
|
65
83
|
```
|
|
66
84
|
|
|
67
|
-
Adding the `disabled` boolean attribute to the `input` element causes the slider to be displayed in a disabled state.
|
|
68
|
-
|
|
69
85
|
The Slider component is aware of the `dir` global attribute that indicates the directionality of text.
|
|
70
86
|
|
|
71
87
|
## Theming
|
|
@@ -79,7 +95,8 @@ Each slider can be themed with CSS custom properties that follow the Material De
|
|
|
79
95
|
| `--md-comp-slider-active-track-color` | The color of the active (filled) part of the track | `--md-sys-color-primary` |
|
|
80
96
|
| `--md-comp-slider-inactive-track-color` | The color of the inactive part of the track | `--md-sys-color-secondary-container` |
|
|
81
97
|
| `--md-comp-slider-handle-color` | The color of the handle | `--md-sys-color-primary` |
|
|
82
|
-
| `--md-comp-slider-stop-indicator-color` | The color of the
|
|
98
|
+
| `--md-comp-slider-active-stop-indicator-container-color` | The color of the stop indicators on the active track | `--md-sys-color-on-primary` |
|
|
99
|
+
| `--md-comp-slider-inactive-stop-indicator-container-color` | The color of the stop indicators on the inactive track | `--md-sys-color-on-secondary-container` |
|
|
83
100
|
| `--md-comp-slider-value-indicator-container-color` | The background color of the value indicator | `--md-sys-color-inverse-surface` |
|
|
84
101
|
| `--md-comp-slider-value-indicator-label-text-color` | The text color of the value indicator | `--md-sys-color-inverse-on-surface` |
|
|
85
102
|
|
|
@@ -89,13 +106,22 @@ Each slider can be themed with CSS custom properties that follow the Material De
|
|
|
89
106
|
<input type="range" class="micl-slider-m" style="--md-comp-slider-active-track-color:var(--md-sys-color-tertiary)">
|
|
90
107
|
```
|
|
91
108
|
|
|
109
|
+
## Accessibility
|
|
110
|
+
The slider is a native `<input type="range">`, so keyboard operation and the announced value come from the browser. Give every slider an accessible name, either with a `<label for>` element or with an `aria-label` attribute. The value indicator is purely visual; if the raw value is not meaningful to users, add `aria-valuetext` and keep it updated.
|
|
111
|
+
|
|
112
|
+
```HTML
|
|
113
|
+
<label for="volume">Volume</label>
|
|
114
|
+
<input type="range" class="micl-slider-m" id="volume" min="0" max="100" value="60">
|
|
115
|
+
```
|
|
116
|
+
|
|
92
117
|
## Compatibility
|
|
93
|
-
This component
|
|
118
|
+
This component relies on the `:has()` pseudo-class, typed `attr()` values, CSS anchor positioning, the `color-mix()` function, and `writing-mode: sideways-lr` for vertical sliders. Please check [Browser compatibility](https://developer.mozilla.org/en-US/docs/Web/CSS/attr#browser_compatibility) for details.
|
|
94
119
|
|
|
95
120
|
> [!NOTE]
|
|
96
|
-
> **Gecko browsers** The
|
|
121
|
+
> **Gecko browsers** The value indicator of a standalone slider is drawn with the `::after` pseudo-element, which **Gecko** browsers like Mozilla Firefox do not render on `<input>` elements. To show the value indicator in these browsers, wrap the slider inside a slider container; the indicator then works in every browser and any layout:
|
|
97
122
|
> ```HTML
|
|
98
123
|
> <div class="micl-slider__container">
|
|
99
|
-
> <input type="range" class="micl-slider-l" value="0">
|
|
124
|
+
> <input type="range" class="micl-slider-l" value="0" aria-label="Brightness">
|
|
100
125
|
> </div>
|
|
101
126
|
> ```
|
|
127
|
+
> The container positions the value indicator from the size custom properties, so set `--md-comp-slider-track-height` and `--md-comp-slider-handle-height` on the container or an ancestor rather than on the `input` element.
|