@spear-ai/spectral 1.3.9 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/.js +91 -0
  2. package/dist/Accordion/AccordionBase.js +233 -0
  3. package/dist/App.js +8 -0
  4. package/dist/Badge/BadgeBase.js +35 -0
  5. package/dist/Badge.js +7 -0
  6. package/dist/Button.js +99 -0
  7. package/dist/Card.js +35 -0
  8. package/dist/Checkbox/CheckboxBase.js +141 -0
  9. package/dist/Drawer.js +1293 -0
  10. package/dist/Icons/AnnotationsIcon.js +28 -0
  11. package/dist/Icons/CalendarIcon.js +60 -0
  12. package/dist/Icons/ClockIcon.js +40 -0
  13. package/dist/Icons/DeleteIcon.js +32 -0
  14. package/dist/Icons/DurationIcon.js +80 -0
  15. package/dist/Icons/EraserIcon.js +37 -0
  16. package/dist/Icons/GoToFirstIcon.js +40 -0
  17. package/dist/Icons/GoToLastIcon.js +40 -0
  18. package/dist/Icons/IconBase.js +33 -0
  19. package/dist/Icons/LabelIcon.js +27 -0
  20. package/dist/Icons/LassoIcon.js +50 -0
  21. package/dist/Icons/LineToolIcon.js +96 -0
  22. package/dist/Icons/LiveViewIcon.js +70 -0
  23. package/dist/Icons/LocationIcon.js +40 -0
  24. package/dist/Icons/MetadataIcon.js +28 -0
  25. package/dist/Icons/OntologyIcon.js +31 -0
  26. package/dist/Icons/PlayIcon.js +28 -0
  27. package/dist/Icons/PlusIcon.js +27 -0
  28. package/dist/Icons/ResetIcon.js +25 -0
  29. package/dist/Icons/ScissorsIcon.js +36 -0
  30. package/dist/Icons/TrashIcon.js +25 -0
  31. package/dist/Icons/UndoIcon.js +28 -0
  32. package/dist/Icons/ZoomAllIcon.js +28 -0
  33. package/dist/Icons/ZoomXIcon.js +41 -0
  34. package/dist/Icons/ZoomYIcon.js +41 -0
  35. package/dist/Icons/iconTypes.js +2 -0
  36. package/dist/Icons.js +51 -0
  37. package/dist/Label.js +13 -0
  38. package/dist/Popover.js +250 -0
  39. package/dist/RadioGroup/RadioGroupBase.js +254 -0
  40. package/dist/Skeleton.js +10 -0
  41. package/dist/Slider/SliderBase.js +315 -0
  42. package/dist/Slider.js +74 -0
  43. package/dist/Switch/SwitchBase.js +131 -0
  44. package/dist/Switch.js +59 -0
  45. package/dist/Toggle/ToggleBase.js +51 -0
  46. package/dist/Toggle.js +51 -0
  47. package/dist/ToggleGroup/ToggleGroupBase.js +125 -0
  48. package/dist/ToggleGroup.js +53 -0
  49. package/dist/Toolbar.js +13 -0
  50. package/dist/Tooltip/TooltipBase.js +225 -0
  51. package/dist/Tooltip.js +371 -0
  52. package/dist/features/LabelingTools/LabelingTools.d.ts.map +1 -0
  53. package/dist/features/LabelingTools.js +107 -0
  54. package/dist/hooks/useAccordionAutoScroll.js +65 -0
  55. package/dist/hooks/useOutsideClick.js +16 -0
  56. package/dist/hooks/useTheme.js +19 -0
  57. package/dist/index-B7LSgz_k.js +446 -0
  58. package/dist/index-CRBC94ik.js +34 -0
  59. package/dist/index-gg2zpNk0.js +672 -0
  60. package/dist/index-sDEISz8i.js +1558 -0
  61. package/dist/index.d.ts +1 -0
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/loader-circle-Btf6jOd5.js +101 -0
  64. package/dist/main.js +25212 -0
  65. package/dist/primitives/label.js +27 -0
  66. package/dist/primitives/slot.js +40 -0
  67. package/dist/twUtils-CRiPKpXj.js +2743 -0
  68. package/dist/utils/refs.js +10 -0
  69. package/dist/utils/shared.js +29 -0
  70. package/dist/utils/twUtils.js +5 -0
  71. package/package.json +19 -15
  72. package/dist/components/LabelingTools/LabelingTools.d.ts.map +0 -1
  73. package/dist/index.js +0 -8443
  74. package/dist/spectral.cjs.js +0 -83
  75. /package/dist/{components → features}/LabelingTools/LabelingTools.d.ts +0 -0
