@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.
Files changed (221) hide show
  1. package/package.json +21 -1
  2. package/src/accordion/accordion.css +31 -13
  3. package/src/accordion/accordion.tokens.json +2 -0
  4. package/src/action-bar/action-bar.css +47 -44
  5. package/src/action-bar/action-bar.tokens.json +1 -0
  6. package/src/action-sheet/action-sheet.css +39 -39
  7. package/src/alert/alert.css +97 -97
  8. package/src/alert/alert.tokens.json +6 -1
  9. package/src/app-shell/app-shell.css +472 -342
  10. package/src/app-shell/app-shell.tokens.json +6 -3
  11. package/src/aspect-ratio/aspect-ratio.css +24 -23
  12. package/src/attachment/attachment.css +118 -114
  13. package/src/avatar/avatar.css +97 -67
  14. package/src/avatar/avatar.tokens.json +8 -0
  15. package/src/avatar-group/avatar-group.css +22 -23
  16. package/src/badge/badge.css +58 -47
  17. package/src/badge/badge.tokens.json +6 -0
  18. package/src/breadcrumb/breadcrumb.css +52 -52
  19. package/src/button/button.css +408 -93
  20. package/src/button/button.tokens.json +13 -0
  21. package/src/button-group/button-group.css +80 -79
  22. package/src/button-group/button-group.tokens.json +1 -0
  23. package/src/calendar/calendar.css +594 -267
  24. package/src/calendar/calendar.tokens.json +35 -3
  25. package/src/card/card.css +133 -70
  26. package/src/card/card.tokens.json +1 -0
  27. package/src/carousel/carousel.css +158 -169
  28. package/src/cascader/cascader.css +174 -159
  29. package/src/cascader/cascader.tokens.json +2 -0
  30. package/src/chart/chart.css +300 -271
  31. package/src/chart/chart.tokens.json +5 -0
  32. package/src/checkbox/checkbox.css +190 -148
  33. package/src/checkbox/checkbox.tokens.json +4 -0
  34. package/src/checkbox-group/checkbox-group.css +7 -7
  35. package/src/clock/clock.css +246 -0
  36. package/src/clock/clock.tokens.json +44 -0
  37. package/src/code-block/code-block.css +85 -89
  38. package/src/collapsible/collapsible.css +273 -85
  39. package/src/collapsible/collapsible.tokens.json +6 -0
  40. package/src/color-picker/color-picker.css +106 -114
  41. package/src/column-manager/column-manager.css +111 -119
  42. package/src/combobox/combobox.css +219 -132
  43. package/src/combobox/combobox.tokens.json +4 -0
  44. package/src/command-palette/command-palette.css +214 -102
  45. package/src/command-palette/command-palette.tokens.json +4 -0
  46. package/src/container/container.css +27 -27
  47. package/src/context-menu/context-menu.css +9 -9
  48. package/src/currency-field/currency-field.css +119 -119
  49. package/src/currency-field/currency-field.tokens.json +1 -0
  50. package/src/dashboard-grid/dashboard-grid.css +231 -115
  51. package/src/dashboard-grid/dashboard-grid.tokens.json +3 -1
  52. package/src/data-grid/data-grid.css +637 -496
  53. package/src/data-grid/data-grid.tokens.json +5 -1
  54. package/src/data-list/data-list.css +93 -76
  55. package/src/data-list/data-list.tokens.json +2 -1
  56. package/src/date-field/date-field.css +62 -57
  57. package/src/date-field/date-field.tokens.json +1 -0
  58. package/src/date-picker/date-picker.css +31 -269
  59. package/src/date-picker/date-picker.tokens.json +1 -21
  60. package/src/date-range-picker/date-range-picker.css +72 -528
  61. package/src/date-range-picker/date-range-picker.tokens.json +1 -37
  62. package/src/datetime-field/datetime-field.css +90 -90
  63. package/src/datetime-field/datetime-field.tokens.json +1 -0
  64. package/src/datetime-picker/datetime-picker.css +49 -711
  65. package/src/datetime-picker/datetime-picker.tokens.json +1 -50
  66. package/src/datetime-range-picker/datetime-range-picker.css +60 -985
  67. package/src/datetime-range-picker/datetime-range-picker.tokens.json +1 -67
  68. package/src/description-list/description-list.css +120 -76
  69. package/src/description-list/description-list.tokens.json +1 -0
  70. package/src/detail-panel/detail-panel.css +86 -71
  71. package/src/detail-panel/detail-panel.tokens.json +2 -0
  72. package/src/dialog/dialog.css +462 -199
  73. package/src/dialog/dialog.tokens.json +10 -0
  74. package/src/divider/divider.css +20 -20
  75. package/src/drawer/drawer.css +736 -237
  76. package/src/drawer/drawer.tokens.json +15 -0
  77. package/src/entity-picker/entity-picker.css +402 -272
  78. package/src/entity-picker/entity-picker.tokens.json +6 -0
  79. package/src/event-calendar/event-calendar.css +357 -399
  80. package/src/field/field.css +106 -93
  81. package/src/field/field.tokens.json +2 -0
  82. package/src/field-group/field-group.css +58 -38
  83. package/src/field-group/field-group.tokens.json +3 -0
  84. package/src/filter-bar/filter-bar.css +224 -216
  85. package/src/floating-panel/floating-panel.css +147 -0
  86. package/src/floating-panel/floating-panel.tokens.json +32 -0
  87. package/src/form/form.css +103 -26
  88. package/src/form/form.tokens.json +6 -1
  89. package/src/fullscreen/fullscreen.css +26 -27
  90. package/src/grid/grid.css +32 -31
  91. package/src/highlight/highlight.css +11 -11
  92. package/src/hover-card/hover-card.css +9 -9
  93. package/src/icon/icon.css +67 -20
  94. package/src/icon/icon.tokens.json +1 -0
  95. package/src/image/image.css +42 -42
  96. package/src/import-export-center/import-export-center.css +147 -168
  97. package/src/import-export-center/import-export-center.tokens.json +1 -0
  98. package/src/inline/inline.css +29 -29
  99. package/src/inline-message/inline-message.css +162 -86
  100. package/src/inline-message/inline-message.tokens.json +5 -0
  101. package/src/kbd/kbd.css +63 -51
  102. package/src/kbd/kbd.tokens.json +4 -0
  103. package/src/link/link.css +54 -33
  104. package/src/link/link.tokens.json +4 -0
  105. package/src/list/list.css +55 -24
  106. package/src/list/list.tokens.json +2 -0
  107. package/src/list-item/list-item.css +195 -80
  108. package/src/list-item/list-item.tokens.json +10 -0
  109. package/src/listbox/listbox.css +121 -72
  110. package/src/listbox/listbox.tokens.json +6 -1
  111. package/src/loading-overlay/loading-overlay.css +86 -103
  112. package/src/markdown/markdown.css +20 -20
  113. package/src/media-viewer/media-viewer.css +790 -0
  114. package/src/media-viewer/media-viewer.tokens.json +53 -0
  115. package/src/menu/menu.css +166 -83
  116. package/src/menu/menu.tokens.json +3 -1
  117. package/src/menubar/menubar.css +16 -16
  118. package/src/message/message.css +1296 -1243
  119. package/src/message/message.tokens.json +14 -0
  120. package/src/message-scroller/message-scroller.css +323 -320
  121. package/src/meter/meter.css +136 -0
  122. package/src/meter/meter.tokens.json +23 -0
  123. package/src/multi-select/multi-select.css +246 -174
  124. package/src/multi-select/multi-select.tokens.json +3 -0
  125. package/src/navigation-menu/navigation-menu.css +170 -191
  126. package/src/navigation-menu/navigation-menu.tokens.json +1 -0
  127. package/src/notification-center/notification-center.css +155 -163
  128. package/src/notification-center/notification-center.tokens.json +4 -0
  129. package/src/number-field/number-field.css +93 -93
  130. package/src/number-field/number-field.tokens.json +1 -0
  131. package/src/otp-input/otp-input.css +74 -64
  132. package/src/otp-input/otp-input.tokens.json +1 -0
  133. package/src/page/page.css +109 -31
  134. package/src/page/page.tokens.json +8 -0
  135. package/src/page-header/page-header.css +342 -287
  136. package/src/page-header/page-header.tokens.json +6 -1
  137. package/src/pagination/pagination.css +75 -79
  138. package/src/picker-panel/picker-panel.css +1074 -0
  139. package/src/picker-panel/picker-panel.tokens.json +77 -0
  140. package/src/popover/popover.css +85 -65
  141. package/src/popover/popover.tokens.json +2 -0
  142. package/src/progress-indicator/progress-indicator.css +194 -137
  143. package/src/progress-indicator/progress-indicator.tokens.json +1 -0
  144. package/src/prompt-composer/prompt-composer.css +274 -116
  145. package/src/prompt-composer/prompt-composer.tokens.json +15 -0
  146. package/src/prose/prose.css +77 -82
  147. package/src/radio-group/radio-group.css +107 -112
  148. package/src/rating/rating.css +147 -143
  149. package/src/rating/rating.tokens.json +2 -0
  150. package/src/result-state/result-state.css +95 -102
  151. package/src/result-state/result-state.tokens.json +1 -0
  152. package/src/runtime-properties.mjs +44 -6
  153. package/src/saved-views/saved-views.css +43 -49
  154. package/src/scroll-area/scroll-area.css +50 -37
  155. package/src/section/section.css +311 -46
  156. package/src/section/section.tokens.json +13 -1
  157. package/src/segmented-control/segmented-control.css +221 -133
  158. package/src/segmented-control/segmented-control.tokens.json +7 -11
  159. package/src/select/select.css +226 -149
  160. package/src/select/select.tokens.json +4 -0
  161. package/src/side-navigation/side-navigation.css +204 -201
  162. package/src/side-navigation/side-navigation.tokens.json +2 -0
  163. package/src/skeleton/skeleton.css +76 -58
  164. package/src/slider/slider.css +108 -104
  165. package/src/slider/slider.tokens.json +1 -0
  166. package/src/sparkline/sparkline.css +75 -53
  167. package/src/sparkline/sparkline.tokens.json +2 -0
  168. package/src/spinner/spinner.css +83 -180
  169. package/src/spinner/spinner.tokens.json +0 -1
  170. package/src/split-button/split-button.css +34 -35
  171. package/src/split-button/split-button.tokens.json +1 -0
  172. package/src/splitter/splitter.css +47 -48
  173. package/src/stack/stack.css +26 -26
  174. package/src/stat-card/stat-card.css +420 -245
  175. package/src/stat-card/stat-card.tokens.json +8 -0
  176. package/src/status-indicator/status-indicator.css +126 -101
  177. package/src/status-indicator/status-indicator.tokens.json +0 -3
  178. package/src/stepper/stepper.css +78 -82
  179. package/src/switch/switch.css +143 -125
  180. package/src/switch/switch.tokens.json +4 -0
  181. package/src/table/table.css +653 -222
  182. package/src/table/table.tokens.json +10 -0
  183. package/src/table-of-contents/table-of-contents.css +60 -59
  184. package/src/table-of-contents/table-of-contents.tokens.json +1 -0
  185. package/src/tabs/tabs.css +327 -294
  186. package/src/tabs/tabs.tokens.json +7 -1
  187. package/src/tag/tag.css +113 -89
  188. package/src/tag/tag.tokens.json +11 -0
  189. package/src/tags-input/tags-input.css +152 -87
  190. package/src/tags-input/tags-input.tokens.json +7 -1
  191. package/src/text-field/text-field.css +146 -148
  192. package/src/text-field/text-field.tokens.json +1 -0
  193. package/src/textarea/textarea.css +38 -33
  194. package/src/textarea/textarea.tokens.json +1 -0
  195. package/src/time-field/time-field.css +82 -77
  196. package/src/time-field/time-field.tokens.json +1 -0
  197. package/src/time-picker/time-picker.css +30 -519
  198. package/src/time-picker/time-picker.tokens.json +1 -38
  199. package/src/time-range-picker/time-range-picker.css +53 -895
  200. package/src/time-range-picker/time-range-picker.tokens.json +1 -66
  201. package/src/timeline/timeline.css +280 -292
  202. package/src/timeline/timeline.tokens.json +5 -0
  203. package/src/toast/toast.css +139 -122
  204. package/src/toast/toast.tokens.json +7 -0
  205. package/src/toggle/toggle.css +34 -38
  206. package/src/toggle-group/toggle-group.css +73 -77
  207. package/src/toolbar/toolbar.css +49 -40
  208. package/src/toolbar/toolbar.tokens.json +2 -1
  209. package/src/tooltip/tooltip.css +95 -39
  210. package/src/tooltip/tooltip.tokens.json +1 -0
  211. package/src/top-navigation/top-navigation.css +253 -269
  212. package/src/top-navigation/top-navigation.tokens.json +1 -0
  213. package/src/tour/tour.css +68 -74
  214. package/src/tour/tour.tokens.json +1 -0
  215. package/src/transfer/transfer.css +164 -168
  216. package/src/tree/tree.css +118 -122
  217. package/src/typography/typography.css +67 -38
  218. package/src/typography/typography.tokens.json +2 -0
  219. package/src/upload/upload.css +256 -257
  220. package/src/visually-hidden/visually-hidden.css +1 -1
  221. package/src/wizard/wizard.css +187 -199
