@frontile/theme 0.18.0-alpha.9 → 0.18.0-beta.1

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 +20 -12
  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 +3831 -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,3838 @@
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-component=listbox-item]_[data-part=label]]:text-body-sm', '[&_[data-component=listbox-item]_[data-part=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
+ // No `base` slot: Table has no single wrapping root element of its own --
1726
+ // `wrapper` (below) is the outermost rendered element, and nothing ever
1727
+ // called `.base()`. `w-full caption-bottom font-body text-body-2xs` was
1728
+ // dead here (never applied by any renderer); it is not carried over to
1729
+ // any other slot, since restoring it would be a visual change out of
1730
+ // scope for this migration -- see Task 12's brief.
1731
+ wrapper: ['relative', 'isolate', 'overflow-auto', 'rounded-default',
1732
+ // `surface-table` rather than `surface-card`, which the table otherwise
1733
+ // looks exactly like: every sticky part of the table paints over the rows
1734
+ // and columns scrolling beneath it, and in dark `card` is a translucent
1735
+ // veil that would let them read through. The role carries the colour that
1736
+ // veil renders, with the alpha already resolved. Override
1737
+ // `--color-surface-table` to sit a table on a different background.
1738
+ 'bg-surface-table'],
1739
+ // The optional controls strip above the table (e.g. column visibility).
1740
+ toolbar: ['px-4', 'pt-3'],
1741
+ table: ['w-full', 'table-auto'],
1742
+ thead: ['relative', 'bg-surface-overlay-subtle'],
1743
+ tbody: ['divide-y', 'divide-surface-overlay-subtle',
1744
+ // Rows carry the surface themselves rather than letting the wrapper show
1745
+ // through: a sticky row has to hide the rows sliding under it, and a
1746
+ // sticky cell picks its fill up from its row via `background-color:
1747
+ // inherit`. Row tints layer on top of this, and any tint that replaces it
1748
+ // has to be opaque too — see `striped` and the selection variants.
1749
+ '[&>tr]:bg-surface-table',
1750
+ // `muted`, not `subtle`: in dark `neutral-subtle` is gray-900, the same
1751
+ // value `surface-table` carries, so a `subtle` hover reads as no hover at
1752
+ // all. This stays a background *colour* so `transition-colors` animates it.
1753
+ '[&>tr]:data-[selectable=true]:data-[selected=false]:hover:bg-neutral-muted', '[&>tr]:data-[selectable=true]:transition-colors'],
1754
+ // Footer rows take the surface for the same reason body rows do: a sticky
1755
+ // column in the footer scrolls past the cells to its side.
1756
+ tfoot: ['relative', '[&>tr]:bg-surface-table'],
1757
+ 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'],
1758
+ separator: ['absolute', 'z-2', 'left-0', 'w-full', 'h-px', 'bg-surface-overlay-mild'],
1759
+ th: ['h-12', 'px-4', 'text-left', 'align-middle', 'font-label', 'text-neutral-bolder', '[&:has([role=checkbox])]:pr-0', 'data-[sortable=true]:cursor-pointer'],
1760
+ 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'],
1761
+ 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'],
1762
+ columnVisibilityButton: ['flex'],
1763
+ columnVisibilityIcon: ['size-6'],
1764
+ td: ['align-middle', 'text-neutral-strong', '[&:has([role=checkbox])]:pr-0'],
1765
+ empty: ['text-neutral-soft', 'align-middle', 'text-center', 'py-12'],
1766
+ // Deliberately carries no width or height: these classes are merged onto
1767
+ // Skeleton *after* its own shape and size variants, so any dimension set
1768
+ // here would defeat a column's `skeleton: 'circle'` preset. The table
1769
+ // passes its `size` through to Skeleton instead.
1770
+ skeleton: ['max-w-[16ch]'],
1771
+ // Placeholder rows fade in one after another. The per-row `animation-delay`
1772
+ // is set inline by the component, since a delay that scales with the row
1773
+ // index cannot be a static utility class.
1774
+ skeletonRow: ['animate-skeleton-enter', 'motion-reduce:animate-none']
1775
+ },
1776
+ variants: {
1777
+ size: {
1778
+ sm: {
1779
+ th: 'h-10 px-3 py-2 text-label-2xs',
1780
+ td: 'px-3 py-2 text-body-2xs'
1781
+ },
1782
+ md: {
1783
+ th: 'h-12 px-4 text-label-xs',
1784
+ td: 'p-4 text-body-2xs'
1785
+ },
1786
+ lg: {
1787
+ th: 'h-14 px-6 text-label-sm',
1788
+ td: 'p-6 text-body-xs'
1789
+ }
1790
+ },
1791
+ isLoading: {
1792
+ true: {
1793
+ thead: ['after:absolute', 'after:top-full', 'after:left-0', 'after:w-1/2', 'after:animate-swing', 'after:h-px', 'after:z-10']
1794
+ }
1795
+ },
1796
+ // Declared empty on purpose: these variants exist only so `isLoading` can
1797
+ // pair with them in `compoundVariants` below, where the actual
1798
+ // `thead: after:bg-*` colour is applied. A colour set here would paint the
1799
+ // hairline even when the table is not loading.
1800
+ loadingColor: {
1801
+ default: {},
1802
+ primary: {},
1803
+ success: {},
1804
+ warning: {},
1805
+ danger: {}
1806
+ },
1807
+ selectionColor: {
1808
+ default: {},
1809
+ primary: {},
1810
+ success: {},
1811
+ warning: {},
1812
+ danger: {}
1813
+ },
1814
+ layout: {
1815
+ auto: {
1816
+ table: 'table-auto'
1817
+ },
1818
+ fixed: {
1819
+ table: 'table-fixed'
1820
+ }
1821
+ },
1822
+ striped: {
1823
+ true: {
1824
+ // A translucent tint, so it goes on as a background *image* layer over
1825
+ // the row's opaque fill instead of replacing it. Painting it as the
1826
+ // background colour would make every striped sticky row see-through.
1827
+ tbody: '[&_tr:nth-child(odd)]:[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'
1828
+ }
1829
+ },
1830
+ isSticky: {
1831
+ true: {}
1832
+ },
1833
+ stickyPosition: {
1834
+ left: {},
1835
+ right: {},
1836
+ top: {},
1837
+ bottom: {}
1838
+ },
1839
+ isScrollable: {
1840
+ true: {
1841
+ wrapper: ['overflow-auto']
1842
+ }
1843
+ },
1844
+ hasStickyHeader: {
1845
+ true: {}
1846
+ },
1847
+ isInStickyRow: {
1848
+ true: {}
1849
+ }
1850
+ },
1851
+ compoundVariants: [
1852
+ // Sticky header - highest priority for intersections with columns
1853
+ {
1854
+ isSticky: true,
1855
+ stickyPosition: 'top',
1856
+ class: {
1857
+ // The opaque surface plus the header's own translucent tint as a layer
1858
+ // above it, which is what a non-sticky `thead` composites to over the
1859
+ // wrapper — so stuck and unstuck headers read as the same colour.
1860
+ thead: ['sticky', 'top-0', 'z-2', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]']
1861
+ }
1862
+ },
1863
+ // Sticky footer
1864
+ {
1865
+ isSticky: true,
1866
+ stickyPosition: 'bottom',
1867
+ class: {
1868
+ tfoot: ['sticky', 'bottom-0', 'z-2', 'bg-surface-table']
1869
+ }
1870
+ },
1871
+ // Sticky columns - medium priority, header cells get higher z-index.
1872
+ // Body and footer cells inherit their row's paint — fill, and any tint
1873
+ // layered over it — so a pinned column tracks selection, hover and striping
1874
+ // instead of masking them with a surface of its own.
1875
+ {
1876
+ isSticky: true,
1877
+ stickyPosition: 'left',
1878
+ class: {
1879
+ th: ['sticky', 'left-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1880
+ td: ['sticky', 'left-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1881
+ }
1882
+ }, {
1883
+ isSticky: true,
1884
+ stickyPosition: 'right',
1885
+ class: {
1886
+ th: ['sticky', 'right-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1887
+ td: ['sticky', 'right-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1888
+ }
1889
+ },
1890
+ // Sticky rows - base layer
1891
+ {
1892
+ isSticky: true,
1893
+ stickyPosition: 'top',
1894
+ class: {
1895
+ tr: ['sticky', 'top-0', 'z-1', 'bg-surface-table']
1896
+ }
1897
+ }, {
1898
+ isSticky: true,
1899
+ stickyPosition: 'bottom',
1900
+ class: {
1901
+ tr: ['sticky', 'bottom-0', 'z-1', 'bg-surface-table']
1902
+ }
1903
+ },
1904
+ // Sticky rows with sticky header - position after header
1905
+ {
1906
+ isSticky: true,
1907
+ stickyPosition: 'top',
1908
+ hasStickyHeader: true,
1909
+ class: {
1910
+ tr: ['sticky', 'z-2', 'bg-surface-table', '[&.sticky]:[top:var(--table-header-height,48px)]']
1911
+ }
1912
+ },
1913
+ // Intersection cells: sticky column + sticky row - highest z-index
1914
+ {
1915
+ isSticky: true,
1916
+ stickyPosition: 'left',
1917
+ isInStickyRow: true,
1918
+ class: {
1919
+ td: ['sticky', 'left-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1920
+ }
1921
+ }, {
1922
+ isSticky: true,
1923
+ stickyPosition: 'right',
1924
+ isInStickyRow: true,
1925
+ class: {
1926
+ td: ['sticky', 'right-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1927
+ }
1928
+ },
1929
+ // Loading states with color variants
1930
+ {
1931
+ isLoading: true,
1932
+ loadingColor: 'default',
1933
+ class: {
1934
+ thead: `after:bg-neutral`
1935
+ }
1936
+ }, {
1937
+ isLoading: true,
1938
+ loadingColor: 'primary',
1939
+ class: {
1940
+ thead: `after:bg-primary`
1941
+ }
1942
+ }, {
1943
+ isLoading: true,
1944
+ loadingColor: 'success',
1945
+ class: {
1946
+ thead: `after:bg-success`
1947
+ }
1948
+ }, {
1949
+ isLoading: true,
1950
+ loadingColor: 'warning',
1951
+ class: {
1952
+ thead: `after:bg-warning`
1953
+ }
1954
+ }, {
1955
+ isLoading: true,
1956
+ loadingColor: 'danger',
1957
+ class: {
1958
+ thead: `after:bg-danger`
1959
+ }
1960
+ },
1961
+ // Selection color variants
1962
+ {
1963
+ selectionColor: 'default',
1964
+ class: {
1965
+ // Half-opacity, so it layers over the row's fill rather than replacing
1966
+ // it — a selected sticky row still has to occlude what scrolls under.
1967
+ // The other selection colours are opaque and can stay plain fills.
1968
+ //
1969
+ // `soft` rather than `subtle`, which in dark is the same value as
1970
+ // `surface-table` and so tints nothing. At 50% this lands on the weight
1971
+ // the colour variants carry (1.4:1 against the surface, against
1972
+ // `primary-subtle`'s 1.38:1).
1973
+ 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))]',
1974
+ tr: ['data-[selectable=true]:focus-visible:ring-default']
1975
+ }
1976
+ }, {
1977
+ selectionColor: 'primary',
1978
+ class: {
1979
+ tbody: '[&>tr]:data-[selected=true]:bg-primary-subtle',
1980
+ tr: ['data-[selectable=true]:focus-visible:ring-primary-soft']
1981
+ }
1982
+ }, {
1983
+ selectionColor: 'success',
1984
+ class: {
1985
+ tbody: '[&>tr]:data-[selected=true]:bg-success-subtle',
1986
+ tr: ['data-[selectable=true]:focus-visible:ring-success']
1987
+ }
1988
+ }, {
1989
+ selectionColor: 'warning',
1990
+ class: {
1991
+ tbody: '[&>tr]:data-[selected=true]:bg-warning-subtle',
1992
+ tr: ['data-[selectable=true]:focus-visible:ring-warning']
1993
+ }
1994
+ }, {
1995
+ selectionColor: 'danger',
1996
+ class: {
1997
+ tbody: '[&>tr]:data-[selected=true]:bg-danger-subtle',
1998
+ tr: ['data-[selectable=true]:focus-visible:ring-danger']
1999
+ }
2000
+ }],
2001
+ defaultVariants: {
2002
+ size: 'md',
2003
+ layout: 'auto',
2004
+ loadingColor: 'default',
2005
+ selectionColor: 'primary'
2006
+ }
2007
+ });
2008
+
2009
+ const segmentedControl = tv({
2010
+ slots: {
2011
+ // The positioning context the indicator is measured against. `isolate`
2012
+ // keeps the indicator's stacking behind the items without leaking a
2013
+ // z-index into the surrounding page.
2014
+ base: ['relative isolate inline-flex', 'rounded-pill', 'p-1'],
2015
+ // Geometry comes from the custom properties `selectionIndicator` publishes;
2016
+ // this slot only decides what it looks like. `var()` names are literal:
2017
+ // Tailwind generates nothing from an interpolated class string.
2018
+ 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',
2019
+ // Held until the first real measurement lands, so the indicator never
2020
+ // flies in from the container origin on first paint.
2021
+ 'opacity-0', 'group-data-[fr-si-ready]/segmented:opacity-100',
2022
+ // Tailwind v4 compiles `translate-x-*` to the standalone `translate`
2023
+ // property, not to `transform`, so `translate` is what has to be
2024
+ // transitioned. `transform` is listed for overrides that use it.
2025
+ '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'],
2026
+ // Both focus rings, not one per rendering mode: in button mode the item is
2027
+ // the focusable element and `has-[:focus-visible]` has no descendant to
2028
+ // match, while in form mode the label is not focusable and `focus-visible:`
2029
+ // never matches it. Only one set can ever apply, so a third rendering mode
2030
+ // needs no third branch.
2031
+ 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',
2032
+ // Both rendering modes publish `data-disabled`, so one selector covers
2033
+ // them. Keying off native `disabled:` would miss form mode, where the
2034
+ // item is a `<label>` and only the hidden input is disabled.
2035
+ 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled',
2036
+ // Resting, hover and selected are three distinct levels so hover has
2037
+ // somewhere to go that is not the selected ink. `neutral-firm` clears
2038
+ // WCAG AA against the track in both modes.
2039
+ 'text-neutral-firm',
2040
+ // Scoped to unselected: an unscoped `hover:` ties on specificity with the
2041
+ // variants' `data-[selected=true]:` ink, leaving the winner to Tailwind's
2042
+ // emitted variant order.
2043
+ 'data-[selected=false]:data-[disabled=false]:hover:text-neutral-strong']
2044
+ },
2045
+ variants: {
2046
+ variant: {
2047
+ solid: {
2048
+ // `surface-overlay-soft` is translucent in dark mode, as is the
2049
+ // indicator's `surface-card`; two stacked veils composite
2050
+ // unpredictably, so dark mode uses an opaque role instead.
2051
+ base: 'bg-surface-overlay-soft dark:bg-surface-table',
2052
+ indicator: 'shadow-elevation-1'
2053
+ },
2054
+ ghost: {
2055
+ base: 'bg-transparent',
2056
+ indicator: ''
2057
+ }
2058
+ },
2059
+ // Keyed off `data-selected`, which the item publishes in both rendering
2060
+ // modes -- the two express selection on different elements, so a rule per
2061
+ // mode is one mode away from being forgotten. Written literally: Tailwind
2062
+ // generates nothing from a composed class string.
2063
+ intent: {
2064
+ default: {
2065
+ // Opaque white in light mode. In dark, `surface-card` is translucent,
2066
+ // so an opaque neutral is used instead -- see the track above.
2067
+ indicator: 'bg-surface-card dark:bg-neutral-soft',
2068
+ item: 'data-[selected=true]:text-neutral-bolder'
2069
+ },
2070
+ primary: {
2071
+ indicator: 'bg-primary',
2072
+ item: 'data-[selected=true]:text-on-primary'
2073
+ },
2074
+ secondary: {
2075
+ indicator: 'bg-secondary',
2076
+ item: 'data-[selected=true]:text-on-secondary'
2077
+ },
2078
+ tertiary: {
2079
+ indicator: 'bg-tertiary',
2080
+ item: 'data-[selected=true]:text-on-tertiary'
2081
+ },
2082
+ success: {
2083
+ indicator: 'bg-success',
2084
+ item: 'data-[selected=true]:text-on-success'
2085
+ },
2086
+ warning: {
2087
+ indicator: 'bg-warning',
2088
+ item: 'data-[selected=true]:text-on-warning'
2089
+ },
2090
+ danger: {
2091
+ indicator: 'bg-danger',
2092
+ item: 'data-[selected=true]:text-on-danger'
2093
+ }
2094
+ },
2095
+ size: {
2096
+ sm: {
2097
+ item: 'px-3 py-1 text-label-sm'
2098
+ },
2099
+ md: {
2100
+ item: 'px-4 py-1.5 text-label-md'
2101
+ },
2102
+ lg: {
2103
+ item: 'px-5 py-2 text-label-lg'
2104
+ }
2105
+ },
2106
+ orientation: {
2107
+ horizontal: {
2108
+ base: 'flex-row'
2109
+ },
2110
+ // A pill radius on a tall narrow column reads as an oval blob, so the
2111
+ // vertical axis squares off -- on the track and on what sits inside it,
2112
+ // or the indicator would bulge out of the track. The inner radius is the
2113
+ // outer one less the track's `p-1`.
2114
+ vertical: {
2115
+ base: 'flex-col rounded-2xl',
2116
+ indicator: 'rounded-xl',
2117
+ item: 'rounded-xl'
2118
+ }
2119
+ },
2120
+ isFullWidth: {
2121
+ true: {
2122
+ base: 'flex w-full',
2123
+ item: 'flex-1'
2124
+ }
2125
+ },
2126
+ isDisabled: {
2127
+ true: {
2128
+ base: 'opacity-disabled',
2129
+ item: 'pointer-events-none'
2130
+ }
2131
+ },
2132
+ hasSeparators: {
2133
+ true: {
2134
+ item: [
2135
+ // A hairline before every item except the first. The level differs
2136
+ // per mode: neither the neutral scale nor the track is symmetric
2137
+ // across them, so one level cannot read on both.
2138
+ 'before:absolute before:content-[""]', 'before:bg-neutral-mild dark:before:bg-neutral-soft', 'before:transition-opacity before:duration-200', 'motion-reduce:before:transition-none',
2139
+ // The indicator's `<span>` is the container's true first child, so
2140
+ // `first:` would never match an item; `first-of-type:` does.
2141
+ 'first-of-type:before:content-none',
2142
+ // Hidden on the selected item and the one after it, so the indicator
2143
+ // never crosses a visible line. Sibling selectors know the order, so
2144
+ // nothing tracks indices.
2145
+ 'before:opacity-100', 'data-[selected=true]:before:opacity-0', '[&[data-selected=true]+*]:before:opacity-0']
2146
+ }
2147
+ }
2148
+ },
2149
+ compoundVariants: [
2150
+ // Vertical items get their width from the flex stretch, so the padding
2151
+ // budget moves to the cross axis. One literal class per size.
2152
+ {
2153
+ orientation: 'vertical',
2154
+ size: 'sm',
2155
+ class: {
2156
+ item: 'py-1.5'
2157
+ }
2158
+ }, {
2159
+ orientation: 'vertical',
2160
+ size: 'md',
2161
+ class: {
2162
+ item: 'py-2'
2163
+ }
2164
+ }, {
2165
+ orientation: 'vertical',
2166
+ size: 'lg',
2167
+ class: {
2168
+ item: 'py-2.5'
2169
+ }
2170
+ }, {
2171
+ hasSeparators: true,
2172
+ orientation: 'horizontal',
2173
+ class: {
2174
+ item: 'before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-px before:h-4'
2175
+ }
2176
+ }, {
2177
+ hasSeparators: true,
2178
+ orientation: 'vertical',
2179
+ class: {
2180
+ item: 'before:top-0 before:left-1/2 before:-translate-x-1/2 before:h-px before:w-4'
2181
+ }
2182
+ }],
2183
+ defaultVariants: {
2184
+ variant: 'solid',
2185
+ intent: 'default',
2186
+ size: 'md',
2187
+ orientation: 'horizontal'
2188
+ }
2189
+ });
2190
+
2191
+ const tabs = tv({
2192
+ slots: {
2193
+ base: 'flex',
2194
+ // The positioning context the indicator is measured against, and the
2195
+ // element that carries `group/tabs` in the template.
2196
+ list: ['relative isolate flex', 'select-none'],
2197
+ // Geometry comes from the custom properties `selectionIndicator`
2198
+ // publishes. `var()` names are literal: Tailwind generates nothing from
2199
+ // an interpolated class string.
2200
+ indicator: ['pointer-events-none absolute left-0 top-0 z-0',
2201
+ // Held until the first real measurement lands, so the indicator never
2202
+ // flies in from the container origin on first paint.
2203
+ 'opacity-0', 'group-data-[fr-si-ready]/tabs:opacity-100',
2204
+ // Tailwind v4 compiles `translate-x-*` to the standalone `translate`
2205
+ // property, not to `transform`, so `translate` is what has to be
2206
+ // transitioned. `transform` is listed for overrides that use it.
2207
+ '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'],
2208
+ 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',
2209
+ // Resting, hover and selected are three distinct levels so hover has
2210
+ // somewhere to go that is not the selected ink.
2211
+ 'text-neutral-firm',
2212
+ // Scoped to unselected: an unscoped `hover:` ties on specificity with
2213
+ // the selected ink, leaving the winner to Tailwind's variant order.
2214
+ // "Not disabled" is `not-data-[disabled=true]`, not `data-[disabled=false]`:
2215
+ // an attribute-value selector cannot match an element that never declares
2216
+ // the attribute, and a consumer bringing their own element should not have
2217
+ // to know the theme wants a `data-disabled="false"` written onto it.
2218
+ 'data-[selected=false]:not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
2219
+ panel: [...focusVisibleRing, 'outline-none']
2220
+ },
2221
+ variants: {
2222
+ variant: {
2223
+ solid: {
2224
+ list: 'bg-surface-overlay-soft dark:bg-surface-table rounded-pill p-1',
2225
+ 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'],
2226
+ tab: 'rounded-pill'
2227
+ },
2228
+ // Painting is finished in compoundVariants: the bar is pinned to a
2229
+ // different edge per orientation and reads a different pair of custom
2230
+ // properties, so there is nothing orientation-agnostic to say here.
2231
+ underline: {
2232
+ tab: 'rounded-md'
2233
+ }
2234
+ },
2235
+ // Fill and selected ink travel together: the label sits on the fill, so a
2236
+ // new intent needs both or its selected label is unreadable on its own
2237
+ // background. `underline` overrides the ink in one compound below, since a
2238
+ // bare bar puts no fill behind the label.
2239
+ intent: {
2240
+ default: {
2241
+ indicator: 'bg-surface-card dark:bg-neutral-soft',
2242
+ tab: 'data-[selected=true]:text-neutral-bolder'
2243
+ },
2244
+ primary: {
2245
+ indicator: 'bg-primary',
2246
+ tab: 'data-[selected=true]:text-on-primary'
2247
+ },
2248
+ secondary: {
2249
+ indicator: 'bg-secondary',
2250
+ tab: 'data-[selected=true]:text-on-secondary'
2251
+ },
2252
+ tertiary: {
2253
+ indicator: 'bg-tertiary',
2254
+ tab: 'data-[selected=true]:text-on-tertiary'
2255
+ },
2256
+ success: {
2257
+ indicator: 'bg-success',
2258
+ tab: 'data-[selected=true]:text-on-success'
2259
+ },
2260
+ warning: {
2261
+ indicator: 'bg-warning',
2262
+ tab: 'data-[selected=true]:text-on-warning'
2263
+ },
2264
+ danger: {
2265
+ indicator: 'bg-danger',
2266
+ tab: 'data-[selected=true]:text-on-danger'
2267
+ }
2268
+ },
2269
+ size: {
2270
+ sm: {
2271
+ tab: 'px-3 py-1 text-label-sm',
2272
+ panel: 'py-2'
2273
+ },
2274
+ md: {
2275
+ tab: 'px-4 py-1.5 text-label-md',
2276
+ panel: 'py-3'
2277
+ },
2278
+ lg: {
2279
+ tab: 'px-5 py-2 text-label-lg',
2280
+ panel: 'py-4'
2281
+ }
2282
+ },
2283
+ orientation: {
2284
+ horizontal: {
2285
+ base: 'flex-col',
2286
+ list: 'flex-row'
2287
+ },
2288
+ vertical: {
2289
+ base: 'flex-row gap-4',
2290
+ list: 'flex-col'
2291
+ }
2292
+ },
2293
+ // `base` needs the width too, not just `list`: the list's `w-full`
2294
+ // resolves against `base`, and a `base` with no width of its own collapses
2295
+ // to its content inside an `align-items: flex-start` parent -- leaving the
2296
+ // whole argument inert in exactly the layouts that reach for it.
2297
+ isFullWidth: {
2298
+ true: {
2299
+ base: 'w-full',
2300
+ list: 'w-full',
2301
+ tab: 'flex-1'
2302
+ }
2303
+ },
2304
+ isDisabled: {
2305
+ true: {
2306
+ list: 'opacity-disabled',
2307
+ tab: 'pointer-events-none'
2308
+ }
2309
+ }
2310
+ },
2311
+ compoundVariants: [
2312
+ // -- underline: no fill behind the label, so the intent colour lives on the
2313
+ // bar alone and the label stays high-contrast neutral at every intent --
2314
+ // matching the reference designs. The hover chip shares this matcher, so it
2315
+ // rides along rather than repeating the condition in a second entry.
2316
+ {
2317
+ variant: 'underline',
2318
+ class: {
2319
+ tab: 'data-[selected=true]:text-neutral-bolder data-[selected=false]:not-data-[disabled=true]:hover:bg-surface-overlay-soft'
2320
+ }
2321
+ },
2322
+ // A pill radius on a tall narrow column reads as an oval blob, so the
2323
+ // vertical axis squares off -- on the track and on what sits inside it, or
2324
+ // the indicator would bulge out of the track. The inner radius is the
2325
+ // outer one less the track's `p-1`. Only `solid` has a track to round.
2326
+ {
2327
+ variant: 'solid',
2328
+ orientation: 'vertical',
2329
+ class: {
2330
+ list: 'rounded-2xl',
2331
+ indicator: 'rounded-xl',
2332
+ tab: 'rounded-xl'
2333
+ }
2334
+ },
2335
+ // `default` intent's fill is a surface in solid; a bare bar needs ink.
2336
+ {
2337
+ variant: 'underline',
2338
+ intent: 'default',
2339
+ class: {
2340
+ indicator: 'bg-neutral-bolder'
2341
+ }
2342
+ }, {
2343
+ variant: 'underline',
2344
+ orientation: 'horizontal',
2345
+ class: {
2346
+ // `pb-2` is what separates the labels from the rule, and it belongs on
2347
+ // the list rather than as a margin on each tab: an absolutely
2348
+ // positioned box resolves its offsets against the padding box, so the
2349
+ // bar stays welded to the rule at `bottom-0` while the padding pushes
2350
+ // the tabs -- and with them their hover chips -- clear of it. A chip
2351
+ // that runs into the rule is the thing this buys off.
2352
+ list: 'gap-1 pb-2 border-b border-neutral-mild dark:border-neutral-soft',
2353
+ indicator: ['top-auto bottom-0 h-0.5 rounded-full', 'w-[var(--fr-si-width)]', 'translate-x-[var(--fr-si-x)]']
2354
+ }
2355
+ }, {
2356
+ variant: 'underline',
2357
+ orientation: 'vertical',
2358
+ class: {
2359
+ // The same gap, on the axis this orientation puts the rule on.
2360
+ list: 'gap-1 ps-2 border-l border-neutral-mild dark:border-neutral-soft',
2361
+ indicator: ['left-0 w-0.5 rounded-full', 'h-[var(--fr-si-height)]', 'translate-y-[var(--fr-si-y)]']
2362
+ }
2363
+ }],
2364
+ defaultVariants: {
2365
+ variant: 'solid',
2366
+ intent: 'default',
2367
+ size: 'md',
2368
+ orientation: 'horizontal'
2369
+ }
2370
+ });
2371
+
2372
+ const accordion = tv({
2373
+ slots: {
2374
+ base: 'flex flex-col',
2375
+ // Carries `group/accordion-item` plus `data-open`, which is what lets the
2376
+ // indicator rotate without the component pushing a class. The group name
2377
+ // is written literally: Tailwind generates nothing from a composed string.
2378
+ item: 'group/accordion-item',
2379
+ heading: 'flex',
2380
+ trigger: [...focusVisibleRing, 'flex flex-1 items-center text-start', 'w-full cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'text-neutral-bolder',
2381
+ // "Not disabled" is `not-data-[disabled=true]`, not
2382
+ // `data-[disabled=false]`: an attribute-value selector cannot match an
2383
+ // element that never declares the attribute.
2384
+ 'not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
2385
+ startContent: 'flex shrink-0 items-center',
2386
+ titleWrapper: 'flex flex-1 flex-col text-start',
2387
+ title: '',
2388
+ subtitle: 'text-neutral-firm',
2389
+ indicator: ['shrink-0', 'transition-transform duration-200 motion-reduce:transition-none', 'group-data-[open=true]/accordion-item:rotate-180'],
2390
+ // The animated element. It must never carry padding: padding on the
2391
+ // animating box means the collapsed height can never reach 0.
2392
+ content: 'text-neutral-firm',
2393
+ // Where the panel's padding actually lives.
2394
+ contentBody: ''
2395
+ },
2396
+ variants: {
2397
+ variant: {
2398
+ // No chrome at all.
2399
+ ghost: {},
2400
+ // Rules between items, none after the last.
2401
+ outlined: {
2402
+ item: 'border-b border-neutral-muted last:border-b-0'
2403
+ },
2404
+ // A soft fill on the open item. Horizontal padding comes with the
2405
+ // surface -- text running to the edge of a tinted box reads as a bug.
2406
+ faded: {
2407
+ item: 'rounded-lg data-[open=true]:bg-surface-overlay-soft',
2408
+ trigger: 'px-3',
2409
+ contentBody: 'px-3'
2410
+ },
2411
+ // One bordered surface around the whole group.
2412
+ enclosed: {
2413
+ base: 'overflow-hidden rounded-lg border border-neutral-muted',
2414
+ item: 'border-b border-neutral-muted last:border-b-0',
2415
+ trigger: 'px-4',
2416
+ contentBody: 'px-4'
2417
+ }
2418
+ },
2419
+ size: {
2420
+ // Typography sits on `trigger`, not on `title`, and that placement is
2421
+ // load-bearing: the trigger renders inside a real `<h3>` (or whatever
2422
+ // `@headingLevel` says), so a host page's heading styles -- large, bold,
2423
+ // tight tracking -- would otherwise be inherited by everything in the
2424
+ // header row that does not set its own size: `startContent`, the
2425
+ // indicator, and any custom `<:title>` content. The class on the trigger
2426
+ // is the baseline that neutralises that; `subtitle` then refines it, and
2427
+ // `@classes.title` still wins on the title element itself.
2428
+ //
2429
+ // `text-label-*` (semibold, default tracking) rather than `text-strong-*`
2430
+ // (bold, tight): an accordion header is a label on a row, not a section
2431
+ // heading. It matches the panel body's size at every step and lets weight
2432
+ // alone do the separating, which is how the reference implementations
2433
+ // read.
2434
+ sm: {
2435
+ trigger: 'gap-2 py-2 text-label-xs',
2436
+ subtitle: 'text-body-2xs',
2437
+ indicator: 'size-4',
2438
+ contentBody: 'pb-2 text-body-sm'
2439
+ },
2440
+ md: {
2441
+ trigger: 'gap-3 py-3 text-label-sm',
2442
+ subtitle: 'text-body-xs',
2443
+ indicator: 'size-5',
2444
+ contentBody: 'pb-3 text-body-md'
2445
+ },
2446
+ lg: {
2447
+ trigger: 'gap-3 py-4 text-label-md',
2448
+ subtitle: 'text-body-sm',
2449
+ indicator: 'size-6',
2450
+ contentBody: 'pb-4 text-body-lg'
2451
+ }
2452
+ },
2453
+ isDisabled: {
2454
+ true: {
2455
+ base: 'opacity-disabled',
2456
+ trigger: 'pointer-events-none'
2457
+ }
2458
+ }
2459
+ },
2460
+ defaultVariants: {
2461
+ variant: 'outlined',
2462
+ size: 'md'
2463
+ }
2464
+ });
2465
+
2466
+ const calendar = tv({
2467
+ slots: {
2468
+ base: [
2469
+ // `isolate` keeps every z-index the calendar uses inside the calendar.
2470
+ // The shared focus ring raises a focused control to `z-10`; without a
2471
+ // stacking context here that lands in the page's own stacking order and
2472
+ // paints over a site header.
2473
+ 'isolate inline-flex flex-col gap-3 p-3',
2474
+ // The two knobs that let a consumer resize cells and reshape them
2475
+ // without any new API. `--calendar-cell-radius` is how a `<:day>` block
2476
+ // with custom content escapes the circle.
2477
+ '[--calendar-cell-size:2.5rem]', '[--calendar-cell-radius:9999px]'],
2478
+ // Header, year panel and month grids share one column sized to the grids
2479
+ // themselves. Without this the header stretches to the width of the
2480
+ // widest sibling -- a `<:footer>` of preset buttons, say -- and the prev
2481
+ // and next arrows drift away from the days they page.
2482
+ body: 'flex flex-col gap-3 w-fit',
2483
+ header: 'flex items-center justify-between gap-2',
2484
+ // `label-sm` is 1rem, which reads as heavy as a heading next to 14px day
2485
+ // numbers; `label-xs` is the 14px the caption wants.
2486
+ title: 'text-label-xs text-neutral-bolder',
2487
+ nav: 'flex items-center gap-1',
2488
+ // A native `<select>` sizes itself to its *widest* option, so the caption
2489
+ // would sit at "September" width even in May. Instead the visible label is
2490
+ // a span that sizes to the current month, with a transparent full-size
2491
+ // `<select>` laid over it -- the control stays native for the keyboard and
2492
+ // for assistive tech, but no longer dictates the width, and its built-in
2493
+ // arrow (which cannot be spaced) is replaced by our own chevron.
2494
+ 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'],
2495
+ monthSelectValue: 'text-label-xs text-neutral-bolder',
2496
+ monthSelect: 'absolute inset-0 w-full opacity-0 cursor-pointer',
2497
+ monthSelectIcon: 'pointer-events-none size-3.5 shrink-0 text-neutral-firm',
2498
+ // Its own slot rather than `navButton`: that one is a fixed square sized
2499
+ // for a chevron, which would clip a four-digit year.
2500
+ 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'],
2501
+ navButton: [...focusVisibleRing, 'inline-flex items-center justify-center', 'size-8 rounded-full',
2502
+ // The chevron inside is sized here rather than on the icon, so the
2503
+ // button stays the hit area and the glyph stays optically balanced
2504
+ // against the caption.
2505
+ '[&_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'],
2506
+ // Centered because the calendar is only ever as wide as its widest part:
2507
+ // a `<:header>` block wider than the grid (long month names, extra
2508
+ // controls) stretches the component, and the months would otherwise sit
2509
+ // flush left under it. A no-op whenever the grid is the widest part.
2510
+ monthsWrapper: 'flex justify-center gap-4',
2511
+ monthGrid: 'border-collapse',
2512
+ weekdaysRow: '',
2513
+ // `caption-2xs` does not exist in the type scale -- the smallest caption
2514
+ // is `caption-sm` -- so the old value generated nothing and these labels
2515
+ // inherited 16px, rendering *larger* than the day numbers beneath them.
2516
+ // The row is also shorter than a day row: it is a label, not a cell.
2517
+ weekday: ['text-caption-sm text-neutral font-normal', 'h-8 w-[var(--calendar-cell-size)]', 'text-center align-middle'],
2518
+ week: '',
2519
+ // The positioning context for `cellBand`. No padding: the band has to
2520
+ // reach the cell edges for adjacent bands to touch.
2521
+ cell: ['relative p-0 text-center', 'size-[var(--calendar-cell-size)]'],
2522
+ // The continuous range ribbon, behind the day. Absolutely positioned and
2523
+ // filling the whole cell, which is what removes the gap between days.
2524
+ // No z-index: the band is painted before the day in document order, and
2525
+ // between two positioned elements with auto z-index document order already
2526
+ // decides. Giving the day a positive index instead let it escape into the
2527
+ // page and paint over a host site's header.
2528
+ cellBand: ['absolute inset-0 pointer-events-none',
2529
+ // The band fills the whole cell so adjacent bands touch, but at the two
2530
+ // ends of a range it must stop under the endpoint's circle rather than
2531
+ // running past it into empty grid. Clipping to half width leaves the
2532
+ // ribbon meeting the fill and going no further.
2533
+ 'data-[range-start=true]:start-1/2', 'data-[range-end=true]:end-1/2',
2534
+ // A single-day range is both ends at once: nothing to connect, so no
2535
+ // band at all.
2536
+ 'data-[range-start=true]:data-[range-end=true]:hidden',
2537
+ // The pending preview is the same ribbon, quieter -- it shows where the
2538
+ // range *would* land, not where it is.
2539
+ 'data-[preview=true]:opacity-60'],
2540
+ day: [...focusVisibleRing,
2541
+ // `relative` is the positioning context for the today dot. Deliberately
2542
+ // no z-index -- see `cellBand`.
2543
+ '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',
2544
+ // Selected days are excluded here and get their own hover per intent.
2545
+ // Without the exclusion this rule wins on specificity -- it carries an
2546
+ // extra `:hover` over the intent's plain `data-[selected=true]` -- so
2547
+ // hovering the selected day replaced its fill with a grey overlay and
2548
+ // made it look deselected.
2549
+ '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'],
2550
+ // Wraps default *and* `<:day>` content, so a block that renders more than
2551
+ // a numeral -- a price, an event count -- stacks and centres without
2552
+ // having to rebuild this layout itself.
2553
+ dayContent: 'flex flex-col items-center justify-center leading-none overflow-hidden',
2554
+ // Sits below the grids, outside the column that sizes to them, so wide
2555
+ // content here wraps instead of stretching the header.
2556
+ footer: 'flex flex-wrap items-center gap-2 pt-1',
2557
+ // The today marker: a dot under the numeral rather than a ring, which
2558
+ // would compete with the selected fill.
2559
+ indicator: 'absolute bottom-1 size-1 rounded-full bg-current opacity-70',
2560
+ // The year panel stands in for the day grid rather than sitting above it,
2561
+ // so it is sized to the grid it replaces: seven cells wide, six tall. The
2562
+ // year list is long by design (a century back, for dates of birth), which
2563
+ // is exactly why it has to scroll inside that box instead of growing the
2564
+ // component to the height of its longest possible list.
2565
+ yearGrid: [
2566
+ // Positioned so the year buttons measure their `offsetTop` against the
2567
+ // panel: the component scrolls the selected year into view itself,
2568
+ // rather than letting `scrollIntoView` drag the whole page with it.
2569
+ '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'],
2570
+ 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']
2571
+ },
2572
+ variants: {
2573
+ intent: {
2574
+ default: {
2575
+ day: 'data-[selected=true]:bg-neutral-strong data-[selected=true]:text-on-neutral-strong data-[selected=true]:hover:bg-neutral-bolder',
2576
+ cellBand: 'data-[in-range=true]:bg-neutral-soft'
2577
+ },
2578
+ primary: {
2579
+ day: 'data-[selected=true]:bg-primary data-[selected=true]:text-on-primary data-[selected=true]:hover:bg-primary-firm',
2580
+ cellBand: 'data-[in-range=true]:bg-primary-soft'
2581
+ },
2582
+ secondary: {
2583
+ day: 'data-[selected=true]:bg-secondary data-[selected=true]:text-on-secondary data-[selected=true]:hover:bg-secondary-firm',
2584
+ cellBand: 'data-[in-range=true]:bg-secondary-soft'
2585
+ },
2586
+ tertiary: {
2587
+ day: 'data-[selected=true]:bg-tertiary data-[selected=true]:text-on-tertiary data-[selected=true]:hover:bg-tertiary-firm',
2588
+ cellBand: 'data-[in-range=true]:bg-tertiary-soft'
2589
+ },
2590
+ success: {
2591
+ day: 'data-[selected=true]:bg-success data-[selected=true]:text-on-success data-[selected=true]:hover:bg-success-firm',
2592
+ cellBand: 'data-[in-range=true]:bg-success-soft'
2593
+ },
2594
+ warning: {
2595
+ day: 'data-[selected=true]:bg-warning data-[selected=true]:text-on-warning data-[selected=true]:hover:bg-warning-firm',
2596
+ cellBand: 'data-[in-range=true]:bg-warning-soft'
2597
+ },
2598
+ danger: {
2599
+ day: 'data-[selected=true]:bg-danger data-[selected=true]:text-on-danger data-[selected=true]:hover:bg-danger-firm',
2600
+ cellBand: 'data-[in-range=true]:bg-danger-soft'
2601
+ }
2602
+ },
2603
+ size: {
2604
+ sm: {
2605
+ base: 'p-2 [--calendar-cell-size:2.25rem]',
2606
+ title: 'text-label-2xs',
2607
+ navButton: 'size-7 [&_svg]:size-3.5'
2608
+ },
2609
+ md: {
2610
+ base: '[--calendar-cell-size:2.5rem]'
2611
+ },
2612
+ lg: {
2613
+ base: 'p-4 [--calendar-cell-size:3rem]',
2614
+ title: 'text-label-sm',
2615
+ navButton: 'size-9 [&_svg]:size-5'
2616
+ }
2617
+ },
2618
+ isDisabled: {
2619
+ true: {
2620
+ base: 'opacity-disabled pointer-events-none'
2621
+ }
2622
+ }
2623
+ },
2624
+ defaultVariants: {
2625
+ intent: 'primary',
2626
+ size: 'md'
2627
+ }
2628
+ });
2629
+
2630
+ /**
2631
+ * Prev/next/first/last share every class, but `tv` has no way for one slot to
2632
+ * inherit another, so the list is written once here and spread into both. It
2633
+ * is not folded into a single `control` slot because `classes.prev` and
2634
+ * `classes.next` are part of the component's public override surface.
2635
+ */
2636
+ 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'];
2637
+
2638
+ /**
2639
+ * The size-dependent half of the same story: `prev` and `next` are one
2640
+ * affordance at every size, so each size is written once here and spread into
2641
+ * both slots below. Written as whole literal class strings rather than
2642
+ * composed from parts -- Tailwind generates nothing from an interpolated
2643
+ * class, so the scanner has to see each one intact.
2644
+ */
2645
+ const controlSize = {
2646
+ sm: 'h-7 px-2 text-label-xs [&_svg]:size-3.5',
2647
+ md: 'h-9 px-3 text-label-sm [&_svg]:size-4',
2648
+ lg: 'h-11 px-4 text-label-md [&_svg]:size-5'
2649
+ };
2650
+ const pagination = tv({
2651
+ slots: {
2652
+ // The summary sits on the leading edge and the controls on the trailing
2653
+ // one, so the row justifies apart only when a summary is actually there;
2654
+ // with nothing to justify against, the controls centre instead. Keyed off
2655
+ // the summary element's own presence with `:has()` -- the same trick
2656
+ // `table.ts` uses -- so the layout follows the rendered structure rather
2657
+ // than a variant the component has to compute and thread through.
2658
+ base: ['flex w-full items-center gap-4', 'justify-center', '[&:has([data-pagination-summary])]:justify-between'],
2659
+ summary: 'text-neutral shrink-0',
2660
+ list: 'flex items-center',
2661
+ item: 'flex',
2662
+ // The resting chip is ghost, so a row of them reads as text with the
2663
+ // active one as the only ink. Hover is scoped to the inactive chips:
2664
+ // unscoped, it ties with the active fill on specificity and the winner is
2665
+ // left to Tailwind's variant ordering.
2666
+ 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'],
2667
+ prev: control,
2668
+ next: control,
2669
+ // Not a button, so no focus ring and no hover: it is a gap marker, and
2670
+ // giving it an affordance would promise a destination it does not have.
2671
+ ellipsis: 'inline-flex shrink-0 items-center justify-center select-none text-neutral'
2672
+ },
2673
+ variants: {
2674
+ // `page` is sized square via `size-*` so a one-digit and a three-digit
2675
+ // chip are the same circle; `tabular-nums` above stops the digits jittering
2676
+ // as the number changes. The controls are pill-shaped rather than square
2677
+ // because they carry a word as well as a chevron.
2678
+ size: {
2679
+ sm: {
2680
+ summary: 'text-body-xs',
2681
+ list: 'gap-0.5',
2682
+ page: 'size-7 text-label-xs',
2683
+ prev: controlSize.sm,
2684
+ next: controlSize.sm,
2685
+ ellipsis: 'size-7 text-label-xs'
2686
+ },
2687
+ md: {
2688
+ summary: 'text-body-sm',
2689
+ list: 'gap-1',
2690
+ page: 'size-9 text-label-sm',
2691
+ prev: controlSize.md,
2692
+ next: controlSize.md,
2693
+ ellipsis: 'size-9 text-label-sm'
2694
+ },
2695
+ lg: {
2696
+ summary: 'text-body-md',
2697
+ list: 'gap-1.5',
2698
+ page: 'size-11 text-label-md',
2699
+ prev: controlSize.lg,
2700
+ next: controlSize.lg,
2701
+ ellipsis: 'size-11 text-label-md'
2702
+ }
2703
+ },
2704
+ // Fill and label travel together: the digit sits on the fill, so each
2705
+ // intent needs both or the active chip is unreadable.
2706
+ intent: {
2707
+ default: {
2708
+ page: 'data-[active=true]:bg-neutral-bolder data-[active=true]:text-on-neutral-bolder'
2709
+ },
2710
+ primary: {
2711
+ page: 'data-[active=true]:bg-primary data-[active=true]:text-on-primary'
2712
+ },
2713
+ secondary: {
2714
+ page: 'data-[active=true]:bg-secondary data-[active=true]:text-on-secondary'
2715
+ },
2716
+ tertiary: {
2717
+ page: 'data-[active=true]:bg-tertiary data-[active=true]:text-on-tertiary'
2718
+ },
2719
+ success: {
2720
+ page: 'data-[active=true]:bg-success data-[active=true]:text-on-success'
2721
+ },
2722
+ warning: {
2723
+ page: 'data-[active=true]:bg-warning data-[active=true]:text-on-warning'
2724
+ },
2725
+ danger: {
2726
+ page: 'data-[active=true]:bg-danger data-[active=true]:text-on-danger'
2727
+ }
2728
+ },
2729
+ // The buttons also carry a real `disabled` attribute, so this is purely
2730
+ // the group-level dimming; `pointer-events-none` covers a consumer's own
2731
+ // element supplied through the `item` block, which the component cannot
2732
+ // disable for them.
2733
+ isDisabled: {
2734
+ true: {
2735
+ base: 'opacity-disabled',
2736
+ list: 'pointer-events-none'
2737
+ }
2738
+ }
2739
+ },
2740
+ defaultVariants: {
2741
+ size: 'md',
2742
+ intent: 'default',
2743
+ isDisabled: false
2744
+ }
2745
+ });
2746
+
2747
+ const tooltip = tv({
2748
+ slots: {
2749
+ // Width is intrinsic so a short label hugs its text, with a cap so a long
2750
+ // one wraps instead of running off the viewport. `origin-*` is keyed off
2751
+ // the resolved placement the content carries as `data-placement`, so the
2752
+ // enter transition grows out of the anchor rather than out of nowhere.
2753
+ 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'],
2754
+ arrow: ''
2755
+ },
2756
+ variants: {
2757
+ size: {
2758
+ sm: {
2759
+ base: 'px-2 py-1 text-label-sm'
2760
+ },
2761
+ md: {
2762
+ base: 'px-2.5 py-1.5 text-label-sm'
2763
+ },
2764
+ lg: {
2765
+ base: 'px-3 py-2 text-label-md'
2766
+ }
2767
+ },
2768
+ // `bg-inherit` on the arrow (see `overlayArrow`) means each intent only
2769
+ // has to state the background once, on `base`. The border is stated on
2770
+ // both `base` and `arrow` for every intent so the two agree at the join:
2771
+ // `default` carries a visible `border-neutral-soft` on each (the arrow's
2772
+ // own shadow-less edge needs a level with more contrast than the body's
2773
+ // `shadow-md` gets away with), and every coloured intent clears both to
2774
+ // `border-transparent`. The body needs this explicitly, not just the
2775
+ // arrow: `Content`'s classNames (`popover.gts`) run this `base` class
2776
+ // through the *`popover`* tv, whose own base carries
2777
+ // `border border-neutral-subtle` (`popover.ts`) -- twMerge only drops
2778
+ // that when a later class from the same border-color group replaces it,
2779
+ // so a coloured intent with no border class of its own left that
2780
+ // neutral border showing on the body while the arrow (fixed here to
2781
+ // `border-transparent`) went invisible, a visible seam at the join.
2782
+ intent: {
2783
+ default: {
2784
+ base: 'bg-surface-input text-on-surface-input border border-neutral-soft',
2785
+ arrow: 'border-neutral-soft'
2786
+ },
2787
+ primary: {
2788
+ base: 'bg-primary text-on-primary border-transparent',
2789
+ arrow: 'border-transparent'
2790
+ },
2791
+ secondary: {
2792
+ base: 'bg-secondary text-on-secondary border-transparent',
2793
+ arrow: 'border-transparent'
2794
+ },
2795
+ tertiary: {
2796
+ base: 'bg-tertiary text-on-tertiary border-transparent',
2797
+ arrow: 'border-transparent'
2798
+ },
2799
+ success: {
2800
+ base: 'bg-success text-on-success border-transparent',
2801
+ arrow: 'border-transparent'
2802
+ },
2803
+ warning: {
2804
+ base: 'bg-warning text-on-warning border-transparent',
2805
+ arrow: 'border-transparent'
2806
+ },
2807
+ danger: {
2808
+ base: 'bg-danger text-on-danger border-transparent',
2809
+ arrow: 'border-transparent'
2810
+ }
2811
+ }
2812
+ },
2813
+ defaultVariants: {
2814
+ size: 'md',
2815
+ intent: 'default'
2816
+ }
2817
+ });
2818
+
2819
+ const notificationsContainer = tv({
2820
+ slots: {
2821
+ base: ['fixed z-1000 w-full max-w-lg px-4 py-4 pointer-events-none'],
2822
+ 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']
2823
+ },
2824
+ variants: {
2825
+ placement: {
2826
+ 'top-left': {
2827
+ base: 'top-0 left-0'
2828
+ },
2829
+ 'top-center': {
2830
+ base: 'top-0 left-2/4 translate-x-[-50%]'
2831
+ },
2832
+ 'top-right': {
2833
+ base: 'top-0 right-0'
2834
+ },
2835
+ 'bottom-left': {
2836
+ base: 'bottom-0 left-0'
2837
+ },
2838
+ 'bottom-center': {
2839
+ base: 'bottom-0 left-2/4 translate-x-[-50%]'
2840
+ },
2841
+ 'bottom-right': {
2842
+ base: 'bottom-0 right-0'
2843
+ }
2844
+ }
2845
+ },
2846
+ defaultVariants: {
2847
+ placement: 'bottom-right'
2848
+ }
2849
+ });
2850
+
2851
+ const notificationCard = tv({
2852
+ slots: {
2853
+ // The outer element. It carries the box treatment (surface color,
2854
+ // border, rounded corners, shadow) and everything the stack's geometry
2855
+ // animates (`transform`, `opacity`, and — while collapsed — a clamped
2856
+ // `height` so a taller card behind the front one can't poke out past
2857
+ // it). `overflow-hidden` here is what makes that clamp actually crop
2858
+ // the content instead of just failing to contain it.
2859
+ //
2860
+ // Deliberately NOT a flex container and NOT where padding/gap live:
2861
+ // the `ResizeObserver` in notification-card.gts measures `inner`, not
2862
+ // `base`, specifically so the reported height is always the content's
2863
+ // true natural height, never the clamped one `base` might be wearing
2864
+ // at the time. Move layout classes here and that guarantee breaks.
2865
+ 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)]',
2866
+ // The three `transition-duration` values line up positionally with
2867
+ // `transition-[transform,opacity,height]` above: transform and height
2868
+ // are the stack's own expand/collapse choreography, fixed at 400ms to
2869
+ // match the container's own height transition (see
2870
+ // notifications-container.gts) and the design spec's "transform
2871
+ // 400ms"; the middle value is the one `@transitionDuration` actually
2872
+ // governs (the enter/exit fade), supplied via the
2873
+ // `--frontile-toast-fade` custom property the card sets inline (see
2874
+ // notification-card.gts's `style` getter). Both the property order
2875
+ // and the duration ownership live here in one place so they can never
2876
+ // drift apart across the component boundary.
2877
+ '[transition-duration:400ms,_var(--frontile-toast-fade,_200ms),_400ms]', 'motion-reduce:transition-[opacity] motion-reduce:duration-150',
2878
+ // Dropping the transition above only makes the transform apply
2879
+ // instantly instead of animating it — the transform itself (the
2880
+ // stack's slide/scale choreography) still comes from notification-card.gts's
2881
+ // `style` getter as an *inline* `transform:` declaration, so it would
2882
+ // still be present, just un-animated. An inline style normally wins
2883
+ // over any stylesheet rule regardless of that rule's specificity, but
2884
+ // `!important` is the one thing that overrides it — Tailwind v4 marks
2885
+ // a utility `!important` with a trailing `!`, which is exactly what's
2886
+ // needed here. This neutralizes every transform (enter/exit slide,
2887
+ // and the stack's hover-expand translate/scale) under
2888
+ // `prefers-reduced-motion`, matching the spec's "drops all
2889
+ // transforms", entirely in CSS with no JS branching required.
2890
+ 'motion-reduce:transform-none!'],
2891
+ // The inner element. Holds the actual row layout (icon, content,
2892
+ // actions, close button) and is never height-constrained, so its
2893
+ // `offsetHeight` is always the card's true natural height — that's
2894
+ // the value the measure modifier reads and reports to the stack.
2895
+ inner: 'flex gap-3 p-4 font-body text-body-2xs',
2896
+ icon: 'shrink-0 size-5',
2897
+ // The loading spinner's own slot, distinct from `icon`. It must NOT
2898
+ // reuse `icon` — `icon`'s intent-coloured `text-*` class (the compound
2899
+ // variants below) would win the Tailwind-merge over the Spinner's own
2900
+ // dim `text-neutral-muted` track, making the arc and track nearly
2901
+ // identical and the spin unreadable. `size-5` matches `icon` exactly so
2902
+ // a promise settling (spinner -> icon) never resizes the card. The arc
2903
+ // colour comes from `@intent` passed to <Spinner>, not from this slot;
2904
+ // this slot only ever supplies sizing/position and, where needed
2905
+ // (solid variant below), an explicit track/arc override.
2906
+ spinner: 'shrink-0 size-5',
2907
+ content: 'grow min-w-0 flex flex-col gap-1',
2908
+ title: 'font-label text-label-xs',
2909
+ description: 'text-body-2xs',
2910
+ customActions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
2911
+ customActionButton: '',
2912
+ closeButton: statusRowCloseButton
2913
+ },
2914
+ variants: {
2915
+ intent: {
2916
+ default: {},
2917
+ info: {},
2918
+ success: {},
2919
+ warning: {},
2920
+ danger: {}
2921
+ },
2922
+ variant: {
2923
+ // `text-neutral` (the DEFAULT level) is only ~3:1 against a light
2924
+ // surface — below the 4.5:1 WCAG AA floor these labels need at this
2925
+ // size. `text-neutral-firm` clears it comfortably against every
2926
+ // surface this description can sit on, light or dark, tonal or not.
2927
+ // See packages/frontile/docs/notifications-usage.md's contrast note for the measured ratios.
2928
+ default: {
2929
+ base: 'bg-surface-modal border-surface-overlay-mild',
2930
+ description: 'text-neutral-firm'
2931
+ },
2932
+ // The outer surface/border is intent-independent — every `tonal`
2933
+ // compound variant below borrows the same neutral surface `default`
2934
+ // uses (see the comment above the `tonal` compound variants), so it
2935
+ // lives here once instead of repeating in each of them.
2936
+ tonal: {
2937
+ base: 'bg-surface-modal border-surface-overlay-mild',
2938
+ description: 'text-neutral-firm'
2939
+ },
2940
+ solid: {
2941
+ base: 'border-transparent'
2942
+ }
2943
+ },
2944
+ // With a description, the icon centres on the *title's* line box rather
2945
+ // than the whole (now two-line) card — hence the negative offset.
2946
+ hasDescription: {
2947
+ true: {
2948
+ inner: 'items-start',
2949
+ icon: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]',
2950
+ spinner: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]'
2951
+ },
2952
+ false: {
2953
+ inner: 'items-center'
2954
+ }
2955
+ },
2956
+ // Cards are pinned to the placement edge so the stack grows away from
2957
+ // it, once the container has supplied stack geometry (`@geometry` on
2958
+ // <NotificationCard>). `none` is the default — a card rendered without
2959
+ // geometry (e.g. a standalone demo) keeps its normal document flow.
2960
+ // The dynamic parts of the stack's positioning (transform, opacity,
2961
+ // height, z-index, transform-origin) still come from the card's own
2962
+ // inline `style` getter, since they change per-frame with the stack's
2963
+ // geometry — only the static edge-pinning lives here.
2964
+ stackPlacement: {
2965
+ top: {
2966
+ base: 'absolute inset-x-0 top-0'
2967
+ },
2968
+ bottom: {
2969
+ base: 'absolute inset-x-0 bottom-0'
2970
+ },
2971
+ none: {}
2972
+ }
2973
+ },
2974
+ compoundVariants: [
2975
+ // default: neutral surface, colour carried by the icon and title.
2976
+ // `default` intent has no accent — icon and title stay neutral, same
2977
+ // `firm` level the other intents use for their accent text.
2978
+ {
2979
+ variant: 'default',
2980
+ intent: 'default',
2981
+ class: {
2982
+ icon: 'text-neutral-firm',
2983
+ title: 'text-neutral-firm'
2984
+ }
2985
+ }, {
2986
+ variant: 'default',
2987
+ intent: 'info',
2988
+ class: {
2989
+ icon: 'text-primary',
2990
+ title: 'text-primary'
2991
+ }
2992
+ }, {
2993
+ // `success-firm` is only ~2.3:1 on the white card surface in light
2994
+ // mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
2995
+ // contrast note.
2996
+ variant: 'default',
2997
+ intent: 'success',
2998
+ class: {
2999
+ icon: 'text-success-bolder',
3000
+ title: 'text-success-bolder'
3001
+ }
3002
+ }, {
3003
+ // `warning-firm` is only ~3:1 on the white card surface in light
3004
+ // mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
3005
+ // contrast note.
3006
+ variant: 'default',
3007
+ intent: 'warning',
3008
+ class: {
3009
+ icon: 'text-warning-bolder',
3010
+ title: 'text-warning-bolder'
3011
+ }
3012
+ }, {
3013
+ variant: 'default',
3014
+ intent: 'danger',
3015
+ class: {
3016
+ icon: 'text-danger-firm',
3017
+ title: 'text-danger-firm'
3018
+ }
3019
+ },
3020
+ // tonal: same recipe as Button's `appearance: 'tonal'` — an opaque
3021
+ // outer surface (so the floating card never lets page content show
3022
+ // through) with the translucent `{intent}-soft` tint and its `on-*`
3023
+ // contrast ink applied to the *inner* element, which composites over
3024
+ // that opaque surface. The outer picks up the `default` variant's
3025
+ // neutral surface/border instead of a colour-matched one: Button's
3026
+ // tonal has no border at all, but a card floating over arbitrary page
3027
+ // content benefits from the same edge definition `default` already
3028
+ // uses, so it borrows that treatment rather than inventing a new one.
3029
+ {
3030
+ variant: 'tonal',
3031
+ intent: 'default',
3032
+ class: {
3033
+ inner: 'bg-neutral-soft',
3034
+ icon: 'text-on-neutral-soft',
3035
+ title: 'text-on-neutral-soft'
3036
+ }
3037
+ }, {
3038
+ variant: 'tonal',
3039
+ intent: 'info',
3040
+ class: {
3041
+ inner: 'bg-primary-soft',
3042
+ icon: 'text-on-primary-soft',
3043
+ title: 'text-on-primary-soft'
3044
+ }
3045
+ }, {
3046
+ variant: 'tonal',
3047
+ intent: 'success',
3048
+ class: {
3049
+ inner: 'bg-success-soft',
3050
+ icon: 'text-on-success-soft',
3051
+ title: 'text-on-success-soft'
3052
+ }
3053
+ }, {
3054
+ variant: 'tonal',
3055
+ intent: 'warning',
3056
+ class: {
3057
+ inner: 'bg-warning-soft',
3058
+ icon: 'text-on-warning-soft',
3059
+ title: 'text-on-warning-soft'
3060
+ }
3061
+ }, {
3062
+ variant: 'tonal',
3063
+ intent: 'danger',
3064
+ class: {
3065
+ inner: 'bg-danger-soft',
3066
+ icon: 'text-on-danger-soft',
3067
+ title: 'text-on-danger-soft'
3068
+ }
3069
+ },
3070
+ // solid: filled surface, contrast text. `description` uses the
3071
+ // full-strength `on-{intent}` ink rather than a translucent cut — see
3072
+ // packages/frontile/docs/notifications-usage.md's contrast note for why
3073
+ // (a translucent cut used to fail WCAG AA here).
3074
+ //
3075
+ // The spinner override matters because `@intent` on <Spinner> drives its
3076
+ // arc via `fill-{intent}`, the exact same color as this variant's own
3077
+ // `bg-{intent}` surface — left alone the arc would be camouflaged
3078
+ // against its own card, so `solid` forces both halves of the spinner to
3079
+ // the contrast ink instead.
3080
+ {
3081
+ variant: 'solid',
3082
+ intent: 'default',
3083
+ class: {
3084
+ base: 'bg-neutral text-on-neutral',
3085
+ icon: 'text-on-neutral',
3086
+ title: 'text-on-neutral',
3087
+ description: 'text-on-neutral',
3088
+ spinner: 'fill-on-neutral text-on-neutral/30'
3089
+ }
3090
+ }, {
3091
+ variant: 'solid',
3092
+ intent: 'info',
3093
+ class: {
3094
+ base: 'bg-primary text-on-primary',
3095
+ icon: 'text-on-primary',
3096
+ title: 'text-on-primary',
3097
+ description: 'text-on-primary',
3098
+ spinner: 'fill-on-primary text-on-primary/30'
3099
+ }
3100
+ }, {
3101
+ variant: 'solid',
3102
+ intent: 'success',
3103
+ class: {
3104
+ base: 'bg-success text-on-success',
3105
+ icon: 'text-on-success',
3106
+ title: 'text-on-success',
3107
+ description: 'text-on-success',
3108
+ spinner: 'fill-on-success text-on-success/30'
3109
+ }
3110
+ }, {
3111
+ variant: 'solid',
3112
+ intent: 'warning',
3113
+ class: {
3114
+ base: 'bg-warning text-on-warning',
3115
+ icon: 'text-on-warning',
3116
+ title: 'text-on-warning',
3117
+ description: 'text-on-warning',
3118
+ spinner: 'fill-on-warning text-on-warning/30'
3119
+ }
3120
+ }, {
3121
+ variant: 'solid',
3122
+ intent: 'danger',
3123
+ class: {
3124
+ base: 'bg-danger text-on-danger',
3125
+ icon: 'text-on-danger',
3126
+ title: 'text-on-danger',
3127
+ description: 'text-on-danger',
3128
+ spinner: 'fill-on-danger text-on-danger/30'
3129
+ }
3130
+ }],
3131
+ defaultVariants: {
3132
+ intent: 'default',
3133
+ variant: 'default',
3134
+ hasDescription: false,
3135
+ stackPlacement: 'none'
3136
+ }
3137
+ });
3138
+
3139
+ const label = tv({
3140
+ slots: {
3141
+ // label text role (Open Sans semibold, tight leading)
3142
+ base: 'text-neutral-bolder inline-block font-label text-label-sm pb-2',
3143
+ asterisk: 'text-danger'
3144
+ },
3145
+ variants: {
3146
+ size: {
3147
+ sm: {
3148
+ base: 'text-label-2xs'
3149
+ },
3150
+ md: {},
3151
+ lg: {
3152
+ base: 'text-label-md'
3153
+ }
3154
+ }
3155
+ },
3156
+ defaultVariants: {
3157
+ size: 'md'
3158
+ }
3159
+ });
3160
+ const formDescription = tv({
3161
+ // help/description text — body role
3162
+ base: 'text-neutral font-body text-body-2xs pb-1 last:pb-0',
3163
+ variants: {
3164
+ size: {
3165
+ sm: 'text-body-2xs',
3166
+ md: '',
3167
+ lg: 'text-body-sm'
3168
+ }
3169
+ },
3170
+ defaultVariants: {
3171
+ size: 'md'
3172
+ }
3173
+ });
3174
+ const formFeedback = tv({
3175
+ // validation/feedback text — body role
3176
+ base: 'font-body text-body-2xs pt-1',
3177
+ variants: {
3178
+ intent: {
3179
+ primary: 'text-primary',
3180
+ secondary: 'text-secondary',
3181
+ tertiary: 'text-tertiary',
3182
+ success: 'text-success',
3183
+ danger: 'text-danger',
3184
+ warning: 'text-warning'
3185
+ },
3186
+ size: {
3187
+ sm: 'text-body-2xs',
3188
+ md: '',
3189
+ lg: 'text-body-sm'
3190
+ }
3191
+ },
3192
+ defaultVariants: {
3193
+ size: 'sm'
3194
+ }
3195
+ });
3196
+
3197
+ // The visual shell of a form field: background, border, radius, and the
3198
+ // invalid/disabled treatments. Shared by the `input` slot and by `select`'s
3199
+ // `chipsField`, which becomes the shell when chips render beside the trigger.
3200
+ const fieldShell = ['bg-surface-input', 'border', 'border-neutral-soft', 'rounded-xl', 'selection:bg-surface-overlay-soft'];
3201
+ const input = tv({
3202
+ slots: {
3203
+ base: '',
3204
+ innerContainer: 'relative flex',
3205
+ startContent: 'absolute inset-y-0 left-0 flex items-center',
3206
+ endContent: 'absolute inset-y-0 right-0 flex items-center',
3207
+ input: ['appearance-none', 'flex-1', 'w-full', ...fieldShell, 'text-neutral-strong', 'placeholder-neutral',
3208
+ // body role family; single-line controls keep tight leading (not the body relaxed leading)
3209
+ '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']
3210
+ },
3211
+ variants: {
3212
+ size: {
3213
+ sm: {
3214
+ input: 'p-2',
3215
+ startContent: 'pl-2',
3216
+ endContent: 'pr-2'
3217
+ },
3218
+ md: {
3219
+ input: 'p-3',
3220
+ startContent: 'pl-3',
3221
+ endContent: 'pr-3'
3222
+ },
3223
+ lg: {
3224
+ input: 'p-4',
3225
+ startContent: 'pl-4',
3226
+ endContent: 'pr-4'
3227
+ }
3228
+ },
3229
+ hasStartContent: {
3230
+ true: {
3231
+ input: 'ps-8'
3232
+ }
3233
+ },
3234
+ hasEndContent: {
3235
+ true: {
3236
+ input: 'pe-10'
3237
+ }
3238
+ },
3239
+ // When chips render beside the trigger, `chipsField` owns the field shell
3240
+ // and the trigger itself must be visually bare.
3241
+ hasChips: {
3242
+ true: {
3243
+ input: ['border-0', 'bg-transparent', 'p-0', 'w-auto', 'flex-1',
3244
+ // Once chips show the selection the trigger renders nothing at all, so
3245
+ // it has no content to give it a height -- it collapsed to a 0px box
3246
+ // that could not be clicked. Stretching makes it as tall as the chips
3247
+ // sitting next to it, which is the box a pointer needs to hit.
3248
+ 'self-stretch',
3249
+ // No horizontal floor by default: a bare (non-filterable) trigger has
3250
+ // no content of its own, so a floor would only push it onto a second
3251
+ // flex line. `select` puts the floor back for the filterable trigger,
3252
+ // which does need room to type.
3253
+ 'min-w-0', 'focus:ring-0', 'focus:border-transparent']
3254
+ }
3255
+ },
3256
+ startContentPointerEvents: {
3257
+ auto: {
3258
+ startContent: 'pointer-events-auto'
3259
+ },
3260
+ none: {
3261
+ startContent: 'pointer-events-none'
3262
+ }
3263
+ },
3264
+ endContentPointerEvents: {
3265
+ auto: {
3266
+ endContent: 'pointer-events-auto'
3267
+ },
3268
+ none: {
3269
+ endContent: 'pointer-events-none'
3270
+ }
3271
+ }
3272
+ },
3273
+ defaultVariants: {
3274
+ size: 'md'
3275
+ }
3276
+ });
3277
+ const textarea = tv({
3278
+ extend: input,
3279
+ slots: {
3280
+ input: 'min-h-24'
3281
+ },
3282
+ variants: {
3283
+ size: {
3284
+ sm: {},
3285
+ md: {},
3286
+ lg: {}
3287
+ }
3288
+ }
3289
+ });
3290
+
3291
+ // A one-time-code field is one real <input> laid transparently over inert
3292
+ // cells. The input must stay fully opaque -- iOS refuses the long-press Paste
3293
+ // menu on an opacity:0 input -- so every colour is made transparent instead.
3294
+ const inputOtp = tv({
3295
+ slots: {
3296
+ base: '',
3297
+ // pointer-events are inverted: the container ignores the pointer so that a
3298
+ // click anywhere in the widget lands on the input below and resolves to the
3299
+ // nearest character position.
3300
+ container: 'relative flex items-center w-fit pointer-events-none',
3301
+ group: 'flex items-center',
3302
+ cell: [...fieldShell, 'relative flex items-center justify-center', 'font-body tabular-nums text-neutral-strong', 'transition-colors'],
3303
+ cellChar: 'select-none',
3304
+ caret: 'absolute w-px bg-neutral-strong animate-caret-blink motion-reduce:animate-none',
3305
+ separator: 'select-none text-neutral-soft',
3306
+ input: ['absolute inset-y-0 left-0 h-full', 'pointer-events-auto', 'text-left',
3307
+ // Mandatory: opaque element, transparent paint.
3308
+ 'opacity-100', 'text-transparent caret-transparent bg-transparent',
3309
+ // Both halves -- setting only the background leaves the text drawn in the
3310
+ // highlight's foreground colour.
3311
+ 'selection:bg-transparent selection:text-transparent', 'appearance-none border-0 outline-0 shadow-none', 'focus:outline-hidden focus:ring-0',
3312
+ // >= 16px or iOS Safari zooms the page on focus. The negative tracking
3313
+ // collapses the invisible glyphs so they cannot spill past the cells.
3314
+ 'text-base leading-none font-mono tabular-nums tracking-[-0.5em]',
3315
+ // Chromium paints an autofilled field yellow, and the :autofill state
3316
+ // outlives the fill. -webkit-text-fill-color is the property that
3317
+ // actually controls text colour in that state.
3318
+ 'autofill:bg-transparent autofill:shadow-none', 'autofill:[-webkit-text-fill-color:transparent]',
3319
+ // iOS paints selection in a native layer that ignores ::selection, so the
3320
+ // text metrics are compressed further to shrink what it can paint.
3321
+ 'supports-[-webkit-touch-callout:none]:tracking-[-0.6em]', 'supports-[-webkit-touch-callout:none]:font-thin',
3322
+ // Password managers anchor their badge to the INPUT's box, not the
3323
+ // container's, so it would land on the last cell. Reserve a 40px gutter
3324
+ // and clip it back: absolutely positioned, so no layout shift, and
3325
+ // clip-path clips hit-testing too.
3326
+ 'w-[calc(100%+40px)] [clip-path:inset(0_40px_0_0)]',
3327
+ // Keep an injected badge clickable inside the pointer-events-none container.
3328
+ '[&+*]:pointer-events-auto']
3329
+ },
3330
+ variants: {
3331
+ size: {
3332
+ sm: {
3333
+ cell: 'size-9 rounded-lg text-sm',
3334
+ group: 'gap-1.5',
3335
+ separator: 'px-1 text-sm',
3336
+ caret: 'h-4'
3337
+ },
3338
+ md: {
3339
+ cell: 'size-12 text-base',
3340
+ group: 'gap-2',
3341
+ separator: 'px-1.5 text-base',
3342
+ caret: 'h-5'
3343
+ },
3344
+ lg: {
3345
+ cell: 'size-14 text-lg',
3346
+ group: 'gap-2.5',
3347
+ separator: 'px-2 text-lg',
3348
+ caret: 'h-6'
3349
+ }
3350
+ },
3351
+ // z-10 keeps the active cell's ring from being clipped by its neighbour.
3352
+ isActive: {
3353
+ true: {
3354
+ cell: 'z-10 border-primary-soft ring-3 ring-focus'
3355
+ }
3356
+ },
3357
+ // Mirrors `input`'s `aria-invalid:focus:ring-danger-soft`: a focused invalid
3358
+ // cell must ring red, not keep the neutral focus ring.
3359
+ isInvalid: {
3360
+ true: {
3361
+ cell: 'border-danger-soft ring-danger-soft'
3362
+ }
3363
+ },
3364
+ isDisabled: {
3365
+ true: {
3366
+ cell: 'border-neutral-subtle text-neutral-soft'
3367
+ }
3368
+ }
3369
+ },
3370
+ defaultVariants: {
3371
+ size: 'md'
3372
+ }
3373
+ });
3374
+ const checkboxRadioBase = tv({
3375
+ slots: {
3376
+ base: ['max-w-fit flex items-center justify-start'],
3377
+ 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],
3378
+ labelContainer: ['flex flex-col ml-2'],
3379
+ label: 'font-body text-body-xs pb-0'
3380
+ },
3381
+ variants: {
3382
+ size: {
3383
+ sm: {
3384
+ input: 'h-4 w-4'
3385
+ },
3386
+ md: {
3387
+ input: 'h-5 w-5'
3388
+ },
3389
+ lg: {
3390
+ input: 'h-6 w-6'
3391
+ }
3392
+ }
3393
+ },
3394
+ defaultVariants: {
3395
+ size: 'md'
3396
+ }
3397
+ });
3398
+ const checkboxRadioGroupBase = tv({
3399
+ slots: {
3400
+ base: '',
3401
+ optionsContainer: ['flex flex-col flex-wrap gap-4 data-[orientation=horizontal]:flex-row'],
3402
+ label: 'pb-2'
3403
+ },
3404
+ variants: {
3405
+ size: {
3406
+ sm: '',
3407
+ md: '',
3408
+ lg: ''
3409
+ }
3410
+ }
3411
+ });
3412
+ const checkbox = tv({
3413
+ extend: checkboxRadioBase,
3414
+ slots: {
3415
+ input: ['checked-bg-checkbox', 'indeterminate-bg-checkbox', 'rounded-sm', 'checked:bg-primary checked:border-primary',
3416
+ // Indeterminate state styles - show minus/dash icon
3417
+ 'indeterminate:bg-primary', 'indeterminate:border-primary', 'indeterminate:bg-origin-border', 'indeterminate:bg-center', 'indeterminate:bg-no-repeat']
3418
+ },
3419
+ variants: {
3420
+ size: {
3421
+ sm: {},
3422
+ md: {},
3423
+ lg: {}
3424
+ }
3425
+ },
3426
+ defaultVariants: {
3427
+ size: 'md'
3428
+ }
3429
+ });
3430
+ const radio = tv({
3431
+ extend: checkboxRadioBase,
3432
+ slots: {
3433
+ input: ['checked-bg-radio', 'rounded-full', 'checked:bg-primary checked:border-primary']
3434
+ },
3435
+ variants: {
3436
+ size: {
3437
+ sm: {},
3438
+ md: {},
3439
+ lg: {}
3440
+ }
3441
+ },
3442
+ defaultVariants: {
3443
+ size: 'md'
3444
+ }
3445
+ });
3446
+ const radioGroup = tv({
3447
+ extend: checkboxRadioGroupBase
3448
+ });
3449
+ const checkboxGroup = tv({
3450
+ extend: checkboxRadioGroupBase
3451
+ });
3452
+ const select = tv({
3453
+ extend: input,
3454
+ slots: {
3455
+ base: [],
3456
+ placeholder: 'text-neutral',
3457
+ listbox: 'scroll-py-6 max-h-64',
3458
+ icon: 'w-5 h-5',
3459
+ clearButton: 'pointer-events-auto',
3460
+ input: '[button]:cursor-default',
3461
+ emptyContent: 'p-2',
3462
+ // The wrapper around the trigger. It is rendered in every mode; the
3463
+ // `hasChips` variant below decides whether it is the field shell or a
3464
+ // transparent passthrough. Authored here rather than as literal classes in
3465
+ // the component template because Tailwind does not scan
3466
+ // `packages/frontile/src`.
3467
+ chipsField: '',
3468
+ chipsContainer: 'flex flex-wrap items-center gap-1 min-w-0',
3469
+ chip: ''
3470
+ },
3471
+ variants: {
3472
+ size: {
3473
+ sm: {},
3474
+ md: {},
3475
+ lg: {}
3476
+ },
3477
+ // When chips render, `chipsField` becomes the field shell in place of the
3478
+ // trigger's own border (see the `hasChips` variant on `input`), and owns the
3479
+ // padding. Otherwise it is a transparent, full-width flex passthrough: the
3480
+ // shell stays on the trigger, but the wrapper is still a real box, so it can
3481
+ // be measured as the popover's width reference in both modes.
3482
+ //
3483
+ // `data-invalid` / `data-disabled` are set by the component because
3484
+ // `aria-invalid:` and `disabled:` only match the element carrying them.
3485
+ hasChips: {
3486
+ true: {
3487
+ 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']
3488
+ },
3489
+ false: {
3490
+ chipsField: 'flex w-full min-w-0'
3491
+ }
3492
+ },
3493
+ // Whether the trigger is a filterable text input rather than a bare button.
3494
+ // Only affects how much horizontal room the trigger reserves in chips mode.
3495
+ isFilterable: {
3496
+ true: {},
3497
+ false: {}
3498
+ }
3499
+ },
3500
+ compoundVariants: [
3501
+ // Padding belongs to whichever element is the field shell, so it is applied
3502
+ // to `chipsField` only in chips mode -- in passthrough mode the wrapper has
3503
+ // to add no geometry of its own.
3504
+ // The `min-h-*` values are the height of the same-size text field
3505
+ // (padding + line box + border), so a chips field is exactly as tall as a
3506
+ // single-select one, does not change height as the first chip arrives, and
3507
+ // absorbs the flex gap when the trigger wraps below the chips.
3508
+ // No gap between the chips and the trigger: the chips carry their own gap,
3509
+ // and a gap here is space the trigger has to fit into before it is allowed
3510
+ // to stay on the chips' line. With `gap-0` a trigger that does have to wrap
3511
+ // (the chips already fill the row) costs no vertical space at all.
3512
+ {
3513
+ hasChips: true,
3514
+ size: 'sm',
3515
+ class: {
3516
+ chipsField: 'p-1 gap-0 min-h-9.5'
3517
+ }
3518
+ }, {
3519
+ hasChips: true,
3520
+ size: 'md',
3521
+ class: {
3522
+ chipsField: 'p-1.5 gap-0 min-h-11.5'
3523
+ }
3524
+ }, {
3525
+ hasChips: true,
3526
+ size: 'lg',
3527
+ class: {
3528
+ chipsField: 'p-2 gap-0 min-h-13.5'
3529
+ }
3530
+ },
3531
+ // Chips have to clear the absolutely-positioned start/end content the same
3532
+ // way a bare `input` does, otherwise they run underneath the chevron and the
3533
+ // clear button.
3534
+ {
3535
+ hasChips: true,
3536
+ hasStartContent: true,
3537
+ class: {
3538
+ chipsField: 'ps-8'
3539
+ }
3540
+ }, {
3541
+ hasChips: true,
3542
+ hasEndContent: true,
3543
+ class: {
3544
+ chipsField: 'pe-10'
3545
+ }
3546
+ },
3547
+ // ...and once `chipsField` reserves that room, the bare trigger inside it
3548
+ // must not reserve it a second time.
3549
+ {
3550
+ hasChips: true,
3551
+ hasStartContent: true,
3552
+ class: {
3553
+ input: 'ps-0'
3554
+ }
3555
+ }, {
3556
+ hasChips: true,
3557
+ hasEndContent: true,
3558
+ class: {
3559
+ input: 'pe-0'
3560
+ }
3561
+ },
3562
+ // Only the filterable trigger needs typing room -- and, since the field
3563
+ // itself no longer sets a gap, its own separation from the last chip.
3564
+ // See `min-w-0` and `gap-0` above.
3565
+ {
3566
+ hasChips: true,
3567
+ isFilterable: true,
3568
+ class: {
3569
+ input: 'min-w-16 ms-1'
3570
+ }
3571
+ }],
3572
+ defaultVariants: {
3573
+ size: 'md'
3574
+ }
3575
+ });
3576
+
3577
+ // Note: extends `input` rather than `select` because tailwind-variants
3578
+ // loses inherited slot types across two levels of `extend`.
3579
+ const autocomplete = tv({
3580
+ extend: input,
3581
+ slots: {
3582
+ base: [],
3583
+ listbox: 'scroll-py-6 max-h-64',
3584
+ icon: 'w-5 h-5',
3585
+ clearButton: 'pointer-events-auto',
3586
+ input: 'cursor-text',
3587
+ emptyContent: 'p-2'
3588
+ },
3589
+ variants: {
3590
+ size: {
3591
+ sm: {},
3592
+ md: {},
3593
+ lg: {}
3594
+ }
3595
+ },
3596
+ defaultVariants: {
3597
+ size: 'md'
3598
+ }
3599
+ });
3600
+ const nativeSelect = tv({
3601
+ extend: input,
3602
+ slots: {
3603
+ input: ['appearance-none'],
3604
+ icon: 'w-5 h-5'
3605
+ },
3606
+ variants: {
3607
+ size: {
3608
+ sm: {},
3609
+ md: {},
3610
+ lg: {}
3611
+ }
3612
+ }
3613
+ });
3614
+ const switchInput = tv({
3615
+ slots: {
3616
+ base: 'group relative max-w-fit inline-flex items-center justify-start',
3617
+ labelContainer: 'flex flex-col ml-2',
3618
+ label: 'font-body text-body-xs pb-0',
3619
+ 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',
3620
+ // `transition-background` is not a Tailwind v4 utility -- it compiled to
3621
+ // nothing. The wrapper's fill is swapped by `group-data-[selected]:bg-*`,
3622
+ // so background-color is what needs to ease.
3623
+ 'transition-colors', ...focusVisibleWithinRing],
3624
+ 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'],
3625
+ thumb: ['z-10', 'flex', 'items-center', 'justify-center', 'bg-white', 'shadow-small', 'rounded-full', 'origin-right', 'transition-all', 'pointer-events-none', 'text-black'],
3626
+ startContent: ['z-0 absolute start-1.5 text-current', 'opacity-0', 'scale-50',
3627
+ // Tailwind v4 compiles `scale-*` to the standalone `scale` property, not
3628
+ // to `transform`; `transform` stays listed for consumers who override
3629
+ // @classes.startContent and position with it.
3630
+ 'transition-[transform,scale,opacity]', 'group-data-[selected=true]:scale-100', 'group-data-[selected=true]:opacity-100'],
3631
+ endContent: ['z-0 absolute end-1.5 text-neutral', 'opacity-100',
3632
+ // Likewise `translate-x-*` compiles to the standalone `translate`
3633
+ // property -- without it listed, this content snapped instead of sliding.
3634
+ 'transition-[transform,translate,opacity]', 'group-data-[selected=true]:translate-x-3', 'group-data-[selected=true]:opacity-0']
3635
+ },
3636
+ variants: {
3637
+ isDisabled: {
3638
+ true: {
3639
+ wrapper: 'opacity-disabled pointer-events-none'
3640
+ }
3641
+ },
3642
+ size: {
3643
+ sm: {
3644
+ wrapper: 'w-6 h-3 px-[2px]',
3645
+ thumb: ['w-2 h-2 text-xs', 'group-data-[selected=true]:ms-3'],
3646
+ endContent: 'text-xs',
3647
+ startContent: 'text-xs',
3648
+ label: 'text-small'
3649
+ },
3650
+ md: {
3651
+ wrapper: 'w-11 h-6',
3652
+ thumb: ['w-4 h-4 text-sm', 'group-data-[selected=true]:ms-5'],
3653
+ endContent: 'text-sm',
3654
+ startContent: 'text-sm',
3655
+ label: 'text-md'
3656
+ },
3657
+ lg: {
3658
+ wrapper: 'w-12 h-7',
3659
+ thumb: ['w-5 h-5 text-medium', 'group-data-[selected=true]:ms-5'],
3660
+ endContent: 'text-md',
3661
+ startContent: 'text-md',
3662
+ label: 'text-lg'
3663
+ }
3664
+ },
3665
+ intent: {
3666
+ default: {
3667
+ wrapper: ['group-data-[selected=true]:bg-neutral-firm', 'group-data-[selected=true]:text-on-neutral-firm']
3668
+ },
3669
+ primary: {
3670
+ wrapper: ['group-data-[selected=true]:bg-primary', 'group-data-[selected=true]:text-on-primary']
3671
+ },
3672
+ secondary: {
3673
+ wrapper: ['group-data-[selected=true]:bg-secondary', 'group-data-[selected=true]:text-on-secondary']
3674
+ },
3675
+ tertiary: {
3676
+ wrapper: ['group-data-[selected=true]:bg-tertiary', 'group-data-[selected=true]:text-on-tertiary']
3677
+ },
3678
+ success: {
3679
+ wrapper: ['group-data-[selected=true]:bg-success', 'group-data-[selected=true]:text-on-success']
3680
+ },
3681
+ warning: {
3682
+ wrapper: ['group-data-[selected=true]:bg-warning', 'group-data-[selected=true]:text-on-warning']
3683
+ },
3684
+ danger: {
3685
+ wrapper: ['group-data-[selected=true]:bg-danger', 'group-data-[selected=true]:text-on-danger']
3686
+ }
3687
+ }
3688
+ },
3689
+ defaultVariants: {
3690
+ size: 'md',
3691
+ intent: 'primary',
3692
+ isDisabled: false
3693
+ }
3694
+ });
3695
+
3696
+ const base = tv({
3697
+ slots: {
3698
+ base: 'flex flex-wrap flex-row items-center',
3699
+ labelContainer: 'leading-tight flex items-start',
3700
+ inputContainer: 'flex items-center',
3701
+ label: 'font-body text-body-xs pl-2 pb-0',
3702
+ hint: 'pl-2 flex basis-full before:content-["_"] before:inline-block before:w-[1em] before:h-[1em] shrink-0'
3703
+ },
3704
+ variants: {
3705
+ size: {
3706
+ sm: {
3707
+ label: 'text-body-2xs'
3708
+ },
3709
+ md: '',
3710
+ lg: ''
3711
+ }
3712
+ },
3713
+ defaultVariants: {
3714
+ size: 'md'
3715
+ }
3716
+ });
3717
+ const formCheckbox = tv({
3718
+ extend: base,
3719
+ slots: {
3720
+ checkbox: ''
3721
+ }
3722
+ });
3723
+ const formRadio = tv({
3724
+ extend: base,
3725
+ slots: {
3726
+ radio: ''
3727
+ }
3728
+ });
3729
+ const baseGroup = tv({
3730
+ slots: {
3731
+ base: '',
3732
+ label: 'pb-1 last:pb-0',
3733
+ hint: 'pb-1 last:pb-0',
3734
+ feedback: 'pt-0 flex-[1_100%]'
3735
+ },
3736
+ variants: {
3737
+ isInline: {
3738
+ true: {
3739
+ base: 'flex flex-wrap flex-row items-start',
3740
+ label: 'pr-4 pb-0',
3741
+ hint: 'pr-4 pb-0',
3742
+ feedback: 'pr-4 pb-0'
3743
+ }
3744
+ }
3745
+ }
3746
+ });
3747
+ const formCheckboxGroup = tv({
3748
+ extend: baseGroup,
3749
+ slots: {
3750
+ formCheckbox: 'pb-1 last:pb-0'
3751
+ },
3752
+ variants: {
3753
+ isInline: {
3754
+ true: {
3755
+ formCheckbox: 'pr-4 pb-0'
3756
+ }
3757
+ }
3758
+ }
3759
+ });
3760
+ const formRadioGroup = tv({
3761
+ extend: baseGroup,
3762
+ slots: {
3763
+ formRadio: 'pb-1 last:pb-0'
3764
+ },
3765
+ variants: {
3766
+ isInline: {
3767
+ true: {
3768
+ formRadio: 'pr-4 pb-0'
3769
+ }
3770
+ }
3771
+ }
3772
+ });
3773
+ const formInput = tv({
3774
+ slots: {
3775
+ base: 'flex flex-wrap flex-row',
3776
+ label: 'flex-[1_100%]',
3777
+ input: '',
3778
+ hint: 'flex-[1_100%]',
3779
+ feedback: 'flex-[1_100%]'
3780
+ },
3781
+ variants: {
3782
+ size: {
3783
+ sm: '',
3784
+ md: '',
3785
+ lg: ''
3786
+ }
3787
+ },
3788
+ defaultVariants: {
3789
+ size: 'md'
3790
+ }
3791
+ });
3792
+ const formTextarea = tv({
3793
+ extend: formInput
3794
+ });
3795
+ const formSelect = tv({
3796
+ slots: {
3797
+ base: 'flex flex-wrap flex-row',
3798
+ label: 'flex-[1_100%]',
3799
+ select: '',
3800
+ hint: 'flex-[1_100%]',
3801
+ feedback: 'flex-[1_100%]'
3802
+ },
3803
+ variants: {
3804
+ size: {
3805
+ sm: '',
3806
+ md: '',
3807
+ lg: ''
3808
+ }
3809
+ },
3810
+ defaultVariants: {
3811
+ size: 'md'
3812
+ }
3813
+ });
3
3814
 
