@alixpartners/ui-components 2.1.2 → 2.2.0

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 (63) hide show
  1. package/dist/ToastProvider-D5LImZ-Q.js +1136 -0
  2. package/dist/assets/Dialog.css +1 -1
  3. package/dist/assets/NavBar.css +1 -1
  4. package/dist/assets/SplitButton.css +1 -1
  5. package/dist/assets/Tooltip.css +1 -1
  6. package/dist/components/Banner/Banner.test.js +1 -1
  7. package/dist/components/Button/Button.test.js +124 -3217
  8. package/dist/components/Checkbox/Checkbox.js +7 -6
  9. package/dist/components/Checkbox/Checkbox.test.js +47 -47
  10. package/dist/components/Creatable/Creatable.js +107 -108
  11. package/dist/components/Dialog/Dialog.d.ts +21 -7
  12. package/dist/components/Dialog/Dialog.js +296 -61
  13. package/dist/components/Dialog/Dialog.test.d.ts +1 -0
  14. package/dist/components/Dialog/Dialog.test.js +368 -0
  15. package/dist/components/Dropdown/Dropdown.js +80 -81
  16. package/dist/components/FilePicker/FilePicker.test.js +1 -1
  17. package/dist/components/Ghost/Ghost.test.js +6 -6
  18. package/dist/components/Input/Input.test.js +2 -2
  19. package/dist/components/NavBar/NavBar.js +16 -16
  20. package/dist/components/Radio/Radio.js +1 -1
  21. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  22. package/dist/components/RadioGroup/RadioGroup.test.js +1 -1
  23. package/dist/components/Search/Search.test.js +1 -1
  24. package/dist/components/SplitButton/SplitButton.js +8 -9
  25. package/dist/components/SplitButton/SplitButton.test.js +1 -1
  26. package/dist/components/Tag/Tag.test.js +1 -1
  27. package/dist/components/TagsFields/TagsFields.js +3 -4
  28. package/dist/components/Textarea/Textarea.js +68 -70
  29. package/dist/components/Textarea/Textarea.test.js +2 -2
  30. package/dist/components/Toast/Toast.d.ts +5 -19
  31. package/dist/components/Toast/Toast.js +65 -62
  32. package/dist/components/Toast/Toast.test.js +47 -30
  33. package/dist/components/ToastProvider/ToastContext.d.ts +11 -0
  34. package/dist/components/ToastProvider/ToastProvider.d.ts +19 -0
  35. package/dist/components/ToastProvider/ToastProvider.js +7 -0
  36. package/dist/components/ToastProvider/ToastProvider.test.d.ts +1 -0
  37. package/dist/components/ToastProvider/ToastProvider.test.js +264 -0
  38. package/dist/components/ToastProvider/types.d.ts +54 -0
  39. package/dist/components/ToastProvider/useToast.d.ts +28 -0
  40. package/dist/components/Toggle/Toggle.js +31 -30
  41. package/dist/components/Toggle/Toggle.test.js +9 -9
  42. package/dist/components/Tooltip/Tooltip.js +20 -19
  43. package/dist/{index-2H7slGYV.js → index-7CBv-Jx6.js} +1 -1
  44. package/dist/{index-DpfPnSMn.js → index-BymOxiM6.js} +2 -2
  45. package/dist/index-C-3_YVJ1.js +1539 -0
  46. package/dist/{index-BKtdMA_j.js → index-C4ffg1vf.js} +24 -23
  47. package/dist/{index-BGZDIjm9.js → index-Chv2KjIL.js} +171 -168
  48. package/dist/{index-BJXIvJs4.js → index-CpsmI33B.js} +24 -23
  49. package/dist/index-CxAtPSMM.js +27 -0
  50. package/dist/{index-CjQV7MmW.js → index-DEphED6n.js} +11 -11
  51. package/dist/index-DM51yNMI.js +237 -0
  52. package/dist/{index-CVWHq7Pr.js → index-D_3jWVyV.js} +37 -36
  53. package/dist/index-DkTDHhag.js +3098 -0
  54. package/dist/index-DrR82jOT.js +142 -0
  55. package/dist/magic-string.es-uPKorP4O.js +663 -0
  56. package/dist/main.d.ts +3 -0
  57. package/dist/main.js +38 -34
  58. package/dist/useToast-Cz5MGKnw.js +11 -0
  59. package/dist/{vi.ClIskdbk-CFW_9sOK.js → vi.bdSIJ99Y-017e_Pkz.js} +9494 -10227
  60. package/package.json +6 -3
  61. package/dist/index-DWydnyjJ.js +0 -245
  62. package/dist/index-DieLVN0p.js +0 -1664
  63. package/dist/magic-string.es-D4UQQyt0.js +0 -859
@@ -1,10 +1,11 @@
1
1
  import * as s from "react";
