@frontile/theme 0.18.0-alpha.17 → 0.18.0-alpha.19
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/config.d.ts +2 -0
- package/declarations/colors/types.d.ts +30 -0
- package/declarations/components/accordion.d.ts +308 -0
- package/declarations/components/alert.d.ts +294 -0
- package/declarations/components/calendar.d.ts +382 -0
- package/declarations/components/external-link.d.ts +160 -0
- package/declarations/components/index.d.ts +6 -0
- package/declarations/components/listbox.d.ts +7 -4
- package/declarations/components/notification-card.d.ts +1 -1
- package/declarations/components/overlays.d.ts +348 -1
- package/declarations/components/pagination.d.ts +359 -0
- package/declarations/components/segmented-control.d.ts +1 -1
- package/declarations/components/shared.d.ts +9 -0
- package/declarations/components/table.d.ts +1 -1
- package/declarations/components/tabs.d.ts +1 -1
- package/declarations/components/tooltip.d.ts +270 -0
- package/declarations/plugin/default-config.d.ts +2 -0
- package/dist/colors.js +1 -1
- package/dist/index.js +833 -10
- package/dist/index.js.map +1 -1
- package/dist/overlays-BjN319OW.js +640 -0
- package/dist/overlays-BjN319OW.js.map +1 -0
- package/dist/plugin.js +12 -9
- package/dist/plugin.js.map +1 -1
- package/dist/{util-CHV5ZmrC.js → util-Dp_dlOPq.js} +3 -1
- package/dist/util-Dp_dlOPq.js.map +1 -0
- package/package.json +2 -2
- package/src/index.css +6 -2
- package/dist/overlays-aq0rSm6R.js +0 -372
- package/dist/overlays-aq0rSm6R.js.map +0 -1
- package/dist/util-CHV5ZmrC.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,321 @@
|
|
|
1
|
-
import { t as tv, b as backdrop, d as drawer, m as modal, o as overlay, a as overlayTransitions } from './overlays-
|
|
2
|
-
export {
|
|
1
|
+
import { t as tv, b as backdrop, d as drawer, m as modal, o as overlay, a as overlayArrow, c as overlayTransitions } from './overlays-BjN319OW.js';
|
|
2
|
+
export { e as twMerge } from './overlays-BjN319OW.js';
|
|
3
|
+
|
|
4
|
+
const focusVisibleRing = ['outline-hidden', 'focus-visible:z-10', 'focus-visible:ring-3', 'focus-visible:ring-focus', 'focus-visible:ring-offset-2', 'focus-visible:ring-offset-background'];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The close button sitting at the end of a status row — NotificationCard's
|
|
8
|
+
* and Alert's. It is the same affordance in both: a small round hit area,
|
|
9
|
+
* pulled into the row's padding, that reveals a surface tint on hover.
|
|
10
|
+
*
|
|
11
|
+
* Colour is deliberately absent, so this stays intent- and variant-neutral
|
|
12
|
+
* and each recipe keeps ownership of its own palette.
|
|
13
|
+
*/
|
|
14
|
+
const statusRowCloseButton = ['shrink-0 self-center -mr-1 inline-block p-1.5 rounded-full', 'transition duration-200', 'hover:bg-surface-overlay-soft', ...focusVisibleRing];
|
|
15
|
+
const focusVisibleWithinRing = ['outline-hidden', 'has-focus-visible:z-10', 'has-focus-visible:ring-3', 'has-[:focus-visible]:ring-focus', 'has-focus-visible:ring-offset-2', 'has-[:focus-visible]:ring-offset-background'];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `default` and `tonal` wear the same outer box. `tonal` carries its colour
|
|
19
|
+
* on the inner element instead (see its compound variants), so the two must
|
|
20
|
+
* stay identical out here — sharing the object keeps that structural rather
|
|
21
|
+
* than a thing a future edit has to remember.
|
|
22
|
+
*
|
|
23
|
+
* `text-neutral` (the DEFAULT level) is only ~3:1 against a light surface —
|
|
24
|
+
* below the 4.5:1 WCAG AA floor a description needs at this size.
|
|
25
|
+
* `text-neutral-firm` clears it against every surface this text can sit on,
|
|
26
|
+
* light or dark.
|
|
27
|
+
*/
|
|
28
|
+
const neutralSurface = {
|
|
29
|
+
base: 'bg-surface-modal border-surface-overlay-mild',
|
|
30
|
+
description: 'text-neutral-firm'
|
|
31
|
+
};
|
|
32
|
+
const alert = tv({
|
|
33
|
+
slots: {
|
|
34
|
+
// The outer element: box treatment only (surface, border, radius).
|
|
35
|
+
// No shadow and a tighter radius than `notificationCard` — an Alert
|
|
36
|
+
// sits in the page rather than floating over it, and no transition
|
|
37
|
+
// machinery or `stackPlacement`, which exist on the card only to serve
|
|
38
|
+
// the notification stack's geometry.
|
|
39
|
+
//
|
|
40
|
+
// `overflow-hidden` is not optional: this element owns the radius, but
|
|
41
|
+
// the `tonal` variant paints its tint on `inner` (it needs an opaque
|
|
42
|
+
// surface underneath — see that slot). `inner` has square corners, so
|
|
43
|
+
// without clipping here its tint paints over all four rounded corners
|
|
44
|
+
// and the alert reads as a rectangle.
|
|
45
|
+
base: 'w-full rounded-lg border overflow-hidden',
|
|
46
|
+
// The inner element carries the row layout. Alert has no
|
|
47
|
+
// ResizeObserver, so unlike the card it does not need this split for
|
|
48
|
+
// measurement — it needs it because the `tonal` variant's translucent
|
|
49
|
+
// `{intent}-soft` tint has to composite over an opaque surface. All
|
|
50
|
+
// three variants share the structure rather than branching the DOM.
|
|
51
|
+
inner: 'flex gap-3 p-4 font-body text-body-2xs',
|
|
52
|
+
// `inline-flex items-center justify-center` turns this slot into a
|
|
53
|
+
// fixed 20px centering box, and `[&>*]:size-full` forces whatever
|
|
54
|
+
// element lands inside it (default intent glyph, or arbitrary content
|
|
55
|
+
// yielded through the `icon` block, e.g. `<Spinner @size='sm' />`) to
|
|
56
|
+
// fill that box rather than render at its own intrinsic size. Without
|
|
57
|
+
// this, a yielded `Spinner` (`sm` = 24px) would overflow and
|
|
58
|
+
// misalign inside the 20px slot — see alert.md's "Icon" section.
|
|
59
|
+
// The trailing `!` marks the utility `!important` (Tailwind v4 syntax):
|
|
60
|
+
// `[&>*]:size-full` is equal specificity to whatever size utility the
|
|
61
|
+
// yielded component carries on itself (e.g. Spinner's own `w-6 h-6`), so
|
|
62
|
+
// without `!` which one wins is just Tailwind's emission order — it
|
|
63
|
+
// happens to work today but could flip on a Tailwind version bump or
|
|
64
|
+
// build change with no structural guarantee. `!` makes this clamp always
|
|
65
|
+
// win instead of relying on that ordering. Same pattern as
|
|
66
|
+
// `motion-reduce:transform-none!` in notification-card.ts.
|
|
67
|
+
icon: 'shrink-0 size-5 inline-flex items-center justify-center [&>*]:size-full!',
|
|
68
|
+
content: 'grow min-w-0 flex flex-col gap-1',
|
|
69
|
+
title: 'font-label text-label-xs',
|
|
70
|
+
description: 'text-body-2xs',
|
|
71
|
+
actions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
|
|
72
|
+
closeButton: statusRowCloseButton
|
|
73
|
+
},
|
|
74
|
+
variants: {
|
|
75
|
+
// Intent alone paints nothing; every colour comes from an intent ×
|
|
76
|
+
// variant compound below.
|
|
77
|
+
//
|
|
78
|
+
// The other half of an intent lives in the component: `INTENT_CONFIG` in
|
|
79
|
+
// alert.gts maps it to a glyph and an ARIA role. Adding an intent means
|
|
80
|
+
// adding it in both places — this list plus its three compound variants
|
|
81
|
+
// here, and a row there.
|
|
82
|
+
intent: {
|
|
83
|
+
default: {},
|
|
84
|
+
info: {},
|
|
85
|
+
success: {},
|
|
86
|
+
warning: {},
|
|
87
|
+
danger: {}
|
|
88
|
+
},
|
|
89
|
+
variant: {
|
|
90
|
+
default: neutralSurface,
|
|
91
|
+
// Intent-independent out here: every `tonal` compound below tints the
|
|
92
|
+
// *inner* element instead, so the outer box is `default`'s.
|
|
93
|
+
tonal: neutralSurface,
|
|
94
|
+
solid: {
|
|
95
|
+
base: 'border-transparent'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
// Shape and alignment, independent of the colour `variant` above.
|
|
99
|
+
//
|
|
100
|
+
// `banner` is a full-bleed announcement bar spanning its container: no
|
|
101
|
+
// radius, no border, content centred. Width is not part of it — `base`
|
|
102
|
+
// is already `w-full`, so an Alert fills its container either way.
|
|
103
|
+
layout: {
|
|
104
|
+
inline: {},
|
|
105
|
+
banner: {
|
|
106
|
+
// `relative` is the positioning context for the pinned close button
|
|
107
|
+
// below. `rounded-none` and `border-0` beat the base slot's
|
|
108
|
+
// `rounded-lg` and `border` through tailwind-merge.
|
|
109
|
+
base: 'relative rounded-none border-0',
|
|
110
|
+
inner: 'justify-center',
|
|
111
|
+
// `grow-0` is what actually centres the row. `content`'s `grow` is
|
|
112
|
+
// what pins the text left and pushes trailing items right, so
|
|
113
|
+
// without dropping it `justify-center` has no free space to
|
|
114
|
+
// distribute and silently does nothing.
|
|
115
|
+
content: 'grow-0 text-center',
|
|
116
|
+
// Out of the flex flow entirely, so the text stays centred on the
|
|
117
|
+
// full banner whether or not the alert is dismissible — a
|
|
118
|
+
// dismissible and a non-dismissible banner stacked together line up.
|
|
119
|
+
// `mr-0` cancels the inline layout's `-mr-1`, which would otherwise
|
|
120
|
+
// pull the pinned button past the edge.
|
|
121
|
+
closeButton: 'absolute right-3 top-1/2 -translate-y-1/2 mr-0'
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
// With a description the icon centres on the *title's* line box rather
|
|
125
|
+
// than on the whole (now multi-line) row, hence the negative offset.
|
|
126
|
+
hasDescription: {
|
|
127
|
+
true: {
|
|
128
|
+
inner: 'items-start',
|
|
129
|
+
icon: 'mt-[calc((var(--text-label-xs)*var(--line-height-tight)-1.25rem)/2)]'
|
|
130
|
+
},
|
|
131
|
+
false: {
|
|
132
|
+
inner: 'items-center'
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// Paints nothing alone — it only matters combined with `layout: 'banner'`
|
|
136
|
+
// below, where a present close button needs room reserved for it.
|
|
137
|
+
hasCloseButton: {
|
|
138
|
+
true: {},
|
|
139
|
+
false: {}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
compoundVariants: [
|
|
143
|
+
// default: neutral surface, colour carried by the icon and title.
|
|
144
|
+
// The `default` intent has no accent colour to lend the title emphasis,
|
|
145
|
+
// so the title earns its prominence from weight of ink instead, sitting
|
|
146
|
+
// a level above the icon.
|
|
147
|
+
{
|
|
148
|
+
variant: 'default',
|
|
149
|
+
intent: 'default',
|
|
150
|
+
class: {
|
|
151
|
+
icon: 'text-neutral-firm',
|
|
152
|
+
title: 'text-neutral-bolder'
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
variant: 'default',
|
|
156
|
+
intent: 'info',
|
|
157
|
+
class: {
|
|
158
|
+
icon: 'text-primary',
|
|
159
|
+
title: 'text-primary'
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
// `success-firm` is only ~2.3:1 on a light surface; `bolder` clears
|
|
163
|
+
// AA in both themes. Same measurement the card's theme records.
|
|
164
|
+
variant: 'default',
|
|
165
|
+
intent: 'success',
|
|
166
|
+
class: {
|
|
167
|
+
icon: 'text-success-bolder',
|
|
168
|
+
title: 'text-success-bolder'
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
// `warning-firm` is only ~3:1 on a light surface; `bolder` clears AA
|
|
172
|
+
// in both themes.
|
|
173
|
+
variant: 'default',
|
|
174
|
+
intent: 'warning',
|
|
175
|
+
class: {
|
|
176
|
+
icon: 'text-warning-bolder',
|
|
177
|
+
title: 'text-warning-bolder'
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
variant: 'default',
|
|
181
|
+
intent: 'danger',
|
|
182
|
+
class: {
|
|
183
|
+
icon: 'text-danger-firm',
|
|
184
|
+
title: 'text-danger-firm'
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
// tonal: an opaque outer surface with the translucent `{intent}-soft`
|
|
188
|
+
// tint and its `on-*` contrast ink applied to the inner element, which
|
|
189
|
+
// composites over that opaque surface. Same recipe as Button's
|
|
190
|
+
// `appearance: 'tonal'` and NotificationCard's.
|
|
191
|
+
{
|
|
192
|
+
variant: 'tonal',
|
|
193
|
+
intent: 'default',
|
|
194
|
+
class: {
|
|
195
|
+
inner: 'bg-neutral-soft',
|
|
196
|
+
icon: 'text-on-neutral-soft',
|
|
197
|
+
title: 'text-on-neutral-soft'
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
variant: 'tonal',
|
|
201
|
+
intent: 'info',
|
|
202
|
+
class: {
|
|
203
|
+
inner: 'bg-primary-soft',
|
|
204
|
+
icon: 'text-on-primary-soft',
|
|
205
|
+
title: 'text-on-primary-soft'
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
variant: 'tonal',
|
|
209
|
+
intent: 'success',
|
|
210
|
+
class: {
|
|
211
|
+
inner: 'bg-success-soft',
|
|
212
|
+
icon: 'text-on-success-soft',
|
|
213
|
+
title: 'text-on-success-soft'
|
|
214
|
+
}
|
|
215
|
+
}, {
|
|
216
|
+
variant: 'tonal',
|
|
217
|
+
intent: 'warning',
|
|
218
|
+
class: {
|
|
219
|
+
inner: 'bg-warning-soft',
|
|
220
|
+
icon: 'text-on-warning-soft',
|
|
221
|
+
title: 'text-on-warning-soft'
|
|
222
|
+
}
|
|
223
|
+
}, {
|
|
224
|
+
variant: 'tonal',
|
|
225
|
+
intent: 'danger',
|
|
226
|
+
class: {
|
|
227
|
+
inner: 'bg-danger-soft',
|
|
228
|
+
icon: 'text-on-danger-soft',
|
|
229
|
+
title: 'text-on-danger-soft'
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
// solid: filled surface, contrast ink. The description uses the
|
|
233
|
+
// full-strength `on-{intent}` ink rather than a translucent cut — a
|
|
234
|
+
// translucent cut failed WCAG AA in the equivalent card recipe.
|
|
235
|
+
{
|
|
236
|
+
variant: 'solid',
|
|
237
|
+
intent: 'default',
|
|
238
|
+
class: {
|
|
239
|
+
base: 'bg-neutral text-on-neutral',
|
|
240
|
+
icon: 'text-on-neutral',
|
|
241
|
+
title: 'text-on-neutral',
|
|
242
|
+
description: 'text-on-neutral'
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
variant: 'solid',
|
|
246
|
+
intent: 'info',
|
|
247
|
+
class: {
|
|
248
|
+
base: 'bg-primary text-on-primary',
|
|
249
|
+
icon: 'text-on-primary',
|
|
250
|
+
title: 'text-on-primary',
|
|
251
|
+
description: 'text-on-primary'
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
variant: 'solid',
|
|
255
|
+
intent: 'success',
|
|
256
|
+
class: {
|
|
257
|
+
base: 'bg-success text-on-success',
|
|
258
|
+
icon: 'text-on-success',
|
|
259
|
+
title: 'text-on-success',
|
|
260
|
+
description: 'text-on-success'
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
variant: 'solid',
|
|
264
|
+
intent: 'warning',
|
|
265
|
+
class: {
|
|
266
|
+
base: 'bg-warning text-on-warning',
|
|
267
|
+
icon: 'text-on-warning',
|
|
268
|
+
title: 'text-on-warning',
|
|
269
|
+
description: 'text-on-warning'
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
variant: 'solid',
|
|
273
|
+
intent: 'danger',
|
|
274
|
+
class: {
|
|
275
|
+
base: 'bg-danger text-on-danger',
|
|
276
|
+
icon: 'text-on-danger',
|
|
277
|
+
title: 'text-on-danger',
|
|
278
|
+
description: 'text-on-danger'
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
// A banner centres its text, so the inline layout's top-aligned icon and
|
|
282
|
+
// its calculated negative offset (see the `hasDescription` variant) read
|
|
283
|
+
// as misaligned. Centre the row instead, whether or not it wraps.
|
|
284
|
+
{
|
|
285
|
+
layout: 'banner',
|
|
286
|
+
hasDescription: true,
|
|
287
|
+
class: {
|
|
288
|
+
inner: 'items-center',
|
|
289
|
+
icon: 'mt-0'
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
// The pinned close button (see `layout.banner.closeButton` above) sits
|
|
293
|
+
// outside the flex flow, so nothing about the row's own layout makes
|
|
294
|
+
// room for it — a centred, wrapping title can run underneath it. Reserve
|
|
295
|
+
// space on both sides rather than only the trailing edge: the button is
|
|
296
|
+
// 28px wide starting 12px from the edge (occupying the outer 40px),
|
|
297
|
+
// `px-11` (44px) clears it with a little breathing room, and doing it
|
|
298
|
+
// symmetrically keeps the centring axis at the banner's true centre —
|
|
299
|
+
// padding only on the right would clear the button but drag the text off
|
|
300
|
+
// centre, undoing the reason the button is pinned in the first place.
|
|
301
|
+
// `px-11` only touches the horizontal axis, so `inner`'s vertical `p-4`
|
|
302
|
+
// is untouched. Conditional on `hasCloseButton` so a non-dismissible
|
|
303
|
+
// banner keeps using its full width.
|
|
304
|
+
{
|
|
305
|
+
layout: 'banner',
|
|
306
|
+
hasCloseButton: true,
|
|
307
|
+
class: {
|
|
308
|
+
inner: 'px-11'
|
|
309
|
+
}
|
|
310
|
+
}],
|
|
311
|
+
defaultVariants: {
|
|
312
|
+
intent: 'default',
|
|
313
|
+
variant: 'default',
|
|
314
|
+
layout: 'inline',
|
|
315
|
+
hasDescription: false,
|
|
316
|
+
hasCloseButton: false
|
|
317
|
+
}
|
|
318
|
+
});
|
|
3
319
|
|
|
4
320
|
const avatar = tv({
|
|
5
321
|
slots: {
|
|
@@ -36,9 +352,6 @@ const avatar = tv({
|
|
|
36
352
|
}
|
|
37
353
|
});
|
|
38
354
|
|
|
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
355
|
const baseButton = tv({
|
|
43
356
|
base: ['inline-flex items-center justify-center', '[&_svg]:size-[1em]', 'font-header', 'border', 'border-transparent', 'disabled:cursor-not-allowed', 'disabled:opacity-disabled', ...focusVisibleRing],
|
|
44
357
|
variants: {
|
|
@@ -1017,7 +1330,12 @@ const listboxItem = tv({
|
|
|
1017
1330
|
descriptionWrapper: 'w-full flex flex-col items-start justify-center',
|
|
1018
1331
|
label: 'flex-1 font-body text-body-2xs truncate',
|
|
1019
1332
|
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']
|
|
1333
|
+
selectedIcon: ['text-inherit', 'w-4', 'h-4', 'shrink-0'],
|
|
1334
|
+
// The chevron on a row that opens a submenu. Sized like `selectedIcon`
|
|
1335
|
+
// -- both are trailing affordances on the same row -- but dimmer at rest,
|
|
1336
|
+
// since it marks a direction rather than a state. `text-inherit` on the
|
|
1337
|
+
// active row lets it pick up the row's own colour.
|
|
1338
|
+
submenuIndicator: ['text-neutral-firm', 'group-data-is-active:text-inherit', 'w-4', 'h-4', 'shrink-0']
|
|
1021
1339
|
},
|
|
1022
1340
|
variants: {
|
|
1023
1341
|
appearance: {
|
|
@@ -1246,6 +1564,50 @@ const divider = tv({
|
|
|
1246
1564
|
}
|
|
1247
1565
|
});
|
|
1248
1566
|
|
|
1567
|
+
const externalLink = tv({
|
|
1568
|
+
slots: {
|
|
1569
|
+
// `inline`, not `inline-flex`. An external link's home is running text, and
|
|
1570
|
+
// `inline-flex` would make the whole anchor an atomic inline-block that
|
|
1571
|
+
// refuses to break across lines mid-phrase.
|
|
1572
|
+
//
|
|
1573
|
+
// No colour: `text-current` inherits from whatever the link sits in, so
|
|
1574
|
+
// there is no `intent` variant to keep in sync. `decoration-current/40`
|
|
1575
|
+
// gives the rule a lighter weight than the text without naming a palette.
|
|
1576
|
+
base: ['inline text-current', 'decoration-current/40 underline-offset-2', 'hover:decoration-current', 'transition-colors duration-150', 'rounded-sm', ...focusVisibleRing],
|
|
1577
|
+
// A wrapper rather than the `<svg>` itself, so the `:icon` block gets the
|
|
1578
|
+
// same sizing and spacing as the built-in glyph. `size-[1em]` tracks the
|
|
1579
|
+
// inherited font size, which is why the component needs no size scale.
|
|
1580
|
+
// `align-[-0.125em]` seats it on the text baseline instead of hanging it
|
|
1581
|
+
// from the line box.
|
|
1582
|
+
icon: ['inline-flex items-center justify-center size-[1em] shrink-0', 'align-[-0.125em]', '[&>svg]:size-full']
|
|
1583
|
+
},
|
|
1584
|
+
variants: {
|
|
1585
|
+
underline: {
|
|
1586
|
+
always: {
|
|
1587
|
+
base: 'underline'
|
|
1588
|
+
},
|
|
1589
|
+
hover: {
|
|
1590
|
+
base: 'no-underline hover:underline'
|
|
1591
|
+
},
|
|
1592
|
+
none: {
|
|
1593
|
+
base: 'no-underline hover:no-underline'
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
iconPlacement: {
|
|
1597
|
+
start: {
|
|
1598
|
+
icon: 'mr-0.5'
|
|
1599
|
+
},
|
|
1600
|
+
end: {
|
|
1601
|
+
icon: 'ml-0.5'
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
defaultVariants: {
|
|
1606
|
+
underline: 'always',
|
|
1607
|
+
iconPlacement: 'end'
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
|
|
1249
1611
|
// Border-radius lives ONLY in the `shape` variants, never in `base`. Frontile's
|
|
1250
1612
|
// `rounded-default` is a custom value that tailwind-merge does not recognise as
|
|
1251
1613
|
// part of the `rounded` group, so a base radius would survive alongside a
|
|
@@ -1974,14 +2336,21 @@ const tabs = tv({
|
|
|
1974
2336
|
variant: 'underline',
|
|
1975
2337
|
orientation: 'horizontal',
|
|
1976
2338
|
class: {
|
|
1977
|
-
|
|
2339
|
+
// `pb-2` is what separates the labels from the rule, and it belongs on
|
|
2340
|
+
// the list rather than as a margin on each tab: an absolutely
|
|
2341
|
+
// positioned box resolves its offsets against the padding box, so the
|
|
2342
|
+
// bar stays welded to the rule at `bottom-0` while the padding pushes
|
|
2343
|
+
// the tabs -- and with them their hover chips -- clear of it. A chip
|
|
2344
|
+
// that runs into the rule is the thing this buys off.
|
|
2345
|
+
list: 'gap-1 pb-2 border-b border-neutral-mild dark:border-neutral-soft',
|
|
1978
2346
|
indicator: ['top-auto bottom-0 h-0.5 rounded-full', 'w-[var(--fr-si-width)]', 'translate-x-[var(--fr-si-x)]']
|
|
1979
2347
|
}
|
|
1980
2348
|
}, {
|
|
1981
2349
|
variant: 'underline',
|
|
1982
2350
|
orientation: 'vertical',
|
|
1983
2351
|
class: {
|
|
1984
|
-
|
|
2352
|
+
// The same gap, on the axis this orientation puts the rule on.
|
|
2353
|
+
list: 'gap-1 ps-2 border-l border-neutral-mild dark:border-neutral-soft',
|
|
1985
2354
|
indicator: ['left-0 w-0.5 rounded-full', 'h-[var(--fr-si-height)]', 'translate-y-[var(--fr-si-y)]']
|
|
1986
2355
|
}
|
|
1987
2356
|
}],
|
|
@@ -1993,6 +2362,453 @@ const tabs = tv({
|
|
|
1993
2362
|
}
|
|
1994
2363
|
});
|
|
1995
2364
|
|
|
2365
|
+
const accordion = tv({
|
|
2366
|
+
slots: {
|
|
2367
|
+
base: 'flex flex-col',
|
|
2368
|
+
// Carries `group/accordion-item` plus `data-open`, which is what lets the
|
|
2369
|
+
// indicator rotate without the component pushing a class. The group name
|
|
2370
|
+
// is written literally: Tailwind generates nothing from a composed string.
|
|
2371
|
+
item: 'group/accordion-item',
|
|
2372
|
+
heading: 'flex',
|
|
2373
|
+
trigger: [...focusVisibleRing, 'flex flex-1 items-center text-start', 'w-full cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'text-neutral-bolder',
|
|
2374
|
+
// "Not disabled" is `not-data-[disabled=true]`, not
|
|
2375
|
+
// `data-[disabled=false]`: an attribute-value selector cannot match an
|
|
2376
|
+
// element that never declares the attribute.
|
|
2377
|
+
'not-data-[disabled=true]:hover:text-neutral-strong', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
|
|
2378
|
+
startContent: 'flex shrink-0 items-center',
|
|
2379
|
+
titleWrapper: 'flex flex-1 flex-col text-start',
|
|
2380
|
+
title: '',
|
|
2381
|
+
subtitle: 'text-neutral-firm',
|
|
2382
|
+
indicator: ['shrink-0', 'transition-transform duration-200 motion-reduce:transition-none', 'group-data-[open=true]/accordion-item:rotate-180'],
|
|
2383
|
+
// The animated element. It must never carry padding: padding on the
|
|
2384
|
+
// animating box means the collapsed height can never reach 0.
|
|
2385
|
+
content: 'text-neutral-firm',
|
|
2386
|
+
// Where the panel's padding actually lives.
|
|
2387
|
+
contentBody: ''
|
|
2388
|
+
},
|
|
2389
|
+
variants: {
|
|
2390
|
+
variant: {
|
|
2391
|
+
// No chrome at all.
|
|
2392
|
+
ghost: {},
|
|
2393
|
+
// Rules between items, none after the last.
|
|
2394
|
+
outlined: {
|
|
2395
|
+
item: 'border-b border-neutral-muted last:border-b-0'
|
|
2396
|
+
},
|
|
2397
|
+
// A soft fill on the open item. Horizontal padding comes with the
|
|
2398
|
+
// surface -- text running to the edge of a tinted box reads as a bug.
|
|
2399
|
+
faded: {
|
|
2400
|
+
item: 'rounded-lg data-[open=true]:bg-surface-overlay-soft',
|
|
2401
|
+
trigger: 'px-3',
|
|
2402
|
+
contentBody: 'px-3'
|
|
2403
|
+
},
|
|
2404
|
+
// One bordered surface around the whole group.
|
|
2405
|
+
enclosed: {
|
|
2406
|
+
base: 'overflow-hidden rounded-lg border border-neutral-muted',
|
|
2407
|
+
item: 'border-b border-neutral-muted last:border-b-0',
|
|
2408
|
+
trigger: 'px-4',
|
|
2409
|
+
contentBody: 'px-4'
|
|
2410
|
+
}
|
|
2411
|
+
},
|
|
2412
|
+
size: {
|
|
2413
|
+
// Typography sits on `trigger`, not on `title`, and that placement is
|
|
2414
|
+
// load-bearing: the trigger renders inside a real `<h3>` (or whatever
|
|
2415
|
+
// `@headingLevel` says), so a host page's heading styles -- large, bold,
|
|
2416
|
+
// tight tracking -- would otherwise be inherited by everything in the
|
|
2417
|
+
// header row that does not set its own size: `startContent`, the
|
|
2418
|
+
// indicator, and any custom `<:title>` content. The class on the trigger
|
|
2419
|
+
// is the baseline that neutralises that; `subtitle` then refines it, and
|
|
2420
|
+
// `@classes.title` still wins on the title element itself.
|
|
2421
|
+
//
|
|
2422
|
+
// `text-label-*` (semibold, default tracking) rather than `text-strong-*`
|
|
2423
|
+
// (bold, tight): an accordion header is a label on a row, not a section
|
|
2424
|
+
// heading. It matches the panel body's size at every step and lets weight
|
|
2425
|
+
// alone do the separating, which is how the reference implementations
|
|
2426
|
+
// read.
|
|
2427
|
+
sm: {
|
|
2428
|
+
trigger: 'gap-2 py-2 text-label-xs',
|
|
2429
|
+
subtitle: 'text-body-2xs',
|
|
2430
|
+
indicator: 'size-4',
|
|
2431
|
+
contentBody: 'pb-2 text-body-sm'
|
|
2432
|
+
},
|
|
2433
|
+
md: {
|
|
2434
|
+
trigger: 'gap-3 py-3 text-label-sm',
|
|
2435
|
+
subtitle: 'text-body-xs',
|
|
2436
|
+
indicator: 'size-5',
|
|
2437
|
+
contentBody: 'pb-3 text-body-md'
|
|
2438
|
+
},
|
|
2439
|
+
lg: {
|
|
2440
|
+
trigger: 'gap-3 py-4 text-label-md',
|
|
2441
|
+
subtitle: 'text-body-sm',
|
|
2442
|
+
indicator: 'size-6',
|
|
2443
|
+
contentBody: 'pb-4 text-body-lg'
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
isDisabled: {
|
|
2447
|
+
true: {
|
|
2448
|
+
base: 'opacity-disabled',
|
|
2449
|
+
trigger: 'pointer-events-none'
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
},
|
|
2453
|
+
defaultVariants: {
|
|
2454
|
+
variant: 'outlined',
|
|
2455
|
+
size: 'md'
|
|
2456
|
+
}
|
|
2457
|
+
});
|
|
2458
|
+
|
|
2459
|
+
const calendar = tv({
|
|
2460
|
+
slots: {
|
|
2461
|
+
base: [
|
|
2462
|
+
// `isolate` keeps every z-index the calendar uses inside the calendar.
|
|
2463
|
+
// The shared focus ring raises a focused control to `z-10`; without a
|
|
2464
|
+
// stacking context here that lands in the page's own stacking order and
|
|
2465
|
+
// paints over a site header.
|
|
2466
|
+
'isolate inline-flex flex-col gap-3 p-3',
|
|
2467
|
+
// The two knobs that let a consumer resize cells and reshape them
|
|
2468
|
+
// without any new API. `--calendar-cell-radius` is how a `<:day>` block
|
|
2469
|
+
// with custom content escapes the circle.
|
|
2470
|
+
'[--calendar-cell-size:2.5rem]', '[--calendar-cell-radius:9999px]'],
|
|
2471
|
+
// Header, year panel and month grids share one column sized to the grids
|
|
2472
|
+
// themselves. Without this the header stretches to the width of the
|
|
2473
|
+
// widest sibling -- a `<:footer>` of preset buttons, say -- and the prev
|
|
2474
|
+
// and next arrows drift away from the days they page.
|
|
2475
|
+
body: 'flex flex-col gap-3 w-fit',
|
|
2476
|
+
header: 'flex items-center justify-between gap-2',
|
|
2477
|
+
// `label-sm` is 1rem, which reads as heavy as a heading next to 14px day
|
|
2478
|
+
// numbers; `label-xs` is the 14px the caption wants.
|
|
2479
|
+
title: 'text-label-xs text-neutral-bolder',
|
|
2480
|
+
nav: 'flex items-center gap-1',
|
|
2481
|
+
// A native `<select>` sizes itself to its *widest* option, so the caption
|
|
2482
|
+
// would sit at "September" width even in May. Instead the visible label is
|
|
2483
|
+
// a span that sizes to the current month, with a transparent full-size
|
|
2484
|
+
// `<select>` laid over it -- the control stays native for the keyboard and
|
|
2485
|
+
// for assistive tech, but no longer dictates the width, and its built-in
|
|
2486
|
+
// arrow (which cannot be spaced) is replaced by our own chevron.
|
|
2487
|
+
monthSelectWrapper: [...focusVisibleWithinRing, 'relative inline-flex items-center gap-1', 'rounded-full px-2 py-1 cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'hover:bg-surface-overlay-soft'],
|
|
2488
|
+
monthSelectValue: 'text-label-xs text-neutral-bolder',
|
|
2489
|
+
monthSelect: 'absolute inset-0 w-full opacity-0 cursor-pointer',
|
|
2490
|
+
monthSelectIcon: 'pointer-events-none size-3.5 shrink-0 text-neutral-firm',
|
|
2491
|
+
// Its own slot rather than `navButton`: that one is a fixed square sized
|
|
2492
|
+
// for a chevron, which would clip a four-digit year.
|
|
2493
|
+
yearTrigger: [...focusVisibleRing, 'inline-flex items-center gap-1', 'rounded-full px-2 py-1 cursor-pointer', 'text-label-xs text-neutral-bolder', 'transition-colors duration-200 motion-reduce:transition-none', 'hover:bg-surface-overlay-soft'],
|
|
2494
|
+
navButton: [...focusVisibleRing, 'inline-flex items-center justify-center', 'size-8 rounded-full',
|
|
2495
|
+
// The chevron inside is sized here rather than on the icon, so the
|
|
2496
|
+
// button stays the hit area and the glyph stays optically balanced
|
|
2497
|
+
// against the caption.
|
|
2498
|
+
'[&_svg]:size-4', 'text-neutral-firm cursor-pointer', 'transition-colors duration-200 motion-reduce:transition-none', 'not-data-[disabled=true]:hover:bg-surface-overlay-soft', 'not-data-[disabled=true]:hover:text-neutral-bolder', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-disabled'],
|
|
2499
|
+
// Centered because the calendar is only ever as wide as its widest part:
|
|
2500
|
+
// a `<:header>` block wider than the grid (long month names, extra
|
|
2501
|
+
// controls) stretches the component, and the months would otherwise sit
|
|
2502
|
+
// flush left under it. A no-op whenever the grid is the widest part.
|
|
2503
|
+
monthsWrapper: 'flex justify-center gap-4',
|
|
2504
|
+
monthGrid: 'border-collapse',
|
|
2505
|
+
weekdaysRow: '',
|
|
2506
|
+
// `caption-2xs` does not exist in the type scale -- the smallest caption
|
|
2507
|
+
// is `caption-sm` -- so the old value generated nothing and these labels
|
|
2508
|
+
// inherited 16px, rendering *larger* than the day numbers beneath them.
|
|
2509
|
+
// The row is also shorter than a day row: it is a label, not a cell.
|
|
2510
|
+
weekday: ['text-caption-sm text-neutral font-normal', 'h-8 w-[var(--calendar-cell-size)]', 'text-center align-middle'],
|
|
2511
|
+
week: '',
|
|
2512
|
+
// The positioning context for `cellBand`. No padding: the band has to
|
|
2513
|
+
// reach the cell edges for adjacent bands to touch.
|
|
2514
|
+
cell: ['relative p-0 text-center', 'size-[var(--calendar-cell-size)]'],
|
|
2515
|
+
// The continuous range ribbon, behind the day. Absolutely positioned and
|
|
2516
|
+
// filling the whole cell, which is what removes the gap between days.
|
|
2517
|
+
// No z-index: the band is painted before the day in document order, and
|
|
2518
|
+
// between two positioned elements with auto z-index document order already
|
|
2519
|
+
// decides. Giving the day a positive index instead let it escape into the
|
|
2520
|
+
// page and paint over a host site's header.
|
|
2521
|
+
cellBand: ['absolute inset-0 pointer-events-none',
|
|
2522
|
+
// The band fills the whole cell so adjacent bands touch, but at the two
|
|
2523
|
+
// ends of a range it must stop under the endpoint's circle rather than
|
|
2524
|
+
// running past it into empty grid. Clipping to half width leaves the
|
|
2525
|
+
// ribbon meeting the fill and going no further.
|
|
2526
|
+
'data-[range-start=true]:start-1/2', 'data-[range-end=true]:end-1/2',
|
|
2527
|
+
// A single-day range is both ends at once: nothing to connect, so no
|
|
2528
|
+
// band at all.
|
|
2529
|
+
'data-[range-start=true]:data-[range-end=true]:hidden',
|
|
2530
|
+
// The pending preview is the same ribbon, quieter -- it shows where the
|
|
2531
|
+
// range *would* land, not where it is.
|
|
2532
|
+
'data-[preview=true]:opacity-60'],
|
|
2533
|
+
day: [...focusVisibleRing,
|
|
2534
|
+
// `relative` is the positioning context for the today dot. Deliberately
|
|
2535
|
+
// no z-index -- see `cellBand`.
|
|
2536
|
+
'relative', 'inline-flex items-center justify-center', 'size-[calc(var(--calendar-cell-size)-0.25rem)]', 'rounded-[var(--calendar-cell-radius)]', 'text-body-sm text-neutral-strong', 'cursor-pointer select-none', 'transition-colors duration-200 motion-reduce:transition-none',
|
|
2537
|
+
// Selected days are excluded here and get their own hover per intent.
|
|
2538
|
+
// Without the exclusion this rule wins on specificity -- it carries an
|
|
2539
|
+
// extra `:hover` over the intent's plain `data-[selected=true]` -- so
|
|
2540
|
+
// hovering the selected day replaced its fill with a grey overlay and
|
|
2541
|
+
// made it look deselected.
|
|
2542
|
+
'not-data-[disabled=true]:not-data-[selected=true]:hover:bg-surface-overlay-soft', 'data-[outside=true]:text-neutral-mild', 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:text-neutral-mild', 'data-[unavailable=true]:line-through data-[unavailable=true]:cursor-not-allowed', 'data-[unavailable=true]:hover:bg-transparent'],
|
|
2543
|
+
// Wraps default *and* `<:day>` content, so a block that renders more than
|
|
2544
|
+
// a numeral -- a price, an event count -- stacks and centres without
|
|
2545
|
+
// having to rebuild this layout itself.
|
|
2546
|
+
dayContent: 'flex flex-col items-center justify-center leading-none overflow-hidden',
|
|
2547
|
+
// Sits below the grids, outside the column that sizes to them, so wide
|
|
2548
|
+
// content here wraps instead of stretching the header.
|
|
2549
|
+
footer: 'flex flex-wrap items-center gap-2 pt-1',
|
|
2550
|
+
// The today marker: a dot under the numeral rather than a ring, which
|
|
2551
|
+
// would compete with the selected fill.
|
|
2552
|
+
indicator: 'absolute bottom-1 size-1 rounded-full bg-current opacity-70',
|
|
2553
|
+
// The year panel stands in for the day grid rather than sitting above it,
|
|
2554
|
+
// so it is sized to the grid it replaces: seven cells wide, six tall. The
|
|
2555
|
+
// year list is long by design (a century back, for dates of birth), which
|
|
2556
|
+
// is exactly why it has to scroll inside that box instead of growing the
|
|
2557
|
+
// component to the height of its longest possible list.
|
|
2558
|
+
yearGrid: [
|
|
2559
|
+
// Positioned so the year buttons measure their `offsetTop` against the
|
|
2560
|
+
// panel: the component scrolls the selected year into view itself,
|
|
2561
|
+
// rather than letting `scrollIntoView` drag the whole page with it.
|
|
2562
|
+
'relative grid grid-cols-3 gap-1', 'w-[calc(var(--calendar-cell-size)*7)]', 'max-h-[calc(var(--calendar-cell-size)*6)] overflow-y-auto', 'overscroll-contain'],
|
|
2563
|
+
yearCell: [...focusVisibleRing, 'rounded-full px-3 py-2 text-body-sm cursor-pointer', 'hover:bg-surface-overlay-soft', 'data-[selected=true]:bg-surface-overlay-soft data-[selected=true]:font-medium']
|
|
2564
|
+
},
|
|
2565
|
+
variants: {
|
|
2566
|
+
intent: {
|
|
2567
|
+
default: {
|
|
2568
|
+
day: 'data-[selected=true]:bg-neutral-strong data-[selected=true]:text-on-neutral-strong data-[selected=true]:hover:bg-neutral-bolder',
|
|
2569
|
+
cellBand: 'data-[in-range=true]:bg-neutral-soft'
|
|
2570
|
+
},
|
|
2571
|
+
primary: {
|
|
2572
|
+
day: 'data-[selected=true]:bg-primary data-[selected=true]:text-on-primary data-[selected=true]:hover:bg-primary-firm',
|
|
2573
|
+
cellBand: 'data-[in-range=true]:bg-primary-soft'
|
|
2574
|
+
},
|
|
2575
|
+
secondary: {
|
|
2576
|
+
day: 'data-[selected=true]:bg-secondary data-[selected=true]:text-on-secondary data-[selected=true]:hover:bg-secondary-firm',
|
|
2577
|
+
cellBand: 'data-[in-range=true]:bg-secondary-soft'
|
|
2578
|
+
},
|
|
2579
|
+
tertiary: {
|
|
2580
|
+
day: 'data-[selected=true]:bg-tertiary data-[selected=true]:text-on-tertiary data-[selected=true]:hover:bg-tertiary-firm',
|
|
2581
|
+
cellBand: 'data-[in-range=true]:bg-tertiary-soft'
|
|
2582
|
+
},
|
|
2583
|
+
success: {
|
|
2584
|
+
day: 'data-[selected=true]:bg-success data-[selected=true]:text-on-success data-[selected=true]:hover:bg-success-firm',
|
|
2585
|
+
cellBand: 'data-[in-range=true]:bg-success-soft'
|
|
2586
|
+
},
|
|
2587
|
+
warning: {
|
|
2588
|
+
day: 'data-[selected=true]:bg-warning data-[selected=true]:text-on-warning data-[selected=true]:hover:bg-warning-firm',
|
|
2589
|
+
cellBand: 'data-[in-range=true]:bg-warning-soft'
|
|
2590
|
+
},
|
|
2591
|
+
danger: {
|
|
2592
|
+
day: 'data-[selected=true]:bg-danger data-[selected=true]:text-on-danger data-[selected=true]:hover:bg-danger-firm',
|
|
2593
|
+
cellBand: 'data-[in-range=true]:bg-danger-soft'
|
|
2594
|
+
}
|
|
2595
|
+
},
|
|
2596
|
+
size: {
|
|
2597
|
+
sm: {
|
|
2598
|
+
base: 'p-2 [--calendar-cell-size:2.25rem]',
|
|
2599
|
+
title: 'text-label-2xs',
|
|
2600
|
+
navButton: 'size-7 [&_svg]:size-3.5'
|
|
2601
|
+
},
|
|
2602
|
+
md: {
|
|
2603
|
+
base: '[--calendar-cell-size:2.5rem]'
|
|
2604
|
+
},
|
|
2605
|
+
lg: {
|
|
2606
|
+
base: 'p-4 [--calendar-cell-size:3rem]',
|
|
2607
|
+
title: 'text-label-sm',
|
|
2608
|
+
navButton: 'size-9 [&_svg]:size-5'
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
isDisabled: {
|
|
2612
|
+
true: {
|
|
2613
|
+
base: 'opacity-disabled pointer-events-none'
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
},
|
|
2617
|
+
defaultVariants: {
|
|
2618
|
+
intent: 'primary',
|
|
2619
|
+
size: 'md'
|
|
2620
|
+
}
|
|
2621
|
+
});
|
|
2622
|
+
|
|
2623
|
+
/**
|
|
2624
|
+
* Prev/next/first/last share every class, but `tv` has no way for one slot to
|
|
2625
|
+
* inherit another, so the list is written once here and spread into both. It
|
|
2626
|
+
* is not folded into a single `control` slot because `classes.prev` and
|
|
2627
|
+
* `classes.next` are part of the component's public override surface.
|
|
2628
|
+
*/
|
|
2629
|
+
const control = [...focusVisibleRing, 'inline-flex shrink-0 items-center justify-center gap-1', 'rounded-pill', 'cursor-pointer select-none whitespace-nowrap', 'text-neutral-firm', 'transition-colors duration-200', 'motion-reduce:transition-none', 'enabled:hover:bg-surface-overlay-soft enabled:hover:text-neutral-strong', 'disabled:cursor-not-allowed disabled:opacity-disabled'];
|
|
2630
|
+
|
|
2631
|
+
/**
|
|
2632
|
+
* The size-dependent half of the same story: `prev` and `next` are one
|
|
2633
|
+
* affordance at every size, so each size is written once here and spread into
|
|
2634
|
+
* both slots below. Written as whole literal class strings rather than
|
|
2635
|
+
* composed from parts -- Tailwind generates nothing from an interpolated
|
|
2636
|
+
* class, so the scanner has to see each one intact.
|
|
2637
|
+
*/
|
|
2638
|
+
const controlSize = {
|
|
2639
|
+
sm: 'h-7 px-2 text-label-xs [&_svg]:size-3.5',
|
|
2640
|
+
md: 'h-9 px-3 text-label-sm [&_svg]:size-4',
|
|
2641
|
+
lg: 'h-11 px-4 text-label-md [&_svg]:size-5'
|
|
2642
|
+
};
|
|
2643
|
+
const pagination = tv({
|
|
2644
|
+
slots: {
|
|
2645
|
+
// The summary sits on the leading edge and the controls on the trailing
|
|
2646
|
+
// one, so the row justifies apart only when a summary is actually there;
|
|
2647
|
+
// with nothing to justify against, the controls centre instead. Keyed off
|
|
2648
|
+
// the summary element's own presence with `:has()` -- the same trick
|
|
2649
|
+
// `table.ts` uses -- so the layout follows the rendered structure rather
|
|
2650
|
+
// than a variant the component has to compute and thread through.
|
|
2651
|
+
base: ['flex w-full items-center gap-4', 'justify-center', '[&:has([data-pagination-summary])]:justify-between'],
|
|
2652
|
+
summary: 'text-neutral shrink-0',
|
|
2653
|
+
list: 'flex items-center',
|
|
2654
|
+
item: 'flex',
|
|
2655
|
+
// The resting chip is ghost, so a row of them reads as text with the
|
|
2656
|
+
// active one as the only ink. Hover is scoped to the inactive chips:
|
|
2657
|
+
// unscoped, it ties with the active fill on specificity and the winner is
|
|
2658
|
+
// left to Tailwind's variant ordering.
|
|
2659
|
+
page: [...focusVisibleRing, 'inline-flex shrink-0 items-center justify-center', 'rounded-pill', 'cursor-pointer select-none tabular-nums', 'text-neutral-firm', 'transition-colors duration-200', 'motion-reduce:transition-none', 'data-[active=false]:enabled:hover:bg-surface-overlay-soft', 'data-[active=false]:enabled:hover:text-neutral-strong', 'disabled:cursor-not-allowed disabled:opacity-disabled'],
|
|
2660
|
+
prev: control,
|
|
2661
|
+
next: control,
|
|
2662
|
+
// Not a button, so no focus ring and no hover: it is a gap marker, and
|
|
2663
|
+
// giving it an affordance would promise a destination it does not have.
|
|
2664
|
+
ellipsis: 'inline-flex shrink-0 items-center justify-center select-none text-neutral'
|
|
2665
|
+
},
|
|
2666
|
+
variants: {
|
|
2667
|
+
// `page` is sized square via `size-*` so a one-digit and a three-digit
|
|
2668
|
+
// chip are the same circle; `tabular-nums` above stops the digits jittering
|
|
2669
|
+
// as the number changes. The controls are pill-shaped rather than square
|
|
2670
|
+
// because they carry a word as well as a chevron.
|
|
2671
|
+
size: {
|
|
2672
|
+
sm: {
|
|
2673
|
+
summary: 'text-body-xs',
|
|
2674
|
+
list: 'gap-0.5',
|
|
2675
|
+
page: 'size-7 text-label-xs',
|
|
2676
|
+
prev: controlSize.sm,
|
|
2677
|
+
next: controlSize.sm,
|
|
2678
|
+
ellipsis: 'size-7 text-label-xs'
|
|
2679
|
+
},
|
|
2680
|
+
md: {
|
|
2681
|
+
summary: 'text-body-sm',
|
|
2682
|
+
list: 'gap-1',
|
|
2683
|
+
page: 'size-9 text-label-sm',
|
|
2684
|
+
prev: controlSize.md,
|
|
2685
|
+
next: controlSize.md,
|
|
2686
|
+
ellipsis: 'size-9 text-label-sm'
|
|
2687
|
+
},
|
|
2688
|
+
lg: {
|
|
2689
|
+
summary: 'text-body-md',
|
|
2690
|
+
list: 'gap-1.5',
|
|
2691
|
+
page: 'size-11 text-label-md',
|
|
2692
|
+
prev: controlSize.lg,
|
|
2693
|
+
next: controlSize.lg,
|
|
2694
|
+
ellipsis: 'size-11 text-label-md'
|
|
2695
|
+
}
|
|
2696
|
+
},
|
|
2697
|
+
// Fill and label travel together: the digit sits on the fill, so each
|
|
2698
|
+
// intent needs both or the active chip is unreadable.
|
|
2699
|
+
intent: {
|
|
2700
|
+
default: {
|
|
2701
|
+
page: 'data-[active=true]:bg-neutral-bolder data-[active=true]:text-on-neutral-bolder'
|
|
2702
|
+
},
|
|
2703
|
+
primary: {
|
|
2704
|
+
page: 'data-[active=true]:bg-primary data-[active=true]:text-on-primary'
|
|
2705
|
+
},
|
|
2706
|
+
secondary: {
|
|
2707
|
+
page: 'data-[active=true]:bg-secondary data-[active=true]:text-on-secondary'
|
|
2708
|
+
},
|
|
2709
|
+
tertiary: {
|
|
2710
|
+
page: 'data-[active=true]:bg-tertiary data-[active=true]:text-on-tertiary'
|
|
2711
|
+
},
|
|
2712
|
+
success: {
|
|
2713
|
+
page: 'data-[active=true]:bg-success data-[active=true]:text-on-success'
|
|
2714
|
+
},
|
|
2715
|
+
warning: {
|
|
2716
|
+
page: 'data-[active=true]:bg-warning data-[active=true]:text-on-warning'
|
|
2717
|
+
},
|
|
2718
|
+
danger: {
|
|
2719
|
+
page: 'data-[active=true]:bg-danger data-[active=true]:text-on-danger'
|
|
2720
|
+
}
|
|
2721
|
+
},
|
|
2722
|
+
// The buttons also carry a real `disabled` attribute, so this is purely
|
|
2723
|
+
// the group-level dimming; `pointer-events-none` covers a consumer's own
|
|
2724
|
+
// element supplied through the `item` block, which the component cannot
|
|
2725
|
+
// disable for them.
|
|
2726
|
+
isDisabled: {
|
|
2727
|
+
true: {
|
|
2728
|
+
base: 'opacity-disabled',
|
|
2729
|
+
list: 'pointer-events-none'
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
},
|
|
2733
|
+
defaultVariants: {
|
|
2734
|
+
size: 'md',
|
|
2735
|
+
intent: 'default',
|
|
2736
|
+
isDisabled: false
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
|
|
2740
|
+
const tooltip = tv({
|
|
2741
|
+
slots: {
|
|
2742
|
+
// Width is intrinsic so a short label hugs its text, with a cap so a long
|
|
2743
|
+
// one wraps instead of running off the viewport. `origin-*` is keyed off
|
|
2744
|
+
// the resolved placement the content carries as `data-placement`, so the
|
|
2745
|
+
// enter transition grows out of the anchor rather than out of nowhere.
|
|
2746
|
+
base: ['relative w-max max-w-xs rounded-lg shadow-md overflow-visible', 'data-[placement^=top]:origin-bottom', 'data-[placement^=bottom]:origin-top', 'data-[placement^=left]:origin-right', 'data-[placement^=right]:origin-left'],
|
|
2747
|
+
arrow: ''
|
|
2748
|
+
},
|
|
2749
|
+
variants: {
|
|
2750
|
+
size: {
|
|
2751
|
+
sm: {
|
|
2752
|
+
base: 'px-2 py-1 text-label-sm'
|
|
2753
|
+
},
|
|
2754
|
+
md: {
|
|
2755
|
+
base: 'px-2.5 py-1.5 text-label-sm'
|
|
2756
|
+
},
|
|
2757
|
+
lg: {
|
|
2758
|
+
base: 'px-3 py-2 text-label-md'
|
|
2759
|
+
}
|
|
2760
|
+
},
|
|
2761
|
+
// `bg-inherit` on the arrow (see `overlayArrow`) means each intent only
|
|
2762
|
+
// has to state the background once, on `base`. The border is stated on
|
|
2763
|
+
// both `base` and `arrow` for every intent so the two agree at the join:
|
|
2764
|
+
// `default` carries a visible `border-neutral-soft` on each (the arrow's
|
|
2765
|
+
// own shadow-less edge needs a level with more contrast than the body's
|
|
2766
|
+
// `shadow-md` gets away with), and every coloured intent clears both to
|
|
2767
|
+
// `border-transparent`. The body needs this explicitly, not just the
|
|
2768
|
+
// arrow: `Content`'s classNames (`popover.gts`) run this `base` class
|
|
2769
|
+
// through the *`popover`* tv, whose own base carries
|
|
2770
|
+
// `border border-neutral-subtle` (`popover.ts`) -- twMerge only drops
|
|
2771
|
+
// that when a later class from the same border-color group replaces it,
|
|
2772
|
+
// so a coloured intent with no border class of its own left that
|
|
2773
|
+
// neutral border showing on the body while the arrow (fixed here to
|
|
2774
|
+
// `border-transparent`) went invisible, a visible seam at the join.
|
|
2775
|
+
intent: {
|
|
2776
|
+
default: {
|
|
2777
|
+
base: 'bg-surface-input text-on-surface-input border border-neutral-soft',
|
|
2778
|
+
arrow: 'border-neutral-soft'
|
|
2779
|
+
},
|
|
2780
|
+
primary: {
|
|
2781
|
+
base: 'bg-primary text-on-primary border-transparent',
|
|
2782
|
+
arrow: 'border-transparent'
|
|
2783
|
+
},
|
|
2784
|
+
secondary: {
|
|
2785
|
+
base: 'bg-secondary text-on-secondary border-transparent',
|
|
2786
|
+
arrow: 'border-transparent'
|
|
2787
|
+
},
|
|
2788
|
+
tertiary: {
|
|
2789
|
+
base: 'bg-tertiary text-on-tertiary border-transparent',
|
|
2790
|
+
arrow: 'border-transparent'
|
|
2791
|
+
},
|
|
2792
|
+
success: {
|
|
2793
|
+
base: 'bg-success text-on-success border-transparent',
|
|
2794
|
+
arrow: 'border-transparent'
|
|
2795
|
+
},
|
|
2796
|
+
warning: {
|
|
2797
|
+
base: 'bg-warning text-on-warning border-transparent',
|
|
2798
|
+
arrow: 'border-transparent'
|
|
2799
|
+
},
|
|
2800
|
+
danger: {
|
|
2801
|
+
base: 'bg-danger text-on-danger border-transparent',
|
|
2802
|
+
arrow: 'border-transparent'
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
},
|
|
2806
|
+
defaultVariants: {
|
|
2807
|
+
size: 'md',
|
|
2808
|
+
intent: 'default'
|
|
2809
|
+
}
|
|
2810
|
+
});
|
|
2811
|
+
|
|
1996
2812
|
const notificationsContainer = tv({
|
|
1997
2813
|
slots: {
|
|
1998
2814
|
base: ['fixed z-1000 w-full max-w-lg px-4 py-4 pointer-events-none'],
|
|
@@ -2086,7 +2902,7 @@ const notificationCard = tv({
|
|
|
2086
2902
|
description: 'text-body-2xs',
|
|
2087
2903
|
customActions: 'flex flex-nowrap shrink-0 items-center gap-2 self-center',
|
|
2088
2904
|
customActionButton: '',
|
|
2089
|
-
closeButton:
|
|
2905
|
+
closeButton: statusRowCloseButton
|
|
2090
2906
|
},
|
|
2091
2907
|
variants: {
|
|
2092
2908
|
intent: {
|
|
@@ -2991,12 +3807,15 @@ const formSelect = tv({
|
|
|
2991
3807
|
|
|
2992
3808
|
var components = /*#__PURE__*/Object.freeze({
|
|
2993
3809
|
__proto__: null,
|
|
3810
|
+
accordion: accordion,
|
|
3811
|
+
alert: alert,
|
|
2994
3812
|
autocomplete: autocomplete,
|
|
2995
3813
|
avatar: avatar,
|
|
2996
3814
|
backdrop: backdrop,
|
|
2997
3815
|
button: button,
|
|
2998
3816
|
buttonGroup: buttonGroup,
|
|
2999
3817
|
buttonSpinner: buttonSpinner,
|
|
3818
|
+
calendar: calendar,
|
|
3000
3819
|
checkbox: checkbox,
|
|
3001
3820
|
checkboxGroup: checkboxGroup,
|
|
3002
3821
|
chip: chip,
|
|
@@ -3006,6 +3825,7 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
3006
3825
|
divider: divider,
|
|
3007
3826
|
drawer: drawer,
|
|
3008
3827
|
dropdownContent: dropdownContent,
|
|
3828
|
+
externalLink: externalLink,
|
|
3009
3829
|
formCheckbox: formCheckbox,
|
|
3010
3830
|
formCheckboxGroup: formCheckboxGroup,
|
|
3011
3831
|
formDescription: formDescription,
|
|
@@ -3027,7 +3847,9 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
3027
3847
|
notificationCard: notificationCard,
|
|
3028
3848
|
notificationsContainer: notificationsContainer,
|
|
3029
3849
|
overlay: overlay,
|
|
3850
|
+
overlayArrow: overlayArrow,
|
|
3030
3851
|
overlayTransitions: overlayTransitions,
|
|
3852
|
+
pagination: pagination,
|
|
3031
3853
|
popover: popover,
|
|
3032
3854
|
progressBar: progressBar,
|
|
3033
3855
|
radio: radio,
|
|
@@ -3040,7 +3862,8 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
3040
3862
|
table: table,
|
|
3041
3863
|
tabs: tabs,
|
|
3042
3864
|
textarea: textarea,
|
|
3043
|
-
toggleButton: toggleButton
|
|
3865
|
+
toggleButton: toggleButton,
|
|
3866
|
+
tooltip: tooltip
|
|
3044
3867
|
});
|
|
3045
3868
|
|
|
3046
3869
|
let localStyles = components;
|