4
3815
  var components = /*#__PURE__*/Object.freeze({
5
3816
  __proto__: null,
3817
+ accordion: accordion,
3818
+ alert: alert,
6
3819
  autocomplete: autocomplete,
7
3820
  avatar: avatar,
8
3821
  backdrop: backdrop,
9
3822
  button: button,
10
3823
  buttonGroup: buttonGroup,
3824
+ buttonSpinner: buttonSpinner,
3825
+ calendar: calendar,
11
3826
  checkbox: checkbox,
12
3827
  checkboxGroup: checkboxGroup,
13
3828
  chip: chip,
14
3829
  closeButton: closeButton,
3830
+ command: command,
3831
+ commandDialog: commandDialog,
15
3832
  divider: divider,
16
3833
  drawer: drawer,
17
3834
  dropdownContent: dropdownContent,
3835
+ externalLink: externalLink,
18
3836
  formCheckbox: formCheckbox,
19
3837
  formCheckboxGroup: formCheckboxGroup,
20
3838
  formDescription: formDescription,
@@ -25,26 +3843,34 @@ var components = /*#__PURE__*/Object.freeze({
25
3843
  formSelect: formSelect,
26
3844
  formTextarea: formTextarea,
27
3845
  input: input,
3846
+ inputOtp: inputOtp,
3847
+ kbd: kbd,
28
3848
  label: label,
29
3849
  listbox: listbox,
3850
+ listboxGroup: listboxGroup,
30
3851
  listboxItem: listboxItem,
31
3852
  modal: modal,
32
3853
  nativeSelect: nativeSelect,
33
3854
  notificationCard: notificationCard,
34
- notificationTransitions: notificationTransitions,
35
3855
  notificationsContainer: notificationsContainer,
36
3856
  overlay: overlay,
3857
+ overlayArrow: overlayArrow,
37
3858
  overlayTransitions: overlayTransitions,
3859
+ pagination: pagination,
38
3860
  popover: popover,
39
3861
  progressBar: progressBar,
40
3862
  radio: radio,
41
3863
  radioGroup: radioGroup,
3864
+ segmentedControl: segmentedControl,
42
3865
  select: select,
3866
+ skeleton: skeleton,
43
3867
  spinner: spinner,
44
3868
  switchInput: switchInput,
45
3869
  table: table,
3870
+ tabs: tabs,
46
3871
  textarea: textarea,
47
- toggleButton: toggleButton
3872
+ toggleButton: toggleButton,
3873
+ tooltip: tooltip
48
3874
  });
49
3875
 
50
3876
  let localStyles = components;
@@ -58,5 +3884,5 @@ function useStyles() {
58
3884
  return localStyles;
59
3885
  }
60
3886
 
61
- export { registerCustomStyles, useStyles };
3887
+ export { registerCustomStyles, tv, useStyles };
62
3888
  //# sourceMappingURL=index.js.map