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