@frontile/theme 0.18.0-alpha.15 → 0.18.0-alpha.17

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 (41) hide show
  1. package/declarations/colors/util.d.ts +2 -1
  2. package/declarations/colors.d.ts +1 -0
  3. package/declarations/components/avatar.d.ts +8 -8
  4. package/declarations/components/button.d.ts +89 -41
  5. package/declarations/components/chip.d.ts +8 -8
  6. package/declarations/components/close-button.d.ts +8 -8
  7. package/declarations/components/command.d.ts +281 -0
  8. package/declarations/components/divider.d.ts +8 -8
  9. package/declarations/components/dropdown.d.ts +8 -8
  10. package/declarations/components/forms/forms-legacy.d.ts +96 -96
  11. package/declarations/components/forms/forms.d.ts +431 -173
  12. package/declarations/components/index.d.ts +4 -0
  13. package/declarations/components/kbd.d.ts +315 -0
  14. package/declarations/components/listbox.d.ts +112 -20
  15. package/declarations/components/notification-card.d.ts +181 -112
  16. package/declarations/components/notifications-container.d.ts +110 -41
  17. package/declarations/components/overlays.d.ts +77 -32
  18. package/declarations/components/popover.d.ts +8 -8
  19. package/declarations/components/progress-bar.d.ts +8 -8
  20. package/declarations/components/segmented-control.d.ts +463 -0
  21. package/declarations/components/skeleton.d.ts +8 -8
  22. package/declarations/components/spinner.d.ts +8 -8
  23. package/declarations/components/table.d.ts +9 -9
  24. package/declarations/components/tabs.d.ts +463 -0
  25. package/declarations/tw.d.ts +8 -8
  26. package/dist/colors.js +2 -1
  27. package/dist/colors.js.map +1 -1
  28. package/dist/index.js +2999 -4
  29. package/dist/index.js.map +1 -1
  30. package/dist/overlays-aq0rSm6R.js +372 -0
  31. package/dist/overlays-aq0rSm6R.js.map +1 -0
  32. package/dist/plugin.js +6 -42
  33. package/dist/plugin.js.map +1 -1
  34. package/dist/{config-BZyMPeuH.js → util-CHV5ZmrC.js} +40 -2
  35. package/dist/util-CHV5ZmrC.js.map +1 -0
  36. package/package.json +2 -2
  37. package/src/index.css +17 -0
  38. package/src/styles/typography.css +27 -22
  39. package/dist/config-BZyMPeuH.js.map +0 -1
  40. package/dist/forms-legacy-9Umui1Bp.js +0 -2363
  41. package/dist/forms-legacy-9Umui1Bp.js.map +0 -1
