@spear-ai/spectral 1.3.10 → 1.3.12

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 (73) 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/loader-circle-Btf6jOd5.js +101 -0
  62. package/dist/main.js +25212 -0
  63. package/dist/primitives/label.js +27 -0
  64. package/dist/primitives/slot.js +40 -0
  65. package/dist/twUtils-CRiPKpXj.js +2743 -0
  66. package/dist/utils/refs.js +10 -0
  67. package/dist/utils/shared.js +29 -0
  68. package/dist/utils/twUtils.js +5 -0
  69. package/package.json +19 -7
  70. package/dist/components/LabelingTools/LabelingTools.d.ts.map +0 -1
  71. package/dist/index.js +0 -9253
  72. package/dist/spectral.cjs.js +0 -83
  73. /package/dist/{components → features}/LabelingTools/LabelingTools.d.ts +0 -0
@@ -0,0 +1,107 @@
1
+ import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
2
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
3
+ import { Badge as s } from "../Badge.js";
4
+ import "../Icons/AnnotationsIcon.js";
5
+ import "../Icons/CalendarIcon.js";
6
+ import "../Icons/ClockIcon.js";
7
+ import { DeleteIcon as c } from "../Icons/DeleteIcon.js";
8
+ import "../Icons/DurationIcon.js";
9
+ import { EraserIcon as m } from "../Icons/EraserIcon.js";
10
+ import "../Icons/GoToFirstIcon.js";
11
+ import "../Icons/GoToLastIcon.js";
12
+ import { LabelIcon as a } from "../Icons/LabelIcon.js";
13
+ import { LassoIcon as h } from "../Icons/LassoIcon.js";
14
+ import { LineToolIcon as p } from "../Icons/LineToolIcon.js";
15
+ import "../Icons/LiveViewIcon.js";
16
+ import "../Icons/LocationIcon.js";
17
+ import { MetadataIcon as f } from "../Icons/MetadataIcon.js";
18
+ import { OntologyIcon as g } from "../Icons/OntologyIcon.js";
19
+ import "../Icons/PlayIcon.js";
20
+ import { PlusIcon as u } from "../Icons/PlusIcon.js";
21
+ import "../Icons/ResetIcon.js";
22
+ import { ScissorsIcon as v } from "../Icons/ScissorsIcon.js";
23
+ import "../Icons/TrashIcon.js";
24
+ import { UndoIcon as b } from "../Icons/UndoIcon.js";
25
+ import "../Icons/ZoomAllIcon.js";
26
+ import "../Icons/ZoomXIcon.js";
27
+ import "../Icons/ZoomYIcon.js";
28
+ import { Toggle as d } from "../Toggle.js";
29
+ import { ToggleGroup as n, ToggleGroupItem as t } from "../ToggleGroup.js";
30
+ import { Tooltip as l, TooltipTrigger as o, TooltipContent as r } from "../Tooltip.js";
31
+ const V = () => /* @__PURE__ */ i("div", { className: "align-center flex gap-4", children: [
32
+ /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ i(n, { type: "single", variant: "outline", children: [
33
+ /* @__PURE__ */ i(l, { children: [
34
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "crosshairs", children: [
35
+ /* @__PURE__ */ e(u, { size: 22 }),
36
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "C" })
37
+ ] }) }),
38
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Crosshairs tool (C)" })
39
+ ] }),
40
+ /* @__PURE__ */ i(l, { children: [
41
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "lasso", children: [
42
+ /* @__PURE__ */ e(h, { size: 22 }),
43
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "L" })
44
+ ] }) }),
45
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Lasso tool (L)" })
46
+ ] }),
47
+ /* @__PURE__ */ i(l, { children: [
48
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "points", children: [
49
+ /* @__PURE__ */ e(p, { size: 22 }),
50
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "P" })
51
+ ] }) }),
52
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Points tool (P)" })
53
+ ] })
54
+ ] }) }),
55
+ /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ i(n, { type: "single", variant: "outline", children: [
56
+ /* @__PURE__ */ i(l, { children: [
57
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "crosshairs", children: [
58
+ /* @__PURE__ */ e(v, { size: 22 }),
59
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "⌘X" })
60
+ ] }) }),
61
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Scissor tool (⌘X)" })
62
+ ] }),
63
+ /* @__PURE__ */ i(l, { children: [
64
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "lasso", children: [
65
+ /* @__PURE__ */ e(a, { size: 22 }),
66
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "⌘T" })
67
+ ] }) }),
68
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Label tool (⌘T)" })
69
+ ] })
70
+ ] }) }),
71
+ /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ i(n, { type: "single", variant: "outline", children: [
72
+ /* @__PURE__ */ i(l, { children: [
73
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "undo", children: [
74
+ /* @__PURE__ */ e(b, { size: 22 }),
75
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "⌘X" })
76
+ ] }) }),
77
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Undo last (⌘X)" })
78
+ ] }),
79
+ /* @__PURE__ */ i(l, { children: [
80
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "delete", children: [
81
+ /* @__PURE__ */ e(c, { size: 22 }),
82
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "⌫" })
83
+ ] }) }),
84
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Delete selected (⌫)" })
85
+ ] }),
86
+ /* @__PURE__ */ i(l, { children: [
87
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ i(t, { value: "clear", children: [
88
+ /* @__PURE__ */ e(m, { size: 22 }),
89
+ /* @__PURE__ */ e(s, { className: "ml-1", children: "⌘⇧A" })
90
+ ] }) }),
91
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Clear (⌘⇧A)" })
92
+ ] })
93
+ ] }) }),
94
+ /* @__PURE__ */ i("div", { className: "flex gap-4", children: [
95
+ /* @__PURE__ */ i(l, { children: [
96
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(f, { size: 22 }) }) }),
97
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Metadata" })
98
+ ] }),
99
+ /* @__PURE__ */ i(l, { children: [
100
+ /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(g, { size: 22 }) }) }),
101
+ /* @__PURE__ */ e(r, { sideOffset: 8, side: "bottom", children: "Ontology" })
102
+ ] })
103
+ ] })
104
+ ] });
105
+ export {
106
+ V as LabelingTools
107
+ };
@@ -0,0 +1,65 @@
1
+ import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
2
+ import { useRef as h, useCallback as g, useEffect as E } from "react";
3
+ const A = (u) => {
4
+ const o = h(null), l = h(null), a = g((t) => {
5
+ if (!t || t === document.body) return window;
6
+ const { overflow: d, overflowY: s } = window.getComputedStyle(t);
7
+ return /(auto|scroll)/.test(d) || /(auto|scroll)/.test(s) ? t : a(t.parentElement);
8
+ }, []);
9
+ return E(() => {
10
+ if (!u.current) return;
11
+ const t = new MutationObserver((d) => {
12
+ d.forEach((s) => {
13
+ if (s.attributeName === "data-state") {
14
+ const e = s.target, f = e.getAttribute("data-state"), w = e.closest("[data-scroll-options]");
15
+ if (!w) return;
16
+ try {
17
+ const i = w.getAttribute("data-scroll-options");
18
+ if (!i) return;
19
+ const v = JSON.parse(i), { autoScroll: p, scrollPadding: T } = v;
20
+ if (p === "never") return;
21
+ const n = a(e);
22
+ if (f === "open") {
23
+ if (p === "mobile" && window.innerHeight >= 768) return;
24
+ n === window ? o.current = window.scrollY : o.current = n.scrollTop, l.current = n, setTimeout(() => {
25
+ if (!e) return;
26
+ const r = e.getBoundingClientRect(), b = 0, m = T;
27
+ if (n === window) {
28
+ const c = window.scrollY + r.top + m - b;
29
+ window.scrollTo({
30
+ top: c,
31
+ behavior: "smooth"
32
+ });
33
+ } else {
34
+ const c = n, S = c.getBoundingClientRect(), C = r.top - S.top;
35
+ c.scrollTo({
36
+ top: c.scrollTop + C + m - b,
37
+ behavior: "smooth"
38
+ });
39
+ }
40
+ }, 100);
41
+ } else f === "closed" && o.current !== null && l.current && setTimeout(() => {
42
+ const r = l.current;
43
+ r === window ? window.scrollTo({
44
+ top: o.current,
45
+ behavior: "smooth"
46
+ }) : r instanceof HTMLElement && r.scrollTo({
47
+ top: o.current,
48
+ behavior: "smooth"
49
+ }), o.current = null, l.current = null;
50
+ }, 100);
51
+ } catch (i) {
52
+ console.error("Error handling accordion scroll:", { error: i });
53
+ }
54
+ }
55
+ });
56
+ });
57
+ return t.observe(u.current, { attributes: !0 }), () => {
58
+ t.disconnect();
59
+ };
60
+ }, [u, a]), g((t) => {
61
+ }, []);
62
+ };
63
+ export {
64
+ A as useAccordionAutoScroll
65
+ };
@@ -0,0 +1,16 @@
1
+ import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
2
+ import { useRef as u, useEffect as o } from "react";
3
+ function i(t) {
4
+ const e = u(null);
5
+ return o(() => {
6
+ const n = (r) => {
7
+ e.current && !e.current.contains(r.target) && t();
8
+ };
9
+ return document.addEventListener("mousedown", n), () => {
10
+ document.removeEventListener("mousedown", n);
11
+ };
12
+ }, [t]), e;
13
+ }
14
+ export {
15
+ i as useOutsideClick
16
+ };
@@ -0,0 +1,19 @@
1
+ import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
2
+ import { useState as n, useEffect as s } from "react";
3
+ const d = (r = "dark") => {
4
+ const [t, m] = n(() => {
5
+ if (typeof window > "u") return r;
6
+ const e = localStorage.getItem("theme");
7
+ return e === "light" || e === "dark" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
8
+ }), o = (e) => {
9
+ m(e);
10
+ }, a = () => {
11
+ o(t === "dark" ? "light" : "dark");
12
+ };
13
+ return s(() => {
14
+ document.documentElement.setAttribute("data-theme", t), localStorage.setItem("theme", t);
15
+ }, [t]), { theme: t, setTheme: o, toggleTheme: a };
16
+ };
17
+ export {
18
+ d as useTheme
19
+ };
@@ -0,0 +1,446 @@
1
+ import * as o from "react";
2
+ import { jsx as y, Fragment as H } from "react/jsx-runtime";
3
+ import * as V from "react-dom";
4
+ import z from "react-dom";
5
+ function S(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
6
+ return function(r) {
7
+ if (e?.(r), n === !1 || !r.defaultPrevented)
8
+ return t?.(r);
9
+ };
10
+ }
11
+ function I(e, t) {
12
+ if (typeof e == "function")
13
+ return e(t);
14
+ e != null && (e.current = t);
15
+ }
16
+ function F(...e) {
17
+ return (t) => {
18
+ let n = !1;
19
+ const s = e.map((r) => {
20
+ const i = I(r, t);
21
+ return !n && typeof i == "function" && (n = !0), i;
22
+ });
23
+ if (n)
24
+ return () => {
25
+ for (let r = 0; r < s.length; r++) {
26
+ const i = s[r];
27
+ typeof i == "function" ? i() : I(e[r], null);
28
+ }
29
+ };
30
+ };
31
+ }
32
+ function w(...e) {
33
+ return o.useCallback(F(...e), e);
34
+ }
35
+ function ge(e, t) {
36
+ const n = o.createContext(t), s = (i) => {
37
+ const { children: u, ...c } = i, l = o.useMemo(() => c, Object.values(c));
38
+ return /* @__PURE__ */ y(n.Provider, { value: l, children: u });
39
+ };
40
+ s.displayName = e + "Provider";
41
+ function r(i) {
42
+ const u = o.useContext(n);
43
+ if (u) return u;
44
+ if (t !== void 0) return t;
45
+ throw new Error(`\`${i}\` must be used within \`${e}\``);
46
+ }
47
+ return [s, r];
48
+ }
49
+ function Oe(e, t = []) {
50
+ let n = [];
51
+ function s(i, u) {
52
+ const c = o.createContext(u), l = n.length;
53
+ n = [...n, u];
54
+ const a = (f) => {
55
+ const { scope: p, children: v, ...E } = f, h = p?.[e]?.[l] || c, P = o.useMemo(() => E, Object.values(E));
56
+ return /* @__PURE__ */ y(h.Provider, { value: P, children: v });
57
+ };
58
+ a.displayName = i + "Provider";
59
+ function d(f, p) {
60
+ const v = p?.[e]?.[l] || c, E = o.useContext(v);
61
+ if (E) return E;
62
+ if (u !== void 0) return u;
63
+ throw new Error(`\`${f}\` must be used within \`${i}\``);
64
+ }
65
+ return [a, d];
66
+ }
67
+ const r = () => {
68
+ const i = n.map((u) => o.createContext(u));
69
+ return function(c) {
70
+ const l = c?.[e] || i;
71
+ return o.useMemo(
72
+ () => ({ [`__scope${e}`]: { ...c, [e]: l } }),
73
+ [c, l]
74
+ );
75
+ };
76
+ };
77
+ return r.scopeName = e, [s, K(r, ...t)];
78
+ }
79
+ function K(...e) {
80
+ const t = e[0];
81
+ if (e.length === 1) return t;
82
+ const n = () => {
83
+ const s = e.map((r) => ({
84
+ useScope: r(),
85
+ scopeName: r.scopeName
86
+ }));
87
+ return function(i) {
88
+ const u = s.reduce((c, { useScope: l, scopeName: a }) => {
89
+ const f = l(i)[`__scope${a}`];
90
+ return { ...c, ...f };
91
+ }, {});
92
+ return o.useMemo(() => ({ [`__scope${t.scopeName}`]: u }), [u]);
93
+ };
94
+ };
95
+ return n.scopeName = t.scopeName, n;
96
+ }
97
+ var b = globalThis?.document ? o.useLayoutEffect : () => {
98
+ }, X = o[" useId ".trim().toString()] || (() => {
99
+ }), Y = 0;
100
+ function Se(e) {
101
+ const [t, n] = o.useState(X());
102
+ return b(() => {
103
+ n((s) => s ?? String(Y++));
104
+ }, [e]), e || (t ? `radix-${t}` : "");
105
+ }
106
+ var Z = o[" useInsertionEffect ".trim().toString()] || b;
107
+ function Re({
108
+ prop: e,
109
+ defaultProp: t,
110
+ onChange: n = () => {
111
+ },
112
+ caller: s
113
+ }) {
114
+ const [r, i, u] = q({
115
+ defaultProp: t,
116
+ onChange: n
117
+ }), c = e !== void 0, l = c ? e : r;
118
+ {
119
+ const d = o.useRef(e !== void 0);
120
+ o.useEffect(() => {
121
+ const f = d.current;
122
+ f !== c && console.warn(
123
+ `${s} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
124
+ ), d.current = c;
125
+ }, [c, s]);
126
+ }
127
+ const a = o.useCallback(
128
+ (d) => {
129
+ if (c) {
130
+ const f = G(d) ? d(e) : d;
131
+ f !== e && u.current?.(f);
132
+ } else
133
+ i(d);
134
+ },
135
+ [c, e, i, u]
136
+ );
137
+ return [l, a];
138
+ }
139
+ function q({
140
+ defaultProp: e,
141
+ onChange: t
142
+ }) {
143
+ const [n, s] = o.useState(e), r = o.useRef(n), i = o.useRef(t);
144
+ return Z(() => {
145
+ i.current = t;
146
+ }, [t]), o.useEffect(() => {
147
+ r.current !== n && (i.current?.(n), r.current = n);
148
+ }, [n, r]), [n, s, i];
149
+ }
150
+ function G(e) {
151
+ return typeof e == "function";
152
+ }
153
+ // @__NO_SIDE_EFFECTS__
154
+ function J(e) {
155
+ const t = /* @__PURE__ */ Q(e), n = o.forwardRef((s, r) => {
156
+ const { children: i, ...u } = s, c = o.Children.toArray(i), l = c.find(ee);
157
+ if (l) {
158
+ const a = l.props.children, d = c.map((f) => f === l ? o.Children.count(a) > 1 ? o.Children.only(null) : o.isValidElement(a) ? a.props.children : null : f);
159
+ return /* @__PURE__ */ y(t, { ...u, ref: r, children: o.isValidElement(a) ? o.cloneElement(a, void 0, d) : null });
160
+ }
161
+ return /* @__PURE__ */ y(t, { ...u, ref: r, children: i });
162
+ });
163
+ return n.displayName = `${e}.Slot`, n;
164
+ }
165
+ // @__NO_SIDE_EFFECTS__
166
+ function Q(e) {
167
+ const t = o.forwardRef((n, s) => {
168
+ const { children: r, ...i } = n;
169
+ if (o.isValidElement(r)) {
170
+ const u = ne(r), c = te(i, r.props);
171
+ return r.type !== o.Fragment && (c.ref = s ? F(s, u) : u), o.cloneElement(r, c);
172
+ }
173
+ return o.Children.count(r) > 1 ? o.Children.only(null) : null;
174
+ });
175
+ return t.displayName = `${e}.SlotClone`, t;
176
+ }
177
+ var W = Symbol("radix.slottable");
178
+ // @__NO_SIDE_EFFECTS__
179
+ function we(e) {
180
+ const t = ({ children: n }) => /* @__PURE__ */ y(H, { children: n });
181
+ return t.displayName = `${e}.Slottable`, t.__radixId = W, t;
182
+ }
183
+ function ee(e) {
184
+ return o.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === W;
185
+ }
186
+ function te(e, t) {
187
+ const n = { ...t };
188
+ for (const s in t) {
189
+ const r = e[s], i = t[s];
190
+ /^on[A-Z]/.test(s) ? r && i ? n[s] = (...c) => {
191
+ const l = i(...c);
192
+ return r(...c), l;
193
+ } : r && (n[s] = r) : s === "style" ? n[s] = { ...r, ...i } : s === "className" && (n[s] = [r, i].filter(Boolean).join(" "));
194
+ }
195
+ return { ...e, ...n };
196
+ }
197
+ function ne(e) {
198
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
199
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
200
+ }
201
+ var re = [
202
+ "a",
203
+ "button",
204
+ "div",
205
+ "form",
206
+ "h2",
207
+ "h3",
208
+ "img",
209
+ "input",
210
+ "label",
211
+ "li",
212
+ "nav",
213
+ "ol",
214
+ "p",
215
+ "select",
216
+ "span",
217
+ "svg",
218
+ "ul"
219
+ ], N = re.reduce((e, t) => {
220
+ const n = /* @__PURE__ */ J(`Primitive.${t}`), s = o.forwardRef((r, i) => {
221
+ const { asChild: u, ...c } = r, l = u ? n : t;
222
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ y(l, { ...c, ref: i });
223
+ });
224
+ return s.displayName = `Primitive.${t}`, { ...e, [t]: s };
225
+ }, {});
226
+ function oe(e, t) {
227
+ e && V.flushSync(() => e.dispatchEvent(t));
228
+ }
229
+ function D(e) {
230
+ const t = o.useRef(e);
231
+ return o.useEffect(() => {
232
+ t.current = e;
233
+ }), o.useMemo(() => (...n) => t.current?.(...n), []);
234
+ }
235
+ function se(e, t = globalThis?.document) {
236
+ const n = D(e);
237
+ o.useEffect(() => {
238
+ const s = (r) => {
239
+ r.key === "Escape" && n(r);
240
+ };
241
+ return t.addEventListener("keydown", s, { capture: !0 }), () => t.removeEventListener("keydown", s, { capture: !0 });
242
+ }, [n, t]);
243
+ }
244
+ var ie = "DismissableLayer", R = "dismissableLayer.update", ce = "dismissableLayer.pointerDownOutside", ae = "dismissableLayer.focusOutside", M, U = o.createContext({
245
+ layers: /* @__PURE__ */ new Set(),
246
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
247
+ branches: /* @__PURE__ */ new Set()
248
+ }), ue = o.forwardRef(
249
+ (e, t) => {
250
+ const {
251
+ disableOutsidePointerEvents: n = !1,
252
+ onEscapeKeyDown: s,
253
+ onPointerDownOutside: r,
254
+ onFocusOutside: i,
255
+ onInteractOutside: u,
256
+ onDismiss: c,
257
+ ...l
258
+ } = e, a = o.useContext(U), [d, f] = o.useState(null), p = d?.ownerDocument ?? globalThis?.document, [, v] = o.useState({}), E = w(t, (m) => f(m)), h = Array.from(a.layers), [P] = [...a.layersWithOutsidePointerEventsDisabled].slice(-1), B = h.indexOf(P), L = d ? h.indexOf(d) : -1, k = a.layersWithOutsidePointerEventsDisabled.size > 0, A = L >= B, j = fe((m) => {
259
+ const C = m.target, T = [...a.branches].some((O) => O.contains(C));
260
+ !A || T || (r?.(m), u?.(m), m.defaultPrevented || c?.());
261
+ }, p), x = me((m) => {
262
+ const C = m.target;
263
+ [...a.branches].some((O) => O.contains(C)) || (i?.(m), u?.(m), m.defaultPrevented || c?.());
264
+ }, p);
265
+ return se((m) => {
266
+ L === a.layers.size - 1 && (s?.(m), !m.defaultPrevented && c && (m.preventDefault(), c()));
267
+ }, p), o.useEffect(() => {
268
+ if (d)
269
+ return n && (a.layersWithOutsidePointerEventsDisabled.size === 0 && (M = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), a.layersWithOutsidePointerEventsDisabled.add(d)), a.layers.add(d), _(), () => {
270
+ n && a.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = M);
271
+ };
272
+ }, [d, p, n, a]), o.useEffect(() => () => {
273
+ d && (a.layers.delete(d), a.layersWithOutsidePointerEventsDisabled.delete(d), _());
274
+ }, [d, a]), o.useEffect(() => {
275
+ const m = () => v({});
276
+ return document.addEventListener(R, m), () => document.removeEventListener(R, m);
277
+ }, []), /* @__PURE__ */ y(
278
+ N.div,
279
+ {
280
+ ...l,
281
+ ref: E,
282
+ style: {
283
+ pointerEvents: k ? A ? "auto" : "none" : void 0,
284
+ ...e.style
285
+ },
286
+ onFocusCapture: S(e.onFocusCapture, x.onFocusCapture),
287
+ onBlurCapture: S(e.onBlurCapture, x.onBlurCapture),
288
+ onPointerDownCapture: S(
289
+ e.onPointerDownCapture,
290
+ j.onPointerDownCapture
291
+ )
292
+ }
293
+ );
294
+ }
295
+ );
296
+ ue.displayName = ie;
297
+ var le = "DismissableLayerBranch", de = o.forwardRef((e, t) => {
298
+ const n = o.useContext(U), s = o.useRef(null), r = w(t, s);
299
+ return o.useEffect(() => {
300
+ const i = s.current;
301
+ if (i)
302
+ return n.branches.add(i), () => {
303
+ n.branches.delete(i);
304
+ };
305
+ }, [n.branches]), /* @__PURE__ */ y(N.div, { ...e, ref: r });
306
+ });
307
+ de.displayName = le;
308
+ function fe(e, t = globalThis?.document) {
309
+ const n = D(e), s = o.useRef(!1), r = o.useRef(() => {
310
+ });
311
+ return o.useEffect(() => {
312
+ const i = (c) => {
313
+ if (c.target && !s.current) {
314
+ let l = function() {
315
+ $(
316
+ ce,
317
+ n,
318
+ a,
319
+ { discrete: !0 }
320
+ );
321
+ };
322
+ const a = { originalEvent: c };
323
+ c.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = l, t.addEventListener("click", r.current, { once: !0 })) : l();
324
+ } else
325
+ t.removeEventListener("click", r.current);
326
+ s.current = !1;
327
+ }, u = window.setTimeout(() => {
328
+ t.addEventListener("pointerdown", i);
329
+ }, 0);
330
+ return () => {
331
+ window.clearTimeout(u), t.removeEventListener("pointerdown", i), t.removeEventListener("click", r.current);
332
+ };
333
+ }, [t, n]), {
334
+ // ensures we check React component tree (not just DOM tree)
335
+ onPointerDownCapture: () => s.current = !0
336
+ };
337
+ }
338
+ function me(e, t = globalThis?.document) {
339
+ const n = D(e), s = o.useRef(!1);
340
+ return o.useEffect(() => {
341
+ const r = (i) => {
342
+ i.target && !s.current && $(ae, n, { originalEvent: i }, {
343
+ discrete: !1
344
+ });
345
+ };
346
+ return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
347
+ }, [t, n]), {
348
+ onFocusCapture: () => s.current = !0,
349
+ onBlurCapture: () => s.current = !1
350
+ };
351
+ }
352
+ function _() {
353
+ const e = new CustomEvent(R);
354
+ document.dispatchEvent(e);
355
+ }
356
+ function $(e, t, n, { discrete: s }) {
357
+ const r = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
358
+ t && r.addEventListener(e, t, { once: !0 }), s ? oe(r, i) : r.dispatchEvent(i);
359
+ }
360
+ var pe = "Portal", ve = o.forwardRef((e, t) => {
361
+ const { container: n, ...s } = e, [r, i] = o.useState(!1);
362
+ b(() => i(!0), []);
363
+ const u = n || r && globalThis?.document?.body;
364
+ return u ? z.createPortal(/* @__PURE__ */ y(N.div, { ...s, ref: t }), u) : null;
365
+ });
366
+ ve.displayName = pe;
367
+ function Ee(e, t) {
368
+ return o.useReducer((n, s) => t[n][s] ?? n, e);
369
+ }
370
+ var ye = (e) => {
371
+ const { present: t, children: n } = e, s = he(t), r = typeof n == "function" ? n({ present: s.isPresent }) : o.Children.only(n), i = w(s.ref, Pe(r));
372
+ return typeof n == "function" || s.isPresent ? o.cloneElement(r, { ref: i }) : null;
373
+ };
374
+ ye.displayName = "Presence";
375
+ function he(e) {
376
+ const [t, n] = o.useState(), s = o.useRef(null), r = o.useRef(e), i = o.useRef("none"), u = e ? "mounted" : "unmounted", [c, l] = Ee(u, {
377
+ mounted: {
378
+ UNMOUNT: "unmounted",
379
+ ANIMATION_OUT: "unmountSuspended"
380
+ },
381
+ unmountSuspended: {
382
+ MOUNT: "mounted",
383
+ ANIMATION_END: "unmounted"
384
+ },
385
+ unmounted: {
386
+ MOUNT: "mounted"
387
+ }
388
+ });
389
+ return o.useEffect(() => {
390
+ const a = g(s.current);
391
+ i.current = c === "mounted" ? a : "none";
392
+ }, [c]), b(() => {
393
+ const a = s.current, d = r.current;
394
+ if (d !== e) {
395
+ const p = i.current, v = g(a);
396
+ e ? l("MOUNT") : v === "none" || a?.display === "none" ? l("UNMOUNT") : l(d && p !== v ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
397
+ }
398
+ }, [e, l]), b(() => {
399
+ if (t) {
400
+ let a;
401
+ const d = t.ownerDocument.defaultView ?? window, f = (v) => {
402
+ const h = g(s.current).includes(CSS.escape(v.animationName));
403
+ if (v.target === t && h && (l("ANIMATION_END"), !r.current)) {
404
+ const P = t.style.animationFillMode;
405
+ t.style.animationFillMode = "forwards", a = d.setTimeout(() => {
406
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = P);
407
+ });
408
+ }
409
+ }, p = (v) => {
410
+ v.target === t && (i.current = g(s.current));
411
+ };
412
+ return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
413
+ d.clearTimeout(a), t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
414
+ };
415
+ } else
416
+ l("ANIMATION_END");
417
+ }, [t, l]), {
418
+ isPresent: ["mounted", "unmountSuspended"].includes(c),
419
+ ref: o.useCallback((a) => {
420
+ s.current = a ? getComputedStyle(a) : null, n(a);
421
+ }, [])
422
+ };
423
+ }
424
+ function g(e) {
425
+ return e?.animationName || "none";
426
+ }
427
+ function Pe(e) {
428
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
429
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
430
+ }
431
+ export {
432
+ ue as D,
433
+ ye as P,
434
+ Se as a,
435
+ ve as b,
436
+ Oe as c,
437
+ w as d,
438
+ N as e,
439
+ S as f,
440
+ J as g,
441
+ we as h,
442
+ ge as i,
443
+ b as j,
444
+ D as k,
445
+ Re as u
446
+ };
@@ -0,0 +1,34 @@
1
+ import { a as O } from "./twUtils-CRiPKpXj.js";
2
+ const m = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, y = O, j = (e, l) => (n) => {
3
+ var u;
4
+ if (l?.variants == null) return y(e, n?.class, n?.className);
5
+ const { variants: r, defaultVariants: d } = l, V = Object.keys(r).map((t) => {
6
+ const a = n?.[t], s = d?.[t];
7
+ if (a === null) return null;
8
+ const i = m(a) || m(s);
9
+ return r[t][i];
10
+ }), v = n && Object.entries(n).reduce((t, a) => {
11
+ let [s, i] = a;
12
+ return i === void 0 || (t[s] = i), t;
13
+ }, {}), N = l == null || (u = l.compoundVariants) === null || u === void 0 ? void 0 : u.reduce((t, a) => {
14
+ let { class: s, className: i, ...f } = a;
15
+ return Object.entries(f).every((C) => {
16
+ let [c, o] = C;
17
+ return Array.isArray(o) ? o.includes({
18
+ ...d,
19
+ ...v
20
+ }[c]) : {
21
+ ...d,
22
+ ...v
23
+ }[c] === o;
24
+ }) ? [
25
+ ...t,
26
+ s,
27
+ i
28
+ ] : t;
29
+ }, []);
30
+ return y(e, V, N, n?.class, n?.className);
31
+ };
32
+ export {
33
+ j as c
34
+ };