@dimasbaguspm/versaur 0.0.17 → 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-CHRSxXRE.js → bottom-sheet-BRv-oJL-.js} +285 -140
- package/dist/js/{tile-B9bt2AY6.js → description-list-DZQF212Z.js} +639 -629
- package/dist/js/email-input-BIbrfs5q.js +1731 -0
- package/dist/js/feedbacks/index.js +1 -1
- package/dist/js/{form-layout-Dhlv-FZL.js → form-layout-4ASWdXn8.js} +1 -1
- package/dist/js/forms/index.js +14 -17
- package/dist/js/{index-C1uJQB34.js → index-DOdDlCoL.js} +2 -2
- package/dist/js/index.js +46 -45
- package/dist/js/layouts/index.js +1 -1
- package/dist/js/navigation/index.js +1 -1
- package/dist/js/overlays/index.js +4 -5
- package/dist/js/primitive/index.js +14 -12
- package/dist/js/providers/index.js +5 -0
- package/dist/js/{skeleton-QEyPZAuF.js → skeleton-BNZyaRjo.js} +1 -1
- package/dist/js/snackbar-DH8jCh2V.js +50 -0
- package/dist/js/{tabs-DYcTvVao.js → tabs-BbOkYchB.js} +1 -1
- 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-single-input/index.d.ts +2 -1
- package/dist/types/forms/index.d.ts +0 -1
- package/dist/types/forms/price-input/index.d.ts +1 -1
- 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/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 -54
- package/package.json +8 -4
- package/dist/js/email-input-CVyrFzqL.js +0 -1820
- package/dist/js/modal-FqewbVts.js +0 -150
- 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/time-picker-input/time-picker-input.atoms.d.ts +0 -15
|
@@ -1,146 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as cva, j as jsxRuntimeExports, a as cn } from "./index-DOdDlCoL.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React__default, { forwardRef, useState,
|
|
3
|
+
import React__default, { forwardRef, useState, useEffect, useCallback, useRef, createContext, useContext, useMemo } from "react";
|
|
4
4
|
import { X, ChevronLeft, ChevronRight } from "lucide-react";
|
|
5
|
-
const
|
|
6
|
-
"flex flex-col w-full max-w-xs rounded-lg bg-background",
|
|
7
|
-
{
|
|
8
|
-
variants: {
|
|
9
|
-
disabled: {
|
|
10
|
-
true: "opacity-60 pointer-events-none",
|
|
11
|
-
false: ""
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
defaultVariants: {
|
|
15
|
-
disabled: !1
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
), calculatorButtonVariants = cva(
|
|
19
|
-
"flex-1 min-w-0 h-12 m-0.5 rounded text-lg font-medium transition-colors select-none",
|
|
20
|
-
{
|
|
21
|
-
variants: {
|
|
22
|
-
variant: {
|
|
23
|
-
default: "bg-neutral text-foreground hover:bg-neutral-soft hover:text-neutral",
|
|
24
|
-
action: "bg-primary text-white hover:bg-primary-soft hover:text-primary",
|
|
25
|
-
operator: "bg-secondary text-white hover:bg-secondary-soft hover:text-secondary",
|
|
26
|
-
danger: "bg-danger text-white hover:bg-danger-soft hover:text-danger"
|
|
27
|
-
},
|
|
28
|
-
disabled: {
|
|
29
|
-
true: "opacity-50 pointer-events-none",
|
|
30
|
-
false: ""
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
defaultVariants: {
|
|
34
|
-
variant: "default",
|
|
35
|
-
disabled: !1
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
), CalculatorButton = forwardRef(({ variant: e = "default", className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39
|
-
"button",
|
|
40
|
-
{
|
|
41
|
-
ref: s,
|
|
42
|
-
type: "button",
|
|
43
|
-
className: cn(
|
|
44
|
-
calculatorButtonVariants({ variant: e, disabled: r.disabled }),
|
|
45
|
-
t
|
|
46
|
-
),
|
|
47
|
-
...r
|
|
48
|
-
}
|
|
49
|
-
));
|
|
50
|
-
function getIconColorFromVariant(e = "primary") {
|
|
51
|
-
const t = e.split("-");
|
|
52
|
-
if (t.length === 1)
|
|
53
|
-
switch (t[0]) {
|
|
54
|
-
case "ghost":
|
|
55
|
-
case "neutral":
|
|
56
|
-
case "outline":
|
|
57
|
-
return "ghost";
|
|
58
|
-
default:
|
|
59
|
-
return "neutral";
|
|
60
|
-
}
|
|
61
|
-
if (t?.[1] === "outline") return "inherit";
|
|
62
|
-
switch (t[0]) {
|
|
63
|
-
case "primary":
|
|
64
|
-
return "primary";
|
|
65
|
-
case "secondary":
|
|
66
|
-
return "secondary";
|
|
67
|
-
case "tertiary":
|
|
68
|
-
return "tertiary";
|
|
69
|
-
case "ghost":
|
|
70
|
-
return "ghost";
|
|
71
|
-
case "neutral":
|
|
72
|
-
return "ghost";
|
|
73
|
-
case "success":
|
|
74
|
-
return "success";
|
|
75
|
-
case "info":
|
|
76
|
-
return "info";
|
|
77
|
-
case "warning":
|
|
78
|
-
return "warning";
|
|
79
|
-
case "danger":
|
|
80
|
-
return "danger";
|
|
81
|
-
default:
|
|
82
|
-
return "neutral";
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const buttonIconVariants = cva(
|
|
86
|
-
"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",
|
|
87
|
-
{
|
|
88
|
-
variants: {
|
|
89
|
-
variant: {
|
|
90
|
-
// Core variants using Versaur color system
|
|
91
|
-
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
92
|
-
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
93
|
-
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
94
|
-
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
95
|
-
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-soft focus-visible:ring-offset-white shadow-sm",
|
|
96
|
-
// Outline variants
|
|
97
|
-
"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",
|
|
98
|
-
"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",
|
|
99
|
-
"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",
|
|
100
|
-
"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",
|
|
101
|
-
"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",
|
|
102
|
-
// Ghost variants (subtle)
|
|
103
|
-
"primary-ghost": "text-primary bg-white hover:bg-primary-light focus-visible:ring-primary-light focus-visible:ring-offset-white",
|
|
104
|
-
"secondary-ghost": "text-secondary bg-white hover:bg-secondary-light focus-visible:ring-secondary-light focus-visible:ring-offset-white",
|
|
105
|
-
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary-light focus-visible:ring-tertiary-light focus-visible:ring-offset-white",
|
|
106
|
-
"neutral-ghost": "text-foreground bg-white hover:bg-neutral-light focus-visible:ring-foreground-light focus-visible:ring-offset-white",
|
|
107
|
-
// Semantic variants
|
|
108
|
-
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
109
|
-
"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",
|
|
110
|
-
"success-ghost": "text-success bg-white hover:bg-success-light focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
111
|
-
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
112
|
-
"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",
|
|
113
|
-
"info-ghost": "text-info bg-white hover:bg-info-light focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
114
|
-
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
115
|
-
"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",
|
|
116
|
-
"warning-ghost": "text-warning bg-white hover:bg-warning-light focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
117
|
-
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
118
|
-
"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",
|
|
119
|
-
"danger-ghost": "text-danger bg-white hover:bg-danger-light focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
120
|
-
// Utility variants
|
|
121
|
-
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
122
|
-
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
123
|
-
},
|
|
124
|
-
size: {
|
|
125
|
-
xs: "h-6 w-6",
|
|
126
|
-
sm: "h-8 w-8",
|
|
127
|
-
md: "h-10 w-10",
|
|
128
|
-
lg: "h-12 w-12",
|
|
129
|
-
xl: "h-14 w-14"
|
|
130
|
-
},
|
|
131
|
-
shape: {
|
|
132
|
-
rounded: "rounded-md",
|
|
133
|
-
square: "rounded-sm",
|
|
134
|
-
circle: "rounded-full"
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
defaultVariants: {
|
|
138
|
-
variant: "primary",
|
|
139
|
-
size: "md",
|
|
140
|
-
shape: "rounded"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
), iconVariants = cva("inline-flex items-center justify-center", {
|
|
5
|
+
const iconVariants = cva("inline-flex items-center justify-center", {
|
|
144
6
|
variants: {
|
|
145
7
|
size: {
|
|
146
8
|
xs: "w-3 h-3",
|
|
@@ -166,257 +28,16 @@ const buttonIconVariants = cva(
|
|
|
166
28
|
size: "md",
|
|
167
29
|
color: "primary"
|
|
168
30
|
}
|
|
169
|
-
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className:
|
|
31
|
+
}), Icon = React__default.forwardRef(function({ as: t, color: r = "primary", size: s = "md", className: n, ...o }, i) {
|
|
170
32
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
171
33
|
t,
|
|
172
34
|
{
|
|
173
|
-
ref:
|
|
174
|
-
className: iconVariants({ color: r, size: s, className:
|
|
175
|
-
...
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}), ButtonIcon = React__default.forwardRef(
|
|
179
|
-
function({
|
|
180
|
-
className: t,
|
|
181
|
-
variant: r = "primary",
|
|
182
|
-
size: s = "md",
|
|
183
|
-
shape: o = "rounded",
|
|
184
|
-
disabled: n = !1,
|
|
185
|
-
as: a,
|
|
186
|
-
"aria-label": i,
|
|
187
|
-
...u
|
|
188
|
-
}, c) {
|
|
189
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
190
|
-
"button",
|
|
191
|
-
{
|
|
192
|
-
ref: c,
|
|
193
|
-
type: "button",
|
|
194
|
-
className: cn(
|
|
195
|
-
buttonIconVariants({
|
|
196
|
-
variant: r,
|
|
197
|
-
size: s,
|
|
198
|
-
shape: o
|
|
199
|
-
}),
|
|
200
|
-
t
|
|
201
|
-
),
|
|
202
|
-
disabled: n,
|
|
203
|
-
"aria-disabled": n,
|
|
204
|
-
"aria-label": i,
|
|
205
|
-
inert: n ? !0 : void 0,
|
|
206
|
-
...u,
|
|
207
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
208
|
-
Icon,
|
|
209
|
-
{
|
|
210
|
-
as: a,
|
|
211
|
-
size: s,
|
|
212
|
-
color: getIconColorFromVariant(r)
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
function useCalculator({
|
|
220
|
-
initialValue = "",
|
|
221
|
-
disabled,
|
|
222
|
-
onChange
|
|
223
|
-
}) {
|
|
224
|
-
const [input, setInput] = useState(String(initialValue)), inputRef = useRef(null);
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
setInput(String(initialValue));
|
|
227
|
-
}, [initialValue]);
|
|
228
|
-
const evaluate = useCallback((expr) => {
|
|
229
|
-
try {
|
|
230
|
-
if (!/^[-+*/.\d\s]+$/.test(expr)) return "";
|
|
231
|
-
const result = eval(expr);
|
|
232
|
-
return result?.toString() ?? "";
|
|
233
|
-
} catch {
|
|
234
|
-
return "";
|
|
35
|
+
ref: i,
|
|
36
|
+
className: iconVariants({ color: r, size: s, className: n }),
|
|
37
|
+
...o
|
|
235
38
|
}
|
|
236
|
-
}, []), handleButton = useCallback(
|
|
237
|
-
(e) => {
|
|
238
|
-
if (!disabled)
|
|
239
|
-
if (e === "C")
|
|
240
|
-
setInput("");
|
|
241
|
-
else if (e === "⌫")
|
|
242
|
-
setInput((t) => t.slice(0, -1));
|
|
243
|
-
else if (e === "=") {
|
|
244
|
-
const t = evaluate(input);
|
|
245
|
-
setInput(t);
|
|
246
|
-
} else
|
|
247
|
-
setInput((t) => t + e);
|
|
248
|
-
},
|
|
249
|
-
[disabled, input, evaluate]
|
|
250
39
|
);
|
|
251
|
-
|
|
252
|
-
if (onChange) {
|
|
253
|
-
const e = evaluate(input);
|
|
254
|
-
onChange(e);
|
|
255
|
-
}
|
|
256
|
-
}, [evaluate, input, onChange]), useEffect(() => {
|
|
257
|
-
if (disabled) return;
|
|
258
|
-
const e = (t) => {
|
|
259
|
-
if (document.activeElement !== inputRef.current && document.activeElement?.tagName !== "BODY")
|
|
260
|
-
return;
|
|
261
|
-
const r = t.key;
|
|
262
|
-
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());
|
|
263
|
-
};
|
|
264
|
-
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
265
|
-
}, [handleButton, disabled]), useEffect(() => {
|
|
266
|
-
disabled || inputRef.current?.focus();
|
|
267
|
-
}, [disabled]);
|
|
268
|
-
const handleInput = (e) => {
|
|
269
|
-
const t = e.target.value.replace(/[^\d+\-*/.]/g, "");
|
|
270
|
-
setInput(t);
|
|
271
|
-
};
|
|
272
|
-
return {
|
|
273
|
-
input,
|
|
274
|
-
inputRef,
|
|
275
|
-
handleButton,
|
|
276
|
-
handleInput
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
const BUTTONS = [
|
|
280
|
-
["7", "8", "9", "/"],
|
|
281
|
-
["4", "5", "6", "*"],
|
|
282
|
-
["1", "2", "3", "-"],
|
|
283
|
-
["0", ".", "=", "+"]
|
|
284
|
-
], Calculator = forwardRef(
|
|
285
|
-
({
|
|
286
|
-
initialValue: e = "",
|
|
287
|
-
onChange: t,
|
|
288
|
-
disabled: r,
|
|
289
|
-
className: s,
|
|
290
|
-
"aria-label": o
|
|
291
|
-
}, n) => {
|
|
292
|
-
const { input: a, inputRef: i, handleButton: u, handleInput: c } = useCalculator({
|
|
293
|
-
initialValue: e,
|
|
294
|
-
disabled: r,
|
|
295
|
-
onChange: t
|
|
296
|
-
});
|
|
297
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
298
|
-
"div",
|
|
299
|
-
{
|
|
300
|
-
ref: n,
|
|
301
|
-
className: cn(calculatorRootVariants({ disabled: r }), s),
|
|
302
|
-
"aria-label": o || "Calculator",
|
|
303
|
-
role: "region",
|
|
304
|
-
children: [
|
|
305
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
306
|
-
"input",
|
|
307
|
-
{
|
|
308
|
-
ref: i,
|
|
309
|
-
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)]",
|
|
310
|
-
value: a,
|
|
311
|
-
onChange: c,
|
|
312
|
-
disabled: r,
|
|
313
|
-
inputMode: "decimal",
|
|
314
|
-
"aria-label": "Calculator input"
|
|
315
|
-
}
|
|
316
|
-
),
|
|
317
|
-
/* @__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(
|
|
318
|
-
ButtonIcon,
|
|
319
|
-
{
|
|
320
|
-
as: X,
|
|
321
|
-
variant: "danger-ghost",
|
|
322
|
-
"aria-label": "Backspace",
|
|
323
|
-
size: "md",
|
|
324
|
-
onClick: () => u("⌫"),
|
|
325
|
-
disabled: r
|
|
326
|
-
},
|
|
327
|
-
"backspace"
|
|
328
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
329
|
-
CalculatorButton,
|
|
330
|
-
{
|
|
331
|
-
variant: f === "=" ? "action" : f === "C" ? "danger" : ["/", "*", "-", "+", "/"].includes(f) ? "operator" : "default",
|
|
332
|
-
onClick: () => u(f),
|
|
333
|
-
disabled: r,
|
|
334
|
-
"aria-label": f,
|
|
335
|
-
children: f
|
|
336
|
-
},
|
|
337
|
-
f
|
|
338
|
-
)) }, b)) })
|
|
339
|
-
]
|
|
340
|
-
}
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
Calculator.displayName = "Calculator";
|
|
345
|
-
const buttonVariants = cva(
|
|
346
|
-
"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",
|
|
347
|
-
{
|
|
348
|
-
variants: {
|
|
349
|
-
variant: {
|
|
350
|
-
// Core variants using Versaur color system
|
|
351
|
-
primary: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
352
|
-
secondary: "bg-secondary text-white hover:bg-secondary/90 focus-visible:ring-secondary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
353
|
-
tertiary: "bg-tertiary text-white hover:bg-tertiary/90 focus-visible:ring-tertiary-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
354
|
-
ghost: "bg-white text-foreground hover:bg-ghost-soft focus-visible:ring-ghost-soft focus-visible:ring-offset-white",
|
|
355
|
-
neutral: "bg-neutral text-foreground border border-border hover:bg-neutral/80 focus-visible:ring-foreground-soft focus-visible:ring-offset-white shadow-sm",
|
|
356
|
-
// Outline variants
|
|
357
|
-
"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",
|
|
358
|
-
"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",
|
|
359
|
-
"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",
|
|
360
|
-
"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",
|
|
361
|
-
"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",
|
|
362
|
-
// Ghost variants (subtle)
|
|
363
|
-
"primary-ghost": "text-primary bg-white hover:bg-primary-light focus-visible:ring-primary-light focus-visible:ring-offset-white",
|
|
364
|
-
"secondary-ghost": "text-secondary bg-white hover:bg-secondary-light focus-visible:ring-secondary-light focus-visible:ring-offset-white",
|
|
365
|
-
"tertiary-ghost": "text-tertiary bg-white hover:bg-tertiary-light focus-visible:ring-tertiary-light focus-visible:ring-offset-white",
|
|
366
|
-
"neutral-ghost": "text-foreground bg-white hover:bg-neutral/70 focus-visible:ring-foreground-soft focus-visible:ring-offset-white",
|
|
367
|
-
// Semantic variants
|
|
368
|
-
success: "bg-success text-white hover:bg-success/90 focus-visible:ring-success-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
369
|
-
"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",
|
|
370
|
-
"success-ghost": "text-success bg-white hover:bg-success-light focus-visible:ring-success-light focus-visible:ring-offset-white",
|
|
371
|
-
info: "bg-info text-white hover:bg-info/90 focus-visible:ring-info-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
372
|
-
"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",
|
|
373
|
-
"info-ghost": "text-info bg-white hover:bg-info-light focus-visible:ring-info-light focus-visible:ring-offset-white",
|
|
374
|
-
warning: "bg-warning text-white hover:bg-warning/90 focus-visible:ring-warning-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
375
|
-
"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",
|
|
376
|
-
"warning-ghost": "text-warning bg-white hover:bg-warning-light focus-visible:ring-warning-light focus-visible:ring-offset-white",
|
|
377
|
-
danger: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md",
|
|
378
|
-
"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",
|
|
379
|
-
"danger-ghost": "text-danger bg-white hover:bg-danger-light focus-visible:ring-danger-light focus-visible:ring-offset-white",
|
|
380
|
-
// Utility variants
|
|
381
|
-
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white transition-all",
|
|
382
|
-
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white shadow-sm hover:shadow-md"
|
|
383
|
-
},
|
|
384
|
-
size: {
|
|
385
|
-
sm: "h-8 px-3 text-sm min-w-[2.25rem]",
|
|
386
|
-
md: "h-10 px-4 text-sm min-w-[2.5rem]",
|
|
387
|
-
lg: "h-12 px-8 text-lg min-w-[2.75rem]"
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
defaultVariants: {
|
|
391
|
-
variant: "primary",
|
|
392
|
-
size: "md"
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
), Button = React__default.forwardRef(
|
|
396
|
-
function e({
|
|
397
|
-
className: t,
|
|
398
|
-
variant: r = "primary",
|
|
399
|
-
size: s = "md",
|
|
400
|
-
disabled: o = !1,
|
|
401
|
-
type: n = "button",
|
|
402
|
-
children: a,
|
|
403
|
-
...i
|
|
404
|
-
}, u) {
|
|
405
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
406
|
-
"button",
|
|
407
|
-
{
|
|
408
|
-
ref: u,
|
|
409
|
-
type: n,
|
|
410
|
-
className: cn(buttonVariants({ variant: r, size: s }), t),
|
|
411
|
-
disabled: o,
|
|
412
|
-
"aria-disabled": o,
|
|
413
|
-
inert: o ? !0 : void 0,
|
|
414
|
-
...i,
|
|
415
|
-
children: a
|
|
416
|
-
}
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
), alertVariants = cva(
|
|
40
|
+
}), alertVariants = cva(
|
|
420
41
|
"relative flex items-center gap-2 rounded-md p-2 text-sm transition-all duration-200",
|
|
421
42
|
{
|
|
422
43
|
variants: {
|
|
@@ -559,18 +180,18 @@ const buttonVariants = cva(
|
|
|
559
180
|
color: t = "neutral",
|
|
560
181
|
icon: r,
|
|
561
182
|
className: s,
|
|
562
|
-
children:
|
|
563
|
-
...
|
|
564
|
-
},
|
|
183
|
+
children: n,
|
|
184
|
+
...o
|
|
185
|
+
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
565
186
|
"div",
|
|
566
187
|
{
|
|
567
|
-
ref:
|
|
188
|
+
ref: i,
|
|
568
189
|
role: "alert",
|
|
569
190
|
className: cn(alertVariants({ variant: e, color: t }), s),
|
|
570
|
-
...
|
|
191
|
+
...o,
|
|
571
192
|
children: [
|
|
572
193
|
r && /* @__PURE__ */ jsxRuntimeExports.jsx(AlertIcon, { children: r }),
|
|
573
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children:
|
|
194
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: n })
|
|
574
195
|
]
|
|
575
196
|
}
|
|
576
197
|
)
|
|
@@ -639,18 +260,18 @@ const buttonVariants = cva(
|
|
|
639
260
|
className: t,
|
|
640
261
|
color: r = "primary",
|
|
641
262
|
fontSize: s = "base",
|
|
642
|
-
fontWeight:
|
|
643
|
-
quiet:
|
|
644
|
-
...
|
|
645
|
-
},
|
|
263
|
+
fontWeight: n = "medium",
|
|
264
|
+
quiet: o = !1,
|
|
265
|
+
...i
|
|
266
|
+
}, a) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
646
267
|
"a",
|
|
647
268
|
{
|
|
648
|
-
ref:
|
|
269
|
+
ref: a,
|
|
649
270
|
className: cn(
|
|
650
|
-
anchorVariants({ color: r, fontSize: s, fontWeight:
|
|
271
|
+
anchorVariants({ color: r, fontSize: s, fontWeight: n, quiet: o }),
|
|
651
272
|
t
|
|
652
273
|
),
|
|
653
|
-
...
|
|
274
|
+
...i,
|
|
654
275
|
children: e
|
|
655
276
|
}
|
|
656
277
|
)
|
|
@@ -698,38 +319,38 @@ const buttonVariants = cva(
|
|
|
698
319
|
size: t = "md",
|
|
699
320
|
shape: r = "circle",
|
|
700
321
|
className: s,
|
|
701
|
-
children:
|
|
702
|
-
...
|
|
703
|
-
},
|
|
322
|
+
children: n,
|
|
323
|
+
...o
|
|
324
|
+
}, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
704
325
|
"div",
|
|
705
326
|
{
|
|
706
|
-
ref:
|
|
327
|
+
ref: i,
|
|
707
328
|
className: cn(avatarVariants({ variant: e, size: t, shape: r }), s),
|
|
708
|
-
...
|
|
709
|
-
children:
|
|
329
|
+
...o,
|
|
330
|
+
children: n
|
|
710
331
|
}
|
|
711
332
|
)
|
|
712
333
|
), AvatarImage = forwardRef(
|
|
713
|
-
({ src: e, alt: t, className: r, onError: s, ...
|
|
714
|
-
const [
|
|
334
|
+
({ src: e, alt: t, className: r, onError: s, ...n }, o) => {
|
|
335
|
+
const [i, a] = useState(!1);
|
|
715
336
|
useEffect(() => {
|
|
716
|
-
|
|
337
|
+
a(!1);
|
|
717
338
|
}, [e]);
|
|
718
339
|
const u = useCallback(
|
|
719
340
|
(c) => {
|
|
720
|
-
|
|
341
|
+
a(!0), s?.(c);
|
|
721
342
|
},
|
|
722
343
|
[s]
|
|
723
344
|
);
|
|
724
|
-
return
|
|
345
|
+
return i ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
725
346
|
"img",
|
|
726
347
|
{
|
|
727
|
-
ref:
|
|
348
|
+
ref: o,
|
|
728
349
|
src: e,
|
|
729
350
|
alt: t,
|
|
730
351
|
className: cn(avatarImageVariants(), r),
|
|
731
352
|
onError: u,
|
|
732
|
-
...
|
|
353
|
+
...n
|
|
733
354
|
}
|
|
734
355
|
);
|
|
735
356
|
}
|
|
@@ -897,13 +518,13 @@ const buttonVariants = cva(
|
|
|
897
518
|
shape: t = "square",
|
|
898
519
|
color: r = "primary",
|
|
899
520
|
size: s = "md",
|
|
900
|
-
iconLeft:
|
|
901
|
-
iconRight:
|
|
902
|
-
className:
|
|
903
|
-
children:
|
|
521
|
+
iconLeft: n,
|
|
522
|
+
iconRight: o,
|
|
523
|
+
className: i,
|
|
524
|
+
children: a,
|
|
904
525
|
...u
|
|
905
526
|
}, c) => {
|
|
906
|
-
const f = !(
|
|
527
|
+
const f = !(a != null && a !== "") && !!(n || o);
|
|
907
528
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
908
529
|
"span",
|
|
909
530
|
{
|
|
@@ -916,64 +537,138 @@ const buttonVariants = cva(
|
|
|
916
537
|
size: s,
|
|
917
538
|
iconOnly: f
|
|
918
539
|
}),
|
|
919
|
-
|
|
540
|
+
i
|
|
920
541
|
),
|
|
921
542
|
...u,
|
|
922
543
|
children: f ? (
|
|
923
544
|
// Icon-only mode: display only the icon
|
|
924
|
-
|
|
545
|
+
n || o
|
|
925
546
|
) : (
|
|
926
547
|
// Normal mode: display icon(s) and text
|
|
927
548
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
549
|
+
n,
|
|
550
|
+
a,
|
|
551
|
+
o
|
|
931
552
|
] })
|
|
932
553
|
)
|
|
933
554
|
}
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
);
|
|
937
|
-
Badge.displayName = "Badge";
|
|
938
|
-
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("", {
|
|
939
|
-
variants: {
|
|
940
|
-
size: {
|
|
941
|
-
xs: "h-6 w-6",
|
|
942
|
-
sm: "h-6 w-6",
|
|
943
|
-
md: "h-8 w-8",
|
|
944
|
-
lg: "h-10 w-10",
|
|
945
|
-
xl: "h-12 w-12"
|
|
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"
|
|
946
646
|
}
|
|
947
|
-
},
|
|
948
|
-
defaultVariants: {
|
|
949
|
-
size: "md"
|
|
950
647
|
}
|
|
951
|
-
|
|
952
|
-
({
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
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) {
|
|
958
658
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
959
|
-
|
|
659
|
+
"button",
|
|
960
660
|
{
|
|
961
|
-
ref:
|
|
962
|
-
|
|
963
|
-
className: cn(
|
|
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
|
|
964
669
|
}
|
|
965
670
|
);
|
|
966
671
|
}
|
|
967
|
-
), Brand = forwardRef(
|
|
968
|
-
({ name: e = "spenicle", size: t = "md", shape: r, ...s }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
969
|
-
"span",
|
|
970
|
-
{
|
|
971
|
-
ref: o,
|
|
972
|
-
className: cn("inline-flex items-center gap-2"),
|
|
973
|
-
...s,
|
|
974
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrandLogo, { shape: r, size: t, "aria-hidden": "true" })
|
|
975
|
-
}
|
|
976
|
-
)
|
|
977
672
|
), buttonFloatVariants = cva(
|
|
978
673
|
[
|
|
979
674
|
"inline-flex items-center justify-center gap-2",
|
|
@@ -1029,82 +724,387 @@ const SvgSpenicleSquare = (e) => /* @__PURE__ */ React.createElement("svg", { wi
|
|
|
1029
724
|
outline: "border border-border text-foreground bg-white hover:bg-accent-soft focus-visible:ring-accent-soft focus-visible:ring-offset-white",
|
|
1030
725
|
destructive: "bg-danger text-white hover:bg-danger/90 focus-visible:ring-danger-soft focus-visible:ring-offset-white"
|
|
1031
726
|
},
|
|
1032
|
-
size: {
|
|
1033
|
-
sm: "h-12 w-12 min-w-12 min-h-12 text-base",
|
|
1034
|
-
md: "h-14 w-14 min-w-14 min-h-14 text-lg",
|
|
1035
|
-
lg: "h-16 w-16 min-w-16 min-h-16 text-xl"
|
|
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: ""
|
|
1036
962
|
}
|
|
1037
963
|
},
|
|
1038
964
|
defaultVariants: {
|
|
1039
|
-
variant: "
|
|
1040
|
-
|
|
965
|
+
variant: "default",
|
|
966
|
+
disabled: !1
|
|
1041
967
|
}
|
|
1042
968
|
}
|
|
1043
|
-
)
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
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);
|
|
1072
1010
|
},
|
|
1073
|
-
[
|
|
1074
|
-
)
|
|
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
|
+
};
|
|
1075
1040
|
}
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
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",
|
|
1093
1061
|
{
|
|
1094
|
-
ref:
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
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
|
+
]
|
|
1104
1102
|
}
|
|
1105
|
-
)
|
|
1103
|
+
);
|
|
1106
1104
|
}
|
|
1107
|
-
)
|
|
1105
|
+
);
|
|
1106
|
+
Calculator.displayName = "Calculator";
|
|
1107
|
+
const textVariants = cva("", {
|
|
1108
1108
|
variants: {
|
|
1109
1109
|
color: {
|
|
1110
1110
|
primary: "text-primary",
|
|
@@ -1179,10 +1179,10 @@ const ButtonFloat = forwardRef(
|
|
|
1179
1179
|
color: t = "ghost",
|
|
1180
1180
|
hasUnderline: r = !1,
|
|
1181
1181
|
isCapitalize: s = !1,
|
|
1182
|
-
align:
|
|
1183
|
-
italic:
|
|
1184
|
-
clamp:
|
|
1185
|
-
ellipsis:
|
|
1182
|
+
align: n = "left",
|
|
1183
|
+
italic: o = !1,
|
|
1184
|
+
clamp: i = "none",
|
|
1185
|
+
ellipsis: a = !1,
|
|
1186
1186
|
fontSize: u,
|
|
1187
1187
|
fontWeight: c,
|
|
1188
1188
|
className: x,
|
|
@@ -1209,10 +1209,10 @@ const ButtonFloat = forwardRef(
|
|
|
1209
1209
|
color: t,
|
|
1210
1210
|
hasUnderline: r,
|
|
1211
1211
|
isCapitalize: s,
|
|
1212
|
-
align:
|
|
1213
|
-
italic:
|
|
1214
|
-
clamp:
|
|
1215
|
-
ellipsis:
|
|
1212
|
+
align: n,
|
|
1213
|
+
italic: o,
|
|
1214
|
+
clamp: i,
|
|
1215
|
+
ellipsis: a,
|
|
1216
1216
|
// @ts-expect-error - `as` is not a valid variant
|
|
1217
1217
|
as: d
|
|
1218
1218
|
}),
|
|
@@ -1268,7 +1268,7 @@ const CalendarHeader = () => {
|
|
|
1268
1268
|
] })
|
|
1269
1269
|
] });
|
|
1270
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:
|
|
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
1272
|
for (let g = 0; g < c; g++) {
|
|
1273
1273
|
const m = w - c + g + 1;
|
|
1274
1274
|
v.push(
|
|
@@ -1280,7 +1280,7 @@ const CalendarHeader = () => {
|
|
|
1280
1280
|
"aria-label": "Previous month day",
|
|
1281
1281
|
variant: "ghost",
|
|
1282
1282
|
onClick: () => {
|
|
1283
|
-
|
|
1283
|
+
n?.(new Date(f, b, m)), o(b), i(f);
|
|
1284
1284
|
}
|
|
1285
1285
|
},
|
|
1286
1286
|
"prev-" + g
|
|
@@ -1308,7 +1308,7 @@ const CalendarHeader = () => {
|
|
|
1308
1308
|
"aria-label": `Select ${t}-${r + 1}-${g}`,
|
|
1309
1309
|
"aria-current": m ? "date" : void 0,
|
|
1310
1310
|
onClick: () => {
|
|
1311
|
-
|
|
1311
|
+
n?.(new Date(t, r, g));
|
|
1312
1312
|
}
|
|
1313
1313
|
},
|
|
1314
1314
|
g
|
|
@@ -1326,7 +1326,7 @@ const CalendarHeader = () => {
|
|
|
1326
1326
|
"aria-label": "Next month day",
|
|
1327
1327
|
variant: "ghost",
|
|
1328
1328
|
onClick: () => {
|
|
1329
|
-
|
|
1329
|
+
n?.(new Date(d, y, g + 1)), o(y), i(d);
|
|
1330
1330
|
}
|
|
1331
1331
|
},
|
|
1332
1332
|
"next-" + g
|
|
@@ -1334,7 +1334,7 @@ const CalendarHeader = () => {
|
|
|
1334
1334
|
);
|
|
1335
1335
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-7 gap-2 px-4 pb-4", children: v });
|
|
1336
1336
|
}, CalendarDaysRange = () => {
|
|
1337
|
-
const { year: e, month: t, value: r, onChange: s, setMonth:
|
|
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
1338
|
if (!Array.isArray(r)) return [null, null];
|
|
1339
1339
|
const [l, h] = r;
|
|
1340
1340
|
return !l && !h ? [null, null] : l && h ? l <= h ? [l, h] : [h, l] : [l, h];
|
|
@@ -1342,7 +1342,7 @@ const CalendarHeader = () => {
|
|
|
1342
1342
|
if (!p || !g) return !1;
|
|
1343
1343
|
const h = new Date(e, t, l);
|
|
1344
1344
|
return h >= p && h <= g;
|
|
1345
|
-
},
|
|
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
1346
|
for (let l = 0; l < u; l++) {
|
|
1347
1347
|
const h = f - u + l + 1;
|
|
1348
1348
|
d.push(
|
|
@@ -1354,7 +1354,7 @@ const CalendarHeader = () => {
|
|
|
1354
1354
|
"aria-label": "Previous month day",
|
|
1355
1355
|
variant: "ghost",
|
|
1356
1356
|
onClick: () => {
|
|
1357
|
-
s?.([null, null]),
|
|
1357
|
+
s?.([null, null]), n(x), o(b);
|
|
1358
1358
|
}
|
|
1359
1359
|
},
|
|
1360
1360
|
"prev-" + l
|
|
@@ -1362,7 +1362,7 @@ const CalendarHeader = () => {
|
|
|
1362
1362
|
);
|
|
1363
1363
|
}
|
|
1364
1364
|
for (let l = 1; l <= c; l++) {
|
|
1365
|
-
const h = m(l), C =
|
|
1365
|
+
const h = m(l), C = D(l), E = N(l);
|
|
1366
1366
|
d.push(
|
|
1367
1367
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1368
1368
|
ButtonIcon,
|
|
@@ -1409,7 +1409,7 @@ const CalendarHeader = () => {
|
|
|
1409
1409
|
"aria-label": "Next month day",
|
|
1410
1410
|
variant: "ghost",
|
|
1411
1411
|
onClick: () => {
|
|
1412
|
-
s?.([null, null]),
|
|
1412
|
+
s?.([null, null]), n(w), o(y);
|
|
1413
1413
|
}
|
|
1414
1414
|
},
|
|
1415
1415
|
"next-" + l
|
|
@@ -1425,31 +1425,31 @@ function useCalendar({
|
|
|
1425
1425
|
type: t,
|
|
1426
1426
|
onChange: r,
|
|
1427
1427
|
initialYear: s,
|
|
1428
|
-
initialMonth:
|
|
1428
|
+
initialMonth: n
|
|
1429
1429
|
}) {
|
|
1430
|
-
const [
|
|
1430
|
+
const [o, i] = useState(n), [a, u] = useState(s), [c, x] = useState([
|
|
1431
1431
|
null,
|
|
1432
1432
|
null
|
|
1433
1433
|
]);
|
|
1434
1434
|
let b = e;
|
|
1435
1435
|
t === "range" && !e && (b = c);
|
|
1436
1436
|
const f = useCallback(() => {
|
|
1437
|
-
const d =
|
|
1438
|
-
|
|
1439
|
-
}, [
|
|
1440
|
-
const d =
|
|
1441
|
-
|
|
1442
|
-
}, [
|
|
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
1443
|
(d) => {
|
|
1444
1444
|
t === "single" ? r?.(d) : t === "range" && (x(d), r?.(d));
|
|
1445
1445
|
},
|
|
1446
1446
|
[t, r]
|
|
1447
1447
|
);
|
|
1448
1448
|
return {
|
|
1449
|
-
year:
|
|
1450
|
-
month:
|
|
1449
|
+
year: a,
|
|
1450
|
+
month: o,
|
|
1451
1451
|
value: b,
|
|
1452
|
-
setMonth:
|
|
1452
|
+
setMonth: i,
|
|
1453
1453
|
setYear: u,
|
|
1454
1454
|
onChange: y,
|
|
1455
1455
|
handlePrevMonth: f,
|
|
@@ -1461,79 +1461,35 @@ const CalendarRoot = ({
|
|
|
1461
1461
|
onChange: t,
|
|
1462
1462
|
className: r,
|
|
1463
1463
|
type: s = "single",
|
|
1464
|
-
...
|
|
1464
|
+
...n
|
|
1465
1465
|
}) => {
|
|
1466
|
-
const
|
|
1466
|
+
const o = /* @__PURE__ */ new Date(), i = useCalendar({
|
|
1467
1467
|
value: e,
|
|
1468
1468
|
onChange: t,
|
|
1469
1469
|
type: s,
|
|
1470
|
-
initialYear:
|
|
1471
|
-
initialMonth:
|
|
1470
|
+
initialYear: o.getFullYear(),
|
|
1471
|
+
initialMonth: o.getMonth()
|
|
1472
1472
|
});
|
|
1473
1473
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1474
1474
|
CalendarContext.Provider,
|
|
1475
1475
|
{
|
|
1476
1476
|
value: {
|
|
1477
|
-
year:
|
|
1478
|
-
month:
|
|
1479
|
-
value:
|
|
1477
|
+
year: i.year,
|
|
1478
|
+
month: i.month,
|
|
1479
|
+
value: i.value,
|
|
1480
1480
|
type: s,
|
|
1481
|
-
setMonth:
|
|
1482
|
-
setYear:
|
|
1483
|
-
onChange:
|
|
1481
|
+
setMonth: i.setMonth,
|
|
1482
|
+
setYear: i.setYear,
|
|
1483
|
+
onChange: i.onChange
|
|
1484
1484
|
},
|
|
1485
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...
|
|
1485
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("select-none", r), ...n, children: [
|
|
1486
1486
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarHeader, {}),
|
|
1487
1487
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarWeekdays, {}),
|
|
1488
1488
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CalendarDays, {})
|
|
1489
1489
|
] })
|
|
1490
1490
|
}
|
|
1491
1491
|
);
|
|
1492
|
-
}, Calendar = Object.assign(CalendarRoot, {}),
|
|
1493
|
-
"flex items-center gap-2 px-4 py-2 rounded-sm w-fit relative shadow-sm",
|
|
1494
|
-
{
|
|
1495
|
-
variants: {
|
|
1496
|
-
color: {
|
|
1497
|
-
success: "text-success-bold bg-success-soft border-l-4 border-success",
|
|
1498
|
-
info: "text-info-bold bg-info-soft border-l-4 border-info",
|
|
1499
|
-
warning: "text-warning-bold bg-warning-soft border-l-4 border-warning",
|
|
1500
|
-
danger: "text-danger-bold bg-danger-soft border-l-4 border-danger"
|
|
1501
|
-
}
|
|
1502
|
-
},
|
|
1503
|
-
defaultVariants: {
|
|
1504
|
-
color: "success"
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
), SnackbarText = ({
|
|
1508
|
-
children: e,
|
|
1509
|
-
...t
|
|
1510
|
-
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1511
|
-
"span",
|
|
1512
|
-
{
|
|
1513
|
-
className: "flex-1 truncate text-sm",
|
|
1514
|
-
"data-testid": "snackbar-text",
|
|
1515
|
-
...t,
|
|
1516
|
-
children: e
|
|
1517
|
-
}
|
|
1518
|
-
), SnackbarAction = ({
|
|
1519
|
-
children: e,
|
|
1520
|
-
...t
|
|
1521
|
-
}) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", "data-testid": "snackbar-action", ...t, children: e }), Snackbar = forwardRef(
|
|
1522
|
-
({ children: e, action: t, color: r, className: s, ...o }, n) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1523
|
-
"div",
|
|
1524
|
-
{
|
|
1525
|
-
ref: n,
|
|
1526
|
-
role: "status",
|
|
1527
|
-
"aria-live": "polite",
|
|
1528
|
-
className: cn(snackbarVariants({ color: r }), s),
|
|
1529
|
-
...o,
|
|
1530
|
-
children: [
|
|
1531
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SnackbarText, { children: e }),
|
|
1532
|
-
t && /* @__PURE__ */ jsxRuntimeExports.jsx(SnackbarAction, { children: t })
|
|
1533
|
-
]
|
|
1534
|
-
}
|
|
1535
|
-
)
|
|
1536
|
-
), TableContext = createContext(null), TableProvider = TableContext.Provider;
|
|
1492
|
+
}, Calendar = Object.assign(CalendarRoot, {}), TableContext = createContext(null), TableProvider = TableContext.Provider;
|
|
1537
1493
|
function useTableContext() {
|
|
1538
1494
|
const e = useContext(TableContext);
|
|
1539
1495
|
if (!e)
|
|
@@ -1604,7 +1560,7 @@ const getTableColumnClass = (e) => {
|
|
|
1604
1560
|
}
|
|
1605
1561
|
}, TableHeader = forwardRef(
|
|
1606
1562
|
({ children: e, className: t, ...r }, s) => {
|
|
1607
|
-
const { maxColumns:
|
|
1563
|
+
const { maxColumns: n } = useTableContext();
|
|
1608
1564
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1609
1565
|
"div",
|
|
1610
1566
|
{
|
|
@@ -1616,7 +1572,7 @@ const getTableColumnClass = (e) => {
|
|
|
1616
1572
|
"div",
|
|
1617
1573
|
{
|
|
1618
1574
|
role: "row",
|
|
1619
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1575
|
+
className: cn("grid gap-4", getTableColumnClass(n)),
|
|
1620
1576
|
children: e
|
|
1621
1577
|
}
|
|
1622
1578
|
)
|
|
@@ -1627,7 +1583,7 @@ const getTableColumnClass = (e) => {
|
|
|
1627
1583
|
({ children: e, className: t, ...r }, s) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "rowgroup", ref: s, className: cn(t), ...r, children: e })
|
|
1628
1584
|
), TableFooter = forwardRef(
|
|
1629
1585
|
({ children: e, className: t, ...r }, s) => {
|
|
1630
|
-
const { maxColumns:
|
|
1586
|
+
const { maxColumns: n } = useTableContext();
|
|
1631
1587
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1632
1588
|
"div",
|
|
1633
1589
|
{
|
|
@@ -1639,7 +1595,7 @@ const getTableColumnClass = (e) => {
|
|
|
1639
1595
|
"div",
|
|
1640
1596
|
{
|
|
1641
1597
|
role: "row",
|
|
1642
|
-
className: cn("grid gap-4", getTableColumnClass(
|
|
1598
|
+
className: cn("grid gap-4", getTableColumnClass(n)),
|
|
1643
1599
|
children: e
|
|
1644
1600
|
}
|
|
1645
1601
|
)
|
|
@@ -1648,14 +1604,14 @@ const getTableColumnClass = (e) => {
|
|
|
1648
1604
|
}
|
|
1649
1605
|
), TableRow = forwardRef(
|
|
1650
1606
|
({ children: e, className: t, ...r }, s) => {
|
|
1651
|
-
const { maxColumns:
|
|
1607
|
+
const { maxColumns: n } = useTableContext();
|
|
1652
1608
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1653
1609
|
"div",
|
|
1654
1610
|
{
|
|
1655
1611
|
role: "row",
|
|
1656
1612
|
className: cn(
|
|
1657
1613
|
"grid gap-4",
|
|
1658
|
-
getTableColumnClass(
|
|
1614
|
+
getTableColumnClass(n),
|
|
1659
1615
|
"border-b border-border last:border-0",
|
|
1660
1616
|
t
|
|
1661
1617
|
),
|
|
@@ -1666,36 +1622,36 @@ const getTableColumnClass = (e) => {
|
|
|
1666
1622
|
);
|
|
1667
1623
|
}
|
|
1668
1624
|
), TableColumn = forwardRef(
|
|
1669
|
-
({ as: e = "td", span: t, align: r = "left", children: s, className:
|
|
1670
|
-
const
|
|
1625
|
+
({ as: e = "td", span: t, align: r = "left", children: s, className: n, ...o }, i) => {
|
|
1626
|
+
const a = e === "th" ? "columnheader" : "cell";
|
|
1671
1627
|
let u = "text-left";
|
|
1672
1628
|
return r === "center" ? u = "text-center" : r === "right" && (u = "text-right"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1673
1629
|
"div",
|
|
1674
1630
|
{
|
|
1675
|
-
ref:
|
|
1676
|
-
role:
|
|
1631
|
+
ref: i,
|
|
1632
|
+
role: a,
|
|
1677
1633
|
className: cn(
|
|
1678
1634
|
"px-4 py-2",
|
|
1679
1635
|
"[&:not(:last-child)]:border-r [&:not(:last-child)]:border-border",
|
|
1680
1636
|
getRowSpanClass(t),
|
|
1681
1637
|
u,
|
|
1682
|
-
|
|
1638
|
+
n
|
|
1683
1639
|
),
|
|
1684
|
-
...
|
|
1640
|
+
...o,
|
|
1685
1641
|
children: s
|
|
1686
1642
|
}
|
|
1687
1643
|
);
|
|
1688
1644
|
}
|
|
1689
1645
|
), TableRoot = forwardRef(
|
|
1690
|
-
({ children: e, className: t, maxColumns: r = 12, ...s },
|
|
1691
|
-
const
|
|
1646
|
+
({ children: e, className: t, maxColumns: r = 12, ...s }, n) => {
|
|
1647
|
+
const o = useMemo(
|
|
1692
1648
|
() => ({ maxColumns: r }),
|
|
1693
1649
|
[r]
|
|
1694
1650
|
);
|
|
1695
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableProvider, { value:
|
|
1651
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(TableProvider, { value: o, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1696
1652
|
"div",
|
|
1697
1653
|
{
|
|
1698
|
-
ref:
|
|
1654
|
+
ref: n,
|
|
1699
1655
|
role: "table",
|
|
1700
1656
|
className: cn(
|
|
1701
1657
|
"w-full overflow-x-auto rounded-lg border border-border",
|
|
@@ -1748,21 +1704,75 @@ const getTableColumnClass = (e) => {
|
|
|
1748
1704
|
}
|
|
1749
1705
|
}
|
|
1750
1706
|
), Tile = forwardRef(
|
|
1751
|
-
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...
|
|
1707
|
+
({ variant: e = "white", size: t = "md", shape: r = "rounded", className: s, ...n }, o) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1752
1708
|
"div",
|
|
1753
1709
|
{
|
|
1754
|
-
ref:
|
|
1710
|
+
ref: o,
|
|
1755
1711
|
className: cn(tileVariants({ variant: e, size: t, shape: r }), s),
|
|
1756
|
-
...
|
|
1712
|
+
...n
|
|
1757
1713
|
}
|
|
1758
1714
|
)
|
|
1759
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
|
+
});
|
|
1760
1770
|
export {
|
|
1761
1771
|
Alert as A,
|
|
1762
1772
|
Badge as B,
|
|
1763
1773
|
Calculator as C,
|
|
1774
|
+
DescriptionList as D,
|
|
1764
1775
|
Icon as I,
|
|
1765
|
-
Snackbar as S,
|
|
1766
1776
|
Table as T,
|
|
1767
1777
|
Anchor as a,
|
|
1768
1778
|
Avatar as b,
|