@alixpartners/ui-components 2.5.7 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +97 -97
  2. package/dist/RichTextEditor-JH6YBGiw.js +541 -0
  3. package/dist/{ToastProvider-D5LImZ-Q.js → ToastProvider-DVycF0zU.js} +26 -26
  4. package/dist/assets/CorusHeader.css +1 -1
  5. package/dist/assets/Dialog.css +1 -1
  6. package/dist/assets/Tab.css +1 -1
  7. package/dist/assets/Tag.css +1 -1
  8. package/dist/assets/ap-icons-types.d.ts +1 -1
  9. package/dist/assets/ap-icons.d.ts +1 -1
  10. package/dist/assets/main.css +1 -1
  11. package/dist/components/Banner/Banner.d.ts +1 -1
  12. package/dist/components/Banner/Banner.test.js +1 -1
  13. package/dist/components/Button/Button.d.ts +1 -1
  14. package/dist/components/Button/Button.test.js +2 -2
  15. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  16. package/dist/components/Checkbox/Checkbox.js +3 -3
  17. package/dist/components/Checkbox/Checkbox.test.js +1 -1
  18. package/dist/components/CorusHeader/CorusHeader.d.ts +1 -1
  19. package/dist/components/CorusHeader/CorusHeader.js +45 -44
  20. package/dist/components/CorusHeader/CorusHeader.types.d.ts +1 -0
  21. package/dist/components/CorusHeader/DropdownItemContent.d.ts +1 -1
  22. package/dist/components/CorusHeader/DropdownMenu.d.ts +2 -1
  23. package/dist/components/CorusHeader/DropdownMenu.js +6 -5
  24. package/dist/components/CorusHeader/MegaMenuContent.d.ts +2 -1
  25. package/dist/components/CorusHeader/MegaMenuContent.js +11 -10
  26. package/dist/components/CorusHeader/UserProfileIcon.d.ts +1 -1
  27. package/dist/components/Creatable/Creatable.d.ts +1 -1
  28. package/dist/components/Creatable/Creatable.js +1 -1
  29. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  30. package/dist/components/Datepicker/Datepicker.js +1 -1
  31. package/dist/components/Datepicker/Datepicker.test.js +1 -1
  32. package/dist/components/Dialog/Dialog.d.ts +8 -2
  33. package/dist/components/Dialog/Dialog.js +183 -203
  34. package/dist/components/Dialog/Dialog.test.js +227 -202
  35. package/dist/components/DragAndDrop/DragAndDrop.d.ts +1 -1
  36. package/dist/components/DragAndDrop/DragAndDrop.test.js +2 -2
  37. package/dist/components/Dropdown/Dropdown.d.ts +3 -1
  38. package/dist/components/Dropdown/Dropdown.js +179 -172
  39. package/dist/components/FilePicker/FilePicker.d.ts +9 -9
  40. package/dist/components/FilePicker/FilePicker.test.js +2 -2
  41. package/dist/components/Ghost/Ghost.d.ts +1 -1
  42. package/dist/components/Ghost/Ghost.test.js +1 -1
  43. package/dist/components/Icon/Icon.d.ts +1 -1
  44. package/dist/components/Icons/IconsGallery.d.ts +1 -1
  45. package/dist/components/Icons/IconsGallery.js +1 -1
  46. package/dist/components/Illustration/Illustration.d.ts +1 -1
  47. package/dist/components/Illustration/Illustration.test.js +1 -1
  48. package/dist/components/Input/Input.test.js +1 -1
  49. package/dist/components/Logo/Logo.d.ts +1 -1
  50. package/dist/components/Logos/LogosGallery.d.ts +1 -1
  51. package/dist/components/NavBar/NavBar.d.ts +1 -1
  52. package/dist/components/NavBar/NavBar.js +1 -1
  53. package/dist/components/Radio/Radio.d.ts +1 -1
  54. package/dist/components/Radio/Radio.js +9 -9
  55. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  56. package/dist/components/RadioGroup/RadioGroup.js +11 -11
  57. package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
  58. package/dist/components/RichTextEditor/RichTextEditor.d.ts +1 -1
  59. package/dist/components/RichTextEditor/RichTextEditor.js +2 -2
  60. package/dist/components/RichTextEditor/RichTextEditor.test.js +2 -2
  61. package/dist/components/Search/Search.d.ts +1 -1
  62. package/dist/components/Search/Search.test.js +1 -1
  63. package/dist/components/Spinner/Spinner.d.ts +1 -1
  64. package/dist/components/SplitButton/SplitButton.d.ts +1 -1
  65. package/dist/components/SplitButton/SplitButton.js +3 -3
  66. package/dist/components/SplitButton/SplitButton.test.js +1 -1
  67. package/dist/components/Tab/Tab.d.ts +5 -1
  68. package/dist/components/Tab/Tab.js +28 -24
  69. package/dist/components/TabNavigation/TabNavigation.d.ts +1 -1
  70. package/dist/components/Tag/Tag.d.ts +1 -1
  71. package/dist/components/Tag/Tag.js +1 -1
  72. package/dist/components/Tag/Tag.test.js +1 -1
  73. package/dist/components/TagsFields/TagsFields.d.ts +1 -1
  74. package/dist/components/TagsFields/TagsFields.js +1 -1
  75. package/dist/components/Textarea/Textarea.d.ts +1 -1
  76. package/dist/components/Textarea/Textarea.test.js +1 -1
  77. package/dist/components/Toast/Toast.test.js +1 -1
  78. package/dist/components/ToastProvider/ToastProvider.d.ts +2 -1
  79. package/dist/components/ToastProvider/ToastProvider.js +1 -1
  80. package/dist/components/ToastProvider/ToastProvider.test.js +4 -4
  81. package/dist/components/Toggle/Toggle.d.ts +1 -1
  82. package/dist/components/Toggle/Toggle.js +211 -126
  83. package/dist/components/Toggle/Toggle.test.js +1 -1
  84. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  85. package/dist/components/Tooltip/Tooltip.js +60 -61
  86. package/dist/{index-C2s_VtSb.js → index-6DGSlWJb.js} +3 -3
  87. package/dist/{index-Nyh2Wa71.js → index-6j3vTf--.js} +5 -5
  88. package/dist/index-B4szHVNJ.js +248 -0
  89. package/dist/{index-CFqDEbIR.js → index-BVZdJVFB.js} +192 -191
  90. package/dist/index-Bq1FiX6B.js +93 -0
  91. package/dist/index-CE9NpYQR.js +604 -0
  92. package/dist/index-CHy8gqvu.js +353 -0
  93. package/dist/index-CarlZuEo.js +1610 -0
  94. package/dist/{index-CCFDXH-J.js → index-CcsZYEYy.js} +29 -28
  95. package/dist/index-DH9SO8qV.js +221 -0
  96. package/dist/{index-D_L0ncPJ.js → index-IR8HlW5P.js} +4 -4
  97. package/dist/{index-DkTDHhag.js → index-banDzeKa.js} +1 -1
  98. package/dist/index-kgC_DL6e.js +216 -0
  99. package/dist/main.js +3 -3
  100. package/dist/storybook-docs-page.d.ts +1 -1
  101. package/dist/{useToast-Cz5MGKnw.js → useToast-CpwrYPvx.js} +1 -1
  102. package/dist/{vi.bdSIJ99Y-017e_Pkz.js → vi.bdSIJ99Y-DWCVXj6K.js} +3 -3
  103. package/dist/web.config +8 -8
  104. package/package.json +94 -94
  105. package/dist/RichTextEditor-kTQEDSL0.js +0 -477
  106. package/dist/index-C8H9A55g.js +0 -222
  107. package/dist/index-CCnm5-ML.js +0 -230
  108. package/dist/index-CfIcUHKK.js +0 -70
  109. package/dist/index-ChQc_Cm6.js +0 -1544
  110. package/dist/index-CmGGeUr0.js +0 -142
  111. package/dist/index-Ii4UOx3H.js +0 -599
  112. package/dist/index-z_kiwVc3.js +0 -237
