@konstructio/ui 0.0.12-alpha.3 → 0.0.12-alpha.4

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