@ropav/styles 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +79 -0
  2. package/dist/components/accordion.css +1 -9
  3. package/dist/components/alert-dialog.css +0 -12
  4. package/dist/components/autocomplete.css +25 -35
  5. package/dist/components/breadcrumbs.css +9 -2
  6. package/dist/components/button-group.css +0 -4
  7. package/dist/components/button.css +3 -7
  8. package/dist/components/calendar-year-picker.css +19 -7
  9. package/dist/components/calendar.css +46 -21
  10. package/dist/components/checkbox.css +54 -56
  11. package/dist/components/chip.css +3 -1
  12. package/dist/components/close-button.css +7 -6
  13. package/dist/components/color-area.css +6 -6
  14. package/dist/components/color-input-group.css +10 -27
  15. package/dist/components/color-picker.css +1 -5
  16. package/dist/components/color-slider.css +14 -12
  17. package/dist/components/color-swatch-picker.css +2 -85
  18. package/dist/components/color-swatch.css +1 -1
  19. package/dist/components/combo-box.css +13 -3
  20. package/dist/components/date-input-group.css +34 -32
  21. package/dist/components/date-picker.css +1 -5
  22. package/dist/components/date-range-picker.css +1 -5
  23. package/dist/components/disclosure.css +0 -4
  24. package/dist/components/drawer.css +4 -8
  25. package/dist/components/drop-zone/drop-zone.styles.d.ts +34 -0
  26. package/dist/components/drop-zone/drop-zone.styles.d.ts.map +1 -0
  27. package/dist/components/drop-zone/drop-zone.styles.js +8 -0
  28. package/dist/components/drop-zone/index.d.ts +2 -0
  29. package/dist/components/drop-zone/index.d.ts.map +1 -0
  30. package/dist/components/drop-zone/index.js +2 -0
  31. package/dist/components/drop-zone.css +78 -0
  32. package/dist/components/dropdown.css +0 -4
  33. package/dist/components/error-message.css +0 -4
  34. package/dist/components/field-error.css +0 -4
  35. package/dist/components/index.css +1 -0
  36. package/dist/components/index.d.ts +1 -0
  37. package/dist/components/index.d.ts.map +1 -1
  38. package/dist/components/input-group.css +12 -37
  39. package/dist/components/input-otp.css +14 -26
  40. package/dist/components/input.css +11 -32
  41. package/dist/components/kbd.css +3 -1
  42. package/dist/components/label.css +7 -2
  43. package/dist/components/link.css +13 -11
  44. package/dist/components/list-box-item.css +4 -10
  45. package/dist/components/menu-item.css +4 -10
  46. package/dist/components/meter.css +8 -16
  47. package/dist/components/modal.css +0 -12
  48. package/dist/components/number-field.css +23 -35
  49. package/dist/components/pagination.css +0 -4
  50. package/dist/components/popover.css +0 -4
  51. package/dist/components/progress-bar/progress-bar.styles.d.ts +36 -0
  52. package/dist/components/progress-bar/progress-bar.styles.d.ts.map +1 -1
  53. package/dist/components/progress-bar/progress-bar.styles.js +10 -0
  54. package/dist/components/progress-bar.css +82 -16
  55. package/dist/components/progress-circle.css +0 -4
  56. package/dist/components/radio.css +7 -9
  57. package/dist/components/range-calendar.css +73 -31
  58. package/dist/components/search-field.css +11 -28
  59. package/dist/components/segmented-control.css +9 -14
  60. package/dist/components/select.css +18 -32
  61. package/dist/components/sidebar/sidebar.styles.d.ts +36 -0
  62. package/dist/components/sidebar/sidebar.styles.d.ts.map +1 -1
  63. package/dist/components/sidebar/sidebar.styles.js +14 -1
  64. package/dist/components/sidebar.css +132 -38
  65. package/dist/components/slider.css +10 -11
  66. package/dist/components/splitter.css +44 -36
  67. package/dist/components/switch.css +16 -15
  68. package/dist/components/table.css +69 -27
  69. package/dist/components/tabs.css +8 -19
  70. package/dist/components/tag.css +32 -24
  71. package/dist/components/textarea.css +11 -32
  72. package/dist/components/toast.css +3 -1
  73. package/dist/components/toggle-button-group.css +0 -4
  74. package/dist/components/toggle-button.css +2 -6
  75. package/dist/components/tooltip.css +0 -4
  76. package/dist/components/typography.css +12 -4
  77. package/dist/components/virtualizer.css +11 -3
  78. package/dist/index.js +2 -1
  79. package/dist/ropav.min.css +1 -1
  80. package/dist/themes/airbnb.css +6 -4
  81. package/dist/themes/coinbase.css +6 -4
  82. package/dist/themes/default.css +24 -4
  83. package/dist/themes/discord.css +6 -4
  84. package/dist/themes/hero.css +24 -4
  85. package/dist/themes/lavender.css +6 -4
  86. package/dist/themes/mint.css +6 -4
  87. package/dist/themes/netflix.css +6 -4
  88. package/dist/themes/rabbit.css +6 -4
  89. package/dist/themes/shared/theme.css +1 -0
  90. package/dist/themes/sky.css +6 -4
  91. package/dist/themes/spotify.css +6 -4
  92. package/dist/themes/uber.css +6 -4
  93. package/package.json +1 -1
  94. package/src/components/drop-zone/drop-zone.styles.ts +12 -0
  95. package/src/components/drop-zone/index.ts +1 -0
  96. package/src/components/index.ts +1 -0
  97. package/src/components/progress-bar/progress-bar.styles.ts +14 -0
  98. package/src/components/sidebar/sidebar.styles.ts +23 -0
