@wrdagency/blockout 0.0.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 (95) hide show
  1. package/dist/2NBKRL7C-DnAMmXv4.js +81 -0
  2. package/dist/CaretDown.es-eySGHzTJ.js +32 -0
  3. package/dist/CaretUp.es-Cy8czlHG.js +32 -0
  4. package/dist/P7GR5CS5-BryEvRCz.js +621 -0
  5. package/dist/SSRBase.es-BUXS72ra.js +33 -0
  6. package/dist/T7VMP3TM--1s529fr.js +3544 -0
  7. package/dist/UQQRIHDV-Bfi_RJby.js +1046 -0
  8. package/dist/VIIRIBF3-XWA2y8Hu.js +21 -0
  9. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  10. package/dist/assets/index.css +1 -0
  11. package/dist/assets/index10.css +1 -0
  12. package/dist/assets/index11.css +1 -0
  13. package/dist/assets/index2.css +1 -0
  14. package/dist/assets/index3.css +1 -0
  15. package/dist/assets/index4.css +1 -0
  16. package/dist/assets/index5.css +1 -0
  17. package/dist/assets/index6.css +1 -0
  18. package/dist/assets/index7.css +1 -0
  19. package/dist/assets/index8.css +1 -0
  20. package/dist/assets/index9.css +1 -0
  21. package/dist/components/button/index.d.ts +9 -0
  22. package/dist/components/button/index.js +28 -0
  23. package/dist/components/button-group/index.d.ts +6 -0
  24. package/dist/components/button-group/index.js +6 -0
  25. package/dist/components/controls/base-control/index.d.ts +3 -0
  26. package/dist/components/controls/base-control/index.js +26 -0
  27. package/dist/components/controls/base-control/props.d.ts +23 -0
  28. package/dist/components/controls/base-control/props.js +21 -0
  29. package/dist/components/controls/index.d.ts +6 -0
  30. package/dist/components/controls/index.js +14 -0
  31. package/dist/components/controls/number-control/index.d.ts +6 -0
  32. package/dist/components/controls/number-control/index.js +52 -0
  33. package/dist/components/controls/select-control/index.d.ts +9 -0
  34. package/dist/components/controls/select-control/index.js +591 -0
  35. package/dist/components/controls/select-control/options.d.ts +11 -0
  36. package/dist/components/controls/select-control/options.js +12 -0
  37. package/dist/components/controls/text-control/index.d.ts +6 -0
  38. package/dist/components/controls/text-control/index.js +12 -0
  39. package/dist/components/controls/textarea-control/index.d.ts +6 -0
  40. package/dist/components/controls/textarea-control/index.js +18 -0
  41. package/dist/components/controls/toggle-control/index.d.ts +8 -0
  42. package/dist/components/controls/toggle-control/index.js +46 -0
  43. package/dist/components/data-table/column.d.ts +4 -0
  44. package/dist/components/data-table/column.js +874 -0
  45. package/dist/components/data-table/context.d.ts +7 -0
  46. package/dist/components/data-table/context.js +36 -0
  47. package/dist/components/data-table/example.d.ts +1 -0
  48. package/dist/components/data-table/example.js +5 -0
  49. package/dist/components/data-table/footer.d.ts +2 -0
  50. package/dist/components/data-table/footer.js +23 -0
  51. package/dist/components/data-table/header.d.ts +7 -0
  52. package/dist/components/data-table/header.js +408 -0
  53. package/dist/components/data-table/index.d.ts +10 -0
  54. package/dist/components/data-table/index.js +86 -0
  55. package/dist/components/data-table/types.d.ts +75 -0
  56. package/dist/components/data-table/types.js +1 -0
  57. package/dist/components/index.d.ts +5 -0
  58. package/dist/components/index.js +23 -0
  59. package/dist/components/menu/icon.d.ts +4 -0
  60. package/dist/components/menu/icon.js +6 -0
  61. package/dist/components/menu/index.d.ts +8 -0
  62. package/dist/components/menu/index.js +131 -0
  63. package/dist/components/menu/item.d.ts +7 -0
  64. package/dist/components/menu/item.js +8 -0
  65. package/dist/components/menu/items/action.d.ts +7 -0
  66. package/dist/components/menu/items/action.js +23 -0
  67. package/dist/components/menu/items/spacer.d.ts +2 -0
  68. package/dist/components/menu/items/spacer.js +46 -0
  69. package/dist/components/menu/items/submenu.d.ts +7 -0
  70. package/dist/components/menu/items/submenu.js +7 -0
  71. package/dist/components/menu/items/toggle.d.ts +7 -0
  72. package/dist/components/menu/items/toggle.js +109 -0
  73. package/dist/components/menu/types.d.ts +28 -0
  74. package/dist/components/menu/types.js +1 -0
  75. package/dist/components/visually-hidden/index.d.ts +2 -0
  76. package/dist/components/visually-hidden/index.js +5 -0
  77. package/dist/index.d.ts +2 -0
  78. package/dist/index.js +25 -0
  79. package/dist/item-CPVd5mKo.js +758 -0
  80. package/dist/primitives/draggable/index.d.ts +17 -0
  81. package/dist/primitives/draggable/index.js +52 -0
  82. package/dist/primitives/index.d.ts +1 -0
  83. package/dist/primitives/index.js +4 -0
  84. package/dist/primitives/resizable/index.d.ts +7 -0
  85. package/dist/primitives/resizable/index.js +76 -0
  86. package/dist/types/component.d.ts +4 -0
  87. package/dist/types/component.js +1 -0
  88. package/dist/types/math.d.ts +10 -0
  89. package/dist/types/math.js +1 -0
  90. package/dist/utils/css.d.ts +1 -0
  91. package/dist/utils/css.js +6 -0
  92. package/dist/utils/noop.d.ts +1 -0
  93. package/dist/utils/noop.js +5 -0
  94. package/package.json +61 -0
  95. package/readme.md +3 -0
