@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
954 lines (953 loc) • 32 kB
JavaScript
import { jsx as a, jsxs as re } from "react/jsx-runtime";
import { c as b } from "./index-2NvaPZWc.mjs";
import { C as bn } from "./chevron-right-BLuy6fjX.mjs";
import { C as xn } from "./check-CSqvOiIj.mjs";
import { c as Sn } from "./createLucideIcon-B950nf2d.mjs";
import * as c from "react";
import { c as _e, a as v, u as Re } from "./index-CBSFK5oB.mjs";
import { b as De, u as F, c as In } from "./index-CB1Wkg0G.mjs";
import { P as T, d as Pn } from "./index-8-FPuQXg.mjs";
import { c as yn, u as En } from "./index-rArYPB5W.mjs";
import { D as Nn } from "./index-e9WAJWP9.mjs";
import { P as Tn, u as An, R as On, F as kn, h as Ln } from "./index-D5vghtYb.mjs";
import { u as Y } from "./index-D59fTEgK.mjs";
import { c as be, R as xe, A as Gn, C as Fn, a as Kn } from "./index-BiEE5p2P.mjs";
import { P as Z } from "./index-dgd0uIiN.mjs";
import { c as Se, I as $n, R as Un } from "./index-DvTuq9HA.mjs";
import { u as ae } from "./index-DwYXX2sM.mjs";
var te = ["Enter", " "], Bn = ["ArrowDown", "PageUp", "Home"], Ie = ["ArrowUp", "PageDown", "End"], Vn = [...Bn, ...Ie], zn = {
ltr: [...te, "ArrowRight"],
rtl: [...te, "ArrowLeft"]
}, jn = {
ltr: ["ArrowLeft"],
rtl: ["ArrowRight"]
}, K = "Menu", [L, Xn, Yn] = yn(K), [P, Pe] = _e(K, [
Yn,
be,
Se
]), $ = be(), ye = Se(), [Ee, S] = P(K), [Hn, U] = P(K), Ne = (e) => {
const { __scopeMenu: o, open: n = !1, children: t, dir: r, onOpenChange: s, modal: i = !0 } = e, d = $(o), [m, M] = c.useState(null), p = c.useRef(!1), u = ae(s), f = En(r);
return c.useEffect(() => {
const h = () => {
p.current = !0, document.addEventListener("pointerdown", g, { capture: !0, once: !0 }), document.addEventListener("pointermove", g, { capture: !0, once: !0 });
}, g = () => p.current = !1;
return document.addEventListener("keydown", h, { capture: !0 }), () => {
document.removeEventListener("keydown", h, { capture: !0 }), document.removeEventListener("pointerdown", g, { capture: !0 }), document.removeEventListener("pointermove", g, { capture: !0 });
};
}, []), /* @__PURE__ */ a(xe, { ...d, children: /* @__PURE__ */ a(
Ee,
{
scope: o,
open: n,
onOpenChange: u,
content: m,
onContentChange: M,
children: /* @__PURE__ */ a(
Hn,
{
scope: o,
onClose: c.useCallback(() => u(!1), [u]),
isUsingKeyboardRef: p,
dir: f,
modal: i,
children: t
}
)
}
) });
};
Ne.displayName = K;
var Wn = "MenuAnchor", ce = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, ...t } = e, r = $(n);
return /* @__PURE__ */ a(Gn, { ...r, ...t, ref: o });
}
);
ce.displayName = Wn;
var se = "MenuPortal", [Zn, Te] = P(se, {
forceMount: void 0
}), Ae = (e) => {
const { __scopeMenu: o, forceMount: n, children: t, container: r } = e, s = S(se, o);
return /* @__PURE__ */ a(Zn, { scope: o, forceMount: n, children: /* @__PURE__ */ a(Z, { present: n || s.open, children: /* @__PURE__ */ a(Tn, { asChild: !0, container: r, children: t }) }) });
};
Ae.displayName = se;
var _ = "MenuContent", [qn, ue] = P(_), Oe = c.forwardRef(
(e, o) => {
const n = Te(_, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, s = S(_, e.__scopeMenu), i = U(_, e.__scopeMenu);
return /* @__PURE__ */ a(L.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(Z, { present: t || s.open, children: /* @__PURE__ */ a(L.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ a(Jn, { ...r, ref: o }) : /* @__PURE__ */ a(Qn, { ...r, ref: o }) }) }) });
}
), Jn = c.forwardRef(
(e, o) => {
const n = S(_, e.__scopeMenu), t = c.useRef(null), r = F(o, t);
return c.useEffect(() => {
const s = t.current;
if (s) return Ln(s);
}, []), /* @__PURE__ */ a(
ie,
{
...e,
ref: r,
trapFocus: n.open,
disableOutsidePointerEvents: n.open,
disableOutsideScroll: !0,
onFocusOutside: v(
e.onFocusOutside,
(s) => s.preventDefault(),
{ checkForDefaultPrevented: !1 }
),
onDismiss: () => n.onOpenChange(!1)
}
);
}
), Qn = c.forwardRef((e, o) => {
const n = S(_, e.__scopeMenu);
return /* @__PURE__ */ a(
ie,
{
...e,
ref: o,
trapFocus: !1,
disableOutsidePointerEvents: !1,
disableOutsideScroll: !1,
onDismiss: () => n.onOpenChange(!1)
}
);
}), eo = In("MenuContent.ScrollLock"), ie = c.forwardRef(
(e, o) => {
const {
__scopeMenu: n,
loop: t = !1,
trapFocus: r,
onOpenAutoFocus: s,
onCloseAutoFocus: i,
disableOutsidePointerEvents: d,
onEntryFocus: m,
onEscapeKeyDown: M,
onPointerDownOutside: p,
onFocusOutside: u,
onInteractOutside: f,
onDismiss: h,
disableOutsideScroll: g,
...I
} = e, y = S(_, n), A = U(_, n), B = $(n), V = ye(n), me = Xn(n), [hn, Me] = c.useState(null), z = c.useRef(null), wn = F(o, z, y.onContentChange), j = c.useRef(0), X = c.useRef(""), Cn = c.useRef(0), Q = c.useRef(null), ve = c.useRef("right"), ee = c.useRef(0), _n = g ? On : c.Fragment, Rn = g ? { as: eo, allowPinchZoom: !0 } : void 0, Dn = (l) => {
var N, he;
const C = X.current + l, R = me().filter((D) => !D.disabled), x = document.activeElement, ne = (N = R.find((D) => D.ref.current === x)) == null ? void 0 : N.textValue, oe = R.map((D) => D.textValue), ge = fo(oe, C, ne), O = (he = R.find((D) => D.textValue === ge)) == null ? void 0 : he.ref.current;
(function D(we) {
X.current = we, window.clearTimeout(j.current), we !== "" && (j.current = window.setTimeout(() => D(""), 1e3));
})(C), O && setTimeout(() => O.focus());
};
c.useEffect(() => () => window.clearTimeout(j.current), []), An();
const E = c.useCallback((l) => {
var R, x;
return ve.current === ((R = Q.current) == null ? void 0 : R.side) && Mo(l, (x = Q.current) == null ? void 0 : x.area);
}, []);
return /* @__PURE__ */ a(
qn,
{
scope: n,
searchRef: X,
onItemEnter: c.useCallback(
(l) => {
E(l) && l.preventDefault();
},
[E]
),
onItemLeave: c.useCallback(
(l) => {
var C;
E(l) || ((C = z.current) == null || C.focus(), Me(null));
},
[E]
),
onTriggerLeave: c.useCallback(
(l) => {
E(l) && l.preventDefault();
},
[E]
),
pointerGraceTimerRef: Cn,
onPointerGraceIntentChange: c.useCallback((l) => {
Q.current = l;
}, []),
children: /* @__PURE__ */ a(_n, { ...Rn, children: /* @__PURE__ */ a(
kn,
{
asChild: !0,
trapped: r,
onMountAutoFocus: v(s, (l) => {
var C;
l.preventDefault(), (C = z.current) == null || C.focus({ preventScroll: !0 });
}),
onUnmountAutoFocus: i,
children: /* @__PURE__ */ a(
Nn,
{
asChild: !0,
disableOutsidePointerEvents: d,
onEscapeKeyDown: M,
onPointerDownOutside: p,
onFocusOutside: u,
onInteractOutside: f,
onDismiss: h,
children: /* @__PURE__ */ a(
Un,
{
asChild: !0,
...V,
dir: A.dir,
orientation: "vertical",
loop: t,
currentTabStopId: hn,
onCurrentTabStopIdChange: Me,
onEntryFocus: v(m, (l) => {
A.isUsingKeyboardRef.current || l.preventDefault();
}),
preventScrollOnEntryFocus: !0,
children: /* @__PURE__ */ a(
Fn,
{
role: "menu",
"aria-orientation": "vertical",
"data-state": qe(y.open),
"data-radix-menu-content": "",
dir: A.dir,
...B,
...I,
ref: wn,
style: { outline: "none", ...I.style },
onKeyDown: v(I.onKeyDown, (l) => {
const R = l.target.closest("[data-radix-menu-content]") === l.currentTarget, x = l.ctrlKey || l.altKey || l.metaKey, ne = l.key.length === 1;
R && (l.key === "Tab" && l.preventDefault(), !x && ne && Dn(l.key));
const oe = z.current;
if (l.target !== oe || !Vn.includes(l.key)) return;
l.preventDefault();
const O = me().filter((N) => !N.disabled).map((N) => N.ref.current);
Ie.includes(l.key) && O.reverse(), lo(O);
}),
onBlur: v(e.onBlur, (l) => {
l.currentTarget.contains(l.target) || (window.clearTimeout(j.current), X.current = "");
}),
onPointerMove: v(
e.onPointerMove,
G((l) => {
const C = l.target, R = ee.current !== l.clientX;
if (l.currentTarget.contains(C) && R) {
const x = l.clientX > ee.current ? "right" : "left";
ve.current = x, ee.current = l.clientX;
}
})
)
}
)
}
)
}
)
}
) })
}
);
}
);
Oe.displayName = _;
var no = "MenuGroup", de = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a(T.div, { role: "group", ...t, ref: o });
}
);
de.displayName = no;
var oo = "MenuLabel", ke = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a(T.div, { ...t, ref: o });
}
);
ke.displayName = oo;
var H = "MenuItem", Ce = "menu.itemSelect", q = c.forwardRef(
(e, o) => {
const { disabled: n = !1, onSelect: t, ...r } = e, s = c.useRef(null), i = U(H, e.__scopeMenu), d = ue(H, e.__scopeMenu), m = F(o, s), M = c.useRef(!1), p = () => {
const u = s.current;
if (!n && u) {
const f = new CustomEvent(Ce, { bubbles: !0, cancelable: !0 });
u.addEventListener(Ce, (h) => t == null ? void 0 : t(h), { once: !0 }), Pn(u, f), f.defaultPrevented ? M.current = !1 : i.onClose();
}
};
return /* @__PURE__ */ a(
Le,
{
...r,
ref: m,
disabled: n,
onClick: v(e.onClick, p),
onPointerDown: (u) => {
var f;
(f = e.onPointerDown) == null || f.call(e, u), M.current = !0;
},
onPointerUp: v(e.onPointerUp, (u) => {
var f;
M.current || (f = u.currentTarget) == null || f.click();
}),
onKeyDown: v(e.onKeyDown, (u) => {
const f = d.searchRef.current !== "";
n || f && u.key === " " || te.includes(u.key) && (u.currentTarget.click(), u.preventDefault());
})
}
);
}
);
q.displayName = H;
var Le = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, disabled: t = !1, textValue: r, ...s } = e, i = ue(H, n), d = ye(n), m = c.useRef(null), M = F(o, m), [p, u] = c.useState(!1), [f, h] = c.useState("");
return c.useEffect(() => {
const g = m.current;
g && h((g.textContent ?? "").trim());
}, [s.children]), /* @__PURE__ */ a(
L.ItemSlot,
{
scope: n,
disabled: t,
textValue: r ?? f,
children: /* @__PURE__ */ a($n, { asChild: !0, ...d, focusable: !t, children: /* @__PURE__ */ a(
T.div,
{
role: "menuitem",
"data-highlighted": p ? "" : void 0,
"aria-disabled": t || void 0,
"data-disabled": t ? "" : void 0,
...s,
ref: M,
onPointerMove: v(
e.onPointerMove,
G((g) => {
t ? i.onItemLeave(g) : (i.onItemEnter(g), g.defaultPrevented || g.currentTarget.focus({ preventScroll: !0 }));
})
),
onPointerLeave: v(
e.onPointerLeave,
G((g) => i.onItemLeave(g))
),
onFocus: v(e.onFocus, () => u(!0)),
onBlur: v(e.onBlur, () => u(!1))
}
) })
}
);
}
), to = "MenuCheckboxItem", Ge = c.forwardRef(
(e, o) => {
const { checked: n = !1, onCheckedChange: t, ...r } = e;
return /* @__PURE__ */ a(Be, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ a(
q,
{
role: "menuitemcheckbox",
"aria-checked": W(n) ? "mixed" : n,
...r,
ref: o,
"data-state": fe(n),
onSelect: v(
r.onSelect,
() => t == null ? void 0 : t(W(n) ? !0 : !n),
{ checkForDefaultPrevented: !1 }
)
}
) });
}
);
Ge.displayName = to;
var Fe = "MenuRadioGroup", [ro, ao] = P(
Fe,
{ value: void 0, onValueChange: () => {
} }
), Ke = c.forwardRef(
(e, o) => {
const { value: n, onValueChange: t, ...r } = e, s = ae(t);
return /* @__PURE__ */ a(ro, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ a(de, { ...r, ref: o }) });
}
);
Ke.displayName = Fe;
var $e = "MenuRadioItem", Ue = c.forwardRef(
(e, o) => {
const { value: n, ...t } = e, r = ao($e, e.__scopeMenu), s = n === r.value;
return /* @__PURE__ */ a(Be, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ a(
q,
{
role: "menuitemradio",
"aria-checked": s,
...t,
ref: o,
"data-state": fe(s),
onSelect: v(
t.onSelect,
() => {
var i;
return (i = r.onValueChange) == null ? void 0 : i.call(r, n);
},
{ checkForDefaultPrevented: !1 }
)
}
) });
}
);
Ue.displayName = $e;
var le = "MenuItemIndicator", [Be, co] = P(
le,
{ checked: !1 }
), Ve = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, forceMount: t, ...r } = e, s = co(le, n);
return /* @__PURE__ */ a(
Z,
{
present: t || W(s.checked) || s.checked === !0,
children: /* @__PURE__ */ a(
T.span,
{
...r,
ref: o,
"data-state": fe(s.checked)
}
)
}
);
}
);
Ve.displayName = le;
var so = "MenuSeparator", ze = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a(
T.div,
{
role: "separator",
"aria-orientation": "horizontal",
...t,
ref: o
}
);
}
);
ze.displayName = so;
var uo = "MenuArrow", je = c.forwardRef(
(e, o) => {
const { __scopeMenu: n, ...t } = e, r = $(n);
return /* @__PURE__ */ a(Kn, { ...r, ...t, ref: o });
}
);
je.displayName = uo;
var pe = "MenuSub", [io, Xe] = P(pe), Ye = (e) => {
const { __scopeMenu: o, children: n, open: t = !1, onOpenChange: r } = e, s = S(pe, o), i = $(o), [d, m] = c.useState(null), [M, p] = c.useState(null), u = ae(r);
return c.useEffect(() => (s.open === !1 && u(!1), () => u(!1)), [s.open, u]), /* @__PURE__ */ a(xe, { ...i, children: /* @__PURE__ */ a(
Ee,
{
scope: o,
open: t,
onOpenChange: u,
content: M,
onContentChange: p,
children: /* @__PURE__ */ a(
io,
{
scope: o,
contentId: Y(),
triggerId: Y(),
trigger: d,
onTriggerChange: m,
children: n
}
)
}
) });
};
Ye.displayName = pe;
var k = "MenuSubTrigger", He = c.forwardRef(
(e, o) => {
const n = S(k, e.__scopeMenu), t = U(k, e.__scopeMenu), r = Xe(k, e.__scopeMenu), s = ue(k, e.__scopeMenu), i = c.useRef(null), { pointerGraceTimerRef: d, onPointerGraceIntentChange: m } = s, M = { __scopeMenu: e.__scopeMenu }, p = c.useCallback(() => {
i.current && window.clearTimeout(i.current), i.current = null;
}, []);
return c.useEffect(() => p, [p]), c.useEffect(() => {
const u = d.current;
return () => {
window.clearTimeout(u), m(null);
};
}, [d, m]), /* @__PURE__ */ a(ce, { asChild: !0, ...M, children: /* @__PURE__ */ a(
Le,
{
id: r.triggerId,
"aria-haspopup": "menu",
"aria-expanded": n.open,
"aria-controls": r.contentId,
"data-state": qe(n.open),
...e,
ref: De(o, r.onTriggerChange),
onClick: (u) => {
var f;
(f = e.onClick) == null || f.call(e, u), !(e.disabled || u.defaultPrevented) && (u.currentTarget.focus(), n.open || n.onOpenChange(!0));
},
onPointerMove: v(
e.onPointerMove,
G((u) => {
s.onItemEnter(u), !u.defaultPrevented && !e.disabled && !n.open && !i.current && (s.onPointerGraceIntentChange(null), i.current = window.setTimeout(() => {
n.onOpenChange(!0), p();
}, 100));
})
),
onPointerLeave: v(
e.onPointerLeave,
G((u) => {
var h, g;
p();
const f = (h = n.content) == null ? void 0 : h.getBoundingClientRect();
if (f) {
const I = (g = n.content) == null ? void 0 : g.dataset.side, y = I === "right", A = y ? -5 : 5, B = f[y ? "left" : "right"], V = f[y ? "right" : "left"];
s.onPointerGraceIntentChange({
area: [
// Apply a bleed on clientX to ensure that our exit point is
// consistently within polygon bounds
{ x: u.clientX + A, y: u.clientY },
{ x: B, y: f.top },
{ x: V, y: f.top },
{ x: V, y: f.bottom },
{ x: B, y: f.bottom }
],
side: I
}), window.clearTimeout(d.current), d.current = window.setTimeout(
() => s.onPointerGraceIntentChange(null),
300
);
} else {
if (s.onTriggerLeave(u), u.defaultPrevented) return;
s.onPointerGraceIntentChange(null);
}
})
),
onKeyDown: v(e.onKeyDown, (u) => {
var h;
const f = s.searchRef.current !== "";
e.disabled || f && u.key === " " || zn[t.dir].includes(u.key) && (n.onOpenChange(!0), (h = n.content) == null || h.focus(), u.preventDefault());
})
}
) });
}
);
He.displayName = k;
var We = "MenuSubContent", Ze = c.forwardRef(
(e, o) => {
const n = Te(_, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, s = S(_, e.__scopeMenu), i = U(_, e.__scopeMenu), d = Xe(We, e.__scopeMenu), m = c.useRef(null), M = F(o, m);
return /* @__PURE__ */ a(L.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(Z, { present: t || s.open, children: /* @__PURE__ */ a(L.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ a(
ie,
{
id: d.contentId,
"aria-labelledby": d.triggerId,
...r,
ref: M,
align: "start",
side: i.dir === "rtl" ? "left" : "right",
disableOutsidePointerEvents: !1,
disableOutsideScroll: !1,
trapFocus: !1,
onOpenAutoFocus: (p) => {
var u;
i.isUsingKeyboardRef.current && ((u = m.current) == null || u.focus()), p.preventDefault();
},
onCloseAutoFocus: (p) => p.preventDefault(),
onFocusOutside: v(e.onFocusOutside, (p) => {
p.target !== d.trigger && s.onOpenChange(!1);
}),
onEscapeKeyDown: v(e.onEscapeKeyDown, (p) => {
i.onClose(), p.preventDefault();
}),
onKeyDown: v(e.onKeyDown, (p) => {
var h;
const u = p.currentTarget.contains(p.target), f = jn[i.dir].includes(p.key);
u && f && (s.onOpenChange(!1), (h = d.trigger) == null || h.focus(), p.preventDefault());
})
}
) }) }) });
}
);
Ze.displayName = We;
function qe(e) {
return e ? "open" : "closed";
}
function W(e) {
return e === "indeterminate";
}
function fe(e) {
return W(e) ? "indeterminate" : e ? "checked" : "unchecked";
}
function lo(e) {
const o = document.activeElement;
for (const n of e)
if (n === o || (n.focus(), document.activeElement !== o)) return;
}
function po(e, o) {
return e.map((n, t) => e[(o + t) % e.length]);
}
function fo(e, o, n) {
const r = o.length > 1 && Array.from(o).every((M) => M === o[0]) ? o[0] : o, s = n ? e.indexOf(n) : -1;
let i = po(e, Math.max(s, 0));
r.length === 1 && (i = i.filter((M) => M !== n));
const m = i.find(
(M) => M.toLowerCase().startsWith(r.toLowerCase())
);
return m !== n ? m : void 0;
}
function mo(e, o) {
const { x: n, y: t } = e;
let r = !1;
for (let s = 0, i = o.length - 1; s < o.length; i = s++) {
const d = o[s], m = o[i], M = d.x, p = d.y, u = m.x, f = m.y;
p > t != f > t && n < (u - M) * (t - p) / (f - p) + M && (r = !r);
}
return r;
}
function Mo(e, o) {
if (!o) return !1;
const n = { x: e.clientX, y: e.clientY };
return mo(n, o);
}
function G(e) {
return (o) => o.pointerType === "mouse" ? e(o) : void 0;
}
var vo = Ne, go = ce, ho = Ae, wo = Oe, Co = de, _o = ke, Ro = q, Do = Ge, bo = Ke, xo = Ue, So = Ve, Io = ze, Po = je, yo = Ye, Eo = He, No = Ze, J = "DropdownMenu", [To, xt] = _e(
J,
[Pe]
), w = Pe(), [Ao, Je] = To(J), Qe = (e) => {
const {
__scopeDropdownMenu: o,
children: n,
dir: t,
open: r,
defaultOpen: s,
onOpenChange: i,
modal: d = !0
} = e, m = w(o), M = c.useRef(null), [p, u] = Re({
prop: r,
defaultProp: s ?? !1,
onChange: i,
caller: J
});
return /* @__PURE__ */ a(
Ao,
{
scope: o,
triggerId: Y(),
triggerRef: M,
contentId: Y(),
open: p,
onOpenChange: u,
onOpenToggle: c.useCallback(() => u((f) => !f), [u]),
modal: d,
children: /* @__PURE__ */ a(vo, { ...m, open: p, onOpenChange: u, dir: t, modal: d, children: n })
}
);
};
Qe.displayName = J;
var en = "DropdownMenuTrigger", nn = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, disabled: t = !1, ...r } = e, s = Je(en, n), i = w(n);
return /* @__PURE__ */ a(go, { asChild: !0, ...i, children: /* @__PURE__ */ a(
T.button,
{
type: "button",
id: s.triggerId,
"aria-haspopup": "menu",
"aria-expanded": s.open,
"aria-controls": s.open ? s.contentId : void 0,
"data-state": s.open ? "open" : "closed",
"data-disabled": t ? "" : void 0,
disabled: t,
...r,
ref: De(o, s.triggerRef),
onPointerDown: v(e.onPointerDown, (d) => {
!t && d.button === 0 && d.ctrlKey === !1 && (s.onOpenToggle(), s.open || d.preventDefault());
}),
onKeyDown: v(e.onKeyDown, (d) => {
t || (["Enter", " "].includes(d.key) && s.onOpenToggle(), d.key === "ArrowDown" && s.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
})
}
) });
}
);
nn.displayName = en;
var Oo = "DropdownMenuPortal", on = (e) => {
const { __scopeDropdownMenu: o, ...n } = e, t = w(o);
return /* @__PURE__ */ a(ho, { ...t, ...n });
};
on.displayName = Oo;
var tn = "DropdownMenuContent", rn = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = Je(tn, n), s = w(n), i = c.useRef(!1);
return /* @__PURE__ */ a(
wo,
{
id: r.contentId,
"aria-labelledby": r.triggerId,
...s,
...t,
ref: o,
onCloseAutoFocus: v(e.onCloseAutoFocus, (d) => {
var m;
i.current || (m = r.triggerRef.current) == null || m.focus(), i.current = !1, d.preventDefault();
}),
onInteractOutside: v(e.onInteractOutside, (d) => {
const m = d.detail.originalEvent, M = m.button === 0 && m.ctrlKey === !0, p = m.button === 2 || M;
(!r.modal || p) && (i.current = !0);
}),
style: {
...e.style,
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
}
}
);
}
);
rn.displayName = tn;
var ko = "DropdownMenuGroup", an = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Co, { ...r, ...t, ref: o });
}
);
an.displayName = ko;
var Lo = "DropdownMenuLabel", cn = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(_o, { ...r, ...t, ref: o });
}
);
cn.displayName = Lo;
var Go = "DropdownMenuItem", sn = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Ro, { ...r, ...t, ref: o });
}
);
sn.displayName = Go;
var Fo = "DropdownMenuCheckboxItem", un = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Do, { ...r, ...t, ref: o });
});
un.displayName = Fo;
var Ko = "DropdownMenuRadioGroup", dn = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(bo, { ...r, ...t, ref: o });
});
dn.displayName = Ko;
var $o = "DropdownMenuRadioItem", ln = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(xo, { ...r, ...t, ref: o });
});
ln.displayName = $o;
var Uo = "DropdownMenuItemIndicator", pn = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(So, { ...r, ...t, ref: o });
});
pn.displayName = Uo;
var Bo = "DropdownMenuSeparator", fn = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Io, { ...r, ...t, ref: o });
});
fn.displayName = Bo;
var Vo = "DropdownMenuArrow", zo = c.forwardRef(
(e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Po, { ...r, ...t, ref: o });
}
);
zo.displayName = Vo;
var jo = (e) => {
const { __scopeDropdownMenu: o, children: n, open: t, onOpenChange: r, defaultOpen: s } = e, i = w(o), [d, m] = Re({
prop: t,
defaultProp: s ?? !1,
onChange: r,
caller: "DropdownMenuSub"
});
return /* @__PURE__ */ a(yo, { ...i, open: d, onOpenChange: m, children: n });
}, Xo = "DropdownMenuSubTrigger", mn = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(Eo, { ...r, ...t, ref: o });
});
mn.displayName = Xo;
var Yo = "DropdownMenuSubContent", Mn = c.forwardRef((e, o) => {
const { __scopeDropdownMenu: n, ...t } = e, r = w(n);
return /* @__PURE__ */ a(
No,
{
...r,
...t,
ref: o,
style: {
...e.style,
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
}
}
);
});
Mn.displayName = Yo;
var Ho = Qe, Wo = nn, vn = on, Zo = rn, qo = an, Jo = cn, Qo = sn, et = un, nt = dn, ot = ln, gn = pn, tt = fn, rt = jo, at = mn, ct = Mn;
/**
* @license lucide-react v0.511.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const st = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], ut = Sn("circle", st), St = Ho, It = Wo, Pt = qo, yt = vn, Et = rt, Nt = nt, Tt = ({
className: e,
inset: o,
children: n,
...t
}) => /* @__PURE__ */ re(
at,
{
className: b(
"focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden select-none",
o && "pl-8",
e
),
...t,
children: [
n,
/* @__PURE__ */ a(bn, { className: "ml-auto size-4" })
]
}
), At = ({
className: e,
...o
}) => /* @__PURE__ */ a(
ct,
{
className: b(
"animate-entrance-fade-slide bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1",
e
),
...o
}
), Ot = ({
className: e,
container: o,
sideOffset: n = 4,
...t
}) => {
const r = /* @__PURE__ */ a(
Zo,
{
sideOffset: n,
className: b(
"animate-entrance-fade-slide bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1",
e
),
...t
}
);
return o === null ? r : /* @__PURE__ */ a(vn, { container: o, children: r });
}, kt = ({
className: e,
inset: o,
...n
}) => /* @__PURE__ */ a(
Qo,
{
className: b(
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4",
o && "pl-8",
e
),
...n
}
), Lt = ({
className: e,
children: o,
checked: n,
...t
}) => /* @__PURE__ */ re(
et,
{
className: b(
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden transition select-none data-disabled:pointer-events-none data-disabled:opacity-50",
e
),
checked: n,
...t,
children: [
/* @__PURE__ */ a("span", { className: "flex-center absolute left-2 size-3.5", children: /* @__PURE__ */ a(gn, { children: /* @__PURE__ */ a(xn, { className: "size-4" }) }) }),
o
]
}
), Gt = ({
className: e,
children: o,
...n
}) => /* @__PURE__ */ re(
ot,
{
className: b(
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden transition select-none data-disabled:pointer-events-none data-disabled:opacity-50",
e
),
...n,
children: [
/* @__PURE__ */ a("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ a(gn, { children: /* @__PURE__ */ a(ut, { className: "size-2 fill-current" }) }) }),
o
]
}
), Ft = ({
className: e,
inset: o,
...n
}) => /* @__PURE__ */ a(
Jo,
{
className: b(
"px-2 py-1.5 text-sm font-semibold",
o && "pl-8",
e
),
...n
}
), Kt = ({
className: e,
...o
}) => /* @__PURE__ */ a(
tt,
{
className: b("bg-muted -mx-1 my-1 h-px", e),
...o
}
), $t = ({
className: e,
...o
}) => /* @__PURE__ */ a(
"span",
{
className: b("ml-auto text-xs tracking-widest opacity-60", e),
...o
}
);
export {
St as D,
It as a,
Pt as b,
yt as c,
Et as d,
Nt as e,
Tt as f,
At as g,
Ot as h,
kt as i,
Lt as j,
Gt as k,
Ft as l,
Kt as m,
$t as n
};