@@ -13,6 +13,12 @@
13
13
  /* Default color token (accent) */
14
14
  --progress-bar-fill: var(--accent);
15
15
 
16
+ /* Derived from the fill rather than declared per colour: mixing toward the track's own colour
17
+ * lands lighter in the light theme and darker in the dark one, so the band separates whichever
18
+ * side of the fill it falls on. */
19
+ --progress-bar-stripe: color-mix(in oklab, var(--progress-bar-fill) 80%, var(--default));
20
+ --progress-bar-stripe-size: 1rem;
21
+
16
22
  [data-slot="label"] {
17
23
  @apply w-fit text-sm font-medium;
18
24
 
@@ -26,7 +32,9 @@
26
32
  }
27
33
 
28
34
  .progress-bar__track {
29
- @apply relative overflow-hidden rounded-sm bg-default;
35
+ @apply relative overflow-hidden bg-default;
36
+
37
+ border-radius: min(32px, var(--component-radius));
30
38
 
31
39
  grid-area: track;
32
40
 
@@ -43,7 +51,9 @@
43
51
  }
44
52
 
45
53
  .progress-bar__fill {
46
- @apply absolute start-0 top-0 h-full rounded-sm;
54
+ @apply absolute start-0 top-0 h-full;
55
+
56
+ border-radius: min(32px, var(--component-radius));
47
57
 
48
58
  background-color: var(--progress-bar-fill);
49
59
 
@@ -51,10 +61,6 @@
51
61
  background-color: Highlight;
52
62
  }
53
63
 
54
- /**
55
- * Transitions
56
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
57
- */
58
64
  transition: width 300ms var(--ease-out);
59
65
  @apply motion-reduce:transition-none;
60
66
  }
@@ -100,12 +106,12 @@
100
106
  ========================================================================== */
101
107
 
102
108
  .progress-bar--sm {
103
- .progress-bar__track {
104
- @apply h-1 rounded-xs;
105
- }
109
+ /* One 1rem tile spans more than the track is tall, so a 4px bar would show a single smear
110
+ * rather than a run of stripes. The tile tracks the height instead. */
111
+ --progress-bar-stripe-size: 0.5rem;
106
112
 
107
- .progress-bar__fill {
108
- @apply rounded-xs;
113
+ .progress-bar__track {
114
+ @apply h-1;
109
115
  }
110
116
  }
111
117
 
@@ -114,12 +120,10 @@
114
120
  }
115
121
 
