@frontile/theme 0.18.0-alpha.16 → 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.
- package/declarations/colors/util.d.ts +2 -1
- package/declarations/colors.d.ts +1 -0
- package/declarations/components/button.d.ts +49 -1
- package/declarations/components/command.d.ts +281 -0
- package/declarations/components/forms/forms.d.ts +259 -1
- package/declarations/components/index.d.ts +4 -0
- package/declarations/components/kbd.d.ts +315 -0
- package/declarations/components/listbox.d.ts +96 -4
- package/declarations/components/notification-card.d.ts +173 -104
- package/declarations/components/notifications-container.d.ts +102 -33
- package/declarations/components/overlays.d.ts +45 -0
- package/declarations/components/segmented-control.d.ts +463 -0
- package/declarations/components/table.d.ts +1 -1
- package/declarations/components/tabs.d.ts +463 -0
- package/dist/colors.js +2 -1
- package/dist/colors.js.map +1 -1
- package/dist/index.js +2999 -4
- package/dist/index.js.map +1 -1
- package/dist/overlays-aq0rSm6R.js +372 -0
- package/dist/overlays-aq0rSm6R.js.map +1 -0
- package/dist/plugin.js +6 -42
- package/dist/plugin.js.map +1 -1
- package/dist/{config-BZyMPeuH.js → util-CHV5ZmrC.js} +40 -2
- package/dist/util-CHV5ZmrC.js.map +1 -0
- package/package.json +2 -2
- package/src/index.css +17 -0
- package/dist/config-BZyMPeuH.js.map +0 -1
- package/dist/forms-legacy-D7knB8hB.js +0 -2363
- package/dist/forms-legacy-D7knB8hB.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,2993 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { t as tv, b as backdrop, d as drawer, m as modal, o as overlay, a as overlayTransitions } from './overlays-aq0rSm6R.js';
|
|
2
|
+
export { c as twMerge } from './overlays-aq0rSm6R.js';
|
|
3
|
+
|
|
4
|
+
const avatar = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
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'],
|
|
7
|
+
img: 'size-full',
|
|
8
|
+
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']
|
|
9
|
+
},
|
|
10
|
+
variants: {
|
|
11
|
+
shape: {
|
|
12
|
+
square: 'rounded-[20%]',
|
|
13
|
+
circle: 'rounded-full'
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
xs: {
|
|
17
|
+
base: 'size-5 text-label-2xs'
|
|
18
|
+
},
|
|
19
|
+
sm: {
|
|
20
|
+
base: 'size-6 text-label-xs'
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
base: 'size-8 text-label-sm'
|
|
24
|
+
},
|
|
25
|
+
lg: {
|
|
26
|
+
base: 'size-10 text-label-md'
|
|
27
|
+
},
|
|
28
|
+
xl: {
|
|
29
|
+
base: 'size-12 text-label-lg'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
size: 'md',
|
|
35
|
+
shape: 'circle'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
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'];
|
|
40
|
+
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'];
|
|
41
|
+
|
|
42
|
+
const baseButton = tv({
|
|
43
|
+
base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
|
|
44
|
+
variants: {
|
|
45
|
+
appearance: {
|
|
46
|
+
outlined: ''
|
|
47
|
+
},
|
|
48
|
+
intent: {
|
|
49
|
+
default: '',
|
|
50
|
+
primary: 'focus-visible:ring-primary-soft',
|
|
51
|
+
secondary: 'focus-visible:ring-secondary-soft',
|
|
52
|
+
tertiary: 'focus-visible:ring-tertiary-soft',
|
|
53
|
+
success: 'focus-visible:ring-success-soft',
|
|
54
|
+
warning: 'focus-visible:ring-warning-soft',
|
|
55
|
+
danger: 'focus-visible:ring-danger-soft'
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
xs: 'text-strong-sm px-4 py-1 gap-1 rounded-full',
|
|
59
|
+
sm: 'text-strong-md px-5 py-1.5 gap-1 rounded-full',
|
|
60
|
+
md: 'text-strong-lg px-6 py-2 gap-1.5 rounded-full',
|
|
61
|
+
lg: 'text-strong-xl px-8 py-2.5 gap-1.5 rounded-full',
|
|
62
|
+
xl: 'text-strong-2xl px-10 py-3 gap-2 rounded-full',
|
|
63
|
+
'2xl': 'text-strong-3xl px-12 py-3.5 gap-2.5 rounded-full'
|
|
64
|
+
},
|
|
65
|
+
isInGroup: {
|
|
66
|
+
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']
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
compoundVariants: [{
|
|
70
|
+
appearance: 'outlined',
|
|
71
|
+
intent: 'default',
|
|
72
|
+
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'
|
|
73
|
+
}, {
|
|
74
|
+
appearance: 'outlined',
|
|
75
|
+
intent: 'primary',
|
|
76
|
+
class: 'text-primary border-primary hover:text-primary-mild hover:border-primary-mild active:text-primary-firm active:border-primary-firm'
|
|
77
|
+
}, {
|
|
78
|
+
appearance: 'outlined',
|
|
79
|
+
intent: 'secondary',
|
|
80
|
+
class: 'text-secondary-strong border-secondary-strong hover:text-secondary-firm hover:border-secondary-firm active:text-secondary-bolder active:border-secondary-bolder'
|
|
81
|
+
}, {
|
|
82
|
+
appearance: 'outlined',
|
|
83
|
+
intent: 'tertiary',
|
|
84
|
+
class: 'text-tertiary-strong border-tertiary-strong hover:text-tertiary-firm hover:border-tertiary-firm active:text-tertiary-bolder active:border-tertiary-bolder'
|
|
85
|
+
}, {
|
|
86
|
+
appearance: 'outlined',
|
|
87
|
+
intent: 'success',
|
|
88
|
+
class: 'text-success-strong border-success-strong hover:text-success-firm hover:border-success-firm active:text-success-bolder active:border-success-bolder'
|
|
89
|
+
}, {
|
|
90
|
+
appearance: 'outlined',
|
|
91
|
+
intent: 'warning',
|
|
92
|
+
class: 'text-warning-strong border-warning-strong hover:text-warning-firm hover:border-warning-firm active:text-warning-bolder active:border-warning-bolder'
|
|
93
|
+
}, {
|
|
94
|
+
appearance: 'outlined',
|
|
95
|
+
intent: 'danger',
|
|
96
|
+
class: 'text-danger border-danger hover:text-danger-mild hover:border-danger-mild active:text-danger-firm active:border-danger-firm'
|
|
97
|
+
}],
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
size: 'md',
|
|
100
|
+
intent: 'default'
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const button = tv({
|
|
104
|
+
extend: baseButton,
|
|
105
|
+
base: [''],
|
|
106
|
+
variants: {
|
|
107
|
+
appearance: {
|
|
108
|
+
default: 'shadow-elevation-2',
|
|
109
|
+
soft: '',
|
|
110
|
+
outlined: '',
|
|
111
|
+
minimal: '',
|
|
112
|
+
tonal: 'shadow-elevation-2',
|
|
113
|
+
custom: ''
|
|
114
|
+
},
|
|
115
|
+
isLoading: {
|
|
116
|
+
true: 'disabled:cursor-progress'
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
compoundVariants: [
|
|
120
|
+
// APPEARANCE: default (Facet "filled") — fill + border + on-color
|
|
121
|
+
{
|
|
122
|
+
appearance: 'default',
|
|
123
|
+
intent: 'default',
|
|
124
|
+
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'
|
|
125
|
+
}, {
|
|
126
|
+
appearance: 'default',
|
|
127
|
+
intent: 'primary',
|
|
128
|
+
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'
|
|
129
|
+
}, {
|
|
130
|
+
appearance: 'default',
|
|
131
|
+
intent: 'secondary',
|
|
132
|
+
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'
|
|
133
|
+
}, {
|
|
134
|
+
appearance: 'default',
|
|
135
|
+
intent: 'tertiary',
|
|
136
|
+
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'
|
|
137
|
+
}, {
|
|
138
|
+
appearance: 'default',
|
|
139
|
+
intent: 'success',
|
|
140
|
+
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'
|
|
141
|
+
}, {
|
|
142
|
+
appearance: 'default',
|
|
143
|
+
intent: 'warning',
|
|
144
|
+
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'
|
|
145
|
+
}, {
|
|
146
|
+
appearance: 'default',
|
|
147
|
+
intent: 'danger',
|
|
148
|
+
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'
|
|
149
|
+
},
|
|
150
|
+
// APPEARANCE: soft — tint fill, plus the border Facet gives it
|
|
151
|
+
{
|
|
152
|
+
appearance: 'soft',
|
|
153
|
+
intent: 'default',
|
|
154
|
+
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'
|
|
155
|
+
}, {
|
|
156
|
+
appearance: 'soft',
|
|
157
|
+
intent: 'primary',
|
|
158
|
+
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'
|
|
159
|
+
}, {
|
|
160
|
+
appearance: 'soft',
|
|
161
|
+
intent: 'secondary',
|
|
162
|
+
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'
|
|
163
|
+
}, {
|
|
164
|
+
appearance: 'soft',
|
|
165
|
+
intent: 'tertiary',
|
|
166
|
+
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'
|
|
167
|
+
}, {
|
|
168
|
+
appearance: 'soft',
|
|
169
|
+
intent: 'success',
|
|
170
|
+
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'
|
|
171
|
+
}, {
|
|
172
|
+
appearance: 'soft',
|
|
173
|
+
intent: 'warning',
|
|
174
|
+
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'
|
|
175
|
+
}, {
|
|
176
|
+
appearance: 'soft',
|
|
177
|
+
intent: 'danger',
|
|
178
|
+
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'
|
|
179
|
+
},
|
|
180
|
+
// APPEARANCE: minimal (Facet "ghost") — ink only, no fill
|
|
181
|
+
{
|
|
182
|
+
appearance: 'minimal',
|
|
183
|
+
intent: 'default',
|
|
184
|
+
class: 'text-neutral-bolder hover:text-neutral-firm/80 active:text-neutral-firm'
|
|
185
|
+
}, {
|
|
186
|
+
appearance: 'minimal',
|
|
187
|
+
intent: 'primary',
|
|
188
|
+
class: 'text-primary hover:text-primary-mild active:text-primary-firm'
|
|
189
|
+
}, {
|
|
190
|
+
appearance: 'minimal',
|
|
191
|
+
intent: 'secondary',
|
|
192
|
+
class: 'text-secondary-strong hover:text-secondary-firm active:text-secondary-bolder'
|
|
193
|
+
}, {
|
|
194
|
+
appearance: 'minimal',
|
|
195
|
+
intent: 'tertiary',
|
|
196
|
+
class: 'text-tertiary-strong hover:text-tertiary-firm active:text-tertiary-bolder'
|
|
197
|
+
}, {
|
|
198
|
+
appearance: 'minimal',
|
|
199
|
+
intent: 'success',
|
|
200
|
+
class: 'text-success-strong hover:text-success-firm active:text-success-bolder'
|
|
201
|
+
}, {
|
|
202
|
+
appearance: 'minimal',
|
|
203
|
+
intent: 'warning',
|
|
204
|
+
class: 'text-warning-strong hover:text-warning-firm active:text-warning-bolder'
|
|
205
|
+
}, {
|
|
206
|
+
appearance: 'minimal',
|
|
207
|
+
intent: 'danger',
|
|
208
|
+
class: 'text-danger hover:text-danger-mild active:text-danger-firm'
|
|
209
|
+
},
|
|
210
|
+
// APPEARANCE: tonal — tint fill that deepens through the ramp
|
|
211
|
+
{
|
|
212
|
+
appearance: 'tonal',
|
|
213
|
+
intent: 'default',
|
|
214
|
+
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'
|
|
215
|
+
}, {
|
|
216
|
+
appearance: 'tonal',
|
|
217
|
+
intent: 'primary',
|
|
218
|
+
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'
|
|
219
|
+
}, {
|
|
220
|
+
appearance: 'tonal',
|
|
221
|
+
intent: 'secondary',
|
|
222
|
+
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'
|
|
223
|
+
}, {
|
|
224
|
+
appearance: 'tonal',
|
|
225
|
+
intent: 'tertiary',
|
|
226
|
+
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'
|
|
227
|
+
}, {
|
|
228
|
+
appearance: 'tonal',
|
|
229
|
+
intent: 'success',
|
|
230
|
+
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'
|
|
231
|
+
}, {
|
|
232
|
+
appearance: 'tonal',
|
|
233
|
+
intent: 'warning',
|
|
234
|
+
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'
|
|
235
|
+
}, {
|
|
236
|
+
appearance: 'tonal',
|
|
237
|
+
intent: 'danger',
|
|
238
|
+
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'
|
|
239
|
+
},
|
|
240
|
+
// APPEARANCE: custom
|
|
241
|
+
{
|
|
242
|
+
appearance: 'custom',
|
|
243
|
+
intent: 'default',
|
|
244
|
+
class: 'text-neutral-strong'
|
|
245
|
+
}, {
|
|
246
|
+
appearance: 'custom',
|
|
247
|
+
intent: 'primary',
|
|
248
|
+
class: 'text-primary-strong'
|
|
249
|
+
}, {
|
|
250
|
+
appearance: 'custom',
|
|
251
|
+
intent: 'secondary',
|
|
252
|
+
class: 'text-secondary-strong'
|
|
253
|
+
}, {
|
|
254
|
+
appearance: 'custom',
|
|
255
|
+
intent: 'tertiary',
|
|
256
|
+
class: 'text-tertiary-strong'
|
|
257
|
+
}, {
|
|
258
|
+
appearance: 'custom',
|
|
259
|
+
intent: 'success',
|
|
260
|
+
class: 'text-success-strong'
|
|
261
|
+
}, {
|
|
262
|
+
appearance: 'custom',
|
|
263
|
+
intent: 'warning',
|
|
264
|
+
class: 'text-warning-strong'
|
|
265
|
+
}, {
|
|
266
|
+
appearance: 'custom',
|
|
267
|
+
intent: 'danger',
|
|
268
|
+
class: 'text-danger-strong'
|
|
269
|
+
}],
|
|
270
|
+
defaultVariants: {
|
|
271
|
+
size: 'md',
|
|
272
|
+
intent: 'primary'
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
const toggleButton = tv({
|
|
276
|
+
extend: baseButton,
|
|
277
|
+
base: [''],
|
|
278
|
+
variants: {
|
|
279
|
+
isSelected: {
|
|
280
|
+
true: ''
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
// Selected is a *filled* state, so every color has to be restated here —
|
|
284
|
+
// fill, border and ink, for the resting, hover and active steps. The
|
|
285
|
+
// unselected `outlined` rules in `baseButton` set their own
|
|
286
|
+
// `hover:text-*`/`active:*` colors, and anything we leave out keeps leaking
|
|
287
|
+
// through: an unselected ink color over a selected fill is what produced the
|
|
288
|
+
// unreadable label on hover. The ramp matches the filled button
|
|
289
|
+
// (`appearance: 'default'`) — one step deeper on hover, another on active —
|
|
290
|
+
// and pairs each fill with its generated `on-*` contrast ink.
|
|
291
|
+
compoundVariants: [{
|
|
292
|
+
appearance: 'outlined',
|
|
293
|
+
intent: 'default',
|
|
294
|
+
isSelected: true,
|
|
295
|
+
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'
|
|
296
|
+
}, {
|
|
297
|
+
appearance: 'outlined',
|
|
298
|
+
intent: 'primary',
|
|
299
|
+
isSelected: true,
|
|
300
|
+
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'
|
|
301
|
+
}, {
|
|
302
|
+
appearance: 'outlined',
|
|
303
|
+
intent: 'secondary',
|
|
304
|
+
isSelected: true,
|
|
305
|
+
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'
|
|
306
|
+
}, {
|
|
307
|
+
appearance: 'outlined',
|
|
308
|
+
intent: 'tertiary',
|
|
309
|
+
isSelected: true,
|
|
310
|
+
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'
|
|
311
|
+
}, {
|
|
312
|
+
appearance: 'outlined',
|
|
313
|
+
intent: 'success',
|
|
314
|
+
isSelected: true,
|
|
315
|
+
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'
|
|
316
|
+
}, {
|
|
317
|
+
appearance: 'outlined',
|
|
318
|
+
intent: 'warning',
|
|
319
|
+
isSelected: true,
|
|
320
|
+
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'
|
|
321
|
+
}, {
|
|
322
|
+
appearance: 'outlined',
|
|
323
|
+
intent: 'danger',
|
|
324
|
+
isSelected: true,
|
|
325
|
+
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'
|
|
326
|
+
}]
|
|
327
|
+
});
|
|
328
|
+
const buttonGroup = tv({
|
|
329
|
+
base: ['inline-flex items-stretch justify-center h-auto']
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// The in-button spinner has to inherit the button's ink. `spinner`'s own base
|
|
333
|
+
// is `text-neutral-muted` / `fill-neutral-strong`, which is invisible on a
|
|
334
|
+
// filled primary button. `size-[1em]` makes it track the button's font size
|
|
335
|
+
// across all six sizes, matching the base button's `[&_svg]:size-[1em]`.
|
|
336
|
+
const buttonSpinner = tv({
|
|
337
|
+
base: 'size-[1em] text-current/25 fill-current'
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
const chip = tv({
|
|
341
|
+
slots: {
|
|
342
|
+
base: ['whitespace-nowrap', 'inline-flex items-center justify-between box-border'],
|
|
343
|
+
// label text role (size set per size variant)
|
|
344
|
+
content: ['flex-1 text-inherit font-label'],
|
|
345
|
+
dot: ['shrink-0', 'ml-1', 'rounded-full'],
|
|
346
|
+
closeButton: ['shrink-0', 'p-0.5',
|
|
347
|
+
// The shared ring is drawn with a background-coloured offset, which
|
|
348
|
+
// inside a chip reads as a hole punched in the chip.
|
|
349
|
+
'focus-visible:ring-2 focus-visible:ring-offset-0', 'disabled:cursor-not-allowed']
|
|
350
|
+
},
|
|
351
|
+
variants: {
|
|
352
|
+
isDisabled: {
|
|
353
|
+
true: 'opacity-disabled cursor-not-allowed'
|
|
354
|
+
},
|
|
355
|
+
appearance: {
|
|
356
|
+
default: '',
|
|
357
|
+
outlined: '',
|
|
358
|
+
faded: ''
|
|
359
|
+
},
|
|
360
|
+
// The close button is a filled circle in every appearance. `-muted` is
|
|
361
|
+
// light enough to sit on the page in `outlined`/`faded` and to read as a
|
|
362
|
+
// disc on a filled chip, and each level carries its own `on-` colour — the
|
|
363
|
+
// pairing this used to get wrong, by putting `text-on-{intent}` (the
|
|
364
|
+
// contrast colour for the DEFAULT level) on a `-muted` circle.
|
|
365
|
+
intent: {
|
|
366
|
+
default: {
|
|
367
|
+
dot: 'bg-neutral-strong',
|
|
368
|
+
closeButton: 'bg-neutral-muted text-on-neutral-muted'
|
|
369
|
+
},
|
|
370
|
+
primary: {
|
|
371
|
+
dot: 'bg-primary',
|
|
372
|
+
closeButton: 'bg-primary-muted text-on-primary-muted'
|
|
373
|
+
},
|
|
374
|
+
secondary: {
|
|
375
|
+
dot: 'bg-secondary',
|
|
376
|
+
closeButton: 'bg-secondary-muted text-on-secondary-muted'
|
|
377
|
+
},
|
|
378
|
+
tertiary: {
|
|
379
|
+
dot: 'bg-tertiary',
|
|
380
|
+
closeButton: 'bg-tertiary-muted text-on-tertiary-muted'
|
|
381
|
+
},
|
|
382
|
+
success: {
|
|
383
|
+
dot: 'bg-success',
|
|
384
|
+
closeButton: 'bg-success-muted text-on-success-muted'
|
|
385
|
+
},
|
|
386
|
+
warning: {
|
|
387
|
+
dot: 'bg-warning',
|
|
388
|
+
closeButton: 'bg-warning-muted text-on-warning-muted'
|
|
389
|
+
},
|
|
390
|
+
danger: {
|
|
391
|
+
dot: 'bg-danger',
|
|
392
|
+
closeButton: 'bg-danger-muted text-on-danger-muted'
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
size: {
|
|
396
|
+
sm: {
|
|
397
|
+
base: 'text-label-2xs px-1 h-6',
|
|
398
|
+
content: 'px-1',
|
|
399
|
+
dot: 'size-1.5',
|
|
400
|
+
closeButton: 'text-label-2xs'
|
|
401
|
+
},
|
|
402
|
+
md: {
|
|
403
|
+
base: 'text-label-xs px-1 h-7',
|
|
404
|
+
content: 'px-2',
|
|
405
|
+
dot: 'size-2',
|
|
406
|
+
closeButton: 'text-label-xs'
|
|
407
|
+
},
|
|
408
|
+
lg: {
|
|
409
|
+
base: 'text-label-md px-2 h-8',
|
|
410
|
+
content: 'px-2',
|
|
411
|
+
dot: 'size-2.5',
|
|
412
|
+
closeButton: 'text-label-md'
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
radius: {
|
|
416
|
+
none: 'rounded-none',
|
|
417
|
+
sm: 'rounded-sm',
|
|
418
|
+
lg: 'rounded-lg',
|
|
419
|
+
full: 'rounded-full'
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
compoundVariants: [
|
|
423
|
+
// A filled chip's background *is* the intent colour, so an intent-coloured
|
|
424
|
+
// dot disappears into it. Inherit the chip's text colour instead — the one
|
|
425
|
+
// colour guaranteed to contrast the fill.
|
|
426
|
+
{
|
|
427
|
+
appearance: 'default',
|
|
428
|
+
class: {
|
|
429
|
+
dot: 'bg-current'
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
// APPEARANCE: default (filled)
|
|
433
|
+
//
|
|
434
|
+
// The chip's own fill is the intent's DEFAULT level, so the close button
|
|
435
|
+
// cannot hover *towards* it the way the other two appearances do — the
|
|
436
|
+
// circle would vanish into the chip. It steps down to `-subtle` instead.
|
|
437
|
+
{
|
|
438
|
+
appearance: 'default',
|
|
439
|
+
intent: 'default',
|
|
440
|
+
class: {
|
|
441
|
+
base: 'bg-neutral-bolder text-on-neutral-bolder',
|
|
442
|
+
closeButton: 'hover:bg-neutral-subtle hover:text-on-neutral-subtle'
|
|
443
|
+
}
|
|
444
|
+
}, {
|
|
445
|
+
appearance: 'default',
|
|
446
|
+
intent: 'primary',
|
|
447
|
+
class: {
|
|
448
|
+
base: 'bg-primary text-on-primary',
|
|
449
|
+
closeButton: 'hover:bg-primary-subtle hover:text-on-primary-subtle'
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
appearance: 'default',
|
|
453
|
+
intent: 'secondary',
|
|
454
|
+
class: {
|
|
455
|
+
base: 'bg-secondary text-on-secondary',
|
|
456
|
+
closeButton: 'hover:bg-secondary-subtle hover:text-on-secondary-subtle'
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
appearance: 'default',
|
|
460
|
+
intent: 'tertiary',
|
|
461
|
+
class: {
|
|
462
|
+
base: 'bg-tertiary text-on-tertiary',
|
|
463
|
+
closeButton: 'hover:bg-tertiary-subtle hover:text-on-tertiary-subtle'
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
appearance: 'default',
|
|
467
|
+
intent: 'success',
|
|
468
|
+
class: {
|
|
469
|
+
base: 'bg-success text-on-success',
|
|
470
|
+
closeButton: 'hover:bg-success-subtle hover:text-on-success-subtle'
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
appearance: 'default',
|
|
474
|
+
intent: 'warning',
|
|
475
|
+
class: {
|
|
476
|
+
base: 'bg-warning text-on-warning',
|
|
477
|
+
closeButton: 'hover:bg-warning-subtle hover:text-on-warning-subtle'
|
|
478
|
+
}
|
|
479
|
+
}, {
|
|
480
|
+
appearance: 'default',
|
|
481
|
+
intent: 'danger',
|
|
482
|
+
class: {
|
|
483
|
+
base: 'bg-danger text-on-danger',
|
|
484
|
+
closeButton: 'hover:bg-danger-subtle hover:text-on-danger-subtle'
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
// APPEARANCE: faded (tonal)
|
|
488
|
+
{
|
|
489
|
+
appearance: 'faded',
|
|
490
|
+
intent: 'default',
|
|
491
|
+
class: {
|
|
492
|
+
base: 'text-neutral-strong bg-neutral-subtle',
|
|
493
|
+
closeButton: 'hover:bg-neutral hover:text-on-neutral'
|
|
494
|
+
}
|
|
495
|
+
}, {
|
|
496
|
+
appearance: 'faded',
|
|
497
|
+
intent: 'primary',
|
|
498
|
+
class: {
|
|
499
|
+
base: 'text-primary-strong bg-primary-subtle',
|
|
500
|
+
closeButton: 'hover:bg-primary hover:text-on-primary'
|
|
501
|
+
}
|
|
502
|
+
}, {
|
|
503
|
+
appearance: 'faded',
|
|
504
|
+
intent: 'secondary',
|
|
505
|
+
class: {
|
|
506
|
+
base: 'text-secondary-strong bg-secondary-subtle',
|
|
507
|
+
closeButton: 'hover:bg-secondary hover:text-on-secondary'
|
|
508
|
+
}
|
|
509
|
+
}, {
|
|
510
|
+
appearance: 'faded',
|
|
511
|
+
intent: 'tertiary',
|
|
512
|
+
class: {
|
|
513
|
+
base: 'text-tertiary-strong bg-tertiary-subtle',
|
|
514
|
+
closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
appearance: 'faded',
|
|
518
|
+
intent: 'success',
|
|
519
|
+
class: {
|
|
520
|
+
base: 'text-success-strong bg-success-subtle',
|
|
521
|
+
closeButton: 'hover:bg-success hover:text-on-success'
|
|
522
|
+
}
|
|
523
|
+
}, {
|
|
524
|
+
appearance: 'faded',
|
|
525
|
+
intent: 'warning',
|
|
526
|
+
class: {
|
|
527
|
+
base: 'text-warning-strong bg-warning-subtle',
|
|
528
|
+
closeButton: 'hover:bg-warning hover:text-on-warning'
|
|
529
|
+
}
|
|
530
|
+
}, {
|
|
531
|
+
appearance: 'faded',
|
|
532
|
+
intent: 'danger',
|
|
533
|
+
class: {
|
|
534
|
+
base: 'text-danger-strong bg-danger-subtle',
|
|
535
|
+
closeButton: 'hover:bg-danger hover:text-on-danger'
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
// APPEARANCE: outlined
|
|
539
|
+
{
|
|
540
|
+
appearance: 'outlined',
|
|
541
|
+
intent: 'default',
|
|
542
|
+
class: {
|
|
543
|
+
base: 'text-neutral-strong border border-neutral',
|
|
544
|
+
closeButton: 'hover:bg-neutral hover:text-on-neutral'
|
|
545
|
+
}
|
|
546
|
+
}, {
|
|
547
|
+
appearance: 'outlined',
|
|
548
|
+
intent: 'primary',
|
|
549
|
+
class: {
|
|
550
|
+
base: 'text-primary-strong border border-primary',
|
|
551
|
+
closeButton: 'hover:bg-primary hover:text-on-primary'
|
|
552
|
+
}
|
|
553
|
+
}, {
|
|
554
|
+
appearance: 'outlined',
|
|
555
|
+
intent: 'secondary',
|
|
556
|
+
class: {
|
|
557
|
+
base: 'text-secondary-strong border border-secondary',
|
|
558
|
+
closeButton: 'hover:bg-secondary hover:text-on-secondary'
|
|
559
|
+
}
|
|
560
|
+
}, {
|
|
561
|
+
appearance: 'outlined',
|
|
562
|
+
intent: 'tertiary',
|
|
563
|
+
class: {
|
|
564
|
+
base: 'text-tertiary-strong border border-tertiary',
|
|
565
|
+
closeButton: 'hover:bg-tertiary hover:text-on-tertiary'
|
|
566
|
+
}
|
|
567
|
+
}, {
|
|
568
|
+
appearance: 'outlined',
|
|
569
|
+
intent: 'success',
|
|
570
|
+
class: {
|
|
571
|
+
base: 'text-success-strong border border-success',
|
|
572
|
+
closeButton: 'hover:bg-success hover:text-on-success'
|
|
573
|
+
}
|
|
574
|
+
}, {
|
|
575
|
+
appearance: 'outlined',
|
|
576
|
+
intent: 'warning',
|
|
577
|
+
class: {
|
|
578
|
+
base: 'text-warning-strong border border-warning',
|
|
579
|
+
closeButton: 'hover:bg-warning hover:text-on-warning'
|
|
580
|
+
}
|
|
581
|
+
}, {
|
|
582
|
+
appearance: 'outlined',
|
|
583
|
+
intent: 'danger',
|
|
584
|
+
class: {
|
|
585
|
+
base: 'text-danger-strong border border-danger',
|
|
586
|
+
closeButton: 'hover:bg-danger hover:text-on-danger'
|
|
587
|
+
}
|
|
588
|
+
}],
|
|
589
|
+
defaultVariants: {
|
|
590
|
+
size: 'md',
|
|
591
|
+
intent: 'default',
|
|
592
|
+
appearance: 'default',
|
|
593
|
+
radius: 'full'
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
const progressBar = tv({
|
|
598
|
+
slots: {
|
|
599
|
+
base: ['overflow-hidden w-full bg-surface-overlay-soft'],
|
|
600
|
+
label: ['flex justify-between pb-1 gap-2 font-label text-label-sm'],
|
|
601
|
+
progress: [''],
|
|
602
|
+
description: ['text-neutral font-body text-body-2xs pb-1']
|
|
603
|
+
},
|
|
604
|
+
variants: {
|
|
605
|
+
isIndeterminate: {
|
|
606
|
+
true: {
|
|
607
|
+
progress: ['animate-loading origin-left']
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
intent: {
|
|
611
|
+
default: {
|
|
612
|
+
progress: 'bg-neutral-strong'
|
|
613
|
+
},
|
|
614
|
+
primary: {
|
|
615
|
+
progress: 'bg-primary-soft'
|
|
616
|
+
},
|
|
617
|
+
secondary: {
|
|
618
|
+
progress: 'bg-secondary-soft'
|
|
619
|
+
},
|
|
620
|
+
tertiary: {
|
|
621
|
+
progress: 'bg-tertiary-soft'
|
|
622
|
+
},
|
|
623
|
+
success: {
|
|
624
|
+
progress: 'bg-success-soft'
|
|
625
|
+
},
|
|
626
|
+
warning: {
|
|
627
|
+
progress: 'bg-warning-soft'
|
|
628
|
+
},
|
|
629
|
+
danger: {
|
|
630
|
+
progress: 'bg-danger-soft'
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
size: {
|
|
634
|
+
xs: {
|
|
635
|
+
base: 'h-1',
|
|
636
|
+
progress: 'h-1',
|
|
637
|
+
label: 'text-label-2xs',
|
|
638
|
+
description: 'text-body-2xs'
|
|
639
|
+
},
|
|
640
|
+
sm: {
|
|
641
|
+
base: 'h-2',
|
|
642
|
+
progress: 'h-2',
|
|
643
|
+
label: 'text-label-xs',
|
|
644
|
+
description: 'text-body-2xs'
|
|
645
|
+
},
|
|
646
|
+
md: {
|
|
647
|
+
base: 'h-4',
|
|
648
|
+
progress: 'h-4'
|
|
649
|
+
},
|
|
650
|
+
lg: {
|
|
651
|
+
base: 'h-8',
|
|
652
|
+
progress: 'h-8',
|
|
653
|
+
label: 'text-label-md',
|
|
654
|
+
description: 'text-body-sm'
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
radius: {
|
|
658
|
+
none: 'rounded-none',
|
|
659
|
+
sm: 'rounded-sm',
|
|
660
|
+
lg: 'rounded-lg',
|
|
661
|
+
full: 'rounded-full'
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
defaultVariants: {
|
|
665
|
+
size: 'md',
|
|
666
|
+
intent: 'default',
|
|
667
|
+
radius: 'sm'
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
const closeButton = tv({
|
|
672
|
+
slots: {
|
|
673
|
+
base: ['rounded-full transition duration-200 text-inherit', ...focusVisibleRing],
|
|
674
|
+
icon: 'size-[1em]'
|
|
675
|
+
},
|
|
676
|
+
variants: {
|
|
677
|
+
size: {
|
|
678
|
+
xs: {
|
|
679
|
+
base: 'text-sm p-1'
|
|
680
|
+
},
|
|
681
|
+
sm: {
|
|
682
|
+
base: 'text-base p-2'
|
|
683
|
+
},
|
|
684
|
+
md: {
|
|
685
|
+
base: 'text-xl p-2'
|
|
686
|
+
},
|
|
687
|
+
lg: {
|
|
688
|
+
base: 'text-2xl p-3'
|
|
689
|
+
},
|
|
690
|
+
xl: {
|
|
691
|
+
base: 'text-4xl p-3'
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
variant: {
|
|
695
|
+
transparent: {
|
|
696
|
+
base: ['bg-transparent', 'hover:bg-surface-overlay-subtle']
|
|
697
|
+
},
|
|
698
|
+
subtle: {
|
|
699
|
+
base: ['bg-neutral-subtle', 'text-on-neutral-subtle', 'hover:bg-surface-overlay-subtle']
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
defaultVariants: {
|
|
704
|
+
size: 'md',
|
|
705
|
+
variant: 'transparent'
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
const command = tv({
|
|
710
|
+
slots: {
|
|
711
|
+
// Padded, with the input inset as its own field: the palette reads as one
|
|
712
|
+
// surface holding a search box and its results, not as a form control
|
|
713
|
+
// with a list glued underneath.
|
|
714
|
+
base: ['flex flex-col', 'w-full min-w-0', 'p-2', 'overflow-hidden', 'text-on-surface-modal'],
|
|
715
|
+
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'],
|
|
716
|
+
inputIcon: ['size-4 shrink-0', 'text-neutral'],
|
|
717
|
+
input: ['h-full w-full', 'bg-transparent', 'font-body text-body-sm', 'outline-hidden', 'placeholder:text-neutral', 'disabled:cursor-not-allowed disabled:opacity-disabled'],
|
|
718
|
+
// The `size` variant gives the list a minimum height on purpose: without
|
|
719
|
+
// one the panel collapses and re-expands on every keystroke as results
|
|
720
|
+
// narrow, which reads as jitter.
|
|
721
|
+
//
|
|
722
|
+
// The palette wants denser, plainer rows than a Dropdown menu does. The
|
|
723
|
+
// descendant utilities below apply that without forking `listboxItem`.
|
|
724
|
+
// They must stay as literal strings: Tailwind finds classes by scanning
|
|
725
|
+
// source text, so a class assembled with interpolation is never generated.
|
|
726
|
+
// No `overscroll-contain`: the list is a scroll container even when its
|
|
727
|
+
// items fit, and containing overscroll there swallows wheel events over an
|
|
728
|
+
// inline palette so the page behind it cannot scroll. The dialog does not
|
|
729
|
+
// need it either -- body scroll is locked while it is open.
|
|
730
|
+
list: [
|
|
731
|
+
// Vertical rhythm: 8px above the first heading, 4px between rows, a
|
|
732
|
+
// padded group above each divider, and room before the footer.
|
|
733
|
+
'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',
|
|
734
|
+
// rows
|
|
735
|
+
'[&_[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',
|
|
736
|
+
// Active row: a solid fill, no outline. `neutral-subtle` is too close to
|
|
737
|
+
// the panel surface in dark mode to read as a highlight, leaving only a
|
|
738
|
+
// hairline box; `neutral-muted` is one step up and visible in both schemes.
|
|
739
|
+
'[&_[data-component=listbox-item][data-active=true]]:bg-neutral-muted', '[&_[data-component=listbox-item][data-active=true]]:text-neutral-bolder',
|
|
740
|
+
// row text
|
|
741
|
+
'[&_[data-test-id=listbox-item-label]]:text-body-sm', '[&_[data-test-id=listbox-item-label]]:font-medium',
|
|
742
|
+
// leading icons are sized and muted unless the consumer says otherwise
|
|
743
|
+
'[&_[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',
|
|
744
|
+
// group headings
|
|
745
|
+
'[&_[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'],
|
|
746
|
+
empty: ['py-6', 'text-center', 'font-body text-body-sm', 'text-neutral'],
|
|
747
|
+
loading: ['flex items-center justify-center gap-2', 'py-6', 'font-body text-body-sm', 'text-neutral'],
|
|
748
|
+
// Bleeds to the panel edges, so it reads as the palette's chrome rather
|
|
749
|
+
// than as a row.
|
|
750
|
+
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'],
|
|
751
|
+
footerHint: 'flex items-center gap-1.5',
|
|
752
|
+
// Empty on purpose: an override hook so `@classes={{hash kbd="..."}}`
|
|
753
|
+
// reaches the keycap, which `Kbd` itself draws.
|
|
754
|
+
kbd: ''
|
|
755
|
+
},
|
|
756
|
+
variants: {
|
|
757
|
+
size: {
|
|
758
|
+
sm: {
|
|
759
|
+
list: 'max-h-64 min-h-32'
|
|
760
|
+
},
|
|
761
|
+
md: {
|
|
762
|
+
list: 'max-h-80 min-h-48'
|
|
763
|
+
},
|
|
764
|
+
lg: {
|
|
765
|
+
list: 'max-h-96 min-h-64'
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
/**
|
|
769
|
+
* Draws the palette's own surface, for use outside a dialog. A shrink-wrap
|
|
770
|
+
* layout would otherwise size it to its widest row, so it also carries a
|
|
771
|
+
* sensible minimum width.
|
|
772
|
+
*/
|
|
773
|
+
isBordered: {
|
|
774
|
+
true: {
|
|
775
|
+
base: [
|
|
776
|
+
// A percentage here would resolve against a shrink-wrapped parent's
|
|
777
|
+
// indefinite width and vanish; the rem floor is what actually holds.
|
|
778
|
+
'min-w-[28rem] max-w-full', 'rounded-xl', 'bg-surface-modal', 'border border-surface-overlay-mild', 'shadow-md'],
|
|
779
|
+
footer: 'rounded-b-xl'
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
defaultVariants: {
|
|
784
|
+
size: 'md'
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
const commandDialog = tv({
|
|
788
|
+
slots: {
|
|
789
|
+
// Sits the panel below the top edge rather than centering it: a palette is
|
|
790
|
+
// read top-down, and a vertically centered one moves as results change.
|
|
791
|
+
base: 'w-full max-w-lg px-4 mt-[12vh] mb-8 sm:mt-[15vh]',
|
|
792
|
+
panel: ['relative flex flex-col', 'w-full', 'overflow-hidden', 'rounded-xl', 'bg-surface-modal', 'text-on-surface-modal', 'border border-surface-overlay-mild',
|
|
793
|
+
// The soft outer ring is what separates the panel from the scrim; a
|
|
794
|
+
// shadow alone reads as flat against a dark backdrop.
|
|
795
|
+
'ring-4 ring-neutral-soft/40', 'shadow-2xl', 'outline-hidden']
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
const kbd = tv({
|
|
800
|
+
slots: {
|
|
801
|
+
// The wrapper draws nothing: it only lines the caps up. `font-label`, not
|
|
802
|
+
// `font-code` -- the modifier glyphs (⌘ ⇧ ⌥ ⌃) render poorly in most
|
|
803
|
+
// monospace faces, and a keycap is a UI affordance rather than sample code.
|
|
804
|
+
base: ['inline-flex items-center align-middle', 'font-label', 'select-none', 'whitespace-nowrap'],
|
|
805
|
+
// Each cap. `min-w` is set per size to match its height, so a lone `K` stays
|
|
806
|
+
// square instead of collapsing to the width of the letter.
|
|
807
|
+
// `font-label` is repeated here rather than inherited from `base`: the CSS
|
|
808
|
+
// reset styles the `kbd` element itself as monospace, and an element rule
|
|
809
|
+
// beats inheritance, so the cap must name its own font.
|
|
810
|
+
key: ['inline-flex items-center justify-center', 'shrink-0', 'font-label', 'leading-none', '[&_svg]:size-3'],
|
|
811
|
+
separator: ['shrink-0', 'text-neutral', 'px-0.5']
|
|
812
|
+
},
|
|
813
|
+
variants: {
|
|
814
|
+
size: {
|
|
815
|
+
sm: {
|
|
816
|
+
base: 'gap-0.5 text-label-2xs',
|
|
817
|
+
key: 'h-5 min-w-5 px-1 rounded text-label-2xs'
|
|
818
|
+
},
|
|
819
|
+
md: {
|
|
820
|
+
base: 'gap-1 text-label-xs',
|
|
821
|
+
key: 'h-6 min-w-6 px-1.5 rounded-md text-label-xs'
|
|
822
|
+
},
|
|
823
|
+
lg: {
|
|
824
|
+
base: 'gap-1 text-label-sm',
|
|
825
|
+
key: 'h-7 min-w-7 px-2 rounded-md text-label-sm'
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
// Colours live in the compound variants below, paired with `intent`.
|
|
829
|
+
appearance: {
|
|
830
|
+
default: {
|
|
831
|
+
key: 'border border-transparent'
|
|
832
|
+
},
|
|
833
|
+
outlined: {
|
|
834
|
+
key: 'border bg-transparent'
|
|
835
|
+
},
|
|
836
|
+
faded: {
|
|
837
|
+
key: 'border'
|
|
838
|
+
},
|
|
839
|
+
// Follows whatever colour it is sitting on. This is what lets a keycap
|
|
840
|
+
// ride an active, filled Listbox row without the row's theme having to
|
|
841
|
+
// repaint it for every intent.
|
|
842
|
+
inherit: {
|
|
843
|
+
key: 'border border-current/20 bg-transparent text-current'
|
|
844
|
+
},
|
|
845
|
+
// No box at all. For dense rows where a keycap would be visual noise and
|
|
846
|
+
// the shortcut should read as quiet trailing text.
|
|
847
|
+
plain: {
|
|
848
|
+
key: 'border-0 bg-transparent px-0 min-w-0 text-current tracking-wide'
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
intent: {
|
|
852
|
+
default: {},
|
|
853
|
+
primary: {},
|
|
854
|
+
secondary: {},
|
|
855
|
+
tertiary: {},
|
|
856
|
+
success: {},
|
|
857
|
+
warning: {},
|
|
858
|
+
danger: {}
|
|
859
|
+
},
|
|
860
|
+
/**
|
|
861
|
+
* `merged` puts every glyph inside one cap (`⌘K`); `split` gives each key
|
|
862
|
+
* its own (`⌘` `K`).
|
|
863
|
+
*/
|
|
864
|
+
isMerged: {
|
|
865
|
+
true: {
|
|
866
|
+
base: 'gap-0'
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
compoundVariants: [
|
|
871
|
+
// appearance: default -- a filled cap. `-muted` is light enough to read as
|
|
872
|
+
// a key on a page and each level carries its own `on-` contrast colour.
|
|
873
|
+
{
|
|
874
|
+
appearance: 'default',
|
|
875
|
+
intent: 'default',
|
|
876
|
+
class: {
|
|
877
|
+
key: 'bg-neutral-muted text-on-neutral-muted'
|
|
878
|
+
}
|
|
879
|
+
}, {
|
|
880
|
+
appearance: 'default',
|
|
881
|
+
intent: 'primary',
|
|
882
|
+
class: {
|
|
883
|
+
key: 'bg-primary-muted text-on-primary-muted'
|
|
884
|
+
}
|
|
885
|
+
}, {
|
|
886
|
+
appearance: 'default',
|
|
887
|
+
intent: 'secondary',
|
|
888
|
+
class: {
|
|
889
|
+
key: 'bg-secondary-muted text-on-secondary-muted'
|
|
890
|
+
}
|
|
891
|
+
}, {
|
|
892
|
+
appearance: 'default',
|
|
893
|
+
intent: 'tertiary',
|
|
894
|
+
class: {
|
|
895
|
+
key: 'bg-tertiary-muted text-on-tertiary-muted'
|
|
896
|
+
}
|
|
897
|
+
}, {
|
|
898
|
+
appearance: 'default',
|
|
899
|
+
intent: 'success',
|
|
900
|
+
class: {
|
|
901
|
+
key: 'bg-success-muted text-on-success-muted'
|
|
902
|
+
}
|
|
903
|
+
}, {
|
|
904
|
+
appearance: 'default',
|
|
905
|
+
intent: 'warning',
|
|
906
|
+
class: {
|
|
907
|
+
key: 'bg-warning-muted text-on-warning-muted'
|
|
908
|
+
}
|
|
909
|
+
}, {
|
|
910
|
+
appearance: 'default',
|
|
911
|
+
intent: 'danger',
|
|
912
|
+
class: {
|
|
913
|
+
key: 'bg-danger-muted text-on-danger-muted'
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
// appearance: outlined
|
|
917
|
+
{
|
|
918
|
+
appearance: 'outlined',
|
|
919
|
+
intent: 'default',
|
|
920
|
+
class: {
|
|
921
|
+
key: 'border-neutral text-neutral-strong'
|
|
922
|
+
}
|
|
923
|
+
}, {
|
|
924
|
+
appearance: 'outlined',
|
|
925
|
+
intent: 'primary',
|
|
926
|
+
class: {
|
|
927
|
+
key: 'border-primary text-primary-strong'
|
|
928
|
+
}
|
|
929
|
+
}, {
|
|
930
|
+
appearance: 'outlined',
|
|
931
|
+
intent: 'secondary',
|
|
932
|
+
class: {
|
|
933
|
+
key: 'border-secondary text-secondary-strong'
|
|
934
|
+
}
|
|
935
|
+
}, {
|
|
936
|
+
appearance: 'outlined',
|
|
937
|
+
intent: 'tertiary',
|
|
938
|
+
class: {
|
|
939
|
+
key: 'border-tertiary text-tertiary-strong'
|
|
940
|
+
}
|
|
941
|
+
}, {
|
|
942
|
+
appearance: 'outlined',
|
|
943
|
+
intent: 'success',
|
|
944
|
+
class: {
|
|
945
|
+
key: 'border-success text-success-strong'
|
|
946
|
+
}
|
|
947
|
+
}, {
|
|
948
|
+
appearance: 'outlined',
|
|
949
|
+
intent: 'warning',
|
|
950
|
+
class: {
|
|
951
|
+
key: 'border-warning text-warning-strong'
|
|
952
|
+
}
|
|
953
|
+
}, {
|
|
954
|
+
appearance: 'outlined',
|
|
955
|
+
intent: 'danger',
|
|
956
|
+
class: {
|
|
957
|
+
key: 'border-danger text-danger-strong'
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
// appearance: faded
|
|
961
|
+
{
|
|
962
|
+
appearance: 'faded',
|
|
963
|
+
intent: 'default',
|
|
964
|
+
class: {
|
|
965
|
+
key: 'bg-neutral-subtle border-neutral-soft text-neutral-strong'
|
|
966
|
+
}
|
|
967
|
+
}, {
|
|
968
|
+
appearance: 'faded',
|
|
969
|
+
intent: 'primary',
|
|
970
|
+
class: {
|
|
971
|
+
key: 'bg-primary-subtle border-primary-soft text-primary-strong'
|
|
972
|
+
}
|
|
973
|
+
}, {
|
|
974
|
+
appearance: 'faded',
|
|
975
|
+
intent: 'secondary',
|
|
976
|
+
class: {
|
|
977
|
+
key: 'bg-secondary-subtle border-secondary-soft text-secondary-strong'
|
|
978
|
+
}
|
|
979
|
+
}, {
|
|
980
|
+
appearance: 'faded',
|
|
981
|
+
intent: 'tertiary',
|
|
982
|
+
class: {
|
|
983
|
+
key: 'bg-tertiary-subtle border-tertiary-soft text-tertiary-strong'
|
|
984
|
+
}
|
|
985
|
+
}, {
|
|
986
|
+
appearance: 'faded',
|
|
987
|
+
intent: 'success',
|
|
988
|
+
class: {
|
|
989
|
+
key: 'bg-success-subtle border-success-soft text-success-strong'
|
|
990
|
+
}
|
|
991
|
+
}, {
|
|
992
|
+
appearance: 'faded',
|
|
993
|
+
intent: 'warning',
|
|
994
|
+
class: {
|
|
995
|
+
key: 'bg-warning-subtle border-warning-soft text-warning-strong'
|
|
996
|
+
}
|
|
997
|
+
}, {
|
|
998
|
+
appearance: 'faded',
|
|
999
|
+
intent: 'danger',
|
|
1000
|
+
class: {
|
|
1001
|
+
key: 'bg-danger-subtle border-danger-soft text-danger-strong'
|
|
1002
|
+
}
|
|
1003
|
+
}],
|
|
1004
|
+
defaultVariants: {
|
|
1005
|
+
size: 'md',
|
|
1006
|
+
intent: 'default',
|
|
1007
|
+
appearance: 'default'
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
|
|
1011
|
+
const listbox = tv({
|
|
1012
|
+
base: 'w-full flex flex-col gap-0.5 outline-hidden p-1'
|
|
1013
|
+
});
|
|
1014
|
+
const listboxItem = tv({
|
|
1015
|
+
slots: {
|
|
1016
|
+
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'],
|
|
1017
|
+
descriptionWrapper: 'w-full flex flex-col items-start justify-center',
|
|
1018
|
+
label: 'flex-1 font-body text-body-2xs truncate',
|
|
1019
|
+
description: ['w-full', 'font-body text-body-2xs', 'text-neutral-firm', 'group-hover:text-current'],
|
|
1020
|
+
selectedIcon: ['text-inherit', 'w-4', 'h-4', 'shrink-0']
|
|
1021
|
+
},
|
|
1022
|
+
variants: {
|
|
1023
|
+
appearance: {
|
|
1024
|
+
default: {
|
|
1025
|
+
base: ''
|
|
1026
|
+
},
|
|
1027
|
+
outlined: {
|
|
1028
|
+
base: 'border border-transparent bg-transparent'
|
|
1029
|
+
},
|
|
1030
|
+
faded: {
|
|
1031
|
+
base: ['border border-transparent']
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
intent: {
|
|
1035
|
+
default: {},
|
|
1036
|
+
primary: {},
|
|
1037
|
+
secondary: {},
|
|
1038
|
+
tertiary: {},
|
|
1039
|
+
success: {},
|
|
1040
|
+
warning: {},
|
|
1041
|
+
danger: {}
|
|
1042
|
+
},
|
|
1043
|
+
isActive: {
|
|
1044
|
+
true: {
|
|
1045
|
+
base: []
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
withDivider: {
|
|
1049
|
+
true: {
|
|
1050
|
+
base: ['mb-1.5']
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
isDisabled: {
|
|
1054
|
+
true: {
|
|
1055
|
+
base: 'opacity-disabled pointer-events-none'
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
isSelected: {
|
|
1059
|
+
true: {
|
|
1060
|
+
base: ''
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
defaultVariants: {
|
|
1065
|
+
appearance: 'default',
|
|
1066
|
+
intent: 'default'
|
|
1067
|
+
},
|
|
1068
|
+
compoundVariants: [
|
|
1069
|
+
// appearance: default
|
|
1070
|
+
{
|
|
1071
|
+
appearance: 'default',
|
|
1072
|
+
intent: 'default',
|
|
1073
|
+
class: {
|
|
1074
|
+
base: ['data-is-active:bg-neutral-subtle', 'data-is-active:text-neutral-strong']
|
|
1075
|
+
}
|
|
1076
|
+
}, {
|
|
1077
|
+
appearance: 'default',
|
|
1078
|
+
intent: 'primary',
|
|
1079
|
+
class: {
|
|
1080
|
+
base: ['data-is-active:bg-primary-soft', 'data-is-active:text-on-primary-soft']
|
|
1081
|
+
}
|
|
1082
|
+
}, {
|
|
1083
|
+
appearance: 'default',
|
|
1084
|
+
intent: 'secondary',
|
|
1085
|
+
class: {
|
|
1086
|
+
base: ['data-is-active:bg-secondary-soft', 'data-is-active:text-on-secondary-soft']
|
|
1087
|
+
}
|
|
1088
|
+
}, {
|
|
1089
|
+
appearance: 'default',
|
|
1090
|
+
intent: 'tertiary',
|
|
1091
|
+
class: {
|
|
1092
|
+
base: ['data-is-active:bg-tertiary-soft', 'data-is-active:text-on-tertiary-soft']
|
|
1093
|
+
}
|
|
1094
|
+
}, {
|
|
1095
|
+
appearance: 'default',
|
|
1096
|
+
intent: 'success',
|
|
1097
|
+
class: {
|
|
1098
|
+
base: ['data-is-active:bg-success-soft', 'data-is-active:text-on-success-soft']
|
|
1099
|
+
}
|
|
1100
|
+
}, {
|
|
1101
|
+
appearance: 'default',
|
|
1102
|
+
intent: 'warning',
|
|
1103
|
+
class: {
|
|
1104
|
+
base: ['data-is-active:bg-warning-soft', 'data-is-active:text-on-warning-soft']
|
|
1105
|
+
}
|
|
1106
|
+
}, {
|
|
1107
|
+
appearance: 'default',
|
|
1108
|
+
intent: 'danger',
|
|
1109
|
+
class: {
|
|
1110
|
+
base: ['data-is-active:bg-danger-soft', 'data-is-active:text-on-danger-soft']
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
// appearance: outlined
|
|
1114
|
+
{
|
|
1115
|
+
appearance: 'outlined',
|
|
1116
|
+
intent: 'default',
|
|
1117
|
+
class: {
|
|
1118
|
+
base: ['data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
|
|
1119
|
+
}
|
|
1120
|
+
}, {
|
|
1121
|
+
appearance: 'outlined',
|
|
1122
|
+
intent: 'primary',
|
|
1123
|
+
class: {
|
|
1124
|
+
base: ['data-is-active:border-primary', 'data-is-active:text-primary-strong']
|
|
1125
|
+
}
|
|
1126
|
+
}, {
|
|
1127
|
+
appearance: 'outlined',
|
|
1128
|
+
intent: 'secondary',
|
|
1129
|
+
class: {
|
|
1130
|
+
base: ['data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
|
|
1131
|
+
}
|
|
1132
|
+
}, {
|
|
1133
|
+
appearance: 'outlined',
|
|
1134
|
+
intent: 'tertiary',
|
|
1135
|
+
class: {
|
|
1136
|
+
base: ['data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
|
|
1137
|
+
}
|
|
1138
|
+
}, {
|
|
1139
|
+
appearance: 'outlined',
|
|
1140
|
+
intent: 'success',
|
|
1141
|
+
class: {
|
|
1142
|
+
base: ['data-is-active:border-success', 'data-is-active:text-success-strong']
|
|
1143
|
+
}
|
|
1144
|
+
}, {
|
|
1145
|
+
appearance: 'outlined',
|
|
1146
|
+
intent: 'warning',
|
|
1147
|
+
class: {
|
|
1148
|
+
base: ['data-is-active:border-warning', 'data-is-active:text-warning-strong']
|
|
1149
|
+
}
|
|
1150
|
+
}, {
|
|
1151
|
+
appearance: 'outlined',
|
|
1152
|
+
intent: 'danger',
|
|
1153
|
+
class: {
|
|
1154
|
+
base: ['data-is-active:border-danger', 'data-is-active:text-danger-strong']
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
// appearance: faded
|
|
1158
|
+
{
|
|
1159
|
+
appearance: 'faded',
|
|
1160
|
+
intent: 'default',
|
|
1161
|
+
class: {
|
|
1162
|
+
base: ['data-is-active:bg-neutral-soft/20', 'data-is-active:border-neutral', 'data-is-active:text-neutral-strong']
|
|
1163
|
+
}
|
|
1164
|
+
}, {
|
|
1165
|
+
appearance: 'faded',
|
|
1166
|
+
intent: 'primary',
|
|
1167
|
+
class: {
|
|
1168
|
+
base: ['data-is-active:bg-primary-soft/20', 'data-is-active:border-primary', 'data-is-active:text-primary-strong']
|
|
1169
|
+
}
|
|
1170
|
+
}, {
|
|
1171
|
+
appearance: 'faded',
|
|
1172
|
+
intent: 'secondary',
|
|
1173
|
+
class: {
|
|
1174
|
+
base: ['data-is-active:bg-secondary-soft/20', 'data-is-active:border-secondary', 'data-is-active:text-secondary-strong']
|
|
1175
|
+
}
|
|
1176
|
+
}, {
|
|
1177
|
+
appearance: 'faded',
|
|
1178
|
+
intent: 'tertiary',
|
|
1179
|
+
class: {
|
|
1180
|
+
base: ['data-is-active:bg-tertiary-soft/20', 'data-is-active:border-tertiary', 'data-is-active:text-tertiary-strong']
|
|
1181
|
+
}
|
|
1182
|
+
}, {
|
|
1183
|
+
appearance: 'faded',
|
|
1184
|
+
intent: 'success',
|
|
1185
|
+
class: {
|
|
1186
|
+
base: ['data-is-active:bg-success-soft/20', 'data-is-active:border-success', 'data-is-active:text-success-strong']
|
|
1187
|
+
}
|
|
1188
|
+
}, {
|
|
1189
|
+
appearance: 'faded',
|
|
1190
|
+
intent: 'warning',
|
|
1191
|
+
class: {
|
|
1192
|
+
base: ['data-is-active:bg-warning-soft/20', 'data-is-active:border-warning', 'data-is-active:text-warning-strong']
|
|
1193
|
+
}
|
|
1194
|
+
}, {
|
|
1195
|
+
appearance: 'faded',
|
|
1196
|
+
intent: 'danger',
|
|
1197
|
+
class: {
|
|
1198
|
+
base: ['data-is-active:bg-danger-soft/20', 'data-is-active:border-danger', 'data-is-active:text-danger-strong']
|
|
1199
|
+
}
|
|
1200
|
+
}]
|
|
1201
|
+
});
|
|
1202
|
+
const listboxGroup = tv({
|
|
1203
|
+
slots: {
|
|
1204
|
+
base: 'block',
|
|
1205
|
+
// Spacing for the separator a group renders after itself, so the value
|
|
1206
|
+
// lives here rather than being repeated at each call site.
|
|
1207
|
+
divider: 'my-1',
|
|
1208
|
+
// `block`: the heading is a <span>, and an inline box's vertical padding
|
|
1209
|
+
// is painted without taking up space -- so without this the rows sit
|
|
1210
|
+
// directly under the heading text whatever padding it is given.
|
|
1211
|
+
title: ['block', 'px-2', 'py-1.5', 'font-body text-body-2xs font-medium', 'text-neutral', 'select-none'],
|
|
1212
|
+
list: 'flex flex-col gap-0.5'
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
const dropdownContent = tv({
|
|
1217
|
+
base: 'bg-surface-input w-[260px] rounded-xl border border-neutral-subtle'
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
const popover = tv({
|
|
1221
|
+
base: 'bg-surface-input rounded-xl border border-neutral-subtle',
|
|
1222
|
+
variants: {
|
|
1223
|
+
size: {
|
|
1224
|
+
sm: 'w-40',
|
|
1225
|
+
md: 'w-64',
|
|
1226
|
+
lg: 'w-96',
|
|
1227
|
+
xl: 'w-136',
|
|
1228
|
+
trigger: 'w-(--trigger-width)'
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
defaultVariants: {
|
|
1232
|
+
size: 'md'
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
const divider = tv({
|
|
1237
|
+
base: 'shrink-0 bg-neutral-subtle border-none',
|
|
1238
|
+
variants: {
|
|
1239
|
+
orientation: {
|
|
1240
|
+
horizontal: 'w-full h-px',
|
|
1241
|
+
vertical: 'h-full w-px'
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
defaultVariants: {
|
|
1245
|
+
orientation: 'horizontal'
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
// Border-radius lives ONLY in the `shape` variants, never in `base`. Frontile's
|
|
1250
|
+
// `rounded-default` is a custom value that tailwind-merge does not recognise as
|
|
1251
|
+
// part of the `rounded` group, so a base radius would survive alongside a
|
|
1252
|
+
// shape's radius instead of being replaced by it.
|
|
1253
|
+
const skeleton = tv({
|
|
1254
|
+
base: ['block', 'overflow-hidden'],
|
|
1255
|
+
variants: {
|
|
1256
|
+
shape: {
|
|
1257
|
+
text: 'w-full rounded-default',
|
|
1258
|
+
circle: 'aspect-square rounded-full',
|
|
1259
|
+
// Matches Avatar's squircle radius so the two line up side by side.
|
|
1260
|
+
square: 'aspect-square rounded-[20%]',
|
|
1261
|
+
rounded: 'w-full rounded-lg',
|
|
1262
|
+
rect: 'w-full rounded-none'
|
|
1263
|
+
},
|
|
1264
|
+
// Resolved per shape in compoundVariants: `circle`/`square` take both
|
|
1265
|
+
// dimensions from Avatar's size scale, the rest take a height.
|
|
1266
|
+
size: {
|
|
1267
|
+
xs: '',
|
|
1268
|
+
sm: '',
|
|
1269
|
+
md: '',
|
|
1270
|
+
lg: '',
|
|
1271
|
+
xl: ''
|
|
1272
|
+
},
|
|
1273
|
+
animation: {
|
|
1274
|
+
shimmer: ['bg-linear-to-r', 'from-surface-overlay-soft', 'via-surface-overlay-firm', 'to-surface-overlay-soft', 'bg-[length:200%_100%]', 'animate-shimmer'],
|
|
1275
|
+
pulse: ['bg-surface-overlay-mild', 'animate-pulse'],
|
|
1276
|
+
none: ['bg-surface-overlay-mild']
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
compoundVariants: [
|
|
1280
|
+
// Square-ish shapes: one token sets width and height, reusing Avatar's
|
|
1281
|
+
// scale so `<Skeleton @shape="circle" @size="md" />` matches
|
|
1282
|
+
// `<Avatar @size="md" />` exactly.
|
|
1283
|
+
{
|
|
1284
|
+
shape: ['circle', 'square'],
|
|
1285
|
+
size: 'xs',
|
|
1286
|
+
class: 'size-5'
|
|
1287
|
+
}, {
|
|
1288
|
+
shape: ['circle', 'square'],
|
|
1289
|
+
size: 'sm',
|
|
1290
|
+
class: 'size-6'
|
|
1291
|
+
}, {
|
|
1292
|
+
shape: ['circle', 'square'],
|
|
1293
|
+
size: 'md',
|
|
1294
|
+
class: 'size-8'
|
|
1295
|
+
}, {
|
|
1296
|
+
shape: ['circle', 'square'],
|
|
1297
|
+
size: 'lg',
|
|
1298
|
+
class: 'size-10'
|
|
1299
|
+
}, {
|
|
1300
|
+
shape: ['circle', 'square'],
|
|
1301
|
+
size: 'xl',
|
|
1302
|
+
class: 'size-12'
|
|
1303
|
+
},
|
|
1304
|
+
// Full-width shapes: size sets a height. Every shape gets one so a
|
|
1305
|
+
// Skeleton is never zero-height — an invisible placeholder makes a
|
|
1306
|
+
// loading state look like an empty state. Override with `@class`.
|
|
1307
|
+
{
|
|
1308
|
+
shape: ['text', 'rounded', 'rect'],
|
|
1309
|
+
size: 'xs',
|
|
1310
|
+
class: 'h-2.5'
|
|
1311
|
+
}, {
|
|
1312
|
+
shape: ['text', 'rounded', 'rect'],
|
|
1313
|
+
size: 'sm',
|
|
1314
|
+
class: 'h-3'
|
|
1315
|
+
}, {
|
|
1316
|
+
shape: ['text', 'rounded', 'rect'],
|
|
1317
|
+
size: 'md',
|
|
1318
|
+
class: 'h-4'
|
|
1319
|
+
}, {
|
|
1320
|
+
shape: ['text', 'rounded', 'rect'],
|
|
1321
|
+
size: 'lg',
|
|
1322
|
+
class: 'h-5'
|
|
1323
|
+
}, {
|
|
1324
|
+
shape: ['text', 'rounded', 'rect'],
|
|
1325
|
+
size: 'xl',
|
|
1326
|
+
class: 'h-6'
|
|
1327
|
+
}],
|
|
1328
|
+
defaultVariants: {
|
|
1329
|
+
shape: 'text',
|
|
1330
|
+
size: 'md',
|
|
1331
|
+
animation: 'shimmer'
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
const spinner = tv({
|
|
1336
|
+
base: 'text-neutral-muted animate-spin',
|
|
1337
|
+
variants: {
|
|
1338
|
+
size: {
|
|
1339
|
+
xs: 'w-4 h-4',
|
|
1340
|
+
sm: 'w-6 h-6',
|
|
1341
|
+
md: 'w-8 h-8',
|
|
1342
|
+
lg: 'w-10 h-10',
|
|
1343
|
+
xl: 'w-12 h-12'
|
|
1344
|
+
},
|
|
1345
|
+
intent: {
|
|
1346
|
+
default: 'fill-neutral-strong',
|
|
1347
|
+
primary: 'fill-primary',
|
|
1348
|
+
secondary: 'fill-secondary',
|
|
1349
|
+
tertiary: 'fill-tertiary',
|
|
1350
|
+
success: 'fill-success',
|
|
1351
|
+
warning: 'fill-warning',
|
|
1352
|
+
danger: 'fill-danger'
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
defaultVariants: {
|
|
1356
|
+
size: 'md',
|
|
1357
|
+
intent: 'default'
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
const table = tv({
|
|
1362
|
+
slots: {
|
|
1363
|
+
base: ['w-full', 'caption-bottom', 'font-body text-body-2xs'],
|
|
1364
|
+
wrapper: ['relative', 'isolate', 'overflow-auto', 'rounded-default',
|
|
1365
|
+
// `surface-table` rather than `surface-card`, which the table otherwise
|
|
1366
|
+
// looks exactly like: every sticky part of the table paints over the rows
|
|
1367
|
+
// and columns scrolling beneath it, and in dark `card` is a translucent
|
|
1368
|
+
// veil that would let them read through. The role carries the colour that
|
|
1369
|
+
// veil renders, with the alpha already resolved. Override
|
|
1370
|
+
// `--color-surface-table` to sit a table on a different background.
|
|
1371
|
+
'bg-surface-table'],
|
|
1372
|
+
table: ['w-full', 'table-auto'],
|
|
1373
|
+
thead: ['relative', 'bg-surface-overlay-subtle'],
|
|
1374
|
+
tbody: ['divide-y', 'divide-surface-overlay-subtle',
|
|
1375
|
+
// Rows carry the surface themselves rather than letting the wrapper show
|
|
1376
|
+
// through: a sticky row has to hide the rows sliding under it, and a
|
|
1377
|
+
// sticky cell picks its fill up from its row via `background-color:
|
|
1378
|
+
// inherit`. Row tints layer on top of this, and any tint that replaces it
|
|
1379
|
+
// has to be opaque too — see `striped` and the selection variants.
|
|
1380
|
+
'[&>tr]:bg-surface-table',
|
|
1381
|
+
// `muted`, not `subtle`: in dark `neutral-subtle` is gray-900, the same
|
|
1382
|
+
// value `surface-table` carries, so a `subtle` hover reads as no hover at
|
|
1383
|
+
// all. This stays a background *colour* so `transition-colors` animates it.
|
|
1384
|
+
'[&>tr]:data-[selectable=true]:data-[selected=false]:hover:bg-neutral-muted', '[&>tr]:data-[selectable=true]:transition-colors'],
|
|
1385
|
+
// Footer rows take the surface for the same reason body rows do: a sticky
|
|
1386
|
+
// column in the footer scrolls past the cells to its side.
|
|
1387
|
+
tfoot: ['relative', '[&>tr]:bg-surface-table'],
|
|
1388
|
+
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'],
|
|
1389
|
+
separator: ['absolute', 'z-2', 'left-0', 'w-full', 'h-px', 'bg-surface-overlay-mild'],
|
|
1390
|
+
th: ['h-12', 'px-4', 'text-left', 'align-middle', 'font-label', 'text-neutral-bolder', '[&:has([role=checkbox])]:pr-0', 'data-[sortable=true]:cursor-pointer'],
|
|
1391
|
+
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'],
|
|
1392
|
+
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'],
|
|
1393
|
+
columnVisibilityButton: ['flex'],
|
|
1394
|
+
columnVisibilityIcon: ['size-6'],
|
|
1395
|
+
td: ['align-middle', 'text-neutral-strong', '[&:has([role=checkbox])]:pr-0'],
|
|
1396
|
+
empty: ['text-neutral-soft', 'align-middle', 'text-center', 'py-12'],
|
|
1397
|
+
// Deliberately carries no width or height: these classes are merged onto
|
|
1398
|
+
// Skeleton *after* its own shape and size variants, so any dimension set
|
|
1399
|
+
// here would defeat a column's `skeleton: 'circle'` preset. The table
|
|
1400
|
+
// passes its `size` through to Skeleton instead.
|
|
1401
|
+
skeleton: ['max-w-[16ch]'],
|
|
1402
|
+
// Placeholder rows fade in one after another. The per-row `animation-delay`
|
|
1403
|
+
// is set inline by the component, since a delay that scales with the row
|
|
1404
|
+
// index cannot be a static utility class.
|
|
1405
|
+
skeletonRow: ['animate-skeleton-enter', 'motion-reduce:animate-none']
|
|
1406
|
+
},
|
|
1407
|
+
variants: {
|
|
1408
|
+
size: {
|
|
1409
|
+
sm: {
|
|
1410
|
+
th: 'h-10 px-3 py-2 text-label-2xs',
|
|
1411
|
+
td: 'px-3 py-2 text-body-2xs'
|
|
1412
|
+
},
|
|
1413
|
+
md: {
|
|
1414
|
+
th: 'h-12 px-4 text-label-xs',
|
|
1415
|
+
td: 'p-4 text-body-2xs'
|
|
1416
|
+
},
|
|
1417
|
+
lg: {
|
|
1418
|
+
th: 'h-14 px-6 text-label-sm',
|
|
1419
|
+
td: 'p-6 text-body-xs'
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
isLoading: {
|
|
1423
|
+
true: {
|
|
1424
|
+
thead: ['after:absolute', 'after:top-full', 'after:left-0', 'after:w-1/2', 'after:animate-swing', 'after:h-px', 'after:z-10']
|
|
1425
|
+
}
|
|
1426
|
+
},
|
|
1427
|
+
// Declared empty on purpose: these variants exist only so `isLoading` can
|
|
1428
|
+
// pair with them in `compoundVariants` below, where the actual
|
|
1429
|
+
// `thead: after:bg-*` colour is applied. A colour set here would paint the
|
|
1430
|
+
// hairline even when the table is not loading.
|
|
1431
|
+
loadingColor: {
|
|
1432
|
+
default: {},
|
|
1433
|
+
primary: {},
|
|
1434
|
+
success: {},
|
|
1435
|
+
warning: {},
|
|
1436
|
+
danger: {}
|
|
1437
|
+
},
|
|
1438
|
+
selectionColor: {
|
|
1439
|
+
default: {},
|
|
1440
|
+
primary: {},
|
|
1441
|
+
success: {},
|
|
1442
|
+
warning: {},
|
|
1443
|
+
danger: {}
|
|
1444
|
+
},
|
|
1445
|
+
layout: {
|
|
1446
|
+
auto: {
|
|
1447
|
+
table: 'table-auto'
|
|
1448
|
+
},
|
|
1449
|
+
fixed: {
|
|
1450
|
+
table: 'table-fixed'
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
striped: {
|
|
1454
|
+
true: {
|
|
1455
|
+
// A translucent tint, so it goes on as a background *image* layer over
|
|
1456
|
+
// the row's opaque fill instead of replacing it. Painting it as the
|
|
1457
|
+
// background colour would make every striped sticky row see-through.
|
|
1458
|
+
tbody: '[&_tr:nth-child(odd)]:[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'
|
|
1459
|
+
}
|
|
1460
|
+
},
|
|
1461
|
+
isSticky: {
|
|
1462
|
+
true: {}
|
|
1463
|
+
},
|
|
1464
|
+
stickyPosition: {
|
|
1465
|
+
left: {},
|
|
1466
|
+
right: {},
|
|
1467
|
+
top: {},
|
|
1468
|
+
bottom: {}
|
|
1469
|
+
},
|
|
1470
|
+
isScrollable: {
|
|
1471
|
+
true: {
|
|
1472
|
+
wrapper: ['overflow-auto']
|
|
1473
|
+
}
|
|
1474
|
+
},
|
|
1475
|
+
hasStickyHeader: {
|
|
1476
|
+
true: {}
|
|
1477
|
+
},
|
|
1478
|
+
isInStickyRow: {
|
|
1479
|
+
true: {}
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
compoundVariants: [
|
|
1483
|
+
// Sticky header - highest priority for intersections with columns
|
|
1484
|
+
{
|
|
1485
|
+
isSticky: true,
|
|
1486
|
+
stickyPosition: 'top',
|
|
1487
|
+
class: {
|
|
1488
|
+
// The opaque surface plus the header's own translucent tint as a layer
|
|
1489
|
+
// above it, which is what a non-sticky `thead` composites to over the
|
|
1490
|
+
// wrapper — so stuck and unstuck headers read as the same colour.
|
|
1491
|
+
thead: ['sticky', 'top-0', 'z-2', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]']
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
// Sticky footer
|
|
1495
|
+
{
|
|
1496
|
+
isSticky: true,
|
|
1497
|
+
stickyPosition: 'bottom',
|
|
1498
|
+
class: {
|
|
1499
|
+
tfoot: ['sticky', 'bottom-0', 'z-2', 'bg-surface-table']
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
// Sticky columns - medium priority, header cells get higher z-index.
|
|
1503
|
+
// Body and footer cells inherit their row's paint — fill, and any tint
|
|
1504
|
+
// layered over it — so a pinned column tracks selection, hover and striping
|
|
1505
|
+
// instead of masking them with a surface of its own.
|
|
1506
|
+
{
|
|
1507
|
+
isSticky: true,
|
|
1508
|
+
stickyPosition: 'left',
|
|
1509
|
+
class: {
|
|
1510
|
+
th: ['sticky', 'left-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
|
|
1511
|
+
td: ['sticky', 'left-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
|
|
1512
|
+
}
|
|
1513
|
+
}, {
|
|
1514
|
+
isSticky: true,
|
|
1515
|
+
stickyPosition: 'right',
|
|
1516
|
+
class: {
|
|
1517
|
+
th: ['sticky', 'right-0', 'z-3', 'bg-surface-table', '[background-image:linear-gradient(var(--color-surface-overlay-subtle),var(--color-surface-overlay-subtle))]'],
|
|
1518
|
+
td: ['sticky', 'right-0', 'z-1', 'bg-inherit', '[background-image:inherit]']
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
// Sticky rows - base layer
|
|
1522
|
+
{
|
|
1523
|
+
isSticky: true,
|
|
1524
|
+
stickyPosition: 'top',
|
|
1525
|
+
class: {
|
|
1526
|
+
tr: ['sticky', 'top-0', 'z-1', 'bg-surface-table']
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
isSticky: true,
|
|
1530
|
+
stickyPosition: 'bottom',
|
|
1531
|
+
class: {
|
|
1532
|
+
tr: ['sticky', 'bottom-0', 'z-1', 'bg-surface-table']
|
|
1533
|
+
}
|
|
1534
|
+
},
|
|
1535
|
+
// Sticky rows with sticky header - position after header
|
|
1536
|
+
{
|
|
1537
|
+
isSticky: true,
|
|
1538
|
+
stickyPosition: 'top',
|
|
1539
|
+
hasStickyHeader: true,
|
|
1540
|
+
class: {
|
|
1541
|
+
tr: ['sticky', 'z-2', 'bg-surface-table', '[&.sticky]:[top:var(--table-header-height,48px)]']
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
// Intersection cells: sticky column + sticky row - highest z-index
|
|
1545
|
+
{
|
|
1546
|
+
isSticky: true,
|
|
1547
|
+
stickyPosition: 'left',
|
|
1548
|
+
isInStickyRow: true,
|
|
1549
|
+
class: {
|
|
1550
|
+
td: ['sticky', 'left-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
|
|
1551
|
+
}
|
|
1552
|
+
}, {
|
|
1553
|
+
isSticky: true,
|
|
1554
|
+
stickyPosition: 'right',
|
|
1555
|
+
isInStickyRow: true,
|
|
1556
|
+
class: {
|
|
1557
|
+
td: ['sticky', 'right-0', 'z-2', 'bg-inherit', '[background-image:inherit]']
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
// Loading states with color variants
|
|
1561
|
+
{
|
|
1562
|
+
isLoading: true,
|
|
1563
|
+
loadingColor: 'default',
|
|
1564
|
+
class: {
|
|
1565
|
+
thead: `after:bg-neutral`
|
|
1566
|
+
}
|
|
1567
|
+
}, {
|
|
1568
|
+
isLoading: true,
|
|
1569
|
+
loadingColor: 'primary',
|
|
1570
|
+
class: {
|
|
1571
|
+
thead: `after:bg-primary`
|
|
1572
|
+
}
|
|
1573
|
+
}, {
|
|
1574
|
+
isLoading: true,
|
|
1575
|
+
loadingColor: 'success',
|
|
1576
|
+
class: {
|
|
1577
|
+
thead: `after:bg-success`
|
|
1578
|
+
}
|
|
1579
|
+
}, {
|
|
1580
|
+
isLoading: true,
|
|
1581
|
+
loadingColor: 'warning',
|
|
1582
|
+
class: {
|
|
1583
|
+
thead: `after:bg-warning`
|
|
1584
|
+
}
|
|
1585
|
+
}, {
|
|
1586
|
+
isLoading: true,
|
|
1587
|
+
loadingColor: 'danger',
|
|
1588
|
+
class: {
|
|
1589
|
+
thead: `after:bg-danger`
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
// Selection color variants
|
|
1593
|
+
{
|
|
1594
|
+
selectionColor: 'default',
|
|
1595
|
+
class: {
|
|
1596
|
+
// Half-opacity, so it layers over the row's fill rather than replacing
|
|
1597
|
+
// it — a selected sticky row still has to occlude what scrolls under.
|
|
1598
|
+
// The other selection colours are opaque and can stay plain fills.
|
|
1599
|
+
//
|
|
1600
|
+
// `soft` rather than `subtle`, which in dark is the same value as
|
|
1601
|
+
// `surface-table` and so tints nothing. At 50% this lands on the weight
|
|
1602
|
+
// the colour variants carry (1.4:1 against the surface, against
|
|
1603
|
+
// `primary-subtle`'s 1.38:1).
|
|
1604
|
+
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))]',
|
|
1605
|
+
tr: ['data-[selectable=true]:focus-visible:ring-default']
|
|
1606
|
+
}
|
|
1607
|
+
}, {
|
|
1608
|
+
selectionColor: 'primary',
|
|
1609
|
+
class: {
|
|
1610
|
+
tbody: '[&>tr]:data-[selected=true]:bg-primary-subtle',
|
|
1611
|
+
tr: ['data-[selectable=true]:focus-visible:ring-primary-soft']
|
|
1612
|
+
}
|
|
1613
|
+
}, {
|
|
1614
|
+
selectionColor: 'success',
|
|
1615
|
+
class: {
|
|
1616
|
+
tbody: '[&>tr]:data-[selected=true]:bg-success-subtle',
|
|
1617
|
+
tr: ['data-[selectable=true]:focus-visible:ring-success']
|
|
1618
|
+
}
|
|
1619
|
+
}, {
|
|
1620
|
+
selectionColor: 'warning',
|
|
1621
|
+
class: {
|
|
1622
|
+
tbody: '[&>tr]:data-[selected=true]:bg-warning-subtle',
|
|
1623
|
+
tr: ['data-[selectable=true]:focus-visible:ring-warning']
|
|
1624
|
+
}
|
|
1625
|
+
}, {
|
|
1626
|
+
selectionColor: 'danger',
|
|
1627
|
+
class: {
|
|
1628
|
+
tbody: '[&>tr]:data-[selected=true]:bg-danger-subtle',
|
|
1629
|
+
tr: ['data-[selectable=true]:focus-visible:ring-danger']
|
|
1630
|
+
}
|
|
1631
|
+
}],
|
|
1632
|
+
defaultVariants: {
|
|
1633
|
+
size: 'md',
|
|
1634
|
+
layout: 'auto',
|
|
1635
|
+
loadingColor: 'default',
|
|
1636
|
+
selectionColor: 'primary'
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
const segmentedControl = tv({
|
|
1641
|
+
slots: {
|
|
1642
|
+
// The positioning context the indicator is measured against. `isolate`
|
|
1643
|
+
// keeps the indicator's stacking behind the items without leaking a
|
|
1644
|
+
// z-index into the surrounding page.
|
|
1645
|
+
base: ['relative isolate inline-flex', 'rounded-pill', 'p-1'],
|
|
1646
|
+
// Geometry comes from the custom properties `selectionIndicator` publishes;
|
|
1647
|
+
// this slot only decides what it looks like. `var()` names are literal:
|
|
1648
|
+
// Tailwind generates nothing from an interpolated class string.
|
|
1649
|
+
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',
|
|
1650
|
+
// Held until the first real measurement lands, so the indicator never
|
|
1651
|
+
// flies in from the container origin on first paint.
|
|
1652
|
+
'opacity-0', 'group-data-[fr-si-ready]/segmented:opacity-100',
|
|
1653
|
+
// Tailwind v4 compiles `translate-x-*` to the standalone `translate`
|
|
1654
|
+
// property, not to `transform`, so `translate` is what has to be
|
|
1655
|
+
// transitioned. `transform` is listed for overrides that use it.
|
|
1656
|
+
'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'],
|
|
1657
|
+
// Both focus rings, not one per rendering mode: in button mode the item is
|
|
1658
|
+
// the focusable element and `has-[:focus-visible]` has no descendant to
|
|
1659
|
+
// match, while in form mode the label is not focusable and `focus-visible:`
|
|
1660
|
+
// never matches it. Only one set can ever apply, so a third rendering mode
|
|
1661
|
+
// needs no third branch.
|
|
1662
|
+
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',
|
|
1663
|
+
// Both rendering modes publish `data-disabled`, so one selector covers
|
|
1664
|
+
// them. Keying off native `disabled:` would miss form mode, where the
|
|
1665
|
+
// item is a `<label>` and only the hidden input is disabled.
|
|
1666
|
+
'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled',
|
|
1667
|
+
// Resting, hover and selected are three distinct levels so hover has
|
|
1668
|
+
// somewhere to go that is not the selected ink. `neutral-firm` clears
|
|
1669
|
+
// WCAG AA against the track in both modes.
|
|
1670
|
+
'text-neutral-firm',
|
|
1671
|
+
// Scoped to unselected: an unscoped `hover:` ties on specificity with the
|
|
1672
|
+
// variants' `data-[selected=true]:` ink, leaving the winner to Tailwind's
|
|
1673
|
+
// emitted variant order.
|
|
1674
|
+
'data-[selected=false]:data-[disabled=false]:hover:text-neutral-strong']
|
|
1675
|
+
},
|
|
1676
|
+
variants: {
|
|
1677
|
+
variant: {
|
|
1678
|
+
solid: {
|
|
1679
|
+
// `surface-overlay-soft` is translucent in dark mode, as is the
|
|
1680
|
+
// indicator's `surface-card`; two stacked veils composite
|
|
1681
|
+
// unpredictably, so dark mode uses an opaque role instead.
|
|
1682
|
+
base: 'bg-surface-overlay-soft dark:bg-surface-table',
|
|
1683
|
+
indicator: 'shadow-elevation-1'
|
|
1684
|
+
},
|
|
1685
|
+
ghost: {
|
|
1686
|
+
base: 'bg-transparent',
|
|
1687
|
+
indicator: ''
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
// Keyed off `data-selected`, which the item publishes in both rendering
|
|
1691
|
+
// modes -- the two express selection on different elements, so a rule per
|
|
1692
|
+
// mode is one mode away from being forgotten. Written literally: Tailwind
|
|
1693
|
+
// generates nothing from a composed class string.
|
|
1694
|
+
intent: {
|
|
1695
|
+
default: {
|
|
1696
|
+
// Opaque white in light mode. In dark, `surface-card` is translucent,
|
|
1697
|
+
// so an opaque neutral is used instead -- see the track above.
|
|
1698
|
+
indicator: 'bg-surface-card dark:bg-neutral-soft',
|
|
1699
|
+
item: 'data-[selected=true]:text-neutral-bolder'
|
|
1700
|
+
},
|
|
1701
|
+
primary: {
|
|
1702
|
+
indicator: 'bg-primary',
|
|
1703
|
+
item: 'data-[selected=true]:text-on-primary'
|
|
1704
|
+
},
|
|
1705
|
+
secondary: {
|
|
1706
|
+
indicator: 'bg-secondary',
|
|
1707
|
+
item: 'data-[selected=true]:text-on-secondary'
|
|
1708
|
+
},
|
|
1709
|
+
tertiary: {
|
|
1710
|
+
indicator: 'bg-tertiary',
|
|
1711
|
+
item: 'data-[selected=true]:text-on-tertiary'
|
|
1712
|
+
},
|
|
1713
|
+
success: {
|
|
1714
|
+
indicator: 'bg-success',
|
|
1715
|
+
item: 'data-[selected=true]:text-on-success'
|
|
1716
|
+
},
|
|
1717
|
+
warning: {
|
|
1718
|
+
indicator: 'bg-warning',
|
|
1719
|
+
item: 'data-[selected=true]:text-on-warning'
|
|
1720
|
+
},
|
|
1721
|
+
danger: {
|
|
1722
|
+
indicator: 'bg-danger',
|
|
1723
|
+
item: 'data-[selected=true]:text-on-danger'
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
size: {
|
|
1727
|
+
sm: {
|
|
1728
|
+
item: 'px-3 py-1 text-label-sm'
|
|
1729
|
+
},
|
|
1730
|
+
md: {
|
|
1731
|
+
item: 'px-4 py-1.5 text-label-md'
|
|
1732
|
+
},
|
|
1733
|
+
lg: {
|
|
1734
|
+
item: 'px-5 py-2 text-label-lg'
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
orientation: {
|
|
1738
|
+
horizontal: {
|
|
1739
|
+
base: 'flex-row'
|
|
1740
|
+
},
|
|
1741
|
+
// A pill radius on a tall narrow column reads as an oval blob, so the
|
|
1742
|
+
// vertical axis squares off -- on the track and on what sits inside it,
|
|
1743
|
+
// or the indicator would bulge out of the track. The inner radius is the
|
|
1744
|
+
// outer one less the track's `p-1`.
|
|
1745
|
+
vertical: {
|
|
1746
|
+
base: 'flex-col rounded-2xl',
|
|
1747
|
+
indicator: 'rounded-xl',
|
|
1748
|
+
item: 'rounded-xl'
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
isFullWidth: {
|
|
1752
|
+
true: {
|
|
1753
|
+
base: 'flex w-full',
|
|
1754
|
+
item: 'flex-1'
|
|
1755
|
+
}
|
|
1756
|
+
},
|
|
1757
|
+
isDisabled: {
|
|
1758
|
+
true: {
|
|
1759
|
+
base: 'opacity-disabled',
|
|
1760
|
+
item: 'pointer-events-none'
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1763
|
+
hasSeparators: {
|
|
1764
|
+
true: {
|
|
1765
|
+
item: [
|
|
1766
|
+
// A hairline before every item except the first. The level differs
|
|
1767
|
+
// per mode: neither the neutral scale nor the track is symmetric
|
|
1768
|
+
// across them, so one level cannot read on both.
|
|
1769
|
+
'before:absolute before:content-[""]', 'before:bg-neutral-mild dark:before:bg-neutral-soft', 'before:transition-opacity before:duration-200', 'motion-reduce:before:transition-none',
|
|
1770
|
+
// The indicator's `<span>` is the container's true first child, so
|
|
1771
|
+
// `first:` would never match an item; `first-of-type:` does.
|
|
1772
|
+
'first-of-type:before:content-none',
|
|
1773
|
+
// Hidden on the selected item and the one after it, so the indicator
|
|
1774
|
+
// never crosses a visible line. Sibling selectors know the order, so
|
|
1775
|
+
// nothing tracks indices.
|
|
1776
|
+
'before:opacity-100', 'data-[selected=true]:before:opacity-0', '[&[data-selected=true]+*]:before:opacity-0']
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
compoundVariants: [
|
|
1781
|
+
// Vertical items get their width from the flex stretch, so the padding
|
|
1782
|
+
// budget moves to the cross axis. One literal class per size.
|
|
1783
|
+
{
|
|
1784
|
+
orientation: 'vertical',
|
|
1785
|
+
size: 'sm',
|
|
1786
|
+
class: {
|
|
1787
|
+
item: 'py-1.5'
|
|
1788
|
+
}
|
|
1789
|
+
}, {
|
|
1790
|
+
orientation: 'vertical',
|
|
1791
|
+
size: 'md',
|
|
1792
|
+
class: {
|
|
1793
|
+
item: 'py-2'
|
|
1794
|
+
}
|
|
1795
|
+
}, {
|
|
1796
|
+
orientation: 'vertical',
|
|
1797
|
+
size: 'lg',
|
|
1798
|
+
class: {
|
|
1799
|
+
item: 'py-2.5'
|
|
1800
|
+
}
|
|
1801
|
+
}, {
|
|
1802
|
+
hasSeparators: true,
|
|
1803
|
+
orientation: 'horizontal',
|
|
1804
|
+
class: {
|
|
1805
|
+
item: 'before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-px before:h-4'
|
|
1806
|
+
}
|
|
1807
|
+
}, {
|
|
1808
|
+
hasSeparators: true,
|
|
1809
|
+
orientation: 'vertical',
|
|
1810
|
+
class: {
|
|
1811
|
+
item: 'before:top-0 before:left-1/2 before:-translate-x-1/2 before:h-px before:w-4'
|
|
1812
|
+
}
|
|
1813
|
+
}],
|
|
1814
|
+
defaultVariants: {
|
|
1815
|
+
variant: 'solid',
|
|
1816
|
+
intent: 'default',
|
|
1817
|
+
size: 'md',
|
|
1818
|
+
orientation: 'horizontal'
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
const tabs = tv({
|
|
1823
|
+
slots: {
|
|
1824
|
+
base: 'flex',
|
|
1825
|
+
// The positioning context the indicator is measured against, and the
|
|
1826
|
+
// element that carries `group/tabs` in the template.
|
|
1827
|
+
list: ['relative isolate flex', 'select-none'],
|
|
1828
|
+
// Geometry comes from the custom properties `selectionIndicator`
|
|
1829
|
+
// publishes. `var()` names are literal: Tailwind generates nothing from
|
|
1830
|
+
// an interpolated class string.
|
|
1831
|
+
indicator: ['pointer-events-none absolute left-0 top-0 z-0',
|
|
1832
|
+
// Held until the first real measurement lands, so the indicator never
|
|
1833
|
+
// flies in from the container origin on first paint.
|
|
1834
|
+
'opacity-0', 'group-data-[fr-si-ready]/tabs:opacity-100',
|
|
1835
|
+
// Tailwind v4 compiles `translate-x-*` to the standalone `translate`
|
|
1836
|
+
// property, not to `transform`, so `translate` is what has to be
|
|
1837
|
+
// transitioned. `transform` is listed for overrides that use it.
|
|
1838
|
+
'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'],
|
|
1839
|
+
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',
|
|
1840
|
+
// Resting, hover and selected are three distinct levels so hover has
|
|
1841
|
+
// somewhere to go that is not the selected ink.
|
|
1842
|
+
'text-neutral-firm',
|
|
1843
|
+
// Scoped to unselected: an unscoped `hover:` ties on specificity with
|
|
1844
|
+
// the selected ink, leaving the winner to Tailwind's variant order.
|
|
1845
|
+
// "Not disabled" is `not-data-[disabled=true]`, not `data-[disabled=false]`:
|
|
1846
|
+
// an attribute-value selector cannot match an element that never declares
|
|
1847
|
+
// the attribute, and a consumer bringing their own element should not have
|
|
1848
|
+
// to know the theme wants a `data-disabled="false"` written onto it.
|
|
1849
|
+
'data-[selected=false]:not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
|
|
1850
|
+
panel: [...focusVisibleRing, 'outline-none']
|
|
1851
|
+
},
|
|
1852
|
+
variants: {
|
|
1853
|
+
variant: {
|
|
1854
|
+
solid: {
|
|
1855
|
+
list: 'bg-surface-overlay-soft dark:bg-surface-table rounded-pill p-1',
|
|
1856
|
+
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'],
|
|
1857
|
+
tab: 'rounded-pill'
|
|
1858
|
+
},
|
|
1859
|
+
// Painting is finished in compoundVariants: the bar is pinned to a
|
|
1860
|
+
// different edge per orientation and reads a different pair of custom
|
|
1861
|
+
// properties, so there is nothing orientation-agnostic to say here.
|
|
1862
|
+
underline: {
|
|
1863
|
+
tab: 'rounded-md'
|
|
1864
|
+
}
|
|
1865
|
+
},
|
|
1866
|
+
// Fill and selected ink travel together: the label sits on the fill, so a
|
|
1867
|
+
// new intent needs both or its selected label is unreadable on its own
|
|
1868
|
+
// background. `underline` overrides the ink in one compound below, since a
|
|
1869
|
+
// bare bar puts no fill behind the label.
|
|
1870
|
+
intent: {
|
|
1871
|
+
default: {
|
|
1872
|
+
indicator: 'bg-surface-card dark:bg-neutral-soft',
|
|
1873
|
+
tab: 'data-[selected=true]:text-neutral-bolder'
|
|
1874
|
+
},
|
|
1875
|
+
primary: {
|
|
1876
|
+
indicator: 'bg-primary',
|
|
1877
|
+
tab: 'data-[selected=true]:text-on-primary'
|
|
1878
|
+
},
|
|
1879
|
+
secondary: {
|
|
1880
|
+
indicator: 'bg-secondary',
|
|
1881
|
+
tab: 'data-[selected=true]:text-on-secondary'
|
|
1882
|
+
},
|
|
1883
|
+
tertiary: {
|
|
1884
|
+
indicator: 'bg-tertiary',
|
|
1885
|
+
tab: 'data-[selected=true]:text-on-tertiary'
|
|
1886
|
+
},
|
|
1887
|
+
success: {
|
|
1888
|
+
indicator: 'bg-success',
|
|
1889
|
+
tab: 'data-[selected=true]:text-on-success'
|
|
1890
|
+
},
|
|
1891
|
+
warning: {
|
|
1892
|
+
indicator: 'bg-warning',
|
|
1893
|
+
tab: 'data-[selected=true]:text-on-warning'
|
|
1894
|
+
},
|
|
1895
|
+
danger: {
|
|
1896
|
+
indicator: 'bg-danger',
|
|
1897
|
+
tab: 'data-[selected=true]:text-on-danger'
|
|
1898
|
+
}
|
|
1899
|
+
},
|
|
1900
|
+
size: {
|
|
1901
|
+
sm: {
|
|
1902
|
+
tab: 'px-3 py-1 text-label-sm',
|
|
1903
|
+
panel: 'py-2'
|
|
1904
|
+
},
|
|
1905
|
+
md: {
|
|
1906
|
+
tab: 'px-4 py-1.5 text-label-md',
|
|
1907
|
+
panel: 'py-3'
|
|
1908
|
+
},
|
|
1909
|
+
lg: {
|
|
1910
|
+
tab: 'px-5 py-2 text-label-lg',
|
|
1911
|
+
panel: 'py-4'
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
orientation: {
|
|
1915
|
+
horizontal: {
|
|
1916
|
+
base: 'flex-col',
|
|
1917
|
+
list: 'flex-row'
|
|
1918
|
+
},
|
|
1919
|
+
vertical: {
|
|
1920
|
+
base: 'flex-row gap-4',
|
|
1921
|
+
list: 'flex-col'
|
|
1922
|
+
}
|
|
1923
|
+
},
|
|
1924
|
+
// `base` needs the width too, not just `list`: the list's `w-full`
|
|
1925
|
+
// resolves against `base`, and a `base` with no width of its own collapses
|
|
1926
|
+
// to its content inside an `align-items: flex-start` parent -- leaving the
|
|
1927
|
+
// whole argument inert in exactly the layouts that reach for it.
|
|
1928
|
+
isFullWidth: {
|
|
1929
|
+
true: {
|
|
1930
|
+
base: 'w-full',
|
|
1931
|
+
list: 'w-full',
|
|
1932
|
+
tab: 'flex-1'
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
isDisabled: {
|
|
1936
|
+
true: {
|
|
1937
|
+
list: 'opacity-disabled',
|
|
1938
|
+
tab: 'pointer-events-none'
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
compoundVariants: [
|
|
1943
|
+
// -- underline: no fill behind the label, so the intent colour lives on the
|
|
1944
|
+
// bar alone and the label stays high-contrast neutral at every intent --
|
|
1945
|
+
// matching the reference designs. The hover chip shares this matcher, so it
|
|
1946
|
+
// rides along rather than repeating the condition in a second entry.
|
|
1947
|
+
{
|
|
1948
|
+
variant: 'underline',
|
|
1949
|
+
class: {
|
|
1950
|
+
tab: 'data-[selected=true]:text-neutral-bolder data-[selected=false]:not-data-[disabled=true]:hover:bg-surface-overlay-soft'
|
|
1951
|
+
}
|
|
1952
|
+
},
|
|
1953
|
+
// A pill radius on a tall narrow column reads as an oval blob, so the
|
|
1954
|
+
// vertical axis squares off -- on the track and on what sits inside it, or
|
|
1955
|
+
// the indicator would bulge out of the track. The inner radius is the
|
|
1956
|
+
// outer one less the track's `p-1`. Only `solid` has a track to round.
|
|
1957
|
+
{
|
|
1958
|
+
variant: 'solid',
|
|
1959
|
+
orientation: 'vertical',
|
|
1960
|
+
class: {
|
|
1961
|
+
list: 'rounded-2xl',
|
|
1962
|
+
indicator: 'rounded-xl',
|
|
1963
|
+
tab: 'rounded-xl'
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
// `default` intent's fill is a surface in solid; a bare bar needs ink.
|
|
1967
|
+
{
|
|
1968
|
+
variant: 'underline',
|
|
1969
|
+
intent: 'default',
|
|
1970
|
+
class: {
|
|
1971
|
+
indicator: 'bg-neutral-bolder'
|
|
1972
|
+
}
|
|
1973
|
+
}, {
|
|
1974
|
+
variant: 'underline',
|
|
1975
|
+
orientation: 'horizontal',
|
|
1976
|
+
class: {
|
|
1977
|
+
list: 'gap-1 border-b border-neutral-mild dark:border-neutral-soft',
|
|
1978
|
+
indicator: ['top-auto bottom-0 h-0.5 rounded-full', 'w-[var(--fr-si-width)]', 'translate-x-[var(--fr-si-x)]']
|
|
1979
|
+
}
|
|
1980
|
+
}, {
|
|
1981
|
+
variant: 'underline',
|
|
1982
|
+
orientation: 'vertical',
|
|
1983
|
+
class: {
|
|
1984
|
+
list: 'gap-1 border-l border-neutral-mild dark:border-neutral-soft',
|
|
1985
|
+
indicator: ['left-0 w-0.5 rounded-full', 'h-[var(--fr-si-height)]', 'translate-y-[var(--fr-si-y)]']
|
|
1986
|
+
}
|
|
1987
|
+
}],
|
|
1988
|
+
defaultVariants: {
|
|
1989
|
+
variant: 'solid',
|
|
1990
|
+
intent: 'default',
|
|
1991
|
+
size: 'md',
|
|
1992
|
+
orientation: 'horizontal'
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
|
|
1996
|
+
const notificationsContainer = tv({
|
|
1997
|
+
slots: {
|
|
1998
|
+
base: ['fixed z-1000 w-full max-w-lg px-4 py-4 pointer-events-none'],
|
|
1999
|
+
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']
|
|
2000
|
+
},
|
|
2001
|
+
variants: {
|
|
2002
|
+
placement: {
|
|
2003
|
+
'top-left': {
|
|
2004
|
+
base: 'top-0 left-0'
|
|
2005
|
+
},
|
|
2006
|
+
'top-center': {
|
|
2007
|
+
base: 'top-0 left-2/4 translate-x-[-50%]'
|
|
2008
|
+
},
|
|
2009
|
+
'top-right': {
|
|
2010
|
+
base: 'top-0 right-0'
|
|
2011
|
+
},
|
|
2012
|
+
'bottom-left': {
|
|
2013
|
+
base: 'bottom-0 left-0'
|
|
2014
|
+
},
|
|
2015
|
+
'bottom-center': {
|
|
2016
|
+
base: 'bottom-0 left-2/4 translate-x-[-50%]'
|
|
2017
|
+
},
|
|
2018
|
+
'bottom-right': {
|
|
2019
|
+
base: 'bottom-0 right-0'
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
},
|
|
2023
|
+
defaultVariants: {
|
|
2024
|
+
placement: 'bottom-right'
|
|
2025
|
+
}
|
|
2026
|
+
});
|
|
2027
|
+
|
|
2028
|
+
const notificationCard = tv({
|
|
2029
|
+
slots: {
|
|
2030
|
+
// The outer element. It carries the box treatment (surface color,
|
|
2031
|
+
// border, rounded corners, shadow) and everything the stack's geometry
|
|
2032
|
+
// animates (`transform`, `opacity`, and — while collapsed — a clamped
|
|
2033
|
+
// `height` so a taller card behind the front one can't poke out past
|
|
2034
|
+
// it). `overflow-hidden` here is what makes that clamp actually crop
|
|
2035
|
+
// the content instead of just failing to contain it.
|
|
2036
|
+
//
|
|
2037
|
+
// Deliberately NOT a flex container and NOT where padding/gap live:
|
|
2038
|
+
// the `ResizeObserver` in notification-card.gts measures `inner`, not
|
|
2039
|
+
// `base`, specifically so the reported height is always the content's
|
|
2040
|
+
// true natural height, never the clamped one `base` might be wearing
|
|
2041
|
+
// at the time. Move layout classes here and that guarantee breaks.
|
|
2042
|
+
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)]',
|
|
2043
|
+
// The three `transition-duration` values line up positionally with
|
|
2044
|
+
// `transition-[transform,opacity,height]` above: transform and height
|
|
2045
|
+
// are the stack's own expand/collapse choreography, fixed at 400ms to
|
|
2046
|
+
// match the container's own height transition (see
|
|
2047
|
+
// notifications-container.gts) and the design spec's "transform
|
|
2048
|
+
// 400ms"; the middle value is the one `@transitionDuration` actually
|
|
2049
|
+
// governs (the enter/exit fade), supplied via the
|
|
2050
|
+
// `--frontile-toast-fade` custom property the card sets inline (see
|
|
2051
|
+
// notification-card.gts's `style` getter). Both the property order
|
|
2052
|
+
// and the duration ownership live here in one place so they can never
|
|
2053
|
+
// drift apart across the component boundary.
|
|
2054
|
+
'[transition-duration:400ms,_var(--frontile-toast-fade,_200ms),_400ms]', 'motion-reduce:transition-[opacity] motion-reduce:duration-150',
|
|
2055
|
+
// Dropping the transition above only makes the transform apply
|
|
2056
|
+
// instantly instead of animating it — the transform itself (the
|
|
2057
|
+
// stack's slide/scale choreography) still comes from notification-card.gts's
|
|
2058
|
+
// `style` getter as an *inline* `transform:` declaration, so it would
|
|
2059
|
+
// still be present, just un-animated. An inline style normally wins
|
|
2060
|
+
// over any stylesheet rule regardless of that rule's specificity, but
|
|
2061
|
+
// `!important` is the one thing that overrides it — Tailwind v4 marks
|
|
2062
|
+
// a utility `!important` with a trailing `!`, which is exactly what's
|
|
2063
|
+
// needed here. This neutralizes every transform (enter/exit slide,
|
|
2064
|
+
// and the stack's hover-expand translate/scale) under
|
|
2065
|
+
// `prefers-reduced-motion`, matching the spec's "drops all
|
|
2066
|
+
// transforms", entirely in CSS with no JS branching required.
|
|
2067
|
+
'motion-reduce:transform-none!'],
|
|
2068
|
+
// The inner element. Holds the actual row layout (icon, content,
|
|
2069
|
+
// actions, close button) and is never height-constrained, so its
|
|
2070
|
+
// `offsetHeight` is always the card's true natural height — that's
|
|
2071
|
+
// the value the measure modifier reads and reports to the stack.
|
|
2072
|
+
inner: 'flex gap-3 p-4 font-body text-body-2xs',
|
|
2073
|
+
icon: 'shrink-0 size-5',
|
|
2074
|
+
// The loading spinner's own slot, distinct from `icon`. It must NOT
|
|
2075
|
+
// reuse `icon` — `icon`'s intent-coloured `text-*` class (the compound
|
|
2076
|
+
// variants below) would win the Tailwind-merge over the Spinner's own
|
|
2077
|
+
// dim `text-neutral-muted` track, making the arc and track nearly
|
|
2078
|
+
// identical and the spin unreadable. `size-5` matches `icon` exactly so
|
|
2079
|
+
// a promise settling (spinner -> icon) never resizes the card. The arc
|
|
2080
|
+
// colour comes from `@intent` passed to <Spinner>, not from this slot;
|
|
2081
|
+
// this slot only ever supplies sizing/position and, where needed
|
|
2082
|
+
// (solid variant below), an explicit track/arc override.
|
|
2083
|
+
spinner: 'shrink-0 size-5',
|
|
2084
|
+
content: 'grow min-w-0 flex flex-col gap-1',
|
|
2085
|
+
title: 'font-label text-label-xs',
|
|
2086
|
+
description: 'text-body-2xs',
|
|
2087
|
+
customActions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
|
|
2088
|
+
customActionButton: '',
|
|
2089
|
+
closeButton: ['shrink-0 self-center -mr-1 inline-block p-1.5 rounded-full', 'transition duration-200', 'hover:bg-surface-overlay-soft', ...focusVisibleRing]
|
|
2090
|
+
},
|
|
2091
|
+
variants: {
|
|
2092
|
+
intent: {
|
|
2093
|
+
default: {},
|
|
2094
|
+
info: {},
|
|
2095
|
+
success: {},
|
|
2096
|
+
warning: {},
|
|
2097
|
+
danger: {}
|
|
2098
|
+
},
|
|
2099
|
+
variant: {
|
|
2100
|
+
// `text-neutral` (the DEFAULT level) is only ~3:1 against a light
|
|
2101
|
+
// surface — below the 4.5:1 WCAG AA floor these labels need at this
|
|
2102
|
+
// size. `text-neutral-firm` clears it comfortably against every
|
|
2103
|
+
// surface this description can sit on, light or dark, tonal or not.
|
|
2104
|
+
// See packages/frontile/docs/notifications-usage.md's contrast note for the measured ratios.
|
|
2105
|
+
default: {
|
|
2106
|
+
base: 'bg-surface-modal border-surface-overlay-mild',
|
|
2107
|
+
description: 'text-neutral-firm'
|
|
2108
|
+
},
|
|
2109
|
+
// The outer surface/border is intent-independent — every `tonal`
|
|
2110
|
+
// compound variant below borrows the same neutral surface `default`
|
|
2111
|
+
// uses (see the comment above the `tonal` compound variants), so it
|
|
2112
|
+
// lives here once instead of repeating in each of them.
|
|
2113
|
+
tonal: {
|
|
2114
|
+
base: 'bg-surface-modal border-surface-overlay-mild',
|
|
2115
|
+
description: 'text-neutral-firm'
|
|
2116
|
+
},
|
|
2117
|
+
solid: {
|
|
2118
|
+
base: 'border-transparent'
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
// With a description, the icon centres on the *title's* line box rather
|
|
2122
|
+
// than the whole (now two-line) card — hence the negative offset.
|
|
2123
|
+
hasDescription: {
|
|
2124
|
+
true: {
|
|
2125
|
+
inner: 'items-start',
|
|
2126
|
+
icon: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]',
|
|
2127
|
+
spinner: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]'
|
|
2128
|
+
},
|
|
2129
|
+
false: {
|
|
2130
|
+
inner: 'items-center'
|
|
2131
|
+
}
|
|
2132
|
+
},
|
|
2133
|
+
// Cards are pinned to the placement edge so the stack grows away from
|
|
2134
|
+
// it, once the container has supplied stack geometry (`@geometry` on
|
|
2135
|
+
// <NotificationCard>). `none` is the default — a card rendered without
|
|
2136
|
+
// geometry (e.g. a standalone demo) keeps its normal document flow.
|
|
2137
|
+
// The dynamic parts of the stack's positioning (transform, opacity,
|
|
2138
|
+
// height, z-index, transform-origin) still come from the card's own
|
|
2139
|
+
// inline `style` getter, since they change per-frame with the stack's
|
|
2140
|
+
// geometry — only the static edge-pinning lives here.
|
|
2141
|
+
stackPlacement: {
|
|
2142
|
+
top: {
|
|
2143
|
+
base: 'absolute inset-x-0 top-0'
|
|
2144
|
+
},
|
|
2145
|
+
bottom: {
|
|
2146
|
+
base: 'absolute inset-x-0 bottom-0'
|
|
2147
|
+
},
|
|
2148
|
+
none: {}
|
|
2149
|
+
}
|
|
2150
|
+
},
|
|
2151
|
+
compoundVariants: [
|
|
2152
|
+
// default: neutral surface, colour carried by the icon and title.
|
|
2153
|
+
// `default` intent has no accent — icon and title stay neutral, same
|
|
2154
|
+
// `firm` level the other intents use for their accent text.
|
|
2155
|
+
{
|
|
2156
|
+
variant: 'default',
|
|
2157
|
+
intent: 'default',
|
|
2158
|
+
class: {
|
|
2159
|
+
icon: 'text-neutral-firm',
|
|
2160
|
+
title: 'text-neutral-firm'
|
|
2161
|
+
}
|
|
2162
|
+
}, {
|
|
2163
|
+
variant: 'default',
|
|
2164
|
+
intent: 'info',
|
|
2165
|
+
class: {
|
|
2166
|
+
icon: 'text-primary',
|
|
2167
|
+
title: 'text-primary'
|
|
2168
|
+
}
|
|
2169
|
+
}, {
|
|
2170
|
+
// `success-firm` is only ~2.3:1 on the white card surface in light
|
|
2171
|
+
// mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
|
|
2172
|
+
// contrast note.
|
|
2173
|
+
variant: 'default',
|
|
2174
|
+
intent: 'success',
|
|
2175
|
+
class: {
|
|
2176
|
+
icon: 'text-success-bolder',
|
|
2177
|
+
title: 'text-success-bolder'
|
|
2178
|
+
}
|
|
2179
|
+
}, {
|
|
2180
|
+
// `warning-firm` is only ~3:1 on the white card surface in light
|
|
2181
|
+
// mode; `bolder` clears AA in both themes. See packages/frontile/docs/notifications-usage.md's
|
|
2182
|
+
// contrast note.
|
|
2183
|
+
variant: 'default',
|
|
2184
|
+
intent: 'warning',
|
|
2185
|
+
class: {
|
|
2186
|
+
icon: 'text-warning-bolder',
|
|
2187
|
+
title: 'text-warning-bolder'
|
|
2188
|
+
}
|
|
2189
|
+
}, {
|
|
2190
|
+
variant: 'default',
|
|
2191
|
+
intent: 'danger',
|
|
2192
|
+
class: {
|
|
2193
|
+
icon: 'text-danger-firm',
|
|
2194
|
+
title: 'text-danger-firm'
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
// tonal: same recipe as Button's `appearance: 'tonal'` — an opaque
|
|
2198
|
+
// outer surface (so the floating card never lets page content show
|
|
2199
|
+
// through) with the translucent `{intent}-soft` tint and its `on-*`
|
|
2200
|
+
// contrast ink applied to the *inner* element, which composites over
|
|
2201
|
+
// that opaque surface. The outer picks up the `default` variant's
|
|
2202
|
+
// neutral surface/border instead of a colour-matched one: Button's
|
|
2203
|
+
// tonal has no border at all, but a card floating over arbitrary page
|
|
2204
|
+
// content benefits from the same edge definition `default` already
|
|
2205
|
+
// uses, so it borrows that treatment rather than inventing a new one.
|
|
2206
|
+
{
|
|
2207
|
+
variant: 'tonal',
|
|
2208
|
+
intent: 'default',
|
|
2209
|
+
class: {
|
|
2210
|
+
inner: 'bg-neutral-soft',
|
|
2211
|
+
icon: 'text-on-neutral-soft',
|
|
2212
|
+
title: 'text-on-neutral-soft'
|
|
2213
|
+
}
|
|
2214
|
+
}, {
|
|
2215
|
+
variant: 'tonal',
|
|
2216
|
+
intent: 'info',
|
|
2217
|
+
class: {
|
|
2218
|
+
inner: 'bg-primary-soft',
|
|
2219
|
+
icon: 'text-on-primary-soft',
|
|
2220
|
+
title: 'text-on-primary-soft'
|
|
2221
|
+
}
|
|
2222
|
+
}, {
|
|
2223
|
+
variant: 'tonal',
|
|
2224
|
+
intent: 'success',
|
|
2225
|
+
class: {
|
|
2226
|
+
inner: 'bg-success-soft',
|
|
2227
|
+
icon: 'text-on-success-soft',
|
|
2228
|
+
title: 'text-on-success-soft'
|
|
2229
|
+
}
|
|
2230
|
+
}, {
|
|
2231
|
+
variant: 'tonal',
|
|
2232
|
+
intent: 'warning',
|
|
2233
|
+
class: {
|
|
2234
|
+
inner: 'bg-warning-soft',
|
|
2235
|
+
icon: 'text-on-warning-soft',
|
|
2236
|
+
title: 'text-on-warning-soft'
|
|
2237
|
+
}
|
|
2238
|
+
}, {
|
|
2239
|
+
variant: 'tonal',
|
|
2240
|
+
intent: 'danger',
|
|
2241
|
+
class: {
|
|
2242
|
+
inner: 'bg-danger-soft',
|
|
2243
|
+
icon: 'text-on-danger-soft',
|
|
2244
|
+
title: 'text-on-danger-soft'
|
|
2245
|
+
}
|
|
2246
|
+
},
|
|
2247
|
+
// solid: filled surface, contrast text. `description` uses the
|
|
2248
|
+
// full-strength `on-{intent}` ink rather than a translucent cut — see
|
|
2249
|
+
// packages/frontile/docs/notifications-usage.md's contrast note for why
|
|
2250
|
+
// (a translucent cut used to fail WCAG AA here).
|
|
2251
|
+
//
|
|
2252
|
+
// The spinner override matters because `@intent` on <Spinner> drives its
|
|
2253
|
+
// arc via `fill-{intent}`, the exact same color as this variant's own
|
|
2254
|
+
// `bg-{intent}` surface — left alone the arc would be camouflaged
|
|
2255
|
+
// against its own card, so `solid` forces both halves of the spinner to
|
|
2256
|
+
// the contrast ink instead.
|
|
2257
|
+
{
|
|
2258
|
+
variant: 'solid',
|
|
2259
|
+
intent: 'default',
|
|
2260
|
+
class: {
|
|
2261
|
+
base: 'bg-neutral text-on-neutral',
|
|
2262
|
+
icon: 'text-on-neutral',
|
|
2263
|
+
title: 'text-on-neutral',
|
|
2264
|
+
description: 'text-on-neutral',
|
|
2265
|
+
spinner: 'fill-on-neutral text-on-neutral/30'
|
|
2266
|
+
}
|
|
2267
|
+
}, {
|
|
2268
|
+
variant: 'solid',
|
|
2269
|
+
intent: 'info',
|
|
2270
|
+
class: {
|
|
2271
|
+
base: 'bg-primary text-on-primary',
|
|
2272
|
+
icon: 'text-on-primary',
|
|
2273
|
+
title: 'text-on-primary',
|
|
2274
|
+
description: 'text-on-primary',
|
|
2275
|
+
spinner: 'fill-on-primary text-on-primary/30'
|
|
2276
|
+
}
|
|
2277
|
+
}, {
|
|
2278
|
+
variant: 'solid',
|
|
2279
|
+
intent: 'success',
|
|
2280
|
+
class: {
|
|
2281
|
+
base: 'bg-success text-on-success',
|
|
2282
|
+
icon: 'text-on-success',
|
|
2283
|
+
title: 'text-on-success',
|
|
2284
|
+
description: 'text-on-success',
|
|
2285
|
+
spinner: 'fill-on-success text-on-success/30'
|
|
2286
|
+
}
|
|
2287
|
+
}, {
|
|
2288
|
+
variant: 'solid',
|
|
2289
|
+
intent: 'warning',
|
|
2290
|
+
class: {
|
|
2291
|
+
base: 'bg-warning text-on-warning',
|
|
2292
|
+
icon: 'text-on-warning',
|
|
2293
|
+
title: 'text-on-warning',
|
|
2294
|
+
description: 'text-on-warning',
|
|
2295
|
+
spinner: 'fill-on-warning text-on-warning/30'
|
|
2296
|
+
}
|
|
2297
|
+
}, {
|
|
2298
|
+
variant: 'solid',
|
|
2299
|
+
intent: 'danger',
|
|
2300
|
+
class: {
|
|
2301
|
+
base: 'bg-danger text-on-danger',
|
|
2302
|
+
icon: 'text-on-danger',
|
|
2303
|
+
title: 'text-on-danger',
|
|
2304
|
+
description: 'text-on-danger',
|
|
2305
|
+
spinner: 'fill-on-danger text-on-danger/30'
|
|
2306
|
+
}
|
|
2307
|
+
}],
|
|
2308
|
+
defaultVariants: {
|
|
2309
|
+
intent: 'default',
|
|
2310
|
+
variant: 'default',
|
|
2311
|
+
hasDescription: false,
|
|
2312
|
+
stackPlacement: 'none'
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2315
|
+
|
|
2316
|
+
const label = tv({
|
|
2317
|
+
slots: {
|
|
2318
|
+
// label text role (Open Sans semibold, tight leading)
|
|
2319
|
+
base: 'text-neutral-bolder inline-block font-label text-label-sm pb-2',
|
|
2320
|
+
asterisk: 'text-danger'
|
|
2321
|
+
},
|
|
2322
|
+
variants: {
|
|
2323
|
+
size: {
|
|
2324
|
+
sm: {
|
|
2325
|
+
base: 'text-label-2xs'
|
|
2326
|
+
},
|
|
2327
|
+
md: {},
|
|
2328
|
+
lg: {
|
|
2329
|
+
base: 'text-label-md'
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
},
|
|
2333
|
+
defaultVariants: {
|
|
2334
|
+
size: 'md'
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
const formDescription = tv({
|
|
2338
|
+
// help/description text — body role
|
|
2339
|
+
base: 'text-neutral font-body text-body-2xs pb-1 last:pb-0',
|
|
2340
|
+
variants: {
|
|
2341
|
+
size: {
|
|
2342
|
+
sm: 'text-body-2xs',
|
|
2343
|
+
md: '',
|
|
2344
|
+
lg: 'text-body-sm'
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
defaultVariants: {
|
|
2348
|
+
size: 'md'
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
const formFeedback = tv({
|
|
2352
|
+
// validation/feedback text — body role
|
|
2353
|
+
base: 'font-body text-body-2xs pt-1',
|
|
2354
|
+
variants: {
|
|
2355
|
+
intent: {
|
|
2356
|
+
primary: 'text-primary',
|
|
2357
|
+
secondary: 'text-secondary',
|
|
2358
|
+
tertiary: 'text-tertiary',
|
|
2359
|
+
success: 'text-success',
|
|
2360
|
+
danger: 'text-danger',
|
|
2361
|
+
warning: 'text-warning'
|
|
2362
|
+
},
|
|
2363
|
+
size: {
|
|
2364
|
+
sm: 'text-body-2xs',
|
|
2365
|
+
md: '',
|
|
2366
|
+
lg: 'text-body-sm'
|
|
2367
|
+
}
|
|
2368
|
+
},
|
|
2369
|
+
defaultVariants: {
|
|
2370
|
+
size: 'sm'
|
|
2371
|
+
}
|
|
2372
|
+
});
|
|
2373
|
+
|
|
2374
|
+
// The visual shell of a form field: background, border, radius, and the
|
|
2375
|
+
// invalid/disabled treatments. Shared by the `input` slot and by `select`'s
|
|
2376
|
+
// `chipsField`, which becomes the shell when chips render beside the trigger.
|
|
2377
|
+
const fieldShell = ['bg-surface-input', 'border', 'border-neutral-soft', 'rounded-xl', 'selection:bg-surface-overlay-soft'];
|
|
2378
|
+
const input = tv({
|
|
2379
|
+
slots: {
|
|
2380
|
+
base: '',
|
|
2381
|
+
innerContainer: 'relative flex',
|
|
2382
|
+
startContent: 'absolute inset-y-0 left-0 flex items-center',
|
|
2383
|
+
endContent: 'absolute inset-y-0 right-0 flex items-center',
|
|
2384
|
+
input: ['appearance-none', 'flex-1', 'w-full', ...fieldShell, 'text-neutral-strong', 'placeholder-neutral',
|
|
2385
|
+
// body role family; single-line controls keep tight leading (not the body relaxed leading)
|
|
2386
|
+
'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']
|
|
2387
|
+
},
|
|
2388
|
+
variants: {
|
|
2389
|
+
size: {
|
|
2390
|
+
sm: {
|
|
2391
|
+
input: 'p-2',
|
|
2392
|
+
startContent: 'pl-2',
|
|
2393
|
+
endContent: 'pr-2'
|
|
2394
|
+
},
|
|
2395
|
+
md: {
|
|
2396
|
+
input: 'p-3',
|
|
2397
|
+
startContent: 'pl-3',
|
|
2398
|
+
endContent: 'pr-3'
|
|
2399
|
+
},
|
|
2400
|
+
lg: {
|
|
2401
|
+
input: 'p-4',
|
|
2402
|
+
startContent: 'pl-4',
|
|
2403
|
+
endContent: 'pr-4'
|
|
2404
|
+
}
|
|
2405
|
+
},
|
|
2406
|
+
hasStartContent: {
|
|
2407
|
+
true: {
|
|
2408
|
+
input: 'ps-8'
|
|
2409
|
+
}
|
|
2410
|
+
},
|
|
2411
|
+
hasEndContent: {
|
|
2412
|
+
true: {
|
|
2413
|
+
input: 'pe-10'
|
|
2414
|
+
}
|
|
2415
|
+
},
|
|
2416
|
+
// When chips render beside the trigger, `chipsField` owns the field shell
|
|
2417
|
+
// and the trigger itself must be visually bare.
|
|
2418
|
+
hasChips: {
|
|
2419
|
+
true: {
|
|
2420
|
+
input: ['border-0', 'bg-transparent', 'p-0', 'w-auto', 'flex-1',
|
|
2421
|
+
// Once chips show the selection the trigger renders nothing at all, so
|
|
2422
|
+
// it has no content to give it a height -- it collapsed to a 0px box
|
|
2423
|
+
// that could not be clicked. Stretching makes it as tall as the chips
|
|
2424
|
+
// sitting next to it, which is the box a pointer needs to hit.
|
|
2425
|
+
'self-stretch',
|
|
2426
|
+
// No horizontal floor by default: a bare (non-filterable) trigger has
|
|
2427
|
+
// no content of its own, so a floor would only push it onto a second
|
|
2428
|
+
// flex line. `select` puts the floor back for the filterable trigger,
|
|
2429
|
+
// which does need room to type.
|
|
2430
|
+
'min-w-0', 'focus:ring-0', 'focus:border-transparent']
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
startContentPointerEvents: {
|
|
2434
|
+
auto: {
|
|
2435
|
+
startContent: 'pointer-events-auto'
|
|
2436
|
+
},
|
|
2437
|
+
none: {
|
|
2438
|
+
startContent: 'pointer-events-none'
|
|
2439
|
+
}
|
|
2440
|
+
},
|
|
2441
|
+
endContentPointerEvents: {
|
|
2442
|
+
auto: {
|
|
2443
|
+
endContent: 'pointer-events-auto'
|
|
2444
|
+
},
|
|
2445
|
+
none: {
|
|
2446
|
+
endContent: 'pointer-events-none'
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
},
|
|
2450
|
+
defaultVariants: {
|
|
2451
|
+
size: 'md'
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
const textarea = tv({
|
|
2455
|
+
extend: input,
|
|
2456
|
+
slots: {
|
|
2457
|
+
input: 'min-h-24'
|
|
2458
|
+
},
|
|
2459
|
+
variants: {
|
|
2460
|
+
size: {
|
|
2461
|
+
sm: {},
|
|
2462
|
+
md: {},
|
|
2463
|
+
lg: {}
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2467
|
+
|
|
2468
|
+
// A one-time-code field is one real <input> laid transparently over inert
|
|
2469
|
+
// cells. The input must stay fully opaque -- iOS refuses the long-press Paste
|
|
2470
|
+
// menu on an opacity:0 input -- so every colour is made transparent instead.
|
|
2471
|
+
const inputOtp = tv({
|
|
2472
|
+
slots: {
|
|
2473
|
+
base: '',
|
|
2474
|
+
// pointer-events are inverted: the container ignores the pointer so that a
|
|
2475
|
+
// click anywhere in the widget lands on the input below and resolves to the
|
|
2476
|
+
// nearest character position.
|
|
2477
|
+
container: 'relative flex items-center w-fit pointer-events-none',
|
|
2478
|
+
group: 'flex items-center',
|
|
2479
|
+
cell: [...fieldShell, 'relative flex items-center justify-center', 'font-body tabular-nums text-neutral-strong', 'transition-colors'],
|
|
2480
|
+
cellChar: 'select-none',
|
|
2481
|
+
caret: 'absolute w-px bg-neutral-strong animate-caret-blink motion-reduce:animate-none',
|
|
2482
|
+
separator: 'select-none text-neutral-soft',
|
|
2483
|
+
input: ['absolute inset-y-0 left-0 h-full', 'pointer-events-auto', 'text-left',
|
|
2484
|
+
// Mandatory: opaque element, transparent paint.
|
|
2485
|
+
'opacity-100', 'text-transparent caret-transparent bg-transparent',
|
|
2486
|
+
// Both halves -- setting only the background leaves the text drawn in the
|
|
2487
|
+
// highlight's foreground colour.
|
|
2488
|
+
'selection:bg-transparent selection:text-transparent', 'appearance-none border-0 outline-0 shadow-none', 'focus:outline-hidden focus:ring-0',
|
|
2489
|
+
// >= 16px or iOS Safari zooms the page on focus. The negative tracking
|
|
2490
|
+
// collapses the invisible glyphs so they cannot spill past the cells.
|
|
2491
|
+
'text-base leading-none font-mono tabular-nums tracking-[-0.5em]',
|
|
2492
|
+
// Chromium paints an autofilled field yellow, and the :autofill state
|
|
2493
|
+
// outlives the fill. -webkit-text-fill-color is the property that
|
|
2494
|
+
// actually controls text colour in that state.
|
|
2495
|
+
'autofill:bg-transparent autofill:shadow-none', 'autofill:[-webkit-text-fill-color:transparent]',
|
|
2496
|
+
// iOS paints selection in a native layer that ignores ::selection, so the
|
|
2497
|
+
// text metrics are compressed further to shrink what it can paint.
|
|
2498
|
+
'supports-[-webkit-touch-callout:none]:tracking-[-0.6em]', 'supports-[-webkit-touch-callout:none]:font-thin',
|
|
2499
|
+
// Password managers anchor their badge to the INPUT's box, not the
|
|
2500
|
+
// container's, so it would land on the last cell. Reserve a 40px gutter
|
|
2501
|
+
// and clip it back: absolutely positioned, so no layout shift, and
|
|
2502
|
+
// clip-path clips hit-testing too.
|
|
2503
|
+
'w-[calc(100%+40px)] [clip-path:inset(0_40px_0_0)]',
|
|
2504
|
+
// Keep an injected badge clickable inside the pointer-events-none container.
|
|
2505
|
+
'[&+*]:pointer-events-auto']
|
|
2506
|
+
},
|
|
2507
|
+
variants: {
|
|
2508
|
+
size: {
|
|
2509
|
+
sm: {
|
|
2510
|
+
cell: 'size-9 rounded-lg text-sm',
|
|
2511
|
+
group: 'gap-1.5',
|
|
2512
|
+
separator: 'px-1 text-sm',
|
|
2513
|
+
caret: 'h-4'
|
|
2514
|
+
},
|
|
2515
|
+
md: {
|
|
2516
|
+
cell: 'size-12 text-base',
|
|
2517
|
+
group: 'gap-2',
|
|
2518
|
+
separator: 'px-1.5 text-base',
|
|
2519
|
+
caret: 'h-5'
|
|
2520
|
+
},
|
|
2521
|
+
lg: {
|
|
2522
|
+
cell: 'size-14 text-lg',
|
|
2523
|
+
group: 'gap-2.5',
|
|
2524
|
+
separator: 'px-2 text-lg',
|
|
2525
|
+
caret: 'h-6'
|
|
2526
|
+
}
|
|
2527
|
+
},
|
|
2528
|
+
// z-10 keeps the active cell's ring from being clipped by its neighbour.
|
|
2529
|
+
isActive: {
|
|
2530
|
+
true: {
|
|
2531
|
+
cell: 'z-10 border-primary-soft ring-3 ring-focus'
|
|
2532
|
+
}
|
|
2533
|
+
},
|
|
2534
|
+
// Mirrors `input`'s `aria-invalid:focus:ring-danger-soft`: a focused invalid
|
|
2535
|
+
// cell must ring red, not keep the neutral focus ring.
|
|
2536
|
+
isInvalid: {
|
|
2537
|
+
true: {
|
|
2538
|
+
cell: 'border-danger-soft ring-danger-soft'
|
|
2539
|
+
}
|
|
2540
|
+
},
|
|
2541
|
+
isDisabled: {
|
|
2542
|
+
true: {
|
|
2543
|
+
cell: 'border-neutral-subtle text-neutral-soft'
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
},
|
|
2547
|
+
defaultVariants: {
|
|
2548
|
+
size: 'md'
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
const checkboxRadioBase = tv({
|
|
2552
|
+
slots: {
|
|
2553
|
+
base: ['max-w-fit flex items-center justify-start'],
|
|
2554
|
+
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],
|
|
2555
|
+
labelContainer: ['flex flex-col ml-2'],
|
|
2556
|
+
label: 'font-body text-body-xs pb-0'
|
|
2557
|
+
},
|
|
2558
|
+
variants: {
|
|
2559
|
+
size: {
|
|
2560
|
+
sm: {
|
|
2561
|
+
input: 'h-4 w-4'
|
|
2562
|
+
},
|
|
2563
|
+
md: {
|
|
2564
|
+
input: 'h-5 w-5'
|
|
2565
|
+
},
|
|
2566
|
+
lg: {
|
|
2567
|
+
input: 'h-6 w-6'
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
},
|
|
2571
|
+
defaultVariants: {
|
|
2572
|
+
size: 'md'
|
|
2573
|
+
}
|
|
2574
|
+
});
|
|
2575
|
+
const checkboxRadioGroupBase = tv({
|
|
2576
|
+
slots: {
|
|
2577
|
+
base: '',
|
|
2578
|
+
optionsContainer: ['flex flex-col flex-wrap gap-4 data-[orientation=horizontal]:flex-row'],
|
|
2579
|
+
label: 'pb-2'
|
|
2580
|
+
},
|
|
2581
|
+
variants: {
|
|
2582
|
+
size: {
|
|
2583
|
+
sm: '',
|
|
2584
|
+
md: '',
|
|
2585
|
+
lg: ''
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
});
|
|
2589
|
+
const checkbox = tv({
|
|
2590
|
+
extend: checkboxRadioBase,
|
|
2591
|
+
slots: {
|
|
2592
|
+
input: ['checked-bg-checkbox', 'indeterminate-bg-checkbox', 'rounded-sm', 'checked:bg-primary checked:border-primary',
|
|
2593
|
+
// Indeterminate state styles - show minus/dash icon
|
|
2594
|
+
'indeterminate:bg-primary', 'indeterminate:border-primary', 'indeterminate:bg-origin-border', 'indeterminate:bg-center', 'indeterminate:bg-no-repeat']
|
|
2595
|
+
},
|
|
2596
|
+
variants: {
|
|
2597
|
+
size: {
|
|
2598
|
+
sm: {},
|
|
2599
|
+
md: {},
|
|
2600
|
+
lg: {}
|
|
2601
|
+
}
|
|
2602
|
+
},
|
|
2603
|
+
defaultVariants: {
|
|
2604
|
+
size: 'md'
|
|
2605
|
+
}
|
|
2606
|
+
});
|
|
2607
|
+
const radio = tv({
|
|
2608
|
+
extend: checkboxRadioBase,
|
|
2609
|
+
slots: {
|
|
2610
|
+
input: ['checked-bg-radio', 'rounded-full', 'checked:bg-primary checked:border-primary']
|
|
2611
|
+
},
|
|
2612
|
+
variants: {
|
|
2613
|
+
size: {
|
|
2614
|
+
sm: {},
|
|
2615
|
+
md: {},
|
|
2616
|
+
lg: {}
|
|
2617
|
+
}
|
|
2618
|
+
},
|
|
2619
|
+
defaultVariants: {
|
|
2620
|
+
size: 'md'
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
const radioGroup = tv({
|
|
2624
|
+
extend: checkboxRadioGroupBase
|
|
2625
|
+
});
|
|
2626
|
+
const checkboxGroup = tv({
|
|
2627
|
+
extend: checkboxRadioGroupBase
|
|
2628
|
+
});
|
|
2629
|
+
const select = tv({
|
|
2630
|
+
extend: input,
|
|
2631
|
+
slots: {
|
|
2632
|
+
base: [],
|
|
2633
|
+
placeholder: 'text-neutral',
|
|
2634
|
+
listbox: 'scroll-py-6 max-h-64',
|
|
2635
|
+
icon: 'w-5 h-5',
|
|
2636
|
+
clearButton: 'pointer-events-auto',
|
|
2637
|
+
input: '[button]:cursor-default',
|
|
2638
|
+
emptyContent: 'p-2',
|
|
2639
|
+
// The wrapper around the trigger. It is rendered in every mode; the
|
|
2640
|
+
// `hasChips` variant below decides whether it is the field shell or a
|
|
2641
|
+
// transparent passthrough. Authored here rather than as literal classes in
|
|
2642
|
+
// the component template because Tailwind does not scan
|
|
2643
|
+
// `packages/frontile/src`.
|
|
2644
|
+
chipsField: '',
|
|
2645
|
+
chipsContainer: 'flex flex-wrap items-center gap-1 min-w-0',
|
|
2646
|
+
chip: ''
|
|
2647
|
+
},
|
|
2648
|
+
variants: {
|
|
2649
|
+
size: {
|
|
2650
|
+
sm: {},
|
|
2651
|
+
md: {},
|
|
2652
|
+
lg: {}
|
|
2653
|
+
},
|
|
2654
|
+
// When chips render, `chipsField` becomes the field shell in place of the
|
|
2655
|
+
// trigger's own border (see the `hasChips` variant on `input`), and owns the
|
|
2656
|
+
// padding. Otherwise it is a transparent, full-width flex passthrough: the
|
|
2657
|
+
// shell stays on the trigger, but the wrapper is still a real box, so it can
|
|
2658
|
+
// be measured as the popover's width reference in both modes.
|
|
2659
|
+
//
|
|
2660
|
+
// `data-invalid` / `data-disabled` are set by the component because
|
|
2661
|
+
// `aria-invalid:` and `disabled:` only match the element carrying them.
|
|
2662
|
+
hasChips: {
|
|
2663
|
+
true: {
|
|
2664
|
+
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']
|
|
2665
|
+
},
|
|
2666
|
+
false: {
|
|
2667
|
+
chipsField: 'flex w-full min-w-0'
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
// Whether the trigger is a filterable text input rather than a bare button.
|
|
2671
|
+
// Only affects how much horizontal room the trigger reserves in chips mode.
|
|
2672
|
+
isFilterable: {
|
|
2673
|
+
true: {},
|
|
2674
|
+
false: {}
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
compoundVariants: [
|
|
2678
|
+
// Padding belongs to whichever element is the field shell, so it is applied
|
|
2679
|
+
// to `chipsField` only in chips mode -- in passthrough mode the wrapper has
|
|
2680
|
+
// to add no geometry of its own.
|
|
2681
|
+
// The `min-h-*` values are the height of the same-size text field
|
|
2682
|
+
// (padding + line box + border), so a chips field is exactly as tall as a
|
|
2683
|
+
// single-select one, does not change height as the first chip arrives, and
|
|
2684
|
+
// absorbs the flex gap when the trigger wraps below the chips.
|
|
2685
|
+
// No gap between the chips and the trigger: the chips carry their own gap,
|
|
2686
|
+
// and a gap here is space the trigger has to fit into before it is allowed
|
|
2687
|
+
// to stay on the chips' line. With `gap-0` a trigger that does have to wrap
|
|
2688
|
+
// (the chips already fill the row) costs no vertical space at all.
|
|
2689
|
+
{
|
|
2690
|
+
hasChips: true,
|
|
2691
|
+
size: 'sm',
|
|
2692
|
+
class: {
|
|
2693
|
+
chipsField: 'p-1 gap-0 min-h-9.5'
|
|
2694
|
+
}
|
|
2695
|
+
}, {
|
|
2696
|
+
hasChips: true,
|
|
2697
|
+
size: 'md',
|
|
2698
|
+
class: {
|
|
2699
|
+
chipsField: 'p-1.5 gap-0 min-h-11.5'
|
|
2700
|
+
}
|
|
2701
|
+
}, {
|
|
2702
|
+
hasChips: true,
|
|
2703
|
+
size: 'lg',
|
|
2704
|
+
class: {
|
|
2705
|
+
chipsField: 'p-2 gap-0 min-h-13.5'
|
|
2706
|
+
}
|
|
2707
|
+
},
|
|
2708
|
+
// Chips have to clear the absolutely-positioned start/end content the same
|
|
2709
|
+
// way a bare `input` does, otherwise they run underneath the chevron and the
|
|
2710
|
+
// clear button.
|
|
2711
|
+
{
|
|
2712
|
+
hasChips: true,
|
|
2713
|
+
hasStartContent: true,
|
|
2714
|
+
class: {
|
|
2715
|
+
chipsField: 'ps-8'
|
|
2716
|
+
}
|
|
2717
|
+
}, {
|
|
2718
|
+
hasChips: true,
|
|
2719
|
+
hasEndContent: true,
|
|
2720
|
+
class: {
|
|
2721
|
+
chipsField: 'pe-10'
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
// ...and once `chipsField` reserves that room, the bare trigger inside it
|
|
2725
|
+
// must not reserve it a second time.
|
|
2726
|
+
{
|
|
2727
|
+
hasChips: true,
|
|
2728
|
+
hasStartContent: true,
|
|
2729
|
+
class: {
|
|
2730
|
+
input: 'ps-0'
|
|
2731
|
+
}
|
|
2732
|
+
}, {
|
|
2733
|
+
hasChips: true,
|
|
2734
|
+
hasEndContent: true,
|
|
2735
|
+
class: {
|
|
2736
|
+
input: 'pe-0'
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
// Only the filterable trigger needs typing room -- and, since the field
|
|
2740
|
+
// itself no longer sets a gap, its own separation from the last chip.
|
|
2741
|
+
// See `min-w-0` and `gap-0` above.
|
|
2742
|
+
{
|
|
2743
|
+
hasChips: true,
|
|
2744
|
+
isFilterable: true,
|
|
2745
|
+
class: {
|
|
2746
|
+
input: 'min-w-16 ms-1'
|
|
2747
|
+
}
|
|
2748
|
+
}],
|
|
2749
|
+
defaultVariants: {
|
|
2750
|
+
size: 'md'
|
|
2751
|
+
}
|
|
2752
|
+
});
|
|
2753
|
+
|
|
2754
|
+
// Note: extends `input` rather than `select` because tailwind-variants
|
|
2755
|
+
// loses inherited slot types across two levels of `extend`.
|
|
2756
|
+
const autocomplete = tv({
|
|
2757
|
+
extend: input,
|
|
2758
|
+
slots: {
|
|
2759
|
+
base: [],
|
|
2760
|
+
listbox: 'scroll-py-6 max-h-64',
|
|
2761
|
+
icon: 'w-5 h-5',
|
|
2762
|
+
clearButton: 'pointer-events-auto',
|
|
2763
|
+
input: 'cursor-text',
|
|
2764
|
+
emptyContent: 'p-2'
|
|
2765
|
+
},
|
|
2766
|
+
variants: {
|
|
2767
|
+
size: {
|
|
2768
|
+
sm: {},
|
|
2769
|
+
md: {},
|
|
2770
|
+
lg: {}
|
|
2771
|
+
}
|
|
2772
|
+
},
|
|
2773
|
+
defaultVariants: {
|
|
2774
|
+
size: 'md'
|
|
2775
|
+
}
|
|
2776
|
+
});
|
|
2777
|
+
const nativeSelect = tv({
|
|
2778
|
+
extend: input,
|
|
2779
|
+
slots: {
|
|
2780
|
+
input: ['appearance-none'],
|
|
2781
|
+
icon: 'w-5 h-5'
|
|
2782
|
+
},
|
|
2783
|
+
variants: {
|
|
2784
|
+
size: {
|
|
2785
|
+
sm: {},
|
|
2786
|
+
md: {},
|
|
2787
|
+
lg: {}
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
});
|
|
2791
|
+
const switchInput = tv({
|
|
2792
|
+
slots: {
|
|
2793
|
+
base: 'group relative max-w-fit inline-flex items-center justify-start',
|
|
2794
|
+
labelContainer: 'flex flex-col ml-2',
|
|
2795
|
+
label: 'font-body text-body-xs pb-0',
|
|
2796
|
+
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',
|
|
2797
|
+
// `transition-background` is not a Tailwind v4 utility -- it compiled to
|
|
2798
|
+
// nothing. The wrapper's fill is swapped by `group-data-[selected]:bg-*`,
|
|
2799
|
+
// so background-color is what needs to ease.
|
|
2800
|
+
'transition-colors', ...focusVisibleWithinRing],
|
|
2801
|
+
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'],
|
|
2802
|
+
thumb: ['z-10', 'flex', 'items-center', 'justify-center', 'bg-white', 'shadow-small', 'rounded-full', 'origin-right', 'transition-all', 'pointer-events-none', 'text-black'],
|
|
2803
|
+
startContent: ['z-0 absolute start-1.5 text-current', 'opacity-0', 'scale-50',
|
|
2804
|
+
// Tailwind v4 compiles `scale-*` to the standalone `scale` property, not
|
|
2805
|
+
// to `transform`; `transform` stays listed for consumers who override
|
|
2806
|
+
// @classes.startContent and position with it.
|
|
2807
|
+
'transition-[transform,scale,opacity]', 'group-data-[selected=true]:scale-100', 'group-data-[selected=true]:opacity-100'],
|
|
2808
|
+
endContent: ['z-0 absolute end-1.5 text-neutral', 'opacity-100',
|
|
2809
|
+
// Likewise `translate-x-*` compiles to the standalone `translate`
|
|
2810
|
+
// property -- without it listed, this content snapped instead of sliding.
|
|
2811
|
+
'transition-[transform,translate,opacity]', 'group-data-[selected=true]:translate-x-3', 'group-data-[selected=true]:opacity-0']
|
|
2812
|
+
},
|
|
2813
|
+
variants: {
|
|
2814
|
+
isDisabled: {
|
|
2815
|
+
true: {
|
|
2816
|
+
wrapper: 'opacity-disabled pointer-events-none'
|
|
2817
|
+
}
|
|
2818
|
+
},
|
|
2819
|
+
size: {
|
|
2820
|
+
sm: {
|
|
2821
|
+
wrapper: 'w-6 h-3 px-[2px]',
|
|
2822
|
+
thumb: ['w-2 h-2 text-xs', 'group-data-[selected=true]:ms-3'],
|
|
2823
|
+
endContent: 'text-xs',
|
|
2824
|
+
startContent: 'text-xs',
|
|
2825
|
+
label: 'text-small'
|
|
2826
|
+
},
|
|
2827
|
+
md: {
|
|
2828
|
+
wrapper: 'w-11 h-6',
|
|
2829
|
+
thumb: ['w-4 h-4 text-sm', 'group-data-[selected=true]:ms-5'],
|
|
2830
|
+
endContent: 'text-sm',
|
|
2831
|
+
startContent: 'text-sm',
|
|
2832
|
+
label: 'text-md'
|
|
2833
|
+
},
|
|
2834
|
+
lg: {
|
|
2835
|
+
wrapper: 'w-12 h-7',
|
|
2836
|
+
thumb: ['w-5 h-5 text-medium', 'group-data-[selected=true]:ms-5'],
|
|
2837
|
+
endContent: 'text-md',
|
|
2838
|
+
startContent: 'text-md',
|
|
2839
|
+
label: 'text-lg'
|
|
2840
|
+
}
|
|
2841
|
+
},
|
|
2842
|
+
intent: {
|
|
2843
|
+
default: {
|
|
2844
|
+
wrapper: ['group-data-[selected=true]:bg-neutral-firm', 'group-data-[selected=true]:text-on-neutral-firm']
|
|
2845
|
+
},
|
|
2846
|
+
primary: {
|
|
2847
|
+
wrapper: ['group-data-[selected=true]:bg-primary', 'group-data-[selected=true]:text-on-primary']
|
|
2848
|
+
},
|
|
2849
|
+
secondary: {
|
|
2850
|
+
wrapper: ['group-data-[selected=true]:bg-secondary', 'group-data-[selected=true]:text-on-secondary']
|
|
2851
|
+
},
|
|
2852
|
+
tertiary: {
|
|
2853
|
+
wrapper: ['group-data-[selected=true]:bg-tertiary', 'group-data-[selected=true]:text-on-tertiary']
|
|
2854
|
+
},
|
|
2855
|
+
success: {
|
|
2856
|
+
wrapper: ['group-data-[selected=true]:bg-success', 'group-data-[selected=true]:text-on-success']
|
|
2857
|
+
},
|
|
2858
|
+
warning: {
|
|
2859
|
+
wrapper: ['group-data-[selected=true]:bg-warning', 'group-data-[selected=true]:text-on-warning']
|
|
2860
|
+
},
|
|
2861
|
+
danger: {
|
|
2862
|
+
wrapper: ['group-data-[selected=true]:bg-danger', 'group-data-[selected=true]:text-on-danger']
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
defaultVariants: {
|
|
2867
|
+
size: 'md',
|
|
2868
|
+
intent: 'primary',
|
|
2869
|
+
isDisabled: false
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
|
|
2873
|
+
const base = tv({
|
|
2874
|
+
slots: {
|
|
2875
|
+
base: 'flex flex-wrap flex-row items-center',
|
|
2876
|
+
labelContainer: 'leading-tight flex items-start',
|
|
2877
|
+
inputContainer: 'flex items-center',
|
|
2878
|
+
label: 'font-body text-body-xs pl-2 pb-0',
|
|
2879
|
+
hint: 'pl-2 flex basis-full before:content-["_"] before:inline-block before:w-[1em] before:h-[1em] shrink-0'
|
|
2880
|
+
},
|
|
2881
|
+
variants: {
|
|
2882
|
+
size: {
|
|
2883
|
+
sm: {
|
|
2884
|
+
label: 'text-body-2xs'
|
|
2885
|
+
},
|
|
2886
|
+
md: '',
|
|
2887
|
+
lg: ''
|
|
2888
|
+
}
|
|
2889
|
+
},
|
|
2890
|
+
defaultVariants: {
|
|
2891
|
+
size: 'md'
|
|
2892
|
+
}
|
|
2893
|
+
});
|
|
2894
|
+
const formCheckbox = tv({
|
|
2895
|
+
extend: base,
|
|
2896
|
+
slots: {
|
|
2897
|
+
checkbox: ''
|
|
2898
|
+
}
|
|
2899
|
+
});
|
|
2900
|
+
const formRadio = tv({
|
|
2901
|
+
extend: base,
|
|
2902
|
+
slots: {
|
|
2903
|
+
radio: ''
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
const baseGroup = tv({
|
|
2907
|
+
slots: {
|
|
2908
|
+
base: '',
|
|
2909
|
+
label: 'pb-1 last:pb-0',
|
|
2910
|
+
hint: 'pb-1 last:pb-0',
|
|
2911
|
+
feedback: 'pt-0 flex-[1_100%]'
|
|
2912
|
+
},
|
|
2913
|
+
variants: {
|
|
2914
|
+
isInline: {
|
|
2915
|
+
true: {
|
|
2916
|
+
base: 'flex flex-wrap flex-row items-start',
|
|
2917
|
+
label: 'pr-4 pb-0',
|
|
2918
|
+
hint: 'pr-4 pb-0',
|
|
2919
|
+
feedback: 'pr-4 pb-0'
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
});
|
|
2924
|
+
const formCheckboxGroup = tv({
|
|
2925
|
+
extend: baseGroup,
|
|
2926
|
+
slots: {
|
|
2927
|
+
formCheckbox: 'pb-1 last:pb-0'
|
|
2928
|
+
},
|
|
2929
|
+
variants: {
|
|
2930
|
+
isInline: {
|
|
2931
|
+
true: {
|
|
2932
|
+
formCheckbox: 'pr-4 pb-0'
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
});
|
|
2937
|
+
const formRadioGroup = tv({
|
|
2938
|
+
extend: baseGroup,
|
|
2939
|
+
slots: {
|
|
2940
|
+
formRadio: 'pb-1 last:pb-0'
|
|
2941
|
+
},
|
|
2942
|
+
variants: {
|
|
2943
|
+
isInline: {
|
|
2944
|
+
true: {
|
|
2945
|
+
formRadio: 'pr-4 pb-0'
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
});
|
|
2950
|
+
const formInput = tv({
|
|
2951
|
+
slots: {
|
|
2952
|
+
base: 'flex flex-wrap flex-row',
|
|
2953
|
+
label: 'flex-[1_100%]',
|
|
2954
|
+
input: '',
|
|
2955
|
+
hint: 'flex-[1_100%]',
|
|
2956
|
+
feedback: 'flex-[1_100%]'
|
|
2957
|
+
},
|
|
2958
|
+
variants: {
|
|
2959
|
+
size: {
|
|
2960
|
+
sm: '',
|
|
2961
|
+
md: '',
|
|
2962
|
+
lg: ''
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2965
|
+
defaultVariants: {
|
|
2966
|
+
size: 'md'
|
|
2967
|
+
}
|
|
2968
|
+
});
|
|
2969
|
+
const formTextarea = tv({
|
|
2970
|
+
extend: formInput
|
|
2971
|
+
});
|
|
2972
|
+
const formSelect = tv({
|
|
2973
|
+
slots: {
|
|
2974
|
+
base: 'flex flex-wrap flex-row',
|
|
2975
|
+
label: 'flex-[1_100%]',
|
|
2976
|
+
select: '',
|
|
2977
|
+
hint: 'flex-[1_100%]',
|
|
2978
|
+
feedback: 'flex-[1_100%]'
|
|
2979
|
+
},
|
|
2980
|
+
variants: {
|
|
2981
|
+
size: {
|
|
2982
|
+
sm: '',
|
|
2983
|
+
md: '',
|
|
2984
|
+
lg: ''
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
defaultVariants: {
|
|
2988
|
+
size: 'md'
|
|
2989
|
+
}
|
|
2990
|
+
});
|
|
3
2991
|
|
|
4
2992
|
var components = /*#__PURE__*/Object.freeze({
|
|
5
2993
|
__proto__: null,
|
|
@@ -8,10 +2996,13 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
8
2996
|
backdrop: backdrop,
|
|
9
2997
|
button: button,
|
|
10
2998
|
buttonGroup: buttonGroup,
|
|
2999
|
+
buttonSpinner: buttonSpinner,
|
|
11
3000
|
checkbox: checkbox,
|
|
12
3001
|
checkboxGroup: checkboxGroup,
|
|
13
3002
|
chip: chip,
|
|
14
3003
|
closeButton: closeButton,
|
|
3004
|
+
command: command,
|
|
3005
|
+
commandDialog: commandDialog,
|
|
15
3006
|
divider: divider,
|
|
16
3007
|
drawer: drawer,
|
|
17
3008
|
dropdownContent: dropdownContent,
|
|
@@ -25,13 +3016,15 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
25
3016
|
formSelect: formSelect,
|
|
26
3017
|
formTextarea: formTextarea,
|
|
27
3018
|
input: input,
|
|
3019
|
+
inputOtp: inputOtp,
|
|
3020
|
+
kbd: kbd,
|
|
28
3021
|
label: label,
|
|
29
3022
|
listbox: listbox,
|
|
3023
|
+
listboxGroup: listboxGroup,
|
|
30
3024
|
listboxItem: listboxItem,
|
|
31
3025
|
modal: modal,
|
|
32
3026
|
nativeSelect: nativeSelect,
|
|
33
3027
|
notificationCard: notificationCard,
|
|
34
|
-
notificationTransitions: notificationTransitions,
|
|
35
3028
|
notificationsContainer: notificationsContainer,
|
|
36
3029
|
overlay: overlay,
|
|
37
3030
|
overlayTransitions: overlayTransitions,
|
|
@@ -39,11 +3032,13 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
39
3032
|
progressBar: progressBar,
|
|
40
3033
|
radio: radio,
|
|
41
3034
|
radioGroup: radioGroup,
|
|
3035
|
+
segmentedControl: segmentedControl,
|
|
42
3036
|
select: select,
|
|
43
3037
|
skeleton: skeleton,
|
|
44
3038
|
spinner: spinner,
|
|
45
3039
|
switchInput: switchInput,
|
|
46
3040
|
table: table,
|
|
3041
|
+
tabs: tabs,
|
|
47
3042
|
textarea: textarea,
|
|
48
3043
|
toggleButton: toggleButton
|
|
49
3044
|
});
|
|
@@ -59,5 +3054,5 @@ function useStyles() {
|
|
|
59
3054
|
return localStyles;
|
|
60
3055
|
}
|
|
61
3056
|
|
|
62
|
-
export { registerCustomStyles, useStyles };
|
|
3057
|
+
export { registerCustomStyles, tv, useStyles };
|
|
63
3058
|
//# sourceMappingURL=index.js.map
|