@@ -0,0 +1,758 @@
1
+ import { jsx as y, jsxs as oe } from "react/jsx-runtime";
2
+ import { ActionMenuItem as Ie } from "./components/menu/items/action.js";
3
+ import { SeparatorMenuItem as ke } from "./components/menu/items/spacer.js";
4
+ import * as S from "react";
5
+ import { useRef as U, useState as ue, useEffect as B, useContext as Le, createContext as Ve, useCallback as ge, createRef as Be, useMemo as je } from "react";
6
+ import { w as Ke } from "./SSRBase.es-BUXS72ra.js";
7
+ import { EmptyIcon as Ze } from "./components/menu/icon.js";
8
+ import { ToggleMenuItem as $e } from "./components/menu/items/toggle.js";
9
+ import { b as me, H as Ue, a as qe, c as ae, M as We, d as Ee } from "./VIIRIBF3-XWA2y8Hu.js";
10
+ import { u as ze, M as Ge } from "./2NBKRL7C-DnAMmXv4.js";
11
+ import { a as Xe, d as Ye, k as Qe, j as Se, c as Je, u as et, e as tt, i as nt, h as ot, g as Pe, R as rt, f as st } from "./T7VMP3TM--1s529fr.js";
12
+ import { c as _e, g as re, d as ce, h as se, j as ut, m as at, o as it, p as ct, t as lt, s as pe, f as dt, u as W } from "./UQQRIHDV-Bfi_RJby.js";
13
+ import { y as Z, z as L, A as I, b as Q, _ as $, i as J, K as mt, L as Oe, u as le, M as ve, N as X, O as ft, v as pt, E as fe, h as k, s as ee, j as E, Q as ye, e as q, R as de, f as te, d as ne, G as Ae, x as vt, S as ht, B as bt, r as Fe, T as wt, g as Mt, F as gt } from "./P7GR5CS5-BryEvRCz.js";
14
+ const Et = /* @__PURE__ */ new Map([
15
+ [
16
+ "bold",
17
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z" }))
18
+ ],
19
+ [
20
+ "duotone",
21
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M176,128,96,208V48Z", opacity: "0.2" }), /* @__PURE__ */ S.createElement("path", { d: "M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z" }))
22
+ ],
23
+ [
24
+ "fill",
25
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z" }))
26
+ ],
27
+ [
28
+ "light",
29
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z" }))
30
+ ],
31
+ [
32
+ "regular",
33
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" }))
34
+ ],
35
+ [
36
+ "thin",
37
+ /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("path", { d: "M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z" }))
38
+ ]
39
+ ]), He = S.forwardRef((n, o) => /* @__PURE__ */ S.createElement(Ke, { ref: o, ...n, weights: Et }));
40
+ He.displayName = "CaretRightIcon";
41
+ function St(n = {}) {
42
+ var o;
43
+ const t = (o = n.store) == null ? void 0 : o.getState(), e = Xe(Z(I({}, n), {
44
+ placement: L(
45
+ n.placement,
46
+ t == null ? void 0 : t.placement,
47
+ "bottom"
48
+ )
49
+ })), i = L(n.timeout, t == null ? void 0 : t.timeout, 500), u = Z(I({}, e.getState()), {
50
+ timeout: i,
51
+ showTimeout: L(n.showTimeout, t == null ? void 0 : t.showTimeout),
52
+ hideTimeout: L(n.hideTimeout, t == null ? void 0 : t.hideTimeout),
53
+ autoFocusOnShow: L(t == null ? void 0 : t.autoFocusOnShow, !1)
54
+ }), a = _e(u, e, n.store);
55
+ return Z(I(I({}, e), a), {
56
+ setAutoFocusOnShow: (s) => a.setState("autoFocusOnShow", s)
57
+ });
58
+ }
59
+ function Pt(n, o, t) {
60
+ return re(n, t, "timeout"), re(n, t, "showTimeout"), re(n, t, "hideTimeout"), Ye(n, o, t);
61
+ }
62
+ function ie(n) {
63
+ return [n.clientX, n.clientY];
64
+ }
65
+ function he(n, o) {
66
+ const [t, e] = n;
67
+ let i = !1;
68
+ const u = o.length;
69
+ for (let a = u, s = 0, l = a - 1; s < a; l = s++) {
70
+ const [r, c] = o[s], [b, m] = o[l], [, d] = o[l === 0 ? a - 1 : l - 1] || [0, 0], g = (c - m) * (t - r) - (r - b) * (e - c);
71
+ if (m < c) {
72
+ if (e >= m && e < c) {
73
+ if (g === 0) return !0;
74
+ g > 0 && (e === m ? e > d && (i = !i) : i = !i);
75
+ }
76
+ } else if (c < m) {
77
+ if (e > c && e <= m) {
78
+ if (g === 0) return !0;
79
+ g < 0 && (e === m ? e < d && (i = !i) : i = !i);
80
+ }
81
+ } else if (e === c && (t >= b && t <= r || t >= r && t <= b))
82
+ return !0;
83
+ }
84
+ return i;
85
+ }
86
+ function _t(n, o) {
87
+ const { top: t, right: e, bottom: i, left: u } = o, [a, s] = n, l = a < u ? "left" : a > e ? "right" : null, r = s < t ? "top" : s > i ? "bottom" : null;
88
+ return [l, r];
89
+ }
90
+ function be(n, o) {
91
+ const t = n.getBoundingClientRect(), { top: e, right: i, bottom: u, left: a } = t, [s, l] = _t(o, t), r = [o];
92
+ return s ? (l !== "top" && r.push([s === "left" ? a : i, e]), r.push([s === "left" ? i : a, e]), r.push([s === "left" ? i : a, u]), l !== "bottom" && r.push([s === "left" ? a : i, u])) : l === "top" ? (r.push([a, e]), r.push([a, u]), r.push([i, u]), r.push([i, e])) : (r.push([a, u]), r.push([a, e]), r.push([i, e]), r.push([i, u])), r;
93
+ }
94
+ var Ot = "div";
95
+ function xe(n, o, t, e) {
96
+ return se(o) ? !0 : n ? !!(de(o, n) || t && de(t, n) || e != null && e.some((i) => xe(n, i, t))) : !1;
97
+ }
98
+ function yt(n) {
99
+ var o = n, {
100
+ store: t
101
+ } = o, e = $(o, [
102
+ "store"
103
+ ]);
104
+ const [i, u] = ue(!1), a = t.useState("mounted");
105
+ B(() => {
106
+ a || u(!1);
107
+ }, [a]);
108
+ const s = e.onFocus, l = q((c) => {
109
+ s == null || s(c), !c.defaultPrevented && u(!0);
110
+ }), r = U(null);
111
+ return B(() => ce(t, ["anchorElement"], (c) => {
112
+ r.current = c.anchorElement;
113
+ }), []), e = k(E({
114
+ autoFocusOnHide: i,
115
+ finalFocus: r
116
+ }, e), {
117
+ onFocus: l
118
+ }), e;
119
+ }
120
+ var we = Ve(null), Ce = Q(
121
+ function(o) {
122
+ var t = o, {
123
+ store: e,
124
+ modal: i = !1,
125
+ portal: u = !!i,
126
+ hideOnEscape: a = !0,
127
+ hideOnHoverOutside: s = !0,
128
+ disablePointerEventsOnApproach: l = !!s
129
+ } = t, r = $(t, [
130
+ "store",
131
+ "modal",
132
+ "portal",
133
+ "hideOnEscape",
134
+ "hideOnHoverOutside",
135
+ "disablePointerEventsOnApproach"
136
+ ]);
137
+ const c = me();
138
+ e = e || c, J(
139
+ e,
140
+ process.env.NODE_ENV !== "production" && "Hovercard must receive a `store` prop or be wrapped in a HovercardProvider component."
141
+ );
142
+ const b = U(null), [m, d] = ue([]), g = U(0), w = U(null), { portalRef: M, domReady: f } = mt(u, r.portalRef), F = Oe(), V = !!s, C = le(s), H = !!l, T = le(
143
+ l
144
+ ), h = e.useState("open"), N = e.useState("mounted");
145
+ B(() => {
146
+ if (!f || !N || !V && !H) return;
147
+ const v = b.current;
148
+ return v ? ve(
149
+ X("mousemove", (P) => {
150
+ if (!e || !F()) return;
151
+ const { anchorElement: O, hideTimeout: _, timeout: z } = e.getState(), Y = w.current, [G] = P.composedPath(), j = O;
152
+ if (xe(G, v, j, m)) {
153
+ w.current = G && j && de(j, G) ? ie(P) : null, window.clearTimeout(g.current), g.current = 0;
154
+ return;
155
+ }
156
+ if (!g.current) {
157
+ if (Y) {
158
+ const K = ie(P), De = be(v, Y);
159
+ if (he(K, De)) {
160
+ if (w.current = K, !T(P)) return;
161
+ P.preventDefault(), P.stopPropagation();
162
+ return;
163
+ }
164
+ }
165
+ C(P) && (g.current = window.setTimeout(() => {
166
+ g.current = 0, e == null || e.hide();
167
+ }, _ ?? z));
168
+ }
169
+ }, !0),
170
+ () => clearTimeout(g.current)
171
+ ) : void 0;
172
+ }, [
173
+ e,
174
+ F,
175
+ f,
176
+ N,
177
+ V,
178
+ H,
179
+ m,
180
+ T,
181
+ C
182
+ ]), B(() => {
183
+ if (!f || !N || !H) return;
184
+ const v = (A) => {
185
+ const P = b.current;
186
+ if (!P) return;
187
+ const O = w.current;
188
+ if (!O) return;
189
+ const _ = be(P, O);
190
+ if (he(ie(A), _)) {
191
+ if (!T(A)) return;
192
+ A.preventDefault(), A.stopPropagation();
193
+ }
194
+ };
195
+ return ve(
196
+ // Note: we may need to add pointer events here in the future.
197
+ X("mouseenter", v, !0),
198
+ X("mouseover", v, !0),
199
+ X("mouseout", v, !0),
200
+ X("mouseleave", v, !0)
201
+ );
202
+ }, [f, N, H, T]), B(() => {
203
+ f && (h || e == null || e.setAutoFocusOnShow(!1));
204
+ }, [e, f, h]);
205
+ const R = ft(h);
206
+ B(() => {
207
+ if (f)
208
+ return () => {
209
+ R.current || e == null || e.setAutoFocusOnShow(!1);
210
+ };
211
+ }, [e, f]);
212
+ const x = Le(we);
213
+ pt(() => {
214
+ if (i || !u || !N || !f) return;
215
+ const v = b.current;
216
+ if (v)
217
+ return x == null ? void 0 : x(v);
218
+ }, [i, u, N, f]);
219
+ const p = ge(
220
+ (v) => {
221
+ d((P) => [...P, v]);
222
+ const A = x == null ? void 0 : x(v);
223
+ return () => {
224
+ d(
225
+ (P) => P.filter((O) => O !== v)
226
+ ), A == null || A();
227
+ };
228
+ },
229
+ [x]
230
+ );
231
+ r = fe(
232
+ r,
233
+ (v) => /* @__PURE__ */ y(Ue, { value: e, children: /* @__PURE__ */ y(we.Provider, { value: p, children: v }) }),
234
+ [e, p]
235
+ ), r = k(E({}, r), {
236
+ ref: ee(b, r.ref)
237
+ }), r = yt(E({ store: e }, r));
238
+ const D = e.useState(
239
+ (v) => i || v.autoFocusOnShow
240
+ );
241
+ return r = Qe(k(E({
242
+ store: e,
243
+ modal: i,
244
+ portal: u,
245
+ autoFocusOnShow: D
246
+ }, r), {
247
+ portalRef: M,
248
+ hideOnEscape(v) {
249
+ return ye(a, v) ? !1 : (requestAnimationFrame(() => {
250
+ requestAnimationFrame(() => {
251
+ e == null || e.hide();
252
+ });
253
+ }), !0);
254
+ }
255
+ })), r;
256
+ }
257
+ );
258
+ Se(
259
+ te(function(o) {
260
+ const t = Ce(o);
261
+ return ne(Ot, t);
262
+ }),
263
+ me
264
+ );
265
+ var At = "a", Te = Q(
266
+ function(o) {
267
+ var t = o, { store: e, showOnHover: i = !0 } = t, u = $(t, ["store", "showOnHover"]);
268
+ const a = me();
269
+ e = e || a, J(
270
+ e,
271
+ process.env.NODE_ENV !== "production" && "HovercardAnchor must receive a `store` prop or be wrapped in a HovercardProvider component."
272
+ );
273
+ const s = Ae(u), l = U(0);
274
+ B(() => () => window.clearTimeout(l.current), []), B(() => X("mouseleave", (f) => {
275
+ if (!e) return;
276
+ const { anchorElement: F } = e.getState();
277
+ F && f.target === F && (window.clearTimeout(l.current), l.current = 0);
278
+ }, !0), [e]);
279
+ const r = u.onMouseMove, c = le(i), b = Oe(), m = q((M) => {
280
+ if (r == null || r(M), s || !e || M.defaultPrevented || l.current || !b() || !c(M)) return;
281
+ const f = M.currentTarget;
282
+ e.setAnchorElement(f), e.setDisclosureElement(f);
283
+ const { showTimeout: F, timeout: V } = e.getState(), C = () => {
284
+ l.current = 0, b() && (e == null || e.setAnchorElement(f), e == null || e.show(), queueMicrotask(() => {
285
+ e == null || e.setDisclosureElement(f);
286
+ }));
287
+ }, H = F ?? V;
288
+ H === 0 ? C() : l.current = window.setTimeout(C, H);
289
+ }), d = u.onClick, g = q((M) => {
290
+ d == null || d(M), e && (window.clearTimeout(l.current), l.current = 0);
291
+ }), w = ge(
292
+ (M) => {
293
+ if (!e) return;
294
+ const { anchorElement: f } = e.getState();
295
+ f != null && f.isConnected || e.setAnchorElement(M);
296
+ },
297
+ [e]
298
+ );
299
+ return u = k(E({}, u), {
300
+ ref: ee(w, u.ref),
301
+ onMouseMove: m,
302
+ onClick: g
303
+ }), u = ut(u), u;
304
+ }
305
+ );
306
+ te(function(o) {
307
+ const t = Te(o);
308
+ return ne(At, t);
309
+ });
310
+ function Ft(n = {}) {
311
+ var o = n, {
312
+ combobox: t,
313
+ parent: e,
314
+ menubar: i
315
+ } = o, u = vt(o, [
316
+ "combobox",
317
+ "parent",
318
+ "menubar"
319
+ ]);
320
+ const a = !!i && !e, s = at(
321
+ u.store,
322
+ ct(e, ["values"]),
323
+ it(t, [
324
+ "arrowElement",
325
+ "anchorElement",
326
+ "contentElement",
327
+ "popoverElement",
328
+ "disclosureElement"
329
+ ])
330
+ );
331
+ lt(u, s);
332
+ const l = s.getState(), r = Je(Z(I({}, u), {
333
+ store: s,
334
+ orientation: L(
335
+ u.orientation,
336
+ l.orientation,
337
+ "vertical"
338
+ )
339
+ })), c = St(Z(I({}, u), {
340
+ store: s,
341
+ placement: L(
342
+ u.placement,
343
+ l.placement,
344
+ "bottom-start"
345
+ ),
346
+ timeout: L(
347
+ u.timeout,
348
+ l.timeout,
349
+ a ? 0 : 150
350
+ ),
351
+ hideTimeout: L(u.hideTimeout, l.hideTimeout, 0)
352
+ })), b = Z(I(I({}, r.getState()), c.getState()), {
353
+ initialFocus: L(l.initialFocus, "container"),
354
+ values: L(
355
+ u.values,
356
+ l.values,
357
+ u.defaultValues,
358
+ {}
359
+ )
360
+ }), m = _e(b, r, c, s);
361
+ return pe(
362
+ m,
363
+ () => ce(m, ["mounted"], (d) => {
364
+ d.mounted || m.setState("activeId", null);
365
+ })
366
+ ), pe(
367
+ m,
368
+ () => ce(e, ["orientation"], (d) => {
369
+ m.setState(
370
+ "placement",
371
+ d.orientation === "vertical" ? "right-start" : "bottom-start"
372
+ );
373
+ })
374
+ ), Z(I(I(I({}, r), c), m), {
375
+ combobox: t,
376
+ parent: e,
377
+ menubar: i,
378
+ hideAll: () => {
379
+ c.hide(), e == null || e.hideAll();
380
+ },
381
+ setInitialFocus: (d) => m.setState("initialFocus", d),
382
+ setValues: (d) => m.setState("values", d),
383
+ setValue: (d, g) => {
384
+ d !== "__proto__" && d !== "constructor" && (Array.isArray(d) || m.setState("values", (w) => {
385
+ const M = w[d], f = ht(g, M);
386
+ return f === M ? w : Z(I({}, w), {
387
+ [d]: f !== void 0 && f
388
+ });
389
+ }));
390
+ }
391
+ });
392
+ }
393
+ function Ht(n, o, t) {
394
+ return bt(o, [t.combobox, t.parent, t.menubar]), re(n, t, "values", "setValues"), Object.assign(
395
+ Pt(
396
+ tt(n, o, t),
397
+ o,
398
+ t
399
+ ),
400
+ {
401
+ combobox: t.combobox,
402
+ parent: t.parent,
403
+ menubar: t.menubar
404
+ }
405
+ );
406
+ }
407
+ function Ne(n = {}) {
408
+ const o = qe(), t = ze(), e = et();
409
+ n = k(E({}, n), {
410
+ parent: n.parent !== void 0 ? n.parent : o,
411
+ menubar: n.menubar !== void 0 ? n.menubar : t,
412
+ combobox: n.combobox !== void 0 ? n.combobox : e
413
+ });
414
+ const [i, u] = dt(Ft, n);
415
+ return Ht(i, u, n);
416
+ }
417
+ var xt = "div";
418
+ function Ct(n) {
419
+ var o = n, { store: t } = o, e = $(o, ["store"]);
420
+ const [i, u] = ue(void 0), a = e["aria-label"], s = W(t, "disclosureElement"), l = W(t, "contentElement");
421
+ return B(() => {
422
+ const r = s;
423
+ if (!r) return;
424
+ const c = l;
425
+ if (!c) return;
426
+ a || c.hasAttribute("aria-label") ? u(void 0) : r.id && u(r.id);
427
+ }, [a, s, l]), i;
428
+ }
429
+ var Re = Q(
430
+ function(o) {
431
+ var t = o, { store: e, alwaysVisible: i, composite: u } = t, a = $(t, ["store", "alwaysVisible", "composite"]);
432
+ const s = ae();
433
+ e = e || s, J(
434
+ e,
435
+ process.env.NODE_ENV !== "production" && "MenuList must receive a `store` prop or be wrapped in a MenuProvider component."
436
+ );
437
+ const l = e.parent, r = e.menubar, c = !!l, b = Fe(a.id), m = a.onKeyDown, d = e.useState(
438
+ (h) => h.placement.split("-")[0]
439
+ ), g = e.useState(
440
+ (h) => h.orientation === "both" ? void 0 : h.orientation
441
+ ), w = g !== "vertical", M = W(
442
+ r,
443
+ (h) => !!h && h.orientation !== "vertical"
444
+ ), f = q((h) => {
445
+ if (m == null || m(h), !h.defaultPrevented) {
446
+ if (c || r && !w) {
447
+ const R = {
448
+ ArrowRight: () => d === "left" && !w,
449
+ ArrowLeft: () => d === "right" && !w,
450
+ ArrowUp: () => d === "bottom" && w,
451
+ ArrowDown: () => d === "top" && w
452
+ }[h.key];
453
+ if (R != null && R())
454
+ return h.stopPropagation(), h.preventDefault(), e == null ? void 0 : e.hide();
455
+ }
456
+ if (r) {
457
+ const R = {
458
+ ArrowRight: () => {
459
+ if (M)
460
+ return r.next();
461
+ },
462
+ ArrowLeft: () => {
463
+ if (M)
464
+ return r.previous();
465
+ },
466
+ ArrowDown: () => {
467
+ if (!M)
468
+ return r.next();
469
+ },
470
+ ArrowUp: () => {
471
+ if (!M)
472
+ return r.previous();
473
+ }
474
+ }[h.key], x = R == null ? void 0 : R();
475
+ x !== void 0 && (h.stopPropagation(), h.preventDefault(), r.move(x));
476
+ }
477
+ }
478
+ });
479
+ a = fe(
480
+ a,
481
+ (h) => /* @__PURE__ */ y(We, { value: e, children: h }),
482
+ [e]
483
+ );
484
+ const F = Ct(E({ store: e }, a)), V = e.useState("mounted"), C = nt(V, a.hidden, i), H = C ? k(E({}, a.style), { display: "none" }) : a.style;
485
+ a = k(E({
486
+ id: b,
487
+ "aria-labelledby": F,
488
+ hidden: C
489
+ }, a), {
490
+ ref: ee(b ? e.setContentElement : null, a.ref),
491
+ style: H,
492
+ onKeyDown: f
493
+ });
494
+ const T = !!e.combobox;
495
+ return u = u ?? !T, u && (a = E({
496
+ role: "menu",
497
+ "aria-orientation": g
498
+ }, a)), a = ot(E({ store: e, composite: u }, a)), a = Pe(E({ store: e, typeahead: !T }, a)), a;
499
+ }
500
+ );
501
+ te(function(o) {
502
+ const t = Re(o);
503
+ return ne(xt, t);
504
+ });
505
+ var Tt = "div", Nt = Q(function(o) {
506
+ var t = o, {
507
+ store: e,
508
+ modal: i = !1,
509
+ portal: u = !!i,
510
+ hideOnEscape: a = !0,
511
+ autoFocusOnShow: s = !0,
512
+ hideOnHoverOutside: l,
513
+ alwaysVisible: r
514
+ } = t, c = $(t, [
515
+ "store",
516
+ "modal",
517
+ "portal",
518
+ "hideOnEscape",
519
+ "autoFocusOnShow",
520
+ "hideOnHoverOutside",
521
+ "alwaysVisible"
522
+ ]);
523
+ const b = ae();
524
+ e = e || b, J(
525
+ e,
526
+ process.env.NODE_ENV !== "production" && "Menu must receive a `store` prop or be wrapped in a MenuProvider component."
527
+ );
528
+ const m = U(null), d = e.parent, g = e.menubar, w = !!d, M = !!g && !w;
529
+ c = k(E({}, c), {
530
+ ref: ee(m, c.ref)
531
+ });
532
+ const f = Re(E({
533
+ store: e,
534
+ alwaysVisible: r
535
+ }, c)), { "aria-labelledby": F } = f;
536
+ c = $(f, ["aria-labelledby"]);
537
+ const [C, H] = ue(), T = e.useState("autoFocusOnShow"), h = e.useState("initialFocus"), N = e.useState("baseElement"), R = e.useState("renderedItems");
538
+ B(() => {
539
+ let O = !1;
540
+ return H((_) => {
541
+ var z, Y, G;
542
+ if (O || !T) return;
543
+ if ((z = _ == null ? void 0 : _.current) != null && z.isConnected) return _;
544
+ const j = Be();
545
+ switch (h) {
546
+ // TODO: Refactor
547
+ case "first":
548
+ j.current = ((Y = R.find((K) => !K.disabled && K.element)) == null ? void 0 : Y.element) || null;
549
+ break;
550
+ case "last":
551
+ j.current = ((G = [...R].reverse().find((K) => !K.disabled && K.element)) == null ? void 0 : G.element) || null;
552
+ break;
553
+ default:
554
+ j.current = N;
555
+ }
556
+ return j;
557
+ }), () => {
558
+ O = !0;
559
+ };
560
+ }, [e, T, h, R, N]);
561
+ const x = w ? !1 : i, p = !!s, D = !!C || !!c.initialFocus || !!x, v = W(
562
+ e.combobox || e,
563
+ "contentElement"
564
+ ), A = W(
565
+ (d == null ? void 0 : d.combobox) || d,
566
+ "contentElement"
567
+ ), P = je(() => {
568
+ if (!A || !v) return;
569
+ const O = v.getAttribute("role"), _ = A.getAttribute("role");
570
+ if (!((_ === "menu" || _ === "menubar") && O === "menu"))
571
+ return A;
572
+ }, [v, A]);
573
+ return P !== void 0 && (c = E({
574
+ preserveTabOrderAnchor: P
575
+ }, c)), c = Ce(k(E({
576
+ store: e,
577
+ alwaysVisible: r,
578
+ initialFocus: C,
579
+ autoFocusOnShow: p ? D && s : T || !!x
580
+ }, c), {
581
+ hideOnEscape(O) {
582
+ return ye(a, O) ? !1 : (e == null || e.hideAll(), !0);
583
+ },
584
+ hideOnHoverOutside(O) {
585
+ const _ = e == null ? void 0 : e.getState().disclosureElement;
586
+ return (typeof l == "function" ? l(O) : l ?? (w ? !0 : M ? _ ? !se(_) : !0 : !1)) ? O.defaultPrevented || !w || !_ || (wt(_, "mouseout", O), !se(_)) ? !0 : (requestAnimationFrame(() => {
587
+ se(_) || e == null || e.hide();
588
+ }), !1) : !1;
589
+ },
590
+ modal: x,
591
+ portal: u,
592
+ backdrop: w ? !1 : c.backdrop
593
+ })), c = E({
594
+ "aria-labelledby": F
595
+ }, c), c;
596
+ }), Rt = Se(
597
+ te(function(o) {
598
+ const t = Nt(o);
599
+ return ne(Tt, t);
600
+ }),
601
+ ae
602
+ );
603
+ function Dt(n = {}) {
604
+ const o = Ne(n);
605
+ return /* @__PURE__ */ y(Ee, { value: o, children: n.children });
606
+ }
607
+ var It = "button";
608
+ function kt(n, o) {
609
+ return {
610
+ ArrowDown: o === "bottom" || o === "top" ? "first" : !1,
611
+ ArrowUp: o === "bottom" || o === "top" ? "last" : !1,
612
+ ArrowRight: o === "right" ? "first" : !1,
613
+ ArrowLeft: o === "left" ? "first" : !1
614
+ }[n.key];
615
+ }
616
+ function Me(n, o) {
617
+ return !!(n != null && n.some((t) => !t.element || t.element === o ? !1 : t.element.getAttribute("aria-expanded") === "true"));
618
+ }
619
+ var Lt = Q(
620
+ function(o) {
621
+ var t = o, {
622
+ store: e,
623
+ focusable: i,
624
+ accessibleWhenDisabled: u,
625
+ showOnHover: a
626
+ } = t, s = $(t, [
627
+ "store",
628
+ "focusable",
629
+ "accessibleWhenDisabled",
630
+ "showOnHover"
631
+ ]);
632
+ const l = ae();
633
+ e = e || l, J(
634
+ e,
635
+ process.env.NODE_ENV !== "production" && "MenuButton must receive a `store` prop or be wrapped in a MenuProvider component."
636
+ );
637
+ const r = U(null), c = e.parent, b = e.menubar, m = !!c, d = !!b && !m, g = Ae(s), w = () => {
638
+ const p = r.current;
639
+ p && (e == null || e.setDisclosureElement(p), e == null || e.setAnchorElement(p), e == null || e.show());
640
+ }, M = s.onFocus, f = q((p) => {
641
+ if (M == null || M(p), g || p.defaultPrevented || (e == null || e.setAutoFocusOnShow(!1), e == null || e.setActiveId(null), !b) || !d) return;
642
+ const { items: D } = b.getState();
643
+ Me(D, p.currentTarget) && w();
644
+ }), F = W(
645
+ e,
646
+ (p) => p.placement.split("-")[0]
647
+ ), V = s.onKeyDown, C = q((p) => {
648
+ if (V == null || V(p), g || p.defaultPrevented) return;
649
+ const D = kt(p, F);
650
+ D && (p.preventDefault(), w(), e == null || e.setAutoFocusOnShow(!0), e == null || e.setInitialFocus(D));
651
+ }), H = s.onClick, T = q((p) => {
652
+ if (H == null || H(p), p.defaultPrevented || !e) return;
653
+ const D = !p.detail, { open: v } = e.getState();
654
+ (!v || D) && ((!m || D) && e.setAutoFocusOnShow(!0), e.setInitialFocus(D ? "first" : "container")), m && w();
655
+ });
656
+ s = fe(
657
+ s,
658
+ (p) => /* @__PURE__ */ y(Ee, { value: e, children: p }),
659
+ [e]
660
+ ), m && (s = k(E({}, s), {
661
+ render: /* @__PURE__ */ y(rt.div, { render: s.render })
662
+ }));
663
+ const h = Fe(s.id), N = W(
664
+ (c == null ? void 0 : c.combobox) || c,
665
+ "contentElement"
666
+ ), R = m || d ? Mt(N, "menuitem") : void 0, x = e.useState("contentElement");
667
+ return s = k(E({
668
+ id: h,
669
+ role: R,
670
+ "aria-haspopup": gt(x, "menu")
671
+ }, s), {
672
+ ref: ee(r, s.ref),
673
+ onFocus: f,
674
+ onKeyDown: C,
675
+ onClick: T
676
+ }), s = Te(k(E({
677
+ store: e,
678
+ focusable: i,
679
+ accessibleWhenDisabled: u
680
+ }, s), {
681
+ showOnHover: (p) => {
682
+ if (!(() => {
683
+ if (typeof a == "function") return a(p);
684
+ if (a != null) return a;
685
+ if (m) return !0;
686
+ if (!b) return !1;
687
+ const { items: P } = b.getState();
688
+ return d && Me(P);
689
+ })()) return !1;
690
+ const A = d ? b : c;
691
+ return A && A.setActiveId(p.currentTarget.id), !0;
692
+ }
693
+ })), s = st(E({
694
+ store: e,
695
+ toggleOnClick: !m,
696
+ focusable: i,
697
+ accessibleWhenDisabled: u
698
+ }, s)), s = Pe(E({
699
+ store: e,
700
+ typeahead: d
701
+ }, s)), s;
702
+ }
703
+ ), Vt = te(function(o) {
704
+ const t = Lt(o);
705
+ return ne(It, t);
706
+ });
707
+ const Bt = ({ item: n }) => {
708
+ const o = n.icon || Ze, t = Ne();
709
+ return /* @__PURE__ */ oe(Dt, { store: t, children: [
710
+ /* @__PURE__ */ oe(
711
+ Vt,
712
+ {
713
+ className: "component-menu__item component-menu__item--submenu",
714
+ render: /* @__PURE__ */ y(Ge, {}),
715
+ children: [
716
+ /* @__PURE__ */ y(o, { className: "component-menu__item__icon component-menu__item__icon--pictoral" }),
717
+ /* @__PURE__ */ oe("div", { className: "component-menu__item__text", children: [
718
+ /* @__PURE__ */ oe("div", { className: "component-menu__item__text__header", children: [
719
+ /* @__PURE__ */ y("div", { className: "component-menu__item__label", children: n.label }),
720
+ /* @__PURE__ */ y(He, { className: "component-menu__item__icon component-menu__item__icon--submenu-indicator" })
721
+ ] }),
722
+ /* @__PURE__ */ y("p", { className: "component-menu__item__description", children: n.description })
723
+ ] })
724
+ ]
725
+ }
726
+ ),
727
+ /* @__PURE__ */ y(
728
+ Rt,
729
+ {
730
+ gutter: 12,
731
+ shift: 0,
732
+ wrapperProps: {
733
+ className: "component-menu__menu-wrapper"
734
+ },
735
+ className: "component-menu",
736
+ children: n.children.map((e, i) => /* @__PURE__ */ y(jt, { item: e }, i))
737
+ }
738
+ )
739
+ ] });
740
+ }, jt = ({ item: n }) => {
741
+ switch (n.type) {
742
+ case "action":
743
+ return /* @__PURE__ */ y(Ie, { item: n });
744
+ case "toggle":
745
+ return /* @__PURE__ */ y($e, { item: n });
746
+ case "submenu":
747
+ return /* @__PURE__ */ y(Bt, { item: n });
748
+ case "separator":
749
+ return /* @__PURE__ */ y(ke, {});
750
+ }
751
+ };
752
+ export {
753
+ Dt as M,
754
+ Bt as S,
755
+ Vt as a,
756
+ Rt as b,
757
+ jt as c
758
+ };