2
- import { c as _, d as P, a as C, u as B, P as I, e as q } from "./index-DWydnyjJ.js";
3
- import { c as w, I as K, u as T, R as U } from "./index-CjQV7MmW.js";
2
+ import { d as P, c as C, u as B, P as b, b as _ } from "./index-DM51yNMI.js";
3
+ import { I as q, u as K, R as T, c as w } from "./index-DEphED6n.js";
4
+ import { u as U } from "./index-CxAtPSMM.js";
4
5
  import { u as V } from "./index-BZPx6jYI.js";
5
- import { P as j } from "./index-DpfPnSMn.js";
6
+ import { P as j } from "./index-BymOxiM6.js";
6
7
  import { jsx as p, jsxs as z } from "react/jsx-runtime";
7
- var E = "Radio", [H, G] = _(E), [W, X] = H(E), S = s.forwardRef(
8
+ var E = "Radio", [H, g] = _(E), [W, X] = H(E), k = s.forwardRef(
8
9
  (a, d) => {
9
10
  const {
10
11
  __scopeRadio: o,
@@ -19,7 +20,7 @@ var E = "Radio", [H, G] = _(E), [W, X] = H(E), S = s.forwardRef(
19
20
  } = a, [l, m] = s.useState(null), t = P(d, (y) => m(y)), u = s.useRef(!1), h = l ? R || !!l.closest("form") : !0;
20
21
  return /* @__PURE__ */ z(W, { scope: o, checked: e, disabled: n, children: [
21
22
  /* @__PURE__ */ p(
22
- I.button,
23
+ b.button,
23
24
  {
24
25
  type: "button",
25
26
  role: "radio",
@@ -52,12 +53,12 @@ var E = "Radio", [H, G] = _(E), [W, X] = H(E), S = s.forwardRef(
52
53
  ] });
53
54
  }
54
55
  );
55
- S.displayName = E;
56
- var g = "RadioIndicator", k = s.forwardRef(
56
+ k.displayName = E;
57
+ var G = "RadioIndicator", S = s.forwardRef(
57
58
  (a, d) => {
58
- const { __scopeRadio: o, forceMount: i, ...e } = a, r = X(g, o);
59
+ const { __scopeRadio: o, forceMount: i, ...e } = a, r = X(G, o);
59
60
  return /* @__PURE__ */ p(j, { present: i || r.checked, children: /* @__PURE__ */ p(
60
- I.span,
61
+ b.span,
61
62
  {
62
63
  "data-state": N(r.checked),
63
64
  "data-disabled": r.disabled ? "" : void 0,
@@ -67,7 +68,7 @@ var g = "RadioIndicator", k = s.forwardRef(
67
68
  ) });
68
69
  }
69
70
  );
70
- k.displayName = g;
71
+ S.displayName = G;
71
72
  var Y = "RadioBubbleInput", A = s.forwardRef(
72
73
  ({
73
74
  __scopeRadio: a,
@@ -76,7 +77,7 @@ var Y = "RadioBubbleInput", A = s.forwardRef(
76
77
  bubbles: i = !0,
77
78
  ...e
78
79
  }, r) => {
79
- const n = s.useRef(null), f = P(n, r), c = V(o), R = q(d);
80
+ const n = s.useRef(null), f = P(n, r), c = V(o), R = U(d);
80
81
  return s.useEffect(() => {
81
82
  const v = n.current;
82
83
  if (!v) return;
@@ -89,7 +90,7 @@ var Y = "RadioBubbleInput", A = s.forwardRef(
89
90
  t.call(v, o), v.dispatchEvent(u);
90
91
  }
91
92
  }, [c, o, i]), /* @__PURE__ */ p(
92
- I.input,
93
+ b.input,
93
94
  {
94
95
  type: "radio",
95
96
  "aria-hidden": !0,
@@ -113,10 +114,10 @@ A.displayName = Y;
113
114
  function N(a) {
114
115
  return a ? "checked" : "unchecked";
115
116
  }
116
- var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], b = "RadioGroup", [Q, se] = _(b, [
117
+ var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], I = "RadioGroup", [Q] = _(I, [
117
118
  w,
118
- G
119
- ]), x = w(), D = G(), [Z, $] = Q(b), M = s.forwardRef(
119
+ g
120
+ ]), x = w(), D = g(), [Z, $] = Q(I), M = s.forwardRef(
120
121
  (a, d) => {
121
122
  const {
122
123
  __scopeRadioGroup: o,
@@ -130,11 +131,11 @@ var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], b = "RadioGroup", [
130
131
  loop: v = !0,
131
132
  onValueChange: l,
132
133
  ...m
133
- } = a, t = x(o), u = T(R), [h, y] = B({
134
+ } = a, t = x(o), u = K(R), [h, y] = B({
134
135
  prop: r,
135
136
  defaultProp: e ?? null,
136
137
  onChange: l,
137
- caller: b
138
+ caller: I
138
139
  });
139
140
  return /* @__PURE__ */ p(
140
141
  Z,
@@ -146,7 +147,7 @@ var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], b = "RadioGroup", [
146
147
  value: h,
147
148
  onValueChange: y,
148
149
  children: /* @__PURE__ */ p(
149
- U,
150
+ T,
150
151
  {
151
152
  asChild: !0,
152
153
  ...t,
@@ -154,7 +155,7 @@ var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], b = "RadioGroup", [
154
155
  dir: u,
155
156
  loop: v,
156
157
  children: /* @__PURE__ */ p(
157
- I.div,
158
+ b.div,
158
159
  {
159
160
  role: "radiogroup",
160
161
  "aria-required": n,
@@ -171,7 +172,7 @@ var J = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], b = "RadioGroup", [
171
172
  );
172
173
  }
173
174
  );
174
- M.displayName = b;
175
+ M.displayName = I;
175
176
  var O = "RadioGroupItem", F = s.forwardRef(
176
177
  (a, d) => {
177
178
  const { __scopeRadioGroup: o, disabled: i, ...e } = a, r = $(O, o), n = r.disabled || i, f = x(o), c = D(o), R = s.useRef(null), v = P(d, R), l = r.value === e.value, m = s.useRef(!1);
@@ -183,14 +184,14 @@ var O = "RadioGroupItem", F = s.forwardRef(
183
184
  document.removeEventListener("keydown", t), document.removeEventListener("keyup", u);
184
185
  };
185
186
  }, []), /* @__PURE__ */ p(
186
- K,
187
+ q,
187
188
  {
188
189
  asChild: !0,
189
190
  ...f,
190
191
  focusable: !n,
191
192
  active: l,
192
193
  children: /* @__PURE__ */ p(
193
- S,
194
+ k,
194
195
  {
195
196
  disabled: n,
196
197
  required: r.required,
@@ -217,7 +218,7 @@ F.displayName = O;
217
218
  var ee = "RadioGroupIndicator", L = s.forwardRef(
218
219
  (a, d) => {
219
220
  const { __scopeRadioGroup: o, ...i } = a, e = D(o);
220
- return /* @__PURE__ */ p(k, { ...e, ...i, ref: d });
221
+ return /* @__PURE__ */ p(S, { ...e, ...i, ref: d });
221
222
  }
222
223
  );
223
224
  L.displayName = ee;
@@ -0,0 +1,27 @@
1
+ import * as u from "react";
2
+ import { i as z } from "./index-DM51yNMI.js";
3
+ function n(r) {
4
+ const [h, i] = u.useState(void 0);
5
+ return z(() => {
6
+ if (r) {
7
+ i({ width: r.offsetWidth, height: r.offsetHeight });
8
+ const f = new ResizeObserver((e) => {
9
+ if (!Array.isArray(e) || !e.length)
10
+ return;
11
+ const b = e[0];
12
+ let o, t;
13
+ if ("borderBoxSize" in b) {
14
+ const s = b.borderBoxSize, d = Array.isArray(s) ? s[0] : s;
15
+ o = d.inlineSize, t = d.blockSize;
16
+ } else
17
+ o = r.offsetWidth, t = r.offsetHeight;
18
+ i({ width: o, height: t });
19
+ });
20
+ return f.observe(r, { box: "border-box" }), () => f.unobserve(r);
21
+ } else
22
+ i(void 0);
23
+ }, [r]), h;
24
+ }
25
+ export {
26
+ n as u
27
+ };
@@ -1,34 +1,34 @@
1
1
  import * as i from "react";
2
- import S from "react";
3
- import { c as L, d as P, g as G, P as K, a as A, u as $ } from "./index-DWydnyjJ.js";
2
+ import g from "react";
3
+ import { b as L, d as P, f as G, P as K, c as A, u as $ } from "./index-DM51yNMI.js";
4
4
  import { jsx as m } from "react/jsx-runtime";
5
- import { u as J, a as Q } from "./index-2H7slGYV.js";
5
+ import { u as J, a as Q } from "./index-7CBv-Jx6.js";
6
6
  function W(e) {
7
7
  const o = e + "CollectionProvider", [u, n] = L(o), [_, v] = u(
8
8
  o,
9
9
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
10
10
  ), I = (f) => {
11
- const { scope: t, children: a } = f, d = S.useRef(null), r = S.useRef(/* @__PURE__ */ new Map()).current;
11
+ const { scope: t, children: a } = f, d = g.useRef(null), r = g.useRef(/* @__PURE__ */ new Map()).current;
12
12
  return /* @__PURE__ */ m(_, { scope: t, itemMap: r, collectionRef: d, children: a });
13
13
  };
14
14
  I.displayName = o;
15
- const C = e + "CollectionSlot", h = G(C), p = S.forwardRef(
15
+ const C = e + "CollectionSlot", h = G(C), p = g.forwardRef(
16
16
  (f, t) => {
17
17
  const { scope: a, children: d } = f, r = v(C, a), c = P(t, r.collectionRef);
18
18
  return /* @__PURE__ */ m(h, { ref: c, children: d });
19
19
  }
20
20
  );
21
21
  p.displayName = C;
22
- const s = e + "CollectionItemSlot", R = "data-radix-collection-item", F = G(s), b = S.forwardRef(
22
+ const s = e + "CollectionItemSlot", R = "data-radix-collection-item", F = G(s), b = g.forwardRef(
23
23
  (f, t) => {
24
- const { scope: a, children: d, ...r } = f, c = S.useRef(null), T = P(t, c), w = v(s, a);
25
- return S.useEffect(() => (w.itemMap.set(c, { ref: c, ...r }), () => void w.itemMap.delete(c))), /* @__PURE__ */ m(F, { [R]: "", ref: T, children: d });
24
+ const { scope: a, children: d, ...r } = f, c = g.useRef(null), T = P(t, c), w = v(s, a);
25
+ return g.useEffect(() => (w.itemMap.set(c, { ref: c, ...r }), () => void w.itemMap.delete(c))), /* @__PURE__ */ m(F, { [R]: "", ref: T, children: d });
26
26
  }
27
27
  );
28
28
  b.displayName = s;
29
29
  function E(f) {
30
30
  const t = v(e + "CollectionConsumer", f);
31
- return S.useCallback(() => {
31
+ return g.useCallback(() => {
32
32
  const d = t.collectionRef.current;
33
33
  if (!d) return [];
34
34
  const r = Array.from(d.querySelectorAll(`[${R}]`));
@@ -114,9 +114,9 @@ var ce = i.forwardRef((e, o) => {
114
114
  if (l.target === l.currentTarget && H && !a) {
115
115
  const O = new CustomEvent(N, ee);
116
116
  if (l.currentTarget.dispatchEvent(O), !O.defaultPrevented) {
117
- const M = c().filter((g) => g.focusable), j = M.find((g) => g.active), q = M.find((g) => g.id === f), z = [j, q, ...M].filter(
117
+ const M = c().filter((S) => S.focusable), j = M.find((S) => S.active), q = M.find((S) => S.id === f), z = [j, q, ...M].filter(
118
118
  Boolean
119
- ).map((g) => g.ref.current);
119
+ ).map((S) => S.ref.current);
120
120
  Y(z, s);
121
121
  }
122
122
  }
@@ -0,0 +1,237 @@
1
+ import * as c from "react";
2
+ import * as w from "react-dom";
3
+ import { jsx as m, Fragment as E } from "react/jsx-runtime";
4
+ function h(t, e) {
5
+ if (typeof t == "function")
6
+ return t(e);
7
+ t != null && (t.current = e);
8
+ }
9
+ function b(...t) {
10
+ return (e) => {
11
+ let o = !1;
12
+ const s = t.map((n) => {
13
+ const r = h(n, e);
14
+ return !o && typeof r == "function" && (o = !0), r;
15
+ });
16
+ if (o)
17
+ return () => {
18
+ for (let n = 0; n < s.length; n++) {
19
+ const r = s[n];
20
+ typeof r == "function" ? r() : h(t[n], null);
21
+ }
22
+ };
23
+ };
24
+ }
25
+ function A(...t) {
26
+ return c.useCallback(b(...t), t);
27
+ }
28
+ // @__NO_SIDE_EFFECTS__
29
+ function R(t) {
30
+ const e = /* @__PURE__ */ $(t), o = c.forwardRef((s, n) => {
31
+ const { children: r, ...i } = s, u = c.Children.toArray(r), l = u.find(g);
32
+ if (l) {
33
+ const a = l.props.children, d = u.map((f) => f === l ? c.Children.count(a) > 1 ? c.Children.only(null) : c.isValidElement(a) ? a.props.children : null : f);
34
+ return /* @__PURE__ */ m(e, { ...i, ref: n, children: c.isValidElement(a) ? c.cloneElement(a, void 0, d) : null });
35
+ }
36
+ return /* @__PURE__ */ m(e, { ...i, ref: n, children: r });
37
+ });
38
+ return o.displayName = `${t}.Slot`, o;
39
+ }
40
+ // @__NO_SIDE_EFFECTS__
41
+ function $(t) {
42
+ const e = c.forwardRef((o, s) => {
43
+ const { children: n, ...r } = o;
44
+ if (c.isValidElement(n)) {
45
+ const i = N(n), u = _(r, n.props);
46
+ return n.type !== c.Fragment && (u.ref = s ? b(s, i) : i), c.cloneElement(n, u);
47
+ }
48
+ return c.Children.count(n) > 1 ? c.Children.only(null) : null;
49
+ });
50
+ return e.displayName = `${t}.SlotClone`, e;
51
+ }
52
+ var x = Symbol("radix.slottable");
53
+ // @__NO_SIDE_EFFECTS__
54
+ function F(t) {
55
+ const e = ({ children: o }) => /* @__PURE__ */ m(E, { children: o });
56
+ return e.displayName = `${t}.Slottable`, e.__radixId = x, e;
57
+ }
58
+ function g(t) {
59
+ return c.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === x;
60
+ }
61
+ function _(t, e) {
62
+ const o = { ...e };
63
+ for (const s in e) {
64
+ const n = t[s], r = e[s];
65
+ /^on[A-Z]/.test(s) ? n && r ? o[s] = (...u) => {
66
+ const l = r(...u);
67
+ return n(...u), l;
68
+ } : n && (o[s] = n) : s === "style" ? o[s] = { ...n, ...r } : s === "className" && (o[s] = [n, r].filter(Boolean).join(" "));
69
+ }
70
+ return { ...t, ...o };
71
+ }
72
+ function N(t) {
73
+ var s, n;
74
+ let e = (s = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : s.get, o = e && "isReactWarning" in e && e.isReactWarning;
75
+ return o ? t.ref : (e = (n = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : n.get, o = e && "isReactWarning" in e && e.isReactWarning, o ? t.props.ref : t.props.ref || t.ref);
76
+ }
77
+ var O = [
78
+ "a",
79
+ "button",
80
+ "div",
81
+ "form",
82
+ "h2",
83
+ "h3",
84
+ "img",
85
+ "input",
86
+ "label",
87
+ "li",
88
+ "nav",
89
+ "ol",
90
+ "p",
91
+ "select",
92
+ "span",
93
+ "svg",
94
+ "ul"
95
+ ], L = O.reduce((t, e) => {
96
+ const o = /* @__PURE__ */ R(`Primitive.${e}`), s = c.forwardRef((n, r) => {
97
+ const { asChild: i, ...u } = n, l = i ? o : e;
98
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(l, { ...u, ref: r });
99
+ });
100
+ return s.displayName = `Primitive.${e}`, { ...t, [e]: s };
101
+ }, {});
102
+ function T(t, e) {
103
+ t && w.flushSync(() => t.dispatchEvent(e));
104
+ }
105
+ function k(t, e) {
106
+ const o = c.createContext(e), s = (r) => {
107
+ const { children: i, ...u } = r, l = c.useMemo(() => u, Object.values(u));
108
+ return /* @__PURE__ */ m(o.Provider, { value: l, children: i });
109
+ };
110
+ s.displayName = t + "Provider";
111
+ function n(r) {
112
+ const i = c.useContext(o);
113
+ if (i) return i;
114
+ if (e !== void 0) return e;
115
+ throw new Error(`\`${r}\` must be used within \`${t}\``);
116
+ }
117
+ return [s, n];
118
+ }
119
+ function B(t, e = []) {
120
+ let o = [];
121
+ function s(r, i) {
122
+ const u = c.createContext(i), l = o.length;
123
+ o = [...o, i];
124
+ const a = (f) => {
125
+ var C;
126
+ const { scope: p, children: S, ...v } = f, y = ((C = p == null ? void 0 : p[t]) == null ? void 0 : C[l]) || u, P = c.useMemo(() => v, Object.values(v));
127
+ return /* @__PURE__ */ m(y.Provider, { value: P, children: S });
128
+ };
129
+ a.displayName = r + "Provider";
130
+ function d(f, p) {
131
+ var y;
132
+ const S = ((y = p == null ? void 0 : p[t]) == null ? void 0 : y[l]) || u, v = c.useContext(S);
133
+ if (v) return v;
134
+ if (i !== void 0) return i;
135
+ throw new Error(`\`${f}\` must be used within \`${r}\``);
136
+ }
137
+ return [a, d];
138
+ }
139
+ const n = () => {
140
+ const r = o.map((i) => c.createContext(i));
141
+ return function(u) {
142
+ const l = (u == null ? void 0 : u[t]) || r;
143
+ return c.useMemo(
144
+ () => ({ [`__scope${t}`]: { ...u, [t]: l } }),
145
+ [u, l]
146
+ );
147
+ };
148
+ };
149
+ return n.scopeName = t, [s, I(n, ...e)];
150
+ }
151
+ function I(...t) {
152
+ const e = t[0];
153
+ if (t.length === 1) return e;
154
+ const o = () => {
155
+ const s = t.map((n) => ({
156
+ useScope: n(),
157
+ scopeName: n.scopeName
158
+ }));
159
+ return function(r) {
160
+ const i = s.reduce((u, { useScope: l, scopeName: a }) => {
161
+ const f = l(r)[`__scope${a}`];
162
+ return { ...u, ...f };
163
+ }, {});
164
+ return c.useMemo(() => ({ [`__scope${e.scopeName}`]: i }), [i]);
165
+ };
166
+ };
167
+ return o.scopeName = e.scopeName, o;
168
+ }
169
+ function U(t, e, { checkForDefaultPrevented: o = !0 } = {}) {
170
+ return function(n) {
171
+ if (t == null || t(n), o === !1 || !n.defaultPrevented)
172
+ return e == null ? void 0 : e(n);
173
+ };
174
+ }
175
+ var D = globalThis != null && globalThis.document ? c.useLayoutEffect : () => {
176
+ }, j = c[" useInsertionEffect ".trim().toString()] || D;
177
+ function Z({
178
+ prop: t,
179
+ defaultProp: e,
180
+ onChange: o = () => {
181
+ },
182
+ caller: s
183
+ }) {
184
+ const [n, r, i] = V({
185
+ defaultProp: e,
186
+ onChange: o
187
+ }), u = t !== void 0, l = u ? t : n;
188
+ {
189
+ const d = c.useRef(t !== void 0);
190
+ c.useEffect(() => {
191
+ const f = d.current;
192
+ f !== u && console.warn(
193
+ `${s} is changing from ${f ? "controlled" : "uncontrolled"} to ${u ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
194
+ ), d.current = u;
195
+ }, [u, s]);
196
+ }
197
+ const a = c.useCallback(
198
+ (d) => {
199
+ var f;
200
+ if (u) {
201
+ const p = M(d) ? d(t) : d;
202
+ p !== t && ((f = i.current) == null || f.call(i, p));
203
+ } else
204
+ r(d);
205
+ },
206
+ [u, t, r, i]
207
+ );
208
+ return [l, a];
209
+ }
210
+ function V({
211
+ defaultProp: t,
212
+ onChange: e
213
+ }) {
214
+ const [o, s] = c.useState(t), n = c.useRef(o), r = c.useRef(e);
215
+ return j(() => {
216
+ r.current = e;
217
+ }, [e]), c.useEffect(() => {
218
+ var i;
219
+ n.current !== o && ((i = r.current) == null || i.call(r, o), n.current = o);
220
+ }, [o, n]), [o, s, r];
221
+ }
222
+ function M(t) {
223
+ return typeof t == "function";
224
+ }
225
+ export {
226
+ L as P,
227
+ b as a,
228
+ B as b,
229
+ U as c,
230
+ A as d,
231
+ T as e,
232
+ R as f,
233
+ k as g,
234
+ F as h,
235
+ D as i,
236
+ Z as u
237
+ };
@@ -1,10 +1,11 @@
1
1
  import * as r from "react";
2
- import { c as je, d as N, a as v, P as F, f as He, g as We, b as ze } from "./index-DWydnyjJ.js";
3
- import { a as Ze, c as pe, u as $e, I as qe, R as Je } from "./index-CjQV7MmW.js";
4
- import { c as ve, R as Qe, A as et, P as tt, D as nt, C as ot, a as rt } from "./index-DieLVN0p.js";
5
- import { h as ct, u as at, R as st, F as ut } from "./index-BGZDIjm9.js";
6
- import { P as H } from "./index-DpfPnSMn.js";
7
- import { a as Me } from "./index-2H7slGYV.js";
2
+ import { d as N, c as v, b as je, P as F, e as He, f as We, a as ze } from "./index-DM51yNMI.js";
3
+ import { u as Ze, c as pe, a as $e, I as qe, R as Je } from "./index-DEphED6n.js";
4
+ import { P as Qe, D as et } from "./index-DrR82jOT.js";
5
+ import { h as tt, u as nt, R as ot, F as rt } from "./index-Chv2KjIL.js";
6
+ import { R as ct, A as at, c as ve, C as st, a as ut } from "./index-C-3_YVJ1.js";
7
+ import { P as H } from "./index-BymOxiM6.js";
8
+ import { a as Me } from "./index-7CBv-Jx6.js";
8
9
  import { jsx as u } from "react/jsx-runtime";
9
10
  var Q = ["Enter", " "], it = ["ArrowDown", "PageUp", "Home"], he = ["ArrowUp", "PageDown", "End"], lt = [...it, ...he], dt = {
10
11
  ltr: [...Q, "ArrowRight"],
@@ -12,12 +13,12 @@ var Q = ["Enter", " "], it = ["ArrowDown", "PageUp", "Home"], he = ["ArrowUp", "
12
13
  }, ft = {
13
14
  ltr: ["ArrowLeft"],
14
15
  rtl: ["ArrowRight"]
15
- }, L = "Menu", [O, mt, pt] = Ze(L), [w, Xt] = je(L, [
16
+ }, L = "Menu", [O, mt, pt] = $e(L), [w, jt] = je(L, [
16
17
  pt,
17
18
  ve,
18
19
  pe
19
20
  ]), W = ve(), Ce = pe(), [vt, I] = w(L), [Mt, K] = w(L), ge = (e) => {
20
- const { __scopeMenu: n, open: t = !1, children: o, dir: s, onOpenChange: c, modal: d = !0 } = e, p = W(n), [M, m] = r.useState(null), f = r.useRef(!1), a = Me(c), l = $e(s);
21
+ const { __scopeMenu: n, open: t = !1, children: o, dir: s, onOpenChange: c, modal: d = !0 } = e, p = W(n), [M, m] = r.useState(null), f = r.useRef(!1), a = Me(c), l = Ze(s);
21
22
  return r.useEffect(() => {
22
23
  const C = () => {
23
24
  f.current = !0, document.addEventListener("pointerdown", h, { capture: !0, once: !0 }), document.addEventListener("pointermove", h, { capture: !0, once: !0 });
@@ -25,7 +26,7 @@ var Q = ["Enter", " "], it = ["ArrowDown", "PageUp", "Home"], he = ["ArrowUp", "
25
26
  return document.addEventListener("keydown", C, { capture: !0 }), () => {
26
27
  document.removeEventListener("keydown", C, { capture: !0 }), document.removeEventListener("pointerdown", h, { capture: !0 }), document.removeEventListener("pointermove", h, { capture: !0 });
27
28
  };
28
- }, []), /* @__PURE__ */ u(Qe, { ...p, children: /* @__PURE__ */ u(
29
+ }, []), /* @__PURE__ */ u(ct, { ...p, children: /* @__PURE__ */ u(
29
30
  vt,
30
31
  {
31
32
  scope: n,
@@ -51,7 +52,7 @@ ge.displayName = L;
51
52
  var ht = "MenuAnchor", ee = r.forwardRef(
52
53
  (e, n) => {
53
54
  const { __scopeMenu: t, ...o } = e, s = W(t);
54
- return /* @__PURE__ */ u(et, { ...s, ...o, ref: n });
55
+ return /* @__PURE__ */ u(at, { ...s, ...o, ref: n });
55
56
  }
56
57
  );
57
58
  ee.displayName = ht;
@@ -59,7 +60,7 @@ var te = "MenuPortal", [Ct, _e] = w(te, {
59
60
  forceMount: void 0
60
61
  }), Re = (e) => {
61
62
  const { __scopeMenu: n, forceMount: t, children: o, container: s } = e, c = I(te, n);
62
- return /* @__PURE__ */ u(Ct, { scope: n, forceMount: t, children: /* @__PURE__ */ u(H, { present: t || c.open, children: /* @__PURE__ */ u(tt, { asChild: !0, container: s, children: o }) }) });
63
+ return /* @__PURE__ */ u(Ct, { scope: n, forceMount: t, children: /* @__PURE__ */ u(H, { present: t || c.open, children: /* @__PURE__ */ u(Qe, { asChild: !0, container: s, children: o }) }) });
63
64
  };
64
65
  Re.displayName = te;
65
66
  var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
@@ -72,7 +73,7 @@ var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
72
73
  const t = I(_, e.__scopeMenu), o = r.useRef(null), s = N(n, o);
73
74
  return r.useEffect(() => {
74
75
  const c = o.current;
75
- if (c) return ct(c);
76
+ if (c) return tt(c);
76
77
  }, []), /* @__PURE__ */ u(
77
78
  oe,
78
79
  {
@@ -120,14 +121,14 @@ var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
120
121
  onDismiss: C,
121
122
  disableOutsideScroll: h,
122
123
  ...S
123
- } = e, y = I(_, t), T = K(_, t), G = W(t), U = Ce(t), se = mt(t), [Ge, ue] = r.useState(null), B = r.useRef(null), Ue = N(n, B, y.onContentChange), V = r.useRef(0), Y = r.useRef(""), Be = r.useRef(0), Z = r.useRef(null), ie = r.useRef("right"), $ = r.useRef(0), Ve = h ? st : r.Fragment, Ye = h ? { as: Pt, allowPinchZoom: !0 } : void 0, Xe = (i) => {
124
+ } = e, y = I(_, t), T = K(_, t), G = W(t), U = Ce(t), se = mt(t), [Ge, ue] = r.useState(null), B = r.useRef(null), Ue = N(n, B, y.onContentChange), V = r.useRef(0), Y = r.useRef(""), Be = r.useRef(0), Z = r.useRef(null), ie = r.useRef("right"), $ = r.useRef(0), Ve = h ? ot : r.Fragment, Ye = h ? { as: Pt, allowPinchZoom: !0 } : void 0, Xe = (i) => {
124
125
  var x, de;
125
126
  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;
126
127
  (function P(fe) {
127
128
  Y.current = fe, window.clearTimeout(V.current), fe !== "" && (V.current = window.setTimeout(() => P(""), 1e3));
128
129
  })(g), A && setTimeout(() => A.focus());
129
130
  };
130
- r.useEffect(() => () => window.clearTimeout(V.current), []), at();
131
+ r.useEffect(() => () => window.clearTimeout(V.current), []), nt();
131
132
  const b = r.useCallback((i) => {
132
133
  var R, E;
133
134
  return ie.current === ((R = Z.current) == null ? void 0 : R.side) && Ft(i, (E = Z.current) == null ? void 0 : E.area);
@@ -161,7 +162,7 @@ var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
161
162
  Z.current = i;
162
163
  }, []),
163
164
  children: /* @__PURE__ */ u(Ve, { ...Ye, children: /* @__PURE__ */ u(
164
- ut,
165
+ rt,
165
166
  {
166
167
  asChild: !0,
167
168
  trapped: s,
@@ -171,7 +172,7 @@ var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
171
172
  }),
172
173
  onUnmountAutoFocus: d,
173
174
  children: /* @__PURE__ */ u(
174
- nt,
175
+ et,
175
176
  {
176
177
  asChild: !0,
177
178
  disableOutsidePointerEvents: p,
@@ -195,7 +196,7 @@ var _ = "MenuContent", [gt, ne] = w(_), Pe = r.forwardRef(
195
196
  }),
196
197
  preventScrollOnEntryFocus: !0,
197
198
  children: /* @__PURE__ */ u(
198
- ot,
199
+ st,
199
200
  {
200
201
  role: "menu",
201
202
  "aria-orientation": "vertical",
@@ -423,11 +424,11 @@ De.displayName = xt;
423
424
  var Tt = "MenuArrow", Oe = r.forwardRef(
424
425
  (e, n) => {
425
426
  const { __scopeMenu: t, ...o } = e, s = W(t);
426
- return /* @__PURE__ */ u(rt, { ...s, ...o, ref: n });
427
+ return /* @__PURE__ */ u(ut, { ...s, ...o, ref: n });
427
428
  }
428
429
  );
429
430
  Oe.displayName = Tt;
430
- var At = "MenuSub", [jt, ke] = w(At), D = "MenuSubTrigger", Ne = r.forwardRef(
431
+ var At = "MenuSub", [Ht, ke] = w(At), D = "MenuSubTrigger", Ne = r.forwardRef(
431
432
  (e, n) => {
432
433
  const t = I(D, e.__scopeMenu), o = K(D, e.__scopeMenu), s = ke(D, e.__scopeMenu), c = ne(D, e.__scopeMenu), d = r.useRef(null), { pointerGraceTimerRef: p, onPointerGraceIntentChange: M } = c, m = { __scopeMenu: e.__scopeMenu }, f = r.useCallback(() => {
433
434
  d.current && window.clearTimeout(d.current), d.current = null;
@@ -577,22 +578,22 @@ function Ft(e, n) {
577
578
  function k(e) {
578
579
  return (n) => n.pointerType === "mouse" ? e(n) : void 0;
579
580
  }
580
- var Ht = ge, Wt = ee, zt = Re, Zt = Pe, $t = re, qt = Ee, Jt = z, Qt = we, en = ye, tn = xe, nn = Ae, on = De, rn = Oe, cn = Ne, an = Le;
581
+ var Wt = ge, zt = ee, Zt = Re, $t = Pe, qt = re, Jt = Ee, Qt = z, en = we, tn = ye, nn = xe, on = Ae, rn = De, cn = Oe, an = Ne, sn = Le;
581
582
  export {
582
- Wt as A,
583
- Zt as C,
584
- $t as G,
585
- Jt as I,
586
- qt as L,
587
- zt as P,
588
- Ht as R,
589
- on as S,
590
- Qt as a,
591
- en as b,
592
- Xt as c,
593
- tn as d,
594
- nn as e,
595
- rn as f,
596
- cn as g,
597
- an as h
583
+ zt as A,
584
+ $t as C,
585
+ qt as G,
586
+ Qt as I,
587
+ Jt as L,
588
+ Zt as P,
589
+ Wt as R,
590
+ rn as S,
591
+ en as a,
592
+ tn as b,
593
+ jt as c,
594
+ nn as d,
595
+ on as e,
596
+ cn as f,
597
+ an as g,
598
+ sn as h
598
599
  };