UNPKG

dgz-ui-shared

Version:

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

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