@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.
@@ -1,986 +0,0 @@
1
- import { j as t } from "./jsx-runtime.js";
2
- import { c as C, u as V, e as xe, B as be, d as ge, S as me, f as ve } from "./calendar.js";
3
- import * as s from "react";
4
- import { Fragment as ye } from "react";
5
- import { c as p } from "./index2.js";
6
- import { X as we, S as je } from "./Table.js";
7
- import { c as Ce, i as W, a as Te, u as ke, j as Se, A as _e, P as Ne, d as T, b as X, k as Ee, l as Me, D as Re, m as Pe, n as Oe, R as De, C as Ae, o as Ie, T as Le, p as ze, h as He, O as $e } from "./popover.js";
8
- import { F as Y } from "./Layout2.js";
9
- import { T as Z } 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 Be = [
17
- ["rect", { width: "14", height: "8", x: "5", y: "2", rx: "2", key: "wc9tft" }],
18
- ["rect", { width: "20", height: "8", x: "2", y: "14", rx: "2", key: "w68u3i" }],
19
- ["path", { d: "M6 18h2", key: "rwmk9e" }],
20
- ["path", { d: "M12 18h6", key: "aqd8w3" }]
21
- ], Fe = C("computer", Be);
22
- /**
23
- * @license lucide-react v0.525.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */
28
- const Ge = [
29
- ["path", { d: "M12 17v4", key: "1riwvh" }],
30
- ["path", { d: "m14.305 7.53.923-.382", key: "1mlnsw" }],
31
- ["path", { d: "m15.228 4.852-.923-.383", key: "82mpwg" }],
32
- ["path", { d: "m16.852 3.228-.383-.924", key: "ln4sir" }],
33
- ["path", { d: "m16.852 8.772-.383.923", key: "1dejw0" }],
34
- ["path", { d: "m19.148 3.228.383-.924", key: "192kgf" }],
35
- ["path", { d: "m19.53 9.696-.382-.924", key: "fiavlr" }],
36
- ["path", { d: "m20.772 4.852.924-.383", key: "1j8mgp" }],
37
- ["path", { d: "m20.772 7.148.924.383", key: "zix9be" }],
38
- ["path", { d: "M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7", key: "1tnzv8" }],
39
- ["path", { d: "M8 21h8", key: "1ev6f3" }],
40
- ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }]
41
- ], qe = C("monitor-cog", Ge);
42
- /**
43
- * @license lucide-react v0.525.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */
48
- const Ke = [
49
- ["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
50
- ], J = C("moon", Ke);
51
- /**
52
- * @license lucide-react v0.525.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */
57
- const Ue = [
58
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
59
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
60
- ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
61
- ], Ve = C("panel-left-open", Ue);
62
- /**
63
- * @license lucide-react v0.525.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */
68
- const We = [
69
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
70
- ["path", { d: "M15 3v18", key: "14nvp0" }],
71
- ["path", { d: "m10 15-3-3 3-3", key: "1pgupc" }]
72
- ], Xe = C("panel-right-open", We);
73
- /**
74
- * @license lucide-react v0.525.0 - ISC
75
- *
76
- * This source code is licensed under the ISC license.
77
- * See the LICENSE file in the root directory of this source tree.
78
- */
79
- const Ye = [
80
- ["path", { d: "M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6", key: "y09zxi" }],
81
- ["path", { d: "m21 3-9 9", key: "mpx6sq" }],
82
- ["path", { d: "M15 3h6v6", key: "1q9fwt" }]
83
- ], Ze = C("square-arrow-out-up-right", Ye);
84
- /**
85
- * @license lucide-react v0.525.0 - ISC
86
- *
87
- * This source code is licensed under the ISC license.
88
- * See the LICENSE file in the root directory of this source tree.
89
- */
90
- const Je = [
91
- ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
92
- ["path", { d: "M12 2v2", key: "tus03m" }],
93
- ["path", { d: "M12 20v2", key: "1lh1kg" }],
94
- ["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
95
- ["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
96
- ["path", { d: "M2 12h2", key: "1t8f8n" }],
97
- ["path", { d: "M20 12h2", key: "1q8mjw" }],
98
- ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
99
- ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
100
- ], Q = C("sun", Je);
101
- var [O, na] = Ce("Tooltip", [
102
- W
103
- ]), D = W(), ee = "TooltipProvider", Qe = 700, L = "tooltip.open", [et, $] = O(ee), te = (e) => {
104
- const {
105
- __scopeTooltip: a,
106
- delayDuration: r = Qe,
107
- skipDelayDuration: o = 300,
108
- disableHoverableContent: n = !1,
109
- children: i
110
- } = e, l = s.useRef(!0), c = s.useRef(!1), d = s.useRef(0);
111
- return s.useEffect(() => {
112
- const h = d.current;
113
- return () => window.clearTimeout(h);
114
- }, []), /* @__PURE__ */ t.jsx(
115
- et,
116
- {
117
- scope: a,
118
- isOpenDelayedRef: l,
119
- delayDuration: r,
120
- onOpen: s.useCallback(() => {
121
- window.clearTimeout(d.current), l.current = !1;
122
- }, []),
123
- onClose: s.useCallback(() => {
124
- window.clearTimeout(d.current), d.current = window.setTimeout(
125
- () => l.current = !0,
126
- o
127
- );
128
- }, [o]),
129
- isPointerInTransitRef: c,
130
- onPointerInTransitChange: s.useCallback((h) => {
131
- c.current = h;
132
- }, []),
133
- disableHoverableContent: n,
134
- children: i
135
- }
136
- );
137
- };
138
- te.displayName = ee;
139
- var E = "Tooltip", [tt, M] = O(E), ae = (e) => {
140
- const {
141
- __scopeTooltip: a,
142
- children: r,
143
- open: o,
144
- defaultOpen: n,
145
- onOpenChange: i,
146
- disableHoverableContent: l,
147
- delayDuration: c
148
- } = e, d = $(E, e.__scopeTooltip), h = D(a), [u, b] = s.useState(null), x = Te(), f = s.useRef(0), v = l ?? d.disableHoverableContent, y = c ?? d.delayDuration, w = s.useRef(!1), [g, m] = ke({
149
- prop: o,
150
- defaultProp: n ?? !1,
151
- onChange: (q) => {
152
- q ? (d.onOpen(), document.dispatchEvent(new CustomEvent(L))) : d.onClose(), i?.(q);
153
- },
154
- caller: E
155
- }), S = s.useMemo(() => g ? w.current ? "delayed-open" : "instant-open" : "closed", [g]), _ = s.useCallback(() => {
156
- window.clearTimeout(f.current), f.current = 0, w.current = !1, m(!0);
157
- }, [m]), N = s.useCallback(() => {
158
- window.clearTimeout(f.current), f.current = 0, m(!1);
159
- }, [m]), G = s.useCallback(() => {
160
- window.clearTimeout(f.current), f.current = window.setTimeout(() => {
161
- w.current = !0, m(!0), f.current = 0;
162
- }, y);
163
- }, [y, m]);
164
- return s.useEffect(() => () => {
165
- f.current && (window.clearTimeout(f.current), f.current = 0);
166
- }, []), /* @__PURE__ */ t.jsx(Se, { ...h, children: /* @__PURE__ */ t.jsx(
167
- tt,
168
- {
169
- scope: a,
170
- contentId: x,
171
- open: g,
172
- stateAttribute: S,
173
- trigger: u,
174
- onTriggerChange: b,
175
- onTriggerEnter: s.useCallback(() => {
176
- d.isOpenDelayedRef.current ? G() : _();
177
- }, [d.isOpenDelayedRef, G, _]),
178
- onTriggerLeave: s.useCallback(() => {
179
- v ? N() : (window.clearTimeout(f.current), f.current = 0);
180
- }, [N, v]),
181
- onOpen: _,
182
- onClose: N,
183
- disableHoverableContent: v,
184
- children: r
185
- }
186
- ) });
187
- };
188
- ae.displayName = E;
189
- var z = "TooltipTrigger", re = s.forwardRef(
190
- (e, a) => {
191
- const { __scopeTooltip: r, ...o } = e, n = M(z, r), i = $(z, r), l = D(r), c = s.useRef(null), d = V(a, c, n.onTriggerChange), h = s.useRef(!1), u = s.useRef(!1), b = s.useCallback(() => h.current = !1, []);
192
- return s.useEffect(() => () => document.removeEventListener("pointerup", b), [b]), /* @__PURE__ */ t.jsx(_e, { asChild: !0, ...l, children: /* @__PURE__ */ t.jsx(
193
- Ne.button,
194
- {
195
- "aria-describedby": n.open ? n.contentId : void 0,
196
- "data-state": n.stateAttribute,
197
- ...o,
198
- ref: d,
199
- onPointerMove: T(e.onPointerMove, (x) => {
200
- x.pointerType !== "touch" && !u.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), u.current = !0);
201
- }),
202
- onPointerLeave: T(e.onPointerLeave, () => {
203
- n.onTriggerLeave(), u.current = !1;
204
- }),
205
- onPointerDown: T(e.onPointerDown, () => {
206
- n.open && n.onClose(), h.current = !0, document.addEventListener("pointerup", b, { once: !0 });
207
- }),
208
- onFocus: T(e.onFocus, () => {
209
- h.current || n.onOpen();
210
- }),
211
- onBlur: T(e.onBlur, n.onClose),
212
- onClick: T(e.onClick, n.onClose)
213
- }
214
- ) });
215
- }
216
- );
217
- re.displayName = z;
218
- var B = "TooltipPortal", [at, rt] = O(B, {
219
- forceMount: void 0
220
- }), oe = (e) => {
221
- const { __scopeTooltip: a, forceMount: r, children: o, container: n } = e, i = M(B, a);
222
- return /* @__PURE__ */ t.jsx(at, { scope: a, forceMount: r, children: /* @__PURE__ */ t.jsx(X, { present: r || i.open, children: /* @__PURE__ */ t.jsx(Ee, { asChild: !0, container: n, children: o }) }) });
223
- };
224
- oe.displayName = B;
225
- var k = "TooltipContent", ne = s.forwardRef(
226
- (e, a) => {
227
- const r = rt(k, e.__scopeTooltip), { forceMount: o = r.forceMount, side: n = "top", ...i } = e, l = M(k, e.__scopeTooltip);
228
- return /* @__PURE__ */ t.jsx(X, { present: o || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ t.jsx(se, { side: n, ...i, ref: a }) : /* @__PURE__ */ t.jsx(ot, { side: n, ...i, ref: a }) });
229
- }
230
- ), ot = s.forwardRef((e, a) => {
231
- const r = M(k, e.__scopeTooltip), o = $(k, e.__scopeTooltip), n = s.useRef(null), i = V(a, n), [l, c] = s.useState(null), { trigger: d, onClose: h } = r, u = n.current, { onPointerInTransitChange: b } = o, x = s.useCallback(() => {
232
- c(null), b(!1);
233
- }, [b]), f = s.useCallback(
234
- (v, y) => {
235
- const w = v.currentTarget, g = { x: v.clientX, y: v.clientY }, m = lt(g, w.getBoundingClientRect()), S = dt(g, m), _ = ct(y.getBoundingClientRect()), N = pt([...S, ..._]);
236
- c(N), b(!0);
237
- },
238
- [b]
239
- );
240
- return s.useEffect(() => () => x(), [x]), s.useEffect(() => {
241
- if (d && u) {
242
- const v = (w) => f(w, u), y = (w) => f(w, d);
243
- return d.addEventListener("pointerleave", v), u.addEventListener("pointerleave", y), () => {
244
- d.removeEventListener("pointerleave", v), u.removeEventListener("pointerleave", y);
245
- };
246
- }
247
- }, [d, u, f, x]), s.useEffect(() => {
248
- if (l) {
249
- const v = (y) => {
250
- const w = y.target, g = { x: y.clientX, y: y.clientY }, m = d?.contains(w) || u?.contains(w), S = !ut(g, l);
251
- m ? x() : S && (x(), h());
252
- };
253
- return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
254
- }
255
- }, [d, u, l, h, x]), /* @__PURE__ */ t.jsx(se, { ...e, ref: i });
256
- }), [nt, st] = O(E, { isInside: !1 }), it = xe("TooltipContent"), se = s.forwardRef(
257
- (e, a) => {
258
- const {
259
- __scopeTooltip: r,
260
- children: o,
261
- "aria-label": n,
262
- onEscapeKeyDown: i,
263
- onPointerDownOutside: l,
264
- ...c
265
- } = e, d = M(k, r), h = D(r), { onClose: u } = d;
266
- return s.useEffect(() => (document.addEventListener(L, u), () => document.removeEventListener(L, u)), [u]), s.useEffect(() => {
267
- if (d.trigger) {
268
- const b = (x) => {
269
- x.target?.contains(d.trigger) && u();
270
- };
271
- return window.addEventListener("scroll", b, { capture: !0 }), () => window.removeEventListener("scroll", b, { capture: !0 });
272
- }
273
- }, [d.trigger, u]), /* @__PURE__ */ t.jsx(
274
- Re,
275
- {
276
- asChild: !0,
277
- disableOutsidePointerEvents: !1,
278
- onEscapeKeyDown: i,
279
- onPointerDownOutside: l,
280
- onFocusOutside: (b) => b.preventDefault(),
281
- onDismiss: u,
282
- children: /* @__PURE__ */ t.jsxs(
283
- Pe,
284
- {
285
- "data-state": d.stateAttribute,
286
- ...h,
287
- ...c,
288
- ref: a,
289
- style: {
290
- ...c.style,
291
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
292
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
293
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
294
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
295
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
296
- },
297
- children: [
298
- /* @__PURE__ */ t.jsx(it, { children: o }),
299
- /* @__PURE__ */ t.jsx(nt, { scope: r, isInside: !0, children: /* @__PURE__ */ t.jsx(Oe, { id: d.contentId, role: "tooltip", children: n || o }) })
300
- ]
301
- }
302
- )
303
- }
304
- );
305
- }
306
- );
307
- ne.displayName = k;
308
- var ie = "TooltipArrow", le = s.forwardRef(
309
- (e, a) => {
310
- const { __scopeTooltip: r, ...o } = e, n = D(r);
311
- return st(
312
- ie,
313
- r
314
- ).isInside ? null : /* @__PURE__ */ t.jsx(Me, { ...n, ...o, ref: a });
315
- }
316
- );
317
- le.displayName = ie;
318
- function lt(e, a) {
319
- const r = Math.abs(a.top - e.y), o = Math.abs(a.bottom - e.y), n = Math.abs(a.right - e.x), i = Math.abs(a.left - e.x);
320
- switch (Math.min(r, o, n, i)) {
321
- case i:
322
- return "left";
323
- case n:
324
- return "right";
325
- case r:
326
- return "top";
327
- case o:
328
- return "bottom";
329
- default:
330
- throw new Error("unreachable");
331
- }
332
- }
333
- function dt(e, a, r = 5) {
334
- const o = [];
335
- switch (a) {
336
- case "top":
337
- o.push(
338
- { x: e.x - r, y: e.y + r },
339
- { x: e.x + r, y: e.y + r }
340
- );
341
- break;
342
- case "bottom":
343
- o.push(
344
- { x: e.x - r, y: e.y - r },
345
- { x: e.x + r, y: e.y - r }
346
- );
347
- break;
348
- case "left":
349
- o.push(
350
- { x: e.x + r, y: e.y - r },
351
- { x: e.x + r, y: e.y + r }
352
- );
353
- break;
354
- case "right":
355
- o.push(
356
- { x: e.x - r, y: e.y - r },
357
- { x: e.x - r, y: e.y + r }
358
- );
359
- break;
360
- }
361
- return o;
362
- }
363
- function ct(e) {
364
- const { top: a, right: r, bottom: o, left: n } = e;
365
- return [
366
- { x: n, y: a },
367
- { x: r, y: a },
368
- { x: r, y: o },
369
- { x: n, y: o }
370
- ];
371
- }
372
- function ut(e, a) {
373
- const { x: r, y: o } = e;
374
- let n = !1;
375
- for (let i = 0, l = a.length - 1; i < a.length; l = i++) {
376
- const c = a[i], d = a[l], h = c.x, u = c.y, b = d.x, x = d.y;
377
- u > o != x > o && r < (b - h) * (o - u) / (x - u) + h && (n = !n);
378
- }
379
- return n;
380
- }
381
- function pt(e) {
382
- const a = e.slice();
383
- return a.sort((r, o) => r.x < o.x ? -1 : r.x > o.x ? 1 : r.y < o.y ? -1 : r.y > o.y ? 1 : 0), ht(a);
384
- }
385
- function ht(e) {
386
- if (e.length <= 1) return e.slice();
387
- const a = [];
388
- for (let o = 0; o < e.length; o++) {
389
- const n = e[o];
390
- for (; a.length >= 2; ) {
391
- const i = a[a.length - 1], l = a[a.length - 2];
392
- if ((i.x - l.x) * (n.y - l.y) >= (i.y - l.y) * (n.x - l.x)) a.pop();
393
- else break;
394
- }
395
- a.push(n);
396
- }
397
- a.pop();
398
- const r = [];
399
- for (let o = e.length - 1; o >= 0; o--) {
400
- const n = e[o];
401
- for (; r.length >= 2; ) {
402
- const i = r[r.length - 1], l = r[r.length - 2];
403
- if ((i.x - l.x) * (n.y - l.y) >= (i.y - l.y) * (n.x - l.x)) r.pop();
404
- else break;
405
- }
406
- r.push(n);
407
- }
408
- return r.pop(), a.length === 1 && r.length === 1 && a[0].x === r[0].x && a[0].y === r[0].y ? a : a.concat(r);
409
- }
410
- var ft = te, xt = ae, bt = re, gt = oe, mt = ne, vt = le;
411
- const K = [
412
- {
413
- theme: "light",
414
- icon: /* @__PURE__ */ t.jsx(Q, {}),
415
- label: "Light mode"
416
- },
417
- {
418
- theme: "dark",
419
- icon: /* @__PURE__ */ t.jsx(J, {}),
420
- label: "Dark mode"
421
- },
422
- {
423
- theme: "system",
424
- icon: /* @__PURE__ */ t.jsx(Fe, {}),
425
- label: "System theme"
426
- }
427
- ], yt = ({ theme: e, setTheme: a, className: r, buttonClassName: o, ...n }) => {
428
- const i = () => {
429
- a(e === "light" ? "dark" : e === "dark" ? "system" : "light");
430
- }, l = K.find((d) => d.theme === e)?.icon, c = K.find((d) => d.theme === e)?.label;
431
- return /* @__PURE__ */ t.jsx("span", { className: p(r), ...n, children: /* @__PURE__ */ t.jsxs(be, { className: p("p-1 w-full", o), onClick: i, variant: "unstyled", children: [
432
- l,
433
- /* @__PURE__ */ t.jsx(Z, { size: "base", truncate: !0, children: c })
434
- ] }) });
435
- }, wt = ({
436
- variant: e = "horizontal",
437
- theme: a,
438
- setTheme: r,
439
- className: o,
440
- buttonClassName: n,
441
- ...i
442
- }) => {
443
- const l = (c) => a === c ? "text-primary/75" : "text-primary/25 hover:text-primary";
444
- return e === "stacked" ? /* @__PURE__ */ t.jsx(
445
- yt,
446
- {
447
- buttonClassName: n,
448
- className: o,
449
- setTheme: r,
450
- theme: a,
451
- ...i
452
- }
453
- ) : /* @__PURE__ */ t.jsxs(Y, { gap: "4", children: [
454
- /* @__PURE__ */ t.jsxs(j, { children: [
455
- /* @__PURE__ */ t.jsx(j.Trigger, { children: /* @__PURE__ */ t.jsx(qe, { className: l("system"), onClick: () => r("system"), size: 32 }) }),
456
- /* @__PURE__ */ t.jsx(j.Content, { children: "Use system theme" })
457
- ] }),
458
- /* @__PURE__ */ t.jsxs(j, { children: [
459
- /* @__PURE__ */ t.jsx(j.Trigger, { children: /* @__PURE__ */ t.jsx(Q, { className: l("light"), onClick: () => r("light"), size: 32 }) }),
460
- /* @__PURE__ */ t.jsx(j.Content, { children: "Use light theme" })
461
- ] }),
462
- /* @__PURE__ */ t.jsxs(j, { children: [
463
- /* @__PURE__ */ t.jsx(j.Trigger, { children: /* @__PURE__ */ t.jsx(J, { className: l("dark"), onClick: () => r("dark"), size: 32 }) }),
464
- /* @__PURE__ */ t.jsx(j.Content, { children: "Use dark theme" })
465
- ] })
466
- ] });
467
- };
468
- function F({ delayDuration: e = 0, ...a }) {
469
- return /* @__PURE__ */ t.jsx(ft, { "data-slot": "tooltip-provider", delayDuration: e, ...a });
470
- }
471
- function de({ ...e }) {
472
- return /* @__PURE__ */ t.jsx(F, { children: /* @__PURE__ */ t.jsx(xt, { "data-slot": "tooltip", ...e }) });
473
- }
474
- function ce({ ...e }) {
475
- return /* @__PURE__ */ t.jsx(bt, { "data-slot": "tooltip-trigger", ...e });
476
- }
477
- function ue({
478
- className: e,
479
- sideOffset: a = 0,
480
- children: r,
481
- ...o
482
- }) {
483
- return /* @__PURE__ */ t.jsx(gt, { children: /* @__PURE__ */ t.jsxs(
484
- mt,
485
- {
486
- className: p(
487
- "fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-primary px-3 py-1.5 text-primary-foreground text-xs data-[state=closed]:animate-out",
488
- e
489
- ),
490
- "data-slot": "tooltip-content",
491
- sideOffset: a,
492
- ...o,
493
- children: [
494
- r,
495
- /* @__PURE__ */ t.jsx(vt, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-primary fill-primary" })
496
- ]
497
- }
498
- ) });
499
- }
500
- const j = ({ children: e, open: a, onOpenChange: r }) => /* @__PURE__ */ t.jsx(F, { children: /* @__PURE__ */ t.jsx(de, { onOpenChange: r, open: a, children: e }) }), jt = ({ children: e, cursor: a = "pointer", className: r }) => /* @__PURE__ */ t.jsx(
501
- ce,
502
- {
503
- asChild: !0,
504
- className: p(
505
- a === "arrow" && "cursor-default",
506
- a === "pointer" && "cursor-pointer",
507
- a === "text" && "cursor-text",
508
- a === "not-allowed" && "cursor-not-allowed",
509
- r
510
- ),
511
- children: e
512
- }
513
- ), Ct = ({ children: e }) => /* @__PURE__ */ t.jsx(ue, { children: e });
514
- j.Trigger = jt;
515
- j.Content = Ct;
516
- function Tt({ ...e }) {
517
- return /* @__PURE__ */ t.jsx(De, { "data-slot": "sheet", ...e });
518
- }
519
- function kt({ ...e }) {
520
- return /* @__PURE__ */ t.jsx(He, { "data-slot": "sheet-portal", ...e });
521
- }
522
- function St({ className: e, ...a }) {
523
- return /* @__PURE__ */ t.jsx(
524
- $e,
525
- {
526
- className: p(
527
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
528
- e
529
- ),
530
- "data-slot": "sheet-overlay",
531
- ...a
532
- }
533
- );
534
- }
535
- function _t({
536
- className: e,
537
- children: a,
538
- side: r = "right",
539
- ...o
540
- }) {
541
- return /* @__PURE__ */ t.jsxs(kt, { children: [
542
- /* @__PURE__ */ t.jsx(St, {}),
543
- /* @__PURE__ */ t.jsxs(
544
- Ae,
545
- {
546
- className: p(
547
- "fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-300 data-[state=open]:duration-500",
548
- r === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
549
- r === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
550
- r === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
551
- r === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
552
- e
553
- ),
554
- "data-slot": "sheet-content",
555
- ...o,
556
- children: [
557
- a,
558
- /* @__PURE__ */ t.jsxs(Ie, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
559
- /* @__PURE__ */ t.jsx(we, { className: "size-4" }),
560
- /* @__PURE__ */ t.jsx("span", { className: "sr-only", children: "Close" })
561
- ] })
562
- ]
563
- }
564
- )
565
- ] });
566
- }
567
- function Nt({ className: e, ...a }) {
568
- return /* @__PURE__ */ t.jsx("div", { className: p("flex flex-col gap-1.5 p-4", e), "data-slot": "sheet-header", ...a });
569
- }
570
- function Et({ className: e, ...a }) {
571
- return /* @__PURE__ */ t.jsx(
572
- Le,
573
- {
574
- className: p("font-semibold text-foreground", e),
575
- "data-slot": "sheet-title",
576
- ...a
577
- }
578
- );
579
- }
580
- function Mt({ className: e, ...a }) {
581
- return /* @__PURE__ */ t.jsx(
582
- ze,
583
- {
584
- className: p("text-muted-foreground text-sm", e),
585
- "data-slot": "sheet-description",
586
- ...a
587
- }
588
- );
589
- }
590
- const I = 768;
591
- function Rt() {
592
- const [e, a] = s.useState(void 0);
593
- return s.useEffect(() => {
594
- const r = window.matchMedia(`(max-width: ${I - 1}px)`), o = () => {
595
- a(window.innerWidth < I);
596
- };
597
- return r.addEventListener("change", o), a(window.innerWidth < I), () => r.removeEventListener("change", o);
598
- }, []), !!e;
599
- }
600
- const Pt = "sidebar_state", Ot = 60 * 60 * 24 * 7, Dt = "16rem", At = "18rem", It = "3rem", Lt = "b", pe = s.createContext(null);
601
- function A() {
602
- const e = s.useContext(pe);
603
- if (!e)
604
- throw new Error("useSidebar must be used within a SidebarProvider.");
605
- return e;
606
- }
607
- function zt({
608
- defaultOpen: e = !0,
609
- open: a,
610
- onOpenChange: r,
611
- className: o,
612
- style: n,
613
- children: i,
614
- ...l
615
- }) {
616
- const c = Rt(), [d, h] = s.useState(!1), [u, b] = s.useState(e), x = a ?? u, f = s.useCallback(
617
- (g) => {
618
- const m = typeof g == "function" ? g(x) : g;
619
- r ? r(m) : b(m), document.cookie = `${Pt}=${m}; path=/; max-age=${Ot}`;
620
- },
621
- [r, x]
622
- ), v = s.useCallback(() => c ? h((g) => !g) : f((g) => !g), [c, f]);
623
- s.useEffect(() => {
624
- const g = (m) => {
625
- m.key === Lt && (m.metaKey || m.ctrlKey) && (m.preventDefault(), v());
626
- };
627
- return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
628
- }, [v]);
629
- const y = x ? "expanded" : "collapsed", w = s.useMemo(
630
- () => ({
631
- state: y,
632
- open: x,
633
- setOpen: f,
634
- isMobile: c,
635
- openMobile: d,
636
- setOpenMobile: h,
637
- toggleSidebar: v
638
- }),
639
- [y, x, f, c, d, v]
640
- );
641
- return /* @__PURE__ */ t.jsx(pe.Provider, { value: w, children: /* @__PURE__ */ t.jsx(F, { delayDuration: 0, children: /* @__PURE__ */ t.jsx(
642
- "div",
643
- {
644
- className: p("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", o),
645
- "data-slot": "sidebar-wrapper",
646
- style: {
647
- "--sidebar-width": Dt,
648
- "--sidebar-width-icon": It,
649
- ...n
650
- },
651
- ...l,
652
- children: i
653
- }
654
- ) }) });
655
- }
656
- function Ht({
657
- side: e = "left",
658
- variant: a = "sidebar",
659
- collapsible: r = "offcanvas",
660
- className: o,
661
- children: n,
662
- ...i
663
- }) {
664
- const { isMobile: l, state: c, openMobile: d, setOpenMobile: h } = A();
665
- return r === "none" ? /* @__PURE__ */ t.jsx(
666
- "div",
667
- {
668
- className: p("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", o),
669
- "data-slot": "sidebar",
670
- ...i,
671
- children: n
672
- }
673
- ) : l ? /* @__PURE__ */ t.jsx(Tt, { onOpenChange: h, open: d, ...i, children: /* @__PURE__ */ t.jsxs(
674
- _t,
675
- {
676
- className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
677
- "data-mobile": "true",
678
- "data-sidebar": "sidebar",
679
- "data-slot": "sidebar",
680
- side: e,
681
- style: {
682
- "--sidebar-width": At
683
- },
684
- children: [
685
- /* @__PURE__ */ t.jsxs(Nt, { className: "sr-only", children: [
686
- /* @__PURE__ */ t.jsx(Et, { children: "Sidebar" }),
687
- /* @__PURE__ */ t.jsx(Mt, { children: "Displays the mobile sidebar." })
688
- ] }),
689
- /* @__PURE__ */ t.jsx("div", { className: "flex h-full w-full flex-col", children: n })
690
- ]
691
- }
692
- ) }) : /* @__PURE__ */ t.jsxs(
693
- "div",
694
- {
695
- className: "group peer hidden text-sidebar-foreground md:block",
696
- "data-collapsible": c === "collapsed" ? r : "",
697
- "data-side": e,
698
- "data-slot": "sidebar",
699
- "data-state": c,
700
- "data-variant": a,
701
- children: [
702
- /* @__PURE__ */ t.jsx(
703
- "div",
704
- {
705
- className: p(
706
- "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
707
- "group-data-[collapsible=offcanvas]:w-0",
708
- "group-data-[side=right]:rotate-180",
709
- a === "floating" || a === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
710
- ),
711
- "data-slot": "sidebar-gap"
712
- }
713
- ),
714
- /* @__PURE__ */ t.jsx(
715
- "div",
716
- {
717
- className: p(
718
- "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
719
- e === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
720
- // Adjust the padding for floating and inset variants.
721
- a === "floating" || a === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
722
- o
723
- ),
724
- "data-slot": "sidebar-container",
725
- ...i,
726
- children: /* @__PURE__ */ t.jsx(
727
- "div",
728
- {
729
- className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",
730
- "data-sidebar": "sidebar",
731
- "data-slot": "sidebar-inner",
732
- children: n
733
- }
734
- )
735
- }
736
- )
737
- ]
738
- }
739
- );
740
- }
741
- function $t({ className: e, onClick: a, children: r, ...o }) {
742
- const { toggleSidebar: n, open: i } = A();
743
- return /* @__PURE__ */ t.jsxs(
744
- ge,
745
- {
746
- className: p("size-7", e),
747
- "data-sidebar": "trigger",
748
- "data-slot": "sidebar-trigger",
749
- onClick: (l) => {
750
- a?.(l), n();
751
- },
752
- size: "icon",
753
- variant: "ghost",
754
- ...o,
755
- children: [
756
- i ? /* @__PURE__ */ t.jsx(Xe, {}) : /* @__PURE__ */ t.jsx(Ve, {}),
757
- /* @__PURE__ */ t.jsx("span", { className: "sr-only", children: "Toggle Sidebar" }),
758
- i ? r : null
759
- ]
760
- }
761
- );
762
- }
763
- function Bt({ className: e, ...a }) {
764
- const { toggleSidebar: r } = A();
765
- return /* @__PURE__ */ t.jsx(
766
- "button",
767
- {
768
- "aria-label": "Toggle Sidebar",
769
- className: p(
770
- "-translate-x-1/2 group-data-[side=left]:-right-4 absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=right]:left-0 sm:flex",
771
- "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
772
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
773
- "group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full",
774
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
775
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
776
- e
777
- ),
778
- "data-sidebar": "rail",
779
- "data-slot": "sidebar-rail",
780
- onClick: r,
781
- tabIndex: -1,
782
- title: "Toggle Sidebar",
783
- ...a
784
- }
785
- );
786
- }
787
- function Ft({ className: e, ...a }) {
788
- return /* @__PURE__ */ t.jsx(
789
- "main",
790
- {
791
- className: p(
792
- "relative flex w-full flex-1 flex-col bg-background",
793
- "md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",
794
- e
795
- ),
796
- "data-slot": "sidebar-inset",
797
- ...a
798
- }
799
- );
800
- }
801
- function Gt({ className: e, ...a }) {
802
- return /* @__PURE__ */ t.jsx(
803
- "div",
804
- {
805
- className: p("flex flex-col gap-2 p-2", e),
806
- "data-sidebar": "header",
807
- "data-slot": "sidebar-header",
808
- ...a
809
- }
810
- );
811
- }
812
- function qt({ className: e, ...a }) {
813
- return /* @__PURE__ */ t.jsx(
814
- "div",
815
- {
816
- className: p("flex flex-col gap-2 p-2", e),
817
- "data-sidebar": "footer",
818
- "data-slot": "sidebar-footer",
819
- ...a
820
- }
821
- );
822
- }
823
- function he({ className: e, ...a }) {
824
- return /* @__PURE__ */ t.jsx(
825
- je,
826
- {
827
- className: p("mx-2 w-auto bg-sidebar-border", e),
828
- "data-sidebar": "separator",
829
- "data-slot": "sidebar-separator",
830
- ...a
831
- }
832
- );
833
- }
834
- function Kt({ className: e, ...a }) {
835
- return /* @__PURE__ */ t.jsx(
836
- "div",
837
- {
838
- className: p(
839
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
840
- e
841
- ),
842
- "data-sidebar": "content",
843
- "data-slot": "sidebar-content",
844
- ...a
845
- }
846
- );
847
- }
848
- function Ut({ className: e, ...a }) {
849
- return /* @__PURE__ */ t.jsx(
850
- "div",
851
- {
852
- className: p("relative flex w-full min-w-0 flex-col p-2", e),
853
- "data-sidebar": "group",
854
- "data-slot": "sidebar-group",
855
- ...a
856
- }
857
- );
858
- }
859
- function Vt({ className: e, ...a }) {
860
- return /* @__PURE__ */ t.jsx(
861
- "div",
862
- {
863
- className: p("w-full text-sm", e),
864
- "data-sidebar": "group-content",
865
- "data-slot": "sidebar-group-content",
866
- ...a
867
- }
868
- );
869
- }
870
- function H({ className: e, ...a }) {
871
- return /* @__PURE__ */ t.jsx(
872
- "ul",
873
- {
874
- className: p("flex w-full min-w-0 flex-col gap-1", e),
875
- "data-sidebar": "menu",
876
- "data-slot": "sidebar-menu",
877
- ...a
878
- }
879
- );
880
- }
881
- function R({ className: e, ...a }) {
882
- return /* @__PURE__ */ t.jsx(
883
- "li",
884
- {
885
- className: p("group/menu-item relative", e),
886
- "data-sidebar": "menu-item",
887
- "data-slot": "sidebar-menu-item",
888
- ...a
889
- }
890
- );
891
- }
892
- const Wt = ve(
893
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
894
- {
895
- variants: {
896
- variant: {
897
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
898
- outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
899
- },
900
- size: {
901
- default: "h-8 text-sm",
902
- sm: "h-7 text-xs",
903
- lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
904
- }
905
- },
906
- defaultVariants: {
907
- variant: "default",
908
- size: "default"
909
- }
910
- }
911
- );
912
- function P({
913
- asChild: e = !1,
914
- isActive: a = !1,
915
- variant: r = "default",
916
- size: o = "default",
917
- tooltip: n,
918
- className: i,
919
- ...l
920
- }) {
921
- const c = e ? me : "button", { isMobile: d, state: h } = A(), u = /* @__PURE__ */ t.jsx(
922
- c,
923
- {
924
- className: p(Wt({ variant: r, size: o }), i),
925
- "data-active": a,
926
- "data-sidebar": "menu-button",
927
- "data-size": o,
928
- "data-slot": "sidebar-menu-button",
929
- ...l
930
- }
931
- );
932
- return n ? (typeof n == "string" && (n = {
933
- children: n
934
- }), /* @__PURE__ */ t.jsxs(de, { children: [
935
- /* @__PURE__ */ t.jsx(ce, { asChild: !0, children: u }),
936
- /* @__PURE__ */ t.jsx(ue, { align: "center", hidden: h !== "collapsed" || d, side: "right", ...n })
937
- ] })) : u;
938
- }
939
- const fe = ({ children: e }) => /* @__PURE__ */ t.jsx(Z, { size: "base", truncate: !0, children: e }), Xt = ({ itemSet: e, activeSlug: a }) => /* @__PURE__ */ t.jsx(t.Fragment, { children: e.links.map((r) => /* @__PURE__ */ t.jsx(R, { className: "hover:cursor-pointer", onClick: r.onClick, children: /* @__PURE__ */ t.jsx(P, { asChild: !0, isActive: a === r.slug, children: /* @__PURE__ */ t.jsxs("span", { children: [
940
- /* @__PURE__ */ t.jsx(r.icon, {}),
941
- /* @__PURE__ */ t.jsx(fe, { children: r.title }),
942
- r.external && /* @__PURE__ */ t.jsx(Y, { children: /* @__PURE__ */ t.jsx(Ze, { size: 12, strokeWidth: 1.5 }) })
943
- ] }) }) }, r.slug)) }), U = ({ itemSets: e, activeSlug: a }) => /* @__PURE__ */ t.jsx(H, { children: e.map((r, o) => /* @__PURE__ */ t.jsxs(ye, { children: [
944
- /* @__PURE__ */ t.jsx(Xt, { activeSlug: a, itemSet: r }),
945
- o < e.length - 1 && /* @__PURE__ */ t.jsx(he, {})
946
- ] }, `item-set-${o}`)) }), Yt = ({
947
- brandContent: e,
948
- brandOnClick: a,
949
- activeSlug: r,
950
- itemSets: o,
951
- bottomItemSets: n = [],
952
- theme: i,
953
- setTheme: l,
954
- ...c
955
- }) => /* @__PURE__ */ t.jsxs(Ht, { collapsible: "icon", ...c, children: [
956
- /* @__PURE__ */ t.jsx(Gt, { children: /* @__PURE__ */ t.jsx(H, { children: /* @__PURE__ */ t.jsx(R, { children: /* @__PURE__ */ t.jsx(
957
- P,
958
- {
959
- className: a ? "cursor-pointer" : "cursor-default",
960
- onClick: a,
961
- size: "lg",
962
- children: e
963
- }
964
- ) }) }) }),
965
- /* @__PURE__ */ t.jsx(Kt, { children: /* @__PURE__ */ t.jsx(Ut, { children: /* @__PURE__ */ t.jsx(Vt, { children: /* @__PURE__ */ t.jsx(U, { activeSlug: r, itemSets: o }) }) }) }),
966
- /* @__PURE__ */ t.jsx(qt, { className: "mb-4", children: /* @__PURE__ */ t.jsxs(H, { children: [
967
- /* @__PURE__ */ t.jsx(R, { children: /* @__PURE__ */ t.jsx(P, { asChild: !0, children: /* @__PURE__ */ t.jsx($t, { className: "justify-start font-normal", children: /* @__PURE__ */ t.jsx(fe, { children: "Collapse menu" }) }) }) }),
968
- /* @__PURE__ */ t.jsx(R, { children: /* @__PURE__ */ t.jsx(P, { asChild: !0, children: /* @__PURE__ */ t.jsx(wt, { buttonClassName: "p-0", setTheme: l, theme: i, variant: "stacked" }) }) }),
969
- n.length > 0 && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
970
- /* @__PURE__ */ t.jsx(he, {}),
971
- /* @__PURE__ */ t.jsx(U, { activeSlug: r, itemSets: n })
972
- ] })
973
- ] }) }),
974
- /* @__PURE__ */ t.jsx(Bt, {})
975
- ] }), sa = ({ children: e, ...a }) => /* @__PURE__ */ t.jsxs(zt, { children: [
976
- /* @__PURE__ */ t.jsx(Yt, { ...a }),
977
- /* @__PURE__ */ t.jsx(Ft, { className: "max-w-screen-xl", children: e })
978
- ] });
979
- export {
980
- fe as M,
981
- $t as S,
982
- wt as T,
983
- Yt as a,
984
- sa as b,
985
- j as c
986
- };