@@ -41,7 +41,7 @@
41
41
  * the name that says so, which is the convention `docs/build-briefing.md`
42
42
  * sets. They are not design tokens and no theme writes them.
43
43
  */
44
- [data-ui='segmented-control'][data-part='root'] {
44
+ [data-ui-segmented-control][data-part-root] {
45
45
  --_count: var(--slotted-segmented-control-count, 1);
46
46
  --_index: var(--slotted-segmented-control-index, 0);
47
47
  --_height: var(--slotted-control-height-md, 34px);
@@ -59,25 +59,34 @@
59
59
  --_inset: var(--slotted-segmented-control-inset, var(--slotted-space-1, 0.125rem));
60
60
  /** What is left for a segment once the track has taken its edge and ring. */
61
61
  --_inner: calc(var(--_height) - (var(--_inset) + var(--_border-width)) * 2);
62
+ /** The space between two segments: the ring's own step. */
63
+ --_spacing: var(--slotted-segmented-control-gap, var(--_inset));
62
64
  /** The thumb's corner, kept concentric with the track's own. */
63
65
  --_thumb-radius: max(calc(var(--_radius) - var(--_inset)), var(--slotted-radius-xs, 2px));
64
66
  /**
65
67
  * How long the thumb takes to cross. One step above the control's own
66
68
  * interaction feedback, because a thing that travels needs longer than a
67
- * thing that changes colour, and every value on the scale collapses to a
69
+ * thing that changes color, and every value on the scale collapses to a
68
70
  * single frame under `prefers-reduced-motion`.
69
71
  */
70
72
  --_travel: var(--slotted-duration-medium);
71
73
 
72
- /* A control in a row of controls: the fill, edge and lift a field has. */
73
- background: var(--slotted-segmented-control-background, var(--slotted-control-surface, Field));
74
- border: var(--_border-width) solid
75
- var(
76
- --slotted-segmented-control-border-color,
77
- var(--slotted-control-border-color, ButtonBorder)
78
- );
74
+ /**
75
+ * A neutral track: the page's own ink at a low alpha rather than an opaque
76
+ * fill, so it darkens whatever it stands on — a surface, a sunken panel, a
77
+ * card header — by the same step, and reads as a recess in each. The edge
78
+ * keeps its width and is transparent by default, so the arithmetic below is
79
+ * the same with a theme's edge and without one. An accent track with an
80
+ * accent thumb edge was the first appearance: a colored outline on a row
81
+ * of neutral controls read as an alert before it read as a choice.
82
+ */
83
+ background: var(
84
+ --slotted-segmented-control-background,
85
+ color-mix(in oklab, var(--slotted-text, CanvasText) 6%, transparent)
86
+ );
87
+ border: var(--_border-width) solid var(--slotted-segmented-control-border-color, transparent);
79
88
  border-radius: var(--_radius);
80
- box-shadow: var(--slotted-segmented-control-shadow, var(--slotted-control-shadow, none));
89
+ box-shadow: var(--slotted-segmented-control-shadow, none);
81
90
  box-sizing: border-box;
82
91
  display: inline-grid;
83
92
  font-family: var(--slotted-control-font-family, system-ui, sans-serif);
@@ -87,8 +96,15 @@
87
96
  * sized grid resolves every track to the largest content contribution, so
88
97
  * the rule Carbon states — base the width on the longest label, and give
89
98
  * every segment that width — falls out of the layout.
99
+ *
100
+ * The column carries the segment's floor, and the segment none of its own:
101
+ * a segment with a minimum inside a column that could shrink below it ran
102
+ * past its column in a narrow container, while the thumb, a column wide,
103
+ * did not — the thumb and its segment no longer matched, and the label
104
+ * overflowed the track.
90
105
  */
91
- grid-auto-columns: minmax(0, 1fr);
106
+ gap: var(--_spacing);
107
+ grid-auto-columns: minmax(max(var(--_inner), var(--slotted-target-min, 24px)), 1fr);
92
108
  grid-auto-flow: column;
93
109
  isolation: isolate;
94
110
  min-inline-size: 0;
@@ -96,13 +112,13 @@
96
112
  position: relative;
97
113
  }
98
114
 
99
- [data-ui='segmented-control'][data-part='root']:empty {
115
+ [data-ui-segmented-control][data-part-root]:empty {
100
116
  display: none;
101
117
  }
102
118
 
103
119
  /* ── Size ─────────────────────────────────────────────────────────────── */
104
120
 
105
- [data-ui='segmented-control'][data-part='root'][data-size='sm'] {
121
+ [data-ui-segmented-control][data-part-root][data-size='sm'] {
106
122
  --_height: var(--slotted-control-height-sm, 30px);
107
123
  --_padding-inline: var(--slotted-control-padding-inline-sm, 10px);
108
124
  --_font-size: var(--slotted-control-font-size-sm, 12px);
@@ -110,7 +126,7 @@
110
126
  --_gap: var(--slotted-control-gap-sm, 6px);
111
127
  }
112
128
 
113
- [data-ui='segmented-control'][data-part='root'][data-size='lg'] {
129
+ [data-ui-segmented-control][data-part-root][data-size='lg'] {
114
130
  --_height: var(--slotted-control-height-lg, 38px);
115
131
  --_padding-inline: var(--slotted-control-padding-inline-lg, 16px);
116
132
  --_font-size: var(--slotted-control-font-size-lg, 14px);
@@ -120,13 +136,13 @@
120
136
 
121
137
  /* ── Orientation and width ────────────────────────────────────────────── */
122
138
 
123
- [data-ui='segmented-control'][data-part='root'][data-orientation='vertical'] {
139
+ [data-ui-segmented-control][data-part-root][data-orientation='vertical'] {
124
140
  grid-auto-columns: auto;
125
141
  grid-auto-flow: row;
126
142
  grid-auto-rows: minmax(0, 1fr);
127
143
  }
128
144
 
129
- [data-ui='segmented-control'][data-part='root'][data-full-width] {
145
+ [data-ui-segmented-control][data-part-root][data-full-width] {
130
146
  display: grid;
131
147
  inline-size: 100%;
132
148
  }
@@ -148,16 +164,27 @@
148
164
  * words at a width it chose for itself is a question with no answer — it
149
165
  * chose a width that fits them.
150
166
  */
151
- [data-ui='segmented-control'][data-part='root'][data-condense='icons'] {
167
+ [data-ui-segmented-control][data-part-root][data-condense='icons'] {
152
168
  container-name: slotted-segmented-control;
153
169
  container-type: inline-size;
154
170
  display: grid;
155
171
  inline-size: 100%;
156
172
  }
157
173
 
174
+ /**
175
+ * A control told to condense to a column takes the width its parent gives,
176
+ * for the same reason: the binding compares that width with the width its
177
+ * labels need, and writes `data-orientation="vertical"` below it, which
178
+ * draws the column and moves the thumb on that axis.
179
+ */
180
+ [data-ui-segmented-control][data-part-root][data-condense='vertical'] {
181
+ display: grid;
182
+ inline-size: 100%;
183
+ }
184
+
158
185
  /* ── The segment ──────────────────────────────────────────────────────── */
159
186
 
160
- [data-ui='segmented-control'] [data-part='item'] {
187
+ [data-ui-segmented-control] [data-part-item] {
161
188
  align-items: center;
162
189
  block-size: var(--_inner);
163
190
  border-radius: var(--_thumb-radius);
@@ -172,7 +199,10 @@
172
199
  color: var(--slotted-segmented-control-color, var(--slotted-text, ButtonText));
173
200
  cursor: pointer;
174
201
  display: flex;
175
- font-weight: var(--slotted-control-font-weight, 600);
202
+ font-weight: var(
203
+ --slotted-segmented-control-font-weight,
204
+ var(--slotted-font-weight-medium, 500)
205
+ );
176
206
  gap: var(--_gap);
177
207
  justify-content: center;
178
208
  letter-spacing: var(--slotted-control-letter-spacing, 0);
@@ -180,66 +210,95 @@
180
210
  /**
181
211
  * The thumb is shorter than the control it lives in, so at the smallest
182
212
  * step and the tightest density it is eighteen pixels tall. The WCAG
183
- * minimum is the floor across the segment, and the radio below reaches the
184
- * track's own edge to meet it in the other axis.
213
+ * minimum is the column's floor across the segment, and the radio below
214
+ * reaches the track's own edge to meet it in the other axis.
185
215
  */
186
- min-inline-size: max(var(--_inner), var(--slotted-target-min, 24px));
216
+ min-inline-size: 0;
187
217
  padding-inline: var(--_padding-inline);
218
+ /**
219
+ * Positioned without a `z-index`: the segment paints after the thumb, which
220
+ * comes first in the DOM, so its words lie over the thumb, and its divider
221
+ * and its hover ground — pseudo-elements at `z-index: -1` — lie under it.
222
+ * A segment at `z-index: 1` lifted both over the thumb as well, and a thumb
223
+ * crossing a hovered segment or a divider lost part of its edge for the
224
+ * length of the slide.
225
+ */
188
226
  position: relative;
189
- transition:
190
- background-color var(--slotted-control-transition-duration)
191
- var(--slotted-control-transition-easing),
192
- color var(--slotted-control-transition-duration) var(--slotted-control-transition-easing);
193
- /* Above the thumb, which is painted behind every segment. */
194
- z-index: 1;
227
+ transition: color var(--slotted-control-transition-duration)
228
+ var(--slotted-control-transition-easing);
229
+ }
230
+
231
+ /** The hover and press ground, under the thumb; see the segment above. */
232
+ [data-ui-segmented-control] [data-part-item]::after {
233
+ background: transparent;
234
+ border-radius: inherit;
235
+ content: '';
236
+ inset: 0;
237
+ position: absolute;
238
+ transition: background-color var(--slotted-control-transition-duration)
239
+ var(--slotted-control-transition-easing);
240
+ z-index: -1;
195
241
  }
196
242
 
197
243
  /* An empty label is no label: a binding that always renders the span must
198
244
  not leave a flex gap after the icon of a segment without words. */
199
- [data-ui='segmented-control'] [data-part='item']:not(:has([data-part='label']:not(:empty))) {
245
+ [data-ui-segmented-control] [data-part-item]:not(:has([data-part-label]:not(:empty))) {
200
246
  padding-inline: 0;
201
247
  }
202
248
 
203
- [data-ui='segmented-control'] [data-part='label']:empty {
249
+ [data-ui-segmented-control] [data-part-label]:empty {
204
250
  display: none;
205
251
  }
206
252
 
207
253
  /**
208
- * ── The rule between two segments ─────────────────────────────────────
254
+ * ── Between two segments ──────────────────────────────────────────────
255
+ *
256
+ * Segments stand apart by the same step as the ring of track around them,
257
+ * so each one — its hover ground, the thumb on it — is a shape of its own
258
+ * on the track, and a rule in the middle of that room says the control is
259
+ * divided: a track of words with nothing between them reads as a sentence.
209
260
  *
210
- * A track of words with nothing between them reads as a sentence. The rule
211
- * is what says the control is divided, and it is what Mantine ships on by
212
- * default, Apple draws, and Carbon draws. It is shorter than the segment, so
213
- * it reads as a divider rather than as a second frame, and it gives way
214
- * around the thumb — a grey line touching the accent edge is the "border
215
- * inside a border" this family had to correct elsewhere.
261
+ * The rule is centerd in the gap rather than on a segment's edge, half the
262
+ * segment's height, rounded at its ends, in a light tint of the ink rather
263
+ * than an opaque border color. It gives way wherever it would touch a
264
+ * shape: beside the thumb, and beside the segment under the pointer, whose
265
+ * ground would otherwise meet it. It lies under the thumb, so a thumb that
266
+ * crosses it while sliding passes over it.
216
267
  */
217
- [data-ui='segmented-control'] [data-part='item'] + [data-part='item']::before {
218
- /* No system colour behind it: an unthemed decoration disappears rather
268
+ [data-ui-segmented-control] [data-part-item] + [data-part-item]::before {
269
+ /* No system color behind it: an unthemed decoration disappears rather
219
270
  than shouting, which is what `fallbacks.test.mjs` holds a pseudo-element
220
- to. The rule is a decoration — what divides the segments in forced
221
- colours is the thumb's own border. */
222
- background: var(--slotted-segmented-control-divider-color, var(--slotted-border-subtle));
271
+ to. In forced colors the thumb's own edge is what divides. */
272
+ background: var(
273
+ --slotted-segmented-control-divider-color,
274
+ color-mix(in oklab, var(--slotted-text) 14%, transparent)
275
+ );
276
+ border-radius: var(--slotted-radius-full, 9999px);
223
277
  content: '';
224
278
  inline-size: var(--_border-width);
225
- inset-block: 22%;
226
- inset-inline-start: 0;
279
+ inset-block: 25%;
280
+ inset-inline-start: calc((var(--_spacing) + var(--_border-width)) / -2);
227
281
  position: absolute;
228
282
  transition: opacity var(--_travel) var(--slotted-easing-standard);
283
+ z-index: -1;
229
284
  }
230
285
 
231
- [data-ui='segmented-control'][data-part='root'][data-orientation='vertical']
232
- [data-part='item']
233
- + [data-part='item']::before {
286
+ [data-ui-segmented-control][data-part-root][data-orientation='vertical']
287
+ [data-part-item]
288
+ + [data-part-item]::before {
234
289
  block-size: var(--_border-width);
235
290
  inline-size: auto;
236
- inset-block: auto;
237
- inset-block-start: 0;
238
- inset-inline: 22%;
291
+ inset-block: calc((var(--_spacing) + var(--_border-width)) / -2) auto;
292
+ inset-inline: 25%;
239
293
  }
240
294
 
241
- [data-ui='segmented-control'] [data-part='item'][data-checked]::before,
242
- [data-ui='segmented-control'] [data-part='item'][data-checked] + [data-part='item']::before {
295
+ [data-ui-segmented-control] [data-part-item][data-checked]::before,
296
+ [data-ui-segmented-control] [data-part-item][data-checked] + [data-part-item]::before,
297
+ [data-ui-segmented-control][data-part-root]:not([data-readonly])
298
+ [data-part-item]:hover:has([data-part-control]:enabled)::before,
299
+ [data-ui-segmented-control][data-part-root]:not([data-readonly])
300
+ [data-part-item]:hover:has([data-part-control]:enabled)
301
+ + [data-part-item]::before {
243
302
  opacity: 0;
244
303
  }
245
304
 
@@ -250,21 +309,23 @@
250
309
  * thumb's — which is what keeps the smallest step at the tightest density
251
310
  * above the WCAG minimum.
252
311
  */
253
- [data-ui='segmented-control'] [data-part='control'] {
312
+ [data-ui-segmented-control] [data-part-control] {
254
313
  appearance: none;
255
314
  background: none;
256
315
  border: 0;
257
316
  border-radius: inherit;
258
317
  cursor: inherit;
259
318
  inset-block: calc(-1 * (var(--_inset) + var(--_border-width)));
260
- inset-inline: 0;
319
+ /* Half the space on each side, so the room between two segments is not a
320
+ place a press lands on nothing. */
321
+ inset-inline: calc(var(--_spacing) / -2);
261
322
  margin: 0;
262
323
  opacity: 0;
263
324
  padding: 0;
264
325
  position: absolute;
265
326
  }
266
327
 
267
- [data-ui='segmented-control'] [data-part='icon'] {
328
+ [data-ui-segmented-control] [data-part-icon] {
268
329
  block-size: var(--_icon-size);
269
330
  display: inline-flex;
270
331
  flex: none;
@@ -276,8 +337,13 @@
276
337
  * narrow clips rather than wrapping the segment onto a second line. The
277
338
  * string stays whole in the DOM: truncation never removes content.
278
339
  */
279
- [data-ui='segmented-control'] [data-part='label'] {
280
- overflow: hidden;
340
+ [data-ui-segmented-control] [data-part-label] {
341
+ /* Clipped along the line only: `hidden` on a one-line box cut the
342
+ descenders and the accents above the cap height. A clipped box is not a
343
+ scroll container, so the flex minimum is given back by hand, or the words
344
+ would hold their full width and run into the next segment. */
345
+ min-inline-size: 0;
346
+ overflow-x: clip;
281
347
  text-overflow: ellipsis;
282
348
  white-space: nowrap;
283
349
  }
@@ -299,28 +365,41 @@
299
365
  * The movement is the one thing in this family a reader's eye follows: it
300
366
  * says which segment was left, which a fill appearing in a new place does
301
367
  * not. It takes a step above the control's own transition, because a thing
302
- * that travels needs longer than a thing that changes colour, and the theme
368
+ * that travels needs longer than a thing that changes color, and the theme
303
369
  * collapses every step to a single frame under `prefers-reduced-motion`.
304
370
  *
305
371
  * The thumb is absent while nothing is checked, so the first selection fades
306
372
  * it in where it belongs rather than sliding it from an edge the reader has
307
373
  * never seen — which is what Mantine does.
308
374
  */
309
- [data-ui='segmented-control'] [data-part='indicator'] {
375
+ [data-ui-segmented-control] [data-part-indicator] {
376
+ /* A raised surface with a hairline and the lightest elevation: the chosen
377
+ segment sits on the track rather than being painted into it. In a dark
378
+ scheme the raised surface is darker than the tinted track, and a thumb
379
+ darker than its track reads as a hole, so it takes a step of the ink. */
310
380
  background: var(
311
381
  --slotted-segmented-control-indicator-background,
312
- var(--slotted-tone-accent-subtle-active, Highlight)
382
+ light-dark(
383
+ var(--slotted-surface-raised, Canvas),
384
+ color-mix(
385
+ in oklab,
386
+ var(--slotted-text, CanvasText) 14%,
387
+ var(--slotted-surface-raised, Canvas)
388
+ )
389
+ )
313
390
  );
314
391
  block-size: calc(100% - var(--_inset) * 2);
315
392
  border: var(--_border-width) solid
316
393
  var(
317
394
  --slotted-segmented-control-indicator-border-color,
318
- var(--slotted-tone-accent-border, Highlight)
395
+ color-mix(in oklab, var(--slotted-text, CanvasText) 10%, transparent)
319
396
  );
320
397
  border-radius: var(--_thumb-radius);
321
- box-shadow: var(--slotted-control-shadow, none);
398
+ box-shadow: var(--slotted-segmented-control-indicator-shadow, var(--slotted-shadow-xs, none));
322
399
  box-sizing: border-box;
323
- inline-size: calc((100% - var(--_inset) * 2) / var(--_count));
400
+ inline-size: calc(
401
+ (100% - var(--_inset) * 2 - var(--_spacing) * (var(--_count) - 1)) / var(--_count)
402
+ );
324
403
  inset-block-start: var(--_inset);
325
404
  inset-inline-start: var(--_inset);
326
405
  pointer-events: none;
@@ -328,7 +407,7 @@
328
407
  transition:
329
408
  opacity var(--slotted-control-transition-duration) var(--slotted-easing-standard),
330
409
  translate var(--_travel) var(--slotted-easing-standard);
331
- translate: calc(var(--_index) * 100%);
410
+ translate: calc(var(--_index) * (100% + var(--_spacing)));
332
411
  z-index: 0;
333
412
 
334
413
  @starting-style {
@@ -336,15 +415,16 @@
336
415
  }
337
416
  }
338
417
 
339
- [data-ui='segmented-control'] [data-part='indicator']:dir(rtl) {
340
- translate: calc(var(--_index) * -100%);
418
+ [data-ui-segmented-control] [data-part-indicator]:dir(rtl) {
419
+ translate: calc(var(--_index) * (-100% - var(--_spacing)));
341
420
  }
342
421
 
343
- [data-ui='segmented-control'][data-part='root'][data-orientation='vertical']
344
- [data-part='indicator'] {
345
- block-size: calc((100% - var(--_inset) * 2) / var(--_count));
422
+ [data-ui-segmented-control][data-part-root][data-orientation='vertical'] [data-part-indicator] {
423
+ block-size: calc(
424
+ (100% - var(--_inset) * 2 - var(--_spacing) * (var(--_count) - 1)) / var(--_count)
425
+ );
346
426
  inline-size: calc(100% - var(--_inset) * 2);
347
- translate: 0 calc(var(--_index) * 100%);
427
+ translate: 0 calc(var(--_index) * (100% + var(--_spacing)));
348
428
  }
349
429
 
350
430
  /**
@@ -355,11 +435,8 @@
355
435
  * was, because a label that thickens when it is chosen moves every label
356
436
  * beside it.
357
437
  */
358
- [data-ui='segmented-control'] [data-part='item'][data-checked] {
359
- color: var(
360
- --slotted-segmented-control-checked-color,
361
- var(--slotted-tone-accent-text, HighlightText)
362
- );
438
+ [data-ui-segmented-control] [data-part-item][data-checked] {
439
+ color: var(--slotted-segmented-control-checked-color, var(--slotted-text, CanvasText));
363
440
  }
364
441
 
365
442
  /* ── Hover and press, held back for every stronger state ──────────────── */
@@ -367,19 +444,19 @@
367
444
  /**
368
445
  * A segment that is not checked answers the pointer with a ground rather
369
446
  * than with a shade of its own ink. Ink alone was the first attempt: with
370
- * the unchecked label already at the page's own colour there was nowhere
447
+ * the unchecked label already at the page's own color there was nowhere
371
448
  * darker for it to go, and a hover that changes nothing is a hover a reader
372
449
  * cannot see. The ground is the neutral one, for the reason `button`
373
450
  * records — a tinted hover on a row of choices reads as a row of status
374
451
  * chips before it reads as one of them being pointed at.
375
452
  */
376
- [data-ui='segmented-control'][data-part='root']:not([data-readonly])
377
- [data-part='item']:hover:not([data-disabled]):not([data-checked]):has(
378
- [data-part='control']:enabled
379
- ) {
453
+ [data-ui-segmented-control][data-part-root]:not([data-readonly])
454
+ [data-part-item]:hover:not([data-disabled]):not([data-checked]):has(
455
+ [data-part-control]:enabled
456
+ )::after {
380
457
  background: var(
381
458
  --slotted-segmented-control-hover-background,
382
- var(--slotted-tone-secondary-subtle-hover, ButtonFace)
459
+ color-mix(in oklab, var(--slotted-text) 5%, transparent)
383
460
  );
384
461
  }
385
462
 
@@ -388,13 +465,13 @@
388
465
  * own pace, which is the rule every activating family here writes: the
389
466
  * duration belongs to the state being entered.
390
467
  */
391
- [data-ui='segmented-control'][data-part='root']:not([data-readonly])
392
- [data-part='item']:active:not([data-disabled]):not([data-checked]):has(
393
- [data-part='control']:enabled
394
- ) {
468
+ [data-ui-segmented-control][data-part-root]:not([data-readonly])
469
+ [data-part-item]:active:not([data-disabled]):not([data-checked]):has(
470
+ [data-part-control]:enabled
471
+ )::after {
395
472
  background: var(
396
473
  --slotted-segmented-control-active-background,
397
- var(--slotted-tone-secondary-subtle-active, ButtonFace)
474
+ color-mix(in oklab, var(--slotted-text) 9%, transparent)
398
475
  );
399
476
  transition-duration: var(--slotted-duration-instant);
400
477
  }
@@ -404,7 +481,7 @@
404
481
  /**
405
482
  * The element holding focus is the radio, and the ring belongs around the
406
483
  * segment. A family that moves its ring has to put out the one the browser
407
- * draws where focus actually is, or it paints two rings in two colours —
484
+ * draws where focus actually is, or it paints two rings in two colors —
408
485
  * the rule `checkbox`, `switch` and `radio-group` each record.
409
486
  *
410
487
  * The ring is drawn *inside* the segment, with its outer edge on the
@@ -421,13 +498,13 @@
421
498
  * it, so a segment that is both checked and focused shows one ring rather
422
499
  * than a ring and a border a pixel apart.
423
500
  */
424
- [data-ui='segmented-control'] [data-part='item']:has([data-part='control']:focus-visible) {
501
+ [data-ui-segmented-control] [data-part-item]:has([data-part-control]:focus-visible) {
425
502
  outline: var(--slotted-focus-ring-width, 2px) solid var(--slotted-focus-ring-color, Highlight);
426
503
  outline-offset: calc(-1 * var(--slotted-focus-ring-width, 2px));
427
504
  z-index: 2;
428
505
  }
429
506
 
430
- [data-ui='segmented-control'] [data-part='control']:focus-visible {
507
+ [data-ui-segmented-control] [data-part-control]:focus-visible {
431
508
  outline: none;
432
509
  }
433
510
 
@@ -436,9 +513,9 @@
436
513
  /**
437
514
  * The ring is retargeted on the element rather than repainted in every rule
438
515
  * that draws one, which is what `--slotted-focus-ring-color-invalid` exists
439
- * for and what keeps the outline and its shadow the same colour.
516
+ * for and what keeps the outline and its shadow the same color.
440
517
  */
441
- [data-ui='segmented-control'][data-part='root'][data-invalid] {
518
+ [data-ui-segmented-control][data-part-root][data-invalid] {
442
519
  --slotted-focus-ring-color: var(
443
520
  --slotted-segmented-control-invalid-focus-ring-color,
444
521
  var(--slotted-focus-ring-color-invalid, Highlight)
@@ -449,7 +526,7 @@
449
526
  var(--slotted-tone-danger-border, ButtonBorder)
450
527
  );
451
528
  /*
452
- * Width as well as colour (WCAG 1.4.1), the edge `text-field` draws: in
529
+ * Width as well as color (WCAG 1.4.1), the edge `text-field` draws: in
453
530
  * `high-contrast` the danger border is the resting edge's black. The line
454
531
  * is a shadow inside the border, so neither the track nor a segment moves,
455
532
  * and it takes the resting lift's place. Focus is the segment's ring, so
@@ -470,18 +547,18 @@
470
547
  /* ── Read-only ────────────────────────────────────────────────────────── */
471
548
 
472
549
  /**
473
- * A read-only control keeps its colours and loses its cursor: it is still
550
+ * A read-only control keeps its colors and loses its cursor: it is still
474
551
  * legible, still focusable and still copyable, and it must not be mistaken
475
552
  * for a disabled one — which is what `docs/component-features.md` §2.5 asks.
476
553
  */
477
- [data-ui='segmented-control'][data-part='root'][data-readonly] [data-part='item'],
478
- [data-ui='segmented-control'][data-part='root'][data-readonly] [data-part='control'] {
554
+ [data-ui-segmented-control][data-part-root][data-readonly] [data-part-item],
555
+ [data-ui-segmented-control][data-part-root][data-readonly] [data-part-control] {
479
556
  cursor: default;
480
557
  }
481
558
 
482
559
  /* ── Disabled ─────────────────────────────────────────────────────────── */
483
560
 
484
- [data-ui='segmented-control'] [data-part='item'][data-disabled] {
561
+ [data-ui-segmented-control] [data-part-item][data-disabled] {
485
562
  color: var(
486
563
  --slotted-segmented-control-disabled-color,
487
564
  var(--slotted-disabled-foreground, GrayText)
@@ -489,26 +566,26 @@
489
566
  cursor: default;
490
567
  }
491
568
 
492
- [data-ui='segmented-control'] [data-part='control']:disabled {
569
+ [data-ui-segmented-control] [data-part-control]:disabled {
493
570
  cursor: default;
494
571
  }
495
572
 
496
573
  /**
497
574
  * A whole control that is unavailable greys its edge and its words and keeps
498
575
  * its track. Painting the track in the disabled ground as well was the first
499
- * attempt, and it made the thumb the same colour as what it sits on: the
576
+ * attempt, and it made the thumb the same color as what it sits on: the
500
577
  * reader could no longer tell which of the three had been chosen. The track
501
578
  * is the ground the thumb is read against, so it is the one thing that has
502
579
  * to stay.
503
580
  */
504
- [data-ui='segmented-control'][data-part='root'][data-disabled] {
581
+ [data-ui-segmented-control][data-part-root][data-disabled] {
505
582
  border-color: var(
506
583
  --slotted-segmented-control-disabled-border-color,
507
584
  var(--slotted-disabled-border, GrayText)
508
585
  );
509
586
  }
510
587
 
511
- [data-ui='segmented-control'][data-part='root'][data-disabled] [data-part='indicator'] {
588
+ [data-ui-segmented-control][data-part-root][data-disabled] [data-part-indicator] {
512
589
  background: var(
513
590
  --slotted-segmented-control-disabled-indicator-background,
514
591
  var(--slotted-disabled-background, ButtonFace)
@@ -524,12 +601,12 @@
524
601
  * ── Underline ──────────────────────────────────────────────────────────
525
602
  *
526
603
  * The same radio group with no track: the words alone, sized to their own
527
- * width, the chosen one in the text colour and underlined. Every other word
528
- * is muted and takes the text colour under the pointer. No thumb, no
604
+ * width, the chosen one in the text color and underlined. Every other word
605
+ * is muted and takes the text color under the pointer. No thumb, no
529
606
  * dividers, no ground — the underline is the mark, and it sits under the
530
607
  * word rather than on an edge of a box (R1).
531
608
  */
532
- [data-ui='segmented-control'][data-part='root'][data-variant='underline'] {
609
+ [data-ui-segmented-control][data-part-root][data-variant='underline'] {
533
610
  --_inner: var(--_height);
534
611
 
535
612
  background: none;
@@ -541,62 +618,63 @@
541
618
  padding: 0;
542
619
  }
543
620
 
544
- [data-ui='segmented-control'][data-part='root'][data-variant='underline'] [data-part='indicator'],
545
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']
546
- [data-part='item']
547
- + [data-part='item']::before {
621
+ [data-ui-segmented-control][data-part-root][data-variant='underline'] [data-part-indicator],
622
+ [data-ui-segmented-control][data-part-root][data-variant='underline']
623
+ [data-part-item]
624
+ + [data-part-item]::before,
625
+ [data-ui-segmented-control][data-part-root][data-variant='underline'] [data-part-item]::after {
548
626
  display: none;
549
627
  }
550
628
 
551
- [data-ui='segmented-control'][data-part='root'][data-variant='underline'] [data-part='item'] {
629
+ [data-ui-segmented-control][data-part-root][data-variant='underline'] [data-part-item] {
552
630
  color: var(--slotted-segmented-control-underline-color, var(--slotted-text-muted, GrayText));
553
631
  font-weight: var(--slotted-font-weight-medium, 500);
554
632
  min-inline-size: var(--slotted-target-min, 24px);
555
633
  padding-inline: 0;
556
634
  }
557
635
 
558
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']
559
- [data-part='item'][data-checked] {
636
+ [data-ui-segmented-control][data-part-root][data-variant='underline']
637
+ [data-part-item][data-checked] {
560
638
  color: var(
561
639
  --slotted-segmented-control-underline-checked-color,
562
640
  var(--slotted-text, CanvasText)
563
641
  );
564
642
  }
565
643
 
566
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']
567
- [data-part='item'][data-checked]
568
- [data-part='label'] {
644
+ [data-ui-segmented-control][data-part-root][data-variant='underline']
645
+ [data-part-item][data-checked]
646
+ [data-part-label] {
569
647
  text-decoration-color: currentColor;
570
648
  text-decoration-line: underline;
571
649
  text-decoration-thickness: var(--slotted-border-width-thick, 2px);
572
650
  text-underline-offset: 0.35em;
573
651
  }
574
652
 
575
- [data-ui='segmented-control'][data-part='root'][data-variant='underline'][data-invalid]
576
- [data-part='item'][data-checked]
577
- [data-part='label'] {
653
+ [data-ui-segmented-control][data-part-root][data-variant='underline'][data-invalid]
654
+ [data-part-item][data-checked]
655
+ [data-part-label] {
578
656
  text-decoration-color: var(--slotted-tone-danger-border, CanvasText);
579
657
  }
580
658
 
581
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']:not([data-readonly])
582
- [data-part='item']:hover:not([data-disabled]):not([data-checked]):has(
583
- [data-part='control']:enabled
659
+ [data-ui-segmented-control][data-part-root][data-variant='underline']:not([data-readonly])
660
+ [data-part-item]:hover:not([data-disabled]):not([data-checked]):has(
661
+ [data-part-control]:enabled
584
662
  ),
585
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']:not([data-readonly])
586
- [data-part='item']:active:not([data-disabled]):not([data-checked]):has(
587
- [data-part='control']:enabled
663
+ [data-ui-segmented-control][data-part-root][data-variant='underline']:not([data-readonly])
664
+ [data-part-item]:active:not([data-disabled]):not([data-checked]):has(
665
+ [data-part-control]:enabled
588
666
  ) {
589
667
  background: none;
590
668
  color: var(--slotted-text, CanvasText);
591
669
  }
592
670
 
593
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']
594
- [data-part='item']:has([data-part='control']:focus-visible) {
671
+ [data-ui-segmented-control][data-part-root][data-variant='underline']
672
+ [data-part-item]:has([data-part-control]:focus-visible) {
595
673
  outline-offset: var(--slotted-focus-ring-offset, 2px);
596
674
  }
597
675
 
598
- [data-ui='segmented-control'][data-part='root'][data-variant='underline']
599
- [data-part='item'][data-disabled] {
676
+ [data-ui-segmented-control][data-part-root][data-variant='underline']
677
+ [data-part-item][data-disabled] {
600
678
  color: var(--slotted-disabled-foreground, GrayText);
601
679
  }
602
680
 
@@ -613,9 +691,9 @@
613
691
  * because `@container (max-inline-size: var(--x))` is invalid CSS.
614
692
  */
615
693
  @container slotted-segmented-control (max-inline-size: 20rem) {
616
- [data-ui='segmented-control'][data-part='root'][data-condense='icons']
617
- [data-part='item']:has([data-part='icon'])
618
- [data-part='label'] {
694
+ [data-ui-segmented-control][data-part-root][data-condense='icons']
695
+ [data-part-item]:has([data-part-icon])
696
+ [data-part-label] {
619
697
  block-size: 1px;
620
698
  clip-path: inset(50%);
621
699
  inline-size: 1px;
@@ -624,19 +702,29 @@
624
702
  white-space: nowrap;
625
703
  }
626
704
 
627
- [data-ui='segmented-control'][data-part='root'][data-condense='icons']
628
- [data-part='item']:has([data-part='icon']) {
705
+ [data-ui-segmented-control][data-part-root][data-condense='icons']
706
+ [data-part-item]:has([data-part-icon]) {
629
707
  padding-inline: 0;
630
708
  }
631
709
  }
632
710
 
633
711
  /*
634
- * Forced colours remove every box shadow, and the edge with them. The width
712
+ * Forced colors remove every box shadow, and the edge with them. The width
635
713
  * comes back as an outline inside the border; the
636
714
  * ring belongs to a segment and leaves it alone.
637
715
  */
638
716
  @media (forced-colors: active) {
639
- [data-ui='segmented-control'][data-part='root'][data-invalid] {
717
+ /* The neutral track is a tint, and a tint flattens to Canvas: the edge
718
+ says where the control is, and the thumb's edge says which is chosen. */
719
+ [data-ui-segmented-control][data-part-root]:not([data-variant='underline']) {
720
+ border-color: ButtonBorder;
721
+ }
722
+
723
+ [data-ui-segmented-control] [data-part-indicator] {
724
+ border-color: Highlight;
725
+ }
726
+
727
+ [data-ui-segmented-control][data-part-root][data-invalid] {
640
728
  outline: var(--_invalid-edge-width) solid CanvasText;
641
729
  outline-offset: calc(-1 * (var(--_border-width) + var(--_invalid-edge-width)));
642
730
  }