bitboss-ui 2.0.170 → 2.0.171

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 (188) hide show
  1. package/dist/components/BbPopover/BbPopover.vue.d.ts +2 -2
  2. package/dist/index106.js +9 -9
  3. package/dist/index111.js +1 -1
  4. package/dist/index113.js +1 -1
  5. package/dist/index121.js +12 -12
  6. package/dist/index129.js +2 -2
  7. package/dist/index13.js +1 -1
  8. package/dist/index131.js +3 -3
  9. package/dist/index133.js +1 -1
  10. package/dist/index136.js +1 -1
  11. package/dist/index138.js +1 -1
  12. package/dist/index15.js +8 -8
  13. package/dist/index17.js +3 -3
  14. package/dist/index19.js +8 -8
  15. package/dist/index207.js +2 -2
  16. package/dist/index208.js +2 -2
  17. package/dist/index209.js +2 -5
  18. package/dist/index21.js +16 -16
  19. package/dist/index210.js +4 -5
  20. package/dist/index211.js +2 -5
  21. package/dist/index212.js +18 -5
  22. package/dist/index213.js +128 -5
  23. package/dist/index214.js +106 -5
  24. package/dist/index216.js +100 -3
  25. package/dist/index218.js +64 -6
  26. package/dist/index220.js +13 -52
  27. package/dist/index221.js +5 -43
  28. package/dist/index222.js +15 -5
  29. package/dist/index223.js +29 -60
  30. package/dist/index224.js +16 -13
  31. package/dist/index225.js +12 -2
  32. package/dist/index226.js +51 -4
  33. package/dist/index227.js +17 -2
  34. package/dist/index228.js +15 -34
  35. package/dist/index229.js +3 -2
  36. package/dist/index23.js +17 -17
  37. package/dist/index230.js +12 -2
  38. package/dist/index231.js +12 -85
  39. package/dist/index232.js +4 -0
  40. package/dist/index233.js +227 -28
  41. package/dist/index234.js +363 -12
  42. package/dist/index235.js +2 -51
  43. package/dist/index236.js +5 -15
  44. package/dist/index237.js +5 -12
  45. package/dist/index238.js +5 -16
  46. package/dist/index239.js +5 -3
  47. package/dist/index240.js +5 -4
  48. package/dist/index241.js +5 -41
  49. package/dist/index242.js +5 -20
  50. package/dist/index243.js +6 -92
  51. package/dist/{index219.js → index244.js} +6 -6
  52. package/dist/index245.js +41 -189
  53. package/dist/index246.js +46 -0
  54. package/dist/index247.js +4 -65
  55. package/dist/index248.js +62 -0
  56. package/dist/index249.js +5 -13
  57. package/dist/index25.js +5 -5
  58. package/dist/index250.js +2 -6
  59. package/dist/index251.js +41 -7
  60. package/dist/index252.js +19 -14
  61. package/dist/index253.js +93 -17
  62. package/dist/index255.js +9 -106
  63. package/dist/index256.js +6 -0
  64. package/dist/index257.js +194 -94
  65. package/dist/index259.js +7 -12
  66. package/dist/index260.js +86 -2
  67. package/dist/index262.js +33 -367
  68. package/dist/index263.js +2 -2
  69. package/dist/index264.js +2 -5
  70. package/dist/index265.js +3 -9
  71. package/dist/index267.js +9 -8
  72. package/dist/index268.js +2 -10
  73. package/dist/index269.js +6 -101
  74. package/dist/index27.js +1 -1
  75. package/dist/index270.js +18 -0
  76. package/dist/index271.js +11 -23
  77. package/dist/index272.js +101 -10
  78. package/dist/index274.js +3 -6
  79. package/dist/index275.js +8 -15
  80. package/dist/index276.js +23 -3
  81. package/dist/index277.js +2 -9
  82. package/dist/index278.js +9 -8
  83. package/dist/index279.js +8 -2
  84. package/dist/index280.js +5 -67
  85. package/dist/index281.js +67 -5
  86. package/dist/index282.js +1 -1
  87. package/dist/index283.js +1 -1
  88. package/dist/index284.js +4 -280
  89. package/dist/index285.js +4 -2
  90. package/dist/index286.js +128 -15
  91. package/dist/index287.js +3 -2
  92. package/dist/index288.js +3 -16
  93. package/dist/index289.js +3 -2
  94. package/dist/index29.js +3 -3
  95. package/dist/index291.js +7 -2
  96. package/dist/index292.js +2 -15
  97. package/dist/index293.js +2 -2
  98. package/dist/index294.js +17 -19
  99. package/dist/index295.js +28 -2
  100. package/dist/index296.js +7 -27
  101. package/dist/index297.js +11 -2
  102. package/dist/index298.js +280 -2
  103. package/dist/index299.js +2 -2
  104. package/dist/index300.js +16 -2
  105. package/dist/index301.js +2 -2
  106. package/dist/index302.js +15 -27
  107. package/dist/index303.js +2 -22
  108. package/dist/{index290.js → index304.js} +2 -2
  109. package/dist/index305.js +2 -7
  110. package/dist/index306.js +15 -7
  111. package/dist/index307.js +2 -11
  112. package/dist/index308.js +19 -4
  113. package/dist/index309.js +2 -2
  114. package/dist/index31.js +2 -2
  115. package/dist/index310.js +26 -5
  116. package/dist/index311.js +2 -4
  117. package/dist/index312.js +2 -3
  118. package/dist/index313.js +2 -17
  119. package/dist/index314.js +2 -5
  120. package/dist/index315.js +2 -471
  121. package/dist/index316.js +22 -3
  122. package/dist/index318.js +125 -3
  123. package/dist/index319.js +4 -0
  124. package/dist/index320.js +457 -186
  125. package/dist/index321.js +3 -2
  126. package/dist/index322.js +3 -129
  127. package/dist/index323.js +382 -3
  128. package/dist/index324.js +126 -3
  129. package/dist/index325.js +1 -1
  130. package/dist/index326.js +3 -382
  131. package/dist/index327.js +5 -125
  132. package/dist/index328.js +196 -121
  133. package/dist/index329.js +5 -2
  134. package/dist/index33.js +8 -8
  135. package/dist/index330.js +701 -3
  136. package/dist/index331.js +354 -5
  137. package/dist/index332.js +58 -701
  138. package/dist/index333.js +3 -354
  139. package/dist/index334.js +5 -58
  140. package/dist/index335.js +47 -2
  141. package/dist/index336.js +2 -7
  142. package/dist/index337.js +32 -18
  143. package/dist/index338.js +28 -7
  144. package/dist/index340.js +57 -27
  145. package/dist/index341.js +60 -0
  146. package/dist/index342.js +6 -227
  147. package/dist/index343.js +8 -58
  148. package/dist/index344.js +6 -58
  149. package/dist/index345.js +8 -8
  150. package/dist/index346.js +5 -6
  151. package/dist/index347.js +7 -8
  152. package/dist/index348.js +19 -5
  153. package/dist/index349.js +227 -46
  154. package/dist/index35.js +4 -4
  155. package/dist/index350.js +1 -1
  156. package/dist/index351.js +484 -0
  157. package/dist/index353.js +3 -482
  158. package/dist/index355.js +1 -1
  159. package/dist/index37.js +22 -22
  160. package/dist/index39.js +5 -5
  161. package/dist/index41.js +2 -2
  162. package/dist/index43.js +8 -8
  163. package/dist/index45.js +8 -8
  164. package/dist/index47.js +2 -2
  165. package/dist/index49.js +2 -2
  166. package/dist/index53.js +1 -1
  167. package/dist/index55.js +1 -1
  168. package/dist/index57.js +2 -2
  169. package/dist/index61.js +3 -3
  170. package/dist/index67.js +1 -1
  171. package/dist/index79.js +4 -4
  172. package/dist/index81.js +1 -1
  173. package/dist/index83.js +2 -2
  174. package/dist/index85.js +1 -1
  175. package/dist/index87.js +1 -1
  176. package/dist/index90.js +4 -4
  177. package/dist/index92.js +2 -2
  178. package/dist/index94.js +41 -40
  179. package/dist/index96.js +1 -1
  180. package/package.json +1 -1
  181. package/dist/index215.js +0 -7
  182. package/dist/index217.js +0 -4
  183. package/dist/index254.js +0 -130
  184. package/dist/index261.js +0 -230
  185. package/dist/index273.js +0 -5
  186. package/dist/index317.js +0 -5
  187. package/dist/index339.js +0 -35
  188. package/dist/index352.js +0 -5
