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

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