@@ -1,2363 +0,0 @@
1
- import { extendTailwindMerge } from 'tailwind-merge';
2
- import { createTV } from 'tailwind-variants';
3
-
4
- function flat(arr, target) {
5
- arr.forEach(el => {
6
- if (Array.isArray(el)) {
7
- flat(el, target);
8
- } else {
9
- target.push(el);
10
- }
11
- });
12
- }
13
- function flatArray(arr) {
14
- const flattened = [];
15
- flat(arr, flattened);
16
- return flattened;
17
- }
18
- const voidEmpty = value => value ? value : undefined;
19
- const clsx = (...classes) => {
20
- return voidEmpty(flatArray(classes).filter(Boolean).join(' '));
21
- };
22
-
23
- // Common size units used across all design tokens (icons, typography, etc.)
24
- const COMMON_UNITS = ['pico', 'nano', 'micro', '3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', 'kilo', 'mega'];
25
- const ELEVATION_LEVELS = ['0', '1', '2', '3', '4', '5'];
26
- const twMergeConfig = {
27
- extend: {
28
- classGroups: {
29
- // Icon sizes
30
- 'icon-size': [{
31
- 'size-icon': COMMON_UNITS
32
- }],
33
- // Border widths (directional variants handled automatically)
34
- 'border-w': [{
35
- border: ['thin', 'heavy', 'aggressive']
36
- }],
37
- // Border radius (extend existing rounded utilities)
38
- rounded: [{
39
- rounded: ['default', 'pill']
40
- }],
41
- // Elevation shadows
42
- shadow: [{
43
- 'shadow-elevation': ELEVATION_LEVELS
44
- }],
45
- // Opacity
46
- opacity: [{
47
- opacity: ['hover', 'disabled']
48
- }],
49
- // Typography composite text styles (extend font-size class group)
50
- // These set font-size + other properties, so they should conflict with text-* utilities
51
- 'font-size': [{
52
- 'text-marquee': [...COMMON_UNITS]
53
- }, {
54
- 'text-header': [...COMMON_UNITS]
55
- }, {
56
- 'text-body': [...COMMON_UNITS]
57
- },
58
- // `strong` was missing here, so `text-strong-*` fell through to the
59
- // text-color group and tailwind-merge dropped it whenever a component
60
- // also set a text color (e.g. Button's `text-on-primary`) — silently
61
- // losing the label's size, weight and tracking.
62
- {
63
- 'text-strong': [...COMMON_UNITS]
64
- }, {
65
- 'text-code': [...COMMON_UNITS]
66
- }, {
67
- 'text-caption': [...COMMON_UNITS]
68
- }, {
69
- 'text-label': [...COMMON_UNITS]
70
- }]
71
- },
72
- conflictingClassGroups: {
73
- 'icon-size': ['w', 'h', 'size']
74
- }
75
- }
76
- };
77
- const twMergeBase = extendTailwindMerge(twMergeConfig);
78
- function twMerge(defaultClass, overwrites) {
79
- if (overwrites) {
80
- return twMergeBase(clsx(defaultClass, overwrites));
81
- }
82
- return clsx(defaultClass);
83
- }
84
- const tv = createTV({
85
- twMerge: true,
86
- twMergeConfig
87
- });
88
-
89
- const avatar = tv({
90
- slots: {
91
- 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'],
92
- img: 'size-full',
93
- 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']
94
- },
95
- variants: {
96
- shape: {
97
- square: 'rounded-[20%]',
98
- circle: 'rounded-full'
99
- },
100
- size: {
101
- xs: {
102
- base: 'size-5 text-label-2xs'
103
- },
104
- sm: {
105
- base: 'size-6 text-label-xs'
106
- },
107
- md: {
108
- base: 'size-8 text-label-sm'
109
- },
110
- lg: {
111
- base: 'size-10 text-label-md'
112
- },
113
- xl: {
114
- base: 'size-12 text-label-lg'
115
- }
116
- }
117
- },
118
- defaultVariants: {
119
- size: 'md',
120
- shape: 'circle'
121
- }
122
- });
123
-
124
- 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'];
125
- 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'];
126
-
127
- const baseButton = tv({
128
- base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
129
- variants: {
130
- appearance: {
131
- outlined: ''
132
- },
133
- intent: {
134
- default: '',
135
- primary: 'focus-visible:ring-primary-soft',
136
- secondary: 'focus-visible:ring-secondary-soft',
137
- tertiary: 'focus-visible:ring-tertiary-soft',
138
- success: 'focus-visible:ring-success-soft',
139
- warning: 'focus-visible:ring-warning-soft',
140
- danger: 'focus-visible:ring-danger-soft'
141
- },
142
- size: {
143
- xs: 'text-strong-sm px-4 py-1 gap-1 rounded-full',
144
- sm: 'text-strong-md px-5 py-1.5 gap-1 rounded-full',
145
- md: 'text-strong-lg px-6 py-2 gap-1.5 rounded-full',
146
- lg: 'text-strong-xl px-8 py-2.5 gap-1.5 rounded-full',
147
- xl: 'text-strong-2xl px-10 py-3 gap-2 rounded-full',
148
- '2xl': 'text-strong-3xl px-12 py-3.5 gap-2.5 rounded-full'
149
- },
150
- isInGroup: {
151
- 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']
152
- }
153
- },
154
- compoundVariants: [{
155
- appearance: 'outlined',
156
- intent: 'default',
157
- 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'
158
- }, {
159
- appearance: 'outlined',
160
- intent: 'primary',
161
- class: 'text-primary border-primary hover:text-primary-mild hover:border-primary-mild active:text-primary-firm active:border-primary-firm'
162
- }, {
163
- appearance: 'outlined',
164
- intent: 'secondary',
165
- class: 'text-secondary-strong border-secondary-strong hover:text-secondary-firm hover:border-secondary-firm active:text-secondary-bolder active:border-secondary-bolder'
166
- }, {
167
- appearance: 'outlined',
168
- intent: 'tertiary',
169
- class: 'text-tertiary-strong border-tertiary-strong hover:text-tertiary-firm hover:border-tertiary-firm active:text-tertiary-bolder active:border-tertiary-bolder'
170
- }, {
171
- appearance: 'outlined',
172
- intent: 'success',
173
- class: 'text-success-strong border-success-strong hover:text-success-firm hover:border-success-firm active:text-success-bolder active:border-success-bolder'
174
- }, {
175
- appearance: 'outlined',
176
- intent: 'warning',
177
- class: 'text-warning-strong border-warning-strong hover:text-warning-firm hover:border-warning-firm active:text-warning-bolder active:border-warning-bolder'
178
- }, {
179
- appearance: 'outlined',
180
- intent: 'danger',
181
- class: 'text-danger border-danger hover:text-danger-mild hover:border-danger-mild active:text-danger-firm active:border-danger-firm'
182
- }],
183
- defaultVariants: {
184
- size: 'md',
185
- intent: 'default'
186
- }
187
- });
188
- const button = tv({
189
- extend: baseButton,
190
- base: [''],
191
- variants: {
192
- appearance: {
193
- default: 'shadow-elevation-2',
194
- soft: '',
195
- outlined: '',
196
- minimal: '',
197
- tonal: 'shadow-elevation-2',
198
- custom: ''
199
- }
200
- },
201
- compoundVariants: [
202
- // APPEARANCE: default (Facet "filled") — fill + border + on-color
203
- {
204
- appearance: 'default',
205
- intent: 'default',
206
- 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'
207
- }, {
208
- appearance: 'default',
209
- intent: 'primary',
210
- 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'
211
- }, {
212
- appearance: 'default',
213
- intent: 'secondary',
214
- 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'
215
- }, {
216
- appearance: 'default',
217
- intent: 'tertiary',
218
- 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'
219
- }, {
220
- appearance: 'default',
221
- intent: 'success',
222
- 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'
223
- }, {
224
- appearance: 'default',
225
- intent: 'warning',
226
- 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'
227
- }, {
228
- appearance: 'default',
229
- intent: 'danger',
230
- 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'
231
- },
232
- // APPEARANCE: soft — tint fill, plus the border Facet gives it
233
- {
234
- appearance: 'soft',
235
- intent: 'default',
236
- 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'
237
- }, {
238
- appearance: 'soft',
239
- intent: 'primary',
240
- 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'
241
- }, {
242
- appearance: 'soft',
243
- intent: 'secondary',
244
- 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'
245
- }, {
246
- appearance: 'soft',
247
- intent: 'tertiary',
248
- 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'
249
- }, {
250
- appearance: 'soft',
251
- intent: 'success',
252
- 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'
253
- }, {
254
- appearance: 'soft',
255
- intent: 'warning',
256
- 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'
257
- }, {
258
- appearance: 'soft',
259
- intent: 'danger',
260
- 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'
261
- },
262
- // APPEARANCE: minimal (Facet "ghost") — ink only, no fill
263
- {
264
- appearance: 'minimal',
265
- intent: 'default',
266
- class: 'text-neutral-bolder hover:text-neutral-firm/80 active:text-neutral-firm'
267
- }, {
268
- appearance: 'minimal',
269
- intent: 'primary',
270
- class: 'text-primary hover:text-primary-mild active:text-primary-firm'
271
- }, {
272
- appearance: 'minimal',
273
- intent: 'secondary',
274
- class: 'text-secondary-strong hover:text-secondary-firm active:text-secondary-bolder'
275
- }, {
276
- appearance: 'minimal',
277
- intent: 'tertiary',
278
- class: 'text-tertiary-strong hover:text-tertiary-firm active:text-tertiary-bolder'
279
- }, {
280
- appearance: 'minimal',
281
- intent: 'success',
282
- class: 'text-success-strong hover:text-success-firm active:text-success-bolder'
283
- }, {
284
- appearance: 'minimal',
285
- intent: 'warning',
286
- class: 'text-warning-strong hover:text-warning-firm active:text-warning-bolder'
287
- }, {
288
- appearance: 'minimal',
289
- intent: 'danger',
290
- class: 'text-danger hover:text-danger-mild active:text-danger-firm'
291
- },
292
- // APPEARANCE: tonal — tint fill that deepens through the ramp
293
- {
294
- appearance: 'tonal',
295
- intent: 'default',
296
- 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'
297
- }, {
298
- appearance: 'tonal',
299
- intent: 'primary',
300
- 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'
301
- }, {
302
- appearance: 'tonal',
303
- intent: 'secondary',
304
- 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'
305
- }, {
306
- appearance: 'tonal',
307
- intent: 'tertiary',
308
- 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'
309
- }, {
310
- appearance: 'tonal',
311
- intent: 'success',
312
- 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'
313
- }, {
314
- appearance: 'tonal',
315
- intent: 'warning',
316
- 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'
317
- }, {
318
- appearance: 'tonal',
319
- intent: 'danger',
320
- 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'
321
- },
322
- // APPEARANCE: custom
323
- {
324
- appearance: 'custom',
325
- intent: 'default',
326
- class: 'text-neutral-strong'
327
- }, {
328
- appearance: 'custom',
329
- intent: 'primary',
330
- class: 'text-primary-strong'
331
- }, {
332
- appearance: 'custom',
333
- intent: 'secondary',
334
- class: 'text-secondary-strong'
335
- }, {
336
- appearance: 'custom',
337
- intent: 'tertiary',
338
- class: 'text-tertiary-strong'
339
- }, {
340
- appearance: 'custom',
341
- intent: 'success',
342
- class: 'text-success-strong'
343
- }, {
344
- appearance: 'custom',
345
- intent: 'warning',
346
- class: 'text-warning-strong'
347
- }, {
348
- appearance: 'custom',
349
- intent: 'danger',
350
- class: 'text-danger-strong'
351
- }],
352
- defaultVariants: {
353
- size: 'md',
354
- intent: 'primary'
355
- }
356
- });
357
- const toggleButton = tv({
358
- extend: baseButton,
359
- base: [''],
360
- variants: {
361
- isSelected: {
362
- true: ''
363
- }
364
- },
365
- // Selected is a *filled* state, so every color has to be restated here —
366
- // fill, border and ink, for the resting, hover and active steps. The
367
- // unselected `outlined` rules in `baseButton` set their own
368
- // `hover:text-*`/`active:*` colors, and anything we leave out keeps leaking
369
- // through: an unselected ink color over a selected fill is what produced the
370
- // unreadable label on hover. The ramp matches the filled button
371
- // (`appearance: 'default'`) — one step deeper on hover, another on active —
372
- // and pairs each fill with its generated `on-*` contrast ink.
373
- compoundVariants: [{
374
- appearance: 'outlined',
375
- intent: 'default',
376
- isSelected: true,
377
- 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'
378
- }, {
379
- appearance: 'outlined',
380
- intent: 'primary',
381
- isSelected: true,
382
- 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'
383
- }, {
384
- appearance: 'outlined',
385
- intent: 'secondary',
386
- isSelected: true,
387
- 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'
388
- }, {
389
- appearance: 'outlined',
390
- intent: 'tertiary',
391
- isSelected: true,
392
- 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'
393
- }, {
394
- appearance: 'outlined',
395
- intent: 'success',
396
- isSelected: true,
397
- 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'
398
- }, {
399
- appearance: 'outlined',
400
- intent: 'warning',
401
- isSelected: true,
402
- 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'
403
- }, {
404
- appearance: 'outlined',
405
- intent: 'danger',
406
- isSelected: true,
407
- 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'
408
- }]
409
- });
410
- const buttonGroup = tv({
411
- base: ['inline-flex items-stretch justify-center h-auto']
412
- });
413
-
414
- const chip = tv({
415
- slots: {
416
- base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border'],
417
- // label text role (size set per size variant)
418
- content: ['flex-1 text-inherit font-label'],
419
- dot: ['shrink-0', 'ml-1', 'rounded-full'],
420
- closeButton: ['shrink-0', 'p-0.5',
421
- // The shared ring is drawn with a background-coloured offset, which
422
- // inside a chip reads as a hole punched in the chip.
423
- 'focus-visible:ring-2 focus-visible:ring-offset-0', 'disabled:cursor-not-allowed']
424
- },
425
- variants: {
426
- isDisabled: {
427
- true: 'opacity-disabled cursor-not-allowed'
428
- },
429
- appearance: {
430
- default: '',
431
- outlined: '',
432
- faded: ''
433
- },
434
- // The close button is a filled circle in every appearance. `-muted` is
435
- // light enough to sit on the page in `outlined`/`faded` and to read as a
436
- // disc on a filled chip, and each level carries its own `on-` colour — the
437
- // pairing this used to get wrong, by putting `text-on-{intent}` (the
438
- // contrast colour for the DEFAULT level) on a `-muted` circle.
439
- intent: {
440
- default: {
441
- dot: 'bg-neutral-strong',
442
- closeButton: 'bg-neutral-muted text-on-neutral-muted'
443
- },
444
- primary: {
445
- dot: 'bg-primary',
446
- closeButton: 'bg-primary-muted text-on-primary-muted'
447
- },
448
- secondary: {
449
- dot: 'bg-secondary',
450
- closeButton: 'bg-secondary-muted text-on-secondary-muted'
451
- },
452
- tertiary: {
453
- dot: 'bg-tertiary',
454
- closeButton: 'bg-tertiary-muted text-on-tertiary-muted'
455
- },
456
- success: {
457
- dot: 'bg-success',
458
- closeButton: 'bg-success-muted text-on-success-muted'
459
- },
460
- warning: {
461
- dot: 'bg-warning',
462
- closeButton: 'bg-warning-muted text-on-warning-muted'
463
- },
464
- danger: {
465
- dot: 'bg-danger',
466
- closeButton: 'bg-danger-muted text-on-danger-muted'
467
- }
468
- },
469
- size: {
470
- sm: {
471
- base: 'text-label-2xs px-1 h-6',
472
- content: 'px-1',
473
- dot: 'size-1.5',
474
- closeButton: 'text-label-2xs'
475
- },
476
- md: {
477
- base: 'text-label-xs px-1 h-7',
478
- content: 'px-2',
479
- dot: 'size-2',
480
- closeButton: 'text-label-xs'
481
- },
482
- lg: {
483
- base: 'text-label-md px-2 h-8',
484
- content: 'px-2',
485
- dot: 'size-2.5',
486
- closeButton: 'text-label-md'
487
- }
488
- },
489
- radius: {
490
- none: 'rounded-none',
491
- sm: 'rounded-sm',
492
- lg: 'rounded-lg',
493
- full: 'rounded-full'
494
- }
495
- },
496
- compoundVariants: [
497
- // A filled chip's background *is* the intent colour, so an intent-coloured
498
- // dot disappears into it. Inherit the chip's text colour instead — the one
499
- // colour guaranteed to contrast the fill.
500
- {
501
- appearance: 'default',
502
- class: {
503
- dot: 'bg-current'
504
- }
505
- },
506
- // APPEARANCE: default (filled)
507
- //
508
- // The chip's own fill is the intent's DEFAULT level, so the close button
509
- // cannot hover *towards* it the way the other two appearances do — the
510
- // circle would vanish into the chip. It steps down to `-subtle` instead.
511
- {
512
- appearance: 'default',
513
- intent: 'default',
514
- class: {
515
- base: 'bg-neutral-bolder text-on-neutral-bolder',
516
- closeButton: 'hover:bg-neutral-subtle hover:text-on-neutral-subtle'
517
- }
518
- }, {
519
- appearance: 'default',
520
- intent: 'primary',
521
- class: {
522
- base: 'bg-primary text-on-primary',
523
- closeButton: 'hover:bg-primary-subtle hover:text-on-primary-subtle'
524
- }
525
- }, {
526
- appearance: 'default',
527
- intent: 'secondary',
528
- class: {
529
- base: 'bg-secondary text-on-secondary',
530
- closeButton: 'hover:bg-secondary-subtle hover:text-on-secondary-subtle'
531
- }
532
- }, {
533
- appearance: 'default',
534
- intent: 'tertiary',
535
- class: {
536
- base: 'bg-tertiary text-on-tertiary',
537
- closeButton: 'hover:bg-tertiary-subtle hover:text-on-tertiary-subtle'
538
- }
539
- }, {
540
- appearance: 'default',
541
- intent: 'success',
542
- class: {
543
- base: 'bg-success text-on-success',
544
- closeButton: 'hover:bg-success-subtle hover:text-on-success-subtle'
545
- }
546
- }, {
547
- appearance: 'default',
548
- intent: 'warning',
549
- class: {
550
- base: 'bg-warning text-on-warning',
551
- closeButton: 'hover:bg-warning-subtle hover:text-on-warning-subtle'
552
- }
553
- }, {
554
- appearance: 'default',
555
- intent: 'danger',
556
- class: {
557
- base: 'bg-danger text-on-danger',
558
- closeButton: 'hover:bg-danger-subtle hover:text-on-danger-subtle'
559
- }
560
- },
561
- // APPEARANCE: faded (tonal)
562
- {
563
- appearance: 'faded',
564
- intent: 'default',
565
- class: {
566
- base: 'text-neutral-strong bg-neutral-subtle',
567
- closeButton: 'hover:bg-neutral hover:text-on-neutral'
568
- }
569
- }, {
570
- appearance: 'faded',
571
- intent: 'primary',
572
- class: {
573
- base: 'text-primary-strong bg-primary-subtle',
574
- closeButton: 'hover:bg-primary hover:text-on-primary'
575
- }
576
- }, {
577
- appearance: 'faded',
578
- intent: 'secondary',
579
- class: {
580
- base: 'text-secondary-strong bg-secondary-subtle',
581
- closeButton: 'hover:bg-secondary hover:text-on-secondary'
582
- }
583
- }, {
584
- appearance: 'faded',
585
- intent: 'tertiary',
586
- class: {
587
- base: 'text-tertiary-strong bg-tertiary-subtle',
588
- closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
589
- }
590
- }, {
591
- appearance: 'faded',
592
- intent: 'success',
593
- class: {
594
- base: 'text-success-strong bg-success-subtle',
595
- closeButton: 'hover:bg-success hover:text-on-success'
596
- }
597
- }, {
598
- appearance: 'faded',
599
- intent: 'warning',
600
- class: {
601
- base: 'text-warning-strong bg-warning-subtle',
602
- closeButton: 'hover:bg-warning hover:text-on-warning'
603
- }
604
- }, {
605
- appearance: 'faded',
606
- intent: 'danger',
607
- class: {
608
- base: 'text-danger-strong bg-danger-subtle',
609
- closeButton: 'hover:bg-danger hover:text-on-danger'
610
- }
611
- },
612
- // APPEARANCE: outlined
613
- {
614
- appearance: 'outlined',
615
- intent: 'default',
616
- class: {
617
- base: 'text-neutral-strong border border-neutral',
618
- closeButton: 'hover:bg-neutral hover:text-on-neutral'
619
- }
620
- }, {
621
- appearance: 'outlined',
622
- intent: 'primary',
623
- class: {
624
- base: 'text-primary-strong border border-primary',
625
- closeButton: 'hover:bg-primary hover:text-on-primary'
626
- }
627
- }, {
628
- appearance: 'outlined',
629
- intent: 'secondary',
630
- class: {
631
- base: 'text-secondary-strong border border-secondary',
632
- closeButton: 'hover:bg-secondary hover:text-on-secondary'
633
- }
634
- }, {
635
- appearance: 'outlined',
636
- intent: 'tertiary',
637
- class: {
638
- base: 'text-tertiary-strong border border-tertiary',
639
- closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
640
- }
641
- }, {
642
- appearance: 'outlined',
643
- intent: 'success',
644
- class: {
645
- base: 'text-success-strong border border-success',
646
- closeButton: 'hover:bg-success hover:text-on-success'
647
- }
648
- }, {
649
- appearance: 'outlined',
650
- intent: 'warning',
651
- class: {
652
- base: 'text-warning-strong border border-warning',
653
- closeButton: 'hover:bg-warning hover:text-on-warning'
654
- }
655
- }, {
656
- appearance: 'outlined',
657
- intent: 'danger',
658
- class: {
659
- base: 'text-danger-strong border border-danger',
660
- closeButton: 'hover:bg-danger hover:text-on-danger'
661
- }
662
- }],
663
- defaultVariants: {
664
- size: 'md',
665
- intent: 'default',
666
- appearance: 'default',
667
- radius: 'full'
668
- }
669
- });
670
-
671
- const progressBar = tv({
672
- slots: {
673
- base: ['overflow-hidden w-full bg-surface-overlay-soft'],
674
- label: ['flex justify-between pb-1 gap-2 font-label text-label-sm'],
675
- progress: [''],
676
- description: ['text-neutral font-body text-body-micro pb-1']
677
- },
678
- variants: {
679
- isIndeterminate: {
680
- true: {
681
- progress: ['animate-loading origin-left']
682
- }
683
- },
684
- intent: {
685
- default: {
686
- progress: 'bg-neutral-strong'
687
- },
688
- primary: {
689
- progress: 'bg-primary-soft'
690
- },
691
- secondary: {
692
- progress: 'bg-secondary-soft'
693
- },
694
- tertiary: {
695
- progress: 'bg-tertiary-soft'
696
- },
697
- success: {
698
- progress: 'bg-success-soft'
699
- },
700
- warning: {
701
- progress: 'bg-warning-soft'
702
- },
703
- danger: {
704
- progress: 'bg-danger-soft'
705
- }
706
- },
707
- size: {
708
- xs: {
709
- base: 'h-1',
710
- progress: 'h-1',
711
- label: 'text-label-2xs',
712
- description: 'text-body-micro'
713
- },
714
- sm: {
715
- base: 'h-2',
716
- progress: 'h-2',
717
- label: 'text-label-xs',
718
- description: 'text-body-2xs'
719
- },
720
- md: {
721
- base: 'h-4',
722
- progress: 'h-4'
723
- },
724
- lg: {
725
- base: 'h-8',
726
- progress: 'h-8',
727
- label: 'text-label-md',
728
- description: 'text-body-sm'
729
- }
730
- },
731
- radius: {
732
- none: 'rounded-none',
733
- sm: 'rounded-sm',
734
- lg: 'rounded-lg',
735
- full: 'rounded-full'
736
- }
737
- },
738
- defaultVariants: {
739
- size: 'md',
740
- intent: 'default',
741
- radius: 'sm'
742
- }
743
- });
744
-
745
- const closeButton = tv({
746
- slots: {
747
- base: ['rounded-full transition transition-200 text-inherit', ...focusVisibleRing],
748
- icon: 'size-[1em]'
749
- },
750
- variants: {
751
- size: {
752
- xs: {
753
- base: 'text-sm p-1'
754
- },
755
- sm: {
756
- base: 'text-base p-2'
757
- },
758
- md: {
759
- base: 'text-xl p-2'
760
- },
761
- lg: {
762
- base: 'text-2xl p-3'
763
- },
764
- xl: {
765
- base: 'text-4xl p-3'
766
- }
767
- },
768
- variant: {
769
- transparent: {
770
- base: ['bg-transparent', 'hover:bg-surface-overlay-subtle']
771
- },
772
- subtle: {
773
- base: ['bg-neutral-subtle', 'text-on-neutral-subtle', 'hover:bg-surface-overlay-subtle']
774
- }
775
- }
776
- },
777
- defaultVariants: {
778
- size: 'md',
779
- variant: 'transparent'
780
- }
781
- });
782
-
783
- const listbox = tv({
784
- base: 'w-full flex flex-col gap-0.5 outline-hidden p-1'
785
- });
786
- const listboxItem = tv({
787
- slots: {
788
- 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'],
789
- descriptionWrapper: 'w-full flex flex-col items-start justify-center',
790
- label: 'flex-1 font-body text-body-2xs truncate',
791
- description: ['w-full', 'font-body text-body-micro', 'text-neutral-firm', 'group-hover:text-current'],
792
- selectedIcon: ['text-inherit', 'w-4', 'h-4', 'shrink-0'],
793
- shortcut: ['px-1', 'py-0.5', 'rounded-sm', 'font-label', 'text-neutral', 'text-label-2xs', 'border', 'border-neutral-soft', 'group-data-is-active:border-current']
794
- },
795
- variants: {
796
- appearance: {
797
- default: {
798
- base: ''
799
- },
800
- outlined: {
801
- base: 'border border-transparent bg-transparent'
802
- },
803
- faded: {
804
- base: ['border border-transparent']
805
- }
806
- },
807
- intent: {
808
- default: {},
809
- primary: {},
810
- secondary: {},
811
- tertiary: {},
812
- success: {},
813
- warning: {},
814
- danger: {}
815
- },
816
- isActive: {
817
- true: {
818
- base: []
819
- }
820
- },
821
- withDivider: {
822
- true: {
823
- base: ['mb-1.5']
824
- }
825
- },
826
- isDisabled: {
827
- true: {
828
- base: 'opacity-disabled pointer-events-none'
829
- }
830
- },
831
- isSelected: {
832
- true: {
833
- base: ''
834
- }
835
- }
836
- },
837
- defaultVariants: {
838
- appearance: 'default',
839
- intent: 'default'
840
- },
841
- compoundVariants: [
842
- // appearance: default
843
- {
844
- appearance: 'default',
845
- intent: 'default',
846
- class: {
847
- base: ['data-is-active:bg-neutral-subtle', 'data-is-active:text-neutral-strong']
848
- }
849
- }, {
850
- appearance: 'default',
851
- intent: 'primary',
852
- class: {
853
- base: ['data-is-active:bg-primary-soft', 'data-is-active:text-on-primary-soft']
854
- }
855
- }, {
856
- appearance: 'default',
857
- intent: 'secondary',
858
- class: {
859
- base: ['data-is-active:bg-secondary-soft', 'data-is-active:text-on-secondary-soft']
860
- }
861
- }, {
862
- appearance: 'default',
863
- intent: 'tertiary',
864
- class: {
865
- base: ['data-is-active:bg-tertiary-soft', 'data-is-active:text-on-tertiary-soft']
866
- }
867
- }, {
868
- appearance: 'default',
869
- intent: 'success',
870
- class: {
871
- base: ['data-is-active:bg-success-soft', 'data-is-active:text-on-success-soft']
872
- }
873
- }, {
874
- appearance: 'default',
875
- intent: 'warning',
876
- class: {
877
- base: ['data-is-active:bg-warning-soft', 'data-is-active:text-on-warning-soft']
878
- }
879
- }, {
880
- appearance: 'default',
881
- intent: 'danger',
882
- class: {
883
- base: ['data-is-active:bg-danger-soft', 'data-is-active:text-on-danger-soft']
884
- }
885
- }, {
886
- appearance: 'default',
887
- intent: 'default',
888
- isActive: true,
889
- class: {
890
- shortcut: ['text-on-neutral', 'border-on-neutral/20']
891
- }
892
- }, {
893
- appearance: 'default',
894
- intent: 'primary',
895
- isActive: true,
896
- class: {
897
- shortcut: ['text-on-primary-soft', 'border-on-primary-soft/20']
898
- }
899
- }, {
900
- appearance: 'default',
901
- intent: 'secondary',
902
- isActive: true,
903
- class: {
904
- shortcut: ['text-on-secondary-soft', 'border-on-secondary-soft/20']
905
- }
906
- }, {
907
- appearance: 'default',
908
- intent: 'tertiary',
909
- isActive: true,
910
- class: {
911
- shortcut: ['text-on-tertiary-soft', 'border-on-tertiary-soft/20']
912
- }
913
- }, {
914
- appearance: 'default',
915
- intent: 'success',
916
- isActive: true,
917
- class: {
918
- shortcut: ['text-on-success-soft', 'border-on-success-soft/20']
919
- }
920
- }, {
921
- appearance: 'default',
922
- intent: 'warning',
923
- isActive: true,
924
- class: {
925
- shortcut: ['text-on-warning-soft', 'border-on-warning-soft/20']
926
- }
927
- }, {
928
- appearance: 'default',
929
- intent: 'danger',
930
- isActive: true,
931
- class: {
932
- shortcut: ['text-on-danger-soft', 'border-on-danger-soft/20']
933
- }
934
- },
935
- // appearance: outlined
936
- {
937
- appearance: 'outlined',
938
- intent: 'default',
939
- class: {
940
- base: ['data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
941
- }
942
- }, {
943
- appearance: 'outlined',
944
- intent: 'primary',
945
- class: {
946
- base: ['data-is-active:border-primary', 'data-is-active:text-primary-strong']
947
- }
948
- }, {
949
- appearance: 'outlined',
950
- intent: 'secondary',
951
- class: {
952
- base: ['data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
953
- }
954
- }, {
955
- appearance: 'outlined',
956
- intent: 'tertiary',
957
- class: {
958
- base: ['data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
959
- }
960
- }, {
961
- appearance: 'outlined',
962
- intent: 'success',
963
- class: {
964
- base: ['data-is-active:border-success', 'data-is-active:text-success-strong']
965
- }
966
- }, {
967
- appearance: 'outlined',
968
- intent: 'warning',
969
- class: {
970
- base: ['data-is-active:border-warning', 'data-is-active:text-warning-strong']
971
- }
972
- }, {
973
- appearance: 'outlined',
974
- intent: 'danger',
975
- class: {
976
- base: ['data-is-active:border-danger', 'data-is-active:text-danger-strong']
977
- }
978
- },
979
- // appearance: faded
980
- {
981
- appearance: 'faded',
982
- intent: 'default',
983
- class: {
984
- base: ['data-is-active:bg-neutral-soft/20', 'data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
985
- }
986
- }, {
987
- appearance: 'faded',
988
- intent: 'primary',
989
- class: {
990
- base: ['data-is-active:bg-primary-soft/20', 'data-is-active:border-primary', 'data-is-active:text-primary-strong']
991
- }
992
- }, {
993
- appearance: 'faded',
994
- intent: 'secondary',
995
- class: {
996
- base: ['data-is-active:bg-secondary-soft/20', 'data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
997
- }
998
- }, {
999
- appearance: 'faded',
1000
- intent: 'tertiary',
1001
- class: {
1002
- base: ['data-is-active:bg-tertiary-soft/20', 'data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
1003
- }
1004
- }, {
1005
- appearance: 'faded',
1006
- intent: 'success',
1007
- class: {
1008
- base: ['data-is-active:bg-success-soft/20', 'data-is-active:border-success', 'data-is-active:text-success-strong']
1009
- }
1010
- }, {
1011
- appearance: 'faded',
1012
- intent: 'warning',
1013
- class: {
1014
- base: ['data-is-active:bg-warning-soft/20', 'data-is-active:border-warning', 'data-is-active:text-warning-strong']
1015
- }
1016
- }, {
1017
- appearance: 'faded',
1018
- intent: 'danger',
1019
- class: {
1020
- base: ['data-is-active:bg-danger-soft/20', 'data-is-active:border-danger', 'data-is-active:text-danger-strong']
1021
- }
1022
- }]
1023
- });
1024
-
1025
- const dropdownContent = tv({
1026
- base: 'bg-surface-input w-[260px] rounded-xl border border-neutral-subtle'
1027
- });
1028
-
1029
- const popover = tv({
1030
- base: 'bg-surface-input rounded-xl border border-neutral-subtle',
1031
- variants: {
1032
- size: {
1033
- sm: 'w-40',
1034
- md: 'w-64',
1035
- lg: 'w-96',
1036
- xl: 'w-136',
1037
- trigger: 'w-(--trigger-width)'
1038
- }
1039
- },
1040
- defaultVariants: {
1041
- size: 'md'
1042
- }
1043
- });
1044
-
1045
- const divider = tv({
1046
- base: 'shrink-0 bg-neutral-subtle border-none',
1047
- variants: {
1048
- orientation: {
1049
- horizontal: 'w-full h-px',
1050
- vertical: 'h-full w-px'
1051
- }
1052
- },
1053
- defaultVariants: {
1054
- orientation: 'horizontal'
1055
- }
1056
- });
1057
-
1058
- // Border-radius lives ONLY in the `shape` variants, never in `base`. Frontile's
1059
- // `rounded-default` is a custom value that tailwind-merge does not recognise as
1060
- // part of the `rounded` group, so a base radius would survive alongside a
1061
- // shape's radius instead of being replaced by it.
1062
- const skeleton = tv({
1063
- base: ['block', 'overflow-hidden'],
1064
- variants: {
1065
- shape: {
1066
- text: 'w-full rounded-default',
1067
- circle: 'aspect-square rounded-full',
1068
- // Matches Avatar's squircle radius so the two line up side by side.
1069
- square: 'aspect-square rounded-[20%]',
1070
- rounded: 'w-full rounded-lg',
1071
- rect: 'w-full rounded-none'
1072
- },
1073
- // Resolved per shape in compoundVariants: `circle`/`square` take both
1074
- // dimensions from Avatar's size scale, the rest take a height.
1075
- size: {
1076
- xs: '',
1077
- sm: '',
1078
- md: '',
1079
- lg: '',
1080
- xl: ''
1081
- },
1082
- animation: {
1083
- shimmer: ['bg-linear-to-r', 'from-surface-overlay-soft', 'via-surface-overlay-firm', 'to-surface-overlay-soft', 'bg-[length:200%_100%]', 'animate-shimmer'],
1084
- pulse: ['bg-surface-overlay-mild', 'animate-pulse'],
1085
- none: ['bg-surface-overlay-mild']
1086
- }
1087
- },
1088
- compoundVariants: [
1089
- // Square-ish shapes: one token sets width and height, reusing Avatar's
1090
- // scale so `<Skeleton @shape="circle" @size="md" />` matches
1091
- // `<Avatar @size="md" />` exactly.
1092
- {
1093
- shape: ['circle', 'square'],
1094
- size: 'xs',
1095
- class: 'size-5'
1096
- }, {
1097
- shape: ['circle', 'square'],
1098
- size: 'sm',
1099
- class: 'size-6'
1100
- }, {
1101
- shape: ['circle', 'square'],
1102
- size: 'md',
1103
- class: 'size-8'
1104
- }, {
1105
- shape: ['circle', 'square'],
1106
- size: 'lg',
1107
- class: 'size-10'
1108
- }, {
1109
- shape: ['circle', 'square'],
1110
- size: 'xl',
1111
- class: 'size-12'
1112
- },
1113
- // Full-width shapes: size sets a height. Every shape gets one so a
1114
- // Skeleton is never zero-height — an invisible placeholder makes a
1115
- // loading state look like an empty state. Override with `@class`.
1116
- {
1117
- shape: ['text', 'rounded', 'rect'],
1118
- size: 'xs',
1119
- class: 'h-2.5'
1120
- }, {
1121
- shape: ['text', 'rounded', 'rect'],
1122
- size: 'sm',
1123
- class: 'h-3'
1124
- }, {
1125
- shape: ['text', 'rounded', 'rect'],
1126
- size: 'md',
1127
- class: 'h-4'
1128
- }, {
1129
- shape: ['text', 'rounded', 'rect'],
1130
- size: 'lg',
1131
- class: 'h-5'
1132
- }, {
1133
- shape: ['text', 'rounded', 'rect'],
1134
- size: 'xl',
1135
- class: 'h-6'
1136
- }],
1137
- defaultVariants: {
1138
- shape: 'text',
1139
- size: 'md',
1140
- animation: 'shimmer'
1141
- }
1142
- });
1143
-
1144
- const spinner = tv({
1145
- base: 'text-neutral-muted animate-spin',
1146
- variants: {
1147
- size: {
1148
- xs: 'w-4 h-4',
1149
- sm: 'w-6 h-6',
1150
- md: 'w-8 h-8',
1151
- lg: 'w-10 h-10',
1152
- xl: 'w-12 h-12'
1153
- },
1154
- intent: {
1155
- default: 'fill-neutral-strong',
1156
- primary: 'fill-primary',
1157
- secondary: 'fill-secondary',
1158
- tertiary: 'fill-tertiary',
1159
- success: 'fill-success',
1160
- warning: 'fill-warning',
1161
- danger: 'fill-danger'
1162
- }
1163
- },
1164
- defaultVariants: {
1165
- size: 'md',
1166
- intent: 'default'
1167
- }
1168
- });
1169
-
1170
- const table = tv({
1171
- slots: {
1172
- base: ['w-full', 'caption-bottom', 'font-body text-body-2xs'],
1173
- wrapper: ['relative', 'isolate', 'overflow-auto', 'rounded-default',
1174
- // `surface-table` rather than `surface-card`, which the table otherwise
1175
- // looks exactly like: every sticky part of the table paints over the rows
1176
- // and columns scrolling beneath it, and in dark `card` is a translucent
1177
- // veil that would let them read through. The role carries the colour that
1178
- // veil renders, with the alpha already resolved. Override
1179
- // `--color-surface-table` to sit a table on a different background.
1180
- 'bg-surface-table'],
1181
- table: ['w-full', 'table-auto'],
1182
- thead: ['relative', 'bg-surface-overlay-subtle'],
1183
- tbody: ['divide-y', 'divide-surface-overlay-subtle',
1184
- // Rows carry the surface themselves rather than letting the wrapper show
1185
- // through: a sticky row has to hide the rows sliding under it, and a
1186
- // sticky cell picks its fill up from its row via `background-color:
1187
- // inherit`. Row tints layer on top of this, and any tint that replaces it
1188
- // has to be opaque too — see `striped` and the selection variants.
1189
- '[&>tr]:bg-surface-table',
1190
- // `muted`, not `subtle`: in dark `neutral-subtle` is gray-900, the same
1191
- // value `surface-table` carries, so a `subtle` hover reads as no hover at
1192
- // all. This stays a background *colour* so `transition-colors` animates it.
1193
- '[&>tr]:data-[selectable=true]:data-[selected=false]:hover:bg-neutral-muted', '[&>tr]:data-[selectable=true]:transition-colors'],
1194
- // Footer rows take the surface for the same reason body rows do: a sticky
1195
- // column in the footer scrolls past the cells to its side.
1196
- tfoot: ['relative', '[&>tr]:bg-surface-table'],
1197
- 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'],
1198
- separator: ['absolute', 'z-2', 'left-0', 'w-full', 'h-px', 'bg-surface-overlay-mild'],
1199
- th: ['h-12', 'px-4', 'text-left', 'align-middle', 'font-label', 'text-neutral-bolder', '[&:has([role=checkbox])]:pr-0', 'data-[sortable=true]:cursor-pointer'],
1200
- 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'],
1201
- 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'],
1202
- columnVisibilityButton: ['flex'],
1203
- columnVisibilityIcon: ['size-6'],
1204
- td: ['align-middle', 'text-neutral-strong', '[&:has([role=checkbox])]:pr-0'],
1205
- empty: ['text-neutral-soft', 'align-middle', 'text-center', 'py-12'],
1206
- // Deliberately carries no width or height: these classes are merged onto
1207
- // Skeleton *after* its own shape and size variants, so any dimension set
1208
- // here would defeat a column's `skeleton: 'circle'` preset. The table
1209
- // passes its `size` through to Skeleton instead.
1210
- skeleton: ['max-w-[16ch]'],
1211
- // Placeholder rows fade in one after another. The per-row `animation-delay`
1212
- // is set inline by the component, since a delay that scales with the row
1213
- // index cannot be a static utility class.
1214
- skeletonRow: ['animate-skeleton-enter', 'motion-reduce:animate-none']
1215
- },
1216
- variants: {
1217
- size: {
1218
- sm: {
1219
- th: 'h-10 px-3 py-2 text-label-2xs',
1220
- td: 'px-3 py-2 text-body-micro'
1221
- },
1222
- md: {
1223
- th: 'h-12 px-4 text-label-xs',
1224
- td: 'p-4 text-body-2xs'
1225
- },
1226
- lg: {
1227
- th: 'h-14 px-6 text-label-sm',
1228
- td: 'p-6 text-body-xs'
1229
- }
1230
- },
1231
- isLoading: {
1232
- true: {
1233
- thead: ['after:absolute', 'after:top-full', 'after:left-0', 'after:w-1/2', 'after:animate-swing', 'after:h-px', 'after:z-10']
1234
- }
1235
- },
1236
- // Declared empty on purpose: these variants exist only so `isLoading` can
1237
- // pair with them in `compoundVariants` below, where the actual
1238
- // `thead: after:bg-*` colour is applied. A colour set here would paint the
1239
- // hairline even when the table is not loading.
1240
- loadingColor: {
1241
- default: {},
1242
- primary: {},
1243
- success: {},
1244
- warning: {},
1245
- danger: {}
1246
- },
1247
- selectionColor: {
1248
- default: {},
1249
- primary: {},
1250
- success: {},
1251
- warning: {},
1252
- danger: {}
1253
- },
1254
- layout: {
1255
- auto: {
1256
- table: 'table-auto'
1257
- },
1258
- fixed: {
1259
- table: 'table-fixed'
1260
- }
1261
- },
1262
- striped: {
1263
- true: {
1264
- // A translucent tint, so it goes on as a background *image* layer over
1265
- // the row's opaque fill instead of replacing it. Painting it as the
1266
- // background colour would make every striped sticky row see-through.
1267
- tbody: '[&_tr:nth-child(odd)]:[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'
1268
- }
1269
- },
1270
- isSticky: {
1271
- true: {}
1272
- },
1273
- stickyPosition: {
1274
- left: {},
1275
- right: {},
1276
- top: {},
1277
- bottom: {}
1278
- },
1279
- isScrollable: {
1280
- true: {
1281
- wrapper: ['overflow-auto']
1282
- }
1283
- },
1284
- hasStickyHeader: {
1285
- true: {}
1286
- },
1287
- isInStickyRow: {
1288
- true: {}
1289
- }
1290
- },
1291
- compoundVariants: [
1292
- // Sticky header - highest priority for intersections with columns
1293
- {
1294
- isSticky: true,
1295
- stickyPosition: 'top',
1296
- class: {
1297
- // The opaque surface plus the header's own translucent tint as a layer
1298
- // above it, which is what a non-sticky `thead` composites to over the
1299
- // wrapper — so stuck and unstuck headers read as the same colour.
1300
- thead: ['sticky', 'top-0', 'z-2', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]']
1301
- }
1302
- },
1303
- // Sticky footer
1304
- {
1305
- isSticky: true,
1306
- stickyPosition: 'bottom',
1307
- class: {
1308
- tfoot: ['sticky', 'bottom-0', 'z-2', 'bg-surface-table']
1309
- }
1310
- },
1311
- // Sticky columns - medium priority, header cells get higher z-index.
1312
- // Body and footer cells inherit their row's paint — fill, and any tint
1313
- // layered over it — so a pinned column tracks selection, hover and striping
1314
- // instead of masking them with a surface of its own.
1315
- {
1316
- isSticky: true,
1317
- stickyPosition: 'left',
1318
- class: {
1319
- th: ['sticky', 'left-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1320
- td: ['sticky', 'left-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1321
- }
1322
- }, {
1323
- isSticky: true,
1324
- stickyPosition: 'right',
1325
- class: {
1326
- th: ['sticky', 'right-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
1327
- td: ['sticky', 'right-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
1328
- }
1329
- },
1330
- // Sticky rows - base layer
1331
- {
1332
- isSticky: true,
1333
- stickyPosition: 'top',
1334
- class: {
1335
- tr: ['sticky', 'top-0', 'z-1', 'bg-surface-table']
1336
- }
1337
- }, {
1338
- isSticky: true,
1339
- stickyPosition: 'bottom',
1340
- class: {
1341
- tr: ['sticky', 'bottom-0', 'z-1', 'bg-surface-table']
1342
- }
1343
- },
1344
- // Sticky rows with sticky header - position after header
1345
- {
1346
- isSticky: true,
1347
- stickyPosition: 'top',
1348
- hasStickyHeader: true,
1349
- class: {
1350
- tr: ['sticky', 'z-2', 'bg-surface-table', '[&.sticky]:[top:var(--table-header-height,48px)]']
1351
- }
1352
- },
1353
- // Intersection cells: sticky column + sticky row - highest z-index
1354
- {
1355
- isSticky: true,
1356
- stickyPosition: 'left',
1357
- isInStickyRow: true,
1358
- class: {
1359
- td: ['sticky', 'left-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1360
- }
1361
- }, {
1362
- isSticky: true,
1363
- stickyPosition: 'right',
1364
- isInStickyRow: true,
1365
- class: {
1366
- td: ['sticky', 'right-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
1367
- }
1368
- },
1369
- // Loading states with color variants
1370
- {
1371
- isLoading: true,
1372
- loadingColor: 'default',
1373
- class: {
1374
- thead: `after:bg-neutral`
1375
- }
1376
- }, {
1377
- isLoading: true,
1378
- loadingColor: 'primary',
1379
- class: {
1380
- thead: `after:bg-primary`
1381
- }
1382
- }, {
1383
- isLoading: true,
1384
- loadingColor: 'success',
1385
- class: {
1386
- thead: `after:bg-success`
1387
- }
1388
- }, {
1389
- isLoading: true,
1390
- loadingColor: 'warning',
1391
- class: {
1392
- thead: `after:bg-warning`
1393
- }
1394
- }, {
1395
- isLoading: true,
1396
- loadingColor: 'danger',
1397
- class: {
1398
- thead: `after:bg-danger`
1399
- }
1400
- },
1401
- // Selection color variants
1402
- {
1403
- selectionColor: 'default',
1404
- class: {
1405
- // Half-opacity, so it layers over the row's fill rather than replacing
1406
- // it — a selected sticky row still has to occlude what scrolls under.
1407
- // The other selection colours are opaque and can stay plain fills.
1408
- //
1409
- // `soft` rather than `subtle`, which in dark is the same value as
1410
- // `surface-table` and so tints nothing. At 50% this lands on the weight
1411
- // the colour variants carry (1.4:1 against the surface, against
1412
- // `primary-subtle`'s 1.38:1).
1413
- 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))]',
1414
- tr: ['data-[selectable=true]:focus-visible:ring-default']
1415
- }
1416
- }, {
1417
- selectionColor: 'primary',
1418
- class: {
1419
- tbody: '[&>tr]:data-[selected=true]:bg-primary-subtle',
1420
- tr: ['data-[selectable=true]:focus-visible:ring-primary-soft']
1421
- }
1422
- }, {
1423
- selectionColor: 'success',
1424
- class: {
1425
- tbody: '[&>tr]:data-[selected=true]:bg-success-subtle',
1426
- tr: ['data-[selectable=true]:focus-visible:ring-success']
1427
- }
1428
- }, {
1429
- selectionColor: 'warning',
1430
- class: {
1431
- tbody: '[&>tr]:data-[selected=true]:bg-warning-subtle',
1432
- tr: ['data-[selectable=true]:focus-visible:ring-warning']
1433
- }
1434
- }, {
1435
- selectionColor: 'danger',
1436
- class: {
1437
- tbody: '[&>tr]:data-[selected=true]:bg-danger-subtle',
1438
- tr: ['data-[selectable=true]:focus-visible:ring-danger']
1439
- }
1440
- }],
1441
- defaultVariants: {
1442
- size: 'md',
1443
- layout: 'auto',
1444
- loadingColor: 'default',
1445
- selectionColor: 'primary'
1446
- }
1447
- });
1448
-
1449
- const notificationsContainer = tv({
1450
- base: ['w-full', 'max-h-full', 'overflow-hidden', 'px-4', 'fixed', 'max-w-lg', 'z-1000'],
1451
- variants: {
1452
- placement: {
1453
- 'top-left': 'top-0 left-0',
1454
- 'top-center': 'top-0 left-2/4 translate-x-[-50%]',
1455
- 'top-right': 'top-0 right-0',
1456
- 'bottom-left': 'bottom-0 left-0',
1457
- 'bottom-center': 'bottom-0 left-2/4 translate-x-[-50%]',
1458
- 'bottom-right': 'bottom-0 right-0 '
1459
- }
1460
- },
1461
- defaultVariants: {
1462
- placement: 'bottom-right'
1463
- }
1464
- });
1465
-
1466
- const btn = ['transition transition-200', ...focusVisibleRing];
1467
- const notificationCard = tv({
1468
- slots: {
1469
- base: 'py-3 px-4 overflow-hidden flex items-center justify-between relative min-h-16 font-body text-body-2xs rounded-xl shadow-sm transition-all transition-200 ease-in-out',
1470
- message: 'grow',
1471
- customActions: 'flex flex-nowrap',
1472
- customActionButton: [...btn, 'first:ml-4 last:-mr-2 font-label text-label-xs py-1 px-2 rounded-md hover:bg-surface-overlay-soft'],
1473
- closeButton: [...btn, 'inline-block p-2 ml-2 -mr-2 rounded-full hover:bg-surface-overlay-soft']
1474
- },
1475
- variants: {
1476
- appearance: {
1477
- info: {
1478
- base: 'bg-neutral-firm text-on-neutral-firm'
1479
- },
1480
- success: {
1481
- base: 'bg-success-soft text-on-success-soft'
1482
- },
1483
- warning: {
1484
- base: 'bg-warning-soft text-on-warning-soft'
1485
- },
1486
- error: {
1487
- base: 'bg-danger-soft text-on-danger-soft'
1488
- }
1489
- }
1490
- },
1491
- defaultVariants: {
1492
- appearance: 'info'
1493
- }
1494
- });
1495
- const zoomOut = {
1496
- leaveTo: {
1497
- transform: 'scale(0.80)',
1498
- opacity: '0'
1499
- },
1500
- leave: {
1501
- transform: 'translate3d(0,0,0)'
1502
- }
1503
- };
1504
- const notificationEnteringFrom = {
1505
- right: {
1506
- transform: 'translate3d(125%, 0, 0)'
1507
- },
1508
- left: {
1509
- transform: 'translate3d(-125%, 0, 0)'
1510
- },
1511
- top: {
1512
- transform: 'translate3d(0, -125%, 0)'
1513
- },
1514
- bottom: {
1515
- transform: 'translate3d(0, 125%, 0)'
1516
- }
1517
- };
1518
- const notificationTransitions = {
1519
- slideFromTopLeft: {
1520
- ...zoomOut,
1521
- enter: {
1522
- ...notificationEnteringFrom.left
1523
- }
1524
- },
1525
- slideFromTopCenter: {
1526
- ...zoomOut,
1527
- enter: notificationEnteringFrom.top
1528
- },
1529
- slideFromTopRight: {
1530
- ...zoomOut,
1531
- enter: notificationEnteringFrom.right
1532
- },
1533
- slideFromBottomLeft: {
1534
- ...zoomOut,
1535
- enter: notificationEnteringFrom.left
1536
- },
1537
- slideFromBottomCenter: {
1538
- ...zoomOut,
1539
- enter: notificationEnteringFrom.bottom
1540
- },
1541
- slideFromBottomRight: {
1542
- ...zoomOut,
1543
- enter: notificationEnteringFrom.right
1544
- }
1545
- };
1546
-
1547
- const obscurer = `before:bg-linear-to-b before:to-surface-modal before:from-surface-modal/75 before:absolute before:left-0 before:w-full before:h-4 before:-top-4 before:content-['_']`;
1548
- const overlay = tv({
1549
- base: 'will-change-transform overflow-auto',
1550
- variants: {
1551
- enableFlexContent: {
1552
- true: 'flex items-center fixed inset-0 flex-col'
1553
- },
1554
- inPlace: {
1555
- true: 'absolute'
1556
- }
1557
- }
1558
- });
1559
- const backdrop = tv({
1560
- base: 'fixed inset-0 select-none',
1561
- variants: {
1562
- type: {
1563
- none: '',
1564
- transparent: '',
1565
- // The scrim is `overlay-strong` in light and `lift-strong` in dark: the
1566
- // two families are mirrored, so the black 75% step swaps sides. Pairing
1567
- // them keeps the backdrop a dark scrim in both schemes.
1568
- blur: 'bg-surface-overlay-strong dark:bg-surface-lift-strong backdrop-blur-sm',
1569
- faded: 'bg-surface-overlay-strong dark:bg-surface-lift-strong'
1570
- },
1571
- inPlace: {
1572
- true: 'absolute'
1573
- }
1574
- }
1575
- });
1576
- const modal = tv({
1577
- slots: {
1578
- base: 'flex flex-col shrink-0 relative text-on-surface-modal bg-surface-modal border border-surface-overlay-mild rounded-2xl my-24 w-full outline-hidden overflow-clip',
1579
- closeButton: 'absolute top-3 right-3',
1580
- header: 'font-header text-header-lg px-6 pt-8 pb-2',
1581
- body: 'px-6 py-2 grow overflow-y-auto',
1582
- footer: 'flex justify-end items-center px-6 pt-6 pb-8 gap-4'
1583
- },
1584
- variants: {
1585
- size: {
1586
- xs: 'modal--xs',
1587
- sm: 'modal--sm',
1588
- md: 'modal--md',
1589
- lg: 'modal--lg',
1590
- xl: 'modal--xl',
1591
- full: 'modal--full'
1592
- },
1593
- isCentered: {
1594
- true: 'my-auto'
1595
- }
1596
- }
1597
- });
1598
- const drawer = tv({
1599
- slots: {
1600
- base: 'flex flex-col absolute text-on-surface-modal bg-surface-modal border border-surface-overlay-mild rounded-2xl w-full h-full outline-hidden overflow-clip',
1601
- closeButton: 'absolute top-3 right-3',
1602
- header: 'font-header text-header-lg text-center px-8 pt-10 pb-2',
1603
- body: 'px-8 py-4 grow overflow-y-auto',
1604
- footer: `${obscurer} flex justify-end items-center relative border-t border-surface-overlay-mild bg-surface-modal p-8 gap-4`
1605
- },
1606
- variants: {
1607
- size: {
1608
- xs: '',
1609
- sm: '',
1610
- md: '',
1611
- lg: '',
1612
- xl: '',
1613
- full: ''
1614
- },
1615
- placement: {
1616
- top: 'top-0 right-0 left-0',
1617
- bottom: 'bottom-0 right-0 left-0',
1618
- left: 'top-0 bottom-0 left-0',
1619
- right: 'top-0 bottom-0 right-0'
1620
- }
1621
- },
1622
- compoundVariants: [
1623
- // vertical
1624
- {
1625
- placement: ['top', 'bottom'],
1626
- size: 'xs',
1627
- class: 'drawer--vertical-xs'
1628
- }, {
1629
- placement: ['top', 'bottom'],
1630
- size: 'sm',
1631
- class: 'drawer--vertical-sm'
1632
- }, {
1633
- placement: ['top', 'bottom'],
1634
- size: 'md',
1635
- class: 'drawer--vertical-md'
1636
- }, {
1637
- placement: ['top', 'bottom'],
1638
- size: 'lg',
1639
- class: 'drawer--vertical-lg'
1640
- }, {
1641
- placement: ['top', 'bottom'],
1642
- size: 'xl',
1643
- class: 'drawer--vertical-xl'
1644
- }, {
1645
- placement: ['top', 'bottom'],
1646
- size: 'full',
1647
- class: 'drawer--vertical-full'
1648
- },
1649
- // horizontal
1650
- {
1651
- placement: ['right', 'left'],
1652
- size: 'xs',
1653
- class: 'drawer--horizontal-xs'
1654
- }, {
1655
- placement: ['right', 'left'],
1656
- size: 'sm',
1657
- class: 'drawer--horizontal-sm'
1658
- }, {
1659
- placement: ['right', 'left'],
1660
- size: 'md',
1661
- class: 'drawer--horizontal-md'
1662
- }, {
1663
- placement: ['right', 'left'],
1664
- size: 'lg',
1665
- class: 'drawer--horizontal-lg'
1666
- }, {
1667
- placement: ['right', 'left'],
1668
- size: 'xl',
1669
- class: 'drawer--horizontal-xl'
1670
- }, {
1671
- placement: ['right', 'left'],
1672
- size: 'full',
1673
- class: 'drawer--horizontal-full'
1674
- }]
1675
- });
1676
- const slideTransition = {
1677
- enterActive: {
1678
- transition: 'transform 0.2s cubic-bezier(0.37, 0, 0.63, 1)'
1679
- },
1680
- leaveActive: {
1681
- transition: 'transform 0.2s cubic-bezier(0.37, 0, 0.63, 1)'
1682
- }
1683
- };
1684
- const overlayTransitions = {
1685
- fade: {
1686
- enter: {
1687
- opacity: '0'
1688
- },
1689
- enterActive: {
1690
- transition: 'opacity 0.2s linear'
1691
- },
1692
- leave: {
1693
- opacity: '1'
1694
- },
1695
- leaveActive: {
1696
- transition: 'opacity 0.2s linear'
1697
- }
1698
- },
1699
- zoom: {
1700
- enter: {
1701
- opacity: '0',
1702
- transform: 'scale(0.8)'
1703
- },
1704
- enterActive: {
1705
- transition: 'all 0.2s ease-in-out'
1706
- },
1707
- leave: {
1708
- opacity: '1',
1709
- transform: 'scale(1)'
1710
- },
1711
- leaveActive: {
1712
- transition: 'all 0.2s ease-in-out'
1713
- }
1714
- },
1715
- slideFromLeft: {
1716
- enter: {
1717
- transform: 'translateX(-100%)'
1718
- },
1719
- leave: {
1720
- transform: 'translateX(0%)'
1721
- },
1722
- ...slideTransition
1723
- },
1724
- slideFromRight: {
1725
- enter: {
1726
- transform: 'translateX(100%)'
1727
- },
1728
- leave: {
1729
- transform: 'translateX(0%)'
1730
- },
1731
- ...slideTransition
1732
- },
1733
- slideFromTop: {
1734
- enter: {
1735
- transform: 'translateY(-100%)'
1736
- },
1737
- leave: {
1738
- transform: 'translateY(0%)'
1739
- },
1740
- ...slideTransition
1741
- },
1742
- slideFromBottom: {
1743
- enter: {
1744
- transform: 'translateY(100%)'
1745
- },
1746
- leave: {
1747
- transform: 'translateY(0%)'
1748
- },
1749
- ...slideTransition
1750
- },
1751
- scale: {
1752
- enter: {
1753
- opacity: '0',
1754
- transform: 'scale(0.95)'
1755
- },
1756
- enterActive: {
1757
- transitionProperty: 'transform, opacity',
1758
- transitionDuration: '200ms',
1759
- transitionTimingFunction: 'cubic-bezier(0, 0, 0.2, 1)'
1760
- },
1761
- enterTo: {
1762
- opacity: '1',
1763
- transform: 'translate(scaleX(1) scaleY(1))'
1764
- },
1765
- leave: {
1766
- opacity: '1',
1767
- transform: 'translate(scaleX(1) scaleY(1))'
1768
- },
1769
- leaveActive: {
1770
- transitionProperty: 'transform, opacity',
1771
- transitionDuration: '100ms',
1772
- transitionTimingFunction: 'cubic-bezier(0.4, 0, 1, 1)'
1773
- },
1774
- leaveTo: {
1775
- opacity: '0',
1776
- transform: 'scale(0.95)'
1777
- }
1778
- }
1779
- };
1780
-
1781
- const label = tv({
1782
- slots: {
1783
- // label text role (Open Sans semibold, tight leading)
1784
- base: 'text-neutral-bolder inline-block font-label text-label-sm pb-2',
1785
- asterisk: 'text-danger'
1786
- },
1787
- variants: {
1788
- size: {
1789
- sm: {
1790
- base: 'text-label-2xs'
1791
- },
1792
- md: {},
1793
- lg: {
1794
- base: 'text-label-md'
1795
- }
1796
- }
1797
- },
1798
- defaultVariants: {
1799
- size: 'md'
1800
- }
1801
- });
1802
- const formDescription = tv({
1803
- // help/description text — body role
1804
- base: 'text-neutral font-body text-body-micro pb-1 last:pb-0',
1805
- variants: {
1806
- size: {
1807
- sm: 'text-body-micro',
1808
- md: '',
1809
- lg: 'text-body-sm'
1810
- }
1811
- },
1812
- defaultVariants: {
1813
- size: 'md'
1814
- }
1815
- });
1816
- const formFeedback = tv({
1817
- // validation/feedback text — body role
1818
- base: 'font-body text-body-micro pt-1',
1819
- variants: {
1820
- intent: {
1821
- primary: 'text-primary',
1822
- secondary: 'text-secondary',
1823
- tertiary: 'text-tertiary',
1824
- success: 'text-success',
1825
- danger: 'text-danger',
1826
- warning: 'text-warning'
1827
- },
1828
- size: {
1829
- sm: 'text-body-micro',
1830
- md: '',
1831
- lg: 'text-body-sm'
1832
- }
1833
- },
1834
- defaultVariants: {
1835
- size: 'sm'
1836
- }
1837
- });
1838
-
1839
- // The visual shell of a form field: background, border, radius, and the
1840
- // invalid/disabled treatments. Shared by the `input` slot and by `select`'s
1841
- // `chipsField`, which becomes the shell when chips render beside the trigger.
1842
- const fieldShell = ['bg-surface-input', 'border', 'border-neutral-soft', 'rounded-xl', 'selection:bg-surface-overlay-soft'];
1843
- const input = tv({
1844
- slots: {
1845
- base: '',
1846
- innerContainer: 'relative flex',
1847
- startContent: 'absolute inset-y-0 left-0 flex items-center',
1848
- endContent: 'absolute inset-y-0 right-0 flex items-center',
1849
- input: ['appearance-none', 'flex-1', 'w-full', ...fieldShell, 'text-neutral-strong', 'placeholder-neutral',
1850
- // body role family; single-line controls keep tight leading (not the body relaxed leading)
1851
- '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']
1852
- },
1853
- variants: {
1854
- size: {
1855
- sm: {
1856
- input: 'p-2',
1857
- startContent: 'pl-2',
1858
- endContent: 'pr-2'
1859
- },
1860
- md: {
1861
- input: 'p-3',
1862
- startContent: 'pl-3',
1863
- endContent: 'pr-3'
1864
- },
1865
- lg: {
1866
- input: 'p-4',
1867
- startContent: 'pl-4',
1868
- endContent: 'pr-4'
1869
- }
1870
- },
1871
- hasStartContent: {
1872
- true: {
1873
- input: 'ps-8'
1874
- }
1875
- },
1876
- hasEndContent: {
1877
- true: {
1878
- input: 'pe-10'
1879
- }
1880
- },
1881
- // When chips render beside the trigger, `chipsField` owns the field shell
1882
- // and the trigger itself must be visually bare.
1883
- hasChips: {
1884
- true: {
1885
- input: ['border-0', 'bg-transparent', 'p-0', 'w-auto', 'flex-1',
1886
- // Once chips show the selection the trigger renders nothing at all, so
1887
- // it has no content to give it a height -- it collapsed to a 0px box
1888
- // that could not be clicked. Stretching makes it as tall as the chips
1889
- // sitting next to it, which is the box a pointer needs to hit.
1890
- 'self-stretch',
1891
- // No horizontal floor by default: a bare (non-filterable) trigger has
1892
- // no content of its own, so a floor would only push it onto a second
1893
- // flex line. `select` puts the floor back for the filterable trigger,
1894
- // which does need room to type.
1895
- 'min-w-0', 'focus:ring-0', 'focus:border-transparent']
1896
- }
1897
- },
1898
- startContentPointerEvents: {
1899
- auto: {
1900
- startContent: 'pointer-events-auto'
1901
- },
1902
- none: {
1903
- startContent: 'pointer-events-none'
1904
- }
1905
- },
1906
- endContentPointerEvents: {
1907
- auto: {
1908
- endContent: 'pointer-events-auto'
1909
- },
1910
- none: {
1911
- endContent: 'pointer-events-none'
1912
- }
1913
- }
1914
- },
1915
- defaultVariants: {
1916
- size: 'md'
1917
- }
1918
- });
1919
- const textarea = tv({
1920
- extend: input,
1921
- slots: {
1922
- input: 'min-h-24'
1923
- },
1924
- variants: {
1925
- size: {
1926
- sm: {},
1927
- md: {},
1928
- lg: {}
1929
- }
1930
- }
1931
- });
1932
- const checkboxRadioBase = tv({
1933
- slots: {
1934
- base: ['max-w-fit flex items-center justify-start'],
1935
- 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],
1936
- labelContainer: ['flex flex-col ml-2'],
1937
- label: 'font-body text-body-xs pb-0'
1938
- },
1939
- variants: {
1940
- size: {
1941
- sm: {
1942
- input: 'h-4 w-4'
1943
- },
1944
- md: {
1945
- input: 'h-5 w-5'
1946
- },
1947
- lg: {
1948
- input: 'h-6 w-6'
1949
- }
1950
- }
1951
- },
1952
- defaultVariants: {
1953
- size: 'md'
1954
- }
1955
- });
1956
- const checkboxRadioGroupBase = tv({
1957
- slots: {
1958
- base: '',
1959
- optionsContainer: ['flex flex-col flex-wrap gap-4 data-[orientation=horizontal]:flex-row'],
1960
- label: 'pb-2'
1961
- },
1962
- variants: {
1963
- size: {
1964
- sm: '',
1965
- md: '',
1966
- lg: ''
1967
- }
1968
- }
1969
- });
1970
- const checkbox = tv({
1971
- extend: checkboxRadioBase,
1972
- slots: {
1973
- input: ['checked-bg-checkbox', 'indeterminate-bg-checkbox', 'rounded-sm', 'checked:bg-primary checked:border-primary',
1974
- // Indeterminate state styles - show minus/dash icon
1975
- 'indeterminate:bg-primary', 'indeterminate:border-primary', 'indeterminate:bg-origin-border', 'indeterminate:bg-center', 'indeterminate:bg-no-repeat']
1976
- },
1977
- variants: {
1978
- size: {
1979
- sm: {},
1980
- md: {},
1981
- lg: {}
1982
- }
1983
- },
1984
- defaultVariants: {
1985
- size: 'md'
1986
- }
1987
- });
1988
- const radio = tv({
1989
- extend: checkboxRadioBase,
1990
- slots: {
1991
- input: ['checked-bg-radio', 'rounded-full', 'checked:bg-primary checked:border-primary']
1992
- },
1993
- variants: {
1994
- size: {
1995
- sm: {},
1996
- md: {},
1997
- lg: {}
1998
- }
1999
- },
2000
- defaultVariants: {
2001
- size: 'md'
2002
- }
2003
- });
2004
- const radioGroup = tv({
2005
- extend: checkboxRadioGroupBase
2006
- });
2007
- const checkboxGroup = tv({
2008
- extend: checkboxRadioGroupBase
2009
- });
2010
- const select = tv({
2011
- extend: input,
2012
- slots: {
2013
- base: [],
2014
- placeholder: 'text-neutral',
2015
- listbox: 'scroll-py-6 max-h-64',
2016
- icon: 'w-5 h-5',
2017
- clearButton: 'pointer-events-auto',
2018
- input: '[button]:cursor-default',
2019
- emptyContent: 'p-2',
2020
- // The wrapper around the trigger. It is rendered in every mode; the
2021
- // `hasChips` variant below decides whether it is the field shell or a
2022
- // transparent passthrough. Authored here rather than as literal classes in
2023
- // the component template because Tailwind does not scan
2024
- // `packages/frontile/src`.
2025
- chipsField: '',
2026
- chipsContainer: 'flex flex-wrap items-center gap-1 min-w-0',
2027
- chip: ''
2028
- },
2029
- variants: {
2030
- size: {
2031
- sm: {},
2032
- md: {},
2033
- lg: {}
2034
- },
2035
- // When chips render, `chipsField` becomes the field shell in place of the
2036
- // trigger's own border (see the `hasChips` variant on `input`), and owns the
2037
- // padding. Otherwise it is a transparent, full-width flex passthrough: the
2038
- // shell stays on the trigger, but the wrapper is still a real box, so it can
2039
- // be measured as the popover's width reference in both modes.
2040
- //
2041
- // `data-invalid` / `data-disabled` are set by the component because
2042
- // `aria-invalid:` and `disabled:` only match the element carrying them.
2043
- hasChips: {
2044
- true: {
2045
- 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']
2046
- },
2047
- false: {
2048
- chipsField: 'flex w-full min-w-0'
2049
- }
2050
- },
2051
- // Whether the trigger is a filterable text input rather than a bare button.
2052
- // Only affects how much horizontal room the trigger reserves in chips mode.
2053
- isFilterable: {
2054
- true: {},
2055
- false: {}
2056
- }
2057
- },
2058
- compoundVariants: [
2059
- // Padding belongs to whichever element is the field shell, so it is applied
2060
- // to `chipsField` only in chips mode -- in passthrough mode the wrapper has
2061
- // to add no geometry of its own.
2062
- // The `min-h-*` values are the height of the same-size text field
2063
- // (padding + line box + border), so a chips field is exactly as tall as a
2064
- // single-select one, does not change height as the first chip arrives, and
2065
- // absorbs the flex gap when the trigger wraps below the chips.
2066
- // No gap between the chips and the trigger: the chips carry their own gap,
2067
- // and a gap here is space the trigger has to fit into before it is allowed
2068
- // to stay on the chips' line. With `gap-0` a trigger that does have to wrap
2069
- // (the chips already fill the row) costs no vertical space at all.
2070
- {
2071
- hasChips: true,
2072
- size: 'sm',
2073
- class: {
2074
- chipsField: 'p-1 gap-0 min-h-9.5'
2075
- }
2076
- }, {
2077
- hasChips: true,
2078
- size: 'md',
2079
- class: {
2080
- chipsField: 'p-1.5 gap-0 min-h-11.5'
2081
- }
2082
- }, {
2083
- hasChips: true,
2084
- size: 'lg',
2085
- class: {
2086
- chipsField: 'p-2 gap-0 min-h-13.5'
2087
- }
2088
- },
2089
- // Chips have to clear the absolutely-positioned start/end content the same
2090
- // way a bare `input` does, otherwise they run underneath the chevron and the
2091
- // clear button.
2092
- {
2093
- hasChips: true,
2094
- hasStartContent: true,
2095
- class: {
2096
- chipsField: 'ps-8'
2097
- }
2098
- }, {
2099
- hasChips: true,
2100
- hasEndContent: true,
2101
- class: {
2102
- chipsField: 'pe-10'
2103
- }
2104
- },
2105
- // ...and once `chipsField` reserves that room, the bare trigger inside it
2106
- // must not reserve it a second time.
2107
- {
2108
- hasChips: true,
2109
- hasStartContent: true,
2110
- class: {
2111
- input: 'ps-0'
2112
- }
2113
- }, {
2114
- hasChips: true,
2115
- hasEndContent: true,
2116
- class: {
2117
- input: 'pe-0'
2118
- }
2119
- },
2120
- // Only the filterable trigger needs typing room -- and, since the field
2121
- // itself no longer sets a gap, its own separation from the last chip.
2122
- // See `min-w-0` and `gap-0` above.
2123
- {
2124
- hasChips: true,
2125
- isFilterable: true,
2126
- class: {
2127
- input: 'min-w-16 ms-1'
2128
- }
2129
- }],
2130
- defaultVariants: {
2131
- size: 'md'
2132
- }
2133
- });
2134
-
2135
- // Note: extends `input` rather than `select` because tailwind-variants
2136
- // loses inherited slot types across two levels of `extend`.
2137
- const autocomplete = tv({
2138
- extend: input,
2139
- slots: {
2140
- base: [],
2141
- listbox: 'scroll-py-6 max-h-64',
2142
- icon: 'w-5 h-5',
2143
- clearButton: 'pointer-events-auto',
2144
- input: 'cursor-text',
2145
- emptyContent: 'p-2'
2146
- },
2147
- variants: {
2148
- size: {
2149
- sm: {},
2150
- md: {},
2151
- lg: {}
2152
- }
2153
- },
2154
- defaultVariants: {
2155
- size: 'md'
2156
- }
2157
- });
2158
- const nativeSelect = tv({
2159
- extend: input,
2160
- slots: {
2161
- input: ['appearance-none'],
2162
- icon: 'w-5 h-5'
2163
- },
2164
- variants: {
2165
- size: {
2166
- sm: {},
2167
- md: {},
2168
- lg: {}
2169
- }
2170
- }
2171
- });
2172
- const switchInput = tv({
2173
- slots: {
2174
- base: 'group relative max-w-fit inline-flex items-center justify-start',
2175
- labelContainer: 'flex flex-col ml-2',
2176
- label: 'font-body text-body-xs pb-0',
2177
- 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', 'transition-background', ...focusVisibleWithinRing],
2178
- 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'],
2179
- thumb: ['z-10', 'flex', 'items-center', 'justify-center', 'bg-white', 'shadow-small', 'rounded-full', 'origin-right', 'transition-all', 'pointer-events-none', 'text-black'],
2180
- startContent: ['z-0 absolute start-1.5 text-current', 'opacity-0', 'scale-50', 'transition-transform-opacity', 'group-data-[selected=true]:scale-100', 'group-data-[selected=true]:opacity-100'],
2181
- endContent: ['z-0 absolute end-1.5 text-neutral', 'opacity-100', 'transition-transform-opacity', 'group-data-[selected=true]:translate-x-3', 'group-data-[selected=true]:opacity-0']
2182
- },
2183
- variants: {
2184
- isDisabled: {
2185
- true: {
2186
- wrapper: 'opacity-disabled pointer-events-none'
2187
- }
2188
- },
2189
- size: {
2190
- sm: {
2191
- wrapper: 'w-6 h-3 px-[2px]',
2192
- thumb: ['w-2 h-2 text-xs', 'group-data-[selected=true]:ms-3'],
2193
- endContent: 'text-xs',
2194
- startContent: 'text-xs',
2195
- label: 'text-small'
2196
- },
2197
- md: {
2198
- wrapper: 'w-11 h-6',
2199
- thumb: ['w-4 h-4 text-sm', 'group-data-[selected=true]:ms-5'],
2200
- endContent: 'text-sm',
2201
- startContent: 'text-sm',
2202
- label: 'text-md'
2203
- },
2204
- lg: {
2205
- wrapper: 'w-12 h-7',
2206
- thumb: ['w-5 h-5 text-medium', 'group-data-[selected=true]:ms-5'],
2207
- endContent: 'text-md',
2208
- startContent: 'text-md',
2209
- label: 'text-lg'
2210
- }
2211
- },
2212
- intent: {
2213
- default: {
2214
- wrapper: ['group-data-[selected=true]:bg-neutral-firm', 'group-data-[selected=true]:text-on-neutral-firm']
2215
- },
2216
- primary: {
2217
- wrapper: ['group-data-[selected=true]:bg-primary', 'group-data-[selected=true]:text-on-primary']
2218
- },
2219
- secondary: {
2220
- wrapper: ['group-data-[selected=true]:bg-secondary', 'group-data-[selected=true]:text-on-secondary']
2221
- },
2222
- tertiary: {
2223
- wrapper: ['group-data-[selected=true]:bg-tertiary', 'group-data-[selected=true]:text-on-tertiary']
2224
- },
2225
- success: {
2226
- wrapper: ['group-data-[selected=true]:bg-success', 'group-data-[selected=true]:text-on-success']
2227
- },
2228
- warning: {
2229
- wrapper: ['group-data-[selected=true]:bg-warning', 'group-data-[selected=true]:text-on-warning']
2230
- },
2231
- danger: {
2232
- wrapper: ['group-data-[selected=true]:bg-danger', 'group-data-[selected=true]:text-on-danger']
2233
- }
2234
- }
2235
- },
2236
- defaultVariants: {
2237
- size: 'md',
2238
- intent: 'primary',
2239
- isDisabled: false
2240
- }
2241
- });
2242
-
2243
- const base = tv({
2244
- slots: {
2245
- base: 'flex flex-wrap flex-row items-center',
2246
- labelContainer: 'leading-tight flex items-start',
2247
- inputContainer: 'flex items-center',
2248
- label: 'font-body text-body-xs pl-2 pb-0',
2249
- hint: 'pl-2 flex basis-full before:content-["_"] before:inline-block before:w-[1em] before:h-[1em] shrink-0'
2250
- },
2251
- variants: {
2252
- size: {
2253
- sm: {
2254
- label: 'text-body-2xs'
2255
- },
2256
- md: '',
2257
- lg: ''
2258
- }
2259
- },
2260
- defaultVariants: {
2261
- size: 'md'
2262
- }
2263
- });
2264
- const formCheckbox = tv({
2265
- extend: base,
2266
- slots: {
2267
- checkbox: ''
2268
- }
2269
- });
2270
- const formRadio = tv({
2271
- extend: base,
2272
- slots: {
2273
- radio: ''
2274
- }
2275
- });
2276
- const baseGroup = tv({
2277
- slots: {
2278
- base: '',
2279
- label: 'pb-1 last:pb-0',
2280
- hint: 'pb-1 last:pb-0',
2281
- feedback: 'pt-0 flex-[1_100%]'
2282
- },
2283
- variants: {
2284
- isInline: {
2285
- true: {
2286
- base: 'flex flex-wrap flex-row items-start',
2287
- label: 'pr-4 pb-0',
2288
- hint: 'pr-4 pb-0',
2289
- feedback: 'pr-4 pb-0'
2290
- }
2291
- }
2292
- }
2293
- });
2294
- const formCheckboxGroup = tv({
2295
- extend: baseGroup,
2296
- slots: {
2297
- formCheckbox: 'pb-1 last:pb-0'
2298
- },
2299
- variants: {
2300
- isInline: {
2301
- true: {
2302
- formCheckbox: 'pr-4 pb-0'
2303
- }
2304
- }
2305
- }
2306
- });
2307
- const formRadioGroup = tv({
2308
- extend: baseGroup,
2309
- slots: {
2310
- formRadio: 'pb-1 last:pb-0'
2311
- },
2312
- variants: {
2313
- isInline: {
2314
- true: {
2315
- formRadio: 'pr-4 pb-0'
2316
- }
2317
- }
2318
- }
2319
- });
2320
- const formInput = tv({
2321
- slots: {
2322
- base: 'flex flex-wrap flex-row',
2323
- label: 'flex-[1_100%]',
2324
- input: '',
2325
- hint: 'flex-[1_100%]',
2326
- feedback: 'flex-[1_100%]'
2327
- },
2328
- variants: {
2329
- size: {
2330
- sm: '',
2331
- md: '',
2332
- lg: ''
2333
- }
2334
- },
2335
- defaultVariants: {
2336
- size: 'md'
2337
- }
2338
- });
2339
- const formTextarea = tv({
2340
- extend: formInput
2341
- });
2342
- const formSelect = tv({
2343
- slots: {
2344
- base: 'flex flex-wrap flex-row',
2345
- label: 'flex-[1_100%]',
2346
- select: '',
2347
- hint: 'flex-[1_100%]',
2348
- feedback: 'flex-[1_100%]'
2349
- },
2350
- variants: {
2351
- size: {
2352
- sm: '',
2353
- md: '',
2354
- lg: ''
2355
- }
2356
- },
2357
- defaultVariants: {
2358
- size: 'md'
2359
- }
2360
- });
2361
-
2362
- export { nativeSelect as A, notificationCard as B, notificationTransitions as C, notificationsContainer as D, overlay as E, overlayTransitions as F, popover as G, progressBar as H, radio as I, radioGroup as J, select as K, skeleton as L, spinner as M, switchInput as N, table as O, textarea as P, toggleButton as Q, tv as R, twMerge as S, autocomplete as a, avatar as b, backdrop as c, button as d, buttonGroup as e, checkbox as f, checkboxGroup as g, chip as h, closeButton as i, divider as j, drawer as k, dropdownContent as l, formCheckbox as m, formCheckboxGroup as n, formDescription as o, formFeedback as p, formInput as q, formRadio as r, formRadioGroup as s, formSelect as t, formTextarea as u, input as v, label as w, listbox as x, listboxItem as y, modal as z };
2363
- //# sourceMappingURL=forms-legacy-9Umui1Bp.js.map