@dimasbaguspm/versaur 0.0.16 → 0.0.18
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/dist/{js → assets}/styles.css +37 -0
- package/dist/js/bottom-sheet-BRv-oJL-.js +646 -0
- package/dist/js/description-list-DZQF212Z.js +1786 -0
- package/dist/js/email-input-BIbrfs5q.js +1731 -0
- package/dist/js/forms/index.js +16 -16
- package/dist/js/index.js +44 -41
- package/dist/js/overlays/index.js +3 -4
- package/dist/js/primitive/index.js +12 -11
- package/dist/js/providers/index.js +5 -0
- package/dist/js/snackbar-DH8jCh2V.js +50 -0
- package/dist/js/use-snackbars-oPoF7J5t.js +94 -0
- package/dist/types/feedbacks/loading-indicator/index.d.ts +2 -1
- package/dist/types/forms/chip-multiple-input/chip-multiple-input.atoms.d.ts +10 -0
- package/dist/types/forms/chip-multiple-input/chip-multiple-input.d.ts +5 -0
- package/dist/types/forms/chip-multiple-input/index.d.ts +2 -0
- package/dist/types/forms/{chip-input → chip-multiple-input}/types.d.ts +16 -4
- package/dist/types/forms/chip-single-input/chip-single-input.atoms.d.ts +10 -0
- package/dist/types/forms/chip-single-input/chip-single-input.d.ts +5 -0
- package/dist/types/forms/chip-single-input/index.d.ts +2 -0
- package/dist/types/forms/chip-single-input/types.d.ts +67 -0
- package/dist/types/forms/date-single-picker-input/date-single-picker-input.d.ts +1 -8
- package/dist/types/forms/date-single-picker-input/index.d.ts +1 -1
- package/dist/types/forms/date-single-picker-input/types.d.ts +12 -66
- package/dist/types/forms/email-input/email-input.d.ts +8 -0
- package/dist/types/forms/email-input/index.d.ts +2 -0
- package/dist/types/forms/email-input/types.d.ts +6 -0
- package/dist/types/forms/index.d.ts +5 -2
- package/dist/types/forms/price-input/index.d.ts +2 -0
- package/dist/types/forms/price-input/price-input.d.ts +6 -0
- package/dist/types/forms/price-input/types.d.ts +15 -0
- package/dist/types/forms/price-input/use-price-input.d.ts +6 -0
- package/dist/types/forms/search-input/index.d.ts +2 -0
- package/dist/types/forms/search-input/search-input.d.ts +8 -0
- package/dist/types/forms/search-input/types.d.ts +35 -0
- package/dist/types/forms/segment-multiple-input/types.d.ts +1 -5
- package/dist/types/forms/segment-single-input/types.d.ts +1 -5
- package/dist/types/forms/switch-input/index.d.ts +2 -3
- package/dist/types/forms/time-picker-input/time-picker-input.d.ts +4 -4
- package/dist/types/forms/time-picker-input/types.d.ts +2 -38
- package/dist/types/index.d.ts +1 -0
- package/dist/types/layouts/page-layout/index.d.ts +2 -1
- package/dist/types/overlays/menu/index.d.ts +2 -2
- package/dist/types/overlays/modal/types.d.ts +1 -1
- package/dist/types/primitive/anchor/types.d.ts +8 -2
- package/dist/types/primitive/description-list/description-list.atoms.d.ts +13 -0
- package/dist/types/primitive/description-list/description-list.d.ts +6 -0
- package/dist/types/primitive/description-list/index.d.ts +2 -0
- package/dist/types/primitive/description-list/types.d.ts +46 -0
- package/dist/types/primitive/index.d.ts +1 -0
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/providers/snackbars-provider/index.d.ts +3 -0
- package/dist/types/providers/snackbars-provider/provider.d.ts +7 -0
- package/dist/types/providers/snackbars-provider/types.d.ts +28 -0
- package/dist/types/providers/snackbars-provider/use-snackbars-queue.d.ts +9 -0
- package/dist/types/providers/snackbars-provider/use-snackbars.d.ts +4 -0
- package/dist/{js → utils}/enforce-subpath-import.js +61 -51
- package/package.json +8 -4
- package/dist/js/bottom-sheet-Difan0U1.js +0 -340
- package/dist/js/calendar-CUjVZ7Ap.js +0 -811
- package/dist/js/menu-Bm-yPIMN.js +0 -310
- package/dist/js/switch-input-Bx6_2zG9.js +0 -2035
- package/dist/js/tile-BjhJ5Mvl.js +0 -939
- package/dist/types/forms/calculator-input/calculator-input.atoms.d.ts +0 -11
- package/dist/types/forms/calculator-input/calculator-input.d.ts +0 -8
- package/dist/types/forms/calculator-input/index.d.ts +0 -1
- package/dist/types/forms/calculator-input/types.d.ts +0 -51
- package/dist/types/forms/chip-input/chip-input.atoms.d.ts +0 -10
- package/dist/types/forms/chip-input/chip-input.d.ts +0 -5
- package/dist/types/forms/chip-input/index.d.ts +0 -2
- package/dist/types/forms/date-range-picker-input/date-range-picker-input.d.ts +0 -10
- package/dist/types/forms/date-range-picker-input/index.d.ts +0 -2
- package/dist/types/forms/date-range-picker-input/types.d.ts +0 -64
- package/dist/types/forms/date-range-picker-input/use-date-range-picker.d.ts +0 -13
- package/dist/types/forms/date-single-picker-input/date-single-picker-input.atoms.d.ts +0 -13
- package/dist/types/forms/date-single-picker-input/date-single-picker-input.docked.d.ts +0 -14
- package/dist/types/forms/date-single-picker-input/date-single-picker-input.modal.d.ts +0 -15
- package/dist/types/forms/date-single-picker-input/use-date-single-picker.d.ts +0 -10
- package/dist/types/forms/time-picker-input/time-picker-input.atoms.d.ts +0 -15
|
@@ -0,0 +1,1786 @@
|
|
|
1
|
+
import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { X, ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
|
+
const iconVariants = cva("inline-flex items-center justify-center", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "w-3 h-3",
|
|
9
|
+
sm: "w-4 h-4",
|
|
10
|
+
md: "w-5 h-5",
|
|
11
|
+
lg: "w-6 h-6",
|
|
12
|
+
xl: "w-8 h-8"
|
|
13
|
+
},
|
|
14
|
+
color: {
|
|
15
|
+
primary: "text-primary",
|
|
16
|
+
secondary: "text-secondary",
|
|
17
|
+
tertiary: "text-tertiary",
|
|
18
|
+
ghost: "text-ghost",
|
|
19
|
+
neutral: "text-neutral",
|
|
20
|
+
success: "text-success",
|
|
21
|
+
info: "text-info",
|
|
22
|
+
warning: "text-warning",
|
|
23
|
+
danger: "text-danger",
|
|
24
|
+
inherit: ""
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "md",
|
|
29
|
+
color: "primary"
|
|
30
|
+
}
|
|
31
|
+
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: n, ...o }, i) {
|
|
32
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
33
|
+
t,
|
|
34
|
+
{
|
|
35
|
+
ref: i,
|
|
36
|
+
className: iconVariants({ color: r, size: s, className: n }),
|
|
37
|
+
...o
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}), alertVariants = cva(
|
|
41
|
+
"relative flex items-center gap-2 rounded-md p-2 text-sm transition-all duration-200",
|
|
42
|
+
{
|
|
43
|
+
variants: {
|
|
44
|
+
variant: {
|
|
45
|
+
default: "",
|
|
46
|
+
outline: "border"
|
|
47
|
+
},
|
|
48
|
+
color: {
|
|
49
|
+
// Core colors
|
|
50
|
+
primary: "",
|
|
51
|
+
secondary: "",
|
|
52
|
+
tertiary: "",
|
|
53
|
+
ghost: "",
|
|
54
|
+
neutral: "",
|
|
55
|
+
// Semantic colors
|
|
56
|
+
success: "",
|
|
57
|
+
info: "",
|
|
58
|
+
warning: "",
|
|
59
|
+
danger: ""
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
compoundVariants: [
|
|
63
|
+
// Default variant styles (soft backgrounds)
|
|
64
|
+
{
|
|
65
|
+
variant: "default",
|
|
66
|
+
color: "primary",
|
|
67
|
+
class: "bg-primary-soft text-primary border border-primary"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
variant: "default",
|
|
71
|
+
color: "secondary",
|
|
72
|
+
class: "bg-secondary-soft text-secondary border border-secondary"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
variant: "default",
|
|
76
|
+
color: "tertiary",
|
|
77
|
+
class: "bg-tertiary-soft text-tertiary border border-tertiary"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
variant: "default",
|
|
81
|
+
color: "ghost",
|
|
82
|
+
class: "bg-ghost-soft text-ghost border border-ghost"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: "default",
|
|
86
|
+
color: "neutral",
|
|
87
|
+
class: "bg-border/50 text-foreground border border-border"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
variant: "default",
|
|
91
|
+
color: "success",
|
|
92
|
+
class: "bg-success-soft text-success border border-success"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: "default",
|
|
96
|
+
color: "info",
|
|
97
|
+
class: "bg-info-soft text-info border border-info"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
variant: "default",
|
|
101
|
+
color: "warning",
|
|
102
|
+
class: "bg-warning-soft text-warning border border-warning"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
variant: "default",
|
|
106
|
+
color: "danger",
|
|
107
|
+
class: "bg-danger-soft text-danger border border-danger"
|
|
108
|
+
},
|
|
109
|
+
// Outline variant styles
|
|
110
|
+
{
|
|
111
|
+
variant: "outline",
|
|
112
|
+
color: "primary",
|
|
113
|
+
class: "bg-transparent text-primary border-primary"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
variant: "outline",
|
|
117
|
+
color: "secondary",
|
|
118
|
+
class: "bg-transparent text-secondary border-secondary"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
variant: "outline",
|
|
122
|
+
color: "tertiary",
|
|
123
|
+
class: "bg-transparent text-tertiary border-tertiary"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
variant: "outline",
|
|
127
|
+
color: "ghost",
|
|
128
|
+
class: "bg-transparent text-ghost border-ghost"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
variant: "outline",
|
|
132
|
+
color: "neutral",
|
|
133
|
+
class: "bg-transparent text-foreground border-border"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
variant: "outline",
|
|
137
|
+
color: "success",
|
|
138
|
+
class: "bg-transparent text-success border-success"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: "outline",
|
|
142
|
+
color: "info",
|
|
143
|
+
class: "bg-transparent text-info border-info"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
variant: "outline",
|
|
147
|
+
color: "warning",
|
|
148
|
+
class: "bg-transparent text-warning border-warning"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
variant: "outline",
|
|
152
|
+
color: "danger",
|
|
153
|
+
class: "bg-transparent text-danger border-danger"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
defaultVariants: {
|
|
157
|
+
variant: "default",
|
|
158
|
+
color: "neutral"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
), alertIconVariants = cva(
|
|
162
|
+
"flex-shrink-0 flex justify-center items-center ",
|
|
163
|
+
{
|
|
164
|
+
variants: {
|
|
165
|
+
size: {
|
|
166
|
+
sm: "w-4 h-4",
|
|
167
|
+
md: "w-5 h-5",
|
|
168
|
+
lg: "w-6 h-6"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
defaultVariants: {
|
|
172
|
+
size: "md"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
), AlertIcon = forwardRef(
|
|
176
|
+
({ className: e, children: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: s, className: cn(alertIconVariants(), e), ...r, children: t })
|
|
177
|
+
), AlertRoot = forwardRef(
|
|
178
|
+
({
|
|
179
|
+
variant: e = "default",
|
|
180
|
+
color: t = "neutral",
|
|
181
|
+
icon: r,
|
|
182
|
+
className: s,
|
|
183
|
+
children: n,
|
|
184
|
+
...o
|
|
185
|
+
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
ref: i,
|
|
189
|
+
role: "alert",
|
|
190
|
+
className: cn(alertVariants({ variant: e, color: t }), s),
|
|
191
|
+
...o,
|
|
192
|
+
children: [
|
|
193
|
+
r && /* @__PURE__ */ jsxRuntimeExports.jsx(AlertIcon, { children: r }),
|
|
194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: n })
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
), Alert = Object.assign(AlertRoot, {
|
|
199
|
+
Icon: AlertIcon
|
|
200
|
+
}), anchorVariants = cva(
|
|
201
|
+
[
|
|
202
|
+
"inline-flex items-center transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
203
|
+
// pseudo selectors for anchor
|
|
204
|
+
"hover:no-underline"
|
|
205
|
+
],
|
|
206
|
+
{
|
|
207
|
+
variants: {
|
|
208
|
+
color: {
|
|
209
|
+
primary: "text-primary",
|
|
210
|
+
secondary: "text-secondary",
|
|
211
|
+
ghost: "text-ghost",
|
|
212
|
+
danger: "text-danger",
|
|
213
|
+
neutral: "text-neutral"
|
|
214
|
+
},
|
|
215
|
+
fontSize: {
|
|
216
|
+
xs: "text-xs",
|
|
217
|
+
sm: "text-sm",
|
|
218
|
+
base: "text-base",
|
|
219
|
+
lg: "text-lg",
|
|
220
|
+
xl: "text-xl",
|
|
221
|
+
"2xl": "text-2xl",
|
|
222
|
+
"3xl": "text-3xl",
|
|
223
|
+
"4xl": "text-4xl",
|
|
224
|
+
"5xl": "text-5xl",
|
|
225
|
+
"6xl": "text-6xl",
|
|
226
|
+
"7xl": "text-7xl",
|
|
227
|
+
"8xl": "text-8xl",
|
|
228
|
+
"9xl": "text-9xl",
|
|
229
|
+
inherit: "",
|
|
230
|
+
undefined: ""
|
|
231
|
+
},
|
|
232
|
+
fontWeight: {
|
|
233
|
+
thin: "font-thin",
|
|
234
|
+
extralight: "font-extralight",
|
|
235
|
+
light: "font-light",
|
|
236
|
+
normal: "font-normal",
|
|
237
|
+
medium: "font-medium",
|
|
238
|
+
semibold: "font-semibold",
|
|
239
|
+
bold: "font-bold",
|
|
240
|
+
extrabold: "font-extrabold",
|
|
241
|
+
black: "font-black",
|
|
242
|
+
inherit: "",
|
|
243
|
+
undefined: ""
|
|
244
|
+
},
|
|
245
|
+
quiet: {
|
|
246
|
+
true: "",
|
|
247
|
+
false: "underline underline-offset-2"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
defaultVariants: {
|
|
251
|
+
color: "primary",
|
|
252
|
+
fontSize: "base",
|
|
253
|
+
fontWeight: "medium",
|
|
254
|
+
quiet: !1
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
), Anchor = forwardRef(
|
|
258
|
+
({
|
|
259
|
+
children: e,
|
|
260
|
+
className: t,
|
|
261
|
+
color: r = "primary",
|
|
262
|
+
fontSize: s = "base",
|
|
263
|
+
fontWeight: n = "medium",
|
|
264
|
+
quiet: o = !1,
|
|
265
|
+
...i
|
|
266
|
+
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
267
|
+
"a",
|
|
268
|
+
{
|
|
269
|
+
ref: a,
|
|
270
|
+
className: cn(
|
|
271
|
+
anchorVariants({ color: r, fontSize: s, fontWeight: n, quiet: o }),
|
|
272
|
+
t
|
|
273
|
+
),
|
|
274
|
+
...i,
|
|
275
|
+
children: e
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
), avatarVariants = cva(
|
|
279
|
+
"inline-flex items-center justify-center font-medium text-white overflow-hidden transition-all duration-200 select-none relative",
|
|
280
|
+
{
|
|
281
|
+
variants: {
|
|
282
|
+
variant: {
|
|
283
|
+
// Core variants using Versaur color system
|
|
284
|
+
primary: "bg-primary-light text-primary",
|
|
285
|
+
secondary: "bg-secondary-light text-secondary",
|
|
286
|
+
tertiary: "bg-tertiary-light text-tertiary",
|
|
287
|
+
ghost: "bg-ghost-light text-ghost",
|
|
288
|
+
neutral: "bg-neutral-light text-foreground border border-border",
|
|
289
|
+
// Semantic variants
|
|
290
|
+
success: "bg-success-light text-success",
|
|
291
|
+
info: "bg-info-light text-info",
|
|
292
|
+
warning: "bg-warning-light text-warning",
|
|
293
|
+
danger: "bg-danger-light text-danger"
|
|
294
|
+
},
|
|
295
|
+
size: {
|
|
296
|
+
xs: "h-6 w-6 text-xs",
|
|
297
|
+
sm: "h-8 w-8 text-xs",
|
|
298
|
+
md: "h-10 w-10 text-sm",
|
|
299
|
+
lg: "h-12 w-12 text-base",
|
|
300
|
+
xl: "h-16 w-16 text-xl"
|
|
301
|
+
},
|
|
302
|
+
shape: {
|
|
303
|
+
circle: "rounded-full",
|
|
304
|
+
square: "rounded-none",
|
|
305
|
+
rounded: "rounded-md"
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
defaultVariants: {
|
|
309
|
+
variant: "primary",
|
|
310
|
+
size: "md",
|
|
311
|
+
shape: "circle"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
), avatarImageVariants = cva(
|
|
315
|
+
"absolute inset-0 h-full w-full object-cover"
|
|
316
|
+
), Avatar$1 = forwardRef(
|
|
317
|
+
({
|
|
318
|
+
variant: e = "primary",
|
|
319
|
+
size: t = "md",
|
|
320
|
+
shape: r = "circle",
|
|
321
|
+
className: s,
|
|
322
|
+
children: n,
|
|
323
|
+
...o
|
|
324
|
+
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
ref: i,
|
|
328
|
+
className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
|
|
329
|
+
...o,
|
|
330
|
+
children: n
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
), AvatarImage = forwardRef(
|
|
334
|
+
({ src: e, alt: t, className: r, onError: s, ...n }, o) => {
|
|
335
|
+
const [i, a] = useState(!1);
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
a(!1);
|
|
338
|
+
}, [e]);
|
|
339
|
+
const u = useCallback(
|
|
340
|
+
(c) => {
|
|
341
|
+
a(!0), s?.(c);
|
|
342
|
+
},
|
|
343
|
+
[s]
|
|
344
|
+
);
|
|
345
|
+
return i ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
346
|
+
"img",
|
|
347
|
+
{
|
|
348
|
+
ref: o,
|
|
349
|
+
src: e,
|
|
350
|
+
alt: t,
|
|
351
|
+
className: cn(avatarImageVariants(), r),
|
|
352
|
+
onError: u,
|
|
353
|
+
...n
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
), Avatar = Object.assign(Avatar$1, {
|
|
358
|
+
/**
|
|
359
|
+
* AvatarImage sub-component for displaying images with fallback behavior
|
|
360
|
+
*/
|
|
361
|
+
Image: AvatarImage
|
|
362
|
+
}), badgeVariants = cva(
|
|
363
|
+
"inline-flex items-center justify-center font-medium transition-all duration-200 select-none gap-1 min-h-[1.25rem]",
|
|
364
|
+
{
|
|
365
|
+
variants: {
|
|
366
|
+
variant: {
|
|
367
|
+
default: "",
|
|
368
|
+
outline: "border bg-background"
|
|
369
|
+
},
|
|
370
|
+
color: {
|
|
371
|
+
// Core colors
|
|
372
|
+
primary: "",
|
|
373
|
+
secondary: "",
|
|
374
|
+
tertiary: "",
|
|
375
|
+
ghost: "",
|
|
376
|
+
neutral: "",
|
|
377
|
+
// Semantic colors
|
|
378
|
+
success: "",
|
|
379
|
+
info: "",
|
|
380
|
+
warning: "",
|
|
381
|
+
danger: ""
|
|
382
|
+
},
|
|
383
|
+
shape: {
|
|
384
|
+
rounded: "rounded-full",
|
|
385
|
+
square: "rounded-md"
|
|
386
|
+
},
|
|
387
|
+
size: {
|
|
388
|
+
sm: "text-xs px-1 py-0.25 h-3",
|
|
389
|
+
md: "text-xs px-1.5 py-0.5 h-4",
|
|
390
|
+
lg: "text-sm px-2 py-1 h-6"
|
|
391
|
+
},
|
|
392
|
+
iconOnly: {
|
|
393
|
+
true: "",
|
|
394
|
+
false: ""
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
compoundVariants: [
|
|
398
|
+
// Default variant color combinations - using light/soft backgrounds
|
|
399
|
+
{
|
|
400
|
+
variant: "default",
|
|
401
|
+
color: "primary",
|
|
402
|
+
className: "bg-primary-light text-primary"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
variant: "default",
|
|
406
|
+
color: "secondary",
|
|
407
|
+
className: "bg-secondary-light text-secondary"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
variant: "default",
|
|
411
|
+
color: "tertiary",
|
|
412
|
+
className: "bg-tertiary-light text-tertiary"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
variant: "default",
|
|
416
|
+
color: "ghost",
|
|
417
|
+
className: "bg-ghost-light text-ghost"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
variant: "default",
|
|
421
|
+
color: "neutral",
|
|
422
|
+
className: "bg-neutral text-foreground"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
variant: "default",
|
|
426
|
+
color: "success",
|
|
427
|
+
className: "bg-success-light text-success"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
variant: "default",
|
|
431
|
+
color: "info",
|
|
432
|
+
className: "bg-info-light text-info"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
variant: "default",
|
|
436
|
+
color: "warning",
|
|
437
|
+
className: "bg-warning-light text-warning"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
variant: "default",
|
|
441
|
+
color: "danger",
|
|
442
|
+
className: "bg-danger-light text-danger"
|
|
443
|
+
},
|
|
444
|
+
// Outline variant color combinations
|
|
445
|
+
{
|
|
446
|
+
variant: "outline",
|
|
447
|
+
color: "primary",
|
|
448
|
+
className: "border-primary text-primary"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
variant: "outline",
|
|
452
|
+
color: "secondary",
|
|
453
|
+
className: "border-secondary text-secondary"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
variant: "outline",
|
|
457
|
+
color: "tertiary",
|
|
458
|
+
className: "border-tertiary text-tertiary"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
variant: "outline",
|
|
462
|
+
color: "ghost",
|
|
463
|
+
className: "border-ghost text-ghost"
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
variant: "outline",
|
|
467
|
+
color: "neutral",
|
|
468
|
+
className: "border-neutral text-foreground"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
variant: "outline",
|
|
472
|
+
color: "success",
|
|
473
|
+
className: "border-success text-success"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
variant: "outline",
|
|
477
|
+
color: "info",
|
|
478
|
+
className: "border-info text-info"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
variant: "outline",
|
|
482
|
+
color: "warning",
|
|
483
|
+
className: "border-warning text-warning"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
variant: "outline",
|
|
487
|
+
color: "danger",
|
|
488
|
+
className: "border-danger text-danger"
|
|
489
|
+
},
|
|
490
|
+
// Icon-only size adjustments
|
|
491
|
+
{
|
|
492
|
+
iconOnly: !0,
|
|
493
|
+
size: "sm",
|
|
494
|
+
className: "px-1 py-1 w-5 h-5"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
iconOnly: !0,
|
|
498
|
+
size: "md",
|
|
499
|
+
className: "px-1.5 py-1.5 w-6 h-6"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
iconOnly: !0,
|
|
503
|
+
size: "lg",
|
|
504
|
+
className: "px-2 py-2 w-7 h-7"
|
|
505
|
+
}
|
|
506
|
+
],
|
|
507
|
+
defaultVariants: {
|
|
508
|
+
variant: "default",
|
|
509
|
+
color: "primary",
|
|
510
|
+
shape: "square",
|
|
511
|
+
size: "md",
|
|
512
|
+
iconOnly: !1
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
), Badge = forwardRef(
|
|
516
|
+
({
|
|
517
|
+
variant: e = "default",
|
|
518
|
+
shape: t = "square",
|
|
519
|
+
color: r = "primary",
|
|
520
|
+
size: s = "md",
|
|
521
|
+
iconLeft: n,
|
|
522
|
+
iconRight: o,
|
|
523
|
+
className: i,
|
|
524
|
+
children: a,
|
|
525
|
+
...u
|
|
526
|
+
}, c) => {
|
|
527
|
+
const f = !(a != null && a !== "") && !!(n || o);
|
|
528
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
529
|
+
"span",
|
|
530
|
+
{
|
|
531
|
+
ref: c,
|
|
532
|
+
className: cn(
|
|
533
|
+
badgeVariants({
|
|
534
|
+
variant: e,
|
|
535
|
+
color: r,
|
|
536
|
+
shape: t,
|
|
537
|
+
size: s,
|
|
538
|
+
iconOnly: f
|
|
539
|
+
}),
|
|
540
|
+
i
|
|
541
|
+
),
|
|
542
|
+
...u,
|
|
543
|
+
children: f ? (
|
|
544
|
+
// Icon-only mode: display only the icon
|
|
545
|
+
n || o
|
|
546
|
+
) : (
|
|
547
|
+
// Normal mode: display icon(s) and text
|
|
548
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
549
|
+
n,
|
|
550
|
+
a,
|
|
551
|
+
o
|
|
552
|
+
] })
|
|
553
|
+
)
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
Badge.displayName = "Badge";
|
|
559
|
+
const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ React.createElement("title", null, "Spenicle"), /* @__PURE__ */ React.createElement("rect", { width: 32, height: 32, fill: "#e07a5f" }), /* @__PURE__ */ React.createElement("g", { transform: "translate(16, 16) scale(0.625) translate(-12, -12)" }, /* @__PURE__ */ React.createElement("path", { d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z", fill: "white" }))), SvgSpenicleRounded = (e) => /* @__PURE__ */ React.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ React.createElement("title", null, "Spenicle"), /* @__PURE__ */ React.createElement("rect", { width: 32, height: 32, rx: 8, fill: "#e07a5f" }), /* @__PURE__ */ React.createElement("g", { transform: "translate(16, 16) scale(0.625) translate(-12, -12)" }, /* @__PURE__ */ React.createElement("path", { d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z", fill: "white" }))), SvgSpenicleCircle = (e) => /* @__PURE__ */ React.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ React.createElement("title", null, "Spenicle"), /* @__PURE__ */ React.createElement("circle", { cx: 16, cy: 16, r: 16, fill: "#e07a5f" }), /* @__PURE__ */ React.createElement("g", { transform: "translate(16, 16) scale(0.625) translate(-12, -12)" }, /* @__PURE__ */ React.createElement("path", { d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z", fill: "white" }))), brandSizeClass = cva("", {
|
|
560
|
+
variants: {
|
|
561
|
+
size: {
|
|
562
|
+
xs: "h-6 w-6",
|
|
563
|
+
sm: "h-6 w-6",
|
|
564
|
+
md: "h-8 w-8",
|
|
565
|
+
lg: "h-10 w-10",
|
|
566
|
+
xl: "h-12 w-12"
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
defaultVariants: {
|
|
570
|
+
size: "md"
|
|
571
|
+
}
|
|
572
|
+
}), BrandLogo = forwardRef(
|
|
573
|
+
({ shape: e = "square", size: t, ...r }, s) => {
|
|
574
|
+
const o = {
|
|
575
|
+
square: SvgSpenicleSquare,
|
|
576
|
+
rounded: SvgSpenicleRounded,
|
|
577
|
+
circle: SvgSpenicleCircle
|
|
578
|
+
}[e] || SvgSpenicleSquare;
|
|
579
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
580
|
+
o,
|
|
581
|
+
{
|
|
582
|
+
ref: s,
|
|
583
|
+
...r,
|
|
584
|
+
className: cn("inline-block", brandSizeClass({ size: t }))
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
), Brand = forwardRef(
|
|
589
|
+
({ name: e = "spenicle", size: t = "md", shape: r, ...s }, n) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
590
|
+
"span",
|
|
591
|
+
{
|
|
592
|
+
ref: n,
|
|
593
|
+
className: cn("inline-flex items-center gap-2"),
|
|
594
|
+
...s,
|
|
595
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrandLogo, { shape: r, size: t, "aria-hidden": "true" })
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
), buttonVariants = cva(
|
|
599
|
+
"inline-flex items-center justify-center gap-2 rounded-md font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] select-none",
|
|
600
|
+
{
|
|
601
|
+
variants: {
|
|
602
|
+
variant: {
|
|
603
|
+
// Core variants using Versaur color system
|
|
604
|
+
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
605
|
+
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
606
|
+
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
607
|
+
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
608
|
+
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-soft focus-visible:ring-offset-white shadow-sm",
|
|
609
|
+
// Outline variants
|
|
610
|
+
"primary-outline": "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-soft focus-visible:ring-offset-white transition-all",
|
|
611
|
+
"secondary-outline": "border border-secondary text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-soft focus-visible:ring-offset-white transition-all",
|
|
612
|
+
"tertiary-outline": "border border-tertiary text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-soft focus-visible:ring-offset-white transition-all",
|
|
613
|
+
"ghost-outline": "border border-ghost text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-soft focus-visible:ring-offset-white transition-all",
|
|
614
|
+
"neutral-outline": "border border-neutral text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-soft focus-visible:ring-offset-white transition-all",
|
|
615
|
+
// Ghost variants (subtle)
|
|
616
|
+
"primary-ghost": "text-primary bg-white hover:bg-primary-light focus-visible:ring-primary-light focus-visible:ring-offset-white",
|
|
617
|
+
"secondary-ghost": "text-secondary bg-white hover:bg-secondary-light focus-visible:ring-secondary-light focus-visible:ring-offset-white",
|
|
618
|
+
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary-light focus-visible:ring-tertiary-light focus-visible:ring-offset-white",
|
|
619
|
+
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/70 focus-visible:ring-foreground-soft focus-visible:ring-offset-white",
|
|
620
|
+
// Semantic variants
|
|
621
|
+
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
622
|
+
"success-outline": "border border-success text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-soft focus-visible:ring-offset-white transition-all",
|
|
623
|
+
"success-ghost": "text-success bg-white hover:bg-success-light focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
624
|
+
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
625
|
+
"info-outline": "border border-info text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-soft focus-visible:ring-offset-white transition-all",
|
|
626
|
+
"info-ghost": "text-info bg-white hover:bg-info-light focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
627
|
+
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
628
|
+
"warning-outline": "border border-warning text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-soft focus-visible:ring-offset-white transition-all",
|
|
629
|
+
"warning-ghost": "text-warning bg-white hover:bg-warning-light focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
630
|
+
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
631
|
+
"danger-outline": "border border-danger text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-soft focus-visible:ring-offset-white transition-all",
|
|
632
|
+
"danger-ghost": "text-danger bg-white hover:bg-danger-light focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
633
|
+
// Utility variants
|
|
634
|
+
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
635
|
+
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
636
|
+
},
|
|
637
|
+
size: {
|
|
638
|
+
sm: "h-8 px-3 text-sm min-w-[2.25rem]",
|
|
639
|
+
md: "h-10 px-4 text-sm min-w-[2.5rem]",
|
|
640
|
+
lg: "h-12 px-8 text-lg min-w-[2.75rem]"
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
defaultVariants: {
|
|
644
|
+
variant: "primary",
|
|
645
|
+
size: "md"
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
), Button = React__default.forwardRef(
|
|
649
|
+
function({
|
|
650
|
+
className: t,
|
|
651
|
+
variant: r = "primary",
|
|
652
|
+
size: s = "md",
|
|
653
|
+
disabled: n = !1,
|
|
654
|
+
type: o = "button",
|
|
655
|
+
children: i,
|
|
656
|
+
...a
|
|
657
|
+
}, u) {
|
|
658
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
ref: u,
|
|
662
|
+
type: o,
|
|
663
|
+
className: cn(buttonVariants({ variant: r, size: s }), t),
|
|
664
|
+
disabled: n,
|
|
665
|
+
"aria-disabled": n,
|
|
666
|
+
inert: n ? !0 : void 0,
|
|
667
|
+
...a,
|
|
668
|
+
children: i
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
), buttonFloatVariants = cva(
|
|
673
|
+
[
|
|
674
|
+
"inline-flex items-center justify-center gap-2",
|
|
675
|
+
"rounded-lg",
|
|
676
|
+
"font-medium",
|
|
677
|
+
"transition-all",
|
|
678
|
+
"duration-200",
|
|
679
|
+
"focus-visible:outline-none",
|
|
680
|
+
"focus-visible:ring-2",
|
|
681
|
+
"focus-visible:ring-offset-2",
|
|
682
|
+
"disabled:opacity-50",
|
|
683
|
+
"disabled:pointer-events-none",
|
|
684
|
+
"select-none",
|
|
685
|
+
"shadow-lg",
|
|
686
|
+
"transition-transform",
|
|
687
|
+
"transition-shadow",
|
|
688
|
+
"will-change-transform,opacity,box-shadow",
|
|
689
|
+
"hover:scale-105",
|
|
690
|
+
"active:scale-95",
|
|
691
|
+
"focus-visible:shadow-xl",
|
|
692
|
+
"hover:shadow-xl",
|
|
693
|
+
"active:shadow-md"
|
|
694
|
+
].join(" "),
|
|
695
|
+
{
|
|
696
|
+
variants: {
|
|
697
|
+
variant: {
|
|
698
|
+
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-soft focus-visible:ring-offset-white",
|
|
699
|
+
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-soft focus-visible:ring-offset-white",
|
|
700
|
+
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-soft focus-visible:ring-offset-white",
|
|
701
|
+
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
702
|
+
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-soft focus-visible:ring-offset-white",
|
|
703
|
+
"primary-outline": "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-soft focus-visible:ring-offset-white",
|
|
704
|
+
"secondary-outline": "border border-secondary text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-soft focus-visible:ring-offset-white",
|
|
705
|
+
"tertiary-outline": "border border-tertiary text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-soft focus-visible:ring-offset-white",
|
|
706
|
+
"ghost-outline": "border border-ghost text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
707
|
+
"neutral-outline": "border border-neutral text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-soft focus-visible:ring-offset-white",
|
|
708
|
+
"primary-ghost": "text-primary bg-white hover:bg-primary-soft focus-visible:ring-primary-soft focus-visible:ring-offset-white",
|
|
709
|
+
"secondary-ghost": "text-secondary bg-white hover:bg-secondary-soft focus-visible:ring-secondary-soft focus-visible:ring-offset-white",
|
|
710
|
+
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary-soft focus-visible:ring-tertiary-soft focus-visible:ring-offset-white",
|
|
711
|
+
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/70 focus-visible:ring-foreground-soft focus-visible:ring-offset-white",
|
|
712
|
+
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-soft focus-visible:ring-offset-white",
|
|
713
|
+
"success-outline": "border border-success text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-soft focus-visible:ring-offset-white",
|
|
714
|
+
"success-ghost": "text-success bg-white hover:bg-success-soft focus-visible:ring-success-soft focus-visible:ring-offset-white",
|
|
715
|
+
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-soft focus-visible:ring-offset-white",
|
|
716
|
+
"info-outline": "border border-info text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-soft focus-visible:ring-offset-white",
|
|
717
|
+
"info-ghost": "text-info bg-white hover:bg-info-soft focus-visible:ring-info-soft focus-visible:ring-offset-white",
|
|
718
|
+
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-soft focus-visible:ring-offset-white",
|
|
719
|
+
"warning-outline": "border border-warning text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-soft focus-visible:ring-offset-white",
|
|
720
|
+
"warning-ghost": "text-warning bg-white hover:bg-warning-soft focus-visible:ring-warning-soft focus-visible:ring-offset-white",
|
|
721
|
+
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white",
|
|
722
|
+
"danger-outline": "border border-danger text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-soft focus-visible:ring-offset-white",
|
|
723
|
+
"danger-ghost": "text-danger bg-white hover:bg-danger-soft focus-visible:ring-danger-soft focus-visible:ring-offset-white",
|
|
724
|
+
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white",
|
|
725
|
+
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white"
|
|
726
|
+
},
|
|
727
|
+
size: {
|
|
728
|
+
sm: "h-12 w-12 min-w-12 min-h-12 text-base",
|
|
729
|
+
md: "h-14 w-14 min-w-14 min-h-14 text-lg",
|
|
730
|
+
lg: "h-16 w-16 min-w-16 min-h-16 text-xl"
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
defaultVariants: {
|
|
734
|
+
variant: "primary",
|
|
735
|
+
size: "md"
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
function useFloatingPosition(e, t = "1rem") {
|
|
740
|
+
const r = useRef(null), [s, n] = useState({}), [o, i] = useState("fixed bottom-4 right-4"), a = useCallback(() => {
|
|
741
|
+
const c = r.current;
|
|
742
|
+
if (!c) return;
|
|
743
|
+
const b = c.getBoundingClientRect().height > window.innerHeight;
|
|
744
|
+
let f = {}, w = "";
|
|
745
|
+
b ? (f = {
|
|
746
|
+
position: "fixed",
|
|
747
|
+
bottom: t,
|
|
748
|
+
zIndex: 50,
|
|
749
|
+
transform: `translateY(${c.scrollTop}px)`
|
|
750
|
+
}, w = `fixed bottom-4 ${e}-4`) : (f = {
|
|
751
|
+
position: "fixed",
|
|
752
|
+
bottom: t,
|
|
753
|
+
zIndex: 50
|
|
754
|
+
}, w = `fixed bottom-4 ${e}-4`), n(f), i(w);
|
|
755
|
+
}, [e, t]);
|
|
756
|
+
return useEffect(() => {
|
|
757
|
+
a();
|
|
758
|
+
const c = r.current;
|
|
759
|
+
return c && c.addEventListener("scroll", a), window.addEventListener("resize", a), () => {
|
|
760
|
+
c && c.removeEventListener("scroll", a), window.removeEventListener("resize", a);
|
|
761
|
+
};
|
|
762
|
+
}, [a]), useEffect(() => {
|
|
763
|
+
r.current && a();
|
|
764
|
+
}, [e, t, a]), [useCallback(
|
|
765
|
+
(c) => {
|
|
766
|
+
r.current = c, c && a();
|
|
767
|
+
},
|
|
768
|
+
[a]
|
|
769
|
+
), s, o];
|
|
770
|
+
}
|
|
771
|
+
const ButtonFloat = forwardRef(
|
|
772
|
+
function({
|
|
773
|
+
className: t,
|
|
774
|
+
variant: r = "primary",
|
|
775
|
+
size: s = "md",
|
|
776
|
+
side: n = "right",
|
|
777
|
+
offset: o = "1rem",
|
|
778
|
+
...i
|
|
779
|
+
}, a) {
|
|
780
|
+
const [u, c, x] = useFloatingPosition(
|
|
781
|
+
n,
|
|
782
|
+
o
|
|
783
|
+
), [b, f] = useState(!1);
|
|
784
|
+
return useEffect(() => {
|
|
785
|
+
f(!0);
|
|
786
|
+
}, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: u, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
787
|
+
"button",
|
|
788
|
+
{
|
|
789
|
+
ref: a,
|
|
790
|
+
type: i.type || "button",
|
|
791
|
+
className: cn(
|
|
792
|
+
buttonFloatVariants({ variant: r, size: s }),
|
|
793
|
+
x,
|
|
794
|
+
b && "animate-fab-in",
|
|
795
|
+
t
|
|
796
|
+
),
|
|
797
|
+
style: c,
|
|
798
|
+
...i
|
|
799
|
+
}
|
|
800
|
+
) });
|
|
801
|
+
}
|
|
802
|
+
);
|
|
803
|
+
function getIconColorFromVariant(e = "primary") {
|
|
804
|
+
const t = e.split("-");
|
|
805
|
+
if (t.length === 1)
|
|
806
|
+
switch (t[0]) {
|
|
807
|
+
case "ghost":
|
|
808
|
+
case "neutral":
|
|
809
|
+
case "outline":
|
|
810
|
+
return "ghost";
|
|
811
|
+
default:
|
|
812
|
+
return "neutral";
|
|
813
|
+
}
|
|
814
|
+
if (t?.[1] === "outline") return "inherit";
|
|
815
|
+
switch (t[0]) {
|
|
816
|
+
case "primary":
|
|
817
|
+
return "primary";
|
|
818
|
+
case "secondary":
|
|
819
|
+
return "secondary";
|
|
820
|
+
case "tertiary":
|
|
821
|
+
return "tertiary";
|
|
822
|
+
case "ghost":
|
|
823
|
+
return "ghost";
|
|
824
|
+
case "neutral":
|
|
825
|
+
return "ghost";
|
|
826
|
+
case "success":
|
|
827
|
+
return "success";
|
|
828
|
+
case "info":
|
|
829
|
+
return "info";
|
|
830
|
+
case "warning":
|
|
831
|
+
return "warning";
|
|
832
|
+
case "danger":
|
|
833
|
+
return "danger";
|
|
834
|
+
default:
|
|
835
|
+
return "neutral";
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
const buttonIconVariants = cva(
|
|
839
|
+
"inline-flex items-center justify-center font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none active:scale-[0.98] select-none",
|
|
840
|
+
{
|
|
841
|
+
variants: {
|
|
842
|
+
variant: {
|
|
843
|
+
// Core variants using Versaur color system
|
|
844
|
+
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
845
|
+
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
846
|
+
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
847
|
+
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
848
|
+
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-soft focus-visible:ring-offset-white shadow-sm",
|
|
849
|
+
// Outline variants
|
|
850
|
+
"primary-outline": "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary-soft focus-visible:ring-offset-white transition-all",
|
|
851
|
+
"secondary-outline": "border border-secondary text-secondary bg-white hover:bg-secondary hover:text-white focus-visible:ring-secondary-soft focus-visible:ring-offset-white transition-all",
|
|
852
|
+
"tertiary-outline": "border border-tertiary text-tertiary bg-white hover:bg-tertiary hover:text-white focus-visible:ring-tertiary-soft focus-visible:ring-offset-white transition-all",
|
|
853
|
+
"ghost-outline": "border border-ghost text-ghost bg-white hover:bg-ghost hover:text-white focus-visible:ring-ghost-soft focus-visible:ring-offset-white transition-all",
|
|
854
|
+
"neutral-outline": "border border-neutral text-foreground bg-white hover:bg-neutral hover:text-foreground focus-visible:ring-foreground-soft focus-visible:ring-offset-white transition-all",
|
|
855
|
+
// Ghost variants (subtle)
|
|
856
|
+
"primary-ghost": "text-primary bg-white hover:bg-primary-light focus-visible:ring-primary-light focus-visible:ring-offset-white",
|
|
857
|
+
"secondary-ghost": "text-secondary bg-white hover:bg-secondary-light focus-visible:ring-secondary-light focus-visible:ring-offset-white",
|
|
858
|
+
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary-light focus-visible:ring-tertiary-light focus-visible:ring-offset-white",
|
|
859
|
+
"neutral-ghost": "text-foreground bg-white hover:bg-neutral-light focus-visible:ring-foreground-light focus-visible:ring-offset-white",
|
|
860
|
+
// Semantic variants
|
|
861
|
+
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
862
|
+
"success-outline": "border border-success text-success bg-white hover:bg-success hover:text-white focus-visible:ring-success-soft focus-visible:ring-offset-white transition-all",
|
|
863
|
+
"success-ghost": "text-success bg-white hover:bg-success-light focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
864
|
+
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
865
|
+
"info-outline": "border border-info text-info bg-white hover:bg-info hover:text-white focus-visible:ring-info-soft focus-visible:ring-offset-white transition-all",
|
|
866
|
+
"info-ghost": "text-info bg-white hover:bg-info-light focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
867
|
+
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
868
|
+
"warning-outline": "border border-warning text-warning bg-white hover:bg-warning hover:text-white focus-visible:ring-warning-soft focus-visible:ring-offset-white transition-all",
|
|
869
|
+
"warning-ghost": "text-warning bg-white hover:bg-warning-light focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
870
|
+
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
871
|
+
"danger-outline": "border border-danger text-danger bg-white hover:bg-danger hover:text-white focus-visible:ring-danger-soft focus-visible:ring-offset-white transition-all",
|
|
872
|
+
"danger-ghost": "text-danger bg-white hover:bg-danger-light focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
873
|
+
// Utility variants
|
|
874
|
+
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
875
|
+
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
876
|
+
},
|
|
877
|
+
size: {
|
|
878
|
+
xs: "h-6 w-6",
|
|
879
|
+
sm: "h-8 w-8",
|
|
880
|
+
md: "h-10 w-10",
|
|
881
|
+
lg: "h-12 w-12",
|
|
882
|
+
xl: "h-14 w-14"
|
|
883
|
+
},
|
|
884
|
+
shape: {
|
|
885
|
+
rounded: "rounded-md",
|
|
886
|
+
square: "rounded-sm",
|
|
887
|
+
circle: "rounded-full"
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
defaultVariants: {
|
|
891
|
+
variant: "primary",
|
|
892
|
+
size: "md",
|
|
893
|
+
shape: "rounded"
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
), ButtonIcon = React__default.forwardRef(
|
|
897
|
+
function({
|
|
898
|
+
className: t,
|
|
899
|
+
variant: r = "primary",
|
|
900
|
+
size: s = "md",
|
|
901
|
+
shape: n = "rounded",
|
|
902
|
+
disabled: o = !1,
|
|
903
|
+
as: i,
|
|
904
|
+
"aria-label": a,
|
|
905
|
+
...u
|
|
906
|
+
}, c) {
|
|
907
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
ref: c,
|
|
911
|
+
type: "button",
|
|
912
|
+
className: cn(
|
|
913
|
+
buttonIconVariants({
|
|
914
|
+
variant: r,
|
|
915
|
+
size: s,
|
|
916
|
+
shape: n
|
|
917
|
+
}),
|
|
918
|
+
t
|
|
919
|
+
),
|
|
920
|
+
disabled: o,
|
|
921
|
+
"aria-disabled": o,
|
|
922
|
+
"aria-label": a,
|
|
923
|
+
inert: o ? !0 : void 0,
|
|
924
|
+
...u,
|
|
925
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
926
|
+
Icon,
|
|
927
|
+
{
|
|
928
|
+
as: i,
|
|
929
|
+
size: s,
|
|
930
|
+
color: getIconColorFromVariant(r)
|
|
931
|
+
}
|
|
932
|
+
)
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
), calculatorRootVariants = cva(
|
|
937
|
+
"flex flex-col w-full max-w-xs rounded-lg bg-background",
|
|
938
|
+
{
|
|
939
|
+
variants: {
|
|
940
|
+
disabled: {
|
|
941
|
+
true: "opacity-60 pointer-events-none",
|
|
942
|
+
false: ""
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
defaultVariants: {
|
|
946
|
+
disabled: !1
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
), calculatorButtonVariants = cva(
|
|
950
|
+
"flex-1 min-w-0 h-12 m-0.5 rounded text-lg font-medium transition-colors select-none",
|
|
951
|
+
{
|
|
952
|
+
variants: {
|
|
953
|
+
variant: {
|
|
954
|
+
default: "bg-neutral text-foreground hover:bg-neutral-soft hover:text-neutral",
|
|
955
|
+
action: "bg-primary text-white hover:bg-primary-soft hover:text-primary",
|
|
956
|
+
operator: "bg-secondary text-white hover:bg-secondary-soft hover:text-secondary",
|
|
957
|
+
danger: "bg-danger text-white hover:bg-danger-soft hover:text-danger"
|
|
958
|
+
},
|
|
959
|
+
disabled: {
|
|
960
|
+
true: "opacity-50 pointer-events-none",
|
|
961
|
+
false: ""
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
defaultVariants: {
|
|
965
|
+
variant: "default",
|
|
966
|
+
disabled: !1
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
), CalculatorButton = forwardRef(({ variant: e = "default", className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
970
|
+
"button",
|
|
971
|
+
{
|
|
972
|
+
ref: s,
|
|
973
|
+
type: "button",
|
|
974
|
+
className: cn(
|
|
975
|
+
calculatorButtonVariants({ variant: e, disabled: r.disabled }),
|
|
976
|
+
t
|
|
977
|
+
),
|
|
978
|
+
...r
|
|
979
|
+
}
|
|
980
|
+
));
|
|
981
|
+
function useCalculator({
|
|
982
|
+
initialValue = "",
|
|
983
|
+
disabled,
|
|
984
|
+
onChange
|
|
985
|
+
}) {
|
|
986
|
+
const [input, setInput] = useState(String(initialValue)), inputRef = useRef(null);
|
|
987
|
+
useEffect(() => {
|
|
988
|
+
setInput(String(initialValue));
|
|
989
|
+
}, [initialValue]);
|
|
990
|
+
const evaluate = useCallback((expr) => {
|
|
991
|
+
try {
|
|
992
|
+
if (!/^[-+*/.\d\s]+$/.test(expr)) return "";
|
|
993
|
+
const result = eval(expr);
|
|
994
|
+
return result?.toString() ?? "";
|
|
995
|
+
} catch {
|
|
996
|
+
return "";
|
|
997
|
+
}
|
|
998
|
+
}, []), handleButton = useCallback(
|
|
999
|
+
(e) => {
|
|
1000
|
+
if (!disabled)
|
|
1001
|
+
if (e === "C")
|
|
1002
|
+
setInput("");
|
|
1003
|
+
else if (e === "⌫")
|
|
1004
|
+
setInput((t) => t.slice(0, -1));
|
|
1005
|
+
else if (e === "=") {
|
|
1006
|
+
const t = evaluate(input);
|
|
1007
|
+
setInput(t);
|
|
1008
|
+
} else
|
|
1009
|
+
setInput((t) => t + e);
|
|
1010
|
+
},
|
|
1011
|
+
[disabled, input, evaluate]
|
|
1012
|
+
);
|
|
1013
|
+
useEffect(() => {
|
|
1014
|
+
if (onChange) {
|
|
1015
|
+
const e = evaluate(input);
|
|
1016
|
+
onChange(e);
|
|
1017
|
+
}
|
|
1018
|
+
}, [evaluate, input, onChange]), useEffect(() => {
|
|
1019
|
+
if (disabled) return;
|
|
1020
|
+
const e = (t) => {
|
|
1021
|
+
if (document.activeElement !== inputRef.current && document.activeElement?.tagName !== "BODY")
|
|
1022
|
+
return;
|
|
1023
|
+
const r = t.key;
|
|
1024
|
+
r === "Enter" || r === "=" ? (handleButton("="), t.preventDefault()) : r === "Backspace" ? (handleButton("⌫"), t.preventDefault()) : r === "Escape" || r === "C" || r === "c" ? (handleButton("C"), t.preventDefault()) : (/^[0-9]$/.test(r) || ["/", "*", "-", "+", "."].includes(r)) && (handleButton(r), t.preventDefault());
|
|
1025
|
+
};
|
|
1026
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1027
|
+
}, [handleButton, disabled]), useEffect(() => {
|
|
1028
|
+
disabled || inputRef.current?.focus();
|
|
1029
|
+
}, [disabled]);
|
|
1030
|
+
const handleInput = (e) => {
|
|
1031
|
+
const t = e.target.value.replace(/[^\d+\-*/.]/g, "");
|
|
1032
|
+
setInput(t);
|
|
1033
|
+
};
|
|
1034
|
+
return {
|
|
1035
|
+
input,
|
|
1036
|
+
inputRef,
|
|
1037
|
+
handleButton,
|
|
1038
|
+
handleInput
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
const BUTTONS = [
|
|
1042
|
+
["7", "8", "9", "/"],
|
|
1043
|
+
["4", "5", "6", "*"],
|
|
1044
|
+
["1", "2", "3", "-"],
|
|
1045
|
+
["0", ".", "=", "+"]
|
|
1046
|
+
], Calculator = forwardRef(
|
|
1047
|
+
({
|
|
1048
|
+
initialValue: e = "",
|
|
1049
|
+
onChange: t,
|
|
1050
|
+
disabled: r,
|
|
1051
|
+
className: s,
|
|
1052
|
+
"aria-label": n
|
|
1053
|
+
}, o) => {
|
|
1054
|
+
const { input: i, inputRef: a, handleButton: u, handleInput: c } = useCalculator({
|
|
1055
|
+
initialValue: e,
|
|
1056
|
+
disabled: r,
|
|
1057
|
+
onChange: t
|
|
1058
|
+
});
|
|
1059
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1060
|
+
"div",
|
|
1061
|
+
{
|
|
1062
|
+
ref: o,
|
|
1063
|
+
className: cn(calculatorRootVariants({ disabled: r }), s),
|
|
1064
|
+
"aria-label": n || "Calculator",
|
|
1065
|
+
role: "region",
|
|
1066
|
+
children: [
|
|
1067
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1068
|
+
"input",
|
|
1069
|
+
{
|
|
1070
|
+
ref: a,
|
|
1071
|
+
className: "w-full mb-3 px-3 py-2 rounded border border-[var(--color-neutral)] bg-[var(--color-neutral-soft)] text-right text-xl font-mono focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",
|
|
1072
|
+
value: i,
|
|
1073
|
+
onChange: c,
|
|
1074
|
+
disabled: r,
|
|
1075
|
+
inputMode: "decimal",
|
|
1076
|
+
"aria-label": "Calculator input"
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-3", children: BUTTONS.map((x, b) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full", children: x.map((f) => f === "⌫" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1080
|
+
ButtonIcon,
|
|
1081
|
+
{
|
|
1082
|
+
as: X,
|
|
1083
|
+
variant: "danger-ghost",
|
|
1084
|
+
"aria-label": "Backspace",
|
|
1085
|
+
size: "md",
|
|
1086
|
+
onClick: () => u("⌫"),
|
|
1087
|
+
disabled: r
|
|
1088
|
+
},
|
|
1089
|
+
"backspace"
|
|
1090
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1091
|
+
CalculatorButton,
|
|
1092
|
+
{
|
|
1093
|
+
variant: f === "=" ? "action" : f === "C" ? "danger" : ["/", "*", "-", "+", "/"].includes(f) ? "operator" : "default",
|
|
1094
|
+
onClick: () => u(f),
|
|
1095
|
+
disabled: r,
|
|
1096
|
+
"aria-label": f,
|
|
1097
|
+
children: f
|
|
1098
|
+
},
|
|
1099
|
+
f
|
|
1100
|
+
)) }, b)) })
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
Calculator.displayName = "Calculator";
|
|
1107
|
+
const textVariants = cva("", {
|
|
1108
|
+
variants: {
|
|
1109
|
+
color: {
|
|
1110
|
+
primary: "text-primary",
|
|
1111
|
+
secondary: "text-secondary",
|
|
1112
|
+
tertiary: "text-tertiary",
|
|
1113
|
+
ghost: "text-ghost",
|
|
1114
|
+
neutral: "text-ghost",
|
|
1115
|
+
success: "text-success",
|
|
1116
|
+
info: "text-info",
|
|
1117
|
+
warning: "text-warning",
|
|
1118
|
+
danger: "text-danger",
|
|
1119
|
+
inherit: "",
|
|
1120
|
+
gray: "text-gray-500",
|
|
1121
|
+
black: "text-black",
|
|
1122
|
+
white: "text-white"
|
|
1123
|
+
},
|
|
1124
|
+
hasUnderline: {
|
|
1125
|
+
true: "underline",
|
|
1126
|
+
false: ""
|
|
1127
|
+
},
|
|
1128
|
+
isCapitalize: {
|
|
1129
|
+
true: "capitalize",
|
|
1130
|
+
false: ""
|
|
1131
|
+
},
|
|
1132
|
+
align: {
|
|
1133
|
+
left: "text-left",
|
|
1134
|
+
center: "text-center",
|
|
1135
|
+
right: "text-right",
|
|
1136
|
+
justify: "text-justify"
|
|
1137
|
+
},
|
|
1138
|
+
italic: {
|
|
1139
|
+
true: "italic",
|
|
1140
|
+
false: ""
|
|
1141
|
+
},
|
|
1142
|
+
clamp: {
|
|
1143
|
+
1: "line-clamp-1",
|
|
1144
|
+
2: "line-clamp-2",
|
|
1145
|
+
3: "line-clamp-3",
|
|
1146
|
+
4: "line-clamp-4",
|
|
1147
|
+
5: "line-clamp-5",
|
|
1148
|
+
none: ""
|
|
1149
|
+
},
|
|
1150
|
+
ellipsis: {
|
|
1151
|
+
true: "truncate",
|
|
1152
|
+
false: ""
|
|
1153
|
+
},
|
|
1154
|
+
as: {
|
|
1155
|
+
h1: "font-bold text-4xl leading-loose",
|
|
1156
|
+
h2: "font-semibold text-3xl leading-relaxed",
|
|
1157
|
+
h3: "font-medium text-2xl leading-relaxed",
|
|
1158
|
+
h4: "font-bold text-xl leading-normal",
|
|
1159
|
+
h5: "font-semibold text-lg leading-normal",
|
|
1160
|
+
h6: "font-medium text-base leading-normal",
|
|
1161
|
+
p: "font-normal text-base leading-normal",
|
|
1162
|
+
span: "font-normal text-base leading-normal",
|
|
1163
|
+
label: "font-normal text-xs leading-normal"
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
defaultVariants: {
|
|
1167
|
+
color: "neutral",
|
|
1168
|
+
hasUnderline: !1,
|
|
1169
|
+
isCapitalize: !1,
|
|
1170
|
+
align: "left",
|
|
1171
|
+
italic: !1,
|
|
1172
|
+
clamp: "none",
|
|
1173
|
+
ellipsis: !1,
|
|
1174
|
+
as: "span"
|
|
1175
|
+
}
|
|
1176
|
+
}), Text = forwardRef(
|
|
1177
|
+
({
|
|
1178
|
+
as: e = "span",
|
|
1179
|
+
color: t = "ghost",
|
|
1180
|
+
hasUnderline: r = !1,
|
|
1181
|
+
isCapitalize: s = !1,
|
|
1182
|
+
align: n = "left",
|
|
1183
|
+
italic: o = !1,
|
|
1184
|
+
clamp: i = "none",
|
|
1185
|
+
ellipsis: a = !1,
|
|
1186
|
+
fontSize: u,
|
|
1187
|
+
fontWeight: c,
|
|
1188
|
+
className: x,
|
|
1189
|
+
children: b,
|
|
1190
|
+
...f
|
|
1191
|
+
}, w) => {
|
|
1192
|
+
const d = [
|
|
1193
|
+
"h1",
|
|
1194
|
+
"h2",
|
|
1195
|
+
"h3",
|
|
1196
|
+
"h4",
|
|
1197
|
+
"h5",
|
|
1198
|
+
"h6",
|
|
1199
|
+
"p",
|
|
1200
|
+
"span",
|
|
1201
|
+
"label"
|
|
1202
|
+
].includes(e) ? e : "span", v = u ? `text-${u}` : "", p = c ? `font-${c}` : "";
|
|
1203
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1204
|
+
e,
|
|
1205
|
+
{
|
|
1206
|
+
ref: w,
|
|
1207
|
+
className: cn(
|
|
1208
|
+
textVariants({
|
|
1209
|
+
color: t,
|
|
1210
|
+
hasUnderline: r,
|
|
1211
|
+
isCapitalize: s,
|
|
1212
|
+
align: n,
|
|
1213
|
+
italic: o,
|
|
1214
|
+
clamp: i,
|
|
1215
|
+
ellipsis: a,
|
|
1216
|
+
// @ts-expect-error - `as` is not a valid variant
|
|
1217
|
+
as: d
|
|
1218
|
+
}),
|
|
1219
|
+
v,
|
|
1220
|
+
p,
|
|
1221
|
+
x
|
|
1222
|
+
),
|
|
1223
|
+
...f,
|
|
1224
|
+
children: b
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
), CalendarContext = createContext(null);
|
|
1229
|
+
function useCalendarContext() {
|
|
1230
|
+
const e = useContext(CalendarContext);
|
|
1231
|
+
if (!e)
|
|
1232
|
+
throw new Error(
|
|
1233
|
+
"useCalendarContext must be used within CalendarContext.Provider"
|
|
1234
|
+
);
|
|
1235
|
+
return e;
|
|
1236
|
+
}
|
|
1237
|
+
const CalendarHeader = () => {
|
|
1238
|
+
const { value: e, year: t, month: r, setMonth: s } = useCalendarContext();
|
|
1239
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between px-4 pt-4 pb-2", children: [
|
|
1240
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { fontSize: "base", fontWeight: "semibold", className: "ml-2", children: e ? e instanceof Date ? e.toLocaleDateString(void 0, {
|
|
1241
|
+
year: "numeric",
|
|
1242
|
+
month: "long"
|
|
1243
|
+
}) : Array.isArray(e) && e[0] ? e[0].toLocaleDateString(void 0, {
|
|
1244
|
+
year: "numeric",
|
|
1245
|
+
month: "long"
|
|
1246
|
+
}) : `${t} ${new Date(t, r).toLocaleString(void 0, { month: "long" })}` : `${t} ${new Date(t, r).toLocaleString(void 0, { month: "long" })}` }),
|
|
1247
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
1248
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1249
|
+
ButtonIcon,
|
|
1250
|
+
{
|
|
1251
|
+
as: ChevronLeft,
|
|
1252
|
+
variant: "ghost",
|
|
1253
|
+
size: "sm",
|
|
1254
|
+
"aria-label": "Previous month",
|
|
1255
|
+
onClick: () => s(r === 0 ? 11 : r - 1)
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1259
|
+
ButtonIcon,
|
|
1260
|
+
{
|
|
1261
|
+
as: ChevronRight,
|
|
1262
|
+
variant: "ghost",
|
|
1263
|
+
size: "sm",
|
|
1264
|
+
"aria-label": "Next month",
|
|
1265
|
+
onClick: () => s(r === 11 ? 0 : r + 1)
|
|
1266
|
+
}
|
|
1267
|
+
)
|
|
1268
|
+
] })
|
|
1269
|
+
] });
|
|
1270
|
+
}, CalendarWeekdays = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 px-4 text-ghost-500 mb-3", children: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((e) => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { fontSize: "xs", color: "ghost", align: "center", children: e }, e)) }), CalendarDaysSingle = () => {
|
|
1271
|
+
const e = useCalendarContext(), { year: t, month: r, value: s, onChange: n, setMonth: o, setYear: i } = e, a = (g, m) => new Date(g, m + 1, 0).getDate(), c = ((g, m) => new Date(g, m, 1).getDay())(t, r), x = a(t, r), b = r - 1 < 0 ? 11 : r - 1, f = r === 0 ? t - 1 : t, w = a(t, b), y = r === 11 ? 0 : r + 1, d = r === 11 ? t + 1 : t, v = [];
|
|
1272
|
+
for (let g = 0; g < c; g++) {
|
|
1273
|
+
const m = w - c + g + 1;
|
|
1274
|
+
v.push(
|
|
1275
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1276
|
+
ButtonIcon,
|
|
1277
|
+
{
|
|
1278
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: m }),
|
|
1279
|
+
size: "sm",
|
|
1280
|
+
"aria-label": "Previous month day",
|
|
1281
|
+
variant: "ghost",
|
|
1282
|
+
onClick: () => {
|
|
1283
|
+
n?.(new Date(f, b, m)), o(b), i(f);
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
"prev-" + g
|
|
1287
|
+
)
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
for (let g = 1; g <= x; g++) {
|
|
1291
|
+
const m = s instanceof Date && s.getFullYear() === t && s.getMonth() === r && s.getDate() === g;
|
|
1292
|
+
v.push(
|
|
1293
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1294
|
+
ButtonIcon,
|
|
1295
|
+
{
|
|
1296
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1297
|
+
Text,
|
|
1298
|
+
{
|
|
1299
|
+
as: "span",
|
|
1300
|
+
fontSize: "sm",
|
|
1301
|
+
color: m ? "inherit" : "ghost",
|
|
1302
|
+
className: m ? "bg-primary text-white rounded-full" : "",
|
|
1303
|
+
children: g
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
variant: m ? "primary" : "ghost",
|
|
1307
|
+
size: "sm",
|
|
1308
|
+
"aria-label": `Select ${t}-${r + 1}-${g}`,
|
|
1309
|
+
"aria-current": m ? "date" : void 0,
|
|
1310
|
+
onClick: () => {
|
|
1311
|
+
n?.(new Date(t, r, g));
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
g
|
|
1315
|
+
)
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
const p = c + x;
|
|
1319
|
+
for (let g = 0; g < (p % 7 === 0 ? 0 : 7 - p % 7); g++)
|
|
1320
|
+
v.push(
|
|
1321
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1322
|
+
ButtonIcon,
|
|
1323
|
+
{
|
|
1324
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: g + 1 }),
|
|
1325
|
+
size: "sm",
|
|
1326
|
+
"aria-label": "Next month day",
|
|
1327
|
+
variant: "ghost",
|
|
1328
|
+
onClick: () => {
|
|
1329
|
+
n?.(new Date(d, y, g + 1)), o(y), i(d);
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
"next-" + g
|
|
1333
|
+
)
|
|
1334
|
+
);
|
|
1335
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1336
|
+
}, CalendarDaysRange = () => {
|
|
1337
|
+
const { year: e, month: t, value: r, onChange: s, setMonth: n, setYear: o } = useCalendarContext(), i = (l, h) => new Date(l, h + 1, 0).getDate(), u = ((l, h) => new Date(l, h, 1).getDay())(e, t), c = i(e, t), x = t - 1 < 0 ? 11 : t - 1, b = t === 0 ? e - 1 : e, f = i(e, x), w = t === 11 ? 0 : t + 1, y = t === 11 ? e + 1 : e, d = [], v = () => {
|
|
1338
|
+
if (!Array.isArray(r)) return [null, null];
|
|
1339
|
+
const [l, h] = r;
|
|
1340
|
+
return !l && !h ? [null, null] : l && h ? l <= h ? [l, h] : [h, l] : [l, h];
|
|
1341
|
+
}, [p, g] = v(), m = (l) => {
|
|
1342
|
+
if (!p || !g) return !1;
|
|
1343
|
+
const h = new Date(e, t, l);
|
|
1344
|
+
return h >= p && h <= g;
|
|
1345
|
+
}, D = (l) => p ? p.getFullYear() === e && p.getMonth() === t && p.getDate() === l : !1, N = (l) => g ? g.getFullYear() === e && g.getMonth() === t && g.getDate() === l : !1;
|
|
1346
|
+
for (let l = 0; l < u; l++) {
|
|
1347
|
+
const h = f - u + l + 1;
|
|
1348
|
+
d.push(
|
|
1349
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1350
|
+
ButtonIcon,
|
|
1351
|
+
{
|
|
1352
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: h }),
|
|
1353
|
+
size: "sm",
|
|
1354
|
+
"aria-label": "Previous month day",
|
|
1355
|
+
variant: "ghost",
|
|
1356
|
+
onClick: () => {
|
|
1357
|
+
s?.([null, null]), n(x), o(b);
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
"prev-" + l
|
|
1361
|
+
)
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
for (let l = 1; l <= c; l++) {
|
|
1365
|
+
const h = m(l), C = D(l), E = N(l);
|
|
1366
|
+
d.push(
|
|
1367
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1368
|
+
ButtonIcon,
|
|
1369
|
+
{
|
|
1370
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1371
|
+
Text,
|
|
1372
|
+
{
|
|
1373
|
+
as: "span",
|
|
1374
|
+
fontSize: "sm",
|
|
1375
|
+
color: h || C || E ? "inherit" : "ghost",
|
|
1376
|
+
className: cn(
|
|
1377
|
+
h && " bg-primary text-white",
|
|
1378
|
+
C && "rounded-l-full bg-primary text-white",
|
|
1379
|
+
E && "rounded-r-full bg-primary text-white"
|
|
1380
|
+
),
|
|
1381
|
+
children: l
|
|
1382
|
+
}
|
|
1383
|
+
),
|
|
1384
|
+
variant: C || E || h ? "primary" : "ghost",
|
|
1385
|
+
size: "sm",
|
|
1386
|
+
"aria-label": `Select ${e}-${t + 1}-${l}`,
|
|
1387
|
+
"aria-current": C || E ? "date" : void 0,
|
|
1388
|
+
onClick: () => {
|
|
1389
|
+
if (!Array.isArray(r) || !r[0] || r[0] && r[1])
|
|
1390
|
+
s?.([new Date(e, t, l), null]);
|
|
1391
|
+
else if (r[0] && !r[1]) {
|
|
1392
|
+
const j = r[0], R = new Date(e, t, l);
|
|
1393
|
+
j.getTime() === R.getTime() ? s?.([j, R]) : s?.(j < R ? [j, R] : [R, j]);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
l
|
|
1398
|
+
)
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
const S = u + c;
|
|
1402
|
+
for (let l = 0; l < (S % 7 === 0 ? 0 : 7 - S % 7); l++)
|
|
1403
|
+
d.push(
|
|
1404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1405
|
+
ButtonIcon,
|
|
1406
|
+
{
|
|
1407
|
+
as: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", color: "tertiary", children: l + 1 }),
|
|
1408
|
+
size: "sm",
|
|
1409
|
+
"aria-label": "Next month day",
|
|
1410
|
+
variant: "ghost",
|
|
1411
|
+
onClick: () => {
|
|
1412
|
+
s?.([null, null]), n(w), o(y);
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
"next-" + l
|
|
1416
|
+
)
|
|
1417
|
+
);
|
|
1418
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: d });
|
|
1419
|
+
}, CalendarDays = () => {
|
|
1420
|
+
const { type: e } = useCalendarContext();
|
|
1421
|
+
return e === "range" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDaysRange, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDaysSingle, {});
|
|
1422
|
+
};
|
|
1423
|
+
function useCalendar({
|
|
1424
|
+
value: e,
|
|
1425
|
+
type: t,
|
|
1426
|
+
onChange: r,
|
|
1427
|
+
initialYear: s,
|
|
1428
|
+
initialMonth: n
|
|
1429
|
+
}) {
|
|
1430
|
+
const [o, i] = useState(n), [a, u] = useState(s), [c, x] = useState([
|
|
1431
|
+
null,
|
|
1432
|
+
null
|
|
1433
|
+
]);
|
|
1434
|
+
let b = e;
|
|
1435
|
+
t === "range" && !e && (b = c);
|
|
1436
|
+
const f = useCallback(() => {
|
|
1437
|
+
const d = o === 0 ? 11 : o - 1, v = o === 0 ? a - 1 : a;
|
|
1438
|
+
i(d), u(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1439
|
+
}, [o, a, t, r]), w = useCallback(() => {
|
|
1440
|
+
const d = o === 11 ? 0 : o + 1, v = o === 11 ? a + 1 : a;
|
|
1441
|
+
i(d), u(v), t === "single" && r?.(new Date(v, d, 1));
|
|
1442
|
+
}, [o, a, t, r]), y = useCallback(
|
|
1443
|
+
(d) => {
|
|
1444
|
+
t === "single" ? r?.(d) : t === "range" && (x(d), r?.(d));
|
|
1445
|
+
},
|
|
1446
|
+
[t, r]
|
|
1447
|
+
);
|
|
1448
|
+
return {
|
|
1449
|
+
year: a,
|
|
1450
|
+
month: o,
|
|
1451
|
+
value: b,
|
|
1452
|
+
setMonth: i,
|
|
1453
|
+
setYear: u,
|
|
1454
|
+
onChange: y,
|
|
1455
|
+
handlePrevMonth: f,
|
|
1456
|
+
handleNextMonth: w
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
const CalendarRoot = ({
|
|
1460
|
+
value: e,
|
|
1461
|
+
onChange: t,
|
|
1462
|
+
className: r,
|
|
1463
|
+
type: s = "single",
|
|
1464
|
+
...n
|
|
1465
|
+
}) => {
|
|
1466
|
+
const o = /* @__PURE__ */ new Date(), i = useCalendar({
|
|
1467
|
+
value: e,
|
|
1468
|
+
onChange: t,
|
|
1469
|
+
type: s,
|
|
1470
|
+
initialYear: o.getFullYear(),
|
|
1471
|
+
initialMonth: o.getMonth()
|
|
1472
|
+
});
|
|
1473
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1474
|
+
CalendarContext.Provider,
|
|
1475
|
+
{
|
|
1476
|
+
value: {
|
|
1477
|
+
year: i.year,
|
|
1478
|
+
month: i.month,
|
|
1479
|
+
value: i.value,
|
|
1480
|
+
type: s,
|
|
1481
|
+
setMonth: i.setMonth,
|
|
1482
|
+
setYear: i.setYear,
|
|
1483
|
+
onChange: i.onChange
|
|
1484
|
+
},
|
|
1485
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...n, children: [
|
|
1486
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarHeader, {}),
|
|
1487
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarWeekdays, {}),
|
|
1488
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDays, {})
|
|
1489
|
+
] })
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1492
|
+
}, Calendar = Object.assign(CalendarRoot, {}), TableContext = createContext(null), TableProvider = TableContext.Provider;
|
|
1493
|
+
function useTableContext() {
|
|
1494
|
+
const e = useContext(TableContext);
|
|
1495
|
+
if (!e)
|
|
1496
|
+
throw new Error("Table compound components must be used within <Table>");
|
|
1497
|
+
return e;
|
|
1498
|
+
}
|
|
1499
|
+
const getTableColumnClass = (e) => {
|
|
1500
|
+
if (e < 1 || e > 12)
|
|
1501
|
+
throw new Error("Column span must be between 1 and 12");
|
|
1502
|
+
switch (e) {
|
|
1503
|
+
case 1:
|
|
1504
|
+
return "grid-cols-1";
|
|
1505
|
+
case 2:
|
|
1506
|
+
return "grid-cols-2";
|
|
1507
|
+
case 3:
|
|
1508
|
+
return "grid-cols-3";
|
|
1509
|
+
case 4:
|
|
1510
|
+
return "grid-cols-4";
|
|
1511
|
+
case 5:
|
|
1512
|
+
return "grid-cols-5";
|
|
1513
|
+
case 6:
|
|
1514
|
+
return "grid-cols-6";
|
|
1515
|
+
case 7:
|
|
1516
|
+
return "grid-cols-7";
|
|
1517
|
+
case 8:
|
|
1518
|
+
return "grid-cols-8";
|
|
1519
|
+
case 9:
|
|
1520
|
+
return "grid-cols-9";
|
|
1521
|
+
case 10:
|
|
1522
|
+
return "grid-cols-10";
|
|
1523
|
+
case 11:
|
|
1524
|
+
return "grid-cols-11";
|
|
1525
|
+
case 12:
|
|
1526
|
+
return "grid-cols-12";
|
|
1527
|
+
default:
|
|
1528
|
+
return "grid-cols-2";
|
|
1529
|
+
}
|
|
1530
|
+
}, getRowSpanClass = (e) => {
|
|
1531
|
+
if (e < 1 || e > 12)
|
|
1532
|
+
throw new Error("Column span must be between 1 and 12");
|
|
1533
|
+
switch (e) {
|
|
1534
|
+
case 1:
|
|
1535
|
+
return "col-span-1";
|
|
1536
|
+
case 2:
|
|
1537
|
+
return "col-span-2";
|
|
1538
|
+
case 3:
|
|
1539
|
+
return "col-span-3";
|
|
1540
|
+
case 4:
|
|
1541
|
+
return "col-span-4";
|
|
1542
|
+
case 5:
|
|
1543
|
+
return "col-span-5";
|
|
1544
|
+
case 6:
|
|
1545
|
+
return "col-span-6";
|
|
1546
|
+
case 7:
|
|
1547
|
+
return "col-span-7";
|
|
1548
|
+
case 8:
|
|
1549
|
+
return "col-span-8";
|
|
1550
|
+
case 9:
|
|
1551
|
+
return "col-span-9";
|
|
1552
|
+
case 10:
|
|
1553
|
+
return "col-span-10";
|
|
1554
|
+
case 11:
|
|
1555
|
+
return "col-span-11";
|
|
1556
|
+
case 12:
|
|
1557
|
+
return "col-span-12";
|
|
1558
|
+
default:
|
|
1559
|
+
return "col-span-2";
|
|
1560
|
+
}
|
|
1561
|
+
}, TableHeader = forwardRef(
|
|
1562
|
+
({ children: e, className: t, ...r }, s) => {
|
|
1563
|
+
const { maxColumns: n } = useTableContext();
|
|
1564
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1565
|
+
"div",
|
|
1566
|
+
{
|
|
1567
|
+
role: "rowgroup",
|
|
1568
|
+
className: cn("bg-neutral-soft", t),
|
|
1569
|
+
...r,
|
|
1570
|
+
ref: s,
|
|
1571
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1572
|
+
"div",
|
|
1573
|
+
{
|
|
1574
|
+
role: "row",
|
|
1575
|
+
className: cn("grid gap-4", getTableColumnClass(n)),
|
|
1576
|
+
children: e
|
|
1577
|
+
}
|
|
1578
|
+
)
|
|
1579
|
+
}
|
|
1580
|
+
);
|
|
1581
|
+
}
|
|
1582
|
+
), TableBody = forwardRef(
|
|
1583
|
+
({ children: e, className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "rowgroup", ref: s, className: cn(t), ...r, children: e })
|
|
1584
|
+
), TableFooter = forwardRef(
|
|
1585
|
+
({ children: e, className: t, ...r }, s) => {
|
|
1586
|
+
const { maxColumns: n } = useTableContext();
|
|
1587
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1588
|
+
"div",
|
|
1589
|
+
{
|
|
1590
|
+
role: "rowgroup",
|
|
1591
|
+
className: cn("bg-neutral-soft", t),
|
|
1592
|
+
...r,
|
|
1593
|
+
ref: s,
|
|
1594
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1595
|
+
"div",
|
|
1596
|
+
{
|
|
1597
|
+
role: "row",
|
|
1598
|
+
className: cn("grid gap-4", getTableColumnClass(n)),
|
|
1599
|
+
children: e
|
|
1600
|
+
}
|
|
1601
|
+
)
|
|
1602
|
+
}
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
), TableRow = forwardRef(
|
|
1606
|
+
({ children: e, className: t, ...r }, s) => {
|
|
1607
|
+
const { maxColumns: n } = useTableContext();
|
|
1608
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1609
|
+
"div",
|
|
1610
|
+
{
|
|
1611
|
+
role: "row",
|
|
1612
|
+
className: cn(
|
|
1613
|
+
"grid gap-4",
|
|
1614
|
+
getTableColumnClass(n),
|
|
1615
|
+
"border-b border-border last:border-0",
|
|
1616
|
+
t
|
|
1617
|
+
),
|
|
1618
|
+
ref: s,
|
|
1619
|
+
...r,
|
|
1620
|
+
children: e
|
|
1621
|
+
}
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
), TableColumn = forwardRef(
|
|
1625
|
+
({ as: e = "td", span: t, align: r = "left", children: s, className: n, ...o }, i) => {
|
|
1626
|
+
const a = e === "th" ? "columnheader" : "cell";
|
|
1627
|
+
let u = "text-left";
|
|
1628
|
+
return r === "center" ? u = "text-center" : r === "right" && (u = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1629
|
+
"div",
|
|
1630
|
+
{
|
|
1631
|
+
ref: i,
|
|
1632
|
+
role: a,
|
|
1633
|
+
className: cn(
|
|
1634
|
+
"px-4 py-2",
|
|
1635
|
+
"[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
|
|
1636
|
+
getRowSpanClass(t),
|
|
1637
|
+
u,
|
|
1638
|
+
n
|
|
1639
|
+
),
|
|
1640
|
+
...o,
|
|
1641
|
+
children: s
|
|
1642
|
+
}
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
), TableRoot = forwardRef(
|
|
1646
|
+
({ children: e, className: t, maxColumns: r = 12, ...s }, n) => {
|
|
1647
|
+
const o = useMemo(
|
|
1648
|
+
() => ({ maxColumns: r }),
|
|
1649
|
+
[r]
|
|
1650
|
+
);
|
|
1651
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableProvider, { value: o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1652
|
+
"div",
|
|
1653
|
+
{
|
|
1654
|
+
ref: n,
|
|
1655
|
+
role: "table",
|
|
1656
|
+
className: cn(
|
|
1657
|
+
"w-full overflow-x-auto rounded-lg border border-border",
|
|
1658
|
+
t
|
|
1659
|
+
),
|
|
1660
|
+
...s,
|
|
1661
|
+
children: e
|
|
1662
|
+
}
|
|
1663
|
+
) });
|
|
1664
|
+
}
|
|
1665
|
+
), Table = Object.assign(TableRoot, {
|
|
1666
|
+
Header: TableHeader,
|
|
1667
|
+
Body: TableBody,
|
|
1668
|
+
Footer: TableFooter,
|
|
1669
|
+
Row: TableRow,
|
|
1670
|
+
Column: TableColumn
|
|
1671
|
+
}), tileVariants = cva(
|
|
1672
|
+
// Base classes
|
|
1673
|
+
"block transition-colors duration-200",
|
|
1674
|
+
{
|
|
1675
|
+
variants: {
|
|
1676
|
+
variant: {
|
|
1677
|
+
white: "bg-white border border-border",
|
|
1678
|
+
neutral: "bg-neutral border border-gray-200",
|
|
1679
|
+
primary: "bg-primary-soft border border-primary",
|
|
1680
|
+
secondary: "bg-secondary-soft border border-secondary",
|
|
1681
|
+
tertiary: "bg-tertiary-soft border border-tertiary",
|
|
1682
|
+
ghost: "bg-transparent border border-ghost",
|
|
1683
|
+
success: "bg-success-soft border border-success",
|
|
1684
|
+
info: "bg-info-soft border border-info",
|
|
1685
|
+
warning: "bg-warning-soft border border-warning",
|
|
1686
|
+
danger: "bg-danger-soft border border-danger"
|
|
1687
|
+
},
|
|
1688
|
+
size: {
|
|
1689
|
+
xs: "p-2",
|
|
1690
|
+
sm: "p-3",
|
|
1691
|
+
md: "p-4",
|
|
1692
|
+
lg: "p-6",
|
|
1693
|
+
xl: "p-8"
|
|
1694
|
+
},
|
|
1695
|
+
shape: {
|
|
1696
|
+
rounded: "rounded-lg",
|
|
1697
|
+
square: "rounded-none"
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
defaultVariants: {
|
|
1701
|
+
variant: "white",
|
|
1702
|
+
size: "md",
|
|
1703
|
+
shape: "rounded"
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
), Tile = forwardRef(
|
|
1707
|
+
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...n }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1708
|
+
"div",
|
|
1709
|
+
{
|
|
1710
|
+
ref: o,
|
|
1711
|
+
className: cn(tileVariants({ variant: e, size: t, shape: r }), s),
|
|
1712
|
+
...n
|
|
1713
|
+
}
|
|
1714
|
+
)
|
|
1715
|
+
);
|
|
1716
|
+
function getColSpan(e = 4) {
|
|
1717
|
+
switch (e) {
|
|
1718
|
+
case 1:
|
|
1719
|
+
return "col-span-1";
|
|
1720
|
+
case 2:
|
|
1721
|
+
return "col-span-2";
|
|
1722
|
+
case 3:
|
|
1723
|
+
return "col-span-3";
|
|
1724
|
+
case 4:
|
|
1725
|
+
return "col-span-4";
|
|
1726
|
+
case 5:
|
|
1727
|
+
return "col-span-5";
|
|
1728
|
+
case 6:
|
|
1729
|
+
return "col-span-6";
|
|
1730
|
+
case 7:
|
|
1731
|
+
return "col-span-7";
|
|
1732
|
+
case 8:
|
|
1733
|
+
return "col-span-8";
|
|
1734
|
+
case 9:
|
|
1735
|
+
return "col-span-9";
|
|
1736
|
+
case 10:
|
|
1737
|
+
return "col-span-10";
|
|
1738
|
+
case 11:
|
|
1739
|
+
return "col-span-11";
|
|
1740
|
+
case 12:
|
|
1741
|
+
return "col-span-12";
|
|
1742
|
+
default:
|
|
1743
|
+
return "col-span-4";
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
const DescriptionListItem = forwardRef(function e({ children: t, className: r, span: s = 4, ...n }, o) {
|
|
1747
|
+
const i = getColSpan(s);
|
|
1748
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: o, className: cn(i, r), ...n, children: t });
|
|
1749
|
+
}), DescriptionListTerm = forwardRef(function e({ children: t, ...r }, s) {
|
|
1750
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { ref: s, ...r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "sm", fontWeight: "medium", color: "gray", children: t }) });
|
|
1751
|
+
}), DescriptionListDetails = forwardRef(function e({ children: t, color: r = "black", ...s }, n) {
|
|
1752
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { ref: n, ...s, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { as: "span", fontSize: "base", fontWeight: "medium", color: r, children: t }) });
|
|
1753
|
+
}), DescriptionListRoot = forwardRef(
|
|
1754
|
+
function e({ children: t, className: r, ...s }, n) {
|
|
1755
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1756
|
+
"dl",
|
|
1757
|
+
{
|
|
1758
|
+
ref: n,
|
|
1759
|
+
className: cn("grid grid-cols-12 gap-y-4", r),
|
|
1760
|
+
...s,
|
|
1761
|
+
children: t
|
|
1762
|
+
}
|
|
1763
|
+
);
|
|
1764
|
+
}
|
|
1765
|
+
), DescriptionList = Object.assign(DescriptionListRoot, {
|
|
1766
|
+
Item: DescriptionListItem,
|
|
1767
|
+
Term: DescriptionListTerm,
|
|
1768
|
+
Details: DescriptionListDetails
|
|
1769
|
+
});
|
|
1770
|
+
export {
|
|
1771
|
+
Alert as A,
|
|
1772
|
+
Badge as B,
|
|
1773
|
+
Calculator as C,
|
|
1774
|
+
DescriptionList as D,
|
|
1775
|
+
Icon as I,
|
|
1776
|
+
Table as T,
|
|
1777
|
+
Anchor as a,
|
|
1778
|
+
Avatar as b,
|
|
1779
|
+
Brand as c,
|
|
1780
|
+
Button as d,
|
|
1781
|
+
ButtonFloat as e,
|
|
1782
|
+
ButtonIcon as f,
|
|
1783
|
+
Calendar as g,
|
|
1784
|
+
Text as h,
|
|
1785
|
+
Tile as i
|
|
1786
|
+
};
|