UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

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