@konstructio/ui 0.0.12-alpha.1 → 0.0.12-alpha.10

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 (110) hide show
  1. package/dist/{Combination-BQYb0Gw7.js → Combination-b348x__d.js} +24 -24
  2. package/dist/Modal-B-E9uaA6.js +922 -0
  3. package/dist/components/Alert/Alert.js +58 -0
  4. package/dist/components/Alert/Alert.variants.js +77 -0
  5. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  6. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  7. package/dist/components/AlertDialog/components/index.js +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.variants.js +0 -1
  9. package/dist/components/Autocomplete/components/List/List.js +3 -3
  10. package/dist/components/Breadcrumb/Breadcrumb.js +3 -3
  11. package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
  12. package/dist/components/Breadcrumb/components/Item/Item.js +4 -4
  13. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  14. package/dist/components/Button/Button.js +1 -1
  15. package/dist/components/Card/Card.js +3 -3
  16. package/dist/components/Checkbox/Checkbox.js +5 -5
  17. package/dist/components/Command/Command.js +32 -0
  18. package/dist/components/Command/Command.variants.js +97 -0
  19. package/dist/components/Command/components/Command.js +8 -0
  20. package/dist/components/Command/components/CommandEmpty.js +15 -0
  21. package/dist/components/Command/components/CommandGroup.js +19 -0
  22. package/dist/components/Command/components/CommandInput.js +84 -0
  23. package/dist/components/Command/components/CommandItem.js +29 -0
  24. package/dist/components/Command/components/CommandList.js +16 -0
  25. package/dist/components/Command/components/CommandSeparator.js +16 -0
  26. package/dist/components/Command/components/CommandShortcut.js +19 -0
  27. package/dist/components/Command/components/DialogContent.js +31 -0
  28. package/dist/components/Command/components/DialogOverlay.js +19 -0
  29. package/dist/components/Command/components/index.js +20 -0
  30. package/dist/components/Command/contexts/Command.context.js +13 -0
  31. package/dist/components/Command/contexts/Command.provider.js +24 -0
  32. package/dist/components/Command/contexts/index.js +6 -0
  33. package/dist/components/Divider/Divider.js +10 -0
  34. package/dist/components/Divider/Divider.variants.js +14 -0
  35. package/dist/components/Dropdown/Dropdown.variants.js +22 -3
  36. package/dist/components/Dropdown/components/List/List.variants.js +4 -4
  37. package/dist/components/Dropdown/components/ListItem/ListItem.js +19 -18
  38. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
  39. package/dist/components/Dropdown/components/Wrapper.js +88 -57
  40. package/dist/components/Input/Input.js +112 -67
  41. package/dist/components/Input/Input.variants.js +5 -6
  42. package/dist/components/Loading/Loading.js +109 -0
  43. package/dist/components/Loading/Loading.variants.js +19 -0
  44. package/dist/components/Modal/Modal.js +3 -3
  45. package/dist/components/Modal/components/Body/Body.js +1 -1
  46. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  47. package/dist/components/Modal/components/Header/Header.js +1 -1
  48. package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -5
  49. package/dist/components/Modal/components/index.js +1 -1
  50. package/dist/components/NumberInput/NumberInput.js +1 -1
  51. package/dist/components/ProgressBar/ProgressBar.js +3 -3
  52. package/dist/components/Radio/Radio.js +4 -4
  53. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  54. package/dist/components/Range/Range.js +4 -4
  55. package/dist/components/Sidebar/Sidebar.variants.js +2 -1
  56. package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -15
  57. package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
  58. package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
  59. package/dist/components/Sidebar/components/Wrapper/Wrapper.js +3 -3
  60. package/dist/components/Slider/Slider.js +14 -14
  61. package/dist/components/Switch/Switch.js +17 -17
  62. package/dist/components/Tag/Tag.js +17 -5
  63. package/dist/components/Tag/Tag.variants.js +11 -1
  64. package/dist/components/TagSelect/TagSelect.js +6 -71
  65. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  66. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  67. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  68. package/dist/components/TagSelect/components/List/List.js +13 -0
  69. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  70. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  71. package/dist/components/TagSelect/components/index.js +8 -0
  72. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  73. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  74. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  75. package/dist/components/TagSelect/contexts/index.js +6 -0
  76. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  77. package/dist/components/TextArea/TextArea.js +28 -22
  78. package/dist/components/TextArea/TextArea.variants.js +0 -1
  79. package/dist/components/Toast/Toast.js +143 -130
  80. package/dist/components/Toast/Toast.variants.js +2 -3
  81. package/dist/components/Tooltip/Tooltip.js +4 -4
  82. package/dist/components/Typography/Typography.js +31 -0
  83. package/dist/components/Typography/Typography.variants.js +63 -0
  84. package/dist/components/index.js +61 -53
  85. package/dist/{index-BxeV34ij.js → index-4ecjw_Aj.js} +1 -1
  86. package/dist/index-B_6_jmOO.js +68 -0
  87. package/dist/{index-BBjak_0p.js → index-BbsJ0VIJ.js} +2 -2
  88. package/dist/{index-CJsYodgi.js → index-BzaHYXkt.js} +9 -9
  89. package/dist/{index-KEdwcThH.js → index-CbTU3cnP.js} +1 -1
  90. package/dist/{index-8vgf-x5i.js → index-Cva-e5M4.js} +2 -2
  91. package/dist/index-CzSBQN5S.js +432 -0
  92. package/dist/index-D7QNmo_D.js +422 -0
  93. package/dist/index-DUA6Y_AE.js +126 -0
  94. package/dist/{index-CoqDsznq.js → index-D_76wh4w.js} +3 -3
  95. package/dist/{index-D4Q2rMby.js → index-Dj1pom3_.js} +2 -2
  96. package/dist/index-DyKo5ZJT.js +446 -0
  97. package/dist/index.d.ts +61 -7
  98. package/dist/index.js +76 -68
  99. package/dist/package.json +36 -35
  100. package/dist/plugins/konstruct.js +34 -31
  101. package/dist/plugins/utils/animation.styles.js +162 -0
  102. package/dist/plugins/utils/index.js +7 -0
  103. package/dist/styles.css +1 -1
  104. package/dist/{useBreadcrumb-CojbXFVD.js → useBreadcrumb-BsIeMoR1.js} +47 -47
  105. package/dist/utils/index.js +320 -322
  106. package/package.json +36 -35
  107. package/dist/Modal-W2GbkC_F.js +0 -906
  108. package/dist/index-1GLoikpT.js +0 -19134
  109. package/dist/index-BVppSRDQ.js +0 -551
  110. package/dist/index-DoOsnuB6.js +0 -72
