@ogcio/design-system-react 1.15.0 → 1.15.2

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,62 +1,62 @@
1
- import { useEffect as he } from "react";
1
+ import { useLayoutEffect as he } from "react";
2
2
  /*!
3
3
  * tabbable 6.2.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
5
  */
6
- var ue = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], K = /* @__PURE__ */ ue.join(","), se = typeof Element > "u", R = se ? function() {
7
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, j = !se && Element.prototype.getRootNode ? function(a) {
6
+ var oe = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], K = /* @__PURE__ */ oe.join(","), ce = typeof Element > "u", R = ce ? function() {
7
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, j = !ce && Element.prototype.getRootNode ? function(r) {
8
8
  var e;
9
- return a == null || (e = a.getRootNode) === null || e === void 0 ? void 0 : e.call(a);
10
- } : function(a) {
11
- return a == null ? void 0 : a.ownerDocument;
12
- }, M = function a(e, t) {
13
- var r;
9
+ return r == null || (e = r.getRootNode) === null || e === void 0 ? void 0 : e.call(r);
10
+ } : function(r) {
11
+ return r == null ? void 0 : r.ownerDocument;
12
+ }, M = function r(e, t) {
13
+ var a;
14
14
  t === void 0 && (t = !0);
15
- var u = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), s = u === "" || u === "true", i = s || t && e && a(e.parentNode);
15
+ var o = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), c = o === "" || o === "true", i = c || t && e && r(e.parentNode);
16
16
  return i;
17
- }, pe = function(e) {
18
- var t, r = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
19
- return r === "" || r === "true";
20
- }, le = function(e, t, r) {
17
+ }, ye = function(e) {
18
+ var t, a = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
19
+ return a === "" || a === "true";
20
+ }, le = function(e, t, a) {
21
21
  if (M(e))
22
22
  return [];
23
- var u = Array.prototype.slice.apply(e.querySelectorAll(K));
24
- return t && R.call(e, K) && u.unshift(e), u = u.filter(r), u;
25
- }, ce = function a(e, t, r) {
26
- for (var u = [], s = Array.from(e); s.length; ) {
27
- var i = s.shift();
23
+ var o = Array.prototype.slice.apply(e.querySelectorAll(K));
24
+ return t && R.call(e, K) && o.unshift(e), o = o.filter(a), o;
25
+ }, se = function r(e, t, a) {
26
+ for (var o = [], c = Array.from(e); c.length; ) {
27
+ var i = c.shift();
28
28
  if (!M(i, !1))
29
29
  if (i.tagName === "SLOT") {
30
- var b = i.assignedElements(), v = b.length ? b : i.children, y = a(v, !0, r);
31
- r.flatten ? u.push.apply(u, y) : u.push({
30
+ var b = i.assignedElements(), v = b.length ? b : i.children, p = r(v, !0, a);
31
+ a.flatten ? o.push.apply(o, p) : o.push({
32
32
  scopeParent: i,
33
- candidates: y
33
+ candidates: p
34
34
  });
35
35
  } else {
36
36
  var T = R.call(i, K);
37
- T && r.filter(i) && (t || !e.includes(i)) && u.push(i);
37
+ T && a.filter(i) && (t || !e.includes(i)) && o.push(i);
38
38
  var w = i.shadowRoot || // check for an undisclosed shadow
39
- typeof r.getShadowRoot == "function" && r.getShadowRoot(i), E = !M(w, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
39
+ typeof a.getShadowRoot == "function" && a.getShadowRoot(i), E = !M(w, !1) && (!a.shadowRootFilter || a.shadowRootFilter(i));
40
40
  if (w && E) {
41
- var D = a(w === !0 ? i.children : w.children, !0, r);
42
- r.flatten ? u.push.apply(u, D) : u.push({
41
+ var D = r(w === !0 ? i.children : w.children, !0, a);
42
+ a.flatten ? o.push.apply(o, D) : o.push({
43
43
  scopeParent: i,
44
44
  candidates: D
45
45
  });
46
46
  } else
47
- s.unshift.apply(s, i.children);
47
+ c.unshift.apply(c, i.children);
48
48
  }
49
49
  }
50
- return u;
50
+ return o;
51
51
  }, fe = function(e) {
52
52
  return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
53
53
  }, k = function(e) {
54
54
  if (!e)
55
55
  throw new Error("No node provided");
56
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || pe(e)) && !fe(e) ? 0 : e.tabIndex;
57
- }, ye = function(e, t) {
58
- var r = k(e);
59
- return r < 0 && t && !fe(e) ? 0 : r;
56
+ return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || ye(e)) && !fe(e) ? 0 : e.tabIndex;
57
+ }, pe = function(e, t) {
58
+ var a = k(e);
59
+ return a < 0 && t && !fe(e) ? 0 : a;
60
60
  }, ge = function(e, t) {
61
61
  return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
62
62
  }, de = function(e) {
@@ -64,79 +64,79 @@ var ue = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
64
64
  }, me = function(e) {
65
65
  return de(e) && e.type === "hidden";
66
66
  }, we = function(e) {
67
- var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
68
- return r.tagName === "SUMMARY";
67
+ var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
68
+ return a.tagName === "SUMMARY";
69
69
  });
70
70
  return t;
71
71
  }, Te = function(e, t) {
72
- for (var r = 0; r < e.length; r++)
73
- if (e[r].checked && e[r].form === t)
74
- return e[r];
72
+ for (var a = 0; a < e.length; a++)
73
+ if (e[a].checked && e[a].form === t)
74
+ return e[a];
75
75
  }, Ne = function(e) {
76
76
  if (!e.name)
77
77
  return !0;
78
- var t = e.form || j(e), r = function(b) {
78
+ var t = e.form || j(e), a = function(b) {
79
79
  return t.querySelectorAll('input[type="radio"][name="' + b + '"]');
80
- }, u;
80
+ }, o;
81
81
  if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
82
- u = r(window.CSS.escape(e.name));
82
+ o = a(window.CSS.escape(e.name));
83
83
  else
84
84
  try {
85
- u = r(e.name);
85
+ o = a(e.name);
86
86
  } catch (i) {
87
87
  return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
88
88
  }
89
- var s = Te(u, e.form);
90
- return !s || s === e;
89
+ var c = Te(o, e.form);
90
+ return !c || c === e;
91
91
  }, Fe = function(e) {
92
92
  return de(e) && e.type === "radio";
93
93
  }, Ee = function(e) {
94
94
  return Fe(e) && !Ne(e);
95
95
  }, Se = function(e) {
96
- var t, r = e && j(e), u = (t = r) === null || t === void 0 ? void 0 : t.host, s = !1;
97
- if (r && r !== e) {
96
+ var t, a = e && j(e), o = (t = a) === null || t === void 0 ? void 0 : t.host, c = !1;
97
+ if (a && a !== e) {
98
98
  var i, b, v;
99
- for (s = !!((i = u) !== null && i !== void 0 && (b = i.ownerDocument) !== null && b !== void 0 && b.contains(u) || e != null && (v = e.ownerDocument) !== null && v !== void 0 && v.contains(e)); !s && u; ) {
100
- var y, T, w;
101
- r = j(u), u = (y = r) === null || y === void 0 ? void 0 : y.host, s = !!((T = u) !== null && T !== void 0 && (w = T.ownerDocument) !== null && w !== void 0 && w.contains(u));
99
+ for (c = !!((i = o) !== null && i !== void 0 && (b = i.ownerDocument) !== null && b !== void 0 && b.contains(o) || e != null && (v = e.ownerDocument) !== null && v !== void 0 && v.contains(e)); !c && o; ) {
100
+ var p, T, w;
101
+ a = j(o), o = (p = a) === null || p === void 0 ? void 0 : p.host, c = !!((T = o) !== null && T !== void 0 && (w = T.ownerDocument) !== null && w !== void 0 && w.contains(o));
102
102
  }
103
103
  }
104
- return s;
105
- }, re = function(e) {
106
- var t = e.getBoundingClientRect(), r = t.width, u = t.height;
107
- return r === 0 && u === 0;
104
+ return c;
105
+ }, ae = function(e) {
106
+ var t = e.getBoundingClientRect(), a = t.width, o = t.height;
107
+ return a === 0 && o === 0;
108
108
  }, ke = function(e, t) {
109
- var r = t.displayCheck, u = t.getShadowRoot;
109
+ var a = t.displayCheck, o = t.getShadowRoot;
110
110
  if (getComputedStyle(e).visibility === "hidden")
111
111
  return !0;
112
- var s = R.call(e, "details>summary:first-of-type"), i = s ? e.parentElement : e;
112
+ var c = R.call(e, "details>summary:first-of-type"), i = c ? e.parentElement : e;
113
113
  if (R.call(i, "details:not([open]) *"))
114
114
  return !0;
115
- if (!r || r === "full" || r === "legacy-full") {
116
- if (typeof u == "function") {
115
+ if (!a || a === "full" || a === "legacy-full") {
116
+ if (typeof o == "function") {
117
117
  for (var b = e; e; ) {
118
- var v = e.parentElement, y = j(e);
119
- if (v && !v.shadowRoot && u(v) === !0)
120
- return re(e);
121
- e.assignedSlot ? e = e.assignedSlot : !v && y !== e.ownerDocument ? e = y.host : e = v;
118
+ var v = e.parentElement, p = j(e);
119
+ if (v && !v.shadowRoot && o(v) === !0)
120
+ return ae(e);
121
+ e.assignedSlot ? e = e.assignedSlot : !v && p !== e.ownerDocument ? e = p.host : e = v;
122
122
  }
123
123
  e = b;
124
124
  }
125
125
  if (Se(e))
126
126
  return !e.getClientRects().length;
127
- if (r !== "legacy-full")
127
+ if (a !== "legacy-full")
128
128
  return !0;
129
- } else if (r === "non-zero-area")
130
- return re(e);
129
+ } else if (a === "non-zero-area")
130
+ return ae(e);
131
131
  return !1;
132
132
  }, Re = function(e) {
133
133
  if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
134
134
  for (var t = e.parentElement; t; ) {
135
135
  if (t.tagName === "FIELDSET" && t.disabled) {
136
- for (var r = 0; r < t.children.length; r++) {
137
- var u = t.children.item(r);
138
- if (u.tagName === "LEGEND")
139
- return R.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
136
+ for (var a = 0; a < t.children.length; a++) {
137
+ var o = t.children.item(a);
138
+ if (o.tagName === "LEGEND")
139
+ return R.call(t, "fieldset[disabled] *") ? !0 : !o.contains(e);
140
140
  }
141
141
  return !0;
142
142
  }
@@ -154,130 +154,130 @@ var ue = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
154
154
  }, De = function(e) {
155
155
  var t = parseInt(e.getAttribute("tabindex"), 10);
156
156
  return !!(isNaN(t) || t >= 0);
157
- }, Ie = function a(e) {
158
- var t = [], r = [];
159
- return e.forEach(function(u, s) {
160
- var i = !!u.scopeParent, b = i ? u.scopeParent : u, v = ye(b, i), y = i ? a(u.candidates) : b;
161
- v === 0 ? i ? t.push.apply(t, y) : t.push(b) : r.push({
162
- documentOrder: s,
157
+ }, Ie = function r(e) {
158
+ var t = [], a = [];
159
+ return e.forEach(function(o, c) {
160
+ var i = !!o.scopeParent, b = i ? o.scopeParent : o, v = pe(b, i), p = i ? r(o.candidates) : b;
161
+ v === 0 ? i ? t.push.apply(t, p) : t.push(b) : a.push({
162
+ documentOrder: c,
163
163
  tabIndex: v,
164
- item: u,
164
+ item: o,
165
165
  isScope: i,
166
- content: y
166
+ content: p
167
167
  });
168
- }), r.sort(ge).reduce(function(u, s) {
169
- return s.isScope ? u.push.apply(u, s.content) : u.push(s.content), u;
168
+ }), a.sort(ge).reduce(function(o, c) {
169
+ return c.isScope ? o.push.apply(o, c.content) : o.push(c.content), o;
170
170
  }, []).concat(t);
171
171
  }, Ae = function(e, t) {
172
172
  t = t || {};
173
- var r;
174
- return t.getShadowRoot ? r = ce([e], t.includeContainer, {
173
+ var a;
174
+ return t.getShadowRoot ? a = se([e], t.includeContainer, {
175
175
  filter: U.bind(null, t),
176
176
  flatten: !1,
177
177
  getShadowRoot: t.getShadowRoot,
178
178
  shadowRootFilter: De
179
- }) : r = le(e, t.includeContainer, U.bind(null, t)), Ie(r);
180
- }, Pe = function(e, t) {
179
+ }) : a = le(e, t.includeContainer, U.bind(null, t)), Ie(a);
180
+ }, Oe = function(e, t) {
181
181
  t = t || {};
182
- var r;
183
- return t.getShadowRoot ? r = ce([e], t.includeContainer, {
182
+ var a;
183
+ return t.getShadowRoot ? a = se([e], t.includeContainer, {
184
184
  filter: G.bind(null, t),
185
185
  flatten: !0,
186
186
  getShadowRoot: t.getShadowRoot
187
- }) : r = le(e, t.includeContainer, G.bind(null, t)), r;
187
+ }) : a = le(e, t.includeContainer, G.bind(null, t)), a;
188
188
  }, I = function(e, t) {
189
189
  if (t = t || {}, !e)
190
190
  throw new Error("No node provided");
191
191
  return R.call(e, K) === !1 ? !1 : U(t, e);
192
- }, Oe = /* @__PURE__ */ ue.concat("iframe").join(","), $ = function(e, t) {
192
+ }, Pe = /* @__PURE__ */ oe.concat("iframe").join(","), $ = function(e, t) {
193
193
  if (t = t || {}, !e)
194
194
  throw new Error("No node provided");
195
- return R.call(e, Oe) === !1 ? !1 : G(t, e);
195
+ return R.call(e, Pe) === !1 ? !1 : G(t, e);
196
196
  };
197
197
  /*!
198
198
  * focus-trap 7.6.5
199
199
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
200
200
  */
201
- function W(a, e) {
202
- (e == null || e > a.length) && (e = a.length);
203
- for (var t = 0, r = Array(e); t < e; t++) r[t] = a[t];
204
- return r;
201
+ function W(r, e) {
202
+ (e == null || e > r.length) && (e = r.length);
203
+ for (var t = 0, a = Array(e); t < e; t++) a[t] = r[t];
204
+ return a;
205
205
  }
206
- function Ce(a) {
207
- if (Array.isArray(a)) return W(a);
206
+ function Ce(r) {
207
+ if (Array.isArray(r)) return W(r);
208
208
  }
209
- function xe(a, e, t) {
210
- return (e = Me(e)) in a ? Object.defineProperty(a, e, {
209
+ function xe(r, e, t) {
210
+ return (e = Me(e)) in r ? Object.defineProperty(r, e, {
211
211
  value: t,
212
212
  enumerable: !0,
213
213
  configurable: !0,
214
214
  writable: !0
215
- }) : a[e] = t, a;
215
+ }) : r[e] = t, r;
216
216
  }
217
- function Le(a) {
218
- if (typeof Symbol < "u" && a[Symbol.iterator] != null || a["@@iterator"] != null) return Array.from(a);
217
+ function Le(r) {
218
+ if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
219
219
  }
220
220
  function Be() {
221
221
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
222
222
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
223
223
  }
224
- function ae(a, e) {
225
- var t = Object.keys(a);
224
+ function re(r, e) {
225
+ var t = Object.keys(r);
226
226
  if (Object.getOwnPropertySymbols) {
227
- var r = Object.getOwnPropertySymbols(a);
228
- e && (r = r.filter(function(u) {
229
- return Object.getOwnPropertyDescriptor(a, u).enumerable;
230
- })), t.push.apply(t, r);
227
+ var a = Object.getOwnPropertySymbols(r);
228
+ e && (a = a.filter(function(o) {
229
+ return Object.getOwnPropertyDescriptor(r, o).enumerable;
230
+ })), t.push.apply(t, a);
231
231
  }
232
232
  return t;
233
233
  }
234
- function ne(a) {
234
+ function ne(r) {
235
235
  for (var e = 1; e < arguments.length; e++) {
236
236
  var t = arguments[e] != null ? arguments[e] : {};
237
- e % 2 ? ae(Object(t), !0).forEach(function(r) {
238
- xe(a, r, t[r]);
239
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(t)) : ae(Object(t)).forEach(function(r) {
240
- Object.defineProperty(a, r, Object.getOwnPropertyDescriptor(t, r));
237
+ e % 2 ? re(Object(t), !0).forEach(function(a) {
238
+ xe(r, a, t[a]);
239
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : re(Object(t)).forEach(function(a) {
240
+ Object.defineProperty(r, a, Object.getOwnPropertyDescriptor(t, a));
241
241
  });
242
242
  }
243
- return a;
243
+ return r;
244
244
  }
245
- function Ke(a) {
246
- return Ce(a) || Le(a) || Ge(a) || Be();
245
+ function Ke(r) {
246
+ return Ce(r) || Le(r) || Ge(r) || Be();
247
247
  }
248
- function je(a, e) {
249
- if (typeof a != "object" || !a) return a;
250
- var t = a[Symbol.toPrimitive];
248
+ function je(r, e) {
249
+ if (typeof r != "object" || !r) return r;
250
+ var t = r[Symbol.toPrimitive];
251
251
  if (t !== void 0) {
252
- var r = t.call(a, e);
253
- if (typeof r != "object") return r;
252
+ var a = t.call(r, e);
253
+ if (typeof a != "object") return a;
254
254
  throw new TypeError("@@toPrimitive must return a primitive value.");
255
255
  }
256
- return (e === "string" ? String : Number)(a);
256
+ return (e === "string" ? String : Number)(r);
257
257
  }
258
- function Me(a) {
259
- var e = je(a, "string");
258
+ function Me(r) {
259
+ var e = je(r, "string");
260
260
  return typeof e == "symbol" ? e : e + "";
261
261
  }
262
- function Ge(a, e) {
263
- if (a) {
264
- if (typeof a == "string") return W(a, e);
265
- var t = {}.toString.call(a).slice(8, -1);
266
- return t === "Object" && a.constructor && (t = a.constructor.name), t === "Map" || t === "Set" ? Array.from(a) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? W(a, e) : void 0;
262
+ function Ge(r, e) {
263
+ if (r) {
264
+ if (typeof r == "string") return W(r, e);
265
+ var t = {}.toString.call(r).slice(8, -1);
266
+ return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? W(r, e) : void 0;
267
267
  }
268
268
  }
269
269
  var ie = {
270
270
  activateTrap: function(e, t) {
271
271
  if (e.length > 0) {
272
- var r = e[e.length - 1];
273
- r !== t && r._setPausedState(!0);
272
+ var a = e[e.length - 1];
273
+ a !== t && a._setPausedState(!0);
274
274
  }
275
- var u = e.indexOf(t);
276
- u === -1 || e.splice(u, 1), e.push(t);
275
+ var o = e.indexOf(t);
276
+ o === -1 || e.splice(o, 1), e.push(t);
277
277
  },
278
278
  deactivateTrap: function(e, t) {
279
- var r = e.indexOf(t);
280
- r !== -1 && e.splice(r, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
279
+ var a = e.indexOf(t);
280
+ a !== -1 && e.splice(a, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
281
281
  }
282
282
  }, qe = function(e) {
283
283
  return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
@@ -289,16 +289,16 @@ var ie = {
289
289
  return x(e) && !e.shiftKey;
290
290
  }, $e = function(e) {
291
291
  return x(e) && e.shiftKey;
292
- }, oe = function(e) {
292
+ }, ue = function(e) {
293
293
  return setTimeout(e, 0);
294
294
  }, C = function(e) {
295
- for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), u = 1; u < t; u++)
296
- r[u - 1] = arguments[u];
297
- return typeof e == "function" ? e.apply(void 0, r) : e;
295
+ for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)
296
+ a[o - 1] = arguments[o];
297
+ return typeof e == "function" ? e.apply(void 0, a) : e;
298
298
  }, B = function(e) {
299
299
  return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
300
300
  }, Ue = [], We = function(e, t) {
301
- var r = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || Ue, s = ne({
301
+ var a = (t == null ? void 0 : t.document) || document, o = (t == null ? void 0 : t.trapStack) || Ue, c = ne({
302
302
  returnFocusOnDeactivate: !0,
303
303
  escapeDeactivates: !0,
304
304
  delayInitialFocus: !0,
@@ -341,31 +341,31 @@ var ie = {
341
341
  delayInitialFocusTimer: void 0,
342
342
  // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
343
343
  recentNavEvent: void 0
344
- }, b, v = function(n, o, l) {
345
- return n && n[o] !== void 0 ? n[o] : s[l || o];
346
- }, y = function(n, o) {
347
- var l = typeof (o == null ? void 0 : o.composedPath) == "function" ? o.composedPath() : void 0;
344
+ }, b, v = function(n, u, l) {
345
+ return n && n[u] !== void 0 ? n[u] : c[l || u];
346
+ }, p = function(n, u) {
347
+ var l = typeof (u == null ? void 0 : u.composedPath) == "function" ? u.composedPath() : void 0;
348
348
  return i.containerGroups.findIndex(function(f) {
349
- var d = f.container, p = f.tabbableNodes;
349
+ var d = f.container, y = f.tabbableNodes;
350
350
  return d.contains(n) || // fall back to explicit tabbable search which will take into consideration any
351
351
  // web components if the `tabbableOptions.getShadowRoot` option was used for
352
352
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
353
353
  // look inside web components even if open)
354
- (l == null ? void 0 : l.includes(d)) || p.find(function(c) {
355
- return c === n;
354
+ (l == null ? void 0 : l.includes(d)) || y.find(function(s) {
355
+ return s === n;
356
356
  });
357
357
  });
358
358
  }, T = function(n) {
359
- var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = o.hasFallback, f = l === void 0 ? !1 : l, d = o.params, p = d === void 0 ? [] : d, c = s[n];
360
- if (typeof c == "function" && (c = c.apply(void 0, Ke(p))), c === !0 && (c = void 0), !c) {
361
- if (c === void 0 || c === !1)
362
- return c;
359
+ var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = u.hasFallback, f = l === void 0 ? !1 : l, d = u.params, y = d === void 0 ? [] : d, s = c[n];
360
+ if (typeof s == "function" && (s = s.apply(void 0, Ke(y))), s === !0 && (s = void 0), !s) {
361
+ if (s === void 0 || s === !1)
362
+ return s;
363
363
  throw new Error("`".concat(n, "` was specified but was not a node, or did not return a node"));
364
364
  }
365
- var g = c;
366
- if (typeof c == "string") {
365
+ var g = s;
366
+ if (typeof s == "string") {
367
367
  try {
368
- g = r.querySelector(c);
368
+ g = a.querySelector(s);
369
369
  } catch (m) {
370
370
  throw new Error("`".concat(n, '` appears to be an invalid selector; error="').concat(m.message, '"'));
371
371
  }
@@ -379,11 +379,11 @@ var ie = {
379
379
  });
380
380
  if (n === !1)
381
381
  return !1;
382
- if (n === void 0 || n && !$(n, s.tabbableOptions))
383
- if (y(r.activeElement) >= 0)
384
- n = r.activeElement;
382
+ if (n === void 0 || n && !$(n, c.tabbableOptions))
383
+ if (p(a.activeElement) >= 0)
384
+ n = a.activeElement;
385
385
  else {
386
- var o = i.tabbableGroups[0], l = o && o.firstTabbableNode;
386
+ var u = i.tabbableGroups[0], l = u && u.firstTabbableNode;
387
387
  n = l || T("fallbackFocus");
388
388
  }
389
389
  else n === null && (n = T("fallbackFocus"));
@@ -392,16 +392,16 @@ var ie = {
392
392
  return n;
393
393
  }, E = function() {
394
394
  if (i.containerGroups = i.containers.map(function(n) {
395
- var o = Ae(n, s.tabbableOptions), l = Pe(n, s.tabbableOptions), f = o.length > 0 ? o[0] : void 0, d = o.length > 0 ? o[o.length - 1] : void 0, p = l.find(function(m) {
395
+ var u = Ae(n, c.tabbableOptions), l = Oe(n, c.tabbableOptions), f = u.length > 0 ? u[0] : void 0, d = u.length > 0 ? u[u.length - 1] : void 0, y = l.find(function(m) {
396
396
  return I(m);
397
- }), c = l.slice().reverse().find(function(m) {
397
+ }), s = l.slice().reverse().find(function(m) {
398
398
  return I(m);
399
- }), g = !!o.find(function(m) {
399
+ }), g = !!u.find(function(m) {
400
400
  return k(m) > 0;
401
401
  });
402
402
  return {
403
403
  container: n,
404
- tabbableNodes: o,
404
+ tabbableNodes: u,
405
405
  focusableNodes: l,
406
406
  /** True if at least one node with positive `tabindex` was found in this container. */
407
407
  posTabIndexesFound: g,
@@ -417,9 +417,9 @@ var ie = {
417
417
  // "close enough most of the time" alternative for positive tabindexes which should generally
418
418
  // be avoided anyway...
419
419
  /** First tabbable node in container, __DOM__ order; `undefined` if none. */
420
- firstDomTabbableNode: p,
420
+ firstDomTabbableNode: y,
421
421
  /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
422
- lastDomTabbableNode: c,
422
+ lastDomTabbableNode: s,
423
423
  /**
424
424
  * Finds the __tabbable__ node that follows the given node in the specified direction,
425
425
  * in this container, if any.
@@ -429,12 +429,12 @@ var ie = {
429
429
  * @returns {HTMLElement|undefined} The next tabbable node, if any.
430
430
  */
431
431
  nextTabbableNode: function(S) {
432
- var P = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, F = o.indexOf(S);
433
- return F < 0 ? P ? l.slice(l.indexOf(S) + 1).find(function(O) {
434
- return I(O);
435
- }) : l.slice(0, l.indexOf(S)).reverse().find(function(O) {
436
- return I(O);
437
- }) : o[F + (P ? 1 : -1)];
432
+ var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, F = u.indexOf(S);
433
+ return F < 0 ? O ? l.slice(l.indexOf(S) + 1).find(function(P) {
434
+ return I(P);
435
+ }) : l.slice(0, l.indexOf(S)).reverse().find(function(P) {
436
+ return I(P);
437
+ }) : u[F + (O ? 1 : -1)];
438
438
  }
439
439
  };
440
440
  }), i.tabbableGroups = i.containerGroups.filter(function(n) {
@@ -446,9 +446,9 @@ var ie = {
446
446
  }) && i.containerGroups.length > 1)
447
447
  throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
448
448
  }, D = function(n) {
449
- var o = n.activeElement;
450
- if (o)
451
- return o.shadowRoot && o.shadowRoot.activeElement !== null ? D(o.shadowRoot) : o;
449
+ var u = n.activeElement;
450
+ if (u)
451
+ return u.shadowRoot && u.shadowRoot.activeElement !== null ? D(u.shadowRoot) : u;
452
452
  }, N = function(n) {
453
453
  if (n !== !1 && n !== D(document)) {
454
454
  if (!n || !n.focus) {
@@ -456,48 +456,48 @@ var ie = {
456
456
  return;
457
457
  }
458
458
  n.focus({
459
- preventScroll: !!s.preventScroll
459
+ preventScroll: !!c.preventScroll
460
460
  }), i.mostRecentlyFocusedNode = n, qe(n) && n.select();
461
461
  }
462
462
  }, Y = function(n) {
463
- var o = T("setReturnFocus", {
463
+ var u = T("setReturnFocus", {
464
464
  params: [n]
465
465
  });
466
- return o || (o === !1 ? !1 : n);
466
+ return u || (u === !1 ? !1 : n);
467
467
  }, Z = function(n) {
468
- var o = n.target, l = n.event, f = n.isBackward, d = f === void 0 ? !1 : f;
469
- o = o || B(l), E();
470
- var p = null;
468
+ var u = n.target, l = n.event, f = n.isBackward, d = f === void 0 ? !1 : f;
469
+ u = u || B(l), E();
470
+ var y = null;
471
471
  if (i.tabbableGroups.length > 0) {
472
- var c = y(o, l), g = c >= 0 ? i.containerGroups[c] : void 0;
473
- if (c < 0)
474
- d ? p = i.tabbableGroups[i.tabbableGroups.length - 1].lastTabbableNode : p = i.tabbableGroups[0].firstTabbableNode;
472
+ var s = p(u, l), g = s >= 0 ? i.containerGroups[s] : void 0;
473
+ if (s < 0)
474
+ d ? y = i.tabbableGroups[i.tabbableGroups.length - 1].lastTabbableNode : y = i.tabbableGroups[0].firstTabbableNode;
475
475
  else if (d) {
476
476
  var m = i.tabbableGroups.findIndex(function(V) {
477
477
  var _ = V.firstTabbableNode;
478
- return o === _;
478
+ return u === _;
479
479
  });
480
- if (m < 0 && (g.container === o || $(o, s.tabbableOptions) && !I(o, s.tabbableOptions) && !g.nextTabbableNode(o, !1)) && (m = c), m >= 0) {
481
- var S = m === 0 ? i.tabbableGroups.length - 1 : m - 1, P = i.tabbableGroups[S];
482
- p = k(o) >= 0 ? P.lastTabbableNode : P.lastDomTabbableNode;
483
- } else x(l) || (p = g.nextTabbableNode(o, !1));
480
+ if (m < 0 && (g.container === u || $(u, c.tabbableOptions) && !I(u, c.tabbableOptions) && !g.nextTabbableNode(u, !1)) && (m = s), m >= 0) {
481
+ var S = m === 0 ? i.tabbableGroups.length - 1 : m - 1, O = i.tabbableGroups[S];
482
+ y = k(u) >= 0 ? O.lastTabbableNode : O.lastDomTabbableNode;
483
+ } else x(l) || (y = g.nextTabbableNode(u, !1));
484
484
  } else {
485
485
  var F = i.tabbableGroups.findIndex(function(V) {
486
486
  var _ = V.lastTabbableNode;
487
- return o === _;
487
+ return u === _;
488
488
  });
489
- if (F < 0 && (g.container === o || $(o, s.tabbableOptions) && !I(o, s.tabbableOptions) && !g.nextTabbableNode(o)) && (F = c), F >= 0) {
490
- var O = F === i.tabbableGroups.length - 1 ? 0 : F + 1, te = i.tabbableGroups[O];
491
- p = k(o) >= 0 ? te.firstTabbableNode : te.firstDomTabbableNode;
492
- } else x(l) || (p = g.nextTabbableNode(o));
489
+ if (F < 0 && (g.container === u || $(u, c.tabbableOptions) && !I(u, c.tabbableOptions) && !g.nextTabbableNode(u)) && (F = s), F >= 0) {
490
+ var P = F === i.tabbableGroups.length - 1 ? 0 : F + 1, te = i.tabbableGroups[P];
491
+ y = k(u) >= 0 ? te.firstTabbableNode : te.firstDomTabbableNode;
492
+ } else x(l) || (y = g.nextTabbableNode(u));
493
493
  }
494
494
  } else
495
- p = T("fallbackFocus");
496
- return p;
495
+ y = T("fallbackFocus");
496
+ return y;
497
497
  }, L = function(n) {
498
- var o = B(n);
499
- if (!(y(o, n) >= 0)) {
500
- if (C(s.clickOutsideDeactivates, n)) {
498
+ var u = B(n);
499
+ if (!(p(u, n) >= 0)) {
500
+ if (C(c.clickOutsideDeactivates, n)) {
501
501
  b.deactivate({
502
502
  // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
503
503
  // which will result in the outside click setting focus to the node
@@ -505,27 +505,27 @@ var ie = {
505
505
  // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
506
506
  // on activation (or the configured `setReturnFocus` node), whether the
507
507
  // outside click was on a focusable node or not
508
- returnFocus: s.returnFocusOnDeactivate
508
+ returnFocus: c.returnFocusOnDeactivate
509
509
  });
510
510
  return;
511
511
  }
512
- C(s.allowOutsideClick, n) || n.preventDefault();
512
+ C(c.allowOutsideClick, n) || n.preventDefault();
513
513
  }
514
514
  }, z = function(n) {
515
- var o = B(n), l = y(o, n) >= 0;
516
- if (l || o instanceof Document)
517
- l && (i.mostRecentlyFocusedNode = o);
515
+ var u = B(n), l = p(u, n) >= 0;
516
+ if (l || u instanceof Document)
517
+ l && (i.mostRecentlyFocusedNode = u);
518
518
  else {
519
519
  n.stopImmediatePropagation();
520
520
  var f, d = !0;
521
521
  if (i.mostRecentlyFocusedNode)
522
522
  if (k(i.mostRecentlyFocusedNode) > 0) {
523
- var p = y(i.mostRecentlyFocusedNode), c = i.containerGroups[p].tabbableNodes;
524
- if (c.length > 0) {
525
- var g = c.findIndex(function(m) {
523
+ var y = p(i.mostRecentlyFocusedNode), s = i.containerGroups[y].tabbableNodes;
524
+ if (s.length > 0) {
525
+ var g = s.findIndex(function(m) {
526
526
  return m === i.mostRecentlyFocusedNode;
527
527
  });
528
- g >= 0 && (s.isKeyForward(i.recentNavEvent) ? g + 1 < c.length && (f = c[g + 1], d = !1) : g - 1 >= 0 && (f = c[g - 1], d = !1));
528
+ g >= 0 && (c.isKeyForward(i.recentNavEvent) ? g + 1 < s.length && (f = s[g + 1], d = !1) : g - 1 >= 0 && (f = s[g - 1], d = !1));
529
529
  }
530
530
  } else
531
531
  i.containerGroups.some(function(m) {
@@ -539,53 +539,53 @@ var ie = {
539
539
  // move FROM the MRU node, not event-related node (which will be the node that is
540
540
  // outside the trap causing the focus escape we're trying to fix)
541
541
  target: i.mostRecentlyFocusedNode,
542
- isBackward: s.isKeyBackward(i.recentNavEvent)
542
+ isBackward: c.isKeyBackward(i.recentNavEvent)
543
543
  })), N(f || i.mostRecentlyFocusedNode || w());
544
544
  }
545
545
  i.recentNavEvent = void 0;
546
546
  }, ve = function(n) {
547
- var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
547
+ var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
548
548
  i.recentNavEvent = n;
549
549
  var l = Z({
550
550
  event: n,
551
- isBackward: o
551
+ isBackward: u
552
552
  });
553
553
  l && (x(n) && n.preventDefault(), N(l));
554
554
  }, X = function(n) {
555
- (s.isKeyForward(n) || s.isKeyBackward(n)) && ve(n, s.isKeyBackward(n));
555
+ (c.isKeyForward(n) || c.isKeyBackward(n)) && ve(n, c.isKeyBackward(n));
556
556
  }, H = function(n) {
557
- Ve(n) && C(s.escapeDeactivates, n) !== !1 && (n.preventDefault(), b.deactivate());
557
+ Ve(n) && C(c.escapeDeactivates, n) !== !1 && (n.preventDefault(), b.deactivate());
558
558
  }, J = function(n) {
559
- var o = B(n);
560
- y(o, n) >= 0 || C(s.clickOutsideDeactivates, n) || C(s.allowOutsideClick, n) || (n.preventDefault(), n.stopImmediatePropagation());
559
+ var u = B(n);
560
+ p(u, n) >= 0 || C(c.clickOutsideDeactivates, n) || C(c.allowOutsideClick, n) || (n.preventDefault(), n.stopImmediatePropagation());
561
561
  }, Q = function() {
562
562
  if (i.active)
563
- return ie.activateTrap(u, b), i.delayInitialFocusTimer = s.delayInitialFocus ? oe(function() {
563
+ return ie.activateTrap(o, b), i.delayInitialFocusTimer = c.delayInitialFocus ? ue(function() {
564
564
  N(w());
565
- }) : N(w()), r.addEventListener("focusin", z, !0), r.addEventListener("mousedown", L, {
565
+ }) : N(w()), a.addEventListener("focusin", z, !0), a.addEventListener("mousedown", L, {
566
566
  capture: !0,
567
567
  passive: !1
568
- }), r.addEventListener("touchstart", L, {
568
+ }), a.addEventListener("touchstart", L, {
569
569
  capture: !0,
570
570
  passive: !1
571
- }), r.addEventListener("click", J, {
571
+ }), a.addEventListener("click", J, {
572
572
  capture: !0,
573
573
  passive: !1
574
- }), r.addEventListener("keydown", X, {
574
+ }), a.addEventListener("keydown", X, {
575
575
  capture: !0,
576
576
  passive: !1
577
- }), r.addEventListener("keydown", H), b;
577
+ }), a.addEventListener("keydown", H), b;
578
578
  }, ee = function() {
579
579
  if (i.active)
580
- return r.removeEventListener("focusin", z, !0), r.removeEventListener("mousedown", L, !0), r.removeEventListener("touchstart", L, !0), r.removeEventListener("click", J, !0), r.removeEventListener("keydown", X, !0), r.removeEventListener("keydown", H), b;
580
+ return a.removeEventListener("focusin", z, !0), a.removeEventListener("mousedown", L, !0), a.removeEventListener("touchstart", L, !0), a.removeEventListener("click", J, !0), a.removeEventListener("keydown", X, !0), a.removeEventListener("keydown", H), b;
581
581
  }, be = function(n) {
582
- var o = n.some(function(l) {
582
+ var u = n.some(function(l) {
583
583
  var f = Array.from(l.removedNodes);
584
584
  return f.some(function(d) {
585
585
  return d === i.mostRecentlyFocusedNode;
586
586
  });
587
587
  });
588
- o && N(w());
588
+ u && N(w());
589
589
  }, q = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(be) : void 0, A = function() {
590
590
  q && (q.disconnect(), i.active && !i.paused && i.containers.map(function(n) {
591
591
  q.observe(n, {
@@ -604,8 +604,8 @@ var ie = {
604
604
  activate: function(n) {
605
605
  if (i.active)
606
606
  return this;
607
- var o = v(n, "onActivate"), l = v(n, "onPostActivate"), f = v(n, "checkCanFocusTrap");
608
- f || E(), i.active = !0, i.paused = !1, i.nodeFocusedBeforeActivation = D(r), o == null || o();
607
+ var u = v(n, "onActivate"), l = v(n, "onPostActivate"), f = v(n, "checkCanFocusTrap");
608
+ f || E(), i.active = !0, i.paused = !1, i.nodeFocusedBeforeActivation = D(a), u == null || u();
609
609
  var d = function() {
610
610
  f && E(), Q(), A(), l == null || l();
611
611
  };
@@ -614,31 +614,31 @@ var ie = {
614
614
  deactivate: function(n) {
615
615
  if (!i.active)
616
616
  return this;
617
- var o = ne({
618
- onDeactivate: s.onDeactivate,
619
- onPostDeactivate: s.onPostDeactivate,
620
- checkCanReturnFocus: s.checkCanReturnFocus
617
+ var u = ne({
618
+ onDeactivate: c.onDeactivate,
619
+ onPostDeactivate: c.onPostDeactivate,
620
+ checkCanReturnFocus: c.checkCanReturnFocus
621
621
  }, n);
622
- clearTimeout(i.delayInitialFocusTimer), i.delayInitialFocusTimer = void 0, ee(), i.active = !1, i.paused = !1, A(), ie.deactivateTrap(u, b);
623
- var l = v(o, "onDeactivate"), f = v(o, "onPostDeactivate"), d = v(o, "checkCanReturnFocus"), p = v(o, "returnFocus", "returnFocusOnDeactivate");
622
+ clearTimeout(i.delayInitialFocusTimer), i.delayInitialFocusTimer = void 0, ee(), i.active = !1, i.paused = !1, A(), ie.deactivateTrap(o, b);
623
+ var l = v(u, "onDeactivate"), f = v(u, "onPostDeactivate"), d = v(u, "checkCanReturnFocus"), y = v(u, "returnFocus", "returnFocusOnDeactivate");
624
624
  l == null || l();
625
- var c = function() {
626
- oe(function() {
627
- p && N(Y(i.nodeFocusedBeforeActivation)), f == null || f();
625
+ var s = function() {
626
+ ue(function() {
627
+ y && N(Y(i.nodeFocusedBeforeActivation)), f == null || f();
628
628
  });
629
629
  };
630
- return p && d ? (d(Y(i.nodeFocusedBeforeActivation)).then(c, c), this) : (c(), this);
630
+ return y && d ? (d(Y(i.nodeFocusedBeforeActivation)).then(s, s), this) : (s(), this);
631
631
  },
632
632
  pause: function(n) {
633
633
  return i.active ? (i.manuallyPaused = !0, this._setPausedState(!0, n)) : this;
634
634
  },
635
635
  unpause: function(n) {
636
- return i.active ? (i.manuallyPaused = !1, u[u.length - 1] !== this ? this : this._setPausedState(!1, n)) : this;
636
+ return i.active ? (i.manuallyPaused = !1, o[o.length - 1] !== this ? this : this._setPausedState(!1, n)) : this;
637
637
  },
638
638
  updateContainerElements: function(n) {
639
- var o = [].concat(n).filter(Boolean);
640
- return i.containers = o.map(function(l) {
641
- return typeof l == "string" ? r.querySelector(l) : l;
639
+ var u = [].concat(n).filter(Boolean);
640
+ return i.containers = u.map(function(l) {
641
+ return typeof l == "string" ? a.querySelector(l) : l;
642
642
  }), i.active && E(), A(), this;
643
643
  }
644
644
  }, Object.defineProperties(b, {
@@ -648,30 +648,35 @@ var ie = {
648
648
  }
649
649
  },
650
650
  _setPausedState: {
651
- value: function(n, o) {
651
+ value: function(n, u) {
652
652
  if (i.paused === n)
653
653
  return this;
654
654
  if (i.paused = n, n) {
655
- var l = v(o, "onPause"), f = v(o, "onPostPause");
655
+ var l = v(u, "onPause"), f = v(u, "onPostPause");
656
656
  l == null || l(), ee(), A(), f == null || f();
657
657
  } else {
658
- var d = v(o, "onUnpause"), p = v(o, "onPostUnpause");
659
- d == null || d(), E(), Q(), A(), p == null || p();
658
+ var d = v(u, "onUnpause"), y = v(u, "onPostUnpause");
659
+ d == null || d(), E(), Q(), A(), y == null || y();
660
660
  }
661
661
  return this;
662
662
  }
663
663
  }
664
664
  }), b.updateContainerElements(e), b;
665
665
  };
666
- const Ze = (a, e, t) => {
666
+ const Ze = (r, e, t) => {
667
667
  he(() => {
668
- if (!a || !e)
668
+ if (!r || !e)
669
669
  return;
670
- const r = We(a, t);
671
- return setTimeout(r.activate, 0), () => {
672
- r.deactivate();
670
+ const a = We(r, {
671
+ ...t,
672
+ initialFocus: (t == null ? void 0 : t.initialFocus) ?? r,
673
+ fallbackFocus: (t == null ? void 0 : t.fallbackFocus) ?? r,
674
+ returnFocusOnDeactivate: !1
675
+ });
676
+ return a.activate(), () => {
677
+ a.deactivate();
673
678
  };
674
- }, [a, e]);
679
+ }, [r, e]);
675
680
  };
676
681
  export {
677
682
  Ze as useFocusTrap