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