package/dist/.js ADDED
@@ -0,0 +1,91 @@
1
+ import './assets/main.css'
2
+ import { Badge as p } from "./Badge.js";
3
+ import { Button as n } from "./Button.js";
4
+ import { Card as x } from "./Card.js";
5
+ import { Drawer as I } from "./Drawer.js";
6
+ import { Popover as l, PopoverContent as i, PopoverTrigger as s } from "./Popover.js";
7
+ import { Skeleton as g } from "./Skeleton.js";
8
+ import { Slider as u } from "./Slider.js";
9
+ import { Switch as L } from "./Switch.js";
10
+ import { Toggle as P } from "./Toggle.js";
11
+ import { ToggleGroup as G, ToggleGroupItem as h } from "./ToggleGroup.js";
12
+ import { Toolbar as w } from "./Toolbar.js";
13
+ import { Tooltip as D, TooltipContent as Z, TooltipTrigger as b } from "./Tooltip.js";
14
+ import { default as A, SvgIdContext as O } from "./Icons/IconBase.js";
15
+ import "react";
16
+ import { AnnotationsIcon as F } from "./Icons/AnnotationsIcon.js";
17
+ import { CalendarIcon as R } from "./Icons/CalendarIcon.js";
18
+ import { ClockIcon as V } from "./Icons/ClockIcon.js";
19
+ import { DeleteIcon as Y } from "./Icons/DeleteIcon.js";
20
+ import { DurationIcon as q } from "./Icons/DurationIcon.js";
21
+ import { EraserIcon as H } from "./Icons/EraserIcon.js";
22
+ import { GoToFirstIcon as K } from "./Icons/GoToFirstIcon.js";
23
+ import { GoToLastIcon as Q } from "./Icons/GoToLastIcon.js";
24
+ import { LabelIcon as _ } from "./Icons/LabelIcon.js";
25
+ import { LassoIcon as oo } from "./Icons/LassoIcon.js";
26
+ import { LineToolIcon as eo } from "./Icons/LineToolIcon.js";
27
+ import { LiveViewIcon as po } from "./Icons/LiveViewIcon.js";
28
+ import { LocationIcon as no } from "./Icons/LocationIcon.js";
29
+ import { MetadataIcon as xo } from "./Icons/MetadataIcon.js";
30
+ import { OntologyIcon as Io } from "./Icons/OntologyIcon.js";
31
+ import { PlayIcon as lo } from "./Icons/PlayIcon.js";
32
+ import { PlusIcon as so } from "./Icons/PlusIcon.js";
33
+ import { ResetIcon as go } from "./Icons/ResetIcon.js";
34
+ import { ScissorsIcon as Co } from "./Icons/ScissorsIcon.js";
35
+ import { TrashIcon as vo } from "./Icons/TrashIcon.js";
36
+ import { UndoIcon as So } from "./Icons/UndoIcon.js";
37
+ import { ZoomAllIcon as ho } from "./Icons/ZoomAllIcon.js";
38
+ import { ZoomXIcon as wo } from "./Icons/ZoomXIcon.js";
39
+ import { ZoomYIcon as Do } from "./Icons/ZoomYIcon.js";
40
+ import { useOutsideClick as bo } from "./hooks/useOutsideClick.js";
41
+ import { useTheme as Ao } from "./hooks/useTheme.js";
42
+ import { c as Eo } from "./twUtils-CRiPKpXj.js";
43
+ /* empty css */
44
+ export {
45
+ F as AnnotationsIcon,
46
+ p as Badge,
47
+ n as Button,
48
+ R as CalendarIcon,
49
+ x as Card,
50
+ V as ClockIcon,
51
+ Y as DeleteIcon,
52
+ I as Drawer,
53
+ q as DurationIcon,
54
+ H as EraserIcon,
55
+ K as GoToFirstIcon,
56
+ Q as GoToLastIcon,
57
+ A as IconBase,
58
+ _ as LabelIcon,
59
+ oo as LassoIcon,
60
+ eo as LineToolIcon,
61
+ po as LiveViewIcon,
62
+ no as LocationIcon,
63
+ xo as MetadataIcon,
64
+ Io as OntologyIcon,
65
+ lo as PlayIcon,
66
+ so as PlusIcon,
67
+ l as Popover,
68
+ i as PopoverContent,
69
+ s as PopoverTrigger,
70
+ go as ResetIcon,
71
+ Co as ScissorsIcon,
72
+ g as Skeleton,
73
+ u as Slider,
74
+ O as SvgIdContext,
75
+ L as Switch,
76
+ P as Toggle,
77
+ G as ToggleGroup,
78
+ h as ToggleGroupItem,
79
+ w as Toolbar,
80
+ D as Tooltip,
81
+ Z as TooltipContent,
82
+ b as TooltipTrigger,
83
+ vo as TrashIcon,
84
+ So as UndoIcon,
85
+ ho as ZoomAllIcon,
86
+ wo as ZoomXIcon,
87
+ Do as ZoomYIcon,
88
+ Eo as cn,
89
+ bo as useOutsideClick,
90
+ Ao as useTheme
91
+ };
@@ -0,0 +1,233 @@
1
+ import './assets/main.css'
2
+ import { jsx as C } from "react/jsx-runtime";
3
+ import { Slot as M } from "../primitives/slot.js";
4
+ import { createContext as j, forwardRef as V, useRef as S, useState as O, useCallback as I, useEffect as T, useContext as N, useId as H, useLayoutEffect as L } from "react";
5
+ function D(...v) {
6
+ return v.filter(Boolean).join(" ");
7
+ }
8
+ function P(v) {
9
+ const { value: l, defaultValue: s, onChange: a } = v, [c, d] = O(s), i = l !== void 0, o = i ? l : c, n = I(
10
+ (t) => {
11
+ const b = typeof t == "function" ? t(o) : t;
12
+ i || d(b), a?.(b);
13
+ },
14
+ [i, a, o]
15
+ );
16
+ return [o, n];
17
+ }
18
+ const E = j(null), U = V(
19
+ ({
20
+ className: v,
21
+ children: l,
22
+ type: s = "single",
23
+ value: a,
24
+ defaultValue: c,
25
+ onValueChange: d,
26
+ collapsible: i = !1,
27
+ dir: o = "ltr",
28
+ disabled: n = !1,
29
+ rovingFocus: t = !0,
30
+ ...b
31
+ }, f) => {
32
+ const [m, u] = P({
33
+ value: typeof a == "string" ? a : void 0,
34
+ defaultValue: typeof c == "string" ? c : (Array.isArray(c) && c.length > 0, void 0),
35
+ onChange: (r) => d?.(s === "single" ? r ?? "" : [])
36
+ }), [A, R] = P({
37
+ value: Array.isArray(a) ? a : void 0,
38
+ defaultValue: Array.isArray(c) ? c : [],
39
+ onChange: (r) => d?.(s === "multiple" ? r : "")
40
+ }), w = S([]), [k, y] = O(void 0), F = I(
41
+ (r) => s === "single" ? m === r : A.includes(r),
42
+ [s, m, A]
43
+ ), e = I(
44
+ (r) => {
45
+ if (!n) {
46
+ if (s === "single") {
47
+ m === r ? i && u(void 0) : u(r);
48
+ return;
49
+ }
50
+ R((p) => {
51
+ const h = new Set(p);
52
+ return h.has(r) ? h.delete(r) : h.add(r), Array.from(h);
53
+ });
54
+ }
55
+ },
56
+ [i, n, R, u, s, m]
57
+ ), g = I((r) => (w.current.push(r), () => {
58
+ w.current = w.current.filter((p) => p.value !== r.value);
59
+ }), []);
60
+ T(() => {
61
+ if (k) return;
62
+ const r = w.current.find((p) => !p.disabled);
63
+ r && y(r.value);
64
+ }, [k]);
65
+ const x = {
66
+ type: s,
67
+ dir: o,
68
+ collapsible: i,
69
+ disabled: n,
70
+ itemsRef: w,
71
+ registerItem: g,
72
+ isItemOpen: F,
73
+ toggleItem: e,
74
+ focusValue: t ? k : void 0,
75
+ setFocusValue: (r) => {
76
+ t && y(r);
77
+ }
78
+ };
79
+ return /* @__PURE__ */ C(E.Provider, { value: x, children: /* @__PURE__ */ C("div", { ref: f, className: D("divide-border divide-y", v), ...b, children: l }) });
80
+ }
81
+ );
82
+ U.displayName = "Accordion";
83
+ const $ = j(null), z = V(
84
+ ({ className: v, value: l, disabled: s = !1, children: a, ...c }, d) => {
85
+ const i = N(E);
86
+ if (!i) throw new Error("AccordionItem must be used within Accordion");
87
+ const o = i.isItemOpen(l), n = S(null);
88
+ return T(() => {
89
+ const t = { value: l, disabled: s, triggerRef: n };
90
+ return i.registerItem(t);
91
+ }, [i, l, s]), /* @__PURE__ */ C($.Provider, { value: { value: l, open: o, disabled: s || i.disabled }, children: /* @__PURE__ */ C(
92
+ "div",
93
+ {
94
+ ref: d,
95
+ "data-state": o ? "open" : "closed",
96
+ "data-disabled": s || i.disabled ? "" : void 0,
97
+ className: D("outline-none", v),
98
+ ...c,
99
+ children: a
100
+ }
101
+ ) });
102
+ }
103
+ );
104
+ z.displayName = "AccordionItem";
105
+ const B = V(
106
+ ({ asChild: v, className: l, onClick: s, onKeyDown: a, disabled: c, id: d, ...i }, o) => {
107
+ const n = N(E), t = N($);
108
+ if (!n || !t) throw new Error("AccordionTrigger must be used within AccordionItem");
109
+ const b = d ?? `act-${H()}`, f = c || t.disabled || n.disabled, m = t.open, u = v ? M : "button", A = (e) => {
110
+ if (t && "value" in t) {
111
+ const g = n.itemsRef.current.find((x) => x.value === t.value);
112
+ g && (g.triggerRef.current = e);
113
+ }
114
+ typeof o == "function" ? o(e) : o && "current" in o && (o.current = e);
115
+ }, w = (n.focusValue === void 0 ? !0 : n.focusValue === t.value && !f) ? 0 : -1, k = I(
116
+ (e) => {
117
+ s?.(e), !e.defaultPrevented && (f || (n.toggleItem(t.value), n.setFocusValue(t.value)));
118
+ },
119
+ [f, t.value, s, n]
120
+ ), y = I(
121
+ (e) => {
122
+ const g = n.itemsRef.current.filter((h) => !h.disabled);
123
+ if (!g.length) return;
124
+ const x = g.findIndex((h) => h.value === t.value);
125
+ let r = x;
126
+ e === "first" ? r = 0 : e === "last" ? r = g.length - 1 : e === "prev" ? r = Math.max(0, x - 1) : r = Math.min(g.length - 1, x + 1);
127
+ const p = g[r];
128
+ p && (n.setFocusValue(p.value), p.triggerRef.current?.focus());
129
+ },
130
+ [t.value, n]
131
+ ), F = I(
132
+ (e) => {
133
+ if (a?.(e), !e.defaultPrevented) {
134
+ if (e.key === "Home") {
135
+ e.preventDefault(), y("first");
136
+ return;
137
+ }
138
+ if (e.key === "End") {
139
+ e.preventDefault(), y("last");
140
+ return;
141
+ }
142
+ if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
143
+ e.preventDefault(), y(n.dir === "rtl" ? "next" : "prev");
144
+ return;
145
+ }
146
+ if (e.key === "ArrowDown" || e.key === "ArrowRight") {
147
+ e.preventDefault(), y(n.dir === "rtl" ? "prev" : "next");
148
+ return;
149
+ }
150
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f || n.toggleItem(t.value));
151
+ }
152
+ },
153
+ [f, t.value, y, a, n]
154
+ );
155
+ return /* @__PURE__ */ C(
156
+ u,
157
+ {
158
+ id: b,
159
+ ref: A,
160
+ type: "button",
161
+ "aria-expanded": m,
162
+ "aria-controls": `acc-content-${t.value}`,
163
+ "aria-disabled": f || void 0,
164
+ "data-state": m ? "open" : "closed",
165
+ "data-disabled": f ? "" : void 0,
166
+ tabIndex: w,
167
+ onClick: k,
168
+ onKeyDown: F,
169
+ className: D(
170
+ "flex w-full items-center justify-between py-3 text-left",
171
+ "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
172
+ "disabled:cursor-not-allowed disabled:opacity-50",
173
+ l
174
+ ),
175
+ ...i
176
+ }
177
+ );
178
+ }
179
+ );
180
+ B.displayName = "AccordionTrigger";
181
+ const K = V(
182
+ ({ asChild: v, className: l, forceMount: s, id: a, ...c }, d) => {
183
+ const i = N(E), o = N($);
184
+ if (!i || !o) throw new Error("AccordionContent must be used within AccordionItem");
185
+ const n = o.open, t = a ?? `acc-content-${o.value}`, b = S(null), f = (u) => {
186
+ b.current = u, typeof d == "function" ? d(u) : d && "current" in d && (d.current = u);
187
+ };
188
+ L(() => {
189
+ const u = b.current;
190
+ if (!u) return;
191
+ const A = () => {
192
+ u.style.setProperty("--radix-accordion-content-height", `${u.scrollHeight}px`);
193
+ };
194
+ A();
195
+ const R = new ResizeObserver(A);
196
+ return R.observe(u), () => R.disconnect();
197
+ }, []);
198
+ const m = v ? M : "div";
199
+ return !n && !s ? /* @__PURE__ */ C(
200
+ m,
201
+ {
202
+ id: t,
203
+ role: "region",
204
+ "aria-labelledby": `act-${o.value}`,
205
+ hidden: !0,
206
+ "data-state": "closed",
207
+ "data-disabled": o.disabled || i.disabled ? "" : void 0,
208
+ className: D(l),
209
+ ref: f,
210
+ ...c
211
+ }
212
+ ) : /* @__PURE__ */ C(
213
+ m,
214
+ {
215
+ id: t,
216
+ role: "region",
217
+ "aria-labelledby": `act-${o.value}`,
218
+ "data-state": n ? "open" : "closed",
219
+ "data-disabled": o.disabled || i.disabled ? "" : void 0,
220
+ className: D("overflow-hidden", l),
221
+ ref: f,
222
+ ...c
223
+ }
224
+ );
225
+ }
226
+ );
227
+ K.displayName = "AccordionContent";
228
+ export {
229
+ U as Accordion,
230
+ K as AccordionContent,
231
+ z as AccordionItem,
232
+ B as AccordionTrigger
233
+ };
package/dist/App.js ADDED
@@ -0,0 +1,8 @@
1
+ import './assets/main.css'
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ function p() {
4
+ return /* @__PURE__ */ r("div", { children: "spectral | spear.ai" });
5
+ }
6
+ export {
7
+ p as default
8
+ };
@@ -0,0 +1,35 @@
1
+ import './assets/main.css'
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { Slot as o } from "../primitives/slot.js";
4
+ import { c as n } from "../twUtils-CRiPKpXj.js";
5
+ import { c as s } from "../index-CRBC94ik.js";
6
+ const d = s(
7
+ `inline-flex items-center justify-center rounded-sm border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none
8
+ focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive
9
+ transition-[color,box-shadow] overflow-hidden`,
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "border border-badge-primary-border bg-badge-primary-bg text-text-primary [a&]:hover:bg-badge-primary-bg--hover group-data-[state=on]:bg-badge-primary-bg--active",
14
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
15
+ destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
16
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
17
+ }
18
+ },
19
+ defaultVariants: {
20
+ variant: "default"
21
+ }
22
+ }
23
+ );
24
+ function p({
25
+ className: r,
26
+ variant: e,
27
+ asChild: t = !1,
28
+ ...a
29
+ }) {
30
+ return /* @__PURE__ */ i(t ? o : "span", { "data-slot": "badge", className: n(d({ variant: e }), r), ...a });
31
+ }
32
+ export {
33
+ p as BadgeBase,
34
+ d as badgeVariants
35
+ };
package/dist/Badge.js ADDED
@@ -0,0 +1,7 @@
1
+ import './assets/main.css'
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { BadgeBase as t } from "./Badge/BadgeBase.js";
4
+ const p = ({ children: r, ...o }) => /* @__PURE__ */ e(t, { ...o, children: r });
5
+ export {
6
+ p as Badge
7
+ };
package/dist/Button.js ADDED
@@ -0,0 +1,99 @@
1
+ import './assets/main.css'
2
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
3
+ import { c as u } from "./twUtils-CRiPKpXj.js";
4
+ import { c as f } from "./index-CRBC94ik.js";
5
+ import { forwardRef as v } from "react";
6
+ import { L as h } from "./loader-circle-Btf6jOd5.js";
7
+ const N = f(
8
+ `
9
+ !font-sans flex relative items-center justify-center gap-2 whitespace-nowrap transition-colors cursor-pointer rounded-lg border font-semibold disabled:pointer-events-none
10
+ focus:outline-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0
11
+ `,
12
+ {
13
+ variants: {
14
+ variant: {
15
+ primary: "bg-button-primary-bg text-button-primary-text border-button-primary-border disabled:bg-button-primary-bg--disabled disabled:text-button-primary-text--disabled disabled:border-button-primary-border--disabled",
16
+ secondary: "bg-button-secondary-bg border-button-secondary-border text-button-secondary-text disabled:bg-button-secondary-bg--disabled disabled:text-button-secondary-text--disabled disabled:border-button-secondary-border--disabled",
17
+ outline: "bg-button-outline-bg border-button-outline-border text-button-outline-text disabled:text-button-outline-text--disabled disabled:border-button-outline-border--disabled",
18
+ ghost: "bg-button-ghost-bg border-none text-button-ghost-text hover:bg-button-ghost-bg--hover hover:text-button-ghost-text--hover disabled:text-button-ghost-text--disabled"
19
+ },
20
+ size: {
21
+ default: "py-2 px-6 w-fit",
22
+ icon: "size-9",
23
+ fullWidth: "py-2 px-6 w-full"
24
+ },
25
+ state: {
26
+ default: "",
27
+ error: "bg-button-danger text-button-primary-text transition pointer-events-none",
28
+ loading: "cursor-wait pointer-events-none"
29
+ }
30
+ },
31
+ defaultVariants: {
32
+ variant: "primary",
33
+ state: "default",
34
+ size: "default"
35
+ }
36
+ }
37
+ ), w = v(
38
+ ({
39
+ className: g,
40
+ variant: r,
41
+ label: o,
42
+ endIcon: i,
43
+ state: t,
44
+ errorMessage: a,
45
+ startIcon: d,
46
+ disabled: s,
47
+ type: p = "button",
48
+ dataTestId: c = `button-${r}`,
49
+ size: n,
50
+ ...x
51
+ }, m) => {
52
+ const b = {
53
+ error: {
54
+ primary: "bg-button-danger border-button-danger text-button-primary-text pointer-events-none",
55
+ secondary: "bg-button-danger border-button-danger text-button-secondary-text pointer-events-none",
56
+ outline: "bg-transparent border-button-danger text-button-danger pointer-events-none",
57
+ ghost: "bg-transparent text-button-danger pointer-events-none"
58
+ },
59
+ loading: {
60
+ primary: "bg-button-primary-bg--disabled border-button-primary-border--disabled text-button-primary-text--disabled pointer-events-none",
61
+ secondary: "bg-button-secondary-bg--disabled border-button-secondary-border--disabled text-button-secondary-text--disabled pointer-events-none",
62
+ outline: "bg-button-outline-bg--disabled border-button-outline-border--disabled text-button-outline-text--disabled pointer-events-none",
63
+ ghost: "bg-transparent text-button-ghost-text--disabled pointer-events-none"
64
+ }
65
+ }, y = u(
66
+ N({ variant: r, state: t, size: n }),
67
+ t === "error" && b.error[r || "primary"],
68
+ t === "loading" && b.loading[r || "primary"],
69
+ n,
70
+ g
71
+ );
72
+ return /* @__PURE__ */ l("div", { className: u("flex flex-col justify-items-center", n), children: [
73
+ /* @__PURE__ */ l(
74
+ "button",
75
+ {
76
+ className: y,
77
+ ref: m,
78
+ type: p,
79
+ "aria-disabled": s,
80
+ disabled: s,
81
+ "data-testid": c,
82
+ ...x,
83
+ "data-state": t,
84
+ children: [
85
+ d && /* @__PURE__ */ e("span", { className: "flex pr-2", "aria-hidden": !0, children: d }),
86
+ n === "icon" ? /* @__PURE__ */ e("span", { className: "sr-only", children: o }) : o,
87
+ t === "loading" && /* @__PURE__ */ e(h, { className: "ml-2 animate-spin", size: 16 }),
88
+ i && t !== "loading" && /* @__PURE__ */ e("span", { className: "flex pl-2", "aria-hidden": !0, children: i })
89
+ ]
90
+ }
91
+ ),
92
+ t === "error" && a && /* @__PURE__ */ e("p", { className: "text-danger-100 mt-2 text-xs", role: "alert", "aria-live": "assertive", children: a })
93
+ ] });
94
+ }
95
+ );
96
+ w.displayName = "Button";
97
+ export {
98
+ w as Button
99
+ };
package/dist/Card.js ADDED
@@ -0,0 +1,35 @@
1
+ import './assets/main.css'
2
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
3
+ import { c as a } from "./twUtils-CRiPKpXj.js";
4
+ import { forwardRef as u } from "react";
5
+ import { L as b } from "./loader-circle-Btf6jOd5.js";
6
+ const h = u(
7
+ ({ className: t, title: s, icon: r, width: o = "full", isLoading: i = !1, children: d, ...c }, f) => {
8
+ const l = s || r, m = a(
9
+ "!font-sans shadow-neumorphic-large relative bg-card-bg rounded-2xl p-4.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
10
+ o === "full" ? "w-full" : "w-fit",
11
+ t
12
+ );
13
+ return /* @__PURE__ */ n("div", { ref: f, className: m, "aria-busy": i, ...c, children: [
14
+ i && /* @__PURE__ */ e(
15
+ "div",
16
+ {
17
+ className: "bg-card-bg/50 absolute inset-0 z-10 flex items-center justify-center",
18
+ role: "status",
19
+ "aria-live": "polite",
20
+ "aria-label": "Loading content",
21
+ children: /* @__PURE__ */ e(b, { className: "text-muted-foreground animate-spin", size: 24 })
22
+ }
23
+ ),
24
+ l && /* @__PURE__ */ n("div", { className: a("mb-6 flex items-center", s ? "justify-between" : "justify-end"), children: [
25
+ s && /* @__PURE__ */ e("h3", { className: "text-card-text m-0 min-w-0 flex-1 truncate font-semibold", children: s }),
26
+ r && /* @__PURE__ */ e("div", { className: "size-5 flex-shrink-0 overflow-hidden [&>svg]:size-5", "aria-hidden": "true", children: r })
27
+ ] }),
28
+ /* @__PURE__ */ e("div", { className: a("min-h-40 p-4", l && "pt-0"), children: d })
29
+ ] });
30
+ }
31
+ );
32
+ h.displayName = "Card";
33
+ export {
34
+ h as Card
35
+ };
@@ -0,0 +1,141 @@
1
+ import './assets/main.css'
2
+ import { jsx as m, jsxs as M } from "react/jsx-runtime";
3
+ import { Slot as C } from "../primitives/slot.js";
4
+ import { useControllableState as O, cn as w } from "../utils/shared.js";
5
+ import { createContext as T, forwardRef as E, useRef as V, useId as $, useEffect as y, useCallback as u, useContext as z } from "react";
6
+ const R = T(null);
7
+ function I(r) {
8
+ return r === "indeterminate" ? "indeterminate" : r ? "checked" : "unchecked";
9
+ }
10
+ function A(r) {
11
+ return r === "indeterminate" ? !0 : !r;
12
+ }
13
+ const B = E(
14
+ ({
15
+ asChild: r,
16
+ className: d,
17
+ checked: l,
18
+ defaultChecked: i = !1,
19
+ onCheckedChange: f,
20
+ disabled: n,
21
+ required: h,
22
+ name: b,
23
+ value: p = "on",
24
+ form: N,
25
+ id: j,
26
+ onClick: v,
27
+ onKeyDown: x,
28
+ type: H,
29
+ // oxlint-disable-line no-unused-vars
30
+ ...k
31
+ }, S) => {
32
+ const o = V(null), P = $(), D = j ?? `chk-${P}`, [t, a] = O({
33
+ value: l,
34
+ defaultValue: i,
35
+ onChange: f
36
+ });
37
+ y(() => {
38
+ o.current && (o.current.indeterminate = t === "indeterminate");
39
+ }, [t]), y(() => {
40
+ const e = o.current?.form ?? null;
41
+ if (!e) return;
42
+ const c = () => {
43
+ a(i);
44
+ };
45
+ return e.addEventListener("reset", c), () => e.removeEventListener("reset", c);
46
+ }, [i, a]);
47
+ const g = u(() => {
48
+ const e = o.current;
49
+ if (!e) return;
50
+ e.checked = t === !0, e.indeterminate = t === "indeterminate";
51
+ const c = new Event("change", { bubbles: !0 });
52
+ e.dispatchEvent(c);
53
+ }, [t]), s = u(() => {
54
+ if (n) return;
55
+ const e = A(t);
56
+ a(e), queueMicrotask(() => g());
57
+ }, [n, g, a, t]), L = u(
58
+ (e) => {
59
+ v?.(e), !e.defaultPrevented && s();
60
+ },
61
+ [s, v]
62
+ ), q = u(
63
+ (e) => {
64
+ x?.(e), !e.defaultPrevented && e.key === " " && (e.preventDefault(), s());
65
+ },
66
+ [s, x]
67
+ ), F = r ? C : "button", K = S;
68
+ return /* @__PURE__ */ m(R.Provider, { value: { state: t, disabled: n }, children: /* @__PURE__ */ M(
69
+ F,
70
+ {
71
+ id: D,
72
+ ref: K,
73
+ type: "button",
74
+ role: "checkbox",
75
+ "aria-checked": t === "indeterminate" ? "mixed" : t,
76
+ "aria-disabled": n || void 0,
77
+ "data-state": I(t),
78
+ "data-indeterminate": t === "indeterminate" ? "" : void 0,
79
+ className: w(
80
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center",
81
+ "border-input bg-background rounded-sm border",
82
+ "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
83
+ "disabled:cursor-not-allowed disabled:opacity-50",
84
+ "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
85
+ d
86
+ ),
87
+ onClick: L,
88
+ onKeyDown: q,
89
+ disabled: n,
90
+ ...k,
91
+ children: [
92
+ /* @__PURE__ */ m(
93
+ "input",
94
+ {
95
+ ref: o,
96
+ type: "checkbox",
97
+ name: b,
98
+ value: p,
99
+ required: h,
100
+ disabled: n,
101
+ form: N,
102
+ checked: t === !0,
103
+ readOnly: !0,
104
+ tabIndex: -1,
105
+ "aria-hidden": "true",
106
+ style: {
107
+ position: "absolute",
108
+ opacity: 0,
109
+ width: 0,
110
+ height: 0,
111
+ pointerEvents: "none"
112
+ }
113
+ }
114
+ ),
115
+ k.children
116
+ ]
117
+ }
118
+ ) });
119
+ }
120
+ );
121
+ B.displayName = "Checkbox";
122
+ const G = E(
123
+ ({ asChild: r, className: d, forceMount: l, ...i }, f) => {
124
+ const n = z(R);
125
+ return !n || !(n.state === !0 || n.state === "indeterminate") && !l ? null : /* @__PURE__ */ m(
126
+ r ? C : "span",
127
+ {
128
+ ref: f,
129
+ "data-state": I(n.state),
130
+ "data-indeterminate": n.state === "indeterminate" ? "" : void 0,
131
+ className: w("flex items-center justify-center text-current", d),
132
+ ...i
133
+ }
134
+ );
135
+ }
136
+ );
137
+ G.displayName = "CheckboxIndicator";
138
+ export {
139
+ B as Checkbox,
140
+ G as CheckboxIndicator
141
+ };