package/dist/index320.js CHANGED
@@ -1,202 +1,473 @@
1
+ import { tabbable as ne, focusable as ae, isTabbable as k, getTabIndex as R, isFocusable as S } from "./index328.js";
1
2
  /*!
2
- * tabbable 6.2.0
3
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
3
+ * focus-trap 7.6.4
4
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
4
5
  */
5
- var w = ["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])"], v = /* @__PURE__ */ w.join(","), T = typeof Element > "u", o = T ? function() {
6
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, b = !T && Element.prototype.getRootNode ? function(i) {
7
- var t;
8
- return i == null || (t = i.getRootNode) === null || t === void 0 ? void 0 : t.call(i);
9
- } : function(i) {
10
- return i == null ? void 0 : i.ownerDocument;
11
- }, h = function i(t, e) {
12
- var r;
13
- e === void 0 && (e = !0);
14
- var a = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), l = a === "" || a === "true", n = l || e && t && i(t.parentNode);
15
- return n;
16
- }, A = function(t) {
17
- var e, r = t == null || (e = t.getAttribute) === null || e === void 0 ? void 0 : e.call(t, "contenteditable");
18
- return r === "" || r === "true";
19
- }, I = function(t, e, r) {
20
- if (h(t))
21
- return [];
22
- var a = Array.prototype.slice.apply(t.querySelectorAll(v));
23
- return e && o.call(t, v) && a.unshift(t), a = a.filter(r), a;
24
- }, m = function i(t, e, r) {
25
- for (var a = [], l = Array.from(t); l.length; ) {
26
- var n = l.shift();
27
- if (!h(n, !1))
28
- if (n.tagName === "SLOT") {
29
- var u = n.assignedElements(), c = u.length ? u : n.children, s = i(c, !0, r);
30
- r.flatten ? a.push.apply(a, s) : a.push({
31
- scopeParent: n,
32
- candidates: s
33
- });
34
- } else {
35
- var f = o.call(n, v);
36
- f && r.filter(n) && (e || !t.includes(n)) && a.push(n);
37
- var d = n.shadowRoot || // check for an undisclosed shadow
38
- typeof r.getShadowRoot == "function" && r.getShadowRoot(n), E = !h(d, !1) && (!r.shadowRootFilter || r.shadowRootFilter(n));
39
- if (d && E) {
40
- var y = i(d === !0 ? n.children : d.children, !0, r);
41
- r.flatten ? a.push.apply(a, y) : a.push({
42
- scopeParent: n,
43
- candidates: y
44
- });
45
- } else
46
- l.unshift.apply(l, n.children);
47
- }
6
+ function x(r, t) {
7
+ (t == null || t > r.length) && (t = r.length);
8
+ for (var o = 0, u = Array(t); o < t; o++) u[o] = r[o];
9
+ return u;
10
+ }
11
+ function re(r) {
12
+ if (Array.isArray(r)) return x(r);
13
+ }
14
+ function ie(r, t, o) {
15
+ return (t = le(t)) in r ? Object.defineProperty(r, t, {
16
+ value: o,
17
+ enumerable: !0,
18
+ configurable: !0,
19
+ writable: !0
20
+ }) : r[t] = o, r;
21
+ }
22
+ function oe(r) {
23
+ if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
24
+ }
25
+ function ue() {
26
+ throw new TypeError(`Invalid attempt to spread non-iterable instance.
27
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
28
+ }
29
+ function Q(r, t) {
30
+ var o = Object.keys(r);
31
+ if (Object.getOwnPropertySymbols) {
32
+ var u = Object.getOwnPropertySymbols(r);
33
+ t && (u = u.filter(function(m) {
34
+ return Object.getOwnPropertyDescriptor(r, m).enumerable;
35
+ })), o.push.apply(o, u);
36
+ }
37
+ return o;
38
+ }
39
+ function X(r) {
40
+ for (var t = 1; t < arguments.length; t++) {
41
+ var o = arguments[t] != null ? arguments[t] : {};
42
+ t % 2 ? Q(Object(o), !0).forEach(function(u) {
43
+ ie(r, u, o[u]);
44
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(o)) : Q(Object(o)).forEach(function(u) {
45
+ Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(o, u));
46
+ });
47
+ }
48
+ return r;
49
+ }
50
+ function se(r) {
51
+ return re(r) || oe(r) || fe(r) || ue();
52
+ }
53
+ function ce(r, t) {
54
+ if (typeof r != "object" || !r) return r;
55
+ var o = r[Symbol.toPrimitive];
56
+ if (o !== void 0) {
57
+ var u = o.call(r, t);
58
+ if (typeof u != "object") return u;
59
+ throw new TypeError("@@toPrimitive must return a primitive value.");
60
+ }
61
+ return (t === "string" ? String : Number)(r);
62
+ }
63
+ function le(r) {
64
+ var t = ce(r, "string");
65
+ return typeof t == "symbol" ? t : t + "";
66
+ }
67
+ function fe(r, t) {
68
+ if (r) {
69
+ if (typeof r == "string") return x(r, t);
70
+ var o = {}.toString.call(r).slice(8, -1);
71
+ return o === "Object" && r.constructor && (o = r.constructor.name), o === "Map" || o === "Set" ? Array.from(r) : o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o) ? x(r, t) : void 0;
48
72
  }
49
- return a;
50
- }, N = function(t) {
51
- return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
52
- }, R = function(t) {
53
- if (!t)
54
- throw new Error("No node provided");
55
- return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || A(t)) && !N(t) ? 0 : t.tabIndex;
56
- }, x = function(t, e) {
57
- var r = R(t);
58
- return r < 0 && e && !N(t) ? 0 : r;
59
- }, O = function(t, e) {
60
- return t.tabIndex === e.tabIndex ? t.documentOrder - e.documentOrder : t.tabIndex - e.tabIndex;
61
- }, C = function(t) {
62
- return t.tagName === "INPUT";
63
- }, F = function(t) {
64
- return C(t) && t.type === "hidden";
65
- }, D = function(t) {
66
- var e = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
67
- return r.tagName === "SUMMARY";
68
- });
69
- return e;
70
- }, k = function(t, e) {
71
- for (var r = 0; r < t.length; r++)
72
- if (t[r].checked && t[r].form === e)
73
- return t[r];
74
- }, M = function(t) {
75
- if (!t.name)
76
- return !0;
77
- var e = t.form || b(t), r = function(u) {
78
- return e.querySelectorAll('input[type="radio"][name="' + u + '"]');
79
- }, a;
80
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
81
- a = r(window.CSS.escape(t.name));
82
- else
83
- try {
84
- a = r(t.name);
85
- } catch (n) {
86
- 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", n.message), !1;
73
+ }
74
+ var Z = {
75
+ activateTrap: function(t, o) {
76
+ if (t.length > 0) {
77
+ var u = t[t.length - 1];
78
+ u !== o && u._setPausedState(!0);
87
79
  }
88
- var l = k(a, t.form);
89
- return !l || l === t;
80
+ var m = t.indexOf(o);
81
+ m === -1 || t.splice(m, 1), t.push(o);
82
+ },
83
+ deactivateTrap: function(t, o) {
84
+ var u = t.indexOf(o);
85
+ u !== -1 && t.splice(u, 1), t.length > 0 && !t[t.length - 1]._isManuallyPaused() && t[t.length - 1]._setPausedState(!1);
86
+ }
87
+ }, de = function(t) {
88
+ return t.tagName && t.tagName.toLowerCase() === "input" && typeof t.select == "function";
89
+ }, be = function(t) {
90
+ return (t == null ? void 0 : t.key) === "Escape" || (t == null ? void 0 : t.key) === "Esc" || (t == null ? void 0 : t.keyCode) === 27;
90
91
  }, L = function(t) {
91
- return C(t) && t.type === "radio";
92
- }, P = function(t) {
93
- return L(t) && !M(t);
92
+ return (t == null ? void 0 : t.key) === "Tab" || (t == null ? void 0 : t.keyCode) === 9;
93
+ }, ve = function(t) {
94
+ return L(t) && !t.shiftKey;
95
+ }, pe = function(t) {
96
+ return L(t) && t.shiftKey;
97
+ }, U = function(t) {
98
+ return setTimeout(t, 0);
99
+ }, K = function(t) {
100
+ for (var o = arguments.length, u = new Array(o > 1 ? o - 1 : 0), m = 1; m < o; m++)
101
+ u[m - 1] = arguments[m];
102
+ return typeof t == "function" ? t.apply(void 0, u) : t;
94
103
  }, B = function(t) {
95
- var e, r = t && b(t), a = (e = r) === null || e === void 0 ? void 0 : e.host, l = !1;
96
- if (r && r !== t) {
97
- var n, u, c;
98
- for (l = !!((n = a) !== null && n !== void 0 && (u = n.ownerDocument) !== null && u !== void 0 && u.contains(a) || t != null && (c = t.ownerDocument) !== null && c !== void 0 && c.contains(t)); !l && a; ) {
99
- var s, f, d;
100
- r = b(a), a = (s = r) === null || s === void 0 ? void 0 : s.host, l = !!((f = a) !== null && f !== void 0 && (d = f.ownerDocument) !== null && d !== void 0 && d.contains(a));
104
+ return t.target.shadowRoot && typeof t.composedPath == "function" ? t.composedPath()[0] : t.target;
105
+ }, me = [], he = function(t, o) {
106
+ var u = (o == null ? void 0 : o.document) || document, m = (o == null ? void 0 : o.trapStack) || me, f = X({
107
+ returnFocusOnDeactivate: !0,
108
+ escapeDeactivates: !0,
109
+ delayInitialFocus: !0,
110
+ isKeyForward: ve,
111
+ isKeyBackward: pe
112
+ }, o), a = {
113
+ // containers given to createFocusTrap()
114
+ // @type {Array<HTMLElement>}
115
+ containers: [],
116
+ // list of objects identifying tabbable nodes in `containers` in the trap
117
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
118
+ // is active, but the trap should never get to a state where there isn't at least one group
119
+ // with at least one tabbable node in it (that would lead to an error condition that would
120
+ // result in an error being thrown)
121
+ // @type {Array<{
122
+ // container: HTMLElement,
123
+ // tabbableNodes: Array<HTMLElement>, // empty if none
124
+ // focusableNodes: Array<HTMLElement>, // empty if none
125
+ // posTabIndexesFound: boolean,
126
+ // firstTabbableNode: HTMLElement|undefined,
127
+ // lastTabbableNode: HTMLElement|undefined,
128
+ // firstDomTabbableNode: HTMLElement|undefined,
129
+ // lastDomTabbableNode: HTMLElement|undefined,
130
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
131
+ // }>}
132
+ containerGroups: [],
133
+ // same order/length as `containers` list
134
+ // references to objects in `containerGroups`, but only those that actually have
135
+ // tabbable nodes in them
136
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
137
+ // the same length
138
+ tabbableGroups: [],
139
+ nodeFocusedBeforeActivation: null,
140
+ mostRecentlyFocusedNode: null,
141
+ active: !1,
142
+ paused: !1,
143
+ manuallyPaused: !1,
144
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
145
+ // has been delayed during activation
146
+ delayInitialFocusTimer: void 0,
147
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
148
+ recentNavEvent: void 0
149
+ }, h, y = function(e, n, i) {
150
+ return e && e[n] !== void 0 ? e[n] : f[i || n];
151
+ }, N = function(e, n) {
152
+ var i = typeof (n == null ? void 0 : n.composedPath) == "function" ? n.composedPath() : void 0;
153
+ return a.containerGroups.findIndex(function(c) {
154
+ var l = c.container, b = c.tabbableNodes;
155
+ return l.contains(e) || // fall back to explicit tabbable search which will take into consideration any
156
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
157
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
158
+ // look inside web components even if open)
159
+ (i == null ? void 0 : i.includes(l)) || b.find(function(s) {
160
+ return s === e;
161
+ });
162
+ });
163
+ }, T = function(e) {
164
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = n.hasFallback, c = i === void 0 ? !1 : i, l = n.params, b = l === void 0 ? [] : l, s = f[e];
165
+ if (typeof s == "function" && (s = s.apply(void 0, se(b))), s === !0 && (s = void 0), !s) {
166
+ if (s === void 0 || s === !1)
167
+ return s;
168
+ throw new Error("`".concat(e, "` was specified but was not a node, or did not return a node"));
101
169
  }
102
- }
103
- return l;
104
- }, p = function(t) {
105
- var e = t.getBoundingClientRect(), r = e.width, a = e.height;
106
- return r === 0 && a === 0;
107
- }, q = function(t, e) {
108
- var r = e.displayCheck, a = e.getShadowRoot;
109
- if (getComputedStyle(t).visibility === "hidden")
110
- return !0;
111
- var l = o.call(t, "details>summary:first-of-type"), n = l ? t.parentElement : t;
112
- if (o.call(n, "details:not([open]) *"))
113
- return !0;
114
- if (!r || r === "full" || r === "legacy-full") {
115
- if (typeof a == "function") {
116
- for (var u = t; t; ) {
117
- var c = t.parentElement, s = b(t);
118
- if (c && !c.shadowRoot && a(c) === !0)
119
- return p(t);
120
- t.assignedSlot ? t = t.assignedSlot : !c && s !== t.ownerDocument ? t = s.host : t = c;
170
+ var v = s;
171
+ if (typeof s == "string") {
172
+ try {
173
+ v = u.querySelector(s);
174
+ } catch (p) {
175
+ throw new Error("`".concat(e, '` appears to be an invalid selector; error="').concat(p.message, '"'));
121
176
  }
122
- t = u;
177
+ if (!v && !c)
178
+ throw new Error("`".concat(e, "` as selector refers to no known node"));
123
179
  }
124
- if (B(t))
125
- return !t.getClientRects().length;
126
- if (r !== "legacy-full")
127
- return !0;
128
- } else if (r === "non-zero-area")
129
- return p(t);
130
- return !1;
131
- }, U = function(t) {
132
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
133
- for (var e = t.parentElement; e; ) {
134
- if (e.tagName === "FIELDSET" && e.disabled) {
135
- for (var r = 0; r < e.children.length; r++) {
136
- var a = e.children.item(r);
137
- if (a.tagName === "LEGEND")
138
- return o.call(e, "fieldset[disabled] *") ? !0 : !a.contains(t);
180
+ return v;
181
+ }, E = function() {
182
+ var e = T("initialFocus", {
183
+ hasFallback: !0
184
+ });
185
+ if (e === !1)
186
+ return !1;
187
+ if (e === void 0 || e && !S(e, f.tabbableOptions))
188
+ if (N(u.activeElement) >= 0)
189
+ e = u.activeElement;
190
+ else {
191
+ var n = a.tabbableGroups[0], i = n && n.firstTabbableNode;
192
+ e = i || T("fallbackFocus");
193
+ }
194
+ else e === null && (e = T("fallbackFocus"));
195
+ if (!e)
196
+ throw new Error("Your focus-trap needs to have at least one focusable element");
197
+ return e;
198
+ }, P = function() {
199
+ if (a.containerGroups = a.containers.map(function(e) {
200
+ var n = ne(e, f.tabbableOptions), i = ae(e, f.tabbableOptions), c = n.length > 0 ? n[0] : void 0, l = n.length > 0 ? n[n.length - 1] : void 0, b = i.find(function(p) {
201
+ return k(p);
202
+ }), s = i.slice().reverse().find(function(p) {
203
+ return k(p);
204
+ }), v = !!n.find(function(p) {
205
+ return R(p) > 0;
206
+ });
207
+ return {
208
+ container: e,
209
+ tabbableNodes: n,
210
+ focusableNodes: i,
211
+ /** True if at least one node with positive `tabindex` was found in this container. */
212
+ posTabIndexesFound: v,
213
+ /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
214
+ firstTabbableNode: c,
215
+ /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
216
+ lastTabbableNode: l,
217
+ // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
218
+ // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
219
+ // because that API doesn't work with Shadow DOM as well as it should (@see
220
+ // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
221
+ // to address an edge case related to positive tabindex support, this seems like a much easier,
222
+ // "close enough most of the time" alternative for positive tabindexes which should generally
223
+ // be avoided anyway...
224
+ /** First tabbable node in container, __DOM__ order; `undefined` if none. */
225
+ firstDomTabbableNode: b,
226
+ /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
227
+ lastDomTabbableNode: s,
228
+ /**
229
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
230
+ * in this container, if any.
231
+ * @param {HTMLElement} node
232
+ * @param {boolean} [forward] True if going in forward tab order; false if going
233
+ * in reverse.
234
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
235
+ */
236
+ nextTabbableNode: function(F) {
237
+ var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, w = n.indexOf(F);
238
+ return w < 0 ? O ? i.slice(i.indexOf(F) + 1).find(function(A) {
239
+ return k(A);
240
+ }) : i.slice(0, i.indexOf(F)).reverse().find(function(A) {
241
+ return k(A);
242
+ }) : n[w + (O ? 1 : -1)];
139
243
  }
140
- return !0;
244
+ };
245
+ }), a.tabbableGroups = a.containerGroups.filter(function(e) {
246
+ return e.tabbableNodes.length > 0;
247
+ }), a.tabbableGroups.length <= 0 && !T("fallbackFocus"))
248
+ throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
249
+ if (a.containerGroups.find(function(e) {
250
+ return e.posTabIndexesFound;
251
+ }) && a.containerGroups.length > 1)
252
+ 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.");
253
+ }, G = function(e) {
254
+ var n = e.activeElement;
255
+ if (n)
256
+ return n.shadowRoot && n.shadowRoot.activeElement !== null ? G(n.shadowRoot) : n;
257
+ }, g = function(e) {
258
+ if (e !== !1 && e !== G(document)) {
259
+ if (!e || !e.focus) {
260
+ g(E());
261
+ return;
262
+ }
263
+ e.focus({
264
+ preventScroll: !!f.preventScroll
265
+ }), a.mostRecentlyFocusedNode = e, de(e) && e.select();
266
+ }
267
+ }, M = function(e) {
268
+ var n = T("setReturnFocus", {
269
+ params: [e]
270
+ });
271
+ return n || (n === !1 ? !1 : e);
272
+ }, $ = function(e) {
273
+ var n = e.target, i = e.event, c = e.isBackward, l = c === void 0 ? !1 : c;
274
+ n = n || B(i), P();
275
+ var b = null;
276
+ if (a.tabbableGroups.length > 0) {
277
+ var s = N(n, i), v = s >= 0 ? a.containerGroups[s] : void 0;
278
+ if (s < 0)
279
+ l ? b = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : b = a.tabbableGroups[0].firstTabbableNode;
280
+ else if (l) {
281
+ var p = a.tabbableGroups.findIndex(function(I) {
282
+ var _ = I.firstTabbableNode;
283
+ return n === _;
284
+ });
285
+ if (p < 0 && (v.container === n || S(n, f.tabbableOptions) && !k(n, f.tabbableOptions) && !v.nextTabbableNode(n, !1)) && (p = s), p >= 0) {
286
+ var F = p === 0 ? a.tabbableGroups.length - 1 : p - 1, O = a.tabbableGroups[F];
287
+ b = R(n) >= 0 ? O.lastTabbableNode : O.lastDomTabbableNode;
288
+ } else L(i) || (b = v.nextTabbableNode(n, !1));
289
+ } else {
290
+ var w = a.tabbableGroups.findIndex(function(I) {
291
+ var _ = I.lastTabbableNode;
292
+ return n === _;
293
+ });
294
+ if (w < 0 && (v.container === n || S(n, f.tabbableOptions) && !k(n, f.tabbableOptions) && !v.nextTabbableNode(n)) && (w = s), w >= 0) {
295
+ var A = w === a.tabbableGroups.length - 1 ? 0 : w + 1, J = a.tabbableGroups[A];
296
+ b = R(n) >= 0 ? J.firstTabbableNode : J.firstDomTabbableNode;
297
+ } else L(i) || (b = v.nextTabbableNode(n));
298
+ }
299
+ } else
300
+ b = T("fallbackFocus");
301
+ return b;
302
+ }, j = function(e) {
303
+ var n = B(e);
304
+ if (!(N(n, e) >= 0)) {
305
+ if (K(f.clickOutsideDeactivates, e)) {
306
+ h.deactivate({
307
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
308
+ // which will result in the outside click setting focus to the node
309
+ // that was clicked (and if not focusable, to "nothing"); by setting
310
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
311
+ // on activation (or the configured `setReturnFocus` node), whether the
312
+ // outside click was on a focusable node or not
313
+ returnFocus: f.returnFocusOnDeactivate
314
+ });
315
+ return;
141
316
  }
142
- e = e.parentElement;
317
+ K(f.allowOutsideClick, e) || e.preventDefault();
318
+ }
319
+ }, H = function(e) {
320
+ var n = B(e), i = N(n, e) >= 0;
321
+ if (i || n instanceof Document)
322
+ i && (a.mostRecentlyFocusedNode = n);
323
+ else {
324
+ e.stopImmediatePropagation();
325
+ var c, l = !0;
326
+ if (a.mostRecentlyFocusedNode)
327
+ if (R(a.mostRecentlyFocusedNode) > 0) {
328
+ var b = N(a.mostRecentlyFocusedNode), s = a.containerGroups[b].tabbableNodes;
329
+ if (s.length > 0) {
330
+ var v = s.findIndex(function(p) {
331
+ return p === a.mostRecentlyFocusedNode;
332
+ });
333
+ v >= 0 && (f.isKeyForward(a.recentNavEvent) ? v + 1 < s.length && (c = s[v + 1], l = !1) : v - 1 >= 0 && (c = s[v - 1], l = !1));
334
+ }
335
+ } else
336
+ a.containerGroups.some(function(p) {
337
+ return p.tabbableNodes.some(function(F) {
338
+ return R(F) > 0;
339
+ });
340
+ }) || (l = !1);
341
+ else
342
+ l = !1;
343
+ l && (c = $({
344
+ // move FROM the MRU node, not event-related node (which will be the node that is
345
+ // outside the trap causing the focus escape we're trying to fix)
346
+ target: a.mostRecentlyFocusedNode,
347
+ isBackward: f.isKeyBackward(a.recentNavEvent)
348
+ })), g(c || a.mostRecentlyFocusedNode || E());
143
349
  }
144
- return !1;
145
- }, g = function(t, e) {
146
- return !(e.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
147
- // because we're limited in the type of selectors we can use in JSDom (see related
148
- // note related to `candidateSelectors`)
149
- h(e) || F(e) || q(e, t) || // For a details element with a summary, the summary element gets the focus
150
- D(e) || U(e));
151
- }, S = function(t, e) {
152
- return !(P(e) || R(e) < 0 || !g(t, e));
153
- }, V = function(t) {
154
- var e = parseInt(t.getAttribute("tabindex"), 10);
155
- return !!(isNaN(e) || e >= 0);
156
- }, j = function i(t) {
157
- var e = [], r = [];
158
- return t.forEach(function(a, l) {
159
- var n = !!a.scopeParent, u = n ? a.scopeParent : a, c = x(u, n), s = n ? i(a.candidates) : u;
160
- c === 0 ? n ? e.push.apply(e, s) : e.push(u) : r.push({
161
- documentOrder: l,
162
- tabIndex: c,
163
- item: a,
164
- isScope: n,
165
- content: s
350
+ a.recentNavEvent = void 0;
351
+ }, ee = function(e) {
352
+ var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
353
+ a.recentNavEvent = e;
354
+ var i = $({
355
+ event: e,
356
+ isBackward: n
357
+ });
358
+ i && (L(e) && e.preventDefault(), g(i));
359
+ }, q = function(e) {
360
+ (f.isKeyForward(e) || f.isKeyBackward(e)) && ee(e, f.isKeyBackward(e));
361
+ }, Y = function(e) {
362
+ be(e) && K(f.escapeDeactivates, e) !== !1 && (e.preventDefault(), h.deactivate());
363
+ }, V = function(e) {
364
+ var n = B(e);
365
+ N(n, e) >= 0 || K(f.clickOutsideDeactivates, e) || K(f.allowOutsideClick, e) || (e.preventDefault(), e.stopImmediatePropagation());
366
+ }, W = function() {
367
+ if (a.active)
368
+ return Z.activateTrap(m, h), a.delayInitialFocusTimer = f.delayInitialFocus ? U(function() {
369
+ g(E());
370
+ }) : g(E()), u.addEventListener("focusin", H, !0), u.addEventListener("mousedown", j, {
371
+ capture: !0,
372
+ passive: !1
373
+ }), u.addEventListener("touchstart", j, {
374
+ capture: !0,
375
+ passive: !1
376
+ }), u.addEventListener("click", V, {
377
+ capture: !0,
378
+ passive: !1
379
+ }), u.addEventListener("keydown", q, {
380
+ capture: !0,
381
+ passive: !1
382
+ }), u.addEventListener("keydown", Y), h;
383
+ }, z = function() {
384
+ if (a.active)
385
+ return u.removeEventListener("focusin", H, !0), u.removeEventListener("mousedown", j, !0), u.removeEventListener("touchstart", j, !0), u.removeEventListener("click", V, !0), u.removeEventListener("keydown", q, !0), u.removeEventListener("keydown", Y), h;
386
+ }, te = function(e) {
387
+ var n = e.some(function(i) {
388
+ var c = Array.from(i.removedNodes);
389
+ return c.some(function(l) {
390
+ return l === a.mostRecentlyFocusedNode;
391
+ });
166
392
  });
167
- }), r.sort(O).reduce(function(a, l) {
168
- return l.isScope ? a.push.apply(a, l.content) : a.push(l.content), a;
169
- }, []).concat(e);
170
- }, Z = function(t, e) {
171
- e = e || {};
172
- var r;
173
- return e.getShadowRoot ? r = m([t], e.includeContainer, {
174
- filter: S.bind(null, e),
175
- flatten: !1,
176
- getShadowRoot: e.getShadowRoot,
177
- shadowRootFilter: V
178
- }) : r = I(t, e.includeContainer, S.bind(null, e)), j(r);
179
- }, z = function(t, e) {
180
- e = e || {};
181
- var r;
182
- return e.getShadowRoot ? r = m([t], e.includeContainer, {
183
- filter: g.bind(null, e),
184
- flatten: !0,
185
- getShadowRoot: e.getShadowRoot
186
- }) : r = I(t, e.includeContainer, g.bind(null, e)), r;
187
- }, G = function(t, e) {
188
- if (e = e || {}, !t)
189
- throw new Error("No node provided");
190
- return o.call(t, v) === !1 ? !1 : S(e, t);
191
- }, W = /* @__PURE__ */ w.concat("iframe").join(","), X = function(t, e) {
192
- if (e = e || {}, !t)
193
- throw new Error("No node provided");
194
- return o.call(t, W) === !1 ? !1 : g(e, t);
393
+ n && g(E());
394
+ }, C = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(te) : void 0, D = function() {
395
+ C && (C.disconnect(), a.active && !a.paused && a.containers.map(function(e) {
396
+ C.observe(e, {
397
+ subtree: !0,
398
+ childList: !0
399
+ });
400
+ }));
401
+ };
402
+ return h = {
403
+ get active() {
404
+ return a.active;
405
+ },
406
+ get paused() {
407
+ return a.paused;
408
+ },
409
+ activate: function(e) {
410
+ if (a.active)
411
+ return this;
412
+ var n = y(e, "onActivate"), i = y(e, "onPostActivate"), c = y(e, "checkCanFocusTrap");
413
+ c || P(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = u.activeElement, n == null || n();
414
+ var l = function() {
415
+ c && P(), W(), D(), i == null || i();
416
+ };
417
+ return c ? (c(a.containers.concat()).then(l, l), this) : (l(), this);
418
+ },
419
+ deactivate: function(e) {
420
+ if (!a.active)
421
+ return this;
422
+ var n = X({
423
+ onDeactivate: f.onDeactivate,
424
+ onPostDeactivate: f.onPostDeactivate,
425
+ checkCanReturnFocus: f.checkCanReturnFocus
426
+ }, e);
427
+ clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, z(), a.active = !1, a.paused = !1, D(), Z.deactivateTrap(m, h);
428
+ var i = y(n, "onDeactivate"), c = y(n, "onPostDeactivate"), l = y(n, "checkCanReturnFocus"), b = y(n, "returnFocus", "returnFocusOnDeactivate");
429
+ i == null || i();
430
+ var s = function() {
431
+ U(function() {
432
+ b && g(M(a.nodeFocusedBeforeActivation)), c == null || c();
433
+ });
434
+ };
435
+ return b && l ? (l(M(a.nodeFocusedBeforeActivation)).then(s, s), this) : (s(), this);
436
+ },
437
+ pause: function(e) {
438
+ return a.active ? (a.manuallyPaused = !0, this._setPausedState(!0, e)) : this;
439
+ },
440
+ unpause: function(e) {
441
+ return a.active ? (a.manuallyPaused = !1, m[m.length - 1] !== this ? this : this._setPausedState(!1, e)) : this;
442
+ },
443
+ updateContainerElements: function(e) {
444
+ var n = [].concat(e).filter(Boolean);
445
+ return a.containers = n.map(function(i) {
446
+ return typeof i == "string" ? u.querySelector(i) : i;
447
+ }), a.active && P(), D(), this;
448
+ }
449
+ }, Object.defineProperties(h, {
450
+ _isManuallyPaused: {
451
+ value: function() {
452
+ return a.manuallyPaused;
453
+ }
454
+ },
455
+ _setPausedState: {
456
+ value: function(e, n) {
457
+ if (a.paused === e)
458
+ return this;
459
+ if (a.paused = e, e) {
460
+ var i = y(n, "onPause"), c = y(n, "onPostPause");
461
+ i == null || i(), z(), D(), c == null || c();
462
+ } else {
463
+ var l = y(n, "onUnpause"), b = y(n, "onPostUnpause");
464
+ l == null || l(), P(), W(), D(), b == null || b();
465
+ }
466
+ return this;
467
+ }
468
+ }
469
+ }), h.updateContainerElements(t), h;
195
470
  };
196
471
  export {
197
- z as focusable,
198
- R as getTabIndex,
199
- X as isFocusable,
200
- G as isTabbable,
201
- Z as tabbable
472
+ he as createFocusTrap
202
473
  };