@frontile/theme 0.18.0-alpha.9 → 0.18.0-beta.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 (65) hide show
  1. package/README.md +3 -2
  2. package/declarations/colors/config.d.ts +10 -4
  3. package/declarations/colors/semantic.d.ts +4 -0
  4. package/declarations/colors/types.d.ts +118 -13
  5. package/declarations/colors/util.d.ts +2 -1
  6. package/declarations/colors.d.ts +1 -0
  7. package/declarations/components/accordion.d.ts +308 -0
  8. package/declarations/components/alert.d.ts +294 -0
  9. package/declarations/components/avatar.d.ts +9 -7
  10. package/declarations/components/button.d.ts +118 -48
  11. package/declarations/components/calendar.d.ts +382 -0
  12. package/declarations/components/chip.d.ts +79 -42
  13. package/declarations/components/close-button.d.ts +9 -7
  14. package/declarations/components/command.d.ts +281 -0
  15. package/declarations/components/divider.d.ts +9 -7
  16. package/declarations/components/dropdown.d.ts +11 -9
  17. package/declarations/components/external-link.d.ts +160 -0
  18. package/declarations/components/forms/forms-legacy.d.ts +108 -84
  19. package/declarations/components/forms/forms.d.ts +652 -162
  20. package/declarations/components/index.d.ts +11 -0
  21. package/declarations/components/kbd.d.ts +315 -0
  22. package/declarations/components/listbox.d.ts +122 -23
  23. package/declarations/components/notification-card.d.ts +182 -111
  24. package/declarations/components/notifications-container.d.ts +111 -40
  25. package/declarations/components/overlays.d.ts +429 -29
  26. package/declarations/components/pagination.d.ts +359 -0
  27. package/declarations/components/popover.d.ts +11 -9
  28. package/declarations/components/progress-bar.d.ts +29 -12
  29. package/declarations/components/segmented-control.d.ts +463 -0
  30. package/declarations/components/shared.d.ts +9 -0
  31. package/declarations/components/skeleton.d.ts +151 -0
  32. package/declarations/components/spinner.d.ts +19 -12
  33. package/declarations/components/table.d.ts +17 -9
  34. package/declarations/components/tabs.d.ts +463 -0
  35. package/declarations/components/tooltip.d.ts +270 -0
  36. package/declarations/plugin/default-config.d.ts +10 -4
  37. package/declarations/tw.d.ts +9 -7
  38. package/declarations/types.d.ts +18 -1
  39. package/dist/colors.js +2 -1
  40. package/dist/colors.js.map +1 -1
  41. package/dist/index.js +3824 -5
  42. package/dist/index.js.map +1 -1
  43. package/dist/overlays-DIZlPzFH.js +654 -0
  44. package/dist/overlays-DIZlPzFH.js.map +1 -0
  45. package/dist/plugin.js +54 -83
  46. package/dist/plugin.js.map +1 -1
  47. package/dist/util-Dp_dlOPq.js +482 -0
  48. package/dist/util-Dp_dlOPq.js.map +1 -0
  49. package/package.json +12 -12
  50. package/src/index.css +64 -15
  51. package/src/styles/font-faces.css +23 -5
  52. package/src/styles/theme.css +18 -7
  53. package/src/styles/typography.css +36 -29
  54. package/declarations/colors/contrast.d.ts +0 -16
  55. package/declarations/colors/defaults.d.ts +0 -66
  56. package/declarations/colors/palette-dark.d.ts +0 -123
  57. package/declarations/colors/palette-light.d.ts +0 -123
  58. package/dist/config-CDp8PRHs.js +0 -370
  59. package/dist/config-CDp8PRHs.js.map +0 -1
  60. package/dist/forms-legacy-CgoY8bbm.js +0 -1967
  61. package/dist/forms-legacy-CgoY8bbm.js.map +0 -1
  62. package/dist/index.css +0 -63
  63. package/dist/styles/font-faces.css +0 -70
  64. package/dist/styles/theme.css +0 -48
  65. package/dist/styles/typography.css +0 -387
