@slotted/styles 0.1.0-beta.4 → 0.1.0-beta.40
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/package.json +21 -1
- package/src/accordion/accordion.css +31 -13
- package/src/accordion/accordion.tokens.json +2 -0
- package/src/action-bar/action-bar.css +47 -44
- package/src/action-bar/action-bar.tokens.json +1 -0
- package/src/action-sheet/action-sheet.css +39 -39
- package/src/alert/alert.css +97 -97
- package/src/alert/alert.tokens.json +6 -1
- package/src/app-shell/app-shell.css +472 -342
- package/src/app-shell/app-shell.tokens.json +6 -3
- package/src/aspect-ratio/aspect-ratio.css +24 -23
- package/src/attachment/attachment.css +118 -114
- package/src/avatar/avatar.css +97 -67
- package/src/avatar/avatar.tokens.json +8 -0
- package/src/avatar-group/avatar-group.css +22 -23
- package/src/badge/badge.css +58 -47
- package/src/badge/badge.tokens.json +6 -0
- package/src/breadcrumb/breadcrumb.css +52 -52
- package/src/button/button.css +408 -93
- package/src/button/button.tokens.json +13 -0
- package/src/button-group/button-group.css +80 -79
- package/src/button-group/button-group.tokens.json +1 -0
- package/src/calendar/calendar.css +594 -267
- package/src/calendar/calendar.tokens.json +35 -3
- package/src/card/card.css +133 -70
- package/src/card/card.tokens.json +1 -0
- package/src/carousel/carousel.css +158 -169
- package/src/cascader/cascader.css +174 -159
- package/src/cascader/cascader.tokens.json +2 -0
- package/src/chart/chart.css +300 -271
- package/src/chart/chart.tokens.json +5 -0
- package/src/checkbox/checkbox.css +190 -148
- package/src/checkbox/checkbox.tokens.json +4 -0
- package/src/checkbox-group/checkbox-group.css +7 -7
- package/src/clock/clock.css +246 -0
- package/src/clock/clock.tokens.json +44 -0
- package/src/code-block/code-block.css +85 -89
- package/src/collapsible/collapsible.css +273 -85
- package/src/collapsible/collapsible.tokens.json +6 -0
- package/src/color-picker/color-picker.css +106 -114
- package/src/column-manager/column-manager.css +111 -119
- package/src/combobox/combobox.css +219 -132
- package/src/combobox/combobox.tokens.json +4 -0
- package/src/command-palette/command-palette.css +214 -102
- package/src/command-palette/command-palette.tokens.json +4 -0
- package/src/container/container.css +27 -27
- package/src/context-menu/context-menu.css +9 -9
- package/src/currency-field/currency-field.css +119 -119
- package/src/currency-field/currency-field.tokens.json +1 -0
- package/src/dashboard-grid/dashboard-grid.css +231 -115
- package/src/dashboard-grid/dashboard-grid.tokens.json +3 -1
- package/src/data-grid/data-grid.css +637 -496
- package/src/data-grid/data-grid.tokens.json +5 -1
- package/src/data-list/data-list.css +93 -76
- package/src/data-list/data-list.tokens.json +2 -1
- package/src/date-field/date-field.css +62 -57
- package/src/date-field/date-field.tokens.json +1 -0
- package/src/date-picker/date-picker.css +31 -269
- package/src/date-picker/date-picker.tokens.json +1 -21
- package/src/date-range-picker/date-range-picker.css +72 -528
- package/src/date-range-picker/date-range-picker.tokens.json +1 -37
- package/src/datetime-field/datetime-field.css +90 -90
- package/src/datetime-field/datetime-field.tokens.json +1 -0
- package/src/datetime-picker/datetime-picker.css +49 -711
- package/src/datetime-picker/datetime-picker.tokens.json +1 -50
- package/src/datetime-range-picker/datetime-range-picker.css +60 -985
- package/src/datetime-range-picker/datetime-range-picker.tokens.json +1 -67
- package/src/description-list/description-list.css +120 -76
- package/src/description-list/description-list.tokens.json +1 -0
- package/src/detail-panel/detail-panel.css +86 -71
- package/src/detail-panel/detail-panel.tokens.json +2 -0
- package/src/dialog/dialog.css +462 -199
- package/src/dialog/dialog.tokens.json +10 -0
- package/src/divider/divider.css +20 -20
- package/src/drawer/drawer.css +736 -237
- package/src/drawer/drawer.tokens.json +15 -0
- package/src/entity-picker/entity-picker.css +402 -272
- package/src/entity-picker/entity-picker.tokens.json +6 -0
- package/src/event-calendar/event-calendar.css +357 -399
- package/src/field/field.css +106 -93
- package/src/field/field.tokens.json +2 -0
- package/src/field-group/field-group.css +58 -38
- package/src/field-group/field-group.tokens.json +3 -0
- package/src/filter-bar/filter-bar.css +224 -216
- package/src/floating-panel/floating-panel.css +147 -0
- package/src/floating-panel/floating-panel.tokens.json +32 -0
- package/src/form/form.css +103 -26
- package/src/form/form.tokens.json +6 -1
- package/src/fullscreen/fullscreen.css +26 -27
- package/src/grid/grid.css +32 -31
- package/src/highlight/highlight.css +11 -11
- package/src/hover-card/hover-card.css +9 -9
- package/src/icon/icon.css +67 -20
- package/src/icon/icon.tokens.json +1 -0
- package/src/image/image.css +42 -42
- package/src/import-export-center/import-export-center.css +147 -168
- package/src/import-export-center/import-export-center.tokens.json +1 -0
- package/src/inline/inline.css +29 -29
- package/src/inline-message/inline-message.css +162 -86
- package/src/inline-message/inline-message.tokens.json +5 -0
- package/src/kbd/kbd.css +63 -51
- package/src/kbd/kbd.tokens.json +4 -0
- package/src/link/link.css +54 -33
- package/src/link/link.tokens.json +4 -0
- package/src/list/list.css +55 -24
- package/src/list/list.tokens.json +2 -0
- package/src/list-item/list-item.css +195 -80
- package/src/list-item/list-item.tokens.json +10 -0
- package/src/listbox/listbox.css +121 -72
- package/src/listbox/listbox.tokens.json +6 -1
- package/src/loading-overlay/loading-overlay.css +86 -103
- package/src/markdown/markdown.css +20 -20
- package/src/media-viewer/media-viewer.css +790 -0
- package/src/media-viewer/media-viewer.tokens.json +53 -0
- package/src/menu/menu.css +166 -83
- package/src/menu/menu.tokens.json +3 -1
- package/src/menubar/menubar.css +16 -16
- package/src/message/message.css +1296 -1243
- package/src/message/message.tokens.json +14 -0
- package/src/message-scroller/message-scroller.css +323 -320
- package/src/meter/meter.css +136 -0
- package/src/meter/meter.tokens.json +23 -0
- package/src/multi-select/multi-select.css +246 -174
- package/src/multi-select/multi-select.tokens.json +3 -0
- package/src/navigation-menu/navigation-menu.css +170 -191
- package/src/navigation-menu/navigation-menu.tokens.json +1 -0
- package/src/notification-center/notification-center.css +155 -163
- package/src/notification-center/notification-center.tokens.json +4 -0
- package/src/number-field/number-field.css +93 -93
- package/src/number-field/number-field.tokens.json +1 -0
- package/src/otp-input/otp-input.css +74 -64
- package/src/otp-input/otp-input.tokens.json +1 -0
- package/src/page/page.css +109 -31
- package/src/page/page.tokens.json +8 -0
- package/src/page-header/page-header.css +342 -287
- package/src/page-header/page-header.tokens.json +6 -1
- package/src/pagination/pagination.css +75 -79
- package/src/picker-panel/picker-panel.css +1074 -0
- package/src/picker-panel/picker-panel.tokens.json +77 -0
- package/src/popover/popover.css +85 -65
- package/src/popover/popover.tokens.json +2 -0
- package/src/progress-indicator/progress-indicator.css +194 -137
- package/src/progress-indicator/progress-indicator.tokens.json +1 -0
- package/src/prompt-composer/prompt-composer.css +274 -116
- package/src/prompt-composer/prompt-composer.tokens.json +15 -0
- package/src/prose/prose.css +77 -82
- package/src/radio-group/radio-group.css +107 -112
- package/src/rating/rating.css +147 -143
- package/src/rating/rating.tokens.json +2 -0
- package/src/result-state/result-state.css +95 -102
- package/src/result-state/result-state.tokens.json +1 -0
- package/src/runtime-properties.mjs +44 -6
- package/src/saved-views/saved-views.css +43 -49
- package/src/scroll-area/scroll-area.css +50 -37
- package/src/section/section.css +311 -46
- package/src/section/section.tokens.json +13 -1
- package/src/segmented-control/segmented-control.css +221 -133
- package/src/segmented-control/segmented-control.tokens.json +7 -11
- package/src/select/select.css +226 -149
- package/src/select/select.tokens.json +4 -0
- package/src/side-navigation/side-navigation.css +204 -201
- package/src/side-navigation/side-navigation.tokens.json +2 -0
- package/src/skeleton/skeleton.css +76 -58
- package/src/slider/slider.css +108 -104
- package/src/slider/slider.tokens.json +1 -0
- package/src/sparkline/sparkline.css +75 -53
- package/src/sparkline/sparkline.tokens.json +2 -0
- package/src/spinner/spinner.css +83 -180
- package/src/spinner/spinner.tokens.json +0 -1
- package/src/split-button/split-button.css +34 -35
- package/src/split-button/split-button.tokens.json +1 -0
- package/src/splitter/splitter.css +47 -48
- package/src/stack/stack.css +26 -26
- package/src/stat-card/stat-card.css +420 -245
- package/src/stat-card/stat-card.tokens.json +8 -0
- package/src/status-indicator/status-indicator.css +126 -101
- package/src/status-indicator/status-indicator.tokens.json +0 -3
- package/src/stepper/stepper.css +78 -82
- package/src/switch/switch.css +143 -125
- package/src/switch/switch.tokens.json +4 -0
- package/src/table/table.css +653 -222
- package/src/table/table.tokens.json +10 -0
- package/src/table-of-contents/table-of-contents.css +60 -59
- package/src/table-of-contents/table-of-contents.tokens.json +1 -0
- package/src/tabs/tabs.css +327 -294
- package/src/tabs/tabs.tokens.json +7 -1
- package/src/tag/tag.css +113 -89
- package/src/tag/tag.tokens.json +11 -0
- package/src/tags-input/tags-input.css +152 -87
- package/src/tags-input/tags-input.tokens.json +7 -1
- package/src/text-field/text-field.css +146 -148
- package/src/text-field/text-field.tokens.json +1 -0
- package/src/textarea/textarea.css +38 -33
- package/src/textarea/textarea.tokens.json +1 -0
- package/src/time-field/time-field.css +82 -77
- package/src/time-field/time-field.tokens.json +1 -0
- package/src/time-picker/time-picker.css +30 -519
- package/src/time-picker/time-picker.tokens.json +1 -38
- package/src/time-range-picker/time-range-picker.css +53 -895
- package/src/time-range-picker/time-range-picker.tokens.json +1 -66
- package/src/timeline/timeline.css +280 -292
- package/src/timeline/timeline.tokens.json +5 -0
- package/src/toast/toast.css +139 -122
- package/src/toast/toast.tokens.json +7 -0
- package/src/toggle/toggle.css +34 -38
- package/src/toggle-group/toggle-group.css +73 -77
- package/src/toolbar/toolbar.css +49 -40
- package/src/toolbar/toolbar.tokens.json +2 -1
- package/src/tooltip/tooltip.css +95 -39
- package/src/tooltip/tooltip.tokens.json +1 -0
- package/src/top-navigation/top-navigation.css +253 -269
- package/src/top-navigation/top-navigation.tokens.json +1 -0
- package/src/tour/tour.css +68 -74
- package/src/tour/tour.tokens.json +1 -0
- package/src/transfer/transfer.css +164 -168
- package/src/tree/tree.css +118 -122
- package/src/typography/typography.css +67 -38
- package/src/typography/typography.tokens.json +2 -0
- package/src/upload/upload.css +256 -257
- package/src/visually-hidden/visually-hidden.css +1 -1
- package/src/wizard/wizard.css +187 -199
package/src/switch/switch.css
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* the binding mirrors, because a control can be disabled by something that
|
|
22
22
|
* never told it so.
|
|
23
23
|
*/
|
|
24
|
-
[data-ui
|
|
24
|
+
[data-ui-switch][data-part-root] {
|
|
25
25
|
/**
|
|
26
26
|
* The thumb is the control glyph, which is the scale the theme restates
|
|
27
27
|
* per density — so a switch in a dense table shrinks whole rather than in
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
--_line-height: var(--slotted-switch-line-height, var(--slotted-line-height-md, 1.5));
|
|
44
44
|
/**
|
|
45
45
|
* The height the label's line is missing before it is as tall as the pill,
|
|
46
|
-
* split above and below its text, so the text reads
|
|
46
|
+
* split above and below its text, so the text reads centerd on the pill
|
|
47
47
|
* rather than sitting at the top of a row the pill made.
|
|
48
48
|
*
|
|
49
49
|
* It was the height a one-line label was missing before it was a WCAG 2.2
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
* its pill and its label and never of its target (SW2). The overhang is on
|
|
99
99
|
* a transparent box, so nothing about it is visible.
|
|
100
100
|
*/
|
|
101
|
-
[data-ui
|
|
101
|
+
[data-ui-switch] > [data-part-control] {
|
|
102
102
|
align-self: start;
|
|
103
103
|
appearance: none;
|
|
104
104
|
background-color: transparent;
|
|
@@ -136,10 +136,10 @@
|
|
|
136
136
|
/**
|
|
137
137
|
* The track. It carries the ground, the edge and the ring, and it is the
|
|
138
138
|
* containing block the thumb travels inside. It is lifted onto the label's
|
|
139
|
-
* first line rather than
|
|
139
|
+
* first line rather than centerd on the label, because `align-items: center`
|
|
140
140
|
* on a label that wraps to three lines puts the pill beside the second one.
|
|
141
141
|
*/
|
|
142
|
-
[data-ui
|
|
142
|
+
[data-ui-switch] > [data-part-track] {
|
|
143
143
|
background-color: var(
|
|
144
144
|
--slotted-switch-track-background,
|
|
145
145
|
var(--slotted-tone-secondary-solid, ButtonFace)
|
|
@@ -169,8 +169,8 @@
|
|
|
169
169
|
* right-to-left document mirrors the movement with no direction-specific
|
|
170
170
|
* rule at all — the axis is the writing direction's, not the screen's.
|
|
171
171
|
*/
|
|
172
|
-
[data-ui
|
|
173
|
-
/* A flex box, so the mark's icon is
|
|
172
|
+
[data-ui-switch] > [data-part-track] > [data-part-thumb] {
|
|
173
|
+
/* A flex box, so the mark's icon is centerd in the knob as a box and not
|
|
174
174
|
set on a line of text. */
|
|
175
175
|
align-items: center;
|
|
176
176
|
/**
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
background-color: var(--slotted-switch-thumb-background, var(--slotted-tone-accent-on-solid));
|
|
185
185
|
/**
|
|
186
186
|
* The thumb keeps an edge in every state. A thumb separated from its track
|
|
187
|
-
* by
|
|
188
|
-
* unchecked track is white, and under forced
|
|
187
|
+
* by color alone disappears in the `high-contrast` scheme, where the
|
|
188
|
+
* unchecked track is white, and under forced colors, where it is Canvas.
|
|
189
189
|
*/
|
|
190
190
|
border: var(--_border) solid
|
|
191
191
|
var(--slotted-switch-thumb-border-color, var(--slotted-control-border-color, ButtonBorder));
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
* that is meant to look raised. It is barely visible on purpose: on a
|
|
197
197
|
* light unchecked track the knob and the ground are two steps apart, and
|
|
198
198
|
* without it the knob rests on its own hairline border alone. The theme
|
|
199
|
-
* withdraws it in `high-contrast` and under forced
|
|
199
|
+
* withdraws it in `high-contrast` and under forced colors, where the
|
|
200
200
|
* border is doing the work instead.
|
|
201
201
|
*/
|
|
202
202
|
box-shadow: var(--slotted-switch-thumb-shadow, var(--slotted-control-shadow, none));
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* The mark. `docs/component-features.md` asks for the state to be
|
|
221
|
-
* perceptible beyond
|
|
221
|
+
* perceptible beyond color *and* beyond position, and this is what supplies
|
|
222
222
|
* it: the check the binding renders in the knob as the `Glyph` element,
|
|
223
223
|
* never a character. `indicator="none"` is the binding rendering none.
|
|
224
224
|
*
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
* changing rather than two marks swapping places. Off is the absence of the
|
|
227
227
|
* mark, which is the same statement a checkbox makes.
|
|
228
228
|
*/
|
|
229
|
-
[data-ui
|
|
229
|
+
[data-ui-switch] > [data-part-track] > [data-part-thumb] > [data-ui-icon] {
|
|
230
230
|
/**
|
|
231
231
|
* Seventy per cent of the knob rather than all of it. The glyph is drawn
|
|
232
232
|
* on a 24-unit grid with a 3-unit stroke, so filling the knob the check
|
|
@@ -249,9 +249,9 @@
|
|
|
249
249
|
* at the tighter densities, and what makes up the difference is the control
|
|
250
250
|
* stretched over the pill, which is a transparent box with a minimum of its
|
|
251
251
|
* own — the correction `docs/token-foundation.md` asks the family for. The
|
|
252
|
-
* padding here is optical: it
|
|
252
|
+
* padding here is optical: it centers the words on the pill.
|
|
253
253
|
*/
|
|
254
|
-
[data-ui
|
|
254
|
+
[data-ui-switch] > [data-part-label] {
|
|
255
255
|
cursor: pointer;
|
|
256
256
|
grid-column: 2;
|
|
257
257
|
grid-row: 1;
|
|
@@ -271,18 +271,18 @@
|
|
|
271
271
|
* back as a negative margin, as it gives back its block overhang, so the row
|
|
272
272
|
* is no wider and a press between the pill and the words still lands on it.
|
|
273
273
|
*/
|
|
274
|
-
[data-ui
|
|
274
|
+
[data-ui-switch][data-part-root]:has(> [data-part-label]) {
|
|
275
275
|
column-gap: var(--_gap);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
/* Beside the pill, the label is as wide as its words: stretched across the
|
|
279
279
|
column, a label in Arabic in a row in Portuguese aligned its text to its
|
|
280
280
|
own start and set it at the far end of the row, away from the pill. */
|
|
281
|
-
[data-ui
|
|
281
|
+
[data-ui-switch] > [data-part-label] {
|
|
282
282
|
justify-self: start;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
[data-ui
|
|
285
|
+
[data-ui-switch][data-part-root]:has(> [data-part-label]) > [data-part-control] {
|
|
286
286
|
inline-size: calc(var(--_track-inline) + var(--_gap));
|
|
287
287
|
margin-inline-end: calc(-1 * var(--_gap));
|
|
288
288
|
}
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
* label: inside, it would join the accessible name, and a paragraph of help
|
|
293
293
|
* text that toggles a setting when it is clicked is a paragraph nobody reads.
|
|
294
294
|
*/
|
|
295
|
-
[data-ui
|
|
295
|
+
[data-ui-switch] > [data-part-description] {
|
|
296
296
|
color: var(--slotted-switch-description-color, var(--slotted-text-muted, GrayText));
|
|
297
297
|
font-size: var(--slotted-switch-description-font-size, var(--slotted-font-size-xs, 0.75rem));
|
|
298
298
|
grid-column: 2;
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
* directions.
|
|
313
313
|
*/
|
|
314
314
|
|
|
315
|
-
[data-ui
|
|
315
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] {
|
|
316
316
|
/**
|
|
317
317
|
* `1fr` and not `max-content`, for the reason `checkbox` records: sizing
|
|
318
318
|
* the first column from each row's own label ends a list with the controls
|
|
@@ -321,24 +321,24 @@
|
|
|
321
321
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
[data-ui
|
|
325
|
-
[data-ui
|
|
324
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] > [data-part-control],
|
|
325
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] > [data-part-track] {
|
|
326
326
|
grid-area: 1 / 2;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
[data-ui
|
|
330
|
-
[data-ui
|
|
329
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] > [data-part-label],
|
|
330
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] > [data-part-description] {
|
|
331
331
|
grid-column: 1;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
/* Before the pill, the label takes the row, so the row is the settings row. */
|
|
335
|
-
[data-ui
|
|
335
|
+
[data-ui-switch][data-part-root][data-label-placement='start'] > [data-part-label] {
|
|
336
336
|
justify-self: stretch;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/* The control reaches across the gap towards the label, now on its start side. */
|
|
340
|
-
[data-ui
|
|
341
|
-
> [data-part
|
|
340
|
+
[data-ui-switch][data-part-root][data-label-placement='start']:has(> [data-part-label])
|
|
341
|
+
> [data-part-control] {
|
|
342
342
|
margin-inline-end: 0;
|
|
343
343
|
margin-inline-start: calc(-1 * var(--_gap));
|
|
344
344
|
}
|
|
@@ -350,24 +350,55 @@
|
|
|
350
350
|
* an `md` control is a field and a control disagreeing about one row.
|
|
351
351
|
*/
|
|
352
352
|
|
|
353
|
-
[data-ui
|
|
353
|
+
[data-ui-switch][data-part-root][data-size='sm'] {
|
|
354
354
|
--_thumb-size: var(--slotted-control-icon-size-sm, 14px);
|
|
355
355
|
--_font-size: var(--slotted-control-font-size-sm, 12px);
|
|
356
356
|
--_gap: var(--slotted-control-label-gap-sm, 8px);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
[data-ui
|
|
359
|
+
[data-ui-switch][data-part-root][data-size='md'] {
|
|
360
360
|
--_thumb-size: var(--slotted-control-icon-size-md, 16px);
|
|
361
361
|
--_font-size: var(--slotted-control-font-size-md, 13px);
|
|
362
362
|
--_gap: var(--slotted-control-label-gap-md, 12px);
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
[data-ui
|
|
365
|
+
[data-ui-switch][data-part-root][data-size='lg'] {
|
|
366
366
|
--_thumb-size: var(--slotted-control-icon-size-lg, 18px);
|
|
367
367
|
--_font-size: var(--slotted-control-font-size-lg, 14px);
|
|
368
368
|
--_gap: var(--slotted-control-label-gap-lg, 12px);
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* One control tall: in a row of fields aligned to their end, the box ends
|
|
373
|
+
* where their controls end and the pill is centered on their line. The
|
|
374
|
+
* padding is what the control height leaves past the switch's own row, so a
|
|
375
|
+
* label that wraps grows the box. The height is the control of the switch's
|
|
376
|
+
* size unless `--slotted-switch-control-block-size` names another step (a
|
|
377
|
+
* small switch in a row of medium fields).
|
|
378
|
+
*/
|
|
379
|
+
[data-ui-switch][data-part-root][data-variant='control'] {
|
|
380
|
+
padding-block: max(
|
|
381
|
+
0px,
|
|
382
|
+
(
|
|
383
|
+
var(--slotted-switch-control-block-size, var(--_control-height)) -
|
|
384
|
+
max(var(--_track-block), var(--_font-size) * var(--_line-height))
|
|
385
|
+
) /
|
|
386
|
+
2
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
[data-ui-switch][data-part-root][data-size='sm'] {
|
|
391
|
+
--_control-height: var(--slotted-control-height-sm, 30px);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
[data-ui-switch][data-part-root][data-size='md'] {
|
|
395
|
+
--_control-height: var(--slotted-control-height-md, 34px);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
[data-ui-switch][data-part-root][data-size='lg'] {
|
|
399
|
+
--_control-height: var(--slotted-control-height-lg, 38px);
|
|
400
|
+
}
|
|
401
|
+
|
|
371
402
|
/* ── States ───────────────────────────────────────────────────────────
|
|
372
403
|
*
|
|
373
404
|
* Written strongest last, and each weaker one guarded against every stronger
|
|
@@ -379,8 +410,8 @@
|
|
|
379
410
|
* and the deleted `input` family shipped that defect once already.
|
|
380
411
|
*/
|
|
381
412
|
|
|
382
|
-
[data-ui
|
|
383
|
-
> [data-part
|
|
413
|
+
[data-ui-switch][data-part-root]:is([data-checked], :has(> [data-part-control]:checked))
|
|
414
|
+
> [data-part-track] {
|
|
384
415
|
background-color: var(
|
|
385
416
|
--slotted-switch-checked-background,
|
|
386
417
|
var(--slotted-tone-accent-solid, Highlight)
|
|
@@ -391,9 +422,9 @@
|
|
|
391
422
|
);
|
|
392
423
|
}
|
|
393
424
|
|
|
394
|
-
[data-ui
|
|
395
|
-
> [data-part
|
|
396
|
-
> [data-part
|
|
425
|
+
[data-ui-switch][data-part-root]:is([data-checked], :has(> [data-part-control]:checked))
|
|
426
|
+
> [data-part-track]
|
|
427
|
+
> [data-part-thumb] {
|
|
397
428
|
border-color: var(
|
|
398
429
|
--slotted-switch-checked-thumb-border-color,
|
|
399
430
|
var(--slotted-tone-accent-solid, Highlight)
|
|
@@ -401,13 +432,12 @@
|
|
|
401
432
|
inset-inline-start: calc(var(--_gutter) + var(--_travel));
|
|
402
433
|
}
|
|
403
434
|
|
|
404
|
-
[data-ui
|
|
405
|
-
[data-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
> [data-part
|
|
409
|
-
> [data-
|
|
410
|
-
> [data-ui='icon'] {
|
|
435
|
+
[data-ui-switch][data-part-root]:is([data-checked], :has(> [data-part-control]:checked)):not(
|
|
436
|
+
[data-loading]
|
|
437
|
+
)
|
|
438
|
+
> [data-part-track]
|
|
439
|
+
> [data-part-thumb]
|
|
440
|
+
> [data-ui-icon] {
|
|
411
441
|
opacity: 1;
|
|
412
442
|
}
|
|
413
443
|
|
|
@@ -417,23 +447,23 @@
|
|
|
417
447
|
* competes with it. Both are held back for disabled, loading and read-only,
|
|
418
448
|
* and both are written before `invalid`, which outranks them.
|
|
419
449
|
*/
|
|
420
|
-
[data-ui
|
|
450
|
+
[data-ui-switch][data-part-root]:hover:not([data-disabled]):not([data-loading]):not(
|
|
421
451
|
[data-readonly]
|
|
422
|
-
):not(:has(> [data-part
|
|
423
|
-
> [data-part
|
|
452
|
+
):not(:has(> [data-part-control]:disabled))
|
|
453
|
+
> [data-part-track] {
|
|
424
454
|
background-color: var(
|
|
425
455
|
--slotted-switch-hover-background,
|
|
426
456
|
var(--slotted-tone-secondary-solid-hover, ButtonFace)
|
|
427
457
|
);
|
|
428
458
|
}
|
|
429
459
|
|
|
430
|
-
[data-ui
|
|
460
|
+
[data-ui-switch][data-part-root]:is(
|
|
431
461
|
[data-checked],
|
|
432
|
-
:has(> [data-part
|
|
462
|
+
:has(> [data-part-control]:checked)
|
|
433
463
|
):hover:not([data-disabled]):not([data-loading]):not([data-readonly]):not(
|
|
434
|
-
:has(> [data-part
|
|
464
|
+
:has(> [data-part-control]:disabled)
|
|
435
465
|
)
|
|
436
|
-
> [data-part
|
|
466
|
+
> [data-part-track] {
|
|
437
467
|
background-color: var(
|
|
438
468
|
--slotted-switch-checked-hover-background,
|
|
439
469
|
var(--slotted-tone-accent-solid-hover, Highlight)
|
|
@@ -444,23 +474,23 @@
|
|
|
444
474
|
);
|
|
445
475
|
}
|
|
446
476
|
|
|
447
|
-
[data-ui
|
|
477
|
+
[data-ui-switch][data-part-root]:active:not([data-disabled]):not([data-loading]):not(
|
|
448
478
|
[data-readonly]
|
|
449
|
-
):not(:has(> [data-part
|
|
450
|
-
> [data-part
|
|
479
|
+
):not(:has(> [data-part-control]:disabled))
|
|
480
|
+
> [data-part-track] {
|
|
451
481
|
background-color: var(
|
|
452
482
|
--slotted-switch-active-background,
|
|
453
483
|
var(--slotted-tone-secondary-solid-active, ButtonFace)
|
|
454
484
|
);
|
|
455
485
|
}
|
|
456
486
|
|
|
457
|
-
[data-ui
|
|
487
|
+
[data-ui-switch][data-part-root]:is(
|
|
458
488
|
[data-checked],
|
|
459
|
-
:has(> [data-part
|
|
489
|
+
:has(> [data-part-control]:checked)
|
|
460
490
|
):active:not([data-disabled]):not([data-loading]):not([data-readonly]):not(
|
|
461
|
-
:has(> [data-part
|
|
491
|
+
:has(> [data-part-control]:disabled)
|
|
462
492
|
)
|
|
463
|
-
> [data-part
|
|
493
|
+
> [data-part-track] {
|
|
464
494
|
background-color: var(
|
|
465
495
|
--slotted-switch-checked-active-background,
|
|
466
496
|
var(--slotted-tone-accent-solid-active, Highlight)
|
|
@@ -477,8 +507,7 @@
|
|
|
477
507
|
* offset keeps the ring off the pill's own edge, which is what makes a
|
|
478
508
|
* focused unchecked switch legible against a sunken surface.
|
|
479
509
|
*/
|
|
480
|
-
[data-ui
|
|
481
|
-
> [data-part='track'] {
|
|
510
|
+
[data-ui-switch][data-part-root]:has(> [data-part-control]:focus-visible) > [data-part-track] {
|
|
482
511
|
outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
|
|
483
512
|
outline-offset: var(--slotted-focus-ring-offset, 2px);
|
|
484
513
|
}
|
|
@@ -486,14 +515,14 @@
|
|
|
486
515
|
/**
|
|
487
516
|
* Read-only stays focusable, announced and submitted, and it must not be
|
|
488
517
|
* mistakable for disabled. The pill goes hollow rather than grey: the state
|
|
489
|
-
* keeps its own
|
|
518
|
+
* keeps its own color in the mark, and the ground stops saying "press me".
|
|
490
519
|
*/
|
|
491
|
-
[data-ui
|
|
520
|
+
[data-ui-switch][data-part-root][data-readonly] > [data-part-track] {
|
|
492
521
|
background-color: var(--slotted-switch-readonly-background, var(--slotted-surface, Canvas));
|
|
493
522
|
}
|
|
494
523
|
|
|
495
|
-
[data-ui
|
|
496
|
-
[data-ui
|
|
524
|
+
[data-ui-switch][data-part-root][data-readonly] > [data-part-control],
|
|
525
|
+
[data-ui-switch][data-part-root][data-readonly] > [data-part-label] {
|
|
497
526
|
cursor: default;
|
|
498
527
|
}
|
|
499
528
|
|
|
@@ -506,11 +535,11 @@
|
|
|
506
535
|
* two pixels apart, and neither could be told from the other. The state is
|
|
507
536
|
* carried where it always is — the thumb's position, and the mark on it.
|
|
508
537
|
*/
|
|
509
|
-
[data-ui
|
|
538
|
+
[data-ui-switch][data-part-root][data-readonly]:is(
|
|
510
539
|
[data-checked],
|
|
511
|
-
:has(> [data-part
|
|
540
|
+
:has(> [data-part-control]:checked)
|
|
512
541
|
)
|
|
513
|
-
> [data-part
|
|
542
|
+
> [data-part-track] {
|
|
514
543
|
background-color: var(--slotted-switch-readonly-background, var(--slotted-surface, Canvas));
|
|
515
544
|
border-color: var(
|
|
516
545
|
--slotted-switch-readonly-border-color,
|
|
@@ -518,12 +547,12 @@
|
|
|
518
547
|
);
|
|
519
548
|
}
|
|
520
549
|
|
|
521
|
-
[data-ui
|
|
550
|
+
[data-ui-switch][data-part-root][data-readonly]:is(
|
|
522
551
|
[data-checked],
|
|
523
|
-
:has(> [data-part
|
|
552
|
+
:has(> [data-part-control]:checked)
|
|
524
553
|
)
|
|
525
|
-
> [data-part
|
|
526
|
-
> [data-part
|
|
554
|
+
> [data-part-track]
|
|
555
|
+
> [data-part-thumb] {
|
|
527
556
|
border-color: var(
|
|
528
557
|
--slotted-switch-readonly-border-color,
|
|
529
558
|
var(--slotted-control-border-color, ButtonBorder)
|
|
@@ -537,49 +566,56 @@
|
|
|
537
566
|
*
|
|
538
567
|
* The ring is retargeted rather than repainted. Every rule that draws focus
|
|
539
568
|
* reads `--slotted-focus-ring-color`, so pointing that one name at the
|
|
540
|
-
* invalid
|
|
569
|
+
* invalid color on the root moves the ring without restating it — the rule
|
|
541
570
|
* `text-field` wrote for this family to inherit.
|
|
542
571
|
*/
|
|
543
|
-
[data-ui
|
|
572
|
+
[data-ui-switch][data-part-root][data-invalid] {
|
|
544
573
|
--slotted-focus-ring-color: var(
|
|
545
574
|
--slotted-switch-invalid-focus-ring-color,
|
|
546
575
|
var(--slotted-focus-ring-color-invalid, Highlight)
|
|
547
576
|
);
|
|
548
577
|
}
|
|
549
578
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
*/
|
|
579
|
+
/*
|
|
580
|
+
* The outer edge of the track alone. An inset edge drew a second danger line
|
|
581
|
+
* inside the accent fill of a checked track and a ring around the thumb, in
|
|
582
|
+
* place of its own border and lift; the thumb keeps both. The edge stands
|
|
583
|
+
* outside the track's border at the invalid edge width, so the state is
|
|
584
|
+
* width as well as color (WCAG 1.4.1, the edge `text-field` draws), and the
|
|
585
|
+
* checked, hover and pressed rules that color the border do not take it.
|
|
586
|
+
*/
|
|
587
|
+
[data-ui-switch][data-part-root][data-invalid] > [data-part-track] {
|
|
560
588
|
--_invalid-edge-width: var(
|
|
561
589
|
--slotted-switch-invalid-edge-width,
|
|
562
590
|
var(--slotted-control-invalid-edge-width, 1px)
|
|
563
591
|
);
|
|
564
592
|
|
|
565
|
-
box-shadow:
|
|
593
|
+
box-shadow: 0 0 0 var(--_invalid-edge-width)
|
|
566
594
|
var(--slotted-switch-invalid-border-color, var(--slotted-tone-danger-border));
|
|
567
595
|
}
|
|
568
596
|
|
|
597
|
+
/* Forced colors remove every box shadow, and the edge with them: it comes
|
|
598
|
+
back as an outline of the same width around the track. */
|
|
599
|
+
@media (forced-colors: active) {
|
|
600
|
+
[data-ui-switch][data-part-root][data-invalid] > [data-part-track] {
|
|
601
|
+
outline: var(--_invalid-edge-width) solid CanvasText;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
569
605
|
/**
|
|
570
606
|
* Loading. The geometry does not change — the thumb stays where it is and
|
|
571
607
|
* the track keeps its size — because a control that resizes while it saves
|
|
572
608
|
* moves the row under the pointer. The mark gives way to the arc, which is
|
|
573
609
|
* the one thing in the family that says the value is not settled yet.
|
|
574
610
|
*/
|
|
575
|
-
[data-ui
|
|
611
|
+
[data-ui-switch][data-part-root][data-loading] > [data-part-control] {
|
|
576
612
|
cursor: progress;
|
|
577
613
|
}
|
|
578
614
|
|
|
579
|
-
[data-ui
|
|
580
|
-
> [data-part
|
|
581
|
-
> [data-part
|
|
582
|
-
> [data-ui
|
|
615
|
+
[data-ui-switch][data-part-root][data-loading]
|
|
616
|
+
> [data-part-track]
|
|
617
|
+
> [data-part-thumb]
|
|
618
|
+
> [data-ui-icon] {
|
|
583
619
|
opacity: 0;
|
|
584
620
|
}
|
|
585
621
|
|
|
@@ -589,13 +625,11 @@
|
|
|
589
625
|
* the border already draws. `progress-indicator` is wave 2 and not built;
|
|
590
626
|
* when it is, this is the first thing it should replace.
|
|
591
627
|
*
|
|
592
|
-
* Three quarters rather than one. A single
|
|
628
|
+
* Three quarters rather than one. A single colored side read as a shape
|
|
593
629
|
* rather than as a spinner in a still image, and a still image is what a
|
|
594
630
|
* reader under `prefers-reduced-motion` is looking at.
|
|
595
631
|
*/
|
|
596
|
-
[data-ui
|
|
597
|
-
> [data-part='track']
|
|
598
|
-
> [data-part='thumb']::after {
|
|
632
|
+
[data-ui-switch][data-part-root][data-loading] > [data-part-track] > [data-part-thumb]::after {
|
|
599
633
|
animation: slotted-switch-pending var(--slotted-duration-loop) linear infinite;
|
|
600
634
|
border: var(--slotted-border-width-thin, 1px) solid
|
|
601
635
|
var(--slotted-switch-pending-color, var(--slotted-tone-accent-solid));
|
|
@@ -622,9 +656,7 @@
|
|
|
622
656
|
* without anything moving.
|
|
623
657
|
*/
|
|
624
658
|
@media (prefers-reduced-motion: reduce) {
|
|
625
|
-
[data-ui
|
|
626
|
-
> [data-part='track']
|
|
627
|
-
> [data-part='thumb']::after {
|
|
659
|
+
[data-ui-switch][data-part-root][data-loading] > [data-part-track] > [data-part-thumb]::after {
|
|
628
660
|
animation: none;
|
|
629
661
|
}
|
|
630
662
|
}
|
|
@@ -636,15 +668,15 @@
|
|
|
636
668
|
* so — and left to the attribute alone it would look fully operable and
|
|
637
669
|
* answer nothing.
|
|
638
670
|
*/
|
|
639
|
-
[data-ui
|
|
640
|
-
> [data-part
|
|
641
|
-
[data-ui
|
|
642
|
-
> [data-part
|
|
671
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
672
|
+
> [data-part-control],
|
|
673
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
674
|
+
> [data-part-label] {
|
|
643
675
|
cursor: not-allowed;
|
|
644
676
|
}
|
|
645
677
|
|
|
646
|
-
[data-ui
|
|
647
|
-
> [data-part
|
|
678
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
679
|
+
> [data-part-track] {
|
|
648
680
|
background-color: var(
|
|
649
681
|
--slotted-switch-disabled-background,
|
|
650
682
|
var(--slotted-disabled-background, ButtonFace)
|
|
@@ -653,13 +685,13 @@
|
|
|
653
685
|
}
|
|
654
686
|
|
|
655
687
|
/**
|
|
656
|
-
* Muted to the
|
|
688
|
+
* Muted to the color the theme measures rather than faded by opacity: a
|
|
657
689
|
* setting nobody can read is a setting nobody can check, and a disabled form
|
|
658
690
|
* still has to say what it holds.
|
|
659
691
|
*/
|
|
660
|
-
[data-ui
|
|
661
|
-
> [data-part
|
|
662
|
-
> [data-part
|
|
692
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
693
|
+
> [data-part-track]
|
|
694
|
+
> [data-part-thumb] {
|
|
663
695
|
/**
|
|
664
696
|
* Grey rather than white. The knob is the brightest thing in the family,
|
|
665
697
|
* and a bright knob on a grey track reads as a control still waiting to be
|
|
@@ -673,31 +705,17 @@
|
|
|
673
705
|
box-shadow: none;
|
|
674
706
|
}
|
|
675
707
|
|
|
676
|
-
[data-ui
|
|
677
|
-
> [data-part
|
|
678
|
-
> [data-part
|
|
679
|
-
> [data-ui
|
|
708
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
709
|
+
> [data-part-track]
|
|
710
|
+
> [data-part-thumb]
|
|
711
|
+
> [data-ui-icon] {
|
|
680
712
|
color: var(--slotted-switch-disabled-mark-color, var(--slotted-disabled-background));
|
|
681
713
|
}
|
|
682
714
|
|
|
683
|
-
[data-ui
|
|
684
|
-
> [data-part
|
|
685
|
-
[data-ui
|
|
686
|
-
> [data-part
|
|
715
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
716
|
+
> [data-part-label],
|
|
717
|
+
[data-ui-switch][data-part-root]:is([data-disabled], :has(> [data-part-control]:disabled))
|
|
718
|
+
> [data-part-description] {
|
|
687
719
|
color: var(--slotted-switch-disabled-color, var(--slotted-disabled-foreground, GrayText));
|
|
688
720
|
}
|
|
689
|
-
|
|
690
|
-
/*
|
|
691
|
-
* Forced colours remove every box shadow, and the edge with them. The width
|
|
692
|
-
* comes back as an outline inside the border, on the
|
|
693
|
-
* track and on the thumb; the focus ring takes the track and the thumb keeps
|
|
694
|
-
* its edge.
|
|
695
|
-
*/
|
|
696
|
-
@media (forced-colors: active) {
|
|
697
|
-
[data-ui='switch'][data-part='root'][data-invalid] > [data-part='track'],
|
|
698
|
-
[data-ui='switch'][data-part='root'][data-invalid] > [data-part='track'] > [data-part='thumb'] {
|
|
699
|
-
outline: var(--_invalid-edge-width) solid CanvasText;
|
|
700
|
-
outline-offset: calc(-1 * (var(--_border) + var(--_invalid-edge-width)));
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
721
|
}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
"--slotted-control-font-size-lg",
|
|
7
7
|
"--slotted-control-font-size-md",
|
|
8
8
|
"--slotted-control-font-size-sm",
|
|
9
|
+
"--slotted-control-height-lg",
|
|
10
|
+
"--slotted-control-height-md",
|
|
11
|
+
"--slotted-control-height-sm",
|
|
9
12
|
"--slotted-control-icon-size-lg",
|
|
10
13
|
"--slotted-control-icon-size-md",
|
|
11
14
|
"--slotted-control-icon-size-sm",
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
"--slotted-switch-checked-hover-background",
|
|
40
43
|
"--slotted-switch-checked-thumb-border-color",
|
|
41
44
|
"--slotted-switch-color",
|
|
45
|
+
"--slotted-switch-control-block-size",
|
|
42
46
|
"--slotted-switch-description-color",
|
|
43
47
|
"--slotted-switch-description-font-size",
|
|
44
48
|
"--slotted-switch-disabled-background",
|