@@ -0,0 +1,922 @@
1
+ import { Body as Mr } from "./components/Modal/components/Body/Body.js";
2
+ import { Footer as _r } from "./components/Modal/components/Footer/Footer.js";
3
+ import { Header as kr } from "./components/Modal/components/Header/Header.js";
4
+ import { jsx as k, jsxs as ee } from "react/jsx-runtime";
5
+ import S, { createContext as Lr, forwardRef as Ue, useState as re, useRef as ne, useCallback as W, useEffect as Ge, useMemo as Rr, Fragment as Cr, PureComponent as Wr, Children as K, isValidElement as X } from "react";
6
+ import { r as Br } from "./index-D7QNmo_D.js";
7
+ import { R as Ur } from "./index-CbTU3cnP.js";
8
+ import { p as v } from "./index-C5psggHV.js";
9
+ import { c as le, a as Gr, u as Hr, R as jr } from "./Combination-b348x__d.js";
10
+ import { cn as Me } from "./utils/index.js";
11
+ import { buttonCloseVariants as Vr, modalVariants as qr } from "./components/Modal/components/Wrapper/Wrapper.variants.js";
12
+ import { X as $r } from "./x-DU-Zw-L_.js";
13
+ import { useTheme as Kr } from "./contexts/theme.hook.js";
14
+ function Xr(e, r) {
15
+ if (e == null) return {};
16
+ var n = {};
17
+ for (var t in e) if ({}.hasOwnProperty.call(e, t)) {
18
+ if (r.indexOf(t) !== -1) continue;
19
+ n[t] = e[t];
20
+ }
21
+ return n;
22
+ }
23
+ function U() {
24
+ return U = Object.assign ? Object.assign.bind() : function(e) {
25
+ for (var r = 1; r < arguments.length; r++) {
26
+ var n = arguments[r];
27
+ for (var t in n) ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
28
+ }
29
+ return e;
30
+ }, U.apply(null, arguments);
31
+ }
32
+ var ie = "data-focus-lock", He = "data-focus-lock-disabled", Yr = "data-no-focus-lock", zr = "data-autofocus-inside", Jr = "data-no-autofocus", te = {
33
+ width: "1px",
34
+ height: "0px",
35
+ padding: 0,
36
+ overflow: "hidden",
37
+ position: "fixed",
38
+ top: "1px",
39
+ left: "1px"
40
+ }, je = le({}, function(e) {
41
+ var r = e.target, n = e.currentTarget;
42
+ return {
43
+ target: r,
44
+ currentTarget: n
45
+ };
46
+ }), Ve = le(), Qr = le(), Zr = Gr({
47
+ async: !0,
48
+ ssr: typeof document < "u"
49
+ }), en = /* @__PURE__ */ Lr(void 0), rn = [], ve = /* @__PURE__ */ Ue(function(r, n) {
50
+ var t, o = re(), u = o[0], a = o[1], i = ne(), m = ne(!1), c = ne(null), d = re({}), s = d[1], f = r.children, p = r.disabled, l = p === void 0 ? !1 : p, b = r.noFocusGuards, g = b === void 0 ? !1 : b, x = r.persistentFocus, y = x === void 0 ? !1 : x, h = r.crossFrame, E = h === void 0 ? !0 : h, w = r.autoFocus, D = w === void 0 ? !0 : w, q = r.allowTextSelection, z = r.group, mr = r.className, br = r.whiteList, pr = r.hasPositiveIndices, Ie = r.shards, J = Ie === void 0 ? rn : Ie, Se = r.as, Ne = Se === void 0 ? "div" : Se, Te = r.lockProps, yr = Te === void 0 ? {} : Te, hr = r.sideCar, Pe = r.returnFocus, $ = Pe === void 0 ? !1 : Pe, gr = r.focusOptions, Q = r.onActivation, Z = r.onDeactivation, Fr = re({}), xr = Fr[0], Er = W(function(I) {
51
+ var M = I.captureFocusRestore;
52
+ if (!c.current) {
53
+ var _, T = (_ = document) == null ? void 0 : _.activeElement;
54
+ c.current = T, T !== document.body && (c.current = M(T));
55
+ }
56
+ i.current && Q && Q(i.current), m.current = !0, s();
57
+ }, [Q]), Or = W(function() {
58
+ m.current = !1, Z && Z(i.current), s();
59
+ }, [Z]), wr = W(function(I) {
60
+ var M = c.current;
61
+ if (M) {
62
+ var _ = (typeof M == "function" ? M() : M) || document.body, T = typeof $ == "function" ? $(_) : $;
63
+ if (T) {
64
+ var De = typeof T == "object" ? T : void 0;
65
+ c.current = null, I ? Promise.resolve().then(function() {
66
+ return _.focus(De);
67
+ }) : _.focus(De);
68
+ }
69
+ }
70
+ }, [$]), Ir = W(function(I) {
71
+ m.current && je.useMedium(I);
72
+ }, []), Sr = Ve.useMedium, Nr = W(function(I) {
73
+ i.current !== I && (i.current = I, a(I));
74
+ }, []);
75
+ process.env.NODE_ENV !== "production" && (typeof q < "u" && console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"), Ge(function() {
76
+ !i.current && typeof Ne != "string" && console.error("FocusLock: could not obtain ref to internal node");
77
+ }, []));
78
+ var Tr = U((t = {}, t[He] = l && "disabled", t[ie] = z, t), yr), Ae = g !== !0, Pr = Ae && g !== "tail", Ar = Hr([n, Nr]), Dr = Rr(function() {
79
+ return {
80
+ observed: i,
81
+ shards: J,
82
+ enabled: !l,
83
+ active: m.current
84
+ };
85
+ }, [l, m.current, J, u]);
86
+ return /* @__PURE__ */ S.createElement(Cr, null, Ae && [
87
+ /* @__PURE__ */ S.createElement("div", {
88
+ key: "guard-first",
89
+ "data-focus-guard": !0,
90
+ tabIndex: l ? -1 : 0,
91
+ style: te
92
+ }),
93
+ pr ? /* @__PURE__ */ S.createElement("div", {
94
+ key: "guard-nearest",
95
+ "data-focus-guard": !0,
96
+ tabIndex: l ? -1 : 1,
97
+ style: te
98
+ }) : null
99
+ ], !l && /* @__PURE__ */ S.createElement(hr, {
100
+ id: xr,
101
+ sideCar: Zr,
102
+ observed: u,
103
+ disabled: l,
104
+ persistentFocus: y,
105
+ crossFrame: E,
106
+ autoFocus: D,
107
+ whiteList: br,
108
+ shards: J,
109
+ onActivation: Er,
110
+ onDeactivation: Or,
111
+ returnFocus: wr,
112
+ focusOptions: gr,
113
+ noFocusGuards: g
114
+ }), /* @__PURE__ */ S.createElement(Ne, U({
115
+ ref: Ar
116
+ }, Tr, {
117
+ className: mr,
118
+ onBlur: Sr,
119
+ onFocus: Ir
120
+ }), /* @__PURE__ */ S.createElement(en.Provider, {
121
+ value: Dr
122
+ }, f)), Pr && /* @__PURE__ */ S.createElement("div", {
123
+ "data-focus-guard": !0,
124
+ tabIndex: l ? -1 : 0,
125
+ style: te
126
+ }));
127
+ });
128
+ ve.propTypes = process.env.NODE_ENV !== "production" ? {
129
+ children: v.node,
130
+ disabled: v.bool,
131
+ returnFocus: v.oneOfType([v.bool, v.object, v.func]),
132
+ focusOptions: v.object,
133
+ noFocusGuards: v.bool,
134
+ hasPositiveIndices: v.bool,
135
+ allowTextSelection: v.bool,
136
+ autoFocus: v.bool,
137
+ persistentFocus: v.bool,
138
+ crossFrame: v.bool,
139
+ group: v.string,
140
+ className: v.string,
141
+ whiteList: v.func,
142
+ shards: v.arrayOf(v.any),
143
+ as: v.oneOfType([v.string, v.func, v.object]),
144
+ lockProps: v.object,
145
+ onActivation: v.func,
146
+ onDeactivation: v.func,
147
+ sideCar: v.any.isRequired
148
+ } : {};
149
+ function ce(e, r) {
150
+ return ce = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, t) {
151
+ return n.__proto__ = t, n;
152
+ }, ce(e, r);
153
+ }
154
+ function nn(e, r) {
155
+ e.prototype = Object.create(r.prototype), e.prototype.constructor = e, ce(e, r);
156
+ }
157
+ function G(e) {
158
+ "@babel/helpers - typeof";
159
+ return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
160
+ return typeof r;
161
+ } : function(r) {
162
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
163
+ }, G(e);
164
+ }
165
+ function tn(e, r) {
166
+ if (G(e) != "object" || !e) return e;
167
+ var n = e[Symbol.toPrimitive];
168
+ if (n !== void 0) {
169
+ var t = n.call(e, r);
170
+ if (G(t) != "object") return t;
171
+ throw new TypeError("@@toPrimitive must return a primitive value.");
172
+ }
173
+ return (r === "string" ? String : Number)(e);
174
+ }
175
+ function on(e) {
176
+ var r = tn(e, "string");
177
+ return G(r) == "symbol" ? r : r + "";
178
+ }
179
+ function un(e, r, n) {
180
+ return (r = on(r)) in e ? Object.defineProperty(e, r, {
181
+ value: n,
182
+ enumerable: !0,
183
+ configurable: !0,
184
+ writable: !0
185
+ }) : e[r] = n, e;
186
+ }
187
+ function an(e, r) {
188
+ if (process.env.NODE_ENV !== "production") {
189
+ if (typeof e != "function")
190
+ throw new Error("Expected reducePropsToState to be a function.");
191
+ if (typeof r != "function")
192
+ throw new Error("Expected handleStateChangeOnClient to be a function.");
193
+ }
194
+ function n(t) {
195
+ return t.displayName || t.name || "Component";
196
+ }
197
+ return function(o) {
198
+ if (process.env.NODE_ENV !== "production" && typeof o != "function")
199
+ throw new Error("Expected WrappedComponent to be a React component.");
200
+ var u = [], a;
201
+ function i() {
202
+ a = e(u.map(function(c) {
203
+ return c.props;
204
+ })), r(a);
205
+ }
206
+ var m = /* @__PURE__ */ function(c) {
207
+ nn(d, c);
208
+ function d() {
209
+ return c.apply(this, arguments) || this;
210
+ }
211
+ d.peek = function() {
212
+ return a;
213
+ };
214
+ var s = d.prototype;
215
+ return s.componentDidMount = function() {
216
+ u.push(this), i();
217
+ }, s.componentDidUpdate = function() {
218
+ i();
219
+ }, s.componentWillUnmount = function() {
220
+ var p = u.indexOf(this);
221
+ u.splice(p, 1), i();
222
+ }, s.render = function() {
223
+ return /* @__PURE__ */ S.createElement(o, this.props);
224
+ }, d;
225
+ }(Wr);
226
+ return un(m, "displayName", "SideEffect(" + n(o) + ")"), m;
227
+ };
228
+ }
229
+ var O = function(e) {
230
+ for (var r = Array(e.length), n = 0; n < e.length; ++n)
231
+ r[n] = e[n];
232
+ return r;
233
+ }, A = function(e) {
234
+ return Array.isArray(e) ? e : [e];
235
+ }, qe = function(e) {
236
+ return Array.isArray(e) ? e[0] : e;
237
+ }, cn = function(e) {
238
+ if (e.nodeType !== Node.ELEMENT_NODE)
239
+ return !1;
240
+ var r = window.getComputedStyle(e, null);
241
+ return !r || !r.getPropertyValue ? !1 : r.getPropertyValue("display") === "none" || r.getPropertyValue("visibility") === "hidden";
242
+ }, $e = function(e) {
243
+ return e.parentNode && e.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? (
244
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
245
+ e.parentNode.host
246
+ ) : e.parentNode;
247
+ }, Ke = function(e) {
248
+ return e === document || e && e.nodeType === Node.DOCUMENT_NODE;
249
+ }, fn = function(e) {
250
+ return e.hasAttribute("inert");
251
+ }, sn = function(e, r) {
252
+ return !e || Ke(e) || !cn(e) && !fn(e) && r($e(e));
253
+ }, Xe = function(e, r) {
254
+ var n = e.get(r);
255
+ if (n !== void 0)
256
+ return n;
257
+ var t = sn(r, Xe.bind(void 0, e));
258
+ return e.set(r, t), t;
259
+ }, dn = function(e, r) {
260
+ return e && !Ke(e) ? mn(e) ? r($e(e)) : !1 : !0;
261
+ }, Ye = function(e, r) {
262
+ var n = e.get(r);
263
+ if (n !== void 0)
264
+ return n;
265
+ var t = dn(r, Ye.bind(void 0, e));
266
+ return e.set(r, t), t;
267
+ }, ze = function(e) {
268
+ return e.dataset;
269
+ }, ln = function(e) {
270
+ return e.tagName === "BUTTON";
271
+ }, Je = function(e) {
272
+ return e.tagName === "INPUT";
273
+ }, Qe = function(e) {
274
+ return Je(e) && e.type === "radio";
275
+ }, vn = function(e) {
276
+ return !((Je(e) || ln(e)) && (e.type === "hidden" || e.disabled));
277
+ }, mn = function(e) {
278
+ var r = e.getAttribute(Jr);
279
+ return ![!0, "true", ""].includes(r);
280
+ }, me = function(e) {
281
+ var r;
282
+ return !!(e && (!((r = ze(e)) === null || r === void 0) && r.focusGuard));
283
+ }, fe = function(e) {
284
+ return !me(e);
285
+ }, bn = function(e) {
286
+ return !!e;
287
+ }, pn = function(e, r) {
288
+ var n = Math.max(0, e.tabIndex), t = Math.max(0, r.tabIndex), o = n - t, u = e.index - r.index;
289
+ if (o) {
290
+ if (!n)
291
+ return 1;
292
+ if (!t)
293
+ return -1;
294
+ }
295
+ return o || u;
296
+ }, yn = function(e) {
297
+ return e.tabIndex < 0 && !e.hasAttribute("tabindex") ? 0 : e.tabIndex;
298
+ }, be = function(e, r, n) {
299
+ return O(e).map(function(t, o) {
300
+ var u = yn(t);
301
+ return {
302
+ node: t,
303
+ index: o,
304
+ tabIndex: n && u === -1 ? (t.dataset || {}).focusGuard ? 0 : -1 : u
305
+ };
306
+ }).filter(function(t) {
307
+ return !r || t.tabIndex >= 0;
308
+ }).sort(pn);
309
+ }, hn = [
310
+ "button:enabled",
311
+ "select:enabled",
312
+ "textarea:enabled",
313
+ "input:enabled",
314
+ // elements with explicit roles will also use explicit tabindex
315
+ // '[role="button"]',
316
+ "a[href]",
317
+ "area[href]",
318
+ "summary",
319
+ "iframe",
320
+ "object",
321
+ "embed",
322
+ "audio[controls]",
323
+ "video[controls]",
324
+ "[tabindex]",
325
+ "[contenteditable]",
326
+ "[autofocus]"
327
+ ], pe = hn.join(","), gn = "".concat(pe, ", [data-focus-guard]"), Ze = function(e, r) {
328
+ return O((e.shadowRoot || e).children).reduce(function(n, t) {
329
+ return n.concat(t.matches(r ? gn : pe) ? [t] : [], Ze(t));
330
+ }, []);
331
+ }, Fn = function(e, r) {
332
+ var n;
333
+ return e instanceof HTMLIFrameElement && (!((n = e.contentDocument) === null || n === void 0) && n.body) ? C([e.contentDocument.body], r) : [e];
334
+ }, C = function(e, r) {
335
+ return e.reduce(function(n, t) {
336
+ var o, u = Ze(t, r), a = (o = []).concat.apply(o, u.map(function(i) {
337
+ return Fn(i, r);
338
+ }));
339
+ return n.concat(
340
+ // add all tabbables inside and within shadow DOMs in DOM order
341
+ a,
342
+ // add if node is tabbable itself
343
+ t.parentNode ? O(t.parentNode.querySelectorAll(pe)).filter(function(i) {
344
+ return i === t;
345
+ }) : []
346
+ );
347
+ }, []);
348
+ }, xn = function(e) {
349
+ var r = e.querySelectorAll("[".concat(zr, "]"));
350
+ return O(r).map(function(n) {
351
+ return C([n]);
352
+ }).reduce(function(n, t) {
353
+ return n.concat(t);
354
+ }, []);
355
+ }, ye = function(e, r) {
356
+ return O(e).filter(function(n) {
357
+ return Xe(r, n);
358
+ }).filter(function(n) {
359
+ return vn(n);
360
+ });
361
+ }, _e = function(e, r) {
362
+ return r === void 0 && (r = /* @__PURE__ */ new Map()), O(e).filter(function(n) {
363
+ return Ye(r, n);
364
+ });
365
+ }, he = function(e, r, n) {
366
+ return be(ye(C(e, n), r), !0, n);
367
+ }, H = function(e, r) {
368
+ return be(ye(C(e), r), !1);
369
+ }, En = function(e, r) {
370
+ return ye(xn(e), r);
371
+ }, P = function(e, r) {
372
+ return e.shadowRoot ? P(e.shadowRoot, r) : Object.getPrototypeOf(e).contains !== void 0 && Object.getPrototypeOf(e).contains.call(e, r) ? !0 : O(e.children).some(function(n) {
373
+ var t;
374
+ if (n instanceof HTMLIFrameElement) {
375
+ var o = (t = n.contentDocument) === null || t === void 0 ? void 0 : t.body;
376
+ return o ? P(o, r) : !1;
377
+ }
378
+ return P(n, r);
379
+ });
380
+ }, On = function(e) {
381
+ for (var r = /* @__PURE__ */ new Set(), n = e.length, t = 0; t < n; t += 1)
382
+ for (var o = t + 1; o < n; o += 1) {
383
+ var u = e[t].compareDocumentPosition(e[o]);
384
+ (u & Node.DOCUMENT_POSITION_CONTAINED_BY) > 0 && r.add(o), (u & Node.DOCUMENT_POSITION_CONTAINS) > 0 && r.add(t);
385
+ }
386
+ return e.filter(function(a, i) {
387
+ return !r.has(i);
388
+ });
389
+ }, er = function(e) {
390
+ return e.parentNode ? er(e.parentNode) : e;
391
+ }, ge = function(e) {
392
+ var r = A(e);
393
+ return r.filter(Boolean).reduce(function(n, t) {
394
+ var o = t.getAttribute(ie);
395
+ return n.push.apply(n, o ? On(O(er(t).querySelectorAll("[".concat(ie, '="').concat(o, '"]:not([').concat(He, '="disabled"])')))) : [t]), n;
396
+ }, []);
397
+ }, wn = function(e) {
398
+ try {
399
+ return e();
400
+ } catch {
401
+ return;
402
+ }
403
+ }, j = function(e) {
404
+ if (e === void 0 && (e = document), !(!e || !e.activeElement)) {
405
+ var r = e.activeElement;
406
+ return r.shadowRoot ? j(r.shadowRoot) : r instanceof HTMLIFrameElement && wn(function() {
407
+ return r.contentWindow.document;
408
+ }) ? j(r.contentWindow.document) : r;
409
+ }
410
+ }, In = function(e, r) {
411
+ return e === r;
412
+ }, Sn = function(e, r) {
413
+ return !!O(e.querySelectorAll("iframe")).some(function(n) {
414
+ return In(n, r);
415
+ });
416
+ }, rr = function(e, r) {
417
+ return r === void 0 && (r = j(qe(e).ownerDocument)), !r || r.dataset && r.dataset.focusGuard ? !1 : ge(e).some(function(n) {
418
+ return P(n, r) || Sn(n, r);
419
+ });
420
+ }, Nn = function(e) {
421
+ e === void 0 && (e = document);
422
+ var r = j(e);
423
+ return r ? O(e.querySelectorAll("[".concat(Yr, "]"))).some(function(n) {
424
+ return P(n, r);
425
+ }) : !1;
426
+ }, Tn = function(e, r) {
427
+ return r.filter(Qe).filter(function(n) {
428
+ return n.name === e.name;
429
+ }).filter(function(n) {
430
+ return n.checked;
431
+ })[0] || e;
432
+ }, Fe = function(e, r) {
433
+ return Qe(e) && e.name ? Tn(e, r) : e;
434
+ }, Pn = function(e) {
435
+ var r = /* @__PURE__ */ new Set();
436
+ return e.forEach(function(n) {
437
+ return r.add(Fe(n, e));
438
+ }), e.filter(function(n) {
439
+ return r.has(n);
440
+ });
441
+ }, ke = function(e) {
442
+ return e[0] && e.length > 1 ? Fe(e[0], e) : e[0];
443
+ }, Le = function(e, r) {
444
+ return e.indexOf(Fe(r, e));
445
+ }, se = "NEW_FOCUS", An = function(e, r, n, t, o) {
446
+ var u = e.length, a = e[0], i = e[u - 1], m = me(t);
447
+ if (!(t && e.indexOf(t) >= 0)) {
448
+ var c = t !== void 0 ? n.indexOf(t) : -1, d = o ? n.indexOf(o) : c, s = o ? e.indexOf(o) : -1;
449
+ if (c === -1)
450
+ return s !== -1 ? s : se;
451
+ if (s === -1)
452
+ return se;
453
+ var f = c - d, p = n.indexOf(a), l = n.indexOf(i), b = Pn(n), g = t !== void 0 ? b.indexOf(t) : -1, x = o ? b.indexOf(o) : g, y = b.filter(function(z) {
454
+ return z.tabIndex >= 0;
455
+ }), h = t !== void 0 ? y.indexOf(t) : -1, E = o ? y.indexOf(o) : h, w = h >= 0 && E >= 0 ? (
456
+ // old/new are tabbables, measure distance in tabbable space
457
+ E - h
458
+ ) : (
459
+ // or else measure in focusable space
460
+ x - g
461
+ );
462
+ if (!f && s >= 0 || r.length === 0)
463
+ return s;
464
+ var D = Le(e, r[0]), q = Le(e, r[r.length - 1]);
465
+ if (c <= p && m && Math.abs(f) > 1)
466
+ return q;
467
+ if (c >= l && m && Math.abs(f) > 1)
468
+ return D;
469
+ if (f && Math.abs(w) > 1)
470
+ return s;
471
+ if (c <= p)
472
+ return q;
473
+ if (c > l)
474
+ return D;
475
+ if (f)
476
+ return Math.abs(f) > 1 ? s : (u + s + f) % u;
477
+ }
478
+ }, Dn = function(e) {
479
+ return function(r) {
480
+ var n, t = (n = ze(r)) === null || n === void 0 ? void 0 : n.autofocus;
481
+ return (
482
+ // @ts-expect-error
483
+ r.autofocus || //
484
+ t !== void 0 && t !== "false" || //
485
+ e.indexOf(r) >= 0
486
+ );
487
+ };
488
+ }, Re = function(e, r, n) {
489
+ var t = e.map(function(u) {
490
+ var a = u.node;
491
+ return a;
492
+ }), o = _e(t.filter(Dn(n)));
493
+ return o && o.length ? ke(o) : ke(_e(r));
494
+ }, de = function(e, r) {
495
+ return r === void 0 && (r = []), r.push(e), e.parentNode && de(e.parentNode.host || e.parentNode, r), r;
496
+ }, oe = function(e, r) {
497
+ for (var n = de(e), t = de(r), o = 0; o < n.length; o += 1) {
498
+ var u = n[o];
499
+ if (t.indexOf(u) >= 0)
500
+ return u;
501
+ }
502
+ return !1;
503
+ }, nr = function(e, r, n) {
504
+ var t = A(e), o = A(r), u = t[0], a = !1;
505
+ return o.filter(Boolean).forEach(function(i) {
506
+ a = oe(a || i, i) || a, n.filter(Boolean).forEach(function(m) {
507
+ var c = oe(u, m);
508
+ c && (!a || P(c, a) ? a = c : a = oe(c, a));
509
+ });
510
+ }), a;
511
+ }, Ce = function(e, r) {
512
+ return e.reduce(function(n, t) {
513
+ return n.concat(En(t, r));
514
+ }, []);
515
+ }, Mn = function(e, r) {
516
+ var n = /* @__PURE__ */ new Map();
517
+ return r.forEach(function(t) {
518
+ return n.set(t.node, t);
519
+ }), e.map(function(t) {
520
+ return n.get(t);
521
+ }).filter(bn);
522
+ }, _n = function(e, r) {
523
+ var n = j(A(e).length > 0 ? document : qe(e).ownerDocument), t = ge(e).filter(fe), o = nr(n || e, e, t), u = /* @__PURE__ */ new Map(), a = H(t, u), i = a.filter(function(l) {
524
+ var b = l.node;
525
+ return fe(b);
526
+ });
527
+ if (i[0]) {
528
+ var m = H([o], u).map(function(l) {
529
+ var b = l.node;
530
+ return b;
531
+ }), c = Mn(m, i), d = c.map(function(l) {
532
+ var b = l.node;
533
+ return b;
534
+ }), s = c.filter(function(l) {
535
+ var b = l.tabIndex;
536
+ return b >= 0;
537
+ }).map(function(l) {
538
+ var b = l.node;
539
+ return b;
540
+ }), f = An(d, s, m, n, r);
541
+ if (f === se) {
542
+ var p = (
543
+ // first try only tabbable, and the fallback to all focusable, as long as at least one element should be picked for focus
544
+ Re(a, s, Ce(t, u)) || Re(a, d, Ce(t, u))
545
+ );
546
+ if (p)
547
+ return { node: p };
548
+ console.warn("focus-lock: cannot find any node to move focus into");
549
+ return;
550
+ }
551
+ return f === void 0 ? f : c[f];
552
+ }
553
+ }, kn = function(e) {
554
+ var r = ge(e).filter(fe), n = nr(e, e, r), t = be(C([n], !0), !0, !0), o = C(r, !1);
555
+ return t.map(function(u) {
556
+ var a = u.node, i = u.index;
557
+ return {
558
+ node: a,
559
+ index: i,
560
+ lockItem: o.indexOf(a) >= 0,
561
+ guard: me(a)
562
+ };
563
+ });
564
+ }, xe = function(e, r) {
565
+ e && ("focus" in e && e.focus(r), "contentWindow" in e && e.contentWindow && e.contentWindow.focus());
566
+ }, ue = 0, ae = !1, tr = function(e, r, n) {
567
+ n === void 0 && (n = {});
568
+ var t = _n(e, r);
569
+ if (!ae && t) {
570
+ if (ue > 2) {
571
+ console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"), ae = !0, setTimeout(function() {
572
+ ae = !1;
573
+ }, 1);
574
+ return;
575
+ }
576
+ ue++, xe(t.node, n.focusOptions), ue--;
577
+ }
578
+ };
579
+ function B(e) {
580
+ if (!e)
581
+ return null;
582
+ if (typeof WeakRef > "u")
583
+ return function() {
584
+ return e || null;
585
+ };
586
+ var r = e ? new WeakRef(e) : null;
587
+ return function() {
588
+ return (r == null ? void 0 : r.deref()) || null;
589
+ };
590
+ }
591
+ var Ln = function(e) {
592
+ if (!e)
593
+ return null;
594
+ for (var r = [], n = e; n && n !== document.body; )
595
+ r.push({
596
+ current: B(n),
597
+ parent: B(n.parentElement),
598
+ left: B(n.previousElementSibling),
599
+ right: B(n.nextElementSibling)
600
+ }), n = n.parentElement;
601
+ return {
602
+ element: B(e),
603
+ stack: r,
604
+ ownerDocument: e.ownerDocument
605
+ };
606
+ }, Rn = function(e) {
607
+ var r, n, t, o, u;
608
+ if (e)
609
+ for (var a = e.stack, i = e.ownerDocument, m = /* @__PURE__ */ new Map(), c = 0, d = a; c < d.length; c++) {
610
+ var s = d[c], f = (r = s.parent) === null || r === void 0 ? void 0 : r.call(s);
611
+ if (f && i.contains(f)) {
612
+ for (var p = (n = s.left) === null || n === void 0 ? void 0 : n.call(s), l = s.current(), b = f.contains(l) ? l : void 0, g = (t = s.right) === null || t === void 0 ? void 0 : t.call(s), x = he([f], m), y = (
613
+ // that is element itself
614
+ (u = (o = b ?? // or something in it's place
615
+ (p == null ? void 0 : p.nextElementSibling)) !== null && o !== void 0 ? o : (
616
+ // or somebody to the right, still close enough
617
+ g
618
+ )) !== null && u !== void 0 ? u : (
619
+ // or somebody to the left, something?
620
+ p
621
+ )
622
+ ); y; ) {
623
+ for (var h = 0, E = x; h < E.length; h++) {
624
+ var w = E[h];
625
+ if (y != null && y.contains(w.node))
626
+ return w.node;
627
+ }
628
+ y = y.nextElementSibling;
629
+ }
630
+ if (x.length)
631
+ return x[0].node;
632
+ }
633
+ }
634
+ }, or = function(e) {
635
+ var r = Ln(e);
636
+ return function() {
637
+ return Rn(r);
638
+ };
639
+ }, Cn = function(e, r, n) {
640
+ if (!e || !r)
641
+ return console.error("no element or scope given"), {};
642
+ var t = A(r);
643
+ if (t.every(function(a) {
644
+ return !P(a, e);
645
+ }))
646
+ return console.error("Active element is not contained in the scope"), {};
647
+ var o = n ? he(t, /* @__PURE__ */ new Map()) : H(t, /* @__PURE__ */ new Map()), u = o.findIndex(function(a) {
648
+ var i = a.node;
649
+ return i === e;
650
+ });
651
+ if (u !== -1)
652
+ return {
653
+ prev: o[u - 1],
654
+ next: o[u + 1],
655
+ first: o[0],
656
+ last: o[o.length - 1]
657
+ };
658
+ }, Wn = function(e, r) {
659
+ var n = r ? he(A(e), /* @__PURE__ */ new Map()) : H(A(e), /* @__PURE__ */ new Map());
660
+ return {
661
+ first: n[0],
662
+ last: n[n.length - 1]
663
+ };
664
+ }, Bn = function(e) {
665
+ return Object.assign({
666
+ scope: document.body,
667
+ cycle: !0,
668
+ onlyTabbable: !0
669
+ }, e);
670
+ }, ur = function(e, r, n) {
671
+ r === void 0 && (r = {});
672
+ var t = Bn(r), o = Cn(e, t.scope, t.onlyTabbable);
673
+ if (o) {
674
+ var u = n(o, t.cycle);
675
+ u && xe(u.node, t.focusOptions);
676
+ }
677
+ }, Un = function(e, r) {
678
+ r === void 0 && (r = {}), ur(e, r, function(n, t) {
679
+ var o = n.next, u = n.first;
680
+ return o || t && u;
681
+ });
682
+ }, Gn = function(e, r) {
683
+ r === void 0 && (r = {}), ur(e, r, function(n, t) {
684
+ var o = n.prev, u = n.last;
685
+ return o || t && u;
686
+ });
687
+ }, ar = function(e, r, n) {
688
+ var t, o = Wn(e, (t = r.onlyTabbable) !== null && t !== void 0 ? t : !0), u = o[n];
689
+ u && xe(u.node, r.focusOptions);
690
+ }, Hn = function(e, r) {
691
+ r === void 0 && (r = {}), ar(e, r, "first");
692
+ }, jn = function(e, r) {
693
+ r === void 0 && (r = {}), ar(e, r, "last");
694
+ };
695
+ function Ee(e) {
696
+ setTimeout(e, 1);
697
+ }
698
+ var Vn = function(r) {
699
+ return r && "current" in r ? r.current : r;
700
+ }, ir = function() {
701
+ return document && document.activeElement === document.body;
702
+ }, qn = function() {
703
+ return ir() || Nn();
704
+ }, L = null, F = null, We = function() {
705
+ return null;
706
+ }, R = null, V = !1, Oe = !1, $n = function() {
707
+ return !0;
708
+ }, Kn = function(r) {
709
+ return (L.whiteList || $n)(r);
710
+ }, Xn = function(r, n) {
711
+ R = {
712
+ observerNode: r,
713
+ portaledElement: n
714
+ };
715
+ }, Yn = function(r) {
716
+ return R && R.portaledElement === r;
717
+ };
718
+ function Be(e, r, n, t) {
719
+ var o = null, u = e;
720
+ do {
721
+ var a = t[u];
722
+ if (a.guard)
723
+ a.node.dataset.focusAutoGuard && (o = a);
724
+ else if (a.lockItem) {
725
+ if (u !== e)
726
+ return;
727
+ o = null;
728
+ } else
729
+ break;
730
+ } while ((u += n) !== r);
731
+ o && (o.node.tabIndex = 0);
732
+ }
733
+ var zn = function(r) {
734
+ return r ? !!V : V === "meanwhile";
735
+ }, Jn = function e(r, n, t) {
736
+ return n && (n.host === r && (!n.activeElement || t.contains(n.activeElement)) || n.parentNode && e(r, n.parentNode, t));
737
+ }, Qn = function(r, n) {
738
+ return n.some(function(t) {
739
+ return Jn(r, t, t);
740
+ });
741
+ }, cr = function(r) {
742
+ return H(r, /* @__PURE__ */ new Map());
743
+ }, Zn = function(r) {
744
+ return !cr([r.parentNode]).some(function(n) {
745
+ return n.node === r;
746
+ });
747
+ }, Y = function() {
748
+ var r = !1;
749
+ if (L) {
750
+ var n = L, t = n.observed, o = n.persistentFocus, u = n.autoFocus, a = n.shards, i = n.crossFrame, m = n.focusOptions, c = n.noFocusGuards, d = t || R && R.portaledElement;
751
+ if (ir() && F && F !== document.body && (!document.body.contains(F) || Zn(F))) {
752
+ var s = We();
753
+ s && s.focus();
754
+ }
755
+ var f = document && document.activeElement;
756
+ if (d) {
757
+ var p = [d].concat(a.map(Vn).filter(Boolean)), l = function() {
758
+ if (!zn(i) || !c || !F || Oe)
759
+ return !1;
760
+ var h = cr(p), E = h.findIndex(function(w) {
761
+ var D = w.node;
762
+ return D === F;
763
+ });
764
+ return E === 0 || E === h.length - 1;
765
+ };
766
+ if ((!f || Kn(f)) && (o || l() || !qn() || !F && u) && (d && !(rr(p) || f && Qn(f, p) || Yn(f)) && (document && !F && f && !u ? (f.blur && f.blur(), document.body.focus()) : (r = tr(p, F, {
767
+ focusOptions: m
768
+ }), R = {})), F = document && document.activeElement, F !== document.body && (We = or(F)), V = !1), document && f !== document.activeElement && document.querySelector("[data-focus-auto-guard]")) {
769
+ var b = document && document.activeElement, g = kn(p), x = g.map(function(y) {
770
+ var h = y.node;
771
+ return h;
772
+ }).indexOf(b);
773
+ x > -1 && (g.filter(function(y) {
774
+ var h = y.guard, E = y.node;
775
+ return h && E.dataset.focusAutoGuard;
776
+ }).forEach(function(y) {
777
+ var h = y.node;
778
+ return h.removeAttribute("tabIndex");
779
+ }), Be(x, g.length, 1, g), Be(x, -1, -1, g));
780
+ }
781
+ }
782
+ }
783
+ return r;
784
+ }, fr = function(r) {
785
+ Y() && r && (r.stopPropagation(), r.preventDefault());
786
+ }, we = function() {
787
+ return Ee(Y);
788
+ }, et = function(r) {
789
+ var n = r.target, t = r.currentTarget;
790
+ t.contains(n) || Xn(t, n);
791
+ }, rt = function() {
792
+ return null;
793
+ }, sr = function() {
794
+ Oe = !0;
795
+ }, dr = function() {
796
+ Oe = !1, V = "just", Ee(function() {
797
+ V = "meanwhile";
798
+ });
799
+ }, nt = function() {
800
+ document.addEventListener("focusin", fr), document.addEventListener("focusout", we), window.addEventListener("focus", sr), window.addEventListener("blur", dr);
801
+ }, tt = function() {
802
+ document.removeEventListener("focusin", fr), document.removeEventListener("focusout", we), window.removeEventListener("focus", sr), window.removeEventListener("blur", dr);
803
+ };
804
+ function ot(e) {
805
+ return e.filter(function(r) {
806
+ var n = r.disabled;
807
+ return !n;
808
+ });
809
+ }
810
+ var lr = {
811
+ moveFocusInside: tr,
812
+ focusInside: rr,
813
+ focusNextElement: Un,
814
+ focusPrevElement: Gn,
815
+ focusFirstElement: Hn,
816
+ focusLastElement: jn,
817
+ captureFocusRestore: or
818
+ };
819
+ function ut(e) {
820
+ var r = e.slice(-1)[0];
821
+ r && !L && nt();
822
+ var n = L, t = n && r && r.id === n.id;
823
+ L = r, n && !t && (n.onDeactivation(), e.filter(function(o) {
824
+ var u = o.id;
825
+ return u === n.id;
826
+ }).length || n.returnFocus(!r)), r ? (F = null, (!t || n.observed !== r.observed) && r.onActivation(lr), Y(), Ee(Y)) : (tt(), F = null);
827
+ }
828
+ je.assignSyncMedium(et);
829
+ Ve.assignMedium(we);
830
+ Qr.assignMedium(function(e) {
831
+ return e(lr);
832
+ });
833
+ const at = an(ot, ut)(rt);
834
+ var vr = /* @__PURE__ */ Ue(function(r, n) {
835
+ return /* @__PURE__ */ S.createElement(ve, U({
836
+ sideCar: at,
837
+ ref: n
838
+ }, r));
839
+ }), it = ve.propTypes || {}, ct = Xr(it, ["sideCar"]);
840
+ vr.propTypes = process.env.NODE_ENV !== "production" ? ct : {};
841
+ const ft = ({
842
+ children: e,
843
+ theme: r,
844
+ className: n,
845
+ buttonCloseClassName: t,
846
+ onClose: o
847
+ }) => {
848
+ const { theme: u } = Kr(), a = K.toArray(e).find(
849
+ (d) => X(d) && d.type === N.Header
850
+ ), i = K.toArray(e).find(
851
+ (d) => X(d) && d.type === N.Body
852
+ ), m = K.toArray(e).find(
853
+ (d) => X(d) && d.type === N.Footer
854
+ ), c = K.toArray(e).filter(
855
+ (d) => !X(d) || ![N.Header, N.Body, N.Footer].includes(
856
+ d.type
857
+ )
858
+ );
859
+ return /* @__PURE__ */ k(vr, { returnFocus: !0, children: /* @__PURE__ */ k(jr, { children: /* @__PURE__ */ ee("div", { className: "fixed inset-0 grid place-content-center", children: [
860
+ /* @__PURE__ */ k(
861
+ "div",
862
+ {
863
+ className: "absolute inset-0 bg-black opacity-75",
864
+ onClick: o,
865
+ role: "presentation"
866
+ }
867
+ ),
868
+ /* @__PURE__ */ ee(
869
+ "div",
870
+ {
871
+ className: Me(
872
+ qr({
873
+ className: n,
874
+ theme: r ?? u
875
+ })
876
+ ),
877
+ role: "dialog",
878
+ "aria-modal": "true",
879
+ children: [
880
+ a,
881
+ /* @__PURE__ */ ee(
882
+ "button",
883
+ {
884
+ className: Me(
885
+ Vr({
886
+ className: t,
887
+ theme: r ?? u
888
+ })
889
+ ),
890
+ onClick: o,
891
+ children: [
892
+ /* @__PURE__ */ k($r, {}),
893
+ /* @__PURE__ */ k(Ur, { children: "Dismiss modal" })
894
+ ]
895
+ }
896
+ ),
897
+ i ?? c,
898
+ m
899
+ ]
900
+ }
901
+ )
902
+ ] }) }) });
903
+ }, N = ({ isOpen: e, onClose: r, ...n }) => (Ge(() => {
904
+ const t = new AbortController(), o = (u) => {
905
+ u.code === "Escape" && (r == null || r());
906
+ };
907
+ return window.addEventListener("keydown", o, {
908
+ signal: t.signal
909
+ }), () => {
910
+ t.abort();
911
+ };
912
+ }, [r]), e ? Br.createPortal(
913
+ /* @__PURE__ */ k(ft, { ...n, onClose: r }),
914
+ document.body
915
+ ) : null);
916
+ N.Header = kr;
917
+ N.Body = Mr;
918
+ N.Footer = _r;
919
+ export {
920
+ N as M,
921
+ ft as W
922
+ };