@@ -0,0 +1,93 @@
1
+ import * as a from "react";
2
+ import { d as A } from "./index-B4szHVNJ.js";
3
+ function T(e, n) {
4
+ return a.useReducer((r, t) => n[r][t] ?? r, e);
5
+ }
6
+ var E = (e) => {
7
+ const { present: n, children: r } = e, t = y(n), o = typeof r == "function" ? r({ present: t.isPresent }) : a.Children.only(r), c = P(t.ref, S(o));
8
+ return typeof r == "function" || t.isPresent ? a.cloneElement(o, { ref: c }) : null;
9
+ };
10
+ E.displayName = "Presence";
11
+ function y(e) {
12
+ const [n, r] = a.useState(), t = a.useRef(null), o = a.useRef(e), c = a.useRef("none"), s = e ? "mounted" : "unmounted", [u, f] = T(s, {
13
+ mounted: {
14
+ UNMOUNT: "unmounted",
15
+ ANIMATION_OUT: "unmountSuspended"
16
+ },
17
+ unmountSuspended: {
18
+ MOUNT: "mounted",
19
+ ANIMATION_END: "unmounted"
20
+ },
21
+ unmounted: {
22
+ MOUNT: "mounted"
23
+ }
24
+ });
25
+ return a.useEffect(() => {
26
+ const i = p(t.current);
27
+ c.current = u === "mounted" ? i : "none";
28
+ }, [u]), A(() => {
29
+ const i = t.current, l = o.current;
30
+ if (l !== e) {
31
+ const N = c.current, m = p(i);
32
+ e ? f("MOUNT") : m === "none" || (i == null ? void 0 : i.display) === "none" ? f("UNMOUNT") : f(l && N !== m ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
33
+ }
34
+ }, [e, f]), A(() => {
35
+ if (n) {
36
+ let i;
37
+ const l = n.ownerDocument.defaultView ?? window, d = (m) => {
38
+ const R = p(t.current).includes(CSS.escape(m.animationName));
39
+ if (m.target === n && R && (f("ANIMATION_END"), !o.current)) {
40
+ const O = n.style.animationFillMode;
41
+ n.style.animationFillMode = "forwards", i = l.setTimeout(() => {
42
+ n.style.animationFillMode === "forwards" && (n.style.animationFillMode = O);
43
+ });
44
+ }
45
+ }, N = (m) => {
46
+ m.target === n && (c.current = p(t.current));
47
+ };
48
+ return n.addEventListener("animationstart", N), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
49
+ l.clearTimeout(i), n.removeEventListener("animationstart", N), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
50
+ };
51
+ } else
52
+ f("ANIMATION_END");
53
+ }, [n, f]), {
54
+ isPresent: ["mounted", "unmountSuspended"].includes(u),
55
+ ref: a.useCallback((i) => {
56
+ t.current = i ? getComputedStyle(i) : null, r(i);
57
+ }, [])
58
+ };
59
+ }
60
+ function g(e, n) {
61
+ if (typeof e == "function")
62
+ return e(n);
63
+ e != null && (e.current = n);
64
+ }
65
+ function P(...e) {
66
+ const n = a.useRef(e);
67
+ return n.current = e, a.useCallback((r) => {
68
+ const t = n.current;
69
+ let o = !1;
70
+ const c = t.map((s) => {
71
+ const u = g(s, r);
72
+ return !o && typeof u == "function" && (o = !0), u;
73
+ });
74
+ if (o)
75
+ return () => {
76
+ for (let s = 0; s < c.length; s++) {
77
+ const u = c[s];
78
+ typeof u == "function" ? u() : g(t[s], null);
79
+ }
80
+ };
81
+ }, []);
82
+ }
83
+ function p(e) {
84
+ return (e == null ? void 0 : e.animationName) || "none";
85
+ }
86
+ function S(e) {
87
+ var t, o;
88
+ let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, r = n && "isReactWarning" in n && n.isReactWarning;
89
+ return r ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = n && "isReactWarning" in n && n.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
90
+ }
91
+ export {
92
+ E as P
93
+ };
@@ -0,0 +1,604 @@
1
+ import * as c from "react";
2
+ import { a as N, c as M, b as je, P as L, f as He, e as We, g as ze } from "./index-B4szHVNJ.js";
3
+ import { u as Ze, c as pe, a as $e, I as qe, R as Je } from "./index-DH9SO8qV.js";
4
+ import { P as Qe, D as et } from "./index-kgC_DL6e.js";
5
+ import { h as tt, u as nt, R as ot, F as rt } from "./index-BVZdJVFB.js";
6
+ import { R as ct, A as at, c as ve, C as st, a as ut } from "./index-CarlZuEo.js";
7
+ import { P as H } from "./index-Bq1FiX6B.js";
8
+ import { a as Me } from "./index-6DGSlWJb.js";
9
+ import { jsx as u } from "react/jsx-runtime";
10
+ var Q = ["Enter", " "], it = ["ArrowDown", "PageUp", "Home"], he = ["ArrowUp", "PageDown", "End"], lt = [...it, ...he], dt = {
11
+ ltr: [...Q, "ArrowRight"],
12
+ rtl: [...Q, "ArrowLeft"]
13
+ }, ft = {
14
+ ltr: ["ArrowLeft"],
15
+ rtl: ["ArrowRight"]
16
+ }, F = "Menu", [O, mt, pt] = $e(F), [S, jt] = je(F, [
17
+ pt,
18
+ ve,
19
+ pe
20
+ ]), W = ve(), Ce = pe(), [vt, I] = S(F), [Mt, K] = S(F), ge = (e) => {
21
+ const { __scopeMenu: n, open: t = !1, children: r, dir: s, onOpenChange: a, modal: d = !0 } = e, v = W(n), [p, f] = c.useState(null), h = c.useRef(!1), o = Me(a), l = Ze(s);
22
+ return c.useEffect(() => {
23
+ const C = () => {
24
+ h.current = !0, document.addEventListener("pointerdown", m, { capture: !0, once: !0 }), document.addEventListener("pointermove", m, { capture: !0, once: !0 });
25
+ }, m = () => h.current = !1;
26
+ return document.addEventListener("keydown", C, { capture: !0 }), () => {
27
+ document.removeEventListener("keydown", C, { capture: !0 }), document.removeEventListener("pointerdown", m, { capture: !0 }), document.removeEventListener("pointermove", m, { capture: !0 });
28
+ };
29
+ }, []), c.useEffect(() => {
30
+ if (!t)
31
+ return;
32
+ const C = () => o(!1);
33
+ return window.addEventListener("blur", C), () => window.removeEventListener("blur", C);
34
+ }, [t, o]), /* @__PURE__ */ u(ct, { ...v, children: /* @__PURE__ */ u(
35
+ vt,
36
+ {
37
+ scope: n,
38
+ open: t,
39
+ onOpenChange: o,
40
+ content: p,
41
+ onContentChange: f,
42
+ children: /* @__PURE__ */ u(
43
+ Mt,
44
+ {
45
+ scope: n,
46
+ onClose: c.useCallback(() => o(!1), [o]),
47
+ isUsingKeyboardRef: h,
48
+ dir: l,
49
+ modal: d,
50
+ children: r
51
+ }
52
+ )
53
+ }
54
+ ) });
55
+ };
56
+ ge.displayName = F;
57
+ var ht = "MenuAnchor", ee = c.forwardRef(
58
+ (e, n) => {
59
+ const { __scopeMenu: t, ...r } = e, s = W(t);
60
+ return /* @__PURE__ */ u(at, { ...s, ...r, ref: n });
61
+ }
62
+ );
63
+ ee.displayName = ht;
64
+ var te = "MenuPortal", [Ct, _e] = S(te, {
65
+ forceMount: void 0
66
+ }), Re = (e) => {
67
+ const { __scopeMenu: n, forceMount: t, children: r, container: s } = e, a = I(te, n);
68
+ return /* @__PURE__ */ u(Ct, { scope: n, forceMount: t, children: /* @__PURE__ */ u(H, { present: t || a.open, children: /* @__PURE__ */ u(Qe, { asChild: !0, container: s, children: r }) }) });
69
+ };
70
+ Re.displayName = te;
71
+ var _ = "MenuContent", [gt, ne] = S(_), Pe = c.forwardRef(
72
+ (e, n) => {
73
+ const t = _e(_, e.__scopeMenu), { forceMount: r = t.forceMount, ...s } = e, a = I(_, e.__scopeMenu), d = K(_, e.__scopeMenu);
74
+ return /* @__PURE__ */ u(O.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(H, { present: r || a.open, children: /* @__PURE__ */ u(O.Slot, { scope: e.__scopeMenu, children: d.modal ? /* @__PURE__ */ u(_t, { ...s, ref: n }) : /* @__PURE__ */ u(Rt, { ...s, ref: n }) }) }) });
75
+ }
76
+ ), _t = c.forwardRef(
77
+ (e, n) => {
78
+ const t = I(_, e.__scopeMenu), r = c.useRef(null), s = N(n, r);
79
+ return c.useEffect(() => {
80
+ const a = r.current;
81
+ if (a) return tt(a);
82
+ }, []), /* @__PURE__ */ u(
83
+ oe,
84
+ {
85
+ ...e,
86
+ ref: s,
87
+ trapFocus: t.open,
88
+ disableOutsidePointerEvents: t.open,
89
+ disableOutsideScroll: !0,
90
+ onFocusOutside: M(
91
+ e.onFocusOutside,
92
+ (a) => a.preventDefault(),
93
+ { checkForDefaultPrevented: !1 }
94
+ ),
95
+ onDismiss: () => t.onOpenChange(!1)
96
+ }
97
+ );
98
+ }
99
+ ), Rt = c.forwardRef((e, n) => {
100
+ const t = I(_, e.__scopeMenu);
101
+ return /* @__PURE__ */ u(
102
+ oe,
103
+ {
104
+ ...e,
105
+ ref: n,
106
+ trapFocus: !1,
107
+ disableOutsidePointerEvents: !1,
108
+ disableOutsideScroll: !1,
109
+ onDismiss: () => t.onOpenChange(!1)
110
+ }
111
+ );
112
+ }), Pt = We("MenuContent.ScrollLock"), oe = c.forwardRef(
113
+ (e, n) => {
114
+ const {
115
+ __scopeMenu: t,
116
+ loop: r = !1,
117
+ trapFocus: s,
118
+ onOpenAutoFocus: a,
119
+ onCloseAutoFocus: d,
120
+ disableOutsidePointerEvents: v,
121
+ onEntryFocus: p,
122
+ onEscapeKeyDown: f,
123
+ onPointerDownOutside: h,
124
+ onFocusOutside: o,
125
+ onInteractOutside: l,
126
+ onDismiss: C,
127
+ disableOutsideScroll: m,
128
+ ...w
129
+ } = e, y = I(_, t), T = K(_, t), G = W(t), U = Ce(t), se = mt(t), [Ge, ue] = c.useState(null), B = c.useRef(null), Ue = N(n, B, y.onContentChange), V = c.useRef(0), Y = c.useRef(""), Be = c.useRef(0), Z = c.useRef(null), ie = c.useRef("right"), $ = c.useRef(0), Ve = m ? ot : c.Fragment, Ye = m ? { as: Pt, allowPinchZoom: !0 } : void 0, Xe = (i) => {
130
+ var x, de;
131
+ const g = Y.current + i, R = se().filter((P) => !P.disabled), E = document.activeElement, q = (x = R.find((P) => P.ref.current === E)) == null ? void 0 : x.textValue, J = R.map((P) => P.textValue), le = kt(J, g, q), A = (de = R.find((P) => P.textValue === le)) == null ? void 0 : de.ref.current;
132
+ (function P(fe) {
133
+ Y.current = fe, window.clearTimeout(V.current), fe !== "" && (V.current = window.setTimeout(() => P(""), 1e3));
134
+ })(g), A && setTimeout(() => A.focus());
135
+ };
136
+ c.useEffect(() => () => window.clearTimeout(V.current), []), nt();
137
+ const b = c.useCallback((i) => {
138
+ var R, E;
139
+ return ie.current === ((R = Z.current) == null ? void 0 : R.side) && Lt(i, (E = Z.current) == null ? void 0 : E.area);
140
+ }, []);
141
+ return /* @__PURE__ */ u(
142
+ gt,
143
+ {
144
+ scope: t,
145
+ searchRef: Y,
146
+ onItemEnter: c.useCallback(
147
+ (i) => {
148
+ b(i) && i.preventDefault();
149
+ },
150
+ [b]
151
+ ),
152
+ onItemLeave: c.useCallback(
153
+ (i) => {
154
+ var g;
155
+ b(i) || ((g = B.current) == null || g.focus(), ue(null));
156
+ },
157
+ [b]
158
+ ),
159
+ onTriggerLeave: c.useCallback(
160
+ (i) => {
161
+ b(i) && i.preventDefault();
162
+ },
163
+ [b]
164
+ ),
165
+ pointerGraceTimerRef: Be,
166
+ onPointerGraceIntentChange: c.useCallback((i) => {
167
+ Z.current = i;
168
+ }, []),
169
+ children: /* @__PURE__ */ u(Ve, { ...Ye, children: /* @__PURE__ */ u(
170
+ rt,
171
+ {
172
+ asChild: !0,
173
+ trapped: s,
174
+ onMountAutoFocus: M(a, (i) => {
175
+ var g;
176
+ i.preventDefault(), (g = B.current) == null || g.focus({ preventScroll: !0 });
177
+ }),
178
+ onUnmountAutoFocus: d,
179
+ children: /* @__PURE__ */ u(
180
+ et,
181
+ {
182
+ asChild: !0,
183
+ disableOutsidePointerEvents: v,
184
+ onEscapeKeyDown: f,
185
+ onPointerDownOutside: h,
186
+ onFocusOutside: o,
187
+ onInteractOutside: l,
188
+ onDismiss: C,
189
+ children: /* @__PURE__ */ u(
190
+ Je,
191
+ {
192
+ asChild: !0,
193
+ ...U,
194
+ dir: T.dir,
195
+ orientation: "vertical",
196
+ loop: r,
197
+ currentTabStopId: Ge,
198
+ onCurrentTabStopIdChange: ue,
199
+ onEntryFocus: M(p, (i) => {
200
+ T.isUsingKeyboardRef.current || i.preventDefault();
201
+ }),
202
+ preventScrollOnEntryFocus: !0,
203
+ children: /* @__PURE__ */ u(
204
+ st,
205
+ {
206
+ role: "menu",
207
+ "aria-orientation": "vertical",
208
+ "data-state": Ke(y.open),
209
+ "data-radix-menu-content": "",
210
+ dir: T.dir,
211
+ ...G,
212
+ ...w,
213
+ ref: Ue,
214
+ style: { outline: "none", ...w.style },
215
+ onKeyDown: M(w.onKeyDown, (i) => {
216
+ const R = i.target.closest("[data-radix-menu-content]") === i.currentTarget, E = i.ctrlKey || i.altKey || i.metaKey, q = i.key.length === 1;
217
+ R && (i.key === "Tab" && i.preventDefault(), !E && q && Xe(i.key));
218
+ const J = B.current;
219
+ if (i.target !== J || !lt.includes(i.key)) return;
220
+ i.preventDefault();
221
+ const A = se().filter((x) => !x.disabled).map((x) => x.ref.current);
222
+ he.includes(i.key) && A.reverse(), Dt(A);
223
+ }),
224
+ onBlur: M(e.onBlur, (i) => {
225
+ i.currentTarget.contains(i.target) || (window.clearTimeout(V.current), Y.current = "");
226
+ }),
227
+ onPointerMove: M(
228
+ e.onPointerMove,
229
+ k((i) => {
230
+ const g = i.target, R = $.current !== i.clientX;
231
+ if (i.currentTarget.contains(g) && R) {
232
+ const E = i.clientX > $.current ? "right" : "left";
233
+ ie.current = E, $.current = i.clientX;
234
+ }
235
+ })
236
+ )
237
+ }
238
+ )
239
+ }
240
+ )
241
+ }
242
+ )
243
+ }
244
+ ) })
245
+ }
246
+ );
247
+ }
248
+ );
249
+ Pe.displayName = _;
250
+ var Et = "MenuGroup", re = c.forwardRef(
251
+ (e, n) => {
252
+ const { __scopeMenu: t, ...r } = e;
253
+ return /* @__PURE__ */ u(L.div, { role: "group", ...r, ref: n });
254
+ }
255
+ );
256
+ re.displayName = Et;
257
+ var wt = "MenuLabel", Ee = c.forwardRef(
258
+ (e, n) => {
259
+ const { __scopeMenu: t, ...r } = e;
260
+ return /* @__PURE__ */ u(L.div, { ...r, ref: n });
261
+ }
262
+ );
263
+ Ee.displayName = wt;
264
+ var X = "MenuItem", me = "menu.itemSelect", z = c.forwardRef(
265
+ (e, n) => {
266
+ const { disabled: t = !1, onSelect: r, ...s } = e, a = c.useRef(null), d = K(X, e.__scopeMenu), v = ne(X, e.__scopeMenu), p = N(n, a), f = c.useRef(!1), h = () => {
267
+ const o = a.current;
268
+ if (!t && o) {
269
+ const l = new CustomEvent(me, { bubbles: !0, cancelable: !0 });
270
+ o.addEventListener(me, (C) => r == null ? void 0 : r(C), { once: !0 }), He(o, l), l.defaultPrevented ? f.current = !1 : d.onClose();
271
+ }
272
+ };
273
+ return /* @__PURE__ */ u(
274
+ we,
275
+ {
276
+ ...s,
277
+ ref: p,
278
+ disabled: t,
279
+ onClick: M(e.onClick, h),
280
+ onPointerDown: (o) => {
281
+ var l;
282
+ (l = e.onPointerDown) == null || l.call(e, o), f.current = !0;
283
+ },
284
+ onPointerUp: M(e.onPointerUp, (o) => {
285
+ var l;
286
+ f.current || (l = o.currentTarget) == null || l.click();
287
+ }),
288
+ onKeyDown: M(e.onKeyDown, (o) => {
289
+ const l = v.searchRef.current !== "";
290
+ t || l && o.key === " " || Q.includes(o.key) && (o.currentTarget.click(), o.preventDefault());
291
+ })
292
+ }
293
+ );
294
+ }
295
+ );
296
+ z.displayName = X;
297
+ var we = c.forwardRef(
298
+ (e, n) => {
299
+ const { __scopeMenu: t, disabled: r = !1, textValue: s, ...a } = e, d = ne(X, t), v = Ce(t), p = c.useRef(null), f = N(n, p), [h, o] = c.useState(!1), [l, C] = c.useState("");
300
+ return c.useEffect(() => {
301
+ const m = p.current;
302
+ m && C((m.textContent ?? "").trim());
303
+ }, [a.children]), /* @__PURE__ */ u(
304
+ O.ItemSlot,
305
+ {
306
+ scope: t,
307
+ disabled: r,
308
+ textValue: s ?? l,
309
+ children: /* @__PURE__ */ u(qe, { asChild: !0, ...v, focusable: !r, children: /* @__PURE__ */ u(
310
+ L.div,
311
+ {
312
+ role: "menuitem",
313
+ "data-highlighted": h ? "" : void 0,
314
+ "aria-disabled": r || void 0,
315
+ "data-disabled": r ? "" : void 0,
316
+ ...a,
317
+ ref: f,
318
+ onPointerMove: M(
319
+ e.onPointerMove,
320
+ k((m) => {
321
+ r ? d.onItemLeave(m) : (d.onItemEnter(m), m.defaultPrevented || m.currentTarget.focus({ preventScroll: !0 }));
322
+ })
323
+ ),
324
+ onPointerLeave: M(
325
+ e.onPointerLeave,
326
+ k((m) => d.onItemLeave(m))
327
+ ),
328
+ onFocus: M(e.onFocus, () => o(!0)),
329
+ onBlur: M(e.onBlur, () => o(!1))
330
+ }
331
+ ) })
332
+ }
333
+ );
334
+ }
335
+ ), St = "MenuCheckboxItem", Se = c.forwardRef(
336
+ (e, n) => {
337
+ const { checked: t = !1, onCheckedChange: r, ...s } = e;
338
+ return /* @__PURE__ */ u(Te, { scope: e.__scopeMenu, checked: t, children: /* @__PURE__ */ u(
339
+ z,
340
+ {
341
+ role: "menuitemcheckbox",
342
+ "aria-checked": j(t) ? "mixed" : t,
343
+ ...s,
344
+ ref: n,
345
+ "data-state": ae(t),
346
+ onSelect: M(
347
+ s.onSelect,
348
+ () => r == null ? void 0 : r(j(t) ? !0 : !t),
349
+ { checkForDefaultPrevented: !1 }
350
+ )
351
+ }
352
+ ) });
353
+ }
354
+ );
355
+ Se.displayName = St;
356
+ var Ie = "MenuRadioGroup", [It, yt] = S(
357
+ Ie,
358
+ { value: void 0, onValueChange: () => {
359
+ } }
360
+ ), ye = c.forwardRef(
361
+ (e, n) => {
362
+ const { value: t, onValueChange: r, ...s } = e, a = Me(r);
363
+ return /* @__PURE__ */ u(It, { scope: e.__scopeMenu, value: t, onValueChange: a, children: /* @__PURE__ */ u(re, { ...s, ref: n }) });
364
+ }
365
+ );
366
+ ye.displayName = Ie;
367
+ var be = "MenuRadioItem", xe = c.forwardRef(
368
+ (e, n) => {
369
+ const { value: t, ...r } = e, s = yt(be, e.__scopeMenu), a = t === s.value;
370
+ return /* @__PURE__ */ u(Te, { scope: e.__scopeMenu, checked: a, children: /* @__PURE__ */ u(
371
+ z,
372
+ {
373
+ role: "menuitemradio",
374
+ "aria-checked": a,
375
+ ...r,
376
+ ref: n,
377
+ "data-state": ae(a),
378
+ onSelect: M(
379
+ r.onSelect,
380
+ () => {
381
+ var d;
382
+ return (d = s.onValueChange) == null ? void 0 : d.call(s, t);
383
+ },
384
+ { checkForDefaultPrevented: !1 }
385
+ )
386
+ }
387
+ ) });
388
+ }
389
+ );
390
+ xe.displayName = be;
391
+ var ce = "MenuItemIndicator", [Te, bt] = S(
392
+ ce,
393
+ { checked: !1 }
394
+ ), Ae = c.forwardRef(
395
+ (e, n) => {
396
+ const { __scopeMenu: t, forceMount: r, ...s } = e, a = bt(ce, t);
397
+ return /* @__PURE__ */ u(
398
+ H,
399
+ {
400
+ present: r || j(a.checked) || a.checked === !0,
401
+ children: /* @__PURE__ */ u(
402
+ L.span,
403
+ {
404
+ ...s,
405
+ ref: n,
406
+ "data-state": ae(a.checked)
407
+ }
408
+ )
409
+ }
410
+ );
411
+ }
412
+ );
413
+ Ae.displayName = ce;
414
+ var xt = "MenuSeparator", De = c.forwardRef(
415
+ (e, n) => {
416
+ const { __scopeMenu: t, ...r } = e;
417
+ return /* @__PURE__ */ u(
418
+ L.div,
419
+ {
420
+ role: "separator",
421
+ "aria-orientation": "horizontal",
422
+ ...r,
423
+ ref: n
424
+ }
425
+ );
426
+ }
427
+ );
428
+ De.displayName = xt;
429
+ var Tt = "MenuArrow", Oe = c.forwardRef(
430
+ (e, n) => {
431
+ const { __scopeMenu: t, ...r } = e, s = W(t);
432
+ return /* @__PURE__ */ u(ut, { ...s, ...r, ref: n });
433
+ }
434
+ );
435
+ Oe.displayName = Tt;
436
+ var At = "MenuSub", [Ht, ke] = S(At), D = "MenuSubTrigger", Ne = c.forwardRef(
437
+ (e, n) => {
438
+ const t = I(D, e.__scopeMenu), r = K(D, e.__scopeMenu), s = ke(D, e.__scopeMenu), a = ne(D, e.__scopeMenu), d = c.useRef(null), { pointerGraceTimerRef: v, onPointerGraceIntentChange: p } = a, f = { __scopeMenu: e.__scopeMenu }, h = c.useCallback(() => {
439
+ d.current && window.clearTimeout(d.current), d.current = null;
440
+ }, []);
441
+ return c.useEffect(() => h, [h]), c.useEffect(() => {
442
+ const o = v.current;
443
+ return () => {
444
+ window.clearTimeout(o), p(null);
445
+ };
446
+ }, [v, p]), /* @__PURE__ */ u(ee, { asChild: !0, ...f, children: /* @__PURE__ */ u(
447
+ we,
448
+ {
449
+ id: s.triggerId,
450
+ "aria-haspopup": "menu",
451
+ "aria-expanded": t.open,
452
+ "aria-controls": t.open ? s.contentId : void 0,
453
+ "data-state": Ke(t.open),
454
+ ...e,
455
+ ref: ze(n, s.onTriggerChange),
456
+ onClick: (o) => {
457
+ var l;
458
+ (l = e.onClick) == null || l.call(e, o), !(e.disabled || o.defaultPrevented) && (o.currentTarget.focus(), t.open || t.onOpenChange(!0));
459
+ },
460
+ onPointerMove: M(
461
+ e.onPointerMove,
462
+ k((o) => {
463
+ a.onItemEnter(o), !o.defaultPrevented && !e.disabled && !t.open && !d.current && (a.onPointerGraceIntentChange(null), d.current = window.setTimeout(() => {
464
+ t.onOpenChange(!0), h();
465
+ }, 100));
466
+ })
467
+ ),
468
+ onPointerLeave: M(
469
+ e.onPointerLeave,
470
+ k((o) => {
471
+ var C, m;
472
+ h();
473
+ const l = (C = t.content) == null ? void 0 : C.getBoundingClientRect();
474
+ if (l) {
475
+ const w = (m = t.content) == null ? void 0 : m.dataset.side, y = w === "right", T = y ? -5 : 5, G = l[y ? "left" : "right"], U = l[y ? "right" : "left"];
476
+ a.onPointerGraceIntentChange({
477
+ area: [
478
+ // Apply a bleed on clientX to ensure that our exit point is
479
+ // consistently within polygon bounds
480
+ { x: o.clientX + T, y: o.clientY },
481
+ { x: G, y: l.top },
482
+ { x: U, y: l.top },
483
+ { x: U, y: l.bottom },
484
+ { x: G, y: l.bottom }
485
+ ],
486
+ side: w
487
+ }), window.clearTimeout(v.current), v.current = window.setTimeout(
488
+ () => a.onPointerGraceIntentChange(null),
489
+ 300
490
+ );
491
+ } else {
492
+ if (a.onTriggerLeave(o), o.defaultPrevented) return;
493
+ a.onPointerGraceIntentChange(null);
494
+ }
495
+ })
496
+ ),
497
+ onKeyDown: M(e.onKeyDown, (o) => {
498
+ var C;
499
+ const l = a.searchRef.current !== "";
500
+ e.disabled || l && o.key === " " || dt[r.dir].includes(o.key) && (t.onOpenChange(!0), (C = t.content) == null || C.focus(), o.preventDefault());
501
+ })
502
+ }
503
+ ) });
504
+ }
505
+ );
506
+ Ne.displayName = D;
507
+ var Le = "MenuSubContent", Fe = c.forwardRef(
508
+ (e, n) => {
509
+ const t = _e(_, e.__scopeMenu), { forceMount: r = t.forceMount, align: s = "start", ...a } = e, d = I(_, e.__scopeMenu), v = K(_, e.__scopeMenu), p = ke(Le, e.__scopeMenu), f = c.useRef(null), h = N(n, f);
510
+ return /* @__PURE__ */ u(O.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(H, { present: r || d.open, children: /* @__PURE__ */ u(O.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ u(
511
+ oe,
512
+ {
513
+ id: p.contentId,
514
+ "aria-labelledby": p.triggerId,
515
+ ...a,
516
+ ref: h,
517
+ align: s,
518
+ side: v.dir === "rtl" ? "left" : "right",
519
+ disableOutsidePointerEvents: !1,
520
+ disableOutsideScroll: !1,
521
+ trapFocus: !1,
522
+ onOpenAutoFocus: (o) => {
523
+ var l;
524
+ v.isUsingKeyboardRef.current && ((l = f.current) == null || l.focus()), o.preventDefault();
525
+ },
526
+ onCloseAutoFocus: (o) => o.preventDefault(),
527
+ onFocusOutside: M(e.onFocusOutside, (o) => {
528
+ o.target !== p.trigger && d.onOpenChange(!1);
529
+ }),
530
+ onEscapeKeyDown: M(e.onEscapeKeyDown, (o) => {
531
+ v.onClose(), o.preventDefault();
532
+ }),
533
+ onKeyDown: M(e.onKeyDown, (o) => {
534
+ var m;
535
+ const l = o.currentTarget.contains(o.target), C = ft[v.dir].includes(o.key);
536
+ l && C && (d.onOpenChange(!1), (m = p.trigger) == null || m.focus(), o.preventDefault());
537
+ })
538
+ }
539
+ ) }) }) });
540
+ }
541
+ );
542
+ Fe.displayName = Le;
543
+ function Ke(e) {
544
+ return e ? "open" : "closed";
545
+ }
546
+ function j(e) {
547
+ return e === "indeterminate";
548
+ }
549
+ function ae(e) {
550
+ return j(e) ? "indeterminate" : e ? "checked" : "unchecked";
551
+ }
552
+ function Dt(e) {
553
+ const n = document.activeElement;
554
+ for (const t of e)
555
+ if (t === n || (t.focus(), document.activeElement !== n)) return;
556
+ }
557
+ function Ot(e, n) {
558
+ return e.map((t, r) => e[(n + r) % e.length]);
559
+ }
560
+ function kt(e, n, t) {
561
+ const s = n.length > 1 && Array.from(n).every((f) => f === n[0]) ? n[0] : n, a = t ? e.indexOf(t) : -1;
562
+ let d = Ot(e, Math.max(a, 0));
563
+ s.length === 1 && (d = d.filter((f) => f !== t));
564
+ const p = d.find(
565
+ (f) => f.toLowerCase().startsWith(s.toLowerCase())
566
+ );
567
+ return p !== t ? p : void 0;
568
+ }
569
+ function Nt(e, n) {
570
+ const { x: t, y: r } = e;
571
+ let s = !1;
572
+ for (let a = 0, d = n.length - 1; a < n.length; d = a++) {
573
+ const v = n[a], p = n[d], f = v.x, h = v.y, o = p.x, l = p.y;
574
+ h > r != l > r && t < (o - f) * (r - h) / (l - h) + f && (s = !s);
575
+ }
576
+ return s;
577
+ }
578
+ function Lt(e, n) {
579
+ if (!n) return !1;
580
+ const t = { x: e.clientX, y: e.clientY };
581
+ return Nt(t, n);
582
+ }
583
+ function k(e) {
584
+ return (n) => n.pointerType === "mouse" ? e(n) : void 0;
585
+ }
586
+ var Wt = ge, zt = ee, Zt = Re, $t = Pe, qt = re, Jt = Ee, Qt = z, en = Se, tn = ye, nn = xe, on = Ae, rn = De, cn = Oe, an = Ne, sn = Fe;
587
+ export {
588
+ zt as A,
589
+ $t as C,
590
+ qt as G,
591
+ Qt as I,
592
+ Jt as L,
593
+ Zt as P,
594
+ Wt as R,
595
+ rn as S,
596
+ en as a,
597
+ tn as b,
598
+ jt as c,
599
+ nn as d,
600
+ on as e,
601
+ cn as f,
602
+ an as g,
603
+ sn as h
604
+ };