package/dist/index.js CHANGED
@@ -1,20 +1,3831 @@
1
- import { a as autocomplete, b as avatar, c as backdrop, d as button, e as buttonGroup, f as checkbox, g as checkboxGroup, h as chip, i as closeButton, j as divider, k as drawer, l as dropdownContent, m as formCheckbox, n as formCheckboxGroup, o as formDescription, p as formFeedback, q as formInput, r as formRadio, s as formRadioGroup, t as formSelect, u as formTextarea, v as input, w as label, x as listbox, y as listboxItem, z as modal, A as nativeSelect, B as notificationCard, C as notificationTransitions, D as notificationsContainer, E as overlay, F as overlayTransitions, G as popover, H as progressBar, I as radio, J as radioGroup, K as select, L as spinner, M as switchInput, N as table, O as textarea, P as toggleButton } from './forms-legacy-CgoY8bbm.js';
2
- export { R as tv, Q as twMerge } from './forms-legacy-CgoY8bbm.js';
1
+ import { t as tv, b as backdrop, d as drawer, m as modal, o as overlay, a as overlayArrow, c as overlayTransitions } from './overlays-DIZlPzFH.js';
2
+ export { e as twMerge } from './overlays-DIZlPzFH.js';
3
+
4
+ const focusVisibleRing = ['outline-hidden', 'focus-visible:z-10', 'focus-visible:ring-3', 'focus-visible:ring-focus', 'focus-visible:ring-offset-2', 'focus-visible:ring-offset-background'];
5
+
6
+ /**
7
+ * The close button sitting at the end of a status row — NotificationCard's
8
+ * and Alert's. It is the same affordance in both: a small round hit area,
9
+ * pulled into the row's padding, that reveals a surface tint on hover.
10
+ *
11
+ * Colour is deliberately absent, so this stays intent- and variant-neutral
12
+ * and each recipe keeps ownership of its own palette.
13
+ */
14
+ const statusRowCloseButton = ['shrink-0 self-center -mr-1 inline-block p-1.5 rounded-full', 'transition duration-200', 'hover:bg-surface-overlay-soft', ...focusVisibleRing];
15
+ const focusVisibleWithinRing = ['outline-hidden', 'has-focus-visible:z-10', 'has-focus-visible:ring-3', 'has-[:focus-visible]:ring-focus', 'has-focus-visible:ring-offset-2', 'has-[:focus-visible]:ring-offset-background'];
16
+
17
+ /**
18
+ * `default` and `tonal` wear the same outer box. `tonal` carries its colour
19
+ * on the inner element instead (see its compound variants), so the two must
20
+ * stay identical out here — sharing the object keeps that structural rather
21
+ * than a thing a future edit has to remember.
22
+ *
23
+ * `text-neutral` (the DEFAULT level) is only ~3:1 against a light surface —
24
+ * below the 4.5:1 WCAG AA floor a description needs at this size.
25
+ * `text-neutral-firm` clears it against every surface this text can sit on,
26
+ * light or dark.
27
+ */
28
+ const neutralSurface = {
29
+ base: 'bg-surface-modal border-surface-overlay-mild',
30
+ description: 'text-neutral-firm'
31
+ };
32
+ const alert = tv({
33
+ slots: {
34
+ // The outer element: box treatment only (surface, border, radius).
35
+ // No shadow and a tighter radius than `notificationCard` — an Alert
36
+ // sits in the page rather than floating over it, and no transition
37
+ // machinery or `stackPlacement`, which exist on the card only to serve
38
+ // the notification stack's geometry.
39
+ //
40
+ // `overflow-hidden` is not optional: this element owns the radius, but
41
+ // the `tonal` variant paints its tint on `inner` (it needs an opaque
42
+ // surface underneath — see that slot). `inner` has square corners, so
43
+ // without clipping here its tint paints over all four rounded corners
44
+ // and the alert reads as a rectangle.
45
+ base: 'w-full rounded-lg border overflow-hidden',
46
+ // The inner element carries the row layout. Alert has no
47
+ // ResizeObserver, so unlike the card it does not need this split for
48
+ // measurement — it needs it because the `tonal` variant's translucent
49
+ // `{intent}-soft` tint has to composite over an opaque surface. All
50
+ // three variants share the structure rather than branching the DOM.
51
+ inner: 'flex gap-3 p-4 font-body text-body-2xs',
52
+ // `inline-flex items-center justify-center` turns this slot into a
53
+ // fixed 20px centering box, and `[&>*]:size-full` forces whatever
54
+ // element lands inside it (default intent glyph, or arbitrary content
55
+ // yielded through the `icon` block, e.g. `<Spinner @size='sm' />`) to
56
+ // fill that box rather than render at its own intrinsic size. Without
57
+ // this, a yielded `Spinner` (`sm` = 24px) would overflow and
58
+ // misalign inside the 20px slot — see alert.md's "Icon" section.
59
+ // The trailing `!` marks the utility `!important` (Tailwind v4 syntax):
60
+ // `[&>*]:size-full` is equal specificity to whatever size utility the
61
+ // yielded component carries on itself (e.g. Spinner's own `w-6 h-6`), so
62
+ // without `!` which one wins is just Tailwind's emission order — it
63
+ // happens to work today but could flip on a Tailwind version bump or
64
+ // build change with no structural guarantee. `!` makes this clamp always
65
+ // win instead of relying on that ordering. Same pattern as
66
+ // `motion-reduce:transform-none!` in notification-card.ts.
67
+ icon: 'shrink-0 size-5 inline-flex items-center justify-center [&>*]:size-full!',
68
+ content: 'grow min-w-0 flex flex-col gap-1',
69
+ title: 'font-label text-label-xs',
70
+ description: 'text-body-2xs',
71
+ actions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
72
+ closeButton: statusRowCloseButton
73
+ },
74
+ variants: {
75
+ // Intent alone paints nothing; every colour comes from an intent ×
76
+ // variant compound below.
77
+ //
78
+ // The other half of an intent lives in the component: `INTENT_CONFIG` in
79
+ // alert.gts maps it to a glyph and an ARIA role. Adding an intent means
80
+ // adding it in both places — this list plus its three compound variants
81
+ // here, and a row there.
82
+ intent: {
83
+ default: {},
84
+ info: {},
85
+ success: {},
86
+ warning: {},
87
+ danger: {}
88
+ },
89
+ variant: {
90
+ default: neutralSurface,
91
+ // Intent-independent out here: every `tonal` compound below tints the
92
+ // *inner* element instead, so the outer box is `default`'s.
93
+ tonal: neutralSurface,
94
+ solid: {
95
+ base: 'border-transparent'
96
+ }
97
+ },
98
+ // Shape and alignment, independent of the colour `variant` above.
99
+ //
100
+ // `banner` is a full-bleed announcement bar spanning its container: no
101
+ // radius, no border, content centred. Width is not part of it — `base`
102
+ // is already `w-full`, so an Alert fills its container either way.
103
+ layout: {
104
+ inline: {},
105
+ banner: {
106
+ // `relative` is the positioning context for the pinned close button
107
+ // below. `rounded-none` and `border-0` beat the base slot's
108
+ // `rounded-lg` and `border` through tailwind-merge.
109
+ base: 'relative rounded-none border-0',
110
+ inner: 'justify-center',
111
+ // `grow-0` is what actually centres the row. `content`'s `grow` is
112
+ // what pins the text left and pushes trailing items right, so
113
+ // without dropping it `justify-center` has no free space to
114
+ // distribute and silently does nothing.
115
+ content: 'grow-0 text-center',
116
+ // Out of the flex flow entirely, so the text stays centred on the
117
+ // full banner whether or not the alert is dismissible — a
118
+ // dismissible and a non-dismissible banner stacked together line up.
119
+ // `mr-0` cancels the inline layout's `-mr-1`, which would otherwise
120
+ // pull the pinned button past the edge.
121
+ closeButton: 'absolute right-3 top-1/2 -translate-y-1/2 mr-0'
122
+ }
123
+ },
124
+ // With a description the icon centres on the *title's* line box rather
125
+ // than on the whole (now multi-line) row, hence the negative offset.
126
+ hasDescription: {
127
+ true: {
128
+ inner: 'items-start',
129
+ icon: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]'
130
+ },
131
+ false: {
132
+ inner: 'items-center'
133
+ }
134
+ },
135
+ // Paints nothing alone — it only matters combined with `layout: 'banner'`
136
+ // below, where a present close button needs room reserved for it.
137
+ hasCloseButton: {
138
+ true: {},
139
+ false: {}
140
+ }
141
+ },
142
+ compoundVariants: [
143
+ // default: neutral surface, colour carried by the icon and title.
144
+ // The `default` intent has no accent colour to lend the title emphasis,
145
+ // so the title earns its prominence from weight of ink instead, sitting
146
+ // a level above the icon.
147
+ {
148
+ variant: 'default',
149
+ intent: 'default',
150
+ class: {
151
+ icon: 'text-neutral-firm',
152
+ title: 'text-neutral-bolder'
153
+ }
154
+ }, {
155
+ variant: 'default',
156
+ intent: 'info',
157
+ class: {
158
+ icon: 'text-primary',
159
+ title: 'text-primary'
160
+ }
161
+ }, {
162
+ // `success-firm` is only ~2.3:1 on a light surface; `bolder` clears
163
+ // AA in both themes. Same measurement the card's theme records.
164
+ variant: 'default',
165
+ intent: 'success',
166
+ class: {
167
+ icon: 'text-success-bolder',
168
+ title: 'text-success-bolder'
169
+ }
170
+ }, {
171
+ // `warning-firm` is only ~3:1 on a light surface; `bolder` clears AA
172
+ // in both themes.
173
+ variant: 'default',
174
+ intent: 'warning',
175
+ class: {
176
+ icon: 'text-warning-bolder',
177
+ title: 'text-warning-bolder'
178
+ }
179
+ }, {
180
+ variant: 'default',
181
+ intent: 'danger',
182
+ class: {
183
+ icon: 'text-danger-firm',
184
+ title: 'text-danger-firm'
185
+ }
186
+ },
187
+ // tonal: an opaque outer surface with the translucent `{intent}-soft`
188
+ // tint and its `on-*` contrast ink applied to the inner element, which
189
+ // composites over that opaque surface. Same recipe as Button's
190
+ // `appearance: 'tonal'` and NotificationCard's.
191
+ {
192
+ variant: 'tonal',
193
+ intent: 'default',
194
+ class: {
195
+ inner: 'bg-neutral-soft',
196
+ icon: 'text-on-neutral-soft',
197
+ title: 'text-on-neutral-soft'
198
+ }
199
+ }, {
200
+ variant: 'tonal',
201
+ intent: 'info',
202
+ class: {
203
+ inner: 'bg-primary-soft',
204
+ icon: 'text-on-primary-soft',
205
+ title: 'text-on-primary-soft'
206
+ }
207
+ }, {
208
+ variant: 'tonal',
209
+ intent: 'success',
210
+ class: {
211
+ inner: 'bg-success-soft',
212
+ icon: 'text-on-success-soft',
213
+ title: 'text-on-success-soft'
214
+ }
215
+ }, {
216
+ variant: 'tonal',
217
+ intent: 'warning',
218
+ class: {
219
+ inner: 'bg-warning-soft',
220
+ icon: 'text-on-warning-soft',
221
+ title: 'text-on-warning-soft'
222
+ }
223
+ }, {
224
+ variant: 'tonal',
225
+ intent: 'danger',
226
+ class: {
227
+ inner: 'bg-danger-soft',
228
+ icon: 'text-on-danger-soft',
229
+ title: 'text-on-danger-soft'
230
+ }
231
+ },
232
+ // solid: filled surface, contrast ink. The description uses the
233
+ // full-strength `on-{intent}` ink rather than a translucent cut — a
234
+ // translucent cut failed WCAG AA in the equivalent card recipe.
235
+ {
236
+ variant: 'solid',
237
+ intent: 'default',
238
+ class: {
239
+ base: 'bg-neutral text-on-neutral',
240
+ icon: 'text-on-neutral',
241
+ title: 'text-on-neutral',
242
+ description: 'text-on-neutral'
243
+ }
244
+ }, {
245
+ variant: 'solid',
246
+ intent: 'info',
247
+ class: {
248
+ base: 'bg-primary text-on-primary',
249
+ icon: 'text-on-primary',
250
+ title: 'text-on-primary',
251
+ description: 'text-on-primary'
252
+ }
253
+ }, {
254
+ variant: 'solid',
255
+ intent: 'success',
256
+ class: {
257
+ base: 'bg-success text-on-success',
258
+ icon: 'text-on-success',
259
+ title: 'text-on-success',
260
+ description: 'text-on-success'
261
+ }
262
+ }, {
263
+ variant: 'solid',
264
+ intent: 'warning',
265
+ class: {
266
+ base: 'bg-warning text-on-warning',
267
+ icon: 'text-on-warning',
268
+ title: 'text-on-warning',
269
+ description: 'text-on-warning'
270
+ }
271
+ }, {
272
+ variant: 'solid',
273
+ intent: 'danger',
274
+ class: {
275
+ base: 'bg-danger text-on-danger',
276
+ icon: 'text-on-danger',
277
+ title: 'text-on-danger',
278
+ description: 'text-on-danger'
279
+ }
280
+ },
281
+ // A banner centres its text, so the inline layout's top-aligned icon and
282
+ // its calculated negative offset (see the `hasDescription` variant) read
283
+ // as misaligned. Centre the row instead, whether or not it wraps.
284
+ {
285
+ layout: 'banner',
286
+ hasDescription: true,
287
+ class: {
288
+ inner: 'items-center',
289
+ icon: 'mt-0'
290
+ }
291
+ },
292
+ // The pinned close button (see `layout.banner.closeButton` above) sits
293
+ // outside the flex flow, so nothing about the row's own layout makes
294
+ // room for it — a centred, wrapping title can run underneath it. Reserve
295
+ // space on both sides rather than only the trailing edge: the button is
296
+ // 28px wide starting 12px from the edge (occupying the outer 40px),
297
+ // `px-11` (44px) clears it with a little breathing room, and doing it
298
+ // symmetrically keeps the centring axis at the banner's true centre —
299
+ // padding only on the right would clear the button but drag the text off
300
+ // centre, undoing the reason the button is pinned in the first place.
301
+ // `px-11` only touches the horizontal axis, so `inner`'s vertical `p-4`
302
+ // is untouched. Conditional on `hasCloseButton` so a non-dismissible
303
+ // banner keeps using its full width.
304
+ {
305
+ layout: 'banner',
306
+ hasCloseButton: true,
307
+ class: {
308
+ inner: 'px-11'
309
+ }
310
+ }],
311
+ defaultVariants: {
312
+ intent: 'default',
313
+ variant: 'default',
314
+ layout: 'inline',
315
+ hasDescription: false,
316
+ hasCloseButton: false
317
+ }
318
+ });
319
+
320
+ const avatar = tv({
321
+ slots: {
322
+ base: ['flex', 'relative', 'justify-center', 'items-center', 'box-border', 'overflow-hidden', 'align-middle', 'text-neutral-strong', 'z-0', 'bg-neutral-subtle', 'ring-1 ring-default ring-offset-1 ring-offset-background'],
323
+ img: 'size-full',
324
+ name: ['w-full', 'font-label', 'text-center', 'text-inherit', 'absolute', 'top-1/2', 'left-1/2', '-translate-x-1/2', '-translate-y-1/2', 'select-none']
325
+ },
326
+ variants: {
327
+ shape: {
328
+ square: 'rounded-[20%]',
329
+ circle: 'rounded-full'
330
+ },
331
+ size: {
332
+ xs: {
333
+ base: 'size-5 text-label-2xs'
334
+ },
335
+ sm: {
336
+ base: 'size-6 text-label-xs'
337
+ },
338
+ md: {
339
+ base: 'size-8 text-label-sm'
340
+ },
341
+ lg: {
342
+ base: 'size-10 text-label-md'
343
+ },
344
+ xl: {
345
+ base: 'size-12 text-label-lg'
346
+ }
347
+ }
348
+ },
349
+ defaultVariants: {
350
+ size: 'md',
351
+ shape: 'circle'
352
+ }
353
+ });
354
+
355
+ const baseButton = tv({
356
+ base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
357
+ variants: {
358
+ appearance: {
359
+ outlined: ''
360
+ },
361
+ intent: {
362
+ default: '',
363
+ primary: 'focus-visible:ring-primary-soft',
364
+ secondary: 'focus-visible:ring-secondary-soft',
365
+ tertiary: 'focus-visible:ring-tertiary-soft',
366
+ success: 'focus-visible:ring-success-soft',
367
+ warning: 'focus-visible:ring-warning-soft',
368
+ danger: 'focus-visible:ring-danger-soft'
369
+ },
370
+ size: {
371
+ xs: 'text-strong-sm px-4 py-1 gap-1 rounded-full',
372
+ sm: 'text-strong-md px-5 py-1.5 gap-1 rounded-full',
373
+ md: 'text-strong-lg px-6 py-2 gap-1.5 rounded-full',
374
+ lg: 'text-strong-xl px-8 py-2.5 gap-1.5 rounded-full',
375
+ xl: 'text-strong-2xl px-10 py-3 gap-2 rounded-full',
376
+ '2xl': 'text-strong-3xl px-12 py-3.5 gap-2.5 rounded-full'
377
+ },
378
+ isInGroup: {
379
+ true: ['rounded-none first-of-type:rounded-s-full last-of-type:rounded-e-full', '[&:not(:first-of-type):not(:last-of-type)]:rounded-none', 'not-last-of-type:-me-px']
380
+ }
381
+ },
382
+ compoundVariants: [{
383
+ appearance: 'outlined',
384
+ intent: 'default',
385
+ class: 'text-neutral-bolder border-neutral-bolder hover:bg-neutral-subtle hover:text-neutral-firm/80 hover:border-neutral-strong active:bg-neutral-muted active:text-neutral-firm active:border-neutral-firm'
386
+ }, {
387
+ appearance: 'outlined',
388
+ intent: 'primary',
389
+ class: 'text-primary border-primary hover:text-primary-mild hover:border-primary-mild active:text-primary-firm active:border-primary-firm'
390
+ }, {
391
+ appearance: 'outlined',
392
+ intent: 'secondary',
393
+ class: 'text-secondary-strong border-secondary-strong hover:text-secondary-firm hover:border-secondary-firm active:text-secondary-bolder active:border-secondary-bolder'
394
+ }, {
395
+ appearance: 'outlined',
396
+ intent: 'tertiary',
397
+ class: 'text-tertiary-strong border-tertiary-strong hover:text-tertiary-firm hover:border-tertiary-firm active:text-tertiary-bolder active:border-tertiary-bolder'
398
+ }, {
399
+ appearance: 'outlined',
400
+ intent: 'success',
401
+ class: 'text-success-strong border-success-strong hover:text-success-firm hover:border-success-firm active:text-success-bolder active:border-success-bolder'
402
+ }, {
403
+ appearance: 'outlined',
404
+ intent: 'warning',
405
+ class: 'text-warning-strong border-warning-strong hover:text-warning-firm hover:border-warning-firm active:text-warning-bolder active:border-warning-bolder'
406
+ }, {
407
+ appearance: 'outlined',
408
+ intent: 'danger',
409
+ class: 'text-danger border-danger hover:text-danger-mild hover:border-danger-mild active:text-danger-firm active:border-danger-firm'
410
+ }],
411
+ defaultVariants: {
412
+ size: 'md',
413
+ intent: 'default'
414
+ }
415
+ });
416
+ const button = tv({
417
+ extend: baseButton,
418
+ base: [''],
419
+ variants: {
420
+ appearance: {
421
+ default: 'shadow-elevation-2',
422
+ soft: '',
423
+ outlined: '',
424
+ minimal: '',
425
+ tonal: 'shadow-elevation-2',
426
+ custom: ''
427
+ },
428
+ isLoading: {
429
+ true: 'disabled:cursor-progress'
430
+ }
431
+ },
432
+ compoundVariants: [
433
+ // APPEARANCE: default (Facet "filled") — fill + border + on-color
434
+ {
435
+ appearance: 'default',
436
+ intent: 'default',
437
+ class: 'bg-neutral-bolder border-neutral-bolder text-on-neutral-bolder hover:bg-neutral-strong hover:border-neutral-strong hover:text-on-neutral-strong active:bg-neutral-firm active:border-neutral-firm active:text-on-neutral-firm'
438
+ }, {
439
+ appearance: 'default',
440
+ intent: 'primary',
441
+ class: 'bg-primary border-primary text-on-primary hover:bg-primary-mild hover:border-primary-mild hover:text-on-primary-mild active:bg-primary-firm active:border-primary-firm active:text-on-primary-firm'
442
+ }, {
443
+ appearance: 'default',
444
+ intent: 'secondary',
445
+ class: 'bg-secondary border-secondary text-on-secondary hover:bg-secondary-mild hover:border-secondary-mild hover:text-on-secondary-mild active:bg-secondary-firm active:border-secondary-firm active:text-on-secondary-firm'
446
+ }, {
447
+ appearance: 'default',
448
+ intent: 'tertiary',
449
+ class: 'bg-tertiary border-tertiary text-on-tertiary hover:bg-tertiary-mild hover:border-tertiary-mild hover:text-on-tertiary-mild active:bg-tertiary-firm active:border-tertiary-firm active:text-on-tertiary-firm'
450
+ }, {
451
+ appearance: 'default',
452
+ intent: 'success',
453
+ class: 'bg-success border-success text-on-success hover:bg-success-mild hover:border-success-mild hover:text-on-success-mild active:bg-success-firm active:border-success-firm active:text-on-success-firm'
454
+ }, {
455
+ appearance: 'default',
456
+ intent: 'warning',
457
+ class: 'bg-warning border-warning text-on-warning hover:bg-warning-mild hover:border-warning-mild hover:text-on-warning-mild active:bg-warning-firm active:border-warning-firm active:text-on-warning-firm'
458
+ }, {
459
+ appearance: 'default',
460
+ intent: 'danger',
461
+ class: 'bg-danger border-danger text-on-danger hover:bg-danger-mild hover:border-danger-mild hover:text-on-danger-mild active:bg-danger-firm active:border-danger-firm active:text-on-danger-firm'
462
+ },
463
+ // APPEARANCE: soft — tint fill, plus the border Facet gives it
464
+ {
465
+ appearance: 'soft',
466
+ intent: 'default',
467
+ class: 'bg-neutral-soft border-neutral-bolder text-neutral-bolder hover:bg-neutral-subtle hover:border-neutral-strong hover:text-neutral-strong active:bg-neutral-muted active:border-neutral-firm active:text-neutral-firm'
468
+ }, {
469
+ appearance: 'soft',
470
+ intent: 'primary',
471
+ class: 'bg-primary-soft border-primary text-primary hover:bg-primary-subtle hover:border-primary-mild hover:text-primary-mild active:bg-primary-muted active:border-primary-firm active:text-primary-firm'
472
+ }, {
473
+ appearance: 'soft',
474
+ intent: 'secondary',
475
+ class: 'bg-secondary-soft border-secondary-strong text-secondary-strong hover:bg-secondary-subtle hover:border-secondary-firm hover:text-secondary-firm active:bg-secondary-muted active:border-secondary-bolder active:text-secondary-bolder'
476
+ }, {
477
+ appearance: 'soft',
478
+ intent: 'tertiary',
479
+ class: 'bg-tertiary-soft border-tertiary-strong text-tertiary-strong hover:bg-tertiary-subtle hover:border-tertiary-firm hover:text-tertiary-firm active:bg-tertiary-muted active:border-tertiary-bolder active:text-tertiary-bolder'
480
+ }, {
481
+ appearance: 'soft',
482
+ intent: 'success',
483
+ class: 'bg-success-soft border-success-strong text-success-strong hover:bg-success-subtle hover:border-success-firm hover:text-success-firm active:bg-success-muted active:border-success-bolder active:text-success-bolder'
484
+ }, {
485
+ appearance: 'soft',
486
+ intent: 'warning',
487
+ class: 'bg-warning-soft border-warning-strong text-warning-strong hover:bg-warning-subtle hover:border-warning-firm hover:text-warning-firm active:bg-warning-muted active:border-warning-bolder active:text-warning-bolder'
488
+ }, {
489
+ appearance: 'soft',
490
+ intent: 'danger',
491
+ class: 'bg-danger-soft border-danger text-danger hover:bg-danger-subtle hover:border-danger-mild hover:text-danger-mild active:bg-danger-muted active:border-danger-firm active:text-danger-firm'
492
+ },
493
+ // APPEARANCE: minimal (Facet "ghost") — ink only, no fill
494
+ {
495
+ appearance: 'minimal',
496
+ intent: 'default',
497
+ class: 'text-neutral-bolder hover:text-neutral-firm/80 active:text-neutral-firm'
498
+ }, {
499
+ appearance: 'minimal',
500
+ intent: 'primary',
501
+ class: 'text-primary hover:text-primary-mild active:text-primary-firm'
502
+ }, {
503
+ appearance: 'minimal',
504
+ intent: 'secondary',
505
+ class: 'text-secondary-strong hover:text-secondary-firm active:text-secondary-bolder'
506
+ }, {
507
+ appearance: 'minimal',
508
+ intent: 'tertiary',
509
+ class: 'text-tertiary-strong hover:text-tertiary-firm active:text-tertiary-bolder'
510
+ }, {
511
+ appearance: 'minimal',
512
+ intent: 'success',
513
+ class: 'text-success-strong hover:text-success-firm active:text-success-bolder'
514
+ }, {
515
+ appearance: 'minimal',
516
+ intent: 'warning',
517
+ class: 'text-warning-strong hover:text-warning-firm active:text-warning-bolder'
518
+ }, {
519
+ appearance: 'minimal',
520
+ intent: 'danger',
521
+ class: 'text-danger hover:text-danger-mild active:text-danger-firm'
522
+ },
523
+ // APPEARANCE: tonal — tint fill that deepens through the ramp
524
+ {
525
+ appearance: 'tonal',
526
+ intent: 'default',
527
+ class: 'bg-neutral-soft text-on-neutral-soft hover:bg-neutral-muted hover:text-on-neutral-muted active:bg-neutral-mild active:text-on-neutral-mild'
528
+ }, {
529
+ appearance: 'tonal',
530
+ intent: 'primary',
531
+ class: 'bg-primary-soft text-on-primary-soft hover:bg-primary-muted hover:text-on-primary-muted active:bg-primary-mild active:text-on-primary-mild'
532
+ }, {
533
+ appearance: 'tonal',
534
+ intent: 'secondary',
535
+ class: 'bg-secondary-soft text-on-secondary-soft hover:bg-secondary-muted hover:text-on-secondary-muted active:bg-secondary-mild active:text-on-secondary-mild'
536
+ }, {
537
+ appearance: 'tonal',
538
+ intent: 'tertiary',
539
+ class: 'bg-tertiary-soft text-on-tertiary-soft hover:bg-tertiary-muted hover:text-on-tertiary-muted active:bg-tertiary-mild active:text-on-tertiary-mild'
540
+ }, {
541
+ appearance: 'tonal',
542
+ intent: 'success',
543
+ class: 'bg-success-soft text-on-success-soft hover:bg-success-muted hover:text-on-success-muted active:bg-success-mild active:text-on-success-mild'
544
+ }, {
545
+ appearance: 'tonal',
546
+ intent: 'warning',
547
+ class: 'bg-warning-soft text-on-warning-soft hover:bg-warning-muted hover:text-on-warning-muted active:bg-warning-mild active:text-on-warning-mild'
548
+ }, {
549
+ appearance: 'tonal',
550
+ intent: 'danger',
551
+ class: 'bg-danger-soft text-on-danger-soft hover:bg-danger-muted hover:text-on-danger-muted active:bg-danger-mild active:text-on-danger-mild'
552
+ },
553
+ // APPEARANCE: custom
554
+ {
555
+ appearance: 'custom',
556
+ intent: 'default',
557
+ class: 'text-neutral-strong'
558
+ }, {
559
+ appearance: 'custom',
560
+ intent: 'primary',
561
+ class: 'text-primary-strong'
562
+ }, {
563
+ appearance: 'custom',
564
+ intent: 'secondary',
565
+ class: 'text-secondary-strong'
566
+ }, {
567
+ appearance: 'custom',
568
+ intent: 'tertiary',
569
+ class: 'text-tertiary-strong'
570
+ }, {
571
+ appearance: 'custom',
572
+ intent: 'success',
573
+ class: 'text-success-strong'
574
+ }, {
575
+ appearance: 'custom',
576
+ intent: 'warning',
577
+ class: 'text-warning-strong'
578
+ }, {
579
+ appearance: 'custom',
580
+ intent: 'danger',
581
+ class: 'text-danger-strong'
582
+ }],
583
+ defaultVariants: {
584
+ size: 'md',
585
+ intent: 'primary'
586
+ }
587
+ });
588
+ const toggleButton = tv({
589
+ extend: baseButton,
590
+ base: [''],
591
+ variants: {
592
+ isSelected: {
593
+ true: ''
594
+ }
595
+ },
596
+ // Selected is a *filled* state, so every color has to be restated here —
597
+ // fill, border and ink, for the resting, hover and active steps. The
598
+ // unselected `outlined` rules in `baseButton` set their own
599
+ // `hover:text-*`/`active:*` colors, and anything we leave out keeps leaking
600
+ // through: an unselected ink color over a selected fill is what produced the
601
+ // unreadable label on hover. The ramp matches the filled button
602
+ // (`appearance: 'default'`) — one step deeper on hover, another on active —
603
+ // and pairs each fill with its generated `on-*` contrast ink.
604
+ compoundVariants: [{
605
+ appearance: 'outlined',
606
+ intent: 'default',
607
+ isSelected: true,
608
+ class: 'bg-neutral-bolder border-neutral-bolder text-on-neutral-bolder hover:bg-neutral-strong hover:border-neutral-strong hover:text-on-neutral-strong active:bg-neutral-firm active:border-neutral-firm active:text-on-neutral-firm'
609
+ }, {
610
+ appearance: 'outlined',
611
+ intent: 'primary',
612
+ isSelected: true,
613
+ class: 'bg-primary border-primary text-on-primary hover:bg-primary-mild hover:border-primary-mild hover:text-on-primary-mild active:bg-primary-firm active:border-primary-firm active:text-on-primary-firm'
614
+ }, {
615
+ appearance: 'outlined',
616
+ intent: 'secondary',
617
+ isSelected: true,
618
+ class: 'bg-secondary border-secondary text-on-secondary hover:bg-secondary-mild hover:border-secondary-mild hover:text-on-secondary-mild active:bg-secondary-firm active:border-secondary-firm active:text-on-secondary-firm'
619
+ }, {
620
+ appearance: 'outlined',
621
+ intent: 'tertiary',
622
+ isSelected: true,
623
+ class: 'bg-tertiary border-tertiary text-on-tertiary hover:bg-tertiary-mild hover:border-tertiary-mild hover:text-on-tertiary-mild active:bg-tertiary-firm active:border-tertiary-firm active:text-on-tertiary-firm'
624
+ }, {
625
+ appearance: 'outlined',
626
+ intent: 'success',
627
+ isSelected: true,
628
+ class: 'bg-success border-success text-on-success hover:bg-success-mild hover:border-success-mild hover:text-on-success-mild active:bg-success-firm active:border-success-firm active:text-on-success-firm'
629
+ }, {
630
+ appearance: 'outlined',
631
+ intent: 'warning',
632
+ isSelected: true,
633
+ class: 'bg-warning border-warning text-on-warning hover:bg-warning-mild hover:border-warning-mild hover:text-on-warning-mild active:bg-warning-firm active:border-warning-firm active:text-on-warning-firm'
634
+ }, {
635
+ appearance: 'outlined',
636
+ intent: 'danger',
637
+ isSelected: true,
638
+ class: 'bg-danger border-danger text-on-danger hover:bg-danger-mild hover:border-danger-mild hover:text-on-danger-mild active:bg-danger-firm active:border-danger-firm active:text-on-danger-firm'
639
+ }]
640
+ });
641
+ const buttonGroup = tv({
642
+ base: ['inline-flex items-stretch justify-center h-auto']
643
+ });
644
+
645
+ // The in-button spinner has to inherit the button's ink. `spinner`'s own base
646
+ // is `text-neutral-muted` / `fill-neutral-strong`, which is invisible on a
647
+ // filled primary button. `size-[1em]` makes it track the button's font size
648
+ // across all six sizes, matching the base button's `[&_svg]:size-[1em]`.
649
+ const buttonSpinner = tv({
650
+ base: 'size-[1em] text-current/25 fill-current'
651
+ });
652
+
653
+ const chip = tv({
654
+ slots: {
655
+ base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border'],
656
+ // label text role (size set per size variant)
657
+ content: ['flex-1 text-inherit font-label'],
658
+ dot: ['shrink-0', 'ml-1', 'rounded-full'],
659
+ closeButton: ['shrink-0', 'p-0.5',
660
+ // The shared ring is drawn with a background-coloured offset, which
661
+ // inside a chip reads as a hole punched in the chip.
662
+ 'focus-visible:ring-2 focus-visible:ring-offset-0', 'disabled:cursor-not-allowed']
663
+ },
664
+ variants: {
665
+ isDisabled: {
666
+ true: 'opacity-disabled cursor-not-allowed'
667
+ },
668
+ appearance: {
669
+ default: '',
670
+ outlined: '',
671
+ faded: ''
672
+ },
673
+ // The close button is a filled circle in every appearance. `-muted` is
674
+ // light enough to sit on the page in `outlined`/`faded` and to read as a
675
+ // disc on a filled chip, and each level carries its own `on-` colour — the
676
+ // pairing this used to get wrong, by putting `text-on-{intent}` (the
677
+ // contrast colour for the DEFAULT level) on a `-muted` circle.
678
+ intent: {
679
+ default: {
680
+ dot: 'bg-neutral-strong',
681
+ closeButton: 'bg-neutral-muted text-on-neutral-muted'
682
+ },
683
+ primary: {
684
+ dot: 'bg-primary',
685
+ closeButton: 'bg-primary-muted text-on-primary-muted'
686
+ },
687
+ secondary: {
688
+ dot: 'bg-secondary',
689
+ closeButton: 'bg-secondary-muted text-on-secondary-muted'
690
+ },
691
+ tertiary: {
692
+ dot: 'bg-tertiary',
693
+ closeButton: 'bg-tertiary-muted text-on-tertiary-muted'
694
+ },
695
+ success: {
696
+ dot: 'bg-success',
697
+ closeButton: 'bg-success-muted text-on-success-muted'
698
+ },
699
+ warning: {
700
+ dot: 'bg-warning',
701
+ closeButton: 'bg-warning-muted text-on-warning-muted'
702
+ },
703
+ danger: {
704
+ dot: 'bg-danger',
705
+ closeButton: 'bg-danger-muted text-on-danger-muted'
706
+ }
707
+ },
708
+ size: {
709
+ sm: {
710
+ base: 'text-label-2xs px-1 h-6',
711
+ content: 'px-1',
712
+ dot: 'size-1.5',
713
+ closeButton: 'text-label-2xs'
714
+ },
715
+ md: {
716
+ base: 'text-label-xs px-1 h-7',
717
+ content: 'px-2',
718
+ dot: 'size-2',
719
+ closeButton: 'text-label-xs'
720
+ },
721
+ lg: {
722
+ base: 'text-label-md px-2 h-8',
723
+ content: 'px-2',
724
+ dot: 'size-2.5',
725
+ closeButton: 'text-label-md'
726
+ }
727
+ },
728
+ radius: {
729
+ none: 'rounded-none',
730
+ sm: 'rounded-sm',
731
+ lg: 'rounded-lg',
732
+ full: 'rounded-full'
733
+ }
734
+ },
735
+ compoundVariants: [
736
+ // A filled chip's background *is* the intent colour, so an intent-coloured
737
+ // dot disappears into it. Inherit the chip's text colour instead — the one
738
+ // colour guaranteed to contrast the fill.
739
+ {
740
+ appearance: 'default',
741
+ class: {
742
+ dot: 'bg-current'
743
+ }
744
+ },
745
+ // APPEARANCE: default (filled)
746
+ //
747
+ // The chip's own fill is the intent's DEFAULT level, so the close button
748
+ // cannot hover *towards* it the way the other two appearances do — the
749
+ // circle would vanish into the chip. It steps down to `-subtle` instead.
750
+ {
751
+ appearance: 'default',
752
+ intent: 'default',
753
+ class: {
754
+ base: 'bg-neutral-bolder text-on-neutral-bolder',
755
+ closeButton: 'hover:bg-neutral-subtle hover:text-on-neutral-subtle'
756
+ }
757
+ }, {
758
+ appearance: 'default',
759
+ intent: 'primary',
760
+ class: {
761
+ base: 'bg-primary text-on-primary',
762
+ closeButton: 'hover:bg-primary-subtle hover:text-on-primary-subtle'
763
+ }
764
+ }, {
765
+ appearance: 'default',
766
+ intent: 'secondary',
767
+ class: {
768
+ base: 'bg-secondary text-on-secondary',
769
+ closeButton: 'hover:bg-secondary-subtle hover:text-on-secondary-subtle'
770
+ }
771
+ }, {
772
+ appearance: 'default',
773
+ intent: 'tertiary',
774
+ class: {
775
+ base: 'bg-tertiary text-on-tertiary',
776
+ closeButton: 'hover:bg-tertiary-subtle hover:text-on-tertiary-subtle'
777
+ }
778
+ }, {
779
+ appearance: 'default',
780
+ intent: 'success',
781
+ class: {
782
+ base: 'bg-success text-on-success',
783
+ closeButton: 'hover:bg-success-subtle hover:text-on-success-subtle'
784
+ }
785
+ }, {
786
+ appearance: 'default',
787
+ intent: 'warning',
788
+ class: {
789
+ base: 'bg-warning text-on-warning',
790
+ closeButton: 'hover:bg-warning-subtle hover:text-on-warning-subtle'
791
+ }
792
+ }, {
793
+ appearance: 'default',
794
+ intent: 'danger',
795
+ class: {
796
+ base: 'bg-danger text-on-danger',
797
+ closeButton: 'hover:bg-danger-subtle hover:text-on-danger-subtle'
798
+ }
799
+ },
800
+ // APPEARANCE: faded (tonal)
801
+ {
802
+ appearance: 'faded',
803
+ intent: 'default',
804
+ class: {
805
+ base: 'text-neutral-strong bg-neutral-subtle',
806
+ closeButton: 'hover:bg-neutral hover:text-on-neutral'
807
+ }
808
+ }, {
809
+ appearance: 'faded',
810
+ intent: 'primary',
811
+ class: {
812
+ base: 'text-primary-strong bg-primary-subtle',
813
+ closeButton: 'hover:bg-primary hover:text-on-primary'
814
+ }
815
+ }, {
816
+ appearance: 'faded',
817
+ intent: 'secondary',
818
+ class: {
819
+ base: 'text-secondary-strong bg-secondary-subtle',
820
+ closeButton: 'hover:bg-secondary hover:text-on-secondary'
821
+ }
822
+ }, {
823
+ appearance: 'faded',
824
+ intent: 'tertiary',
825
+ class: {
826
+ base: 'text-tertiary-strong bg-tertiary-subtle',
827
+ closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
828
+ }
829
+ }, {
830
+ appearance: 'faded',
831
+ intent: 'success',
832
+ class: {
833
+ base: 'text-success-strong bg-success-subtle',
834
+ closeButton: 'hover:bg-success hover:text-on-success'
835
+ }
836
+ }, {
837
+ appearance: 'faded',
838
+ intent: 'warning',
839
+ class: {
840
+ base: 'text-warning-strong bg-warning-subtle',
841
+ closeButton: 'hover:bg-warning hover:text-on-warning'
842
+ }
843
+ }, {
844
+ appearance: 'faded',
845
+ intent: 'danger',
846
+ class: {
847
+ base: 'text-danger-strong bg-danger-subtle',
848
+ closeButton: 'hover:bg-danger hover:text-on-danger'
849
+ }
850
+ },
851
+ // APPEARANCE: outlined
852
+ {
853
+ appearance: 'outlined',
854
+ intent: 'default',
855
+ class: {
856
+ base: 'text-neutral-strong border border-neutral',
857
+ closeButton: 'hover:bg-neutral hover:text-on-neutral'
858
+ }
859
+ }, {
860
+ appearance: 'outlined',
861
+ intent: 'primary',
862
+ class: {
863
+ base: 'text-primary-strong border border-primary',
864
+ closeButton: 'hover:bg-primary hover:text-on-primary'
865
+ }
866
+ }, {
867
+ appearance: 'outlined',
868
+ intent: 'secondary',
869
+ class: {
870
+ base: 'text-secondary-strong border border-secondary',
871
+ closeButton: 'hover:bg-secondary hover:text-on-secondary'
872
+ }
873
+ }, {
874
+ appearance: 'outlined',
875
+ intent: 'tertiary',
876
+ class: {
877
+ base: 'text-tertiary-strong border border-tertiary',
878
+ closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
879
+ }
880
+ }, {
881
+ appearance: 'outlined',
882
+ intent: 'success',
883
+ class: {
884
+ base: 'text-success-strong border border-success',
885
+ closeButton: 'hover:bg-success hover:text-on-success'
886
+ }
887
+ }, {
888
+ appearance: 'outlined',
889
+ intent: 'warning',
890
+ class: {
891
+ base: 'text-warning-strong border border-warning',
892
+ closeButton: 'hover:bg-warning hover:text-on-warning'
893
+ }
894
+ }, {
895
+ appearance: 'outlined',
896
+ intent: 'danger',
897
+ class: {
898
+ base: 'text-danger-strong border border-danger',
899
+ closeButton: 'hover:bg-danger hover:text-on-danger'
900
+ }
901
+ }],
902
+ defaultVariants: {
903
+ size: 'md',
904
+ intent: 'default',
905
+ appearance: 'default',
906
+ radius: 'full'
907
+ }
908
+ });
909
+
910
+ const progressBar = tv({
911
+ slots: {
912
+ base: ['overflow-hidden w-full bg-surface-overlay-soft'],
913
+ label: ['flex justify-between pb-1 gap-2 font-label text-label-sm'],
914
+ progress: [''],
915
+ description: ['text-neutral font-body text-body-2xs pb-1']
916
+ },
917
+ variants: {
918
+ isIndeterminate: {
919
+ true: {
920
+ progress: ['animate-loading origin-left']
921
+ }
922
+ },
923
+ intent: {
924
+ default: {
925
+ progress: 'bg-neutral-strong'
926
+ },
927
+ primary: {
928
+ progress: 'bg-primary-soft'
929
+ },
930
+ secondary: {
931
+ progress: 'bg-secondary-soft'
932
+ },
933
+ tertiary: {
934
+ progress: 'bg-tertiary-soft'
935
+ },
936
+ success: {
937
+ progress: 'bg-success-soft'
938
+ },
939
+ warning: {
940
+ progress: 'bg-warning-soft'
941
+ },
942
+ danger: {
943
+ progress: 'bg-danger-soft'
944
+ }
945
+ },
946
+ size: {
947
+ xs: {
948
+ base: 'h-1',
949
+ progress: 'h-1',
950
+ label: 'text-label-2xs',
951
+ description: 'text-body-2xs'
952
+ },
953
+ sm: {
954
+ base: 'h-2',
955
+ progress: 'h-2',
956
+ label: 'text-label-xs',
957
+ description: 'text-body-2xs'
958
+ },
959
+ md: {
960
+ base: 'h-4',
961
+ progress: 'h-4'
962
+ },
963
+ lg: {
964
+ base: 'h-8',
965
+ progress: 'h-8',
966
+ label: 'text-label-md',
967
+ description: 'text-body-sm'
968
+ }
969
+ },
970
+ radius: {
971
+ none: 'rounded-none',
972
+ sm: 'rounded-sm',
973
+ lg: 'rounded-lg',
974
+ full: 'rounded-full'
975
+ }
976
+ },
977
+ defaultVariants: {
978
+ size: 'md',
979
+ intent: 'default',
980
+ radius: 'sm'
981
+ }
982
+ });
983
+
984
+ const closeButton = tv({
985
+ slots: {
986
+ base: ['rounded-full transition duration-200 text-inherit', ...focusVisibleRing],
987
+ icon: 'size-[1em]'
988
+ },
989
+ variants: {
990
+ size: {
991
+ xs: {
992
+ base: 'text-sm p-1'
993
+ },
994
+ sm: {
995
+ base: 'text-base p-2'
996
+ },
997
+ md: {
998
+ base: 'text-xl p-2'
999
+ },
1000
+ lg: {
1001
+ base: 'text-2xl p-3'
1002
+ },
1003
+ xl: {
1004
+ base: 'text-4xl p-3'
1005
+ }
1006
+ },
1007
+ variant: {
1008
+ transparent: {
1009
+ base: ['bg-transparent', 'hover:bg-surface-overlay-subtle']
1010
+ },
1011
+ subtle: {
1012
+ base: ['bg-neutral-subtle', 'text-on-neutral-subtle', 'hover:bg-surface-overlay-subtle']
1013
+ }
1014
+ }
1015
+ },
1016
+ defaultVariants: {
1017
+ size: 'md',
1018
+ variant: 'transparent'
1019
+ }
1020
+ });
1021
+
1022
+ const command = tv({
1023
+ slots: {
1024
+ // Padded, with the input inset as its own field: the palette reads as one
1025
+ // surface holding a search box and its results, not as a form control
1026
+ // with a list glued underneath.
1027
+ base: ['flex flex-col', 'w-full min-w-0', 'p-2', 'overflow-hidden', 'text-on-surface-modal'],
1028
+ inputWrapper: ['flex items-center gap-2', 'h-9 shrink-0', 'px-3', 'rounded-md', 'border border-neutral-soft', 'bg-neutral-subtle/60', 'transition-colors', 'has-[input:focus-visible]:border-neutral-mild'],
1029
+ inputIcon: ['size-4 shrink-0', 'text-neutral'],
1030
+ input: ['h-full w-full', 'bg-transparent', 'font-body text-body-sm', 'outline-hidden', 'placeholder:text-neutral', 'disabled:cursor-not-allowed disabled:opacity-disabled'],
1031
+ // The `size` variant gives the list a minimum height on purpose: without
1032
+ // one the panel collapses and re-expands on every keystroke as results
1033
+ // narrow, which reads as jitter.
1034
+ //
1035
+ // The palette wants denser, plainer rows than a Dropdown menu does. The
1036
+ // descendant utilities below apply that without forking `listboxItem`.
1037
+ // They must stay as literal strings: Tailwind finds classes by scanning
1038
+ // source text, so a class assembled with interpolation is never generated.
1039
+ // No `overscroll-contain`: the list is a scroll container even when its
1040
+ // items fit, and containing overscroll there swallows wheel events over an
1041
+ // inline palette so the page behind it cannot scroll. The dialog does not
1042
+ // need it either -- body scroll is locked while it is open.
1043
+ list: [
1044
+ // Vertical rhythm: 8px above the first heading, 4px between rows, a
1045
+ // padded group above each divider, and room before the footer.
1046
+ 'mt-2', 'overflow-y-auto overflow-x-hidden', 'scroll-py-1', 'px-0 pt-0 pb-1', 'gap-1', '[&_[data-component=listbox-group]]:pb-1', '[&_[data-component=listbox-group]_ul]:gap-1',
1047
+ // rows
1048
+ '[&_[data-component=listbox-item]]:min-h-9', '[&_[data-component=listbox-item]]:rounded-md', '[&_[data-component=listbox-item]]:px-3', '[&_[data-component=listbox-item]]:py-0',
1049
+ // Active row: a solid fill, no outline. `neutral-subtle` is too close to
1050
+ // the panel surface in dark mode to read as a highlight, leaving only a
1051
+ // hairline box; `neutral-muted` is one step up and visible in both schemes.
1052
+ '[&_[data-component=listbox-item][data-active=true]]:bg-neutral-muted', '[&_[data-component=listbox-item][data-active=true]]:text-neutral-bolder',
1053
+ // row text
1054
+ '[&_[data-test-id=listbox-item-label]]:text-body-sm', '[&_[data-test-id=listbox-item-label]]:font-medium',
1055
+ // leading icons are sized and muted unless the consumer says otherwise
1056
+ '[&_[data-component=listbox-item]_svg:not([class*=size-])]:size-4', '[&_[data-component=listbox-item]_svg]:shrink-0', '[&_[data-component=listbox-item]_svg:not([class*=text-])]:text-neutral',
1057
+ // group headings
1058
+ '[&_[data-test-id=listbox-group-title]]:px-3', '[&_[data-test-id=listbox-group-title]]:pt-1.5', '[&_[data-test-id=listbox-group-title]]:pb-1.5'],
1059
+ empty: ['py-6', 'text-center', 'font-body text-body-sm', 'text-neutral'],
1060
+ loading: ['flex items-center justify-center gap-2', 'py-6', 'font-body text-body-sm', 'text-neutral'],
1061
+ // Bleeds to the panel edges, so it reads as the palette's chrome rather
1062
+ // than as a row.
1063
+ footer: ['flex items-center gap-3', 'h-10 shrink-0', '-mx-2 -mb-2 mt-2 px-4', 'border-t border-neutral-soft', 'bg-neutral-subtle/60', 'font-body text-body-2xs font-medium', 'text-neutral', 'select-none'],
1064
+ footerHint: 'flex items-center gap-1.5',
1065
+ // Empty on purpose: an override hook so `@classes={{hash kbd="..."}}`
1066
+ // reaches the keycap, which `Kbd` itself draws.
1067
+ kbd: ''
1068
+ },
1069
+ variants: {
1070
+ size: {
1071
+ sm: {
1072
+ list: 'max-h-64 min-h-32'
1073
+ },
1074
+ md: {
1075
+ list: 'max-h-80 min-h-48'
1076
+ },
1077
+ lg: {
1078
+ list: 'max-h-96 min-h-64'
1079
+ }
1080
+ },
1081
+ /**
1082
+ * Draws the palette's own surface, for use outside a dialog. A shrink-wrap
1083
+ * layout would otherwise size it to its widest row, so it also carries a
1084
+ * sensible minimum width.
1085
+ */
1086
+ isBordered: {
1087
+ true: {
1088
+ base: [
1089
+ // A percentage here would resolve against a shrink-wrapped parent's
1090
+ // indefinite width and vanish; the rem floor is what actually holds.
1091
+ 'min-w-[28rem] max-w-full', 'rounded-xl', 'bg-surface-modal', 'border border-surface-overlay-mild', 'shadow-md'],
1092
+ footer: 'rounded-b-xl'
1093
+ }
1094
+ }
1095
+ },
1096
+ defaultVariants: {
1097
+ size: 'md'
1098
+ }
1099
+ });
1100
+ const commandDialog = tv({
1101
+ slots: {
1102
+ // Sits the panel below the top edge rather than centering it: a palette is
1103
+ // read top-down, and a vertically centered one moves as results change.
1104
+ base: 'w-full max-w-lg px-4 mt-[12vh] mb-8 sm:mt-[15vh]',
1105
+ panel: ['relative flex flex-col', 'w-full', 'overflow-hidden', 'rounded-xl', 'bg-surface-modal', 'text-on-surface-modal', 'border border-surface-overlay-mild',
1106
+ // The soft outer ring is what separates the panel from the scrim; a
1107
+ // shadow alone reads as flat against a dark backdrop.
1108
+ 'ring-4 ring-neutral-soft/40', 'shadow-2xl', 'outline-hidden']
1109
+ }
1110
+ });
1111
+
1112
+ const kbd = tv({
1113
+ slots: {
1114
+ // The wrapper draws nothing: it only lines the caps up. `font-label`, not
1115
+ // `font-code` -- the modifier glyphs (⌘ ⇧ ⌥ ⌃) render poorly in most
1116
+ // monospace faces, and a keycap is a UI affordance rather than sample code.
1117
+ base: ['inline-flex items-center align-middle', 'font-label', 'select-none', 'whitespace-nowrap'],
1118
+ // Each cap. `min-w` is set per size to match its height, so a lone `K` stays
1119
+ // square instead of collapsing to the width of the letter.
1120
+ // `font-label` is repeated here rather than inherited from `base`: the CSS
1121
+ // reset styles the `kbd` element itself as monospace, and an element rule
1122
+ // beats inheritance, so the cap must name its own font.
1123
+ key: ['inline-flex items-center justify-center', 'shrink-0', 'font-label', 'leading-none', '[&_svg]:size-3'],
1124
+ separator: ['shrink-0', 'text-neutral', 'px-0.5']
1125
+ },
1126
+ variants: {
1127
+ size: {
1128
+ sm: {
1129
+ base: 'gap-0.5 text-label-2xs',
1130
+ key: 'h-5 min-w-5 px-1 rounded text-label-2xs'
1131
+ },
1132
+ md: {
1133
+ base: 'gap-1 text-label-xs',
1134
+ key: 'h-6 min-w-6 px-1.5 rounded-md text-label-xs'
1135
+ },
1136
+ lg: {
1137
+ base: 'gap-1 text-label-sm',
1138
+ key: 'h-7 min-w-7 px-2 rounded-md text-label-sm'
1139
+ }
1140
+ },
1141
+ // Colours live in the compound variants below, paired with `intent`.
1142
+ appearance: {
1143
+ default: {
1144
+ key: 'border border-transparent'
1145
+ },
1146
+ outlined: {
1147
+ key: 'border bg-transparent'
1148
+ },
1149
+ faded: {
1150
+ key: 'border'
1151
+ },
1152
+ // Follows whatever colour it is sitting on. This is what lets a keycap
1153
+ // ride an active, filled Listbox row without the row's theme having to
1154
+ // repaint it for every intent.
1155
+ inherit: {
1156
+ key: 'border border-current/20 bg-transparent text-current'
1157
+ },
1158
+ // No box at all. For dense rows where a keycap would be visual noise and
1159
+ // the shortcut should read as quiet trailing text.
1160
+ plain: {
1161
+ key: 'border-0 bg-transparent px-0 min-w-0 text-current tracking-wide'
1162
+ }
1163
+ },
1164
+ intent: {
1165
+ default: {},
1166
+ primary: {},
1167
+ secondary: {},
1168
+ tertiary: {},
1169
+ success: {},
1170
+ warning: {},
1171
+ danger: {}
1172
+ },
1173
+ /**
1174
+ * `merged` puts every glyph inside one cap (`⌘K`); `split` gives each key
1175
+ * its own (`⌘` `K`).
1176
+ */
1177
+ isMerged: {
1178
+ true: {
1179
+ base: 'gap-0'
1180
+ }
1181
+ }
1182
+ },
1183
+ compoundVariants: [
1184
+ // appearance: default -- a filled cap. `-muted` is light enough to read as
1185
+ // a key on a page and each level carries its own `on-` contrast colour.
1186
+ {
1187
+ appearance: 'default',
1188
+ intent: 'default',
1189
+ class: {
1190
+ key: 'bg-neutral-muted text-on-neutral-muted'
1191
+ }
1192
+ }, {
1193
+ appearance: 'default',
1194
+ intent: 'primary',
1195
+ class: {
1196
+ key: 'bg-primary-muted text-on-primary-muted'
1197
+ }
1198
+ }, {
1199
+ appearance: 'default',
1200
+ intent: 'secondary',
1201
+ class: {
1202
+ key: 'bg-secondary-muted text-on-secondary-muted'
1203
+ }
1204
+ }, {
1205
+ appearance: 'default',
1206
+ intent: 'tertiary',
1207
+ class: {
1208
+ key: 'bg-tertiary-muted text-on-tertiary-muted'
1209
+ }
1210
+ }, {
1211
+ appearance: 'default',
1212
+ intent: 'success',
1213
+ class: {
1214
+ key: 'bg-success-muted text-on-success-muted'
1215
+ }
1216
+ }, {
1217
+ appearance: 'default',
1218
+ intent: 'warning',
1219
+ class: {
1220
+ key: 'bg-warning-muted text-on-warning-muted'
1221
+ }
1222
+ }, {
1223
+ appearance: 'default',
1224
+ intent: 'danger',
1225
+ class: {
1226
+ key: 'bg-danger-muted text-on-danger-muted'
1227
+ }
1228
+ },
1229
+ // appearance: outlined
1230
+ {
1231
+ appearance: 'outlined',
1232
+ intent: 'default',
1233
+ class: {
1234
+ key: 'border-neutral text-neutral-strong'
1235
+ }
1236
+ }, {
1237
+ appearance: 'outlined',
1238
+ intent: 'primary',
1239
+ class: {
1240
+ key: 'border-primary text-primary-strong'
1241
+ }
1242
+ }, {
1243
+ appearance: 'outlined',
1244
+ intent: 'secondary',
1245
+ class: {
1246
+ key: 'border-secondary text-secondary-strong'
1247
+ }
1248
+ }, {
1249
+ appearance: 'outlined',
1250
+ intent: 'tertiary',
1251
+ class: {
1252
+ key: 'border-tertiary text-tertiary-strong'
1253
+ }
1254
+ }, {
1255
+ appearance: 'outlined',
1256
+ intent: 'success',
1257
+ class: {
1258
+ key: 'border-success text-success-strong'
1259
+ }
1260
+ }, {
1261
+ appearance: 'outlined',
1262
+ intent: 'warning',
1263
+ class: {
1264
+ key: 'border-warning text-warning-strong'
1265
+ }
1266
+ }, {
1267
+ appearance: 'outlined',
1268
+ intent: 'danger',
1269
+ class: {
1270
+ key: 'border-danger text-danger-strong'
1271
+ }
1272
+ },
1273
+ // appearance: faded
1274
+ {
1275
+ appearance: 'faded',
1276
+ intent: 'default',
1277
+ class: {
1278
+ key: 'bg-neutral-subtle border-neutral-soft text-neutral-strong'
1279
+ }
1280
+ }, {
1281
+ appearance: 'faded',
1282
+ intent: 'primary',
1283
+ class: {
1284
+ key: 'bg-primary-subtle border-primary-soft text-primary-strong'
1285
+ }
1286
+ }, {
1287
+ appearance: 'faded',
1288
+ intent: 'secondary',
1289
+ class: {
1290
+ key: 'bg-secondary-subtle border-secondary-soft text-secondary-strong'
1291
+ }
1292
+ }, {
1293
+ appearance: 'faded',
1294
+ intent: 'tertiary',
1295
+ class: {
1296
+ key: 'bg-tertiary-subtle border-tertiary-soft text-tertiary-strong'
1297
+ }
1298
+ }, {
1299
+ appearance: 'faded',
1300
+ intent: 'success',
1301
+ class: {
1302
+ key: 'bg-success-subtle border-success-soft text-success-strong'
1303
+ }
1304
+ }, {
1305
+ appearance: 'faded',
1306
+ intent: 'warning',
1307
+ class: {
1308
+ key: 'bg-warning-subtle border-warning-soft text-warning-strong'
1309
+ }
1310
+ }, {
1311
+ appearance: 'faded',
1312
+ intent: 'danger',
1313
+ class: {
1314
+ key: 'bg-danger-subtle border-danger-soft text-danger-strong'
1315
+ }
1316
+ }],
1317
+ defaultVariants: {
1318
+ size: 'md',
1319
+ intent: 'default',
1320
+ appearance: 'default'
1321
+ }
1322
+ });
1323
+
1324
+ const listbox = tv({
1325
+ base: 'w-full flex flex-col gap-0.5 outline-hidden p-1'
1326
+ });
1327
+ const listboxItem = tv({
1328
+ slots: {
1329
+ base: ['flex', 'group', 'gap-2', 'items-center', 'justify-between', 'relative', 'px-2', 'py-1.5', 'w-full', 'h-full', 'box-border', 'rounded-lg', 'subpixel-antialiased', 'outline-hidden', 'cursor-pointer', 'tap-highlight-transparent'],
1330
+ descriptionWrapper: 'w-full flex flex-col items-start justify-center',
1331
+ label: 'flex-1 font-body text-body-2xs truncate',
1332
+ description: ['w-full', 'font-body text-body-2xs', 'text-neutral-firm', 'group-hover:text-current'],
1333
+ selectedIcon: ['text-inherit', 'w-4', 'h-4', 'shrink-0'],
1334
+ // The chevron on a row that opens a submenu. Sized like `selectedIcon`
1335
+ // -- both are trailing affordances on the same row -- but dimmer at rest,
1336
+ // since it marks a direction rather than a state. `text-inherit` on the
1337
+ // active row lets it pick up the row's own colour.
1338
+ submenuIndicator: ['text-neutral-firm', 'group-data-is-active:text-inherit', 'w-4', 'h-4', 'shrink-0']
1339
+ },
1340
+ variants: {
1341
+ appearance: {
1342
+ default: {
1343
+ base: ''
1344
+ },
1345
+ outlined: {
1346
+ base: 'border border-transparent bg-transparent'
1347
+ },
1348
+ faded: {
1349
+ base: ['border border-transparent']
1350
+ }
1351
+ },
1352
+ intent: {
1353
+ default: {},
1354
+ primary: {},
1355
+ secondary: {},
1356
+ tertiary: {},
1357
+ success: {},
1358
+ warning: {},
1359
+ danger: {}
1360
+ },
1361
+ isActive: {
1362
+ true: {
1363
+ base: []
1364
+ }
1365
+ },
1366
+ withDivider: {
1367
+ true: {
1368
+ base: ['mb-1.5']
1369
+ }
1370
+ },
1371
+ isDisabled: {
1372
+ true: {
1373
+ base: 'opacity-disabled pointer-events-none'
1374
+ }
1375
+ },
1376
+ isSelected: {
1377
+ true: {
1378
+ base: ''
1379
+ }
1380
+ }
1381
+ },
1382
+ defaultVariants: {
1383
+ appearance: 'default',
1384
+ intent: 'default'
1385
+ },
1386
+ compoundVariants: [
1387
+ // appearance: default
1388
+ {
1389
+ appearance: 'default',
1390
+ intent: 'default',
1391
+ class: {
1392
+ base: ['data-is-active:bg-neutral-subtle', 'data-is-active:text-neutral-strong']
1393
+ }
1394
+ }, {
1395
+ appearance: 'default',
1396
+ intent: 'primary',
1397
+ class: {
1398
+ base: ['data-is-active:bg-primary-soft', 'data-is-active:text-on-primary-soft']
1399
+ }
1400
+ }, {
1401
+ appearance: 'default',
1402
+ intent: 'secondary',
1403
+ class: {
1404
+ base: ['data-is-active:bg-secondary-soft', 'data-is-active:text-on-secondary-soft']
1405
+ }
1406
+ }, {
1407
+ appearance: 'default',
1408
+ intent: 'tertiary',
1409
+ class: {
1410
+ base: ['data-is-active:bg-tertiary-soft', 'data-is-active:text-on-tertiary-soft']
1411
+ }
1412
+ }, {
1413
+ appearance: 'default',
1414
+ intent: 'success',
1415
+ class: {
1416
+ base: ['data-is-active:bg-success-soft', 'data-is-active:text-on-success-soft']
1417
+ }
1418
+ }, {
1419
+ appearance: 'default',
1420
+ intent: 'warning',
1421
+ class: {
1422
+ base: ['data-is-active:bg-warning-soft', 'data-is-active:text-on-warning-soft']
1423
+ }
1424
+ }, {
1425
+ appearance: 'default',
1426
+ intent: 'danger',
1427
+ class: {
1428
+ base: ['data-is-active:bg-danger-soft', 'data-is-active:text-on-danger-soft']
1429
+ }
1430
+ },
1431
+ // appearance: outlined
1432
+ {
1433
+ appearance: 'outlined',
1434
+ intent: 'default',
1435
+ class: {
1436
+ base: ['data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
1437
+ }
1438
+ }, {
1439
+ appearance: 'outlined',
1440
+ intent: 'primary',
1441
+ class: {
1442
+ base: ['data-is-active:border-primary', 'data-is-active:text-primary-strong']
1443
+ }
1444
+ }, {
1445
+ appearance: 'outlined',
1446
+ intent: 'secondary',
1447
+ class: {
1448
+ base: ['data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
1449
+ }
1450
+ }, {
1451
+ appearance: 'outlined',
1452
+ intent: 'tertiary',
1453
+ class: {
1454
+ base: ['data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
1455
+ }
1456
+ }, {
1457
+ appearance: 'outlined',
1458
+ intent: 'success',
1459
+ class: {
1460
+ base: ['data-is-active:border-success', 'data-is-active:text-success-strong']
1461
+ }
1462
+ }, {
1463
+ appearance: 'outlined',
1464
+ intent: 'warning',
1465
+ class: {
1466
+ base: ['data-is-active:border-warning', 'data-is-active:text-warning-strong']
1467
+ }
1468
+ }, {
1469
+ appearance: 'outlined',
1470
+ intent: 'danger',
1471
+ class: {
1472
+ base: ['data-is-active:border-danger', 'data-is-active:text-danger-strong']
1473
+ }
1474
+ },
1475
+ // appearance: faded
1476
+ {
1477
+ appearance: 'faded',
1478
+ intent: 'default',
1479
+ class: {
1480
+ base: ['data-is-active:bg-neutral-soft/20', 'data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
1481
+ }
1482
+ }, {
1483
+ appearance: 'faded',
1484
+ intent: 'primary',
1485
+ class: {
1486
+ base: ['data-is-active:bg-primary-soft/20', 'data-is-active:border-primary', 'data-is-active:text-primary-strong']
1487
+ }
1488
+ }, {
1489
+ appearance: 'faded',
1490
+ intent: 'secondary',
1491
+ class: {
1492
+ base: ['data-is-active:bg-secondary-soft/20', 'data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
1493
+ }
1494
+ }, {
1495
+ appearance: 'faded',
1496
+ intent: 'tertiary',
1497
+ class: {
1498
+ base: ['data-is-active:bg-tertiary-soft/20', 'data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
1499
+ }
1500
+ }, {
1501
+ appearance: 'faded',
1502
+ intent: 'success',
1503
+ class: {
1504
+ base: ['data-is-active:bg-success-soft/20', 'data-is-active:border-success', 'data-is-active:text-success-strong']
1505
+ }
1506
+ }, {
1507
+ appearance: 'faded',
1508
+ intent: 'warning',
1509
+ class: {
1510
+ base: ['data-is-active:bg-warning-soft/20', 'data-is-active:border-warning', 'data-is-active:text-warning-strong']
1511
+ }
1512
+ }, {
1513
+ appearance: 'faded',
1514
+ intent: 'danger',
1515
+ class: {
1516
+ base: ['data-is-active:bg-danger-soft/20', 'data-is-active:border-danger', 'data-is-active:text-danger-strong']
1517
+ }
1518
+ }]
1519
+ });
1520
+ const listboxGroup = tv({
1521
+ slots: {
1522
+ base: 'block',
1523
+ // Spacing for the separator a group renders after itself, so the value
1524
+ // lives here rather than being repeated at each call site.
1525
+ divider: 'my-1',
1526
+ // `block`: the heading is a <span>, and an inline box's vertical padding
1527
+ // is painted without taking up space -- so without this the rows sit
1528
+ // directly under the heading text whatever padding it is given.
1529
+ title: ['block', 'px-2', 'py-1.5', 'font-body text-body-2xs font-medium', 'text-neutral', 'select-none'],
1530
+ list: 'flex flex-col gap-0.5'
1531
+ }
1532
+ });
1533
+
1534
+ const dropdownContent = tv({
1535
+ base: 'bg-surface-input w-[260px] rounded-xl border border-neutral-subtle'
1536
+ });
1537
+
1538
+ const popover = tv({
1539
+ base: 'bg-surface-input rounded-xl border border-neutral-subtle',
1540
+ variants: {
1541
+ size: {
1542
+ sm: 'w-40',
1543
+ md: 'w-64',
1544
+ lg: 'w-96',
1545
+ xl: 'w-136',
1546
+ trigger: 'w-(--trigger-width)'
1547
+ }
1548
+ },
1549
+ defaultVariants: {
1550
+ size: 'md'
1551
+ }
1552
+ });
1553
+
1554
+ const divider = tv({
1555
+ base: 'shrink-0 bg-neutral-subtle border-none',
1556
+ variants: {
1557
+ orientation: {
1558
+ horizontal: 'w-full h-px',
1559
+ vertical: 'h-full w-px'
1560
+ }
1561
+ },
1562
+ defaultVariants: {
1563
+ orientation: 'horizontal'
1564
+ }
1565
+ });
1566
+
1567
+ const externalLink = tv({
1568
+ slots: {
1569
+ // `inline`, not `inline-flex`. An external link's home is running text, and
1570
+ // `inline-flex` would make the whole anchor an atomic inline-block that
1571
+ // refuses to break across lines mid-phrase.
1572
+ //
1573
+ // No colour: `text-current` inherits from whatever the link sits in, so
1574
+ // there is no `intent` variant to keep in sync. `decoration-current/40`
1575
+ // gives the rule a lighter weight than the text without naming a palette.
1576
+ base: ['inline text-current', 'decoration-current/40 underline-offset-2', 'hover:decoration-current', 'transition-colors duration-150', 'rounded-sm', ...focusVisibleRing],
1577
+ // A wrapper rather than the `<svg>` itself, so the `:icon` block gets the
1578
+ // same sizing and spacing as the built-in glyph. `size-[1em]` tracks the
1579
+ // inherited font size, which is why the component needs no size scale.
1580
+ // `align-[-0.125em]` seats it on the text baseline instead of hanging it
1581
+ // from the line box.
1582
+ icon: ['inline-flex items-center justify-center size-[1em] shrink-0', 'align-[-0.125em]', '[&>svg]:size-full']
1583
+ },
1584
+ variants: {
1585
+ underline: {
1586
+ always: {
1587
+ base: 'underline'
1588
+ },
1589
+ hover: {
1590
+ base: 'no-underline hover:underline'
1591
+ },
1592
+ none: {
1593
+ base: 'no-underline hover:no-underline'
1594
+ }
1595
+ },
1596
+ iconPlacement: {
1597
+ start: {
1598
+ icon: 'mr-0.5'
1599
+ },
1600
+ end: {
1601
+ icon: 'ml-0.5'
1602
+ }
1603
+ }
1604
+ },
1605
+ defaultVariants: {
1606
+ underline: 'always',
1607
+ iconPlacement: 'end'
1608
+ }
1609
+ });
1610
+
1611
+ // Border-radius lives ONLY in the `shape` variants, never in `base`. Frontile's
1612
+ // `rounded-default` is a custom value that tailwind-merge does not recognise as
1613
+ // part of the `rounded` group, so a base radius would survive alongside a
1614
+ // shape's radius instead of being replaced by it.
1615
+ const skeleton = tv({
1616
+ base: ['block', 'overflow-hidden'],
1617
+ variants: {
1618
+ shape: {
1619
+ text: 'w-full rounded-default',
1620
+ circle: 'aspect-square rounded-full',
1621
+ // Matches Avatar's squircle radius so the two line up side by side.
1622
+ square: 'aspect-square rounded-[20%]',
1623
+ rounded: 'w-full rounded-lg',
1624
+ rect: 'w-full rounded-none'
1625
+ },
1626
+ // Resolved per shape in compoundVariants: `circle`/`square` take both
1627
+ // dimensions from Avatar's size scale, the rest take a height.
1628
+ size: {
1629
+ xs: '',
1630
+ sm: '',
1631
+ md: '',
1632
+ lg: '',
1633
+ xl: ''
1634
+ },
1635
+ animation: {
1636
+ shimmer: ['bg-linear-to-r', 'from-surface-overlay-soft', 'via-surface-overlay-firm', 'to-surface-overlay-soft', 'bg-[length:200%_100%]', 'animate-shimmer'],
1637
+ pulse: ['bg-surface-overlay-mild', 'animate-pulse'],
1638
+ none: ['bg-surface-overlay-mild']
1639
+ }
1640
+ },
1641
+ compoundVariants: [
1642
+ // Square-ish shapes: one token sets width and height, reusing Avatar's
1643
+ // scale so `<Skeleton @shape="circle" @size="md" />` matches
1644
+ // `<Avatar @size="md" />` exactly.
1645
+ {
1646
+ shape: ['circle', 'square'],
1647
+ size: 'xs',
1648
+ class: 'size-5'
1649
+ }, {
1650
+ shape: ['circle', 'square'],
1651
+ size: 'sm',
1652
+ class: 'size-6'
1653
+ }, {
1654
+ shape: ['circle', 'square'],
1655
+ size: 'md',
1656
+ class: 'size-8'
1657
+ }, {
1658
+ shape: ['circle', 'square'],
1659
+ size: 'lg',
1660
+ class: 'size-10'
1661
+ }, {
1662
+ shape: ['circle', 'square'],
1663
+ size: 'xl',
1664
+ class: 'size-12'
1665
+ },
1666
+ // Full-width shapes: size sets a height. Every shape gets one so a
1667
+ // Skeleton is never zero-height — an invisible placeholder makes a
1668
+ // loading state look like an empty state. Override with `@class`.
1669
+ {
1670
+ shape: ['text', 'rounded', 'rect'],
1671
+ size: 'xs',
1672
+ class: 'h-2.5'
1673
+ }, {
1674
+ shape: ['text', 'rounded', 'rect'],
1675
+ size: 'sm',
1676
+ class: 'h-3'
1677
+ }, {
1678
+ shape: ['text', 'rounded', 'rect'],
1679
+ size: 'md',
1680
+ class: 'h-4'
1681
+ }, {
1682
+ shape: ['text', 'rounded', 'rect'],
1683
+ size: 'lg',
1684
+ class: 'h-5'
1685
+ }, {
1686
+ shape: ['text', 'rounded', 'rect'],
1687
+ size: 'xl',
1688
+ class: 'h-6'
1689
+ }],
1690
+ defaultVariants: {
1691
+ shape: 'text',
1692
+ size: 'md',
1693
+ animation: 'shimmer'
1694
+ }
1695
+ });
1696
+
1697
+ const spinner = tv({
1698
+ base: 'text-neutral-muted animate-spin',
1699
+ variants: {
1700
+ size: {
1701
+ xs: 'w-4 h-4',
1702
+ sm: 'w-6 h-6',
1703
+ md: 'w-8 h-8',
1704
+ lg: 'w-10 h-10',
1705
+ xl: 'w-12 h-12'
1706
+ },
1707
+ intent: {
1708
+ default: 'fill-neutral-strong',
1709
+ primary: 'fill-primary',
1710
+ secondary: 'fill-secondary',
1711
+ tertiary: 'fill-tertiary',
1712
+ success: 'fill-success',
1713
+ warning: 'fill-warning',
1714
+ danger: 'fill-danger'
1715
+ }
1716
+ },
1717
+ defaultVariants: {
1718
+ size: 'md',
1719
+ intent: 'default'
1720
+ }
1721
+ });
1722
+
1723
+ const table = tv({
1724
+ slots: {
1725
+ base: ['w-full', 'caption-bottom', 'font-body text-body-2xs'],
1726
+ wrapper: ['relative', 'isolate', 'overflow-auto', 'rounded-default',
1727
+ // `surface-table` rather than `surface-card`, which the table otherwise
1728
+ // looks exactly like: every sticky part of the table paints over the rows
1729
+ // and columns scrolling beneath it, and in dark `card` is a translucent
1730
+ // veil that would let them read through. The role carries the colour that
1731
+ // veil renders, with the alpha already resolved. Override
1732
+ // `--color-surface-table` to sit a table on a different background.
1733
+ 'bg-surface-table'],
1734
+ table: ['w-full', 'table-auto'],
1735
+ thead: ['relative', 'bg-surface-overlay-subtle'],
1736
+ tbody: ['divide-y', 'divide-surface-overlay-subtle',
1737
+ // Rows carry the surface themselves rather than letting the wrapper show
1738
+ // through: a sticky row has to hide the rows sliding under it, and a
1739
+ // sticky cell picks its fill up from its row via `background-color:
1740
+ // inherit`. Row tints layer on top of this, and any tint that replaces it
1741
+ // has to be opaque too — see `striped` and the selection variants.
1742
+ '[&>tr]:bg-surface-table',
1743
+ // `muted`, not `subtle`: in dark `neutral-subtle` is gray-900, the same
1744
+ // value `surface-table` carries, so a `subtle` hover reads as no hover at
1745
+ // all. This stays a background *colour* so `transition-colors` animates it.
1746
+ '[&>tr]:data-[selectable=true]:data-[selected=false]:hover:bg-neutral-muted', '[&>tr]:data-[selectable=true]:transition-colors'],
1747
+ // Footer rows take the surface for the same reason body rows do: a sticky
1748
+ // column in the footer scrolls past the cells to its side.
1749
+ tfoot: ['relative', '[&>tr]:bg-surface-table'],
1750
+ tr: ['data-[disabled=true]:opacity-50', 'data-[disabled=true]:cursor-not-allowed', 'data-[disabled=true]:hover:bg-transparent', 'data-[selectable=true]:focus-visible:ring-2', 'data-[selectable=true]:focus-visible:ring-inset', 'data-[selectable=true]:focus-visible:ring-default', 'data-[selectable=true]:focus-visible:z-10', 'transition-colors', 'duration-150', 'outline-hidden'],
1751
+ separator: ['absolute', 'z-2', 'left-0', 'w-full', 'h-px', 'bg-surface-overlay-mild'],
1752
+ th: ['h-12', 'px-4', 'text-left', 'align-middle', 'font-label', 'text-neutral-bolder', '[&:has([role=checkbox])]:pr-0', 'data-[sortable=true]:cursor-pointer'],
1753
+ sortButton: ['group/sort', 'inline-flex', 'items-center', 'gap-1', 'w-full', 'text-left', 'font-label', 'text-neutral-bolder', 'outline-hidden', 'focus-visible:z-10', 'focus-visible:ring-3', 'focus-visible:ring-focus', 'focus-visible:ring-offset-2', 'focus-visible:ring-offset-background'],
1754
+ sortIcon: ['size-4', 'flex-shrink-0', 'text-neutral-soft', 'transition-opacity', 'data-[sorted=false]:opacity-0', 'group-hover/sort:data-[sorted=false]:opacity-100', 'data-[sorted=true]:opacity-100'],
1755
+ columnVisibilityButton: ['flex'],
1756
+ columnVisibilityIcon: ['size-6'],
1757
+ td: ['align-middle', 'text-neutral-strong', '[&:has([role=checkbox])]:pr-0'],
1758
+ empty: ['text-neutral-soft', 'align-middle', 'text-center', 'py-12'],
1759
+ // Deliberately carries no width or height: these classes are merged onto
1760
+ // Skeleton *after* its own shape and size variants, so any dimension set
1761
+ // here would defeat a column's `skeleton: 'circle'` preset. The table
1762
+ // passes its `size` through to Skeleton instead.
1763
+ skeleton: ['max-w-[16ch]'],
1764
+ // Placeholder rows fade in one after another. The per-row `animation-delay`
1765
+ // is set inline by the component, since a delay that scales with the row
1766
+ // index cannot be a static utility class.
1767
+ skeletonRow: ['animate-skeleton-enter', 'motion-reduce:animate-none']
1768
+ },
1769
+ variants: {
1770
+ size: {
1771
+ sm: {
1772
+ th: 'h-10 px-3 py-2 text-label-2xs',
1773
+ td: 'px-3 py-2 text-body-2xs'
1774
+ },
1775
+ md: {
1776
+ th: 'h-12 px-4 text-label-xs',
1777
+ td: 'p-4 text-body-2xs'
1778
+ },
1779
+ lg: {
1780
+ th: 'h-14 px-6 text-label-sm',
1781
+ td: 'p-6 text-body-xs'
1782
+ }
1783
+ },
1784
+ isLoading: {
1785
+ true: {
1786
+ thead: ['after:absolute', 'after:top-full', 'after:left-0', 'after:w-1/2', 'after:animate-swing', 'after:h-px', 'after:z-10']
1787
+ }
1788
+ },
1789
+ // Declared empty on purpose: these variants exist only so `isLoading` can
1790
+ // pair with them in `compoundVariants` below, where the actual
1791
+ // `thead: after:bg-*` colour is applied. A colour set here would paint the
1792
+ // hairline even when the table is not loading.
1793
+ loadingColor: {
1794
+ default: {},
1795
+ primary: {},
1796
+ success: {},
1797
+ warning: {},
1798
+ danger: {}
1799
+ },
1800
+ selectionColor: {
1801
+ default: {},
1802
+ primary: {},
1803
+ success: {},
1804
+ warning: {},
1805
+ danger: {}
1806
+ },
1807
+ layout: {
1808
+ auto: {
1809
+ table: 'table-auto'
1810
+ },
1811
+ fixed: {
1812
+ table: 'table-fixed'
1813
+ }
1814
+ },
1815
+ striped: {
1816
+ true: {
1817
+ // A translucent tint, so it goes on as a background *image* layer over
1818
+ // the row's opaque fill instead of replacing it. Painting it as the
1819
+ // background colour would make every striped sticky row see-through.
1820
+ tbody: '[&_tr:nth-child(odd)]:[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'
1821
+ }
1822
+ },
1823
+ isSticky: {
1824
+ true: {}
1825
+ },
1826
+ stickyPosition: {
1827
+ left: {},
1828
+ right: {},
1829
+ top: {},
1830
+ bottom: {}
1831
+ },
1832
+ isScrollable: {
1833
+ true: {
1834
+ wrapper: ['overflow-auto']
1835
+ }
1836
+ },
1837
+ hasStickyHeader: {
1838
+ true: {}
1839
+ },
1840
+ isInStickyRow: {
1841
+ true: {}
1842
+ }
1843
+ },
1844
+ compoundVariants: [
1845
+ // Sticky header - highest priority for intersections with columns
1846
+ {
1847
+ isSticky: true,
1848
+ stickyPosition: 'top',
1849
+ class: {
1850
+ // The opaque surface plus the header's own translucent tint as a layer
1851
+ // above it, which is what a non-sticky `thead` composites to over the
1852
+ // wrapper — so stuck and unstuck headers read as the same colour.
1853
+ thead: ['sticky', 'top-0', 'z-2', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]']
1854
+ }
1855
+ },
1856
+ // Sticky footer
1857
+ {
1858
+ isSticky: true,
1859
+ stickyPosition: 'bottom',
1860
+ class: {
1861
+ tfoot: ['sticky', 'bottom-0', 'z-2', 'bg-surface-table']
1862
+ }
1863
+ },
1864
+ // Sticky columns - medium priority, header cells get higher z-index.
1865
+ // Body and footer cells inherit their row's paint — fill, and any tint
1866
+ // layered over it — so a pinned column tracks selection, hover and striping
1867
+ // instead of masking them with a surface of its own.
1868
+ {
1869
+ isSticky: true,
1870
+ stickyPosition: 'left',
1871
+ class: {
1872
+ th: ['sticky', 'left-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1873
+ td: ['sticky', 'left-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1874
+ }
1875
+ }, {
1876
+ isSticky: true,
1877
+ stickyPosition: 'right',
1878
+ class: {
1879
+ th: ['sticky', 'right-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1880
+ td: ['sticky', 'right-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1881
+ }
1882
+ },
1883
+ // Sticky rows - base layer
1884
+ {
1885
+ isSticky: true,
1886
+ stickyPosition: 'top',
1887
+ class: {
1888
+ tr: ['sticky', 'top-0', 'z-1', 'bg-surface-table']
1889
+ }
1890
+ }, {
1891
+ isSticky: true,
1892
+ stickyPosition: 'bottom',
1893
+ class: {
1894
+ tr: ['sticky', 'bottom-0', 'z-1', 'bg-surface-table']
1895
+ }
1896
+ },
1897
+ // Sticky rows with sticky header - position after header
1898
+ {
1899
+ isSticky: true,
1900
+ stickyPosition: 'top',
1901
+ hasStickyHeader: true,
1902
+ class: {
1903
+ tr: ['sticky', 'z-2', 'bg-surface-table', '[&.sticky]:[top:var(--table-header-height,48px)]']
1904
+ }
1905
+ },
1906
+ // Intersection cells: sticky column + sticky row - highest z-index
1907
+ {
1908
+ isSticky: true,
1909
+ stickyPosition: 'left',
1910
+ isInStickyRow: true,
1911
+ class: {
1912
+ td: ['sticky', 'left-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1913
+ }
1914
+ }, {
1915
+ isSticky: true,
1916
+ stickyPosition: 'right',
1917
+ isInStickyRow: true,
1918
+ class: {
1919
+ td: ['sticky', 'right-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1920
+ }
1921
+ },
1922
+ // Loading states with color variants
1923
+ {
1924
+ isLoading: true,
1925
+ loadingColor: 'default',
1926
+ class: {
1927
+ thead: `after:bg-neutral`
1928
+ }
1929
+ }, {
1930
+ isLoading: true,
1931
+ loadingColor: 'primary',
1932
+ class: {
1933
+ thead: `after:bg-primary`
1934
+ }
1935
+ }, {
1936
+ isLoading: true,
1937
+ loadingColor: 'success',
1938
+ class: {
1939
+ thead: `after:bg-success`
1940
+ }
1941
+ }, {
1942
+ isLoading: true,
1943
+ loadingColor: 'warning',
1944
+ class: {
1945
+ thead: `after:bg-warning`
1946
+ }
1947
+ }, {
1948
+ isLoading: true,
1949
+ loadingColor: 'danger',
1950
+ class: {
1951
+ thead: `after:bg-danger`
1952
+ }
1953
+ },
1954
+ // Selection color variants
1955
+ {
1956
+ selectionColor: 'default',
1957
+ class: {
1958
+ // Half-opacity, so it layers over the row's fill rather than replacing
1959
+ // it — a selected sticky row still has to occlude what scrolls under.
1960
+ // The other selection colours are opaque and can stay plain fills.
1961
+ //
1962
+ // `soft` rather than `subtle`, which in dark is the same value as
1963
+ // `surface-table` and so tints nothing. At 50% this lands on the weight
1964
+ // the colour variants carry (1.4:1 against the surface, against
1965
+ // `primary-subtle`'s 1.38:1).
1966
+ tbody: '[&>tr]:data-[selected=true]:[background-image:linear-gradient(color-mix(in_oklab,var(--color-neutral-soft)_50%,transparent),color-mix(in_oklab,var(--color-neutral-soft)_50%,transparent))]',
1967
+ tr: ['data-[selectable=true]:focus-visible:ring-default']
1968
+ }
1969
+ }, {
1970
+ selectionColor: 'primary',
1971
+ class: {
1972
+ tbody: '[&>tr]:data-[selected=true]:bg-primary-subtle',
1973
+ tr: ['data-[selectable=true]:focus-visible:ring-primary-soft']
1974
+ }
1975
+ }, {
1976
+ selectionColor: 'success',
1977
+ class: {
1978
+ tbody: '[&>tr]:data-[selected=true]:bg-success-subtle',
1979
+ tr: ['data-[selectable=true]:focus-visible:ring-success']
1980
+ }
1981
+ }, {
1982
+ selectionColor: 'warning',
1983
+ class: {
1984
+ tbody: '[&>tr]:data-[selected=true]:bg-warning-subtle',
1985
+ tr: ['data-[selectable=true]:focus-visible:ring-warning']
1986
+ }
1987
+ }, {
1988
+ selectionColor: 'danger',
1989
+ class: {
1990
+ tbody: '[&>tr]:data-[selected=true]:bg-danger-subtle',
1991
+ tr: ['data-[selectable=true]:focus-visible:ring-danger']
1992
+ }
1993
+ }],
1994
+ defaultVariants: {
1995
+ size: 'md',
1996
+ layout: 'auto',
1997
+ loadingColor: 'default',
1998
+ selectionColor: 'primary'
1999
+ }
2000
+ });
2001
+
2002
+ const segmentedControl = tv({
2003
+ slots: {
2004
+ // The positioning context the indicator is measured against. `isolate`
2005
+ // keeps the indicator's stacking behind the items without leaking a
2006
+ // z-index into the surrounding page.
2007
+ base: ['relative isolate inline-flex', 'rounded-pill', 'p-1'],
2008
+ // Geometry comes from the custom properties `selectionIndicator` publishes;
2009
+ // this slot only decides what it looks like. `var()` names are literal:
2010
+ // Tailwind generates nothing from an interpolated class string.
2011
+ indicator: ['pointer-events-none absolute left-0 top-0 z-0', 'w-[var(--fr-si-width)] h-[var(--fr-si-height)]', 'translate-x-[var(--fr-si-x)] translate-y-[var(--fr-si-y)]', 'rounded-pill',
2012
+ // Held until the first real measurement lands, so the indicator never
2013
+ // flies in from the container origin on first paint.
2014
+ 'opacity-0', 'group-data-[fr-si-ready]/segmented:opacity-100',
2015
+ // Tailwind v4 compiles `translate-x-*` to the standalone `translate`
2016
+ // property, not to `transform`, so `translate` is what has to be
2017
+ // transitioned. `transform` is listed for overrides that use it.
2018
+ 'group-data-[fr-si-ready]/segmented:transition-[transform,translate,width,height]', 'group-data-[fr-si-ready]/segmented:duration-200', 'group-data-[fr-si-ready]/segmented:ease-out', 'motion-reduce:transition-none'],
2019
+ // Both focus rings, not one per rendering mode: in button mode the item is
2020
+ // the focusable element and `has-[:focus-visible]` has no descendant to
2021
+ // match, while in form mode the label is not focusable and `focus-visible:`
2022
+ // never matches it. Only one set can ever apply, so a third rendering mode
2023
+ // needs no third branch.
2024
+ item: [...focusVisibleRing, ...focusVisibleWithinRing, 'relative z-10', 'inline-flex items-center justify-center gap-2', 'cursor-pointer select-none whitespace-nowrap', 'rounded-pill', 'transition-colors duration-200', 'motion-reduce:transition-none',
2025
+ // Both rendering modes publish `data-disabled`, so one selector covers
2026
+ // them. Keying off native `disabled:` would miss form mode, where the
2027
+ // item is a `<label>` and only the hidden input is disabled.
2028
+ 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled',
2029
+ // Resting, hover and selected are three distinct levels so hover has
2030
+ // somewhere to go that is not the selected ink. `neutral-firm` clears
2031
+ // WCAG AA against the track in both modes.
2032
+ 'text-neutral-firm',
2033
+ // Scoped to unselected: an unscoped `hover:` ties on specificity with the
2034
+ // variants' `data-[selected=true]:` ink, leaving the winner to Tailwind's
2035
+ // emitted variant order.
2036
+ 'data-[selected=false]:data-[disabled=false]:hover:text-neutral-strong']
2037
+ },
2038
+ variants: {
2039
+ variant: {
2040
+ solid: {
2041
+ // `surface-overlay-soft` is translucent in dark mode, as is the
2042
+ // indicator's `surface-card`; two stacked veils composite
2043
+ // unpredictably, so dark mode uses an opaque role instead.
2044
+ base: 'bg-surface-overlay-soft dark:bg-surface-table',
2045
+ indicator: 'shadow-elevation-1'
2046
+ },
2047
+ ghost: {
2048
+ base: 'bg-transparent',
2049
+ indicator: ''
2050
+ }
2051
+ },
2052
+ // Keyed off `data-selected`, which the item publishes in both rendering
2053
+ // modes -- the two express selection on different elements, so a rule per
2054
+ // mode is one mode away from being forgotten. Written literally: Tailwind
2055
+ // generates nothing from a composed class string.
2056
+ intent: {
2057
+ default: {
2058
+ // Opaque white in light mode. In dark, `surface-card` is translucent,
2059
+ // so an opaque neutral is used instead -- see the track above.
2060
+ indicator: 'bg-surface-card dark:bg-neutral-soft',
2061
+ item: 'data-[selected=true]:text-neutral-bolder'
2062
+ },
2063
+ primary: {
2064
+ indicator: 'bg-primary',
2065
+ item: 'data-[selected=true]:text-on-primary'
2066
+ },
2067
+ secondary: {
2068
+ indicator: 'bg-secondary',
2069
+ item: 'data-[selected=true]:text-on-secondary'
2070
+ },
2071
+ tertiary: {
2072
+ indicator: 'bg-tertiary',
2073
+ item: 'data-[selected=true]:text-on-tertiary'
2074
+ },
2075
+ success: {
2076
+ indicator: 'bg-success',
2077
+ item: 'data-[selected=true]:text-on-success'
2078
+ },
2079
+ warning: {
2080
+ indicator: 'bg-warning',
2081
+ item: 'data-[selected=true]:text-on-warning'
2082
+ },
2083
+ danger: {
2084
+ indicator: 'bg-danger',
2085
+ item: 'data-[selected=true]:text-on-danger'
2086
+ }
2087
+ },
2088
+ size: {
2089
+ sm: {
2090
+ item: 'px-3 py-1 text-label-sm'
2091
+ },
2092
+ md: {
2093
+ item: 'px-4 py-1.5 text-label-md'
2094
+ },
2095
+ lg: {
2096
+ item: 'px-5 py-2 text-label-lg'
2097
+ }
2098
+ },
2099
+ orientation: {
2100
+ horizontal: {
2101
+ base: 'flex-row'
2102
+ },
2103
+ // A pill radius on a tall narrow column reads as an oval blob, so the
2104
+ // vertical axis squares off -- on the track and on what sits inside it,
2105
+ // or the indicator would bulge out of the track. The inner radius is the
2106
+ // outer one less the track's `p-1`.
2107
+ vertical: {
2108
+ base: 'flex-col rounded-2xl',
2109
+ indicator: 'rounded-xl',
2110
+ item: 'rounded-xl'
2111
+ }
2112
+ },
2113
+ isFullWidth: {
2114
+ true: {
2115
+ base: 'flex w-full',
2116
+ item: 'flex-1'
2117
+ }
2118
+ },
2119
+ isDisabled: {
2120
+ true: {
2121
+ base: 'opacity-disabled',
2122
+ item: 'pointer-events-none'
2123
+ }
2124
+ },
2125
+ hasSeparators: {
2126
+ true: {
2127
+ item: [
2128
+ // A hairline before every item except the first. The level differs
2129
+ // per mode: neither the neutral scale nor the track is symmetric
2130
+ // across them, so one level cannot read on both.
2131
+ 'before:absolute before:content-[""]', 'before:bg-neutral-mild dark:before:bg-neutral-soft', 'before:transition-opacity before:duration-200', 'motion-reduce:before:transition-none',
2132
+ // The indicator's `<span>` is the container's true first child, so
2133
+ // `first:` would never match an item; `first-of-type:` does.
2134
+ 'first-of-type:before:content-none',
2135
+ // Hidden on the selected item and the one after it, so the indicator
2136
+ // never crosses a visible line. Sibling selectors know the order, so
2137
+ // nothing tracks indices.
2138
+ 'before:opacity-100', 'data-[selected=true]:before:opacity-0', '[&[data-selected=true]+*]:before:opacity-0']
2139
+ }
2140
+ }
2141
+ },
2142
+ compoundVariants: [
2143
+ // Vertical items get their width from the flex stretch, so the padding
2144
+ // budget moves to the cross axis. One literal class per size.
2145
+ {
2146
+ orientation: 'vertical',
2147
+ size: 'sm',
2148
+ class: {
2149
+ item: 'py-1.5'
2150
+ }
2151
+ }, {
2152
+ orientation: 'vertical',
2153
+ size: 'md',
2154
+ class: {
2155
+ item: 'py-2'
2156
+ }
2157
+ }, {
2158
+ orientation: 'vertical',
2159
+ size: 'lg',
2160
+ class: {
2161
+ item: 'py-2.5'
2162
+ }
2163
+ }, {
2164
+ hasSeparators: true,
2165
+ orientation: 'horizontal',
2166
+ class: {
2167
+ item: 'before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-px before:h-4'
2168
+ }
2169
+ }, {
2170
+ hasSeparators: true,
2171
+ orientation: 'vertical',
2172
+ class: {
2173
+ item: 'before:top-0 before:left-1/2 before:-translate-x-1/2 before:h-px before:w-4'
2174
+ }
2175
+ }],
2176
+ defaultVariants: {
2177
+ variant: 'solid',
2178
+ intent: 'default',
2179
+ size: 'md',
2180
+ orientation: 'horizontal'
2181
+ }
2182
+ });
2183
+
2184
+ const tabs = tv({
2185
+ slots: {
2186
+ base: 'flex',
2187
+ // The positioning context the indicator is measured against, and the
2188
+ // element that carries `group/tabs` in the template.
2189
+ list: ['relative isolate flex', 'select-none'],
2190
+ // Geometry comes from the custom properties `selectionIndicator`
2191
+ // publishes. `var()` names are literal: Tailwind generates nothing from
2192
+ // an interpolated class string.
2193
+ indicator: ['pointer-events-none absolute left-0 top-0 z-0',
2194
+ // Held until the first real measurement lands, so the indicator never
2195
+ // flies in from the container origin on first paint.
2196
+ 'opacity-0', 'group-data-[fr-si-ready]/tabs:opacity-100',
2197
+ // Tailwind v4 compiles `translate-x-*` to the standalone `translate`
2198
+ // property, not to `transform`, so `translate` is what has to be
2199
+ // transitioned. `transform` is listed for overrides that use it.
2200
+ 'group-data-[fr-si-ready]/tabs:transition-[transform,translate,width,height]', 'group-data-[fr-si-ready]/tabs:duration-200', 'group-data-[fr-si-ready]/tabs:ease-out', 'motion-reduce:transition-none'],
2201
+ tab: [...focusVisibleRing, 'relative z-10', 'inline-flex items-center justify-center gap-2', 'cursor-pointer whitespace-nowrap', 'transition-colors duration-200', 'motion-reduce:transition-none',
2202
+ // Resting, hover and selected are three distinct levels so hover has
2203
+ // somewhere to go that is not the selected ink.
2204
+ 'text-neutral-firm',
2205
+ // Scoped to unselected: an unscoped `hover:` ties on specificity with
2206
+ // the selected ink, leaving the winner to Tailwind's variant order.
2207
+ // "Not disabled" is `not-data-[disabled=true]`, not `data-[disabled=false]`:
2208
+ // an attribute-value selector cannot match an element that never declares
2209
+ // the attribute, and a consumer bringing their own element should not have
2210
+ // to know the theme wants a `data-disabled="false"` written onto it.
2211
+ 'data-[selected=false]:not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
2212
+ panel: [...focusVisibleRing, 'outline-none']
2213
+ },
2214
+ variants: {
2215
+ variant: {
2216
+ solid: {
2217
+ list: 'bg-surface-overlay-soft dark:bg-surface-table rounded-pill p-1',
2218
+ indicator: ['w-[var(--fr-si-width)] h-[var(--fr-si-height)]', 'translate-x-[var(--fr-si-x)] translate-y-[var(--fr-si-y)]', 'rounded-pill shadow-elevation-1'],
2219
+ tab: 'rounded-pill'
2220
+ },
2221
+ // Painting is finished in compoundVariants: the bar is pinned to a
2222
+ // different edge per orientation and reads a different pair of custom
2223
+ // properties, so there is nothing orientation-agnostic to say here.
2224
+ underline: {
2225
+ tab: 'rounded-md'
2226
+ }
2227
+ },
2228
+ // Fill and selected ink travel together: the label sits on the fill, so a
2229
+ // new intent needs both or its selected label is unreadable on its own
2230
+ // background. `underline` overrides the ink in one compound below, since a
2231
+ // bare bar puts no fill behind the label.
2232
+ intent: {
2233
+ default: {
2234
+ indicator: 'bg-surface-card dark:bg-neutral-soft',
2235
+ tab: 'data-[selected=true]:text-neutral-bolder'
2236
+ },
2237
+ primary: {
2238
+ indicator: 'bg-primary',
2239
+ tab: 'data-[selected=true]:text-on-primary'
2240
+ },
2241
+ secondary: {
2242
+ indicator: 'bg-secondary',
2243
+ tab: 'data-[selected=true]:text-on-secondary'
2244
+ },
2245
+ tertiary: {
2246
+ indicator: 'bg-tertiary',
2247
+ tab: 'data-[selected=true]:text-on-tertiary'
2248
+ },
2249
+ success: {
2250
+ indicator: 'bg-success',
2251
+ tab: 'data-[selected=true]:text-on-success'
2252
+ },
2253
+ warning: {
2254
+ indicator: 'bg-warning',
2255
+ tab: 'data-[selected=true]:text-on-warning'
2256
+ },
2257
+ danger: {
2258
+ indicator: 'bg-danger',
2259
+ tab: 'data-[selected=true]:text-on-danger'
2260
+ }
2261
+ },
2262
+ size: {
2263
+ sm: {
2264
+ tab: 'px-3 py-1 text-label-sm',
2265
+ panel: 'py-2'
2266
+ },
2267
+ md: {
2268
+ tab: 'px-4 py-1.5 text-label-md',
2269
+ panel: 'py-3'
2270
+ },
2271
+ lg: {
2272
+ tab: 'px-5 py-2 text-label-lg',
2273
+ panel: 'py-4'
2274
+ }
2275
+ },
2276
+ orientation: {
2277
+ horizontal: {
2278
+ base: 'flex-col',
2279
+ list: 'flex-row'
2280
+ },
2281
+ vertical: {
2282
+ base: 'flex-row gap-4',
2283
+ list: 'flex-col'
2284
+ }
2285
+ },
2286
+ // `base` needs the width too, not just `list`: the list's `w-full`
2287
+ // resolves against `base`, and a `base` with no width of its own collapses
2288
+ // to its content inside an `align-items: flex-start` parent -- leaving the
2289
+ // whole argument inert in exactly the layouts that reach for it.
2290
+ isFullWidth: {
2291
+ true: {
2292
+ base: 'w-full',
2293
+ list: 'w-full',
2294
+ tab: 'flex-1'
2295
+ }
2296
+ },
2297
+ isDisabled: {
2298
+ true: {
2299
+ list: 'opacity-disabled',
2300
+ tab: 'pointer-events-none'
2301
+ }
2302
+ }
2303
+ },
2304
+ compoundVariants: [
2305
+ // -- underline: no fill behind the label, so the intent colour lives on the
2306
+ // bar alone and the label stays high-contrast neutral at every intent --
2307
+ // matching the reference designs. The hover chip shares this matcher, so it
2308
+ // rides along rather than repeating the condition in a second entry.
2309
+ {
2310
+ variant: 'underline',
2311
+ class: {
2312
+ tab: 'data-[selected=true]:text-neutral-bolder data-[selected=false]:not-data-[disabled=true]:hover:bg-surface-overlay-soft'
2313
+ }
2314
+ },
2315
+ // A pill radius on a tall narrow column reads as an oval blob, so the
2316
+ // vertical axis squares off -- on the track and on what sits inside it, or
2317
+ // the indicator would bulge out of the track. The inner radius is the
2318
+ // outer one less the track's `p-1`. Only `solid` has a track to round.
2319
+ {
2320
+ variant: 'solid',
2321
+ orientation: 'vertical',
2322
+ class: {
2323
+ list: 'rounded-2xl',
2324
+ indicator: 'rounded-xl',
2325
+ tab: 'rounded-xl'
2326
+ }
2327
+ },
2328
+ // `default` intent's fill is a surface in solid; a bare bar needs ink.
2329
+ {
2330
+ variant: 'underline',
2331
+ intent: 'default',
2332
+ class: {
2333
+ indicator: 'bg-neutral-bolder'
2334
+ }
2335
+ }, {
2336
+ variant: 'underline',
2337
+ orientation: 'horizontal',
2338
+ class: {
2339
+ // `pb-2` is what separates the labels from the rule, and it belongs on
2340
+ // the list rather than as a margin on each tab: an absolutely
2341
+ // positioned box resolves its offsets against the padding box, so the
2342
+ // bar stays welded to the rule at `bottom-0` while the padding pushes
2343
+ // the tabs -- and with them their hover chips -- clear of it. A chip
2344
+ // that runs into the rule is the thing this buys off.
2345
+ list: 'gap-1 pb-2 border-b border-neutral-mild dark:border-neutral-soft',
2346
+ indicator: ['top-auto bottom-0 h-0.5 rounded-full', 'w-[var(--fr-si-width)]', 'translate-x-[var(--fr-si-x)]']
2347
+ }
2348
+ }, {
2349
+ variant: 'underline',
2350
+ orientation: 'vertical',
2351
+ class: {
2352
+ // The same gap, on the axis this orientation puts the rule on.
2353
+ list: 'gap-1 ps-2 border-l border-neutral-mild dark:border-neutral-soft',
2354
+ indicator: ['left-0 w-0.5 rounded-full', 'h-[var(--fr-si-height)]', 'translate-y-[var(--fr-si-y)]']
2355
+ }
2356
+ }],
2357
+ defaultVariants: {
2358
+ variant: 'solid',
2359
+ intent: 'default',
2360
+ size: 'md',
2361
+ orientation: 'horizontal'
2362
+ }
2363
+ });
2364
+
2365
+ const accordion = tv({
2366
+ slots: {
2367
+ base: 'flex flex-col',
2368
+ // Carries `group/accordion-item` plus `data-open`, which is what lets the
2369
+ // indicator rotate without the component pushing a class. The group name
2370
+ // is written literally: Tailwind generates nothing from a composed string.
2371
+ item: 'group/accordion-item',
2372
+ heading: 'flex',
2373
+ trigger: [...focusVisibleRing, 'flex flex-1 items-center text-start', 'w-full cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'text-neutral-bolder',
2374
+ // "Not disabled" is `not-data-[disabled=true]`, not
2375
+ // `data-[disabled=false]`: an attribute-value selector cannot match an
2376
+ // element that never declares the attribute.
2377
+ 'not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
2378
+ startContent: 'flex shrink-0 items-center',
2379
+ titleWrapper: 'flex flex-1 flex-col text-start',
2380
+ title: '',
2381
+ subtitle: 'text-neutral-firm',
2382
+ indicator: ['shrink-0', 'transition-transform duration-200 motion-reduce:transition-none', 'group-data-[open=true]/accordion-item:rotate-180'],
2383
+ // The animated element. It must never carry padding: padding on the
2384
+ // animating box means the collapsed height can never reach 0.
2385
+ content: 'text-neutral-firm',
2386
+ // Where the panel's padding actually lives.
2387
+ contentBody: ''
2388
+ },
2389
+ variants: {
2390
+ variant: {
2391
+ // No chrome at all.
2392
+ ghost: {},
2393
+ // Rules between items, none after the last.
2394
+ outlined: {
2395
+ item: 'border-b border-neutral-muted last:border-b-0'
2396
+ },
2397
+ // A soft fill on the open item. Horizontal padding comes with the
2398
+ // surface -- text running to the edge of a tinted box reads as a bug.
2399
+ faded: {
2400
+ item: 'rounded-lg data-[open=true]:bg-surface-overlay-soft',
2401
+ trigger: 'px-3',
2402
+ contentBody: 'px-3'
2403
+ },
2404
+ // One bordered surface around the whole group.
2405
+ enclosed: {
2406
+ base: 'overflow-hidden rounded-lg border border-neutral-muted',
2407
+ item: 'border-b border-neutral-muted last:border-b-0',
2408
+ trigger: 'px-4',
2409
+ contentBody: 'px-4'
2410
+ }
2411
+ },
2412
+ size: {
2413
+ // Typography sits on `trigger`, not on `title`, and that placement is
2414
+ // load-bearing: the trigger renders inside a real `<h3>` (or whatever
2415
+ // `@headingLevel` says), so a host page's heading styles -- large, bold,
2416
+ // tight tracking -- would otherwise be inherited by everything in the
2417
+ // header row that does not set its own size: `startContent`, the
2418
+ // indicator, and any custom `<:title>` content. The class on the trigger
2419
+ // is the baseline that neutralises that; `subtitle` then refines it, and
2420
+ // `@classes.title` still wins on the title element itself.
2421
+ //
2422
+ // `text-label-*` (semibold, default tracking) rather than `text-strong-*`
2423
+ // (bold, tight): an accordion header is a label on a row, not a section
2424
+ // heading. It matches the panel body's size at every step and lets weight
2425
+ // alone do the separating, which is how the reference implementations
2426
+ // read.
2427
+ sm: {
2428
+ trigger: 'gap-2 py-2 text-label-xs',
2429
+ subtitle: 'text-body-2xs',
2430
+ indicator: 'size-4',
2431
+ contentBody: 'pb-2 text-body-sm'
2432
+ },
2433
+ md: {
2434
+ trigger: 'gap-3 py-3 text-label-sm',
2435
+ subtitle: 'text-body-xs',
2436
+ indicator: 'size-5',
2437
+ contentBody: 'pb-3 text-body-md'
2438
+ },
2439
+ lg: {
2440
+ trigger: 'gap-3 py-4 text-label-md',
2441
+ subtitle: 'text-body-sm',
2442
+ indicator: 'size-6',
2443
+ contentBody: 'pb-4 text-body-lg'
2444
+ }
2445
+ },
2446
+ isDisabled: {
2447
+ true: {
2448
+ base: 'opacity-disabled',
2449
+ trigger: 'pointer-events-none'
2450
+ }
2451
+ }
2452
+ },
2453
+ defaultVariants: {
2454
+ variant: 'outlined',
2455
+ size: 'md'
2456
+ }
2457
+ });
2458
+
2459
+ const calendar = tv({
2460
+ slots: {
2461
+ base: [
2462
+ // `isolate` keeps every z-index the calendar uses inside the calendar.
2463
+ // The shared focus ring raises a focused control to `z-10`; without a
2464
+ // stacking context here that lands in the page's own stacking order and
2465
+ // paints over a site header.
2466
+ 'isolate inline-flex flex-col gap-3 p-3',
2467
+ // The two knobs that let a consumer resize cells and reshape them
2468
+ // without any new API. `--calendar-cell-radius` is how a `<:day>` block
2469
+ // with custom content escapes the circle.
2470
+ '[--calendar-cell-size:2.5rem]', '[--calendar-cell-radius:9999px]'],
2471
+ // Header, year panel and month grids share one column sized to the grids
2472
+ // themselves. Without this the header stretches to the width of the
2473
+ // widest sibling -- a `<:footer>` of preset buttons, say -- and the prev
2474
+ // and next arrows drift away from the days they page.
2475
+ body: 'flex flex-col gap-3 w-fit',
2476
+ header: 'flex items-center justify-between gap-2',
2477
+ // `label-sm` is 1rem, which reads as heavy as a heading next to 14px day
2478
+ // numbers; `label-xs` is the 14px the caption wants.
2479
+ title: 'text-label-xs text-neutral-bolder',
2480
+ nav: 'flex items-center gap-1',
2481
+ // A native `<select>` sizes itself to its *widest* option, so the caption
2482
+ // would sit at "September" width even in May. Instead the visible label is
2483
+ // a span that sizes to the current month, with a transparent full-size
2484
+ // `<select>` laid over it -- the control stays native for the keyboard and
2485
+ // for assistive tech, but no longer dictates the width, and its built-in
2486
+ // arrow (which cannot be spaced) is replaced by our own chevron.
2487
+ monthSelectWrapper: [...focusVisibleWithinRing, 'relative inline-flex items-center gap-1', 'rounded-full px-2 py-1 cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'hover:bg-surface-overlay-soft'],
2488
+ monthSelectValue: 'text-label-xs text-neutral-bolder',
2489
+ monthSelect: 'absolute inset-0 w-full opacity-0 cursor-pointer',
2490
+ monthSelectIcon: 'pointer-events-none size-3.5 shrink-0 text-neutral-firm',
2491
+ // Its own slot rather than `navButton`: that one is a fixed square sized
2492
+ // for a chevron, which would clip a four-digit year.
2493
+ yearTrigger: [...focusVisibleRing, 'inline-flex items-center gap-1', 'rounded-full px-2 py-1 cursor-pointer', 'text-label-xs text-neutral-bolder', 'transition-colors duration-200 motion-reduce:transition-none', 'hover:bg-surface-overlay-soft'],
2494
+ navButton: [...focusVisibleRing, 'inline-flex items-center justify-center', 'size-8 rounded-full',
2495
+ // The chevron inside is sized here rather than on the icon, so the
2496
+ // button stays the hit area and the glyph stays optically balanced
2497
+ // against the caption.
2498
+ '[&_svg]:size-4', 'text-neutral-firm cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'not-data-[disabled=true]:hover:bg-surface-overlay-soft', 'not-data-[disabled=true]:hover:text-neutral-bolder', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
2499
+ // Centered because the calendar is only ever as wide as its widest part:
2500
+ // a `<:header>` block wider than the grid (long month names, extra
2501
+ // controls) stretches the component, and the months would otherwise sit
2502
+ // flush left under it. A no-op whenever the grid is the widest part.
2503
+ monthsWrapper: 'flex justify-center gap-4',
2504
+ monthGrid: 'border-collapse',
2505
+ weekdaysRow: '',
2506
+ // `caption-2xs` does not exist in the type scale -- the smallest caption
2507
+ // is `caption-sm` -- so the old value generated nothing and these labels
2508
+ // inherited 16px, rendering *larger* than the day numbers beneath them.
2509
+ // The row is also shorter than a day row: it is a label, not a cell.
2510
+ weekday: ['text-caption-sm text-neutral font-normal', 'h-8 w-[var(--calendar-cell-size)]', 'text-center align-middle'],
2511
+ week: '',
2512
+ // The positioning context for `cellBand`. No padding: the band has to
2513
+ // reach the cell edges for adjacent bands to touch.
2514
+ cell: ['relative p-0 text-center', 'size-[var(--calendar-cell-size)]'],
2515
+ // The continuous range ribbon, behind the day. Absolutely positioned and
2516
+ // filling the whole cell, which is what removes the gap between days.
2517
+ // No z-index: the band is painted before the day in document order, and
2518
+ // between two positioned elements with auto z-index document order already
2519
+ // decides. Giving the day a positive index instead let it escape into the
2520
+ // page and paint over a host site's header.
2521
+ cellBand: ['absolute inset-0 pointer-events-none',
2522
+ // The band fills the whole cell so adjacent bands touch, but at the two
2523
+ // ends of a range it must stop under the endpoint's circle rather than
2524
+ // running past it into empty grid. Clipping to half width leaves the
2525
+ // ribbon meeting the fill and going no further.
2526
+ 'data-[range-start=true]:start-1/2', 'data-[range-end=true]:end-1/2',
2527
+ // A single-day range is both ends at once: nothing to connect, so no
2528
+ // band at all.
2529
+ 'data-[range-start=true]:data-[range-end=true]:hidden',
2530
+ // The pending preview is the same ribbon, quieter -- it shows where the
2531
+ // range *would* land, not where it is.
2532
+ 'data-[preview=true]:opacity-60'],
2533
+ day: [...focusVisibleRing,
2534
+ // `relative` is the positioning context for the today dot. Deliberately
2535
+ // no z-index -- see `cellBand`.
2536
+ 'relative', 'inline-flex items-center justify-center', 'size-[calc(var(--calendar-cell-size)-0.25rem)]', 'rounded-[var(--calendar-cell-radius)]', 'text-body-sm text-neutral-strong', 'cursor-pointer select-none', 'transition-colors duration-200 motion-reduce:transition-none',
2537
+ // Selected days are excluded here and get their own hover per intent.
2538
+ // Without the exclusion this rule wins on specificity -- it carries an
2539
+ // extra `:hover` over the intent's plain `data-[selected=true]` -- so
2540
+ // hovering the selected day replaced its fill with a grey overlay and
2541
+ // made it look deselected.
2542
+ 'not-data-[disabled=true]:not-data-[selected=true]:hover:bg-surface-overlay-soft', 'data-[outside=true]:text-neutral-mild', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:text-neutral-mild', 'data-[unavailable=true]:line-through data-[unavailable=true]:cursor-not-allowed', 'data-[unavailable=true]:hover:bg-transparent'],
2543
+ // Wraps default *and* `<:day>` content, so a block that renders more than
2544
+ // a numeral -- a price, an event count -- stacks and centres without
2545
+ // having to rebuild this layout itself.
2546
+ dayContent: 'flex flex-col items-center justify-center leading-none overflow-hidden',
2547
+ // Sits below the grids, outside the column that sizes to them, so wide
2548
+ // content here wraps instead of stretching the header.
2549
+ footer: 'flex flex-wrap items-center gap-2 pt-1',
2550
+ // The today marker: a dot under the numeral rather than a ring, which
2551
+ // would compete with the selected fill.
2552
+ indicator: 'absolute bottom-1 size-1 rounded-full bg-current opacity-70',
2553
+ // The year panel stands in for the day grid rather than sitting above it,
2554
+ // so it is sized to the grid it replaces: seven cells wide, six tall. The
2555
+ // year list is long by design (a century back, for dates of birth), which
2556
+ // is exactly why it has to scroll inside that box instead of growing the
2557
+ // component to the height of its longest possible list.
2558
+ yearGrid: [
2559
+ // Positioned so the year buttons measure their `offsetTop` against the
2560
+ // panel: the component scrolls the selected year into view itself,
2561
+ // rather than letting `scrollIntoView` drag the whole page with it.
2562
+ 'relative grid grid-cols-3 gap-1', 'w-[calc(var(--calendar-cell-size)*7)]', 'max-h-[calc(var(--calendar-cell-size)*6)] overflow-y-auto', 'overscroll-contain'],
2563
+ yearCell: [...focusVisibleRing, 'rounded-full px-3 py-2 text-body-sm cursor-pointer', 'hover:bg-surface-overlay-soft', 'data-[selected=true]:bg-surface-overlay-soft data-[selected=true]:font-medium']
2564
+ },
2565
+ variants: {
2566
+ intent: {
2567
+ default: {
2568
+ day: 'data-[selected=true]:bg-neutral-strong data-[selected=true]:text-on-neutral-strong data-[selected=true]:hover:bg-neutral-bolder',
2569
+ cellBand: 'data-[in-range=true]:bg-neutral-soft'
2570
+ },
2571
+ primary: {
2572
+ day: 'data-[selected=true]:bg-primary data-[selected=true]:text-on-primary data-[selected=true]:hover:bg-primary-firm',
2573
+ cellBand: 'data-[in-range=true]:bg-primary-soft'
2574
+ },
2575
+ secondary: {
2576
+ day: 'data-[selected=true]:bg-secondary data-[selected=true]:text-on-secondary data-[selected=true]:hover:bg-secondary-firm',
2577
+ cellBand: 'data-[in-range=true]:bg-secondary-soft'
2578
+ },
2579
+ tertiary: {
2580
+ day: 'data-[selected=true]:bg-tertiary data-[selected=true]:text-on-tertiary data-[selected=true]:hover:bg-tertiary-firm',
2581
+ cellBand: 'data-[in-range=true]:bg-tertiary-soft'
2582
+ },
2583
+ success: {
2584
+ day: 'data-[selected=true]:bg-success data-[selected=true]:text-on-success data-[selected=true]:hover:bg-success-firm',
2585
+ cellBand: 'data-[in-range=true]:bg-success-soft'
2586
+ },
2587
+ warning: {
2588
+ day: 'data-[selected=true]:bg-warning data-[selected=true]:text-on-warning data-[selected=true]:hover:bg-warning-firm',
2589
+ cellBand: 'data-[in-range=true]:bg-warning-soft'
2590
+ },
2591
+ danger: {
2592
+ day: 'data-[selected=true]:bg-danger data-[selected=true]:text-on-danger data-[selected=true]:hover:bg-danger-firm',
2593
+ cellBand: 'data-[in-range=true]:bg-danger-soft'
2594
+ }
2595
+ },
2596
+ size: {
2597
+ sm: {
2598
+ base: 'p-2 [--calendar-cell-size:2.25rem]',
2599
+ title: 'text-label-2xs',
2600
+ navButton: 'size-7 [&_svg]:size-3.5'
2601
+ },
2602
+ md: {
2603
+ base: '[--calendar-cell-size:2.5rem]'
2604
+ },
2605
+ lg: {
2606
+ base: 'p-4 [--calendar-cell-size:3rem]',
2607
+ title: 'text-label-sm',
2608
+ navButton: 'size-9 [&_svg]:size-5'
2609
+ }
2610
+ },
2611
+ isDisabled: {
2612
+ true: {
2613
+ base: 'opacity-disabled pointer-events-none'
2614
+ }
2615
+ }
2616
+ },
2617
+ defaultVariants: {
2618
+ intent: 'primary',
2619
+ size: 'md'
2620
+ }
2621
+ });
2622
+
2623
+ /**
2624
+ * Prev/next/first/last share every class, but `tv` has no way for one slot to
2625
+ * inherit another, so the list is written once here and spread into both. It
2626
+ * is not folded into a single `control` slot because `classes.prev` and
2627
+ * `classes.next` are part of the component's public override surface.
2628
+ */
2629
+ const control = [...focusVisibleRing, 'inline-flex shrink-0 items-center justify-center gap-1', 'rounded-pill', 'cursor-pointer select-none whitespace-nowrap', 'text-neutral-firm', 'transition-colors duration-200', 'motion-reduce:transition-none', 'enabled:hover:bg-surface-overlay-soft enabled:hover:text-neutral-strong', 'disabled:cursor-not-allowed disabled:opacity-disabled'];
2630
+
2631
+ /**
2632
+ * The size-dependent half of the same story: `prev` and `next` are one
2633
+ * affordance at every size, so each size is written once here and spread into
2634
+ * both slots below. Written as whole literal class strings rather than
2635
+ * composed from parts -- Tailwind generates nothing from an interpolated
2636
+ * class, so the scanner has to see each one intact.
2637
+ */
2638
+ const controlSize = {
2639
+ sm: 'h-7 px-2 text-label-xs [&_svg]:size-3.5',
2640
+ md: 'h-9 px-3 text-label-sm [&_svg]:size-4',
2641
+ lg: 'h-11 px-4 text-label-md [&_svg]:size-5'
2642
+ };
2643
+ const pagination = tv({
2644
+ slots: {
2645
+ // The summary sits on the leading edge and the controls on the trailing
2646
+ // one, so the row justifies apart only when a summary is actually there;
2647
+ // with nothing to justify against, the controls centre instead. Keyed off
2648
+ // the summary element's own presence with `:has()` -- the same trick
2649
+ // `table.ts` uses -- so the layout follows the rendered structure rather
2650
+ // than a variant the component has to compute and thread through.
2651
+ base: ['flex w-full items-center gap-4', 'justify-center', '[&:has([data-pagination-summary])]:justify-between'],
2652
+ summary: 'text-neutral shrink-0',
2653
+ list: 'flex items-center',
2654
+ item: 'flex',
2655
+ // The resting chip is ghost, so a row of them reads as text with the
2656
+ // active one as the only ink. Hover is scoped to the inactive chips:
2657
+ // unscoped, it ties with the active fill on specificity and the winner is
2658
+ // left to Tailwind's variant ordering.
2659
+ page: [...focusVisibleRing, 'inline-flex shrink-0 items-center justify-center', 'rounded-pill', 'cursor-pointer select-none tabular-nums', 'text-neutral-firm', 'transition-colors duration-200', 'motion-reduce:transition-none', 'data-[active=false]:enabled:hover:bg-surface-overlay-soft', 'data-[active=false]:enabled:hover:text-neutral-strong', 'disabled:cursor-not-allowed disabled:opacity-disabled'],
2660
+ prev: control,
2661
+ next: control,
2662
+ // Not a button, so no focus ring and no hover: it is a gap marker, and
2663
+ // giving it an affordance would promise a destination it does not have.
2664
+ ellipsis: 'inline-flex shrink-0 items-center justify-center select-none text-neutral'
2665
+ },
2666
+ variants: {
2667
+ // `page` is sized square via `size-*` so a one-digit and a three-digit
2668
+ // chip are the same circle; `tabular-nums` above stops the digits jittering
2669
+ // as the number changes. The controls are pill-shaped rather than square
2670
+ // because they carry a word as well as a chevron.
2671
+ size: {
2672
+ sm: {
2673
+ summary: 'text-body-xs',
2674
+ list: 'gap-0.5',
2675
+ page: 'size-7 text-label-xs',
2676
+ prev: controlSize.sm,
2677
+ next: controlSize.sm,
2678
+ ellipsis: 'size-7 text-label-xs'
2679
+ },
2680
+ md: {
2681
+ summary: 'text-body-sm',
2682
+ list: 'gap-1',
2683
+ page: 'size-9 text-label-sm',
2684
+ prev: controlSize.md,
2685
+ next: controlSize.md,
2686
+ ellipsis: 'size-9 text-label-sm'
2687
+ },
2688
+ lg: {
2689
+ summary: 'text-body-md',
2690
+ list: 'gap-1.5',
2691
+ page: 'size-11 text-label-md',
2692
+ prev: controlSize.lg,
2693
+ next: controlSize.lg,
2694
+ ellipsis: 'size-11 text-label-md'
2695
+ }
2696
+ },
2697
+ // Fill and label travel together: the digit sits on the fill, so each
2698
+ // intent needs both or the active chip is unreadable.
2699
+ intent: {
2700
+ default: {
2701
+ page: 'data-[active=true]:bg-neutral-bolder data-[active=true]:text-on-neutral-bolder'
2702
+ },
2703
+ primary: {
2704
+ page: 'data-[active=true]:bg-primary data-[active=true]:text-on-primary'
2705
+ },
2706
+ secondary: {
2707
+ page: 'data-[active=true]:bg-secondary data-[active=true]:text-on-secondary'
2708
+ },
2709
+ tertiary: {
2710
+ page: 'data-[active=true]:bg-tertiary data-[active=true]:text-on-tertiary'
2711
+ },
2712
+ success: {
2713
+ page: 'data-[active=true]:bg-success data-[active=true]:text-on-success'
2714
+ },
2715
+ warning: {
2716
+ page: 'data-[active=true]:bg-warning data-[active=true]:text-on-warning'
2717
+ },
2718
+ danger: {
2719
+ page: 'data-[active=true]:bg-danger data-[active=true]:text-on-danger'
2720
+ }
2721
+ },
2722
+ // The buttons also carry a real `disabled` attribute, so this is purely
2723
+ // the group-level dimming; `pointer-events-none` covers a consumer's own
2724
+ // element supplied through the `item` block, which the component cannot
2725
+ // disable for them.
2726
+ isDisabled: {
2727
+ true: {
2728
+ base: 'opacity-disabled',
2729
+ list: 'pointer-events-none'
2730
+ }
2731
+ }
2732
+ },
2733
+ defaultVariants: {
2734
+ size: 'md',
2735
+ intent: 'default',
2736
+ isDisabled: false
2737
+ }
2738
+ });
2739
+
2740
+ const tooltip = tv({
2741
+ slots: {
2742
+ // Width is intrinsic so a short label hugs its text, with a cap so a long
2743
+ // one wraps instead of running off the viewport. `origin-*` is keyed off
2744
+ // the resolved placement the content carries as `data-placement`, so the
2745
+ // enter transition grows out of the anchor rather than out of nowhere.
2746
+ base: ['relative w-max max-w-xs rounded-lg shadow-md overflow-visible', 'data-[placement^=top]:origin-bottom', 'data-[placement^=bottom]:origin-top', 'data-[placement^=left]:origin-right', 'data-[placement^=right]:origin-left'],
2747
+ arrow: ''
2748
+ },
2749
+ variants: {
2750
+ size: {
2751
+ sm: {
2752
+ base: 'px-2 py-1 text-label-sm'
2753
+ },
2754
+ md: {
2755
+ base: 'px-2.5 py-1.5 text-label-sm'
2756
+ },
2757
+ lg: {
2758
+ base: 'px-3 py-2 text-label-md'
2759
+ }
2760
+ },
2761
+ // `bg-inherit` on the arrow (see `overlayArrow`) means each intent only
2762
+ // has to state the background once, on `base`. The border is stated on
2763
+ // both `base` and `arrow` for every intent so the two agree at the join:
2764
+ // `default` carries a visible `border-neutral-soft` on each (the arrow's
2765
+ // own shadow-less edge needs a level with more contrast than the body's
2766
+ // `shadow-md` gets away with), and every coloured intent clears both to
2767
+ // `border-transparent`. The body needs this explicitly, not just the
2768
+ // arrow: `Content`'s classNames (`popover.gts`) run this `base` class
2769
+ // through the *`popover`* tv, whose own base carries
2770
+ // `border border-neutral-subtle` (`popover.ts`) -- twMerge only drops
2771
+ // that when a later class from the same border-color group replaces it,
2772
+ // so a coloured intent with no border class of its own left that
2773
+ // neutral border showing on the body while the arrow (fixed here to
2774
+ // `border-transparent`) went invisible, a visible seam at the join.
2775
+ intent: {
2776
+ default: {
2777
+ base: 'bg-surface-input text-on-surface-input border border-neutral-soft',
2778
+ arrow: 'border-neutral-soft'
2779
+ },
2780
+ primary: {
2781
+ base: 'bg-primary text-on-primary border-transparent',
2782
+ arrow: 'border-transparent'
2783
+ },
2784
+ secondary: {
2785
+ base: 'bg-secondary text-on-secondary border-transparent',
2786
+ arrow: 'border-transparent'
2787
+ },
2788
+ tertiary: {
2789
+ base: 'bg-tertiary text-on-tertiary border-transparent',
2790
+ arrow: 'border-transparent'
2791
+ },
2792
+ success: {
2793
+ base: 'bg-success text-on-success border-transparent',
2794
+ arrow: 'border-transparent'
2795
+ },
2796
+ warning: {
2797
+ base: 'bg-warning text-on-warning border-transparent',
2798
+ arrow: 'border-transparent'
2799
+ },
2800
+ danger: {
2801
+ base: 'bg-danger text-on-danger border-transparent',
2802
+ arrow: 'border-transparent'
2803
+ }
2804
+ }
2805
+ },
2806
+ defaultVariants: {
2807
+ size: 'md',
2808
+ intent: 'default'
2809
+ }
2810
+ });
2811
+
2812
+ const notificationsContainer = tv({
2813
+ slots: {
2814
+ base: ['fixed z-1000 w-full max-w-lg px-4 py-4 pointer-events-none'],
2815
+ stack: ['relative w-full pointer-events-none', 'data-[expanded=true]:pointer-events-auto', 'transition-[height] duration-400 ease-[cubic-bezier(0.21,1.02,0.73,1)]', 'motion-reduce:transition-none']
2816
+ },
2817
+ variants: {
2818
+ placement: {
2819
+ 'top-left': {
2820
+ base: 'top-0 left-0'
2821
+ },
2822
+ 'top-center': {
2823
+ base: 'top-0 left-2/4 translate-x-[-50%]'
2824
+ },
2825
+ 'top-right': {
2826
+ base: 'top-0 right-0'
2827
+ },
2828
+ 'bottom-left': {
2829
+ base: 'bottom-0 left-0'
2830
+ },
2831
+ 'bottom-center': {
2832
+ base: 'bottom-0 left-2/4 translate-x-[-50%]'
2833
+ },
2834
+ 'bottom-right': {
2835
+ base: 'bottom-0 right-0'
2836
+ }
2837
+ }
2838
+ },
2839
+ defaultVariants: {
2840
+ placement: 'bottom-right'
2841
+ }
2842
+ });
2843
+
2844
+ const notificationCard = tv({
2845
+ slots: {
2846
+ // The outer element. It carries the box treatment (surface color,
2847
+ // border, rounded corners, shadow) and everything the stack's geometry
2848
+ // animates (`transform`, `opacity`, and — while collapsed — a clamped
2849
+ // `height` so a taller card behind the front one can't poke out past
2850
+ // it). `overflow-hidden` here is what makes that clamp actually crop
2851
+ // the content instead of just failing to contain it.
2852
+ //
2853
+ // Deliberately NOT a flex container and NOT where padding/gap live:
2854
+ // the `ResizeObserver` in notification-card.gts measures `inner`, not
2855
+ // `base`, specifically so the reported height is always the content's
2856
+ // true natural height, never the clamped one `base` might be wearing
2857
+ // at the time. Move layout classes here and that guarantee breaks.
2858
+ base: ['pointer-events-auto w-full', 'rounded-2xl border shadow-lg', 'overflow-hidden', 'transition-[transform,opacity,height] ease-[cubic-bezier(0.21,1.02,0.73,1)]',
2859
+ // The three `transition-duration` values line up positionally with
2860
+ // `transition-[transform,opacity,height]` above: transform and height
2861
+ // are the stack's own expand/collapse choreography, fixed at 400ms to
2862
+ // match the container's own height transition (see
2863
+ // notifications-container.gts) and the design spec's "transform
2864
+ // 400ms"; the middle value is the one `@transitionDuration` actually
2865
+ // governs (the enter/exit fade), supplied via the
2866
+ // `--frontile-toast-fade` custom property the card sets inline (see
2867
+ // notification-card.gts's `style` getter). Both the property order
2868
+ // and the duration ownership live here in one place so they can never
2869
+ // drift apart across the component boundary.
2870
+ '[transition-duration:400ms,_var(--frontile-toast-fade,_200ms),_400ms]', 'motion-reduce:transition-[opacity] motion-reduce:duration-150',
2871
+ // Dropping the transition above only makes the transform apply
2872
+ // instantly instead of animating it — the transform itself (the
2873
+ // stack's slide/scale choreography) still comes from notification-card.gts's
2874
+ // `style` getter as an *inline* `transform:` declaration, so it would
2875
+ // still be present, just un-animated. An inline style normally wins
2876
+ // over any stylesheet rule regardless of that rule's specificity, but
2877
+ // `!important` is the one thing that overrides it — Tailwind v4 marks
2878
+ // a utility `!important` with a trailing `!`, which is exactly what's
2879
+ // needed here. This neutralizes every transform (enter/exit slide,
2880
+ // and the stack's hover-expand translate/scale) under
2881
+ // `prefers-reduced-motion`, matching the spec's "drops all
2882
+ // transforms", entirely in CSS with no JS branching required.
2883
+ 'motion-reduce:transform-none!'],
2884
+ // The inner element. Holds the actual row layout (icon, content,
2885
+ // actions, close button) and is never height-constrained, so its
2886
+ // `offsetHeight` is always the card's true natural height — that's
2887
+ // the value the measure modifier reads and reports to the stack.
2888
+ inner: 'flex gap-3 p-4 font-body text-body-2xs',
2889
+ icon: 'shrink-0 size-5',
2890
+ // The loading spinner's own slot, distinct from `icon`. It must NOT
2891
+ // reuse `icon` — `icon`'s intent-coloured `text-*` class (the compound
2892
+ // variants below) would win the Tailwind-merge over the Spinner's own
2893
+ // dim `text-neutral-muted` track, making the arc and track nearly
2894
+ // identical and the spin unreadable. `size-5` matches `icon` exactly so
2895
+ // a promise settling (spinner -> icon) never resizes the card. The arc
2896
+ // colour comes from `@intent` passed to <Spinner>, not from this slot;
2897
+ // this slot only ever supplies sizing/position and, where needed
2898
+ // (solid variant below), an explicit track/arc override.
2899
+ spinner: 'shrink-0 size-5',
2900
+ content: 'grow min-w-0 flex flex-col gap-1',
2901
+ title: 'font-label text-label-xs',
2902
+ description: 'text-body-2xs',
2903
+ customActions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
2904
+ customActionButton: '',
2905
+ closeButton: statusRowCloseButton
2906
+ },
2907
+ variants: {
2908
+ intent: {
2909
+ default: {},
2910
+ info: {},
2911
+ success: {},
2912
+ warning: {},
2913
+ danger: {}
2914
+ },
2915
+ variant: {
2916
+ // `text-neutral` (the DEFAULT level) is only ~3:1 against a light
2917
+ // surface — below the 4.5:1 WCAG AA floor these labels need at this
2918
+ // size. `text-neutral-firm` clears it comfortably against every
2919
+ // surface this description can sit on, light or dark, tonal or not.
2920
+ // See packages/frontile/docs/notifications-usage.md's contrast note for the measured ratios.
2921
+ default: {
2922
+ base: 'bg-surface-modal border-surface-overlay-mild',
2923
+ description: 'text-neutral-firm'
2924
+ },
2925
+ // The outer surface/border is intent-independent — every `tonal`
2926
+ // compound variant below borrows the same neutral surface `default`
2927
+ // uses (see the comment above the `tonal` compound variants), so it
2928
+ // lives here once instead of repeating in each of them.
2929
+ tonal: {
2930
+ base: 'bg-surface-modal border-surface-overlay-mild',
2931
+ description: 'text-neutral-firm'
2932
+ },
2933
+ solid: {
2934
+ base: 'border-transparent'
2935
+ }
2936
+ },
2937
+ // With a description, the icon centres on the *title's* line box rather
2938
+ // than the whole (now two-line) card — hence the negative offset.
2939
+ hasDescription: {
2940
+ true: {
2941
+ inner: 'items-start',
2942
+ icon: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]',
2943
+ spinner: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]'
2944
+ },
2945
+ false: {
2946
+ inner: 'items-center'
2947
+ }
2948
+ },
2949
+ // Cards are pinned to the placement edge so the stack grows away from
2950
+ // it, once the container has supplied stack geometry (`@geometry` on
2951
+ // <NotificationCard>). `none` is the default — a card rendered without
2952
+ // geometry (e.g. a standalone demo) keeps its normal document flow.
2953
+ // The dynamic parts of the stack's positioning (transform, opacity,
2954
+ // height, z-index, transform-origin) still come from the card's own
2955
+ // inline `style` getter, since they change per-frame with the stack's
2956
+ // geometry — only the static edge-pinning lives here.
2957
+ stackPlacement: {
2958
+ top: {
2959
+ base: 'absolute inset-x-0 top-0'
2960
+ },
2961
+ bottom: {
2962
+ base: 'absolute inset-x-0 bottom-0'
2963
+ },
2964
+ none: {}
2965
+ }
2966
+ },
2967
+ compoundVariants: [
2968
+ // default: neutral surface, colour carried by the icon and title.
2969
+ // `default` intent has no accent — icon and title stay neutral, same
2970
+ // `firm` level the other intents use for their accent text.
2971
+ {
2972
+ variant: 'default',
2973
+ intent: 'default',
2974
+ class: {
2975
+ icon: 'text-neutral-firm',
2976
+ title: 'text-neutral-firm'
2977
+ }
2978
+ }, {
2979
+ variant: 'default',
2980
+ intent: 'info',
2981
+ class: {
2982
+ icon: 'text-primary',
2983
+ title: 'text-primary'
2984
+ }
2985
+ }, {
2986
+ // `success-firm` is only ~2.3:1 on the white card surface in light
2987
+ // mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
2988
+ // contrast note.
2989
+ variant: 'default',
2990
+ intent: 'success',
2991
+ class: {
2992
+ icon: 'text-success-bolder',
2993
+ title: 'text-success-bolder'
2994
+ }
2995
+ }, {
2996
+ // `warning-firm` is only ~3:1 on the white card surface in light
2997
+ // mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
2998
+ // contrast note.
2999
+ variant: 'default',
3000
+ intent: 'warning',
3001
+ class: {
3002
+ icon: 'text-warning-bolder',
3003
+ title: 'text-warning-bolder'
3004
+ }
3005
+ }, {
3006
+ variant: 'default',
3007
+ intent: 'danger',
3008
+ class: {
3009
+ icon: 'text-danger-firm',
3010
+ title: 'text-danger-firm'
3011
+ }
3012
+ },
3013
+ // tonal: same recipe as Button's `appearance: 'tonal'` — an opaque
3014
+ // outer surface (so the floating card never lets page content show
3015
+ // through) with the translucent `{intent}-soft` tint and its `on-*`
3016
+ // contrast ink applied to the *inner* element, which composites over
3017
+ // that opaque surface. The outer picks up the `default` variant's
3018
+ // neutral surface/border instead of a colour-matched one: Button's
3019
+ // tonal has no border at all, but a card floating over arbitrary page
3020
+ // content benefits from the same edge definition `default` already
3021
+ // uses, so it borrows that treatment rather than inventing a new one.
3022
+ {
3023
+ variant: 'tonal',
3024
+ intent: 'default',
3025
+ class: {
3026
+ inner: 'bg-neutral-soft',
3027
+ icon: 'text-on-neutral-soft',
3028
+ title: 'text-on-neutral-soft'
3029
+ }
3030
+ }, {
3031
+ variant: 'tonal',
3032
+ intent: 'info',
3033
+ class: {
3034
+ inner: 'bg-primary-soft',
3035
+ icon: 'text-on-primary-soft',
3036
+ title: 'text-on-primary-soft'
3037
+ }
3038
+ }, {
3039
+ variant: 'tonal',
3040
+ intent: 'success',
3041
+ class: {
3042
+ inner: 'bg-success-soft',
3043
+ icon: 'text-on-success-soft',
3044
+ title: 'text-on-success-soft'
3045
+ }
3046
+ }, {
3047
+ variant: 'tonal',
3048
+ intent: 'warning',
3049
+ class: {
3050
+ inner: 'bg-warning-soft',
3051
+ icon: 'text-on-warning-soft',
3052
+ title: 'text-on-warning-soft'
3053
+ }
3054
+ }, {
3055
+ variant: 'tonal',
3056
+ intent: 'danger',
3057
+ class: {
3058
+ inner: 'bg-danger-soft',
3059
+ icon: 'text-on-danger-soft',
3060
+ title: 'text-on-danger-soft'
3061
+ }
3062
+ },
3063
+ // solid: filled surface, contrast text. `description` uses the
3064
+ // full-strength `on-{intent}` ink rather than a translucent cut — see
3065
+ // packages/frontile/docs/notifications-usage.md's contrast note for why
3066
+ // (a translucent cut used to fail WCAG AA here).
3067
+ //
3068
+ // The spinner override matters because `@intent` on <Spinner> drives its
3069
+ // arc via `fill-{intent}`, the exact same color as this variant's own
3070
+ // `bg-{intent}` surface — left alone the arc would be camouflaged
3071
+ // against its own card, so `solid` forces both halves of the spinner to
3072
+ // the contrast ink instead.
3073
+ {
3074
+ variant: 'solid',
3075
+ intent: 'default',
3076
+ class: {
3077
+ base: 'bg-neutral text-on-neutral',
3078
+ icon: 'text-on-neutral',
3079
+ title: 'text-on-neutral',
3080
+ description: 'text-on-neutral',
3081
+ spinner: 'fill-on-neutral text-on-neutral/30'
3082
+ }
3083
+ }, {
3084
+ variant: 'solid',
3085
+ intent: 'info',
3086
+ class: {
3087
+ base: 'bg-primary text-on-primary',
3088
+ icon: 'text-on-primary',
3089
+ title: 'text-on-primary',
3090
+ description: 'text-on-primary',
3091
+ spinner: 'fill-on-primary text-on-primary/30'
3092
+ }
3093
+ }, {
3094
+ variant: 'solid',
3095
+ intent: 'success',
3096
+ class: {
3097
+ base: 'bg-success text-on-success',
3098
+ icon: 'text-on-success',
3099
+ title: 'text-on-success',
3100
+ description: 'text-on-success',
3101
+ spinner: 'fill-on-success text-on-success/30'
3102
+ }
3103
+ }, {
3104
+ variant: 'solid',
3105
+ intent: 'warning',
3106
+ class: {
3107
+ base: 'bg-warning text-on-warning',
3108
+ icon: 'text-on-warning',
3109
+ title: 'text-on-warning',
3110
+ description: 'text-on-warning',
3111
+ spinner: 'fill-on-warning text-on-warning/30'
3112
+ }
3113
+ }, {
3114
+ variant: 'solid',
3115
+ intent: 'danger',
3116
+ class: {
3117
+ base: 'bg-danger text-on-danger',
3118
+ icon: 'text-on-danger',
3119
+ title: 'text-on-danger',
3120
+ description: 'text-on-danger',
3121
+ spinner: 'fill-on-danger text-on-danger/30'
3122
+ }
3123
+ }],
3124
+ defaultVariants: {
3125
+ intent: 'default',
3126
+ variant: 'default',
3127
+ hasDescription: false,
3128
+ stackPlacement: 'none'
3129
+ }
3130
+ });
3131
+
3132
+ const label = tv({
3133
+ slots: {
3134
+ // label text role (Open Sans semibold, tight leading)
3135
+ base: 'text-neutral-bolder inline-block font-label text-label-sm pb-2',
3136
+ asterisk: 'text-danger'
3137
+ },
3138
+ variants: {
3139
+ size: {
3140
+ sm: {
3141
+ base: 'text-label-2xs'
3142
+ },
3143
+ md: {},
3144
+ lg: {
3145
+ base: 'text-label-md'
3146
+ }
3147
+ }
3148
+ },
3149
+ defaultVariants: {
3150
+ size: 'md'
3151
+ }
3152
+ });
3153
+ const formDescription = tv({
3154
+ // help/description text — body role
3155
+ base: 'text-neutral font-body text-body-2xs pb-1 last:pb-0',
3156
+ variants: {
3157
+ size: {
3158
+ sm: 'text-body-2xs',
3159
+ md: '',
3160
+ lg: 'text-body-sm'
3161
+ }
3162
+ },
3163
+ defaultVariants: {
3164
+ size: 'md'
3165
+ }
3166
+ });
3167
+ const formFeedback = tv({
3168
+ // validation/feedback text — body role
3169
+ base: 'font-body text-body-2xs pt-1',
3170
+ variants: {
3171
+ intent: {
3172
+ primary: 'text-primary',
3173
+ secondary: 'text-secondary',
3174
+ tertiary: 'text-tertiary',
3175
+ success: 'text-success',
3176
+ danger: 'text-danger',
3177
+ warning: 'text-warning'
3178
+ },
3179
+ size: {
3180
+ sm: 'text-body-2xs',
3181
+ md: '',
3182
+ lg: 'text-body-sm'
3183
+ }
3184
+ },
3185
+ defaultVariants: {
3186
+ size: 'sm'
3187
+ }
3188
+ });
3189
+
3190
+ // The visual shell of a form field: background, border, radius, and the
3191
+ // invalid/disabled treatments. Shared by the `input` slot and by `select`'s
3192
+ // `chipsField`, which becomes the shell when chips render beside the trigger.
3193
+ const fieldShell = ['bg-surface-input', 'border', 'border-neutral-soft', 'rounded-xl', 'selection:bg-surface-overlay-soft'];
3194
+ const input = tv({
3195
+ slots: {
3196
+ base: '',
3197
+ innerContainer: 'relative flex',
3198
+ startContent: 'absolute inset-y-0 left-0 flex items-center',
3199
+ endContent: 'absolute inset-y-0 right-0 flex items-center',
3200
+ input: ['appearance-none', 'flex-1', 'w-full', ...fieldShell, 'text-neutral-strong', 'placeholder-neutral',
3201
+ // body role family; single-line controls keep tight leading (not the body relaxed leading)
3202
+ 'font-body text-base text-left', 'leading-tight', 'focus:ring-3', 'focus:ring-focus', 'focus:outline-hidden', 'focus:border-primary-soft', 'disabled:border-neutral-subtle disabled:text-neutral-soft', 'aria-invalid:border-danger-soft', 'aria-invalid:focus:ring-danger-soft']
3203
+ },
3204
+ variants: {
3205
+ size: {
3206
+ sm: {
3207
+ input: 'p-2',
3208
+ startContent: 'pl-2',
3209
+ endContent: 'pr-2'
3210
+ },
3211
+ md: {
3212
+ input: 'p-3',
3213
+ startContent: 'pl-3',
3214
+ endContent: 'pr-3'
3215
+ },
3216
+ lg: {
3217
+ input: 'p-4',
3218
+ startContent: 'pl-4',
3219
+ endContent: 'pr-4'
3220
+ }
3221
+ },
3222
+ hasStartContent: {
3223
+ true: {
3224
+ input: 'ps-8'
3225
+ }
3226
+ },
3227
+ hasEndContent: {
3228
+ true: {
3229
+ input: 'pe-10'
3230
+ }
3231
+ },
3232
+ // When chips render beside the trigger, `chipsField` owns the field shell
3233
+ // and the trigger itself must be visually bare.
3234
+ hasChips: {
3235
+ true: {
3236
+ input: ['border-0', 'bg-transparent', 'p-0', 'w-auto', 'flex-1',
3237
+ // Once chips show the selection the trigger renders nothing at all, so
3238
+ // it has no content to give it a height -- it collapsed to a 0px box
3239
+ // that could not be clicked. Stretching makes it as tall as the chips
3240
+ // sitting next to it, which is the box a pointer needs to hit.
3241
+ 'self-stretch',
3242
+ // No horizontal floor by default: a bare (non-filterable) trigger has
3243
+ // no content of its own, so a floor would only push it onto a second
3244
+ // flex line. `select` puts the floor back for the filterable trigger,
3245
+ // which does need room to type.
3246
+ 'min-w-0', 'focus:ring-0', 'focus:border-transparent']
3247
+ }
3248
+ },
3249
+ startContentPointerEvents: {
3250
+ auto: {
3251
+ startContent: 'pointer-events-auto'
3252
+ },
3253
+ none: {
3254
+ startContent: 'pointer-events-none'
3255
+ }
3256
+ },
3257
+ endContentPointerEvents: {
3258
+ auto: {
3259
+ endContent: 'pointer-events-auto'
3260
+ },
3261
+ none: {
3262
+ endContent: 'pointer-events-none'
3263
+ }
3264
+ }
3265
+ },
3266
+ defaultVariants: {
3267
+ size: 'md'
3268
+ }
3269
+ });
3270
+ const textarea = tv({
3271
+ extend: input,
3272
+ slots: {
3273
+ input: 'min-h-24'
3274
+ },
3275
+ variants: {
3276
+ size: {
3277
+ sm: {},
3278
+ md: {},
3279
+ lg: {}
3280
+ }
3281
+ }
3282
+ });
3283
+
3284
+ // A one-time-code field is one real <input> laid transparently over inert
3285
+ // cells. The input must stay fully opaque -- iOS refuses the long-press Paste
3286
+ // menu on an opacity:0 input -- so every colour is made transparent instead.
3287
+ const inputOtp = tv({
3288
+ slots: {
3289
+ base: '',
3290
+ // pointer-events are inverted: the container ignores the pointer so that a
3291
+ // click anywhere in the widget lands on the input below and resolves to the
3292
+ // nearest character position.
3293
+ container: 'relative flex items-center w-fit pointer-events-none',
3294
+ group: 'flex items-center',
3295
+ cell: [...fieldShell, 'relative flex items-center justify-center', 'font-body tabular-nums text-neutral-strong', 'transition-colors'],
3296
+ cellChar: 'select-none',
3297
+ caret: 'absolute w-px bg-neutral-strong animate-caret-blink motion-reduce:animate-none',
3298
+ separator: 'select-none text-neutral-soft',
3299
+ input: ['absolute inset-y-0 left-0 h-full', 'pointer-events-auto', 'text-left',
3300
+ // Mandatory: opaque element, transparent paint.
3301
+ 'opacity-100', 'text-transparent caret-transparent bg-transparent',
3302
+ // Both halves -- setting only the background leaves the text drawn in the
3303
+ // highlight's foreground colour.
3304
+ 'selection:bg-transparent selection:text-transparent', 'appearance-none border-0 outline-0 shadow-none', 'focus:outline-hidden focus:ring-0',
3305
+ // >= 16px or iOS Safari zooms the page on focus. The negative tracking
3306
+ // collapses the invisible glyphs so they cannot spill past the cells.
3307
+ 'text-base leading-none font-mono tabular-nums tracking-[-0.5em]',
3308
+ // Chromium paints an autofilled field yellow, and the :autofill state
3309
+ // outlives the fill. -webkit-text-fill-color is the property that
3310
+ // actually controls text colour in that state.
3311
+ 'autofill:bg-transparent autofill:shadow-none', 'autofill:[-webkit-text-fill-color:transparent]',
3312
+ // iOS paints selection in a native layer that ignores ::selection, so the
3313
+ // text metrics are compressed further to shrink what it can paint.
3314
+ 'supports-[-webkit-touch-callout:none]:tracking-[-0.6em]', 'supports-[-webkit-touch-callout:none]:font-thin',
3315
+ // Password managers anchor their badge to the INPUT's box, not the
3316
+ // container's, so it would land on the last cell. Reserve a 40px gutter
3317
+ // and clip it back: absolutely positioned, so no layout shift, and
3318
+ // clip-path clips hit-testing too.
3319
+ 'w-[calc(100%+40px)] [clip-path:inset(0_40px_0_0)]',
3320
+ // Keep an injected badge clickable inside the pointer-events-none container.
3321
+ '[&+*]:pointer-events-auto']
3322
+ },
3323
+ variants: {
3324
+ size: {
3325
+ sm: {
3326
+ cell: 'size-9 rounded-lg text-sm',
3327
+ group: 'gap-1.5',
3328
+ separator: 'px-1 text-sm',
3329
+ caret: 'h-4'
3330
+ },
3331
+ md: {
3332
+ cell: 'size-12 text-base',
3333
+ group: 'gap-2',
3334
+ separator: 'px-1.5 text-base',
3335
+ caret: 'h-5'
3336
+ },
3337
+ lg: {
3338
+ cell: 'size-14 text-lg',
3339
+ group: 'gap-2.5',
3340
+ separator: 'px-2 text-lg',
3341
+ caret: 'h-6'
3342
+ }
3343
+ },
3344
+ // z-10 keeps the active cell's ring from being clipped by its neighbour.
3345
+ isActive: {
3346
+ true: {
3347
+ cell: 'z-10 border-primary-soft ring-3 ring-focus'
3348
+ }
3349
+ },
3350
+ // Mirrors `input`'s `aria-invalid:focus:ring-danger-soft`: a focused invalid
3351
+ // cell must ring red, not keep the neutral focus ring.
3352
+ isInvalid: {
3353
+ true: {
3354
+ cell: 'border-danger-soft ring-danger-soft'
3355
+ }
3356
+ },
3357
+ isDisabled: {
3358
+ true: {
3359
+ cell: 'border-neutral-subtle text-neutral-soft'
3360
+ }
3361
+ }
3362
+ },
3363
+ defaultVariants: {
3364
+ size: 'md'
3365
+ }
3366
+ });
3367
+ const checkboxRadioBase = tv({
3368
+ slots: {
3369
+ base: ['max-w-fit flex items-center justify-start'],
3370
+ input: ['appearance-none', 'inline-block', 'align-middle', 'select-none', 'shrink-0', 'text-base', 'border-2 border-neutral', 'bg-surface-input', 'transition-colors', 'checked:bg-origin-border checked:bg-center checked:bg-no-repeat', 'checked:disabled:bg-neutral-soft checked:disabled:border-neutral-soft', ...focusVisibleRing],
3371
+ labelContainer: ['flex flex-col ml-2'],
3372
+ label: 'font-body text-body-xs pb-0'
3373
+ },
3374
+ variants: {
3375
+ size: {
3376
+ sm: {
3377
+ input: 'h-4 w-4'
3378
+ },
3379
+ md: {
3380
+ input: 'h-5 w-5'
3381
+ },
3382
+ lg: {
3383
+ input: 'h-6 w-6'
3384
+ }
3385
+ }
3386
+ },
3387
+ defaultVariants: {
3388
+ size: 'md'
3389
+ }
3390
+ });
3391
+ const checkboxRadioGroupBase = tv({
3392
+ slots: {
3393
+ base: '',
3394
+ optionsContainer: ['flex flex-col flex-wrap gap-4 data-[orientation=horizontal]:flex-row'],
3395
+ label: 'pb-2'
3396
+ },
3397
+ variants: {
3398
+ size: {
3399
+ sm: '',
3400
+ md: '',
3401
+ lg: ''
3402
+ }
3403
+ }
3404
+ });
3405
+ const checkbox = tv({
3406
+ extend: checkboxRadioBase,
3407
+ slots: {
3408
+ input: ['checked-bg-checkbox', 'indeterminate-bg-checkbox', 'rounded-sm', 'checked:bg-primary checked:border-primary',
3409
+ // Indeterminate state styles - show minus/dash icon
3410
+ 'indeterminate:bg-primary', 'indeterminate:border-primary', 'indeterminate:bg-origin-border', 'indeterminate:bg-center', 'indeterminate:bg-no-repeat']
3411
+ },
3412
+ variants: {
3413
+ size: {
3414
+ sm: {},
3415
+ md: {},
3416
+ lg: {}
3417
+ }
3418
+ },
3419
+ defaultVariants: {
3420
+ size: 'md'
3421
+ }
3422
+ });
3423
+ const radio = tv({
3424
+ extend: checkboxRadioBase,
3425
+ slots: {
3426
+ input: ['checked-bg-radio', 'rounded-full', 'checked:bg-primary checked:border-primary']
3427
+ },
3428
+ variants: {
3429
+ size: {
3430
+ sm: {},
3431
+ md: {},
3432
+ lg: {}
3433
+ }
3434
+ },
3435
+ defaultVariants: {
3436
+ size: 'md'
3437
+ }
3438
+ });
3439
+ const radioGroup = tv({
3440
+ extend: checkboxRadioGroupBase
3441
+ });
3442
+ const checkboxGroup = tv({
3443
+ extend: checkboxRadioGroupBase
3444
+ });
3445
+ const select = tv({
3446
+ extend: input,
3447
+ slots: {
3448
+ base: [],
3449
+ placeholder: 'text-neutral',
3450
+ listbox: 'scroll-py-6 max-h-64',
3451
+ icon: 'w-5 h-5',
3452
+ clearButton: 'pointer-events-auto',
3453
+ input: '[button]:cursor-default',
3454
+ emptyContent: 'p-2',
3455
+ // The wrapper around the trigger. It is rendered in every mode; the
3456
+ // `hasChips` variant below decides whether it is the field shell or a
3457
+ // transparent passthrough. Authored here rather than as literal classes in
3458
+ // the component template because Tailwind does not scan
3459
+ // `packages/frontile/src`.
3460
+ chipsField: '',
3461
+ chipsContainer: 'flex flex-wrap items-center gap-1 min-w-0',
3462
+ chip: ''
3463
+ },
3464
+ variants: {
3465
+ size: {
3466
+ sm: {},
3467
+ md: {},
3468
+ lg: {}
3469
+ },
3470
+ // When chips render, `chipsField` becomes the field shell in place of the
3471
+ // trigger's own border (see the `hasChips` variant on `input`), and owns the
3472
+ // padding. Otherwise it is a transparent, full-width flex passthrough: the
3473
+ // shell stays on the trigger, but the wrapper is still a real box, so it can
3474
+ // be measured as the popover's width reference in both modes.
3475
+ //
3476
+ // `data-invalid` / `data-disabled` are set by the component because
3477
+ // `aria-invalid:` and `disabled:` only match the element carrying them.
3478
+ hasChips: {
3479
+ true: {
3480
+ chipsField: [...fieldShell, 'flex', 'flex-wrap', 'items-center', 'gap-1', 'w-full', 'cursor-default', 'focus-within:ring-3', 'focus-within:ring-focus', 'focus-within:border-primary-soft', 'data-[invalid=true]:border-danger-soft', 'data-[invalid=true]:focus-within:ring-danger-soft', 'data-[disabled=true]:border-neutral-subtle', 'data-[disabled=true]:text-neutral-soft']
3481
+ },
3482
+ false: {
3483
+ chipsField: 'flex w-full min-w-0'
3484
+ }
3485
+ },
3486
+ // Whether the trigger is a filterable text input rather than a bare button.
3487
+ // Only affects how much horizontal room the trigger reserves in chips mode.
3488
+ isFilterable: {
3489
+ true: {},
3490
+ false: {}
3491
+ }
3492
+ },
3493
+ compoundVariants: [
3494
+ // Padding belongs to whichever element is the field shell, so it is applied
3495
+ // to `chipsField` only in chips mode -- in passthrough mode the wrapper has
3496
+ // to add no geometry of its own.
3497
+ // The `min-h-*` values are the height of the same-size text field
3498
+ // (padding + line box + border), so a chips field is exactly as tall as a
3499
+ // single-select one, does not change height as the first chip arrives, and
3500
+ // absorbs the flex gap when the trigger wraps below the chips.
3501
+ // No gap between the chips and the trigger: the chips carry their own gap,
3502
+ // and a gap here is space the trigger has to fit into before it is allowed
3503
+ // to stay on the chips' line. With `gap-0` a trigger that does have to wrap
3504
+ // (the chips already fill the row) costs no vertical space at all.
3505
+ {
3506
+ hasChips: true,
3507
+ size: 'sm',
3508
+ class: {
3509
+ chipsField: 'p-1 gap-0 min-h-9.5'
3510
+ }
3511
+ }, {
3512
+ hasChips: true,
3513
+ size: 'md',
3514
+ class: {
3515
+ chipsField: 'p-1.5 gap-0 min-h-11.5'
3516
+ }
3517
+ }, {
3518
+ hasChips: true,
3519
+ size: 'lg',
3520
+ class: {
3521
+ chipsField: 'p-2 gap-0 min-h-13.5'
3522
+ }
3523
+ },
3524
+ // Chips have to clear the absolutely-positioned start/end content the same
3525
+ // way a bare `input` does, otherwise they run underneath the chevron and the
3526
+ // clear button.
3527
+ {
3528
+ hasChips: true,
3529
+ hasStartContent: true,
3530
+ class: {
3531
+ chipsField: 'ps-8'
3532
+ }
3533
+ }, {
3534
+ hasChips: true,
3535
+ hasEndContent: true,
3536
+ class: {
3537
+ chipsField: 'pe-10'
3538
+ }
3539
+ },
3540
+ // ...and once `chipsField` reserves that room, the bare trigger inside it
3541
+ // must not reserve it a second time.
3542
+ {
3543
+ hasChips: true,
3544
+ hasStartContent: true,
3545
+ class: {
3546
+ input: 'ps-0'
3547
+ }
3548
+ }, {
3549
+ hasChips: true,
3550
+ hasEndContent: true,
3551
+ class: {
3552
+ input: 'pe-0'
3553
+ }
3554
+ },
3555
+ // Only the filterable trigger needs typing room -- and, since the field
3556
+ // itself no longer sets a gap, its own separation from the last chip.
3557
+ // See `min-w-0` and `gap-0` above.
3558
+ {
3559
+ hasChips: true,
3560
+ isFilterable: true,
3561
+ class: {
3562
+ input: 'min-w-16 ms-1'
3563
+ }
3564
+ }],
3565
+ defaultVariants: {
3566
+ size: 'md'
3567
+ }
3568
+ });
3569
+
3570
+ // Note: extends `input` rather than `select` because tailwind-variants
3571
+ // loses inherited slot types across two levels of `extend`.
3572
+ const autocomplete = tv({
3573
+ extend: input,
3574
+ slots: {
3575
+ base: [],
3576
+ listbox: 'scroll-py-6 max-h-64',
3577
+ icon: 'w-5 h-5',
3578
+ clearButton: 'pointer-events-auto',
3579
+ input: 'cursor-text',
3580
+ emptyContent: 'p-2'
3581
+ },
3582
+ variants: {
3583
+ size: {
3584
+ sm: {},
3585
+ md: {},
3586
+ lg: {}
3587
+ }
3588
+ },
3589
+ defaultVariants: {
3590
+ size: 'md'
3591
+ }
3592
+ });
3593
+ const nativeSelect = tv({
3594
+ extend: input,
3595
+ slots: {
3596
+ input: ['appearance-none'],
3597
+ icon: 'w-5 h-5'
3598
+ },
3599
+ variants: {
3600
+ size: {
3601
+ sm: {},
3602
+ md: {},
3603
+ lg: {}
3604
+ }
3605
+ }
3606
+ });
3607
+ const switchInput = tv({
3608
+ slots: {
3609
+ base: 'group relative max-w-fit inline-flex items-center justify-start',
3610
+ labelContainer: 'flex flex-col ml-2',
3611
+ label: 'font-body text-body-xs pb-0',
3612
+ wrapper: ['px-1', 'relative', 'inline-flex', 'items-center', 'justify-start', 'shrink-0', 'overflow-hidden', 'bg-neutral-soft', 'rounded-full', 'cursor-pointer touch-none tap-highlight-transparent select-none',
3613
+ // `transition-background` is not a Tailwind v4 utility -- it compiled to
3614
+ // nothing. The wrapper's fill is swapped by `group-data-[selected]:bg-*`,
3615
+ // so background-color is what needs to ease.
3616
+ 'transition-colors', ...focusVisibleWithinRing],
3617
+ hiddenInput: ['font-inherit', 'text-[100%]', 'leading-[1.15]', 'm-0', 'p-0', 'overflow-visible', 'box-border', 'absolute', 'top-0', 'w-full', 'h-full', 'opacity-[0.0001]', 'z-1', 'cursor-pointer', 'disabled:cursor-default'],
3618
+ thumb: ['z-10', 'flex', 'items-center', 'justify-center', 'bg-white', 'shadow-small', 'rounded-full', 'origin-right', 'transition-all', 'pointer-events-none', 'text-black'],
3619
+ startContent: ['z-0 absolute start-1.5 text-current', 'opacity-0', 'scale-50',
3620
+ // Tailwind v4 compiles `scale-*` to the standalone `scale` property, not
3621
+ // to `transform`; `transform` stays listed for consumers who override
3622
+ // @classes.startContent and position with it.
3623
+ 'transition-[transform,scale,opacity]', 'group-data-[selected=true]:scale-100', 'group-data-[selected=true]:opacity-100'],
3624
+ endContent: ['z-0 absolute end-1.5 text-neutral', 'opacity-100',
3625
+ // Likewise `translate-x-*` compiles to the standalone `translate`
3626
+ // property -- without it listed, this content snapped instead of sliding.
3627
+ 'transition-[transform,translate,opacity]', 'group-data-[selected=true]:translate-x-3', 'group-data-[selected=true]:opacity-0']
3628
+ },
3629
+ variants: {
3630
+ isDisabled: {
3631
+ true: {
3632
+ wrapper: 'opacity-disabled pointer-events-none'
3633
+ }
3634
+ },
3635
+ size: {
3636
+ sm: {
3637
+ wrapper: 'w-6 h-3 px-[2px]',
3638
+ thumb: ['w-2 h-2 text-xs', 'group-data-[selected=true]:ms-3'],
3639
+ endContent: 'text-xs',
3640
+ startContent: 'text-xs',
3641
+ label: 'text-small'
3642
+ },
3643
+ md: {
3644
+ wrapper: 'w-11 h-6',
3645
+ thumb: ['w-4 h-4 text-sm', 'group-data-[selected=true]:ms-5'],
3646
+ endContent: 'text-sm',
3647
+ startContent: 'text-sm',
3648
+ label: 'text-md'
3649
+ },
3650
+ lg: {
3651
+ wrapper: 'w-12 h-7',
3652
+ thumb: ['w-5 h-5 text-medium', 'group-data-[selected=true]:ms-5'],
3653
+ endContent: 'text-md',
3654
+ startContent: 'text-md',
3655
+ label: 'text-lg'
3656
+ }
3657
+ },
3658
+ intent: {
3659
+ default: {
3660
+ wrapper: ['group-data-[selected=true]:bg-neutral-firm', 'group-data-[selected=true]:text-on-neutral-firm']
3661
+ },
3662
+ primary: {
3663
+ wrapper: ['group-data-[selected=true]:bg-primary', 'group-data-[selected=true]:text-on-primary']
3664
+ },
3665
+ secondary: {
3666
+ wrapper: ['group-data-[selected=true]:bg-secondary', 'group-data-[selected=true]:text-on-secondary']
3667
+ },
3668
+ tertiary: {
3669
+ wrapper: ['group-data-[selected=true]:bg-tertiary', 'group-data-[selected=true]:text-on-tertiary']
3670
+ },
3671
+ success: {
3672
+ wrapper: ['group-data-[selected=true]:bg-success', 'group-data-[selected=true]:text-on-success']
3673
+ },
3674
+ warning: {
3675
+ wrapper: ['group-data-[selected=true]:bg-warning', 'group-data-[selected=true]:text-on-warning']
3676
+ },
3677
+ danger: {
3678
+ wrapper: ['group-data-[selected=true]:bg-danger', 'group-data-[selected=true]:text-on-danger']
3679
+ }
3680
+ }
3681
+ },
3682
+ defaultVariants: {
3683
+ size: 'md',
3684
+ intent: 'primary',
3685
+ isDisabled: false
3686
+ }
3687
+ });
3688
+
3689
+ const base = tv({
3690
+ slots: {
3691
+ base: 'flex flex-wrap flex-row items-center',
3692
+ labelContainer: 'leading-tight flex items-start',
3693
+ inputContainer: 'flex items-center',
3694
+ label: 'font-body text-body-xs pl-2 pb-0',
3695
+ hint: 'pl-2 flex basis-full before:content-["_"] before:inline-block before:w-[1em] before:h-[1em] shrink-0'
3696
+ },
3697
+ variants: {
3698
+ size: {
3699
+ sm: {
3700
+ label: 'text-body-2xs'
3701
+ },
3702
+ md: '',
3703
+ lg: ''
3704
+ }
3705
+ },
3706
+ defaultVariants: {
3707
+ size: 'md'
3708
+ }
3709
+ });
3710
+ const formCheckbox = tv({
3711
+ extend: base,
3712
+ slots: {
3713
+ checkbox: ''
3714
+ }
3715
+ });
3716
+ const formRadio = tv({
3717
+ extend: base,
3718
+ slots: {
3719
+ radio: ''
3720
+ }
3721
+ });
3722
+ const baseGroup = tv({
3723
+ slots: {
3724
+ base: '',
3725
+ label: 'pb-1 last:pb-0',
3726
+ hint: 'pb-1 last:pb-0',
3727
+ feedback: 'pt-0 flex-[1_100%]'
3728
+ },
3729
+ variants: {
3730
+ isInline: {
3731
+ true: {
3732
+ base: 'flex flex-wrap flex-row items-start',
3733
+ label: 'pr-4 pb-0',
3734
+ hint: 'pr-4 pb-0',
3735
+ feedback: 'pr-4 pb-0'
3736
+ }
3737
+ }
3738
+ }
3739
+ });
3740
+ const formCheckboxGroup = tv({
3741
+ extend: baseGroup,
3742
+ slots: {
3743
+ formCheckbox: 'pb-1 last:pb-0'
3744
+ },
3745
+ variants: {
3746
+ isInline: {
3747
+ true: {
3748
+ formCheckbox: 'pr-4 pb-0'
3749
+ }
3750
+ }
3751
+ }
3752
+ });
3753
+ const formRadioGroup = tv({
3754
+ extend: baseGroup,
3755
+ slots: {
3756
+ formRadio: 'pb-1 last:pb-0'
3757
+ },
3758
+ variants: {
3759
+ isInline: {
3760
+ true: {
3761
+ formRadio: 'pr-4 pb-0'
3762
+ }
3763
+ }
3764
+ }
3765
+ });
3766
+ const formInput = tv({
3767
+ slots: {
3768
+ base: 'flex flex-wrap flex-row',
3769
+ label: 'flex-[1_100%]',
3770
+ input: '',
3771
+ hint: 'flex-[1_100%]',
3772
+ feedback: 'flex-[1_100%]'
3773
+ },
3774
+ variants: {
3775
+ size: {
3776
+ sm: '',
3777
+ md: '',
3778
+ lg: ''
3779
+ }
3780
+ },
3781
+ defaultVariants: {
3782
+ size: 'md'
3783
+ }
3784
+ });
3785
+ const formTextarea = tv({
3786
+ extend: formInput
3787
+ });
3788
+ const formSelect = tv({
3789
+ slots: {
3790
+ base: 'flex flex-wrap flex-row',
3791
+ label: 'flex-[1_100%]',
3792
+ select: '',
3793
+ hint: 'flex-[1_100%]',
3794
+ feedback: 'flex-[1_100%]'
3795
+ },
3796
+ variants: {
3797
+ size: {
3798
+ sm: '',
3799
+ md: '',
3800
+ lg: ''
3801
+ }
3802
+ },
3803
+ defaultVariants: {
3804
+ size: 'md'
3805
+ }
3806
+ });
3
3807
 
4
3808
  var components = /*#__PURE__*/Object.freeze({
5
3809
  __proto__: null,
3810
+ accordion: accordion,
3811
+ alert: alert,
6
3812
  autocomplete: autocomplete,
7
3813
  avatar: avatar,
8
3814
  backdrop: backdrop,
9
3815
  button: button,
10
3816
  buttonGroup: buttonGroup,
3817
+ buttonSpinner: buttonSpinner,
3818
+ calendar: calendar,
11
3819
  checkbox: checkbox,
12
3820
  checkboxGroup: checkboxGroup,
13
3821
  chip: chip,
14
3822
  closeButton: closeButton,
3823
+ command: command,
3824
+ commandDialog: commandDialog,
15
3825
  divider: divider,
16
3826
  drawer: drawer,
17
3827
  dropdownContent: dropdownContent,
3828
+ externalLink: externalLink,
18
3829
  formCheckbox: formCheckbox,
19
3830
  formCheckboxGroup: formCheckboxGroup,
20
3831
  formDescription: formDescription,
@@ -25,26 +3836,34 @@ var components = /*#__PURE__*/Object.freeze({
25
3836
  formSelect: formSelect,
26
3837
  formTextarea: formTextarea,
27
3838
  input: input,
3839
+ inputOtp: inputOtp,
3840
+ kbd: kbd,
28
3841
  label: label,
29
3842
  listbox: listbox,
3843
+ listboxGroup: listboxGroup,
30
3844
  listboxItem: listboxItem,
31
3845
  modal: modal,
32
3846
  nativeSelect: nativeSelect,
33
3847
  notificationCard: notificationCard,
34
- notificationTransitions: notificationTransitions,
35
3848
  notificationsContainer: notificationsContainer,
36
3849
  overlay: overlay,
3850
+ overlayArrow: overlayArrow,
37
3851
  overlayTransitions: overlayTransitions,
3852
+ pagination: pagination,
38
3853
  popover: popover,
39
3854
  progressBar: progressBar,
40
3855
  radio: radio,
41
3856
  radioGroup: radioGroup,
3857
+ segmentedControl: segmentedControl,
42
3858
  select: select,
3859
+ skeleton: skeleton,
43
3860
  spinner: spinner,
44
3861
  switchInput: switchInput,
45
3862
  table: table,
3863
+ tabs: tabs,
46
3864
  textarea: textarea,
47
- toggleButton: toggleButton
3865
+ toggleButton: toggleButton,
3866
+ tooltip: tooltip
48
3867
  });
49
3868
 
50
3869
  let localStyles = components;
@@ -58,5 +3877,5 @@ function useStyles() {
58
3877
  return localStyles;
59
3878
  }
60
3879
 
61
- export { registerCustomStyles, useStyles };
3880
+ export { registerCustomStyles, tv, useStyles };
62
3881
  //# sourceMappingURL=index.js.map