dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
874 lines (873 loc) • 31.5 kB
JavaScript
import { j as he, y as bn, a, g as me, h as O, b as h, m as ge, n as we, R as H, x as L, w as Dn, c as jn, M as Rn } from "./index-DqTIeHVj-CeLMF2B2.js";
import * as s from "react";
import { t as Cn, X as Nn, b as xe, n as kn, g as Pn, S as On, a as In } from "./circle-COtEidYe-DaI8pjYh.js";
import { M as En, R as Sn, C as Tn, d as $n, S as Fn } from "./createLucideIcon-B950nf2d-C2YhAyqE.js";
import { o as ye, i as Ln, r as Kn, s as An, c as Gn } from "./index-VIo8j85K-Gso9ejBr.js";
import { m as D } from "./utils-B6fNqzRf-B1_jG1K7.js";
import { e as zn } from "./chevron-right-HWBijj-I-CVwIY20F.js";
var ne = ["Enter", " "], Un = ["ArrowDown", "PageUp", "Home"], _e = ["ArrowUp", "PageDown", "End"], Vn = [...Un, ..._e], Bn = {
ltr: [...ne, "ArrowRight"],
rtl: [...ne, "ArrowLeft"]
}, Xn = {
ltr: ["ArrowLeft"],
rtl: ["ArrowRight"]
}, K = "Menu", [$, Wn, qn] = Nn(K), [j, Me] = he(K, [
qn,
ye,
xe
]), Q = ye(), be = xe(), [Hn, R] = j(K), [Qn, A] = j(K), De = (e) => {
const { __scopeMenu: r, open: n = !1, children: t, dir: o, onOpenChange: i, modal: l = !0 } = e, d = Q(r), [m, g] = s.useState(null), p = s.useRef(!1), c = we(i), f = kn(o);
return s.useEffect(() => {
const w = () => {
p.current = !0, document.addEventListener("pointerdown", v, { capture: !0, once: !0 }), document.addEventListener("pointermove", v, { capture: !0, once: !0 });
}, v = () => p.current = !1;
return document.addEventListener("keydown", w, { capture: !0 }), () => {
document.removeEventListener("keydown", w, { capture: !0 }), document.removeEventListener("pointerdown", v, { capture: !0 }), document.removeEventListener("pointermove", v, { capture: !0 });
};
}, []), /* @__PURE__ */ a.jsx(Ln, { ...d, children: /* @__PURE__ */ a.jsx(
Hn,
{
scope: r,
open: n,
onOpenChange: c,
content: m,
onContentChange: g,
children: /* @__PURE__ */ a.jsx(
Qn,
{
scope: r,
onClose: s.useCallback(() => c(!1), [c]),
isUsingKeyboardRef: p,
dir: f,
modal: l,
children: t
}
)
}
) });
};
De.displayName = K;
var Yn = "MenuAnchor", re = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, ...t } = e, o = Q(n);
return /* @__PURE__ */ a.jsx(Kn, { ...o, ...t, ref: r });
}
);
re.displayName = Yn;
var te = "MenuPortal", [Zn, je] = j(te, {
forceMount: void 0
}), Re = (e) => {
const { __scopeMenu: r, forceMount: n, children: t, container: o } = e, i = R(te, r);
return /* @__PURE__ */ a.jsx(Zn, { scope: r, forceMount: n, children: /* @__PURE__ */ a.jsx(H, { present: n || i.open, children: /* @__PURE__ */ a.jsx(En, { asChild: !0, container: o, children: t }) }) });
};
Re.displayName = te;
var _ = "MenuContent", [Jn, oe] = j(_), Ce = s.forwardRef(
(e, r) => {
const n = je(_, e.__scopeMenu), { forceMount: t = n.forceMount, ...o } = e, i = R(_, e.__scopeMenu), l = A(_, e.__scopeMenu);
return /* @__PURE__ */ a.jsx($.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a.jsx(H, { present: t || i.open, children: /* @__PURE__ */ a.jsx($.Slot, { scope: e.__scopeMenu, children: l.modal ? /* @__PURE__ */ a.jsx(er, { ...o, ref: r }) : /* @__PURE__ */ a.jsx(nr, { ...o, ref: r }) }) }) });
}
), er = s.forwardRef(
(e, r) => {
const n = R(_, e.__scopeMenu), t = s.useRef(null), o = L(r, t);
return s.useEffect(() => {
const i = t.current;
if (i) return Sn(i);
}, []), /* @__PURE__ */ a.jsx(
ae,
{
...e,
ref: o,
trapFocus: n.open,
disableOutsidePointerEvents: n.open,
disableOutsideScroll: !0,
onFocusOutside: h(
e.onFocusOutside,
(i) => i.preventDefault(),
{ checkForDefaultPrevented: !1 }
),
onDismiss: () => n.onOpenChange(!1)
}
);
}
), nr = s.forwardRef((e, r) => {
const n = R(_, e.__scopeMenu);
return /* @__PURE__ */ a.jsx(
ae,
{
...e,
ref: r,
trapFocus: !1,
disableOutsidePointerEvents: !1,
disableOutsideScroll: !1,
onDismiss: () => n.onOpenChange(!1)
}
);
}), rr = jn("MenuContent.ScrollLock"), ae = s.forwardRef(
(e, r) => {
const {
__scopeMenu: n,
loop: t = !1,
trapFocus: o,
onOpenAutoFocus: i,
onCloseAutoFocus: l,
disableOutsidePointerEvents: d,
onEntryFocus: m,
onEscapeKeyDown: g,
onPointerDownOutside: p,
onFocusOutside: c,
onInteractOutside: f,
onDismiss: w,
disableOutsideScroll: v,
...C
} = e, N = R(_, n), I = A(_, n), G = Q(n), z = be(n), de = Wn(n), [vn, ue] = s.useState(null), U = s.useRef(null), hn = L(r, U, N.onContentChange), V = s.useRef(0), B = s.useRef(""), gn = s.useRef(0), J = s.useRef(null), le = s.useRef("right"), ee = s.useRef(0), wn = v ? $n : s.Fragment, xn = v ? { as: rr, allowPinchZoom: !0 } : void 0, yn = (u) => {
var x, M;
const P = B.current + u, E = de().filter((b) => !b.disabled), X = document.activeElement, S = (x = E.find((b) => b.ref.current === X)) == null ? void 0 : x.textValue, _n = E.map((b) => b.textValue), Mn = mr(_n, P, S), pe = (M = E.find((b) => b.textValue === Mn)) == null ? void 0 : M.ref.current;
(function b(fe) {
B.current = fe, window.clearTimeout(V.current), fe !== "" && (V.current = window.setTimeout(() => b(""), 1e3));
})(P), pe && setTimeout(() => pe.focus());
};
s.useEffect(() => () => window.clearTimeout(V.current), []), Tn();
const k = s.useCallback((u) => {
var x, M;
return le.current === ((x = J.current) == null ? void 0 : x.side) && hr(u, (M = J.current) == null ? void 0 : M.area);
}, []);
return /* @__PURE__ */ a.jsx(
Jn,
{
scope: n,
searchRef: B,
onItemEnter: s.useCallback(
(u) => {
k(u) && u.preventDefault();
},
[k]
),
onItemLeave: s.useCallback(
(u) => {
var x;
k(u) || ((x = U.current) == null || x.focus(), ue(null));
},
[k]
),
onTriggerLeave: s.useCallback(
(u) => {
k(u) && u.preventDefault();
},
[k]
),
pointerGraceTimerRef: gn,
onPointerGraceIntentChange: s.useCallback((u) => {
J.current = u;
}, []),
children: /* @__PURE__ */ a.jsx(wn, { ...xn, children: /* @__PURE__ */ a.jsx(
Fn,
{
asChild: !0,
trapped: o,
onMountAutoFocus: h(i, (u) => {
var x;
u.preventDefault(), (x = U.current) == null || x.focus({ preventScroll: !0 });
}),
onUnmountAutoFocus: l,
children: /* @__PURE__ */ a.jsx(
Rn,
{
asChild: !0,
disableOutsidePointerEvents: d,
onEscapeKeyDown: g,
onPointerDownOutside: p,
onFocusOutside: c,
onInteractOutside: f,
onDismiss: w,
children: /* @__PURE__ */ a.jsx(
On,
{
asChild: !0,
...z,
dir: I.dir,
orientation: "vertical",
loop: t,
currentTabStopId: vn,
onCurrentTabStopIdChange: ue,
onEntryFocus: h(m, (u) => {
I.isUsingKeyboardRef.current || u.preventDefault();
}),
preventScrollOnEntryFocus: !0,
children: /* @__PURE__ */ a.jsx(
An,
{
role: "menu",
"aria-orientation": "vertical",
"data-state": Ue(N.open),
"data-radix-menu-content": "",
dir: I.dir,
...G,
...C,
ref: hn,
style: { outline: "none", ...C.style },
onKeyDown: h(C.onKeyDown, (u) => {
const x = u.target.closest("[data-radix-menu-content]") === u.currentTarget, M = u.ctrlKey || u.altKey || u.metaKey, P = u.key.length === 1;
x && (u.key === "Tab" && u.preventDefault(), !M && P && yn(u.key));
const E = U.current;
if (u.target !== E || !Vn.includes(u.key)) return;
u.preventDefault();
const X = de().filter((S) => !S.disabled).map((S) => S.ref.current);
_e.includes(u.key) && X.reverse(), pr(X);
}),
onBlur: h(e.onBlur, (u) => {
u.currentTarget.contains(u.target) || (window.clearTimeout(V.current), B.current = "");
}),
onPointerMove: h(
e.onPointerMove,
F((u) => {
const x = u.target, M = ee.current !== u.clientX;
if (u.currentTarget.contains(x) && M) {
const P = u.clientX > ee.current ? "right" : "left";
le.current = P, ee.current = u.clientX;
}
})
)
}
)
}
)
}
)
}
) })
}
);
}
);
Ce.displayName = _;
var tr = "MenuGroup", se = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a.jsx(O.div, { role: "group", ...t, ref: r });
}
);
se.displayName = tr;
var or = "MenuLabel", Ne = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a.jsx(O.div, { ...t, ref: r });
}
);
Ne.displayName = or;
var W = "MenuItem", ve = "menu.itemSelect", Y = s.forwardRef(
(e, r) => {
const { disabled: n = !1, onSelect: t, ...o } = e, i = s.useRef(null), l = A(W, e.__scopeMenu), d = oe(W, e.__scopeMenu), m = L(r, i), g = s.useRef(!1), p = () => {
const c = i.current;
if (!n && c) {
const f = new CustomEvent(ve, { bubbles: !0, cancelable: !0 });
c.addEventListener(ve, (w) => t == null ? void 0 : t(w), { once: !0 }), Dn(c, f), f.defaultPrevented ? g.current = !1 : l.onClose();
}
};
return /* @__PURE__ */ a.jsx(
ke,
{
...o,
ref: m,
disabled: n,
onClick: h(e.onClick, p),
onPointerDown: (c) => {
var f;
(f = e.onPointerDown) == null || f.call(e, c), g.current = !0;
},
onPointerUp: h(e.onPointerUp, (c) => {
var f;
g.current || (f = c.currentTarget) == null || f.click();
}),
onKeyDown: h(e.onKeyDown, (c) => {
const f = d.searchRef.current !== "";
n || f && c.key === " " || ne.includes(c.key) && (c.currentTarget.click(), c.preventDefault());
})
}
);
}
);
Y.displayName = W;
var ke = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, disabled: t = !1, textValue: o, ...i } = e, l = oe(W, n), d = be(n), m = s.useRef(null), g = L(r, m), [p, c] = s.useState(!1), [f, w] = s.useState("");
return s.useEffect(() => {
const v = m.current;
v && w((v.textContent ?? "").trim());
}, [i.children]), /* @__PURE__ */ a.jsx(
$.ItemSlot,
{
scope: n,
disabled: t,
textValue: o ?? f,
children: /* @__PURE__ */ a.jsx(Pn, { asChild: !0, ...d, focusable: !t, children: /* @__PURE__ */ a.jsx(
O.div,
{
role: "menuitem",
"data-highlighted": p ? "" : void 0,
"aria-disabled": t || void 0,
"data-disabled": t ? "" : void 0,
...i,
ref: g,
onPointerMove: h(
e.onPointerMove,
F((v) => {
t ? l.onItemLeave(v) : (l.onItemEnter(v), v.defaultPrevented || v.currentTarget.focus({ preventScroll: !0 }));
})
),
onPointerLeave: h(
e.onPointerLeave,
F((v) => l.onItemLeave(v))
),
onFocus: h(e.onFocus, () => c(!0)),
onBlur: h(e.onBlur, () => c(!1))
}
) })
}
);
}
), ar = "MenuCheckboxItem", Pe = s.forwardRef(
(e, r) => {
const { checked: n = !1, onCheckedChange: t, ...o } = e;
return /* @__PURE__ */ a.jsx(Te, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ a.jsx(
Y,
{
role: "menuitemcheckbox",
"aria-checked": q(n) ? "mixed" : n,
...o,
ref: r,
"data-state": ce(n),
onSelect: h(
o.onSelect,
() => t == null ? void 0 : t(q(n) ? !0 : !n),
{ checkForDefaultPrevented: !1 }
)
}
) });
}
);
Pe.displayName = ar;
var Oe = "MenuRadioGroup", [sr, ir] = j(
Oe,
{ value: void 0, onValueChange: () => {
} }
), Ie = s.forwardRef(
(e, r) => {
const { value: n, onValueChange: t, ...o } = e, i = we(t);
return /* @__PURE__ */ a.jsx(sr, { scope: e.__scopeMenu, value: n, onValueChange: i, children: /* @__PURE__ */ a.jsx(se, { ...o, ref: r }) });
}
);
Ie.displayName = Oe;
var Ee = "MenuRadioItem", Se = s.forwardRef(
(e, r) => {
const { value: n, ...t } = e, o = ir(Ee, e.__scopeMenu), i = n === o.value;
return /* @__PURE__ */ a.jsx(Te, { scope: e.__scopeMenu, checked: i, children: /* @__PURE__ */ a.jsx(
Y,
{
role: "menuitemradio",
"aria-checked": i,
...t,
ref: r,
"data-state": ce(i),
onSelect: h(
t.onSelect,
() => {
var l;
return (l = o.onValueChange) == null ? void 0 : l.call(o, n);
},
{ checkForDefaultPrevented: !1 }
)
}
) });
}
);
Se.displayName = Ee;
var ie = "MenuItemIndicator", [Te, cr] = j(
ie,
{ checked: !1 }
), $e = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, forceMount: t, ...o } = e, i = cr(ie, n);
return /* @__PURE__ */ a.jsx(
H,
{
present: t || q(i.checked) || i.checked === !0,
children: /* @__PURE__ */ a.jsx(
O.span,
{
...o,
ref: r,
"data-state": ce(i.checked)
}
)
}
);
}
);
$e.displayName = ie;
var dr = "MenuSeparator", Fe = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, ...t } = e;
return /* @__PURE__ */ a.jsx(
O.div,
{
role: "separator",
"aria-orientation": "horizontal",
...t,
ref: r
}
);
}
);
Fe.displayName = dr;
var ur = "MenuArrow", Le = s.forwardRef(
(e, r) => {
const { __scopeMenu: n, ...t } = e, o = Q(n);
return /* @__PURE__ */ a.jsx(Gn, { ...o, ...t, ref: r });
}
);
Le.displayName = ur;
var lr = "MenuSub", [pt, Ke] = j(lr), T = "MenuSubTrigger", Ae = s.forwardRef(
(e, r) => {
const n = R(T, e.__scopeMenu), t = A(T, e.__scopeMenu), o = Ke(T, e.__scopeMenu), i = oe(T, e.__scopeMenu), l = s.useRef(null), { pointerGraceTimerRef: d, onPointerGraceIntentChange: m } = i, g = { __scopeMenu: e.__scopeMenu }, p = s.useCallback(() => {
l.current && window.clearTimeout(l.current), l.current = null;
}, []);
return s.useEffect(() => p, [p]), s.useEffect(() => {
const c = d.current;
return () => {
window.clearTimeout(c), m(null);
};
}, [d, m]), /* @__PURE__ */ a.jsx(re, { asChild: !0, ...g, children: /* @__PURE__ */ a.jsx(
ke,
{
id: o.triggerId,
"aria-haspopup": "menu",
"aria-expanded": n.open,
"aria-controls": o.contentId,
"data-state": Ue(n.open),
...e,
ref: ge(r, o.onTriggerChange),
onClick: (c) => {
var f;
(f = e.onClick) == null || f.call(e, c), !(e.disabled || c.defaultPrevented) && (c.currentTarget.focus(), n.open || n.onOpenChange(!0));
},
onPointerMove: h(
e.onPointerMove,
F((c) => {
i.onItemEnter(c), !c.defaultPrevented && !e.disabled && !n.open && !l.current && (i.onPointerGraceIntentChange(null), l.current = window.setTimeout(() => {
n.onOpenChange(!0), p();
}, 100));
})
),
onPointerLeave: h(
e.onPointerLeave,
F((c) => {
var f, w;
p();
const v = (f = n.content) == null ? void 0 : f.getBoundingClientRect();
if (v) {
const C = (w = n.content) == null ? void 0 : w.dataset.side, N = C === "right", I = N ? -5 : 5, G = v[N ? "left" : "right"], z = v[N ? "right" : "left"];
i.onPointerGraceIntentChange({
area: [
// Apply a bleed on clientX to ensure that our exit point is
// consistently within polygon bounds
{ x: c.clientX + I, y: c.clientY },
{ x: G, y: v.top },
{ x: z, y: v.top },
{ x: z, y: v.bottom },
{ x: G, y: v.bottom }
],
side: C
}), window.clearTimeout(d.current), d.current = window.setTimeout(
() => i.onPointerGraceIntentChange(null),
300
);
} else {
if (i.onTriggerLeave(c), c.defaultPrevented) return;
i.onPointerGraceIntentChange(null);
}
})
),
onKeyDown: h(e.onKeyDown, (c) => {
var f;
const w = i.searchRef.current !== "";
e.disabled || w && c.key === " " || Bn[t.dir].includes(c.key) && (n.onOpenChange(!0), (f = n.content) == null || f.focus(), c.preventDefault());
})
}
) });
}
);
Ae.displayName = T;
var Ge = "MenuSubContent", ze = s.forwardRef(
(e, r) => {
const n = je(_, e.__scopeMenu), { forceMount: t = n.forceMount, ...o } = e, i = R(_, e.__scopeMenu), l = A(_, e.__scopeMenu), d = Ke(Ge, e.__scopeMenu), m = s.useRef(null), g = L(r, m);
return /* @__PURE__ */ a.jsx($.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ a.jsx(H, { present: t || i.open, children: /* @__PURE__ */ a.jsx($.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ a.jsx(
ae,
{
id: d.contentId,
"aria-labelledby": d.triggerId,
...o,
ref: g,
align: "start",
side: l.dir === "rtl" ? "left" : "right",
disableOutsidePointerEvents: !1,
disableOutsideScroll: !1,
trapFocus: !1,
onOpenAutoFocus: (p) => {
var c;
l.isUsingKeyboardRef.current && ((c = m.current) == null || c.focus()), p.preventDefault();
},
onCloseAutoFocus: (p) => p.preventDefault(),
onFocusOutside: h(e.onFocusOutside, (p) => {
p.target !== d.trigger && i.onOpenChange(!1);
}),
onEscapeKeyDown: h(e.onEscapeKeyDown, (p) => {
l.onClose(), p.preventDefault();
}),
onKeyDown: h(e.onKeyDown, (p) => {
var c;
const f = p.currentTarget.contains(p.target), w = Xn[l.dir].includes(p.key);
f && w && (i.onOpenChange(!1), (c = d.trigger) == null || c.focus(), p.preventDefault());
})
}
) }) }) });
}
);
ze.displayName = Ge;
function Ue(e) {
return e ? "open" : "closed";
}
function q(e) {
return e === "indeterminate";
}
function ce(e) {
return q(e) ? "indeterminate" : e ? "checked" : "unchecked";
}
function pr(e) {
const r = document.activeElement;
for (const n of e)
if (n === r || (n.focus(), document.activeElement !== r)) return;
}
function fr(e, r) {
return e.map((n, t) => e[(r + t) % e.length]);
}
function mr(e, r, n) {
const t = r.length > 1 && Array.from(r).every((d) => d === r[0]) ? r[0] : r, o = n ? e.indexOf(n) : -1;
let i = fr(e, Math.max(o, 0));
t.length === 1 && (i = i.filter((d) => d !== n));
const l = i.find(
(d) => d.toLowerCase().startsWith(t.toLowerCase())
);
return l !== n ? l : void 0;
}
function vr(e, r) {
const { x: n, y: t } = e;
let o = !1;
for (let i = 0, l = r.length - 1; i < r.length; l = i++) {
const d = r[i], m = r[l], g = d.x, p = d.y, c = m.x, f = m.y;
p > t != f > t && n < (c - g) * (t - p) / (f - p) + g && (o = !o);
}
return o;
}
function hr(e, r) {
if (!r) return !1;
const n = { x: e.clientX, y: e.clientY };
return vr(n, r);
}
function F(e) {
return (r) => r.pointerType === "mouse" ? e(r) : void 0;
}
var gr = De, wr = re, xr = Re, yr = Ce, _r = se, Mr = Ne, br = Y, Dr = Pe, jr = Ie, Rr = Se, Cr = $e, Nr = Fe, kr = Le, Pr = Ae, Or = ze, Z = "DropdownMenu", [Ir, ft] = he(
Z,
[Me]
), y = Me(), [Er, Ve] = Ir(Z), Be = (e) => {
const {
__scopeDropdownMenu: r,
children: n,
dir: t,
open: o,
defaultOpen: i,
onOpenChange: l,
modal: d = !0
} = e, m = y(r), g = s.useRef(null), [p, c] = bn({
prop: o,
defaultProp: i ?? !1,
onChange: l,
caller: Z
});
return /* @__PURE__ */ a.jsx(
Er,
{
scope: r,
triggerId: me(),
triggerRef: g,
contentId: me(),
open: p,
onOpenChange: c,
onOpenToggle: s.useCallback(() => c((f) => !f), [c]),
modal: d,
children: /* @__PURE__ */ a.jsx(gr, { ...m, open: p, onOpenChange: c, dir: t, modal: d, children: n })
}
);
};
Be.displayName = Z;
var Xe = "DropdownMenuTrigger", We = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, disabled: t = !1, ...o } = e, i = Ve(Xe, n), l = y(n);
return /* @__PURE__ */ a.jsx(wr, { asChild: !0, ...l, children: /* @__PURE__ */ a.jsx(
O.button,
{
type: "button",
id: i.triggerId,
"aria-haspopup": "menu",
"aria-expanded": i.open,
"aria-controls": i.open ? i.contentId : void 0,
"data-state": i.open ? "open" : "closed",
"data-disabled": t ? "" : void 0,
disabled: t,
...o,
ref: ge(r, i.triggerRef),
onPointerDown: h(e.onPointerDown, (d) => {
!t && d.button === 0 && d.ctrlKey === !1 && (i.onOpenToggle(), i.open || d.preventDefault());
}),
onKeyDown: h(e.onKeyDown, (d) => {
t || (["Enter", " "].includes(d.key) && i.onOpenToggle(), d.key === "ArrowDown" && i.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
})
}
) });
}
);
We.displayName = Xe;
var Sr = "DropdownMenuPortal", qe = (e) => {
const { __scopeDropdownMenu: r, ...n } = e, t = y(r);
return /* @__PURE__ */ a.jsx(xr, { ...t, ...n });
};
qe.displayName = Sr;
var He = "DropdownMenuContent", Qe = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = Ve(He, n), i = y(n), l = s.useRef(!1);
return /* @__PURE__ */ a.jsx(
yr,
{
id: o.contentId,
"aria-labelledby": o.triggerId,
...i,
...t,
ref: r,
onCloseAutoFocus: h(e.onCloseAutoFocus, (d) => {
var m;
l.current || (m = o.triggerRef.current) == null || m.focus(), l.current = !1, d.preventDefault();
}),
onInteractOutside: h(e.onInteractOutside, (d) => {
const m = d.detail.originalEvent, g = m.button === 0 && m.ctrlKey === !0, p = m.button === 2 || g;
(!o.modal || p) && (l.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)"
}
}
);
}
);
Qe.displayName = He;
var Tr = "DropdownMenuGroup", $r = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(_r, { ...o, ...t, ref: r });
}
);
$r.displayName = Tr;
var Fr = "DropdownMenuLabel", Ye = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Mr, { ...o, ...t, ref: r });
}
);
Ye.displayName = Fr;
var Lr = "DropdownMenuItem", Ze = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(br, { ...o, ...t, ref: r });
}
);
Ze.displayName = Lr;
var Kr = "DropdownMenuCheckboxItem", Je = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Dr, { ...o, ...t, ref: r });
});
Je.displayName = Kr;
var Ar = "DropdownMenuRadioGroup", Gr = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(jr, { ...o, ...t, ref: r });
});
Gr.displayName = Ar;
var zr = "DropdownMenuRadioItem", en = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Rr, { ...o, ...t, ref: r });
});
en.displayName = zr;
var Ur = "DropdownMenuItemIndicator", nn = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Cr, { ...o, ...t, ref: r });
});
nn.displayName = Ur;
var Vr = "DropdownMenuSeparator", rn = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Nr, { ...o, ...t, ref: r });
});
rn.displayName = Vr;
var Br = "DropdownMenuArrow", Xr = s.forwardRef(
(e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(kr, { ...o, ...t, ref: r });
}
);
Xr.displayName = Br;
var Wr = "DropdownMenuSubTrigger", tn = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(Pr, { ...o, ...t, ref: r });
});
tn.displayName = Wr;
var qr = "DropdownMenuSubContent", on = s.forwardRef((e, r) => {
const { __scopeDropdownMenu: n, ...t } = e, o = y(n);
return /* @__PURE__ */ a.jsx(
Or,
{
...o,
...t,
ref: r,
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)"
}
}
);
});
on.displayName = qr;
var Hr = Be, Qr = We, Yr = qe, an = Qe, sn = Ye, cn = Ze, dn = Je, un = en, ln = nn, pn = rn, fn = tn, mn = on;
const mt = Hr, vt = Qr, Zr = s.forwardRef(({ className: e, inset: r, children: n, ...t }, o) => /* @__PURE__ */ a.jsxs(
fn,
{
ref: o,
className: D(
"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",
r && "pl-8",
e
),
...t,
children: [
n,
/* @__PURE__ */ a.jsx(zn, { className: "ml-auto" })
]
}
));
Zr.displayName = fn.displayName;
const Jr = s.forwardRef(({ className: e, ...r }, n) => /* @__PURE__ */ a.jsx(
mn,
{
ref: n,
className: D(
"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
),
...r
}
));
Jr.displayName = mn.displayName;
const et = s.forwardRef(({ className: e, sideOffset: r = 4, ...n }, t) => /* @__PURE__ */ a.jsx(Yr, { children: /* @__PURE__ */ a.jsx(
an,
{
ref: t,
sideOffset: r,
className: D(
"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
}
) }));
et.displayName = an.displayName;
const nt = s.forwardRef(({ className: e, inset: r, ...n }, t) => /* @__PURE__ */ a.jsx(
cn,
{
ref: t,
className: D(
"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",
r && "pl-8",
e
),
...n
}
));
nt.displayName = cn.displayName;
const rt = s.forwardRef(({ className: e, children: r, checked: n, ...t }, o) => /* @__PURE__ */ a.jsxs(
dn,
{
ref: o,
className: D(
"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(ln, { children: /* @__PURE__ */ a.jsx(Cn, { className: "h-4 w-4" }) }) }),
r
]
}
));
rt.displayName = dn.displayName;
const tt = s.forwardRef(({ className: e, children: r, ...n }, t) => /* @__PURE__ */ a.jsxs(
un,
{
ref: t,
className: D(
"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(ln, { children: /* @__PURE__ */ a.jsx(In, { className: "h-2 w-2 fill-current" }) }) }),
r
]
}
));
tt.displayName = un.displayName;
const ot = s.forwardRef(({ className: e, inset: r, ...n }, t) => /* @__PURE__ */ a.jsx(
sn,
{
ref: t,
className: D(
"px-2 py-1.5 text-sm font-semibold",
r && "pl-8",
e
),
...n
}
));
ot.displayName = sn.displayName;
const at = s.forwardRef(({ className: e, ...r }, n) => /* @__PURE__ */ a.jsx(
pn,
{
ref: n,
className: D("bg-muted -mx-1 my-1 h-px", e),
...r
}
));
at.displayName = pn.displayName;
export {
mt as N,
rt as d,
at as f,
nt as i,
vt as j,
et as u
};