116
122
  .progress-bar--lg {
117
- .progress-bar__track {
118
- @apply h-3 rounded-md;
119
- }
123
+ --progress-bar-stripe-size: 1.25rem;
120
124
 
121
- .progress-bar__fill {
122
- @apply rounded-md;
125
+ .progress-bar__track {
126
+ @apply h-3;
123
127
  }
124
128
  }
125
129
 
@@ -146,3 +150,65 @@
146
150
  .progress-bar--danger {
147
151
  --progress-bar-fill: var(--danger);
148
152
  }
153
+
154
+ /* ==========================================================================
155
+ Stripes
156
+
157
+ The band paints on the fill's `::after`, not on the fill. `animation` on the fill itself is
158
+ already spoken for by the indeterminate slide, at a specificity a modifier class does not
159
+ reach, so a band put there would be the one that loses. On a box of its own it composes with
160
+ the slide instead of trading places with it.
161
+ ========================================================================== */
162
+
163
+ .progress-bar--striped,
164
+ .progress-bar--animated {
165
+ .progress-bar__fill::after {
166
+ @apply absolute inset-0 content-[''];
167
+
168
+ border-radius: inherit;
169
+
170
+ /* Tiled by `background-size` rather than repeated by the gradient, so one tile is exactly the
171
+ * distance the animation travels and the loop closes without a seam. */
172
+ background-image: linear-gradient(
173
+ 45deg,
174
+ var(--progress-bar-stripe) 25%,
175
+ transparent 25% 50%,
176
+ var(--progress-bar-stripe) 50% 75%,
177
+ transparent 75%
178
+ );
179
+ background-size: var(--progress-bar-stripe-size) var(--progress-bar-stripe-size);
180
+ }
181
+
182
+ /* Forced colors flattens the fill to `Highlight` and leaves this `background-image` painting over
183
+ * it in author colours. */
184
+ @media (forced-colors: active) {
185
+ .progress-bar__fill::after {
186
+ content: none;
187
+ }
188
+ }
189
+ }
190
+
191
+ .progress-bar--animated {
192
+ .progress-bar__fill {
193
+ /* On the host, not inside the `::after` block: the variant carries its own `::before`/`::after`
194
+ * slot, and written under the pseudo-element instead its ancestor condition would land after
195
+ * the pseudo-element and compile to an empty `:is()`. Stopped this way the band stays put
196
+ * rather than disappearing, which is `--striped`. */
197
+ @apply motion-reduce:animate-none;
198
+
199
+ &::after {
200
+ animation: progress-bar-stripes 1s linear infinite;
201
+ }
202
+
203
+ /* Travelling toward the inline end is what reads as progress; in RTL that is the other way. */
204
+ &:dir(rtl)::after {
205
+ animation-direction: reverse;
206
+ }
207
+ }
208
+ }
209
+
210
+ @keyframes progress-bar-stripes {
211
+ to {
212
+ background-position-x: var(--progress-bar-stripe-size);
213
+ }
214
+ }
@@ -34,10 +34,6 @@
34
34
  stroke: Highlight;
35
35
  }
36
36
 
37
- /**
38
- * Transitions
39
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
40
- */
41
37
  transition: stroke-dashoffset 300ms var(--ease-out);
42
38
  @apply motion-reduce:transition-none;
43
39
  }
@@ -54,10 +54,6 @@
54
54
  .radio__control {
55
55
  @apply relative inline-flex size-4 shrink-0 items-center justify-center rounded-lg border [border-width:var(--border-width-field)] border-field-border bg-field shadow-field outline-none no-highlight;
56
56
 
57
- /**
58
- * Transitions
59
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
60
- */
61
57
  transition:
62
58
  background-color 200ms var(--ease-out),
63
59
  border-color 200ms var(--ease-out),
@@ -134,6 +130,13 @@
134
130
  @apply absolute inset-0 flex items-center justify-center;
135
131
 
136
132
  pointer-events: none;
133
+
134
+ /* On the indicator, not in `:empty::before` where the transition lives: the variant reaches a
135
+ * pseudo-element from its originating element, and appending its condition after `::before`
136
+ * matches nothing. `:empty` because without it this ties with that rule and loses on order. */
137
+ &:empty {
138
+ @apply motion-reduce:transition-none;
139
+ }
137
140
  }
138
141
 
139
142
  /* :empty pseudo-class ensures these styles only apply when the indicator has no custom children
@@ -146,14 +149,9 @@
146
149
  height: 100%;
147
150
  scale: 1;
148
151
 
149
- /**
150
- * Transitions
151
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
152
- */
153
152
  transition:
154
153
  scale 200ms var(--ease-out),
155
154
  background-color 200ms var(--ease-out);
156
- @apply motion-reduce:transition-none;
157
155
  }
158
156
 
159
157
  /* Selected state */
