@still-forest/canopy 0.28.2 → 0.29.0

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/Table.js DELETED
@@ -1,122 +0,0 @@
1
- import { c as m } from "./calendar.js";
2
- import { j as e } from "./jsx-runtime.js";
3
- import { P as u, e as x, f, g as h } from "./popover.js";
4
- import { c as o } from "./index2.js";
5
- import * as v from "react";
6
- /**
7
- * @license lucide-react v0.525.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
12
- const N = [
13
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
14
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
15
- ], H = m("x", N);
16
- var T = "Separator", l = "horizontal", j = ["horizontal", "vertical"], c = v.forwardRef((t, a) => {
17
- const { decorative: s, orientation: n = l, ...p } = t, i = w(n) ? n : l, b = s ? { role: "none" } : { "aria-orientation": i === "vertical" ? i : void 0, role: "separator" };
18
- return /* @__PURE__ */ e.jsx(
19
- u.div,
20
- {
21
- "data-orientation": i,
22
- ...b,
23
- ...p,
24
- ref: a
25
- }
26
- );
27
- });
28
- c.displayName = T;
29
- function w(t) {
30
- return j.includes(t);
31
- }
32
- var g = c;
33
- const d = ({ children: t, ...a }) => /* @__PURE__ */ e.jsx(x, { ...a, children: t });
34
- d.Trigger = f;
35
- d.Content = h;
36
- function $({
37
- className: t,
38
- orientation: a = "horizontal",
39
- decorative: s = !0,
40
- ...n
41
- }) {
42
- return /* @__PURE__ */ e.jsx(
43
- g,
44
- {
45
- className: o(
46
- "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px",
47
- t
48
- ),
49
- "data-slot": "separator-root",
50
- decorative: s,
51
- orientation: a,
52
- ...n
53
- }
54
- );
55
- }
56
- function P({ className: t, ...a }) {
57
- return /* @__PURE__ */ e.jsx("div", { className: "relative w-full overflow-x-auto", "data-slot": "table-container", children: /* @__PURE__ */ e.jsx("table", { className: o("w-full caption-bottom text-sm", t), "data-slot": "table", ...a }) });
58
- }
59
- function y({ className: t, ...a }) {
60
- return /* @__PURE__ */ e.jsx("thead", { className: o("[&_tr]:border-b", t), "data-slot": "table-header", ...a });
61
- }
62
- function k({ className: t, ...a }) {
63
- return /* @__PURE__ */ e.jsx("tbody", { className: o("[&_tr:last-child]:border-0", t), "data-slot": "table-body", ...a });
64
- }
65
- function R({ className: t, ...a }) {
66
- return /* @__PURE__ */ e.jsx(
67
- "tr",
68
- {
69
- className: o("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", t),
70
- "data-slot": "table-row",
71
- ...a
72
- }
73
- );
74
- }
75
- function O({ className: t, ...a }) {
76
- return /* @__PURE__ */ e.jsx(
77
- "th",
78
- {
79
- className: o(
80
- "h-10 whitespace-nowrap px-2 text-left align-middle font-medium text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
81
- t
82
- ),
83
- "data-slot": "table-head",
84
- ...a
85
- }
86
- );
87
- }
88
- function C({ className: t, ...a }) {
89
- return /* @__PURE__ */ e.jsx(
90
- "td",
91
- {
92
- className: o(
93
- "whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
94
- t
95
- ),
96
- "data-slot": "table-cell",
97
- ...a
98
- }
99
- );
100
- }
101
- function z({ className: t, ...a }) {
102
- return /* @__PURE__ */ e.jsx("caption", { className: o("mt-4 text-muted-foreground text-sm", t), "data-slot": "table-caption", ...a });
103
- }
104
- const r = ({ children: t, ...a }) => /* @__PURE__ */ e.jsx(P, { ...a, children: t });
105
- r.Body = k;
106
- r.Caption = z;
107
- r.Cell = C;
108
- r.Head = O;
109
- r.Header = y;
110
- r.Row = R;
111
- export {
112
- d as P,
113
- $ as S,
114
- r as T,
115
- H as X,
116
- k as a,
117
- z as b,
118
- C as c,
119
- O as d,
120
- y as e,
121
- R as f
122
- };
package/dist/Textarea.js DELETED
@@ -1,491 +0,0 @@
1
- import { j as p } from "./jsx-runtime.js";
2
- import * as l from "react";
3
- import { useState as Ce, useMemo as je } from "react";
4
- import { c as he, b as z, d as Ie } from "./calendar.js";
5
- import { a as L, P as R, R as Re, h as Ne, O as Ae, C as $e, e as Me, g as De, f as Fe } from "./popover.js";
6
- import { c as M } from "./index2.js";
7
- import { h as Pe, L as Le, I as Ke } from "./SelectInput.js";
8
- import { F as Oe } from "./Layout2.js";
9
- import { T as Te } from "./Heading.js";
10
- /**
11
- * @license lucide-react v0.525.0 - ISC
12
- *
13
- * This source code is licensed under the ISC license.
14
- * See the LICENSE file in the root directory of this source tree.
15
- */
16
- const ze = [
17
- ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
18
- ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
19
- ], qe = he("chevrons-up-down", ze);
20
- /**
21
- * @license lucide-react v0.525.0 - ISC
22
- *
23
- * This source code is licensed under the ISC license.
24
- * See the LICENSE file in the root directory of this source tree.
25
- */
26
- const Ve = [
27
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
28
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
29
- ], _e = he("search", Ve);
30
- var fe = 1, Be = 0.9, Ue = 0.8, Ge = 0.17, ee = 0.1, te = 0.999, He = 0.9999, We = 0.99, Je = /[\\\/_+.#"@\[\(\{&]/, Xe = /[\\\/_+.#"@\[\(\{&]/g, Ye = /[\s-]/, ge = /[\s-]/g;
31
- function ne(e, n, r, d, o, u, s) {
32
- if (u === n.length) return o === e.length ? fe : We;
33
- var m = `${o},${u}`;
34
- if (s[m] !== void 0) return s[m];
35
- for (var x = d.charAt(u), a = r.indexOf(x, o), h = 0, g, C, k, j; a >= 0; ) g = ne(e, n, r, d, a + 1, u + 1, s), g > h && (a === o ? g *= fe : Je.test(e.charAt(a - 1)) ? (g *= Ue, k = e.slice(o, a - 1).match(Xe), k && o > 0 && (g *= Math.pow(te, k.length))) : Ye.test(e.charAt(a - 1)) ? (g *= Be, j = e.slice(o, a - 1).match(ge), j && o > 0 && (g *= Math.pow(te, j.length))) : (g *= Ge, o > 0 && (g *= Math.pow(te, a - o))), e.charAt(a) !== n.charAt(u) && (g *= He)), (g < ee && r.charAt(a - 1) === d.charAt(u + 1) || d.charAt(u + 1) === d.charAt(u) && r.charAt(a - 1) !== d.charAt(u)) && (C = ne(e, n, r, d, a + 1, u + 2, s), C * ee > g && (g = C * ee)), g > h && (h = g), a = r.indexOf(x, a + 1);
36
- return s[m] = h, h;
37
- }
38
- function pe(e) {
39
- return e.toLowerCase().replace(ge, " ");
40
- }
41
- function Qe(e, n, r) {
42
- return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, ne(e, n, pe(e), pe(n), 0, 0, {});
43
- }
44
- var T = '[cmdk-group=""]', re = '[cmdk-group-items=""]', Ze = '[cmdk-group-heading=""]', be = '[cmdk-item=""]', ve = `${be}:not([aria-disabled="true"])`, le = "cmdk-item-select", F = "data-value", et = (e, n, r) => Qe(e, n, r), xe = l.createContext(void 0), q = () => l.useContext(xe), ye = l.createContext(void 0), ae = () => l.useContext(ye), we = l.createContext(void 0), ke = l.forwardRef((e, n) => {
45
- let r = P(() => {
46
- var t, c;
47
- return { search: "", value: (c = (t = e.value) != null ? t : e.defaultValue) != null ? c : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
48
- }), d = P(() => /* @__PURE__ */ new Set()), o = P(() => /* @__PURE__ */ new Map()), u = P(() => /* @__PURE__ */ new Map()), s = P(() => /* @__PURE__ */ new Set()), m = Ee(e), { label: x, children: a, value: h, onValueChange: g, filter: C, shouldFilter: k, loop: j, disablePointerSelection: U = !1, vimBindings: N = !0, ...V } = e, G = L(), oe = L(), H = L(), A = l.useRef(null), y = dt();
49
- $(() => {
50
- if (h !== void 0) {
51
- let t = h.trim();
52
- r.current.value = t, E.emit();
53
- }
54
- }, [h]), $(() => {
55
- y(6, ue);
56
- }, []);
57
- let E = l.useMemo(() => ({ subscribe: (t) => (s.current.add(t), () => s.current.delete(t)), snapshot: () => r.current, setState: (t, c, f) => {
58
- var i, v, b, S;
59
- if (!Object.is(r.current[t], c)) {
60
- if (r.current[t] = c, t === "search") Y(), J(), y(1, X);
61
- else if (t === "value") {
62
- if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
63
- let w = document.getElementById(H);
64
- w ? w.focus() : (i = document.getElementById(G)) == null || i.focus();
65
- }
66
- if (y(7, () => {
67
- var w;
68
- r.current.selectedItemId = (w = D()) == null ? void 0 : w.id, E.emit();
69
- }), f || y(5, ue), ((v = m.current) == null ? void 0 : v.value) !== void 0) {
70
- let w = c ?? "";
71
- (S = (b = m.current).onValueChange) == null || S.call(b, w);
72
- return;
73
- }
74
- }
75
- E.emit();
76
- }
77
- }, emit: () => {
78
- s.current.forEach((t) => t());
79
- } }), []), W = l.useMemo(() => ({ value: (t, c, f) => {
80
- var i;
81
- c !== ((i = u.current.get(t)) == null ? void 0 : i.value) && (u.current.set(t, { value: c, keywords: f }), r.current.filtered.items.set(t, ie(c, f)), y(2, () => {
82
- J(), E.emit();
83
- }));
84
- }, item: (t, c) => (d.current.add(t), c && (o.current.has(c) ? o.current.get(c).add(t) : o.current.set(c, /* @__PURE__ */ new Set([t]))), y(3, () => {
85
- Y(), J(), r.current.value || X(), E.emit();
86
- }), () => {
87
- u.current.delete(t), d.current.delete(t), r.current.filtered.items.delete(t);
88
- let f = D();
89
- y(4, () => {
90
- Y(), f?.getAttribute("id") === t && X(), E.emit();
91
- });
92
- }), group: (t) => (o.current.has(t) || o.current.set(t, /* @__PURE__ */ new Set()), () => {
93
- u.current.delete(t), o.current.delete(t);
94
- }), filter: () => m.current.shouldFilter, label: x || e["aria-label"], getDisablePointerSelection: () => m.current.disablePointerSelection, listId: G, inputId: H, labelId: oe, listInnerRef: A }), []);
95
- function ie(t, c) {
96
- var f, i;
97
- let v = (i = (f = m.current) == null ? void 0 : f.filter) != null ? i : et;
98
- return t ? v(t, r.current.search, c) : 0;
99
- }
100
- function J() {
101
- if (!r.current.search || m.current.shouldFilter === !1) return;
102
- let t = r.current.filtered.items, c = [];
103
- r.current.filtered.groups.forEach((i) => {
104
- let v = o.current.get(i), b = 0;
105
- v.forEach((S) => {
106
- let w = t.get(S);
107
- b = Math.max(w, b);
108
- }), c.push([i, b]);
109
- });
110
- let f = A.current;
111
- O().sort((i, v) => {
112
- var b, S;
113
- let w = i.getAttribute("id"), _ = v.getAttribute("id");
114
- return ((b = t.get(_)) != null ? b : 0) - ((S = t.get(w)) != null ? S : 0);
115
- }).forEach((i) => {
116
- let v = i.closest(re);
117
- v ? v.appendChild(i.parentElement === v ? i : i.closest(`${re} > *`)) : f.appendChild(i.parentElement === f ? i : i.closest(`${re} > *`));
118
- }), c.sort((i, v) => v[1] - i[1]).forEach((i) => {
119
- var v;
120
- let b = (v = A.current) == null ? void 0 : v.querySelector(`${T}[${F}="${encodeURIComponent(i[0])}"]`);
121
- b?.parentElement.appendChild(b);
122
- });
123
- }
124
- function X() {
125
- let t = O().find((f) => f.getAttribute("aria-disabled") !== "true"), c = t?.getAttribute(F);
126
- E.setState("value", c || void 0);
127
- }
128
- function Y() {
129
- var t, c, f, i;
130
- if (!r.current.search || m.current.shouldFilter === !1) {
131
- r.current.filtered.count = d.current.size;
132
- return;
133
- }
134
- r.current.filtered.groups = /* @__PURE__ */ new Set();
135
- let v = 0;
136
- for (let b of d.current) {
137
- let S = (c = (t = u.current.get(b)) == null ? void 0 : t.value) != null ? c : "", w = (i = (f = u.current.get(b)) == null ? void 0 : f.keywords) != null ? i : [], _ = ie(S, w);
138
- r.current.filtered.items.set(b, _), _ > 0 && v++;
139
- }
140
- for (let [b, S] of o.current) for (let w of S) if (r.current.filtered.items.get(w) > 0) {
141
- r.current.filtered.groups.add(b);
142
- break;
143
- }
144
- r.current.filtered.count = v;
145
- }
146
- function ue() {
147
- var t, c, f;
148
- let i = D();
149
- i && (((t = i.parentElement) == null ? void 0 : t.firstChild) === i && ((f = (c = i.closest(T)) == null ? void 0 : c.querySelector(Ze)) == null || f.scrollIntoView({ block: "nearest" })), i.scrollIntoView({ block: "nearest" }));
150
- }
151
- function D() {
152
- var t;
153
- return (t = A.current) == null ? void 0 : t.querySelector(`${be}[aria-selected="true"]`);
154
- }
155
- function O() {
156
- var t;
157
- return Array.from(((t = A.current) == null ? void 0 : t.querySelectorAll(ve)) || []);
158
- }
159
- function Q(t) {
160
- let c = O()[t];
161
- c && E.setState("value", c.getAttribute(F));
162
- }
163
- function Z(t) {
164
- var c;
165
- let f = D(), i = O(), v = i.findIndex((S) => S === f), b = i[v + t];
166
- (c = m.current) != null && c.loop && (b = v + t < 0 ? i[i.length - 1] : v + t === i.length ? i[0] : i[v + t]), b && E.setState("value", b.getAttribute(F));
167
- }
168
- function se(t) {
169
- let c = D(), f = c?.closest(T), i;
170
- for (; f && !i; ) f = t > 0 ? st(f, T) : ct(f, T), i = f?.querySelector(ve);
171
- i ? E.setState("value", i.getAttribute(F)) : Z(t);
172
- }
173
- let ce = () => Q(O().length - 1), de = (t) => {
174
- t.preventDefault(), t.metaKey ? ce() : t.altKey ? se(1) : Z(1);
175
- }, me = (t) => {
176
- t.preventDefault(), t.metaKey ? Q(0) : t.altKey ? se(-1) : Z(-1);
177
- };
178
- return l.createElement(R.div, { ref: n, tabIndex: -1, ...V, "cmdk-root": "", onKeyDown: (t) => {
179
- var c;
180
- (c = V.onKeyDown) == null || c.call(V, t);
181
- let f = t.nativeEvent.isComposing || t.keyCode === 229;
182
- if (!(t.defaultPrevented || f)) switch (t.key) {
183
- case "n":
184
- case "j": {
185
- N && t.ctrlKey && de(t);
186
- break;
187
- }
188
- case "ArrowDown": {
189
- de(t);
190
- break;
191
- }
192
- case "p":
193
- case "k": {
194
- N && t.ctrlKey && me(t);
195
- break;
196
- }
197
- case "ArrowUp": {
198
- me(t);
199
- break;
200
- }
201
- case "Home": {
202
- t.preventDefault(), Q(0);
203
- break;
204
- }
205
- case "End": {
206
- t.preventDefault(), ce();
207
- break;
208
- }
209
- case "Enter": {
210
- t.preventDefault();
211
- let i = D();
212
- if (i) {
213
- let v = new Event(le);
214
- i.dispatchEvent(v);
215
- }
216
- }
217
- }
218
- } }, l.createElement("label", { "cmdk-label": "", htmlFor: W.inputId, id: W.labelId, style: ft }, x), B(e, (t) => l.createElement(ye.Provider, { value: E }, l.createElement(xe.Provider, { value: W }, t))));
219
- }), tt = l.forwardRef((e, n) => {
220
- var r, d;
221
- let o = L(), u = l.useRef(null), s = l.useContext(we), m = q(), x = Ee(e), a = (d = (r = x.current) == null ? void 0 : r.forceMount) != null ? d : s?.forceMount;
222
- $(() => {
223
- if (!a) return m.item(o, s?.id);
224
- }, [a]);
225
- let h = Se(o, u, [e.value, e.children, u], e.keywords), g = ae(), C = I((y) => y.value && y.value === h.current), k = I((y) => a || m.filter() === !1 ? !0 : y.search ? y.filtered.items.get(o) > 0 : !0);
226
- l.useEffect(() => {
227
- let y = u.current;
228
- if (!(!y || e.disabled)) return y.addEventListener(le, j), () => y.removeEventListener(le, j);
229
- }, [k, e.onSelect, e.disabled]);
230
- function j() {
231
- var y, E;
232
- U(), (E = (y = x.current).onSelect) == null || E.call(y, h.current);
233
- }
234
- function U() {
235
- g.setState("value", h.current, !0);
236
- }
237
- if (!k) return null;
238
- let { disabled: N, value: V, onSelect: G, forceMount: oe, keywords: H, ...A } = e;
239
- return l.createElement(R.div, { ref: z(u, n), ...A, id: o, "cmdk-item": "", role: "option", "aria-disabled": !!N, "aria-selected": !!C, "data-disabled": !!N, "data-selected": !!C, onPointerMove: N || m.getDisablePointerSelection() ? void 0 : U, onClick: N ? void 0 : j }, e.children);
240
- }), rt = l.forwardRef((e, n) => {
241
- let { heading: r, children: d, forceMount: o, ...u } = e, s = L(), m = l.useRef(null), x = l.useRef(null), a = L(), h = q(), g = I((k) => o || h.filter() === !1 ? !0 : k.search ? k.filtered.groups.has(s) : !0);
242
- $(() => h.group(s), []), Se(s, m, [e.value, e.heading, x]);
243
- let C = l.useMemo(() => ({ id: s, forceMount: o }), [o]);
244
- return l.createElement(R.div, { ref: z(m, n), ...u, "cmdk-group": "", role: "presentation", hidden: g ? void 0 : !0 }, r && l.createElement("div", { ref: x, "cmdk-group-heading": "", "aria-hidden": !0, id: a }, r), B(e, (k) => l.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? a : void 0 }, l.createElement(we.Provider, { value: C }, k))));
245
- }), nt = l.forwardRef((e, n) => {
246
- let { alwaysRender: r, ...d } = e, o = l.useRef(null), u = I((s) => !s.search);
247
- return !r && !u ? null : l.createElement(R.div, { ref: z(o, n), ...d, "cmdk-separator": "", role: "separator" });
248
- }), lt = l.forwardRef((e, n) => {
249
- let { onValueChange: r, ...d } = e, o = e.value != null, u = ae(), s = I((a) => a.search), m = I((a) => a.selectedItemId), x = q();
250
- return l.useEffect(() => {
251
- e.value != null && u.setState("search", e.value);
252
- }, [e.value]), l.createElement(R.input, { ref: n, ...d, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": x.listId, "aria-labelledby": x.labelId, "aria-activedescendant": m, id: x.inputId, type: "text", value: o ? e.value : s, onChange: (a) => {
253
- o || u.setState("search", a.target.value), r?.(a.target.value);
254
- } });
255
- }), at = l.forwardRef((e, n) => {
256
- let { children: r, label: d = "Suggestions", ...o } = e, u = l.useRef(null), s = l.useRef(null), m = I((a) => a.selectedItemId), x = q();
257
- return l.useEffect(() => {
258
- if (s.current && u.current) {
259
- let a = s.current, h = u.current, g, C = new ResizeObserver(() => {
260
- g = requestAnimationFrame(() => {
261
- let k = a.offsetHeight;
262
- h.style.setProperty("--cmdk-list-height", k.toFixed(1) + "px");
263
- });
264
- });
265
- return C.observe(a), () => {
266
- cancelAnimationFrame(g), C.unobserve(a);
267
- };
268
- }
269
- }, []), l.createElement(R.div, { ref: z(u, n), ...o, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": m, "aria-label": d, id: x.listId }, B(e, (a) => l.createElement("div", { ref: z(s, x.listInnerRef), "cmdk-list-sizer": "" }, a)));
270
- }), ot = l.forwardRef((e, n) => {
271
- let { open: r, onOpenChange: d, overlayClassName: o, contentClassName: u, container: s, ...m } = e;
272
- return l.createElement(Re, { open: r, onOpenChange: d }, l.createElement(Ne, { container: s }, l.createElement(Ae, { "cmdk-overlay": "", className: o }), l.createElement($e, { "aria-label": e.label, "cmdk-dialog": "", className: u }, l.createElement(ke, { ref: n, ...m }))));
273
- }), it = l.forwardRef((e, n) => I((r) => r.filtered.count === 0) ? l.createElement(R.div, { ref: n, ...e, "cmdk-empty": "", role: "presentation" }) : null), ut = l.forwardRef((e, n) => {
274
- let { progress: r, children: d, label: o = "Loading...", ...u } = e;
275
- return l.createElement(R.div, { ref: n, ...u, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": o }, B(e, (s) => l.createElement("div", { "aria-hidden": !0 }, s)));
276
- }), K = Object.assign(ke, { List: at, Item: tt, Input: lt, Group: rt, Separator: nt, Dialog: ot, Empty: it, Loading: ut });
277
- function st(e, n) {
278
- let r = e.nextElementSibling;
279
- for (; r; ) {
280
- if (r.matches(n)) return r;
281
- r = r.nextElementSibling;
282
- }
283
- }
284
- function ct(e, n) {
285
- let r = e.previousElementSibling;
286
- for (; r; ) {
287
- if (r.matches(n)) return r;
288
- r = r.previousElementSibling;
289
- }
290
- }
291
- function Ee(e) {
292
- let n = l.useRef(e);
293
- return $(() => {
294
- n.current = e;
295
- }), n;
296
- }
297
- var $ = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
298
- function P(e) {
299
- let n = l.useRef();
300
- return n.current === void 0 && (n.current = e()), n;
301
- }
302
- function I(e) {
303
- let n = ae(), r = () => e(n.snapshot());
304
- return l.useSyncExternalStore(n.subscribe, r, r);
305
- }
306
- function Se(e, n, r, d = []) {
307
- let o = l.useRef(), u = q();
308
- return $(() => {
309
- var s;
310
- let m = (() => {
311
- var a;
312
- for (let h of r) {
313
- if (typeof h == "string") return h.trim();
314
- if (typeof h == "object" && "current" in h) return h.current ? (a = h.current.textContent) == null ? void 0 : a.trim() : o.current;
315
- }
316
- })(), x = d.map((a) => a.trim());
317
- u.value(e, m, x), (s = n.current) == null || s.setAttribute(F, m), o.current = m;
318
- }), o;
319
- }
320
- var dt = () => {
321
- let [e, n] = l.useState(), r = P(() => /* @__PURE__ */ new Map());
322
- return $(() => {
323
- r.current.forEach((d) => d()), r.current = /* @__PURE__ */ new Map();
324
- }, [e]), (d, o) => {
325
- r.current.set(d, o), n({});
326
- };
327
- };
328
- function mt(e) {
329
- let n = e.type;
330
- return typeof n == "function" ? n(e.props) : "render" in n ? n.render(e.props) : e;
331
- }
332
- function B({ asChild: e, children: n }, r) {
333
- return e && l.isValidElement(n) ? l.cloneElement(mt(n), { ref: n.ref }, r(n.props.children)) : r(n);
334
- }
335
- var ft = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
336
- function pt({ className: e, ...n }) {
337
- return /* @__PURE__ */ p.jsx(
338
- K,
339
- {
340
- className: M(
341
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
342
- e
343
- ),
344
- "data-slot": "command",
345
- ...n
346
- }
347
- );
348
- }
349
- function vt({ className: e, ...n }) {
350
- return /* @__PURE__ */ p.jsxs("div", { className: "flex h-9 items-center gap-2 border-b px-3", "data-slot": "command-input-wrapper", children: [
351
- /* @__PURE__ */ p.jsx(_e, { className: "size-4 shrink-0 opacity-50" }),
352
- /* @__PURE__ */ p.jsx(
353
- K.Input,
354
- {
355
- className: M(
356
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
357
- e
358
- ),
359
- "data-slot": "command-input",
360
- ...n
361
- }
362
- )
363
- ] });
364
- }
365
- function ht({ className: e, ...n }) {
366
- return /* @__PURE__ */ p.jsx(
367
- K.List,
368
- {
369
- className: M("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", e),
370
- "data-slot": "command-list",
371
- ...n
372
- }
373
- );
374
- }
375
- function gt({ ...e }) {
376
- return /* @__PURE__ */ p.jsx(K.Empty, { className: "py-6 text-center text-sm", "data-slot": "command-empty", ...e });
377
- }
378
- function bt({ className: e, ...n }) {
379
- return /* @__PURE__ */ p.jsx(
380
- K.Group,
381
- {
382
- className: M(
383
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs",
384
- e
385
- ),
386
- "data-slot": "command-group",
387
- ...n
388
- }
389
- );
390
- }
391
- function xt({ className: e, ...n }) {
392
- return /* @__PURE__ */ p.jsx(
393
- K.Item,
394
- {
395
- className: M(
396
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
397
- e
398
- ),
399
- "data-slot": "command-item",
400
- ...n
401
- }
402
- );
403
- }
404
- const yt = ({
405
- placeholder: e,
406
- selected: n,
407
- className: r,
408
- open: d,
409
- renderSelected: o = (u) => u.label
410
- }) => /* @__PURE__ */ p.jsx(Fe, { asChild: !0, children: /* @__PURE__ */ p.jsxs(Ie, { "aria-expanded": d, className: `justify-between ${r}`, role: "combobox", variant: "outline", children: [
411
- o(n || { label: e, value: "" }),
412
- /* @__PURE__ */ p.jsx(qe, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
413
- ] }) }), At = ({
414
- options: e,
415
- value: n = "",
416
- placeholder: r = "Select a value...",
417
- className: d = "",
418
- onSelect: o = () => {
419
- },
420
- renderSelected: u = (s) => s.label
421
- }) => {
422
- const [s, m] = Ce(!1), x = je(() => e.find((a) => a.value === n), [e, n]);
423
- return /* @__PURE__ */ p.jsxs(Me, { onOpenChange: m, open: s, children: [
424
- /* @__PURE__ */ p.jsx(
425
- yt,
426
- {
427
- className: `w-full ${d}`,
428
- open: s,
429
- placeholder: r,
430
- renderSelected: u,
431
- selected: x
432
- }
433
- ),
434
- /* @__PURE__ */ p.jsx(De, { className: "w-full p-0", children: /* @__PURE__ */ p.jsxs(pt, { value: n, children: [
435
- /* @__PURE__ */ p.jsx(vt, { "aria-label": "Search options", className: "h-9", placeholder: "Search" }),
436
- /* @__PURE__ */ p.jsxs(ht, { children: [
437
- /* @__PURE__ */ p.jsx(gt, { children: "No results found" }),
438
- /* @__PURE__ */ p.jsx(bt, { children: e.map((a) => /* @__PURE__ */ p.jsxs(
439
- xt,
440
- {
441
- onSelect: () => {
442
- m(!1), o(a.value);
443
- },
444
- value: a.value,
445
- children: [
446
- a.icon ? /* @__PURE__ */ p.jsx("span", { className: "mr-2", children: a.icon }) : "",
447
- a.label,
448
- /* @__PURE__ */ p.jsx(Pe, { className: M("ml-auto", a.value === n ? "opacity-100" : "opacity-0") })
449
- ]
450
- },
451
- a.value
452
- )) })
453
- ] })
454
- ] }) })
455
- ] });
456
- };
457
- function wt({ className: e, ...n }) {
458
- return /* @__PURE__ */ p.jsx(
459
- "textarea",
460
- {
461
- className: M(
462
- "field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:ring-destructive/40",
463
- e
464
- ),
465
- "data-slot": "textarea",
466
- ...n
467
- }
468
- );
469
- }
470
- function $t({ label: e, name: n, note: r, placeholder: d, className: o, error: u, ...s }) {
471
- return /* @__PURE__ */ p.jsxs(Oe, { className: "w-full", direction: "col", gap: "2", children: [
472
- e && /* @__PURE__ */ p.jsx(Le, { htmlFor: n, children: e }),
473
- /* @__PURE__ */ p.jsx(
474
- wt,
475
- {
476
- "aria-label": e || n,
477
- className: o,
478
- id: n,
479
- name: n,
480
- placeholder: d,
481
- ...s
482
- }
483
- ),
484
- r && /* @__PURE__ */ p.jsx(Te, { size: "sm", variant: "muted", children: r }),
485
- u && /* @__PURE__ */ p.jsx(Ke, { message: u })
486
- ] });
487
- }
488
- export {
489
- At as S,
490
- $t as T
491
- };