@@ -80,14 +80,12 @@
80
80
  }
81
81
 
82
82
  .range-calendar__nav-button {
83
- @apply flex size-6 items-center justify-center rounded-xl text-accent-soft-foreground;
83
+ @apply flex size-6 items-center justify-center text-accent-soft-foreground;
84
+
85
+ border-radius: min(32px, var(--component-radius));
84
86
 
85
87
  will-change: scale;
86
88
 
87
- /**
88
- * Transitions
89
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
90
- */
91
89
  transition:
92
90
  transform 250ms var(--ease-out),
93
91
  background-color 100ms var(--ease-out),
@@ -101,7 +99,7 @@
101
99
  @media (hover: hover) {
102
100
  &:hover,
103
101
  &[data-hovered="true"] {
104
- @apply bg-default text-accent-soft-foreground;
102
+ @apply bg-state-layer;
105
103
  }
106
104
  }
107
105
 
@@ -182,14 +180,35 @@
182
180
  * RangeCalendar Cells
183
181
  * -------------------------------------------------------------------------- */
184
182
  .range-calendar__cell {
185
- @apply relative z-1 mx-0 my-[2px] rounded-3xl p-0 outline-none;
183
+ @apply relative z-1 mx-0 my-[2px] p-0 outline-none;
184
+
185
+ --range-calendar-day-radius: min(32px, var(--component-radius));
186
+ --range-calendar-wrap-radius: calc(var(--range-calendar-day-radius) / 3);
187
+
188
+ border-radius: var(--range-calendar-day-radius);
186
189
  cursor: var(--cursor-interactive);
187
190
 
191
+ /* The range track paints on the cell and the day paints on the button inside it, so both sets
192
+ * are declared here and the button reads them by inheritance. A cap is a day at either end of
193
+ * the range; several states land in pairs, and one declaration cannot tell them apart. */
194
+ --range-calendar-cell-bg: transparent;
195
+ --range-calendar-cell-bg-selected: var(--accent-soft);
196
+ --range-calendar-cell-bg-selected-outside-month: color-mix(
197
+ in oklab,
198
+ var(--state-layer) 20%,
199
+ transparent
200
+ );
201
+ --range-calendar-day-bg-hover: var(--state-layer);
202
+ --range-calendar-day-bg-today: var(--accent-soft);
203
+ --range-calendar-day-bg-today-hover: var(--accent-soft-hover);
204
+ --range-calendar-day-bg-cap: var(--accent);
205
+ --range-calendar-day-bg-cap-pressed: var(--accent-hover);
206
+ --range-calendar-day-fg-today: var(--accent-soft-foreground);
207
+ --range-calendar-day-fg-cap: var(--accent-foreground);
208
+
209
+ background-color: var(--range-calendar-cell-bg);
210
+
188
211
  will-change: background-color, border-color;
189
- /**
190
- * Transitions
191
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
192
- */
193
212
  transition:
194
213
  box-shadow 100ms var(--ease-out),
195
214
  border-color 100ms var(--ease-out);
@@ -197,7 +216,9 @@
197
216
 
198
217
  /* Inner interactive circle/capsule (equivalent to React Aria "button-base") */
199
218
  .range-calendar__cell-button {
200
- @apply flex aspect-square w-full items-center justify-center rounded-3xl text-sm font-medium text-foreground no-highlight;
219
+ @apply flex aspect-square w-full items-center justify-center text-sm font-medium text-foreground no-highlight;
220
+
221
+ border-radius: var(--range-calendar-day-radius);
201
222
 
202
223
  will-change: scale;
203
224
  transition: scale 200ms var(--ease-out);
@@ -217,7 +238,8 @@
217
238
  /* Today indicator */
218
239
  &[data-today="true"] {
219
240
  .range-calendar__cell-button {
220
- @apply bg-accent-soft text-accent-soft-foreground;
241
+ background-color: var(--range-calendar-day-bg-today);
242
+ color: var(--range-calendar-day-fg-today);
221
243
 
222
244
  /* An edge rather than a fill, so today still reads as itself once it is also in range */
223
245
  @media (forced-colors: active) {
@@ -230,7 +252,7 @@
230
252
  &:hover:not([data-selected="true"]),
231
253
  &[data-hovered="true"]:not([data-selected="true"]) {
232
254
  .range-calendar__cell-button {
233
- @apply bg-accent-soft-hover;
255
+ background-color: var(--range-calendar-day-bg-today-hover);
234
256
  }
235
257
  }
236
258
  }
@@ -238,7 +260,9 @@
238
260
 
239
261
  /* Range selected track (middle segment) */
240
262
  &[data-selected="true"]:not([data-outside-month="true"]) {
241
- @apply rounded-none bg-accent-soft;
263
+ @apply rounded-none;
264
+
265
+ background-color: var(--range-calendar-cell-bg-selected);
242
266
 
243
267
  /* The track is a background and nothing else, so Forced Colors Mode flattens it into the
244
268
  * page and the range stops being visible. The day button declares its own `color`, so
@@ -257,16 +281,22 @@
257
281
 
258
282
  /* Round row boundaries so the range track looks continuous across weeks */
259
283
  &[data-selected="true"]:is(td:first-child > *, [aria-disabled] + td > *) {
260
- @apply rounded-ss-lg rounded-es-lg;
284
+ border-start-start-radius: var(--range-calendar-wrap-radius);
285
+ border-end-start-radius: var(--range-calendar-wrap-radius);
286
+
261
287
  &[data-selection-start="true"] {
262
- @apply rounded-ss-3xl rounded-es-3xl;
288
+ border-start-start-radius: var(--range-calendar-day-radius);
289
+ border-end-start-radius: var(--range-calendar-day-radius);
263
290
  }
264
291
  }
265
292
 
266
293
  &[data-selected="true"]:is(td:last-child > *, td:has(+ [aria-disabled]) > *) {
267
- @apply rounded-se-lg rounded-ee-lg;
294
+ border-start-end-radius: var(--range-calendar-wrap-radius);
295
+ border-end-end-radius: var(--range-calendar-wrap-radius);
296
+
268
297
  &[data-selection-end="true"] {
269
- @apply rounded-se-3xl rounded-ee-3xl;
298
+ border-start-end-radius: var(--range-calendar-day-radius);
299
+ border-end-end-radius: var(--range-calendar-day-radius);
270
300
  }
271
301
  }
272
302
 
@@ -276,7 +306,8 @@
276
306
  @apply z-2;
277
307
 
278
308
  .range-calendar__cell-button {
279
- @apply bg-accent text-accent-foreground;
309
+ background-color: var(--range-calendar-day-bg-cap);
310
+ color: var(--range-calendar-day-fg-cap);
280
311
 
281
312
  /* Caps read the same as the track here. Forced colors offers one selection colour, and
282
313
  * spending it on the shape that matters - the range - beats splitting it. */
@@ -293,11 +324,13 @@
293
324
  } */
294
325
 
295
326
  &[data-selection-start="true"]:not([data-outside-month="true"]) {
296
- @apply rounded-ss-3xl rounded-es-3xl;
327
+ border-start-start-radius: var(--range-calendar-day-radius);
328
+ border-end-start-radius: var(--range-calendar-day-radius);
297
329
  }
298
330
 
299
331
  &[data-selection-end="true"]:not([data-outside-month="true"]) {
300
- @apply rounded-se-3xl rounded-ee-3xl;
332
+ border-start-end-radius: var(--range-calendar-day-radius);
333
+ border-end-end-radius: var(--range-calendar-day-radius);
301
334
  }
302
335
 
303
336
  /* Pressed state */
@@ -310,7 +343,7 @@
310
343
  &[data-selection-start="true"],
311
344
  &[data-selection-end="true"] {
312
345
  .range-calendar__cell-button {
313
- @apply bg-accent-hover;
346
+ background-color: var(--range-calendar-day-bg-cap-pressed);
314
347
  }
315
348
  }
316
349
  }
@@ -320,7 +353,7 @@
320
353
  &:hover:not([data-selected="true"]),
321
354
  &[data-hovered="true"]:not([data-selected="true"]) {
322
355
  .range-calendar__cell-button {
323
- @apply bg-default;
356
+ background-color: var(--range-calendar-day-bg-hover);
324
357
  }
325
358
  }
326
359
  }
@@ -334,7 +367,7 @@
334
367
  [data-selection-start="true"],
335
368
  [data-selection-end="true"]
336
369
  ) {
337
- @apply bg-default/20;
370
+ background-color: var(--range-calendar-cell-bg-selected-outside-month);
338
371
  }
339
372
 
340
373
  /* Unavailable dates */
@@ -356,11 +389,13 @@
356
389
  td:has(> .range-calendar__cell[data-outside-month="true"])
357
390
  + td
358
391
  > .range-calendar__cell[data-selected="true"] {
359
- @apply rounded-ss-lg rounded-es-lg;
392
+ border-start-start-radius: var(--range-calendar-wrap-radius);
393
+ border-end-start-radius: var(--range-calendar-wrap-radius);
360
394
 
361
395
  &[data-outside-month="true"],
362
396
  &[data-selection-start="true"] {
363
- @apply rounded-ss-3xl rounded-es-3xl;
397
+ border-start-start-radius: var(--range-calendar-day-radius);
398
+ border-end-start-radius: var(--range-calendar-day-radius);
364
399
  }
365
400
  }
366
401
 
@@ -370,20 +405,27 @@
370
405
  + td > .range-calendar__cell[data-outside-month="true"]
371
406
  )
372
407
  > .range-calendar__cell[data-selected="true"] {
373
- @apply rounded-se-lg rounded-ee-lg;
408
+ border-start-end-radius: var(--range-calendar-wrap-radius);
409
+ border-end-end-radius: var(--range-calendar-wrap-radius);
374
410
 
375
411
  &[data-outside-month="true"],
376
412
  &[data-selection-end="true"] {
377
- @apply rounded-se-3xl rounded-ee-3xl;
413
+ border-start-end-radius: var(--range-calendar-day-radius);
414
+ border-end-end-radius: var(--range-calendar-day-radius);
378
415
  }
379
416
  }
380
417
 
381
418
  /* Cell indicator - small dot at bottom center of cell */
382
419
  .range-calendar__cell-indicator {
383
- @apply absolute bottom-1 left-1/2 size-[3px] -translate-x-1/2 rounded-xs bg-muted;
420
+ @apply absolute bottom-1 left-1/2 size-[3px] -translate-x-1/2 rounded-xs;
421
+
422
+ --range-calendar-cell-indicator-bg: var(--muted);
423
+ --range-calendar-cell-indicator-bg-selected: var(--accent-foreground);
424
+
425
+ background-color: var(--range-calendar-cell-indicator-bg);
384
426
 
385
427
  /* Indicator color changes when cell is selected */
386
428
  [data-selected="true"] > & {
387
- @apply bg-accent-foreground;
429
+ background-color: var(--range-calendar-cell-indicator-bg-selected);
388
430
  }
389
431
  }
@@ -21,7 +21,14 @@
21
21
  }
22
22
 
23
23
  .search-field__group {
24
- @apply relative inline-flex h-9 items-center overflow-hidden rounded-field border bg-field text-sm text-field-foreground shadow-field outline-none;
24
+ @apply relative inline-flex h-9 items-center overflow-hidden rounded-field border text-sm text-field-foreground shadow-field outline-none;
25
+
26
+ /* The fill, per state. The `--secondary` variant re-points these and declares nothing else. */
27
+ --search-field-group-bg: var(--field-background, var(--default));
28
+ --search-field-group-bg-hover: var(--field-hover);
29
+ --search-field-group-bg-focus: var(--field-focus);
30
+
31
+ background-color: var(--search-field-group-bg);
25
32
  border-width: var(--border-width-field);
26
33
  border-color: var(--field-border);
27
34
 
@@ -33,10 +40,6 @@
33
40
  outline-offset: -1px;
34
41
  }
35
42
 
36
- /**
37
- * Transitions
38
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
39
- */
40
43
  transition:
41
44
  background-color 150ms var(--ease-smooth),
42
45
  border-color 150ms var(--ease-smooth),
@@ -47,7 +50,7 @@
47
50
  @media (hover: hover) {
48
51
  &:hover:not(:focus-within),
49
52
  &[data-hovered="true"]:not([data-focus-within="true"]) {
50
- @apply bg-field-hover;
53
+ background-color: var(--search-field-group-bg-hover);
51
54
  border-color: var(--field-border-hover);
52
55
  }
53
56
  }
@@ -61,7 +64,7 @@
61
64
  /* Invalid state */
62
65
  &[data-invalid="true"] {
63
66
  @apply status-invalid-field;
64
- background-color: var(--field-focus);
67
+ background-color: var(--search-field-group-bg-focus);
65
68
  border-color: var(--color-field-border-invalid);
66
69
  }
67
70
 
@@ -82,7 +85,7 @@
82
85
  */
83
86
  &:has([data-slot="search-field-input"]:-webkit-autofill),
84
87
  &:has([data-slot="search-field-input"]:autofill) {
85
- background-color: var(--field-focus);
88
+ background-color: var(--search-field-group-bg-focus);
86
89
  border-color: var(--field-border-focus);
87
90
  }
88
91
  }
@@ -154,31 +157,11 @@
154
157
 
155
158
  .search-field--secondary .search-field__group {
156
159
  @apply shadow-none;
157
- background-color: var(--search-field-group-bg);
158
160
 
159
161
  --search-field-group-bg: var(--default);
160
162
  --search-field-group-bg-hover: var(--default-hover);
161
163
  --search-field-group-bg-focus: var(--default);
162
164
 
163
- @media (hover: hover) {
164
- &:hover:not(:focus-within),
165
- &[data-hovered="true"]:not([data-focus-within="true"]) {
166
- background-color: var(--search-field-group-bg-hover);
167
- }
168
- }
169
-
170
- &:focus-within,
171
- &[data-focus-within="true"] {
172
- background-color: var(--search-field-group-bg-focus);
173
- }
174
-
175
- /* Invalid state */
176
- &[data-invalid="true"] {
177
- @apply status-invalid-field;
178
- border-color: var(--color-field-border-invalid);
179
- background-color: var(--search-field-group-bg-focus);
180
- }
181
-
182
165
  [data-slot="search-field-input"] {
183
166
  @apply bg-transparent;
184
167
  }
@@ -38,15 +38,17 @@
38
38
  ========================================================================== */
39
39
 
40
40
  .segmented-control__item {
41
- @apply relative inline-flex h-7 min-w-0 shrink-0 appearance-none items-center justify-center gap-2 rounded-component border-0 bg-transparent px-3 text-center text-sm font-medium whitespace-nowrap text-muted outline-none select-none no-highlight;
41
+ @apply relative inline-flex h-7 min-w-0 shrink-0 appearance-none items-center justify-center gap-2 rounded-component border-0 bg-transparent px-3 text-center text-sm font-medium whitespace-nowrap outline-none select-none no-highlight;
42
+
43
+ --segmented-control-item-fg: var(--muted);
44
+ --segmented-control-item-fg-hover: var(--foreground);
45
+ --segmented-control-item-fg-selected: var(--segment-foreground);
46
+
47
+ color: var(--segmented-control-item-fg);
42
48
 
43
49
  z-index: 1;
44
50
  cursor: var(--cursor-interactive);
45
51
 
46
- /**
47
- * Transitions
48
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
49
- */
50
52
  transition:
51
53
  color 150ms var(--ease-smooth),
52
54
  opacity 150ms var(--ease-smooth);
@@ -54,7 +56,7 @@
54
56
 
55
57
  /* Selected state */
56
58
  &[data-selected="true"] {
57
- @apply text-segment-foreground;
59
+ color: var(--segmented-control-item-fg-selected);
58
60
 
59
61
  /* Sits on top of the indicator, which forced colors paints `Highlight`. `forced-color-adjust`
60
62
  * suppresses the `Canvas` backplate Chromium would otherwise paint behind this label - it
@@ -69,7 +71,7 @@
69
71
  @media (hover: hover) {
70
72
  &:not([data-selected="true"]):not([data-disabled="true"]):hover,
71
73
  &[data-hovered="true"]:not([data-selected="true"]):not([data-disabled="true"]) {
72
- @apply text-foreground;
74
+ color: var(--segmented-control-item-fg-hover);
73
75
  }
74
76
  }
75
77
 
@@ -107,10 +109,6 @@
107
109
  .segmented-control__separator {
108
110
  @apply pointer-events-none absolute start-0 top-1/4 h-1/2 w-px rounded-sm bg-muted/25;
109
111
 
110
- /**
111
- * Transitions
112
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
113
- */
114
112
  transition: opacity 150ms var(--ease-smooth);
115
113
  @apply motion-reduce:transition-none;
116
114
 
@@ -148,9 +146,6 @@
148
146
  }
149
147
 
150
148
  /**
151
- * Transitions
152
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
153
- *
154
149
  * `useSharedElement` reads this very declaration to decide what to carry across the handoff,
155
150
  * so the stylesheet stays the only place that decides what animates. `height` is listed even
156
151
  * though the pill only travels along one axis today, so a vertical orientation needs no
@@ -15,7 +15,14 @@
15
15
  }
16
16
 
17
17
  .select__trigger {
18
- @apply relative isolate inline-flex min-h-9 rounded-field border bg-field px-3 field-line-md text-field-foreground shadow-field outline-none select-none no-highlight;
18
+ @apply relative isolate inline-flex min-h-9 rounded-field border px-3 field-line-md text-field-foreground shadow-field outline-none select-none no-highlight;
19
+
20
+ /* The fill, per state. The `--secondary` variant re-points these and declares nothing else. */
21
+ --select-trigger-bg: var(--field-background, var(--default));
22
+ --select-trigger-bg-hover: var(--field-hover);
23
+ --select-trigger-bg-focus: var(--field-focus);
24
+
25
+ background-color: var(--select-trigger-bg);
19
26
 
20
27
  /* Forced Colors Mode flattens the fill onto the page and strips the shadow, leaving a field that
21
28
  * reads as bare text - `--border-width-field` is 0, so the declared border brings nothing back on
@@ -26,10 +33,6 @@
26
33
  outline-offset: -1px;
27
34
  }
28
35
 
29
- /**
30
- * Transitions
31
- * CRITICAL: motion-reduce must be AFTER transition for correct override specificity
32
- */
33
36
  transition:
34
37
  background-color 150ms var(--ease-smooth),
35
38
  border-color 150ms var(--ease-smooth),
@@ -51,7 +54,7 @@
51
54
  @media (hover: hover) {
52
55
  &:hover,
53
56
  &[data-hovered="true"] {
54
- @apply bg-field-hover;
57
+ background-color: var(--select-trigger-bg-hover);
55
58
  border-color: var(--field-border-hover);
56
59
  }
57
60
  }
@@ -61,7 +64,7 @@
61
64
  &[data-focus-visible="true"] {
62
65
  @apply status-focused;
63
66
  border-color: var(--field-border-focus);
64
- background-color: var(--field-focus);
67
+ background-color: var(--select-trigger-bg-focus);
65
68
  }
66
69
 
67
70
  /* Focus state */
@@ -73,7 +76,7 @@
73
76
  .select[data-invalid="true"] &,
74
77
  .select[aria-invalid="true"] & {
75
78
  @apply status-invalid-field;
76
- background-color: var(--field-focus);
79
+ background-color: var(--select-trigger-bg-focus);
77
80
  }
78
81
 
79
82
  /* Disabled state */
@@ -91,39 +94,22 @@
91
94
 
92
95
  .select--secondary .select__trigger {
93
96
  @apply shadow-none;
94
- background-color: var(--select-trigger-bg);
95
97
 
96
98
  --select-trigger-bg: var(--default);
97
99
  --select-trigger-bg-hover: var(--default-hover);
98
100
  --select-trigger-bg-focus: var(--default);
99
-
100
- @media (hover: hover) {
101
- &:hover,
102
- &[data-hovered="true"] {
103
- background-color: var(--select-trigger-bg-hover);
104
- }
105
- }
106
-
107
- &:focus-visible:not(:focus),
108
- &[data-focus-visible="true"] {
109
- background-color: var(--select-trigger-bg-focus);
110
- }
111
-
112
- &:focus,
113
- &[data-focus="true"] {
114
- }
115
-
116
- .select[data-invalid="true"] &,
117
- .select[aria-invalid="true"] & {
118
- background-color: var(--select-trigger-bg-focus);
119
- }
120
101
  }
121
102
 
122
103
  .select__value {
123
- @apply flex-1 text-start wrap-break-word text-current;
104
+ @apply flex-1 text-start wrap-break-word;
105
+
106
+ --select-value-fg: currentcolor;
107
+ --select-value-fg-placeholder: var(--field-placeholder, var(--muted));
108
+
109
+ color: var(--select-value-fg);
124
110
 
125
111
  &[data-placeholder="true"] {
126
- @apply text-field-placeholder;
112
+ color: var(--select-value-fg-placeholder);
127
113
  }
128
114
 
129
115
  /* Removes the list-box-item indicator element from the select value*/