@cfx-dev/ui-components 4.2.24 → 4.3.0

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 (176) hide show
  1. package/dist/Combination-CSgOhzm-.js +2198 -0
  2. package/dist/Combination-N-vN9BB-.js +823 -0
  3. package/dist/Table.module-DHI1mXN2.js +17 -0
  4. package/dist/assets/all_css.css +1 -0
  5. package/dist/assets/css/Checkbox.css +1 -1
  6. package/dist/assets/css/DataTable.css +1 -0
  7. package/dist/assets/css/Table.css +1 -1
  8. package/dist/assets/general/global.css +1 -1
  9. package/dist/cfxIcons-B9nzO6TW.js +98 -0
  10. package/dist/components/Accordion/Accordion.js +25 -26
  11. package/dist/components/Accordion/AccordionShowcase.js +1 -1
  12. package/dist/components/Avatar/Avatar.d.ts +2 -1
  13. package/dist/components/Avatar/Avatar.js +21 -20
  14. package/dist/components/Avatar/AvatarShowcase.js +1 -1
  15. package/dist/components/Badge/Badge.d.ts +2 -1
  16. package/dist/components/Badge/Badge.js +29 -29
  17. package/dist/components/Badge/BadgeShowcase.js +1 -1
  18. package/dist/components/BurgerMenu/BurgerMenu.js +2 -2
  19. package/dist/components/BurgerMenu/BurgerMenuButton.js +1 -1
  20. package/dist/components/BurgerMenu/BurgerMenuShowcase.js +1 -1
  21. package/dist/components/Button/Button.d.ts +5 -2
  22. package/dist/components/Button/Button.js +83 -81
  23. package/dist/components/Button/ButtonShowcase.js +2 -2
  24. package/dist/components/Button/LinkButton.d.ts +1 -1
  25. package/dist/components/Button/LinkButton.js +18 -17
  26. package/dist/components/Button/index.d.ts +1 -1
  27. package/dist/components/Button/index.js +7 -7
  28. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  29. package/dist/components/Checkbox/Checkbox.js +154 -242
  30. package/dist/components/ClipboardButton/ClipboardButton.js +7 -7
  31. package/dist/components/ControlBox/ControlBox.d.ts +3 -2
  32. package/dist/components/ControlBox/ControlBox.js +13 -10
  33. package/dist/components/CountryFlag/CountryFlag.d.ts +3 -2
  34. package/dist/components/CountryFlag/CountryFlag.js +14 -11
  35. package/dist/components/DataTable/DataTable.d.ts +40 -0
  36. package/dist/components/DataTable/DataTable.js +163 -0
  37. package/dist/components/DataTable/DataTableShowcase.d.ts +5 -0
  38. package/dist/components/DataTable/DataTableShowcase.js +60 -0
  39. package/dist/components/DataTable/index.d.ts +2 -0
  40. package/dist/components/DataTable/index.js +6 -0
  41. package/dist/components/Decorate/Decorate.d.ts +3 -2
  42. package/dist/components/Decorate/Decorate.js +19 -15
  43. package/dist/components/Dot/Dot.d.ts +2 -1
  44. package/dist/components/Dot/Dot.js +15 -13
  45. package/dist/components/DropdownSelect/DropdownSelect.d.ts +2 -1
  46. package/dist/components/DropdownSelect/DropdownSelect.js +665 -1836
  47. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +1 -1
  48. package/dist/components/Flyout/Flyout.d.ts +2 -1
  49. package/dist/components/Flyout/Flyout.js +22 -20
  50. package/dist/components/Icon/Icon.d.ts +2 -1
  51. package/dist/components/Icon/Icon.js +19 -17
  52. package/dist/components/IconBig/IconBig.d.ts +2 -1
  53. package/dist/components/IconBig/IconBig.js +16 -14
  54. package/dist/components/Icons/IconsShowcase.js +1 -1
  55. package/dist/components/Icons/cfx-icons/Radio.d.ts +5 -0
  56. package/dist/components/Icons/cfx-icons/Radio.js +36 -0
  57. package/dist/components/Icons/cfx-icons/Square.js +15 -9
  58. package/dist/components/Icons/cfxIcons.d.ts +1 -0
  59. package/dist/components/Icons/cfxIcons.js +62 -60
  60. package/dist/components/Icons/index.js +1 -1
  61. package/dist/components/Indicator/Indicator.js +9 -10
  62. package/dist/components/InfoPanel/InfoPanelShowcase.js +1 -1
  63. package/dist/components/Input/Input.d.ts +4 -1
  64. package/dist/components/Input/Input.js +101 -88
  65. package/dist/components/Input/InputShowcase.js +1 -1
  66. package/dist/components/Input/RichInput.d.ts +2 -1
  67. package/dist/components/Input/RichInput.js +37 -34
  68. package/dist/components/InputDropzone/InputDropzone.d.ts +1 -1
  69. package/dist/components/InputDropzone/InputDropzone.js +1723 -625
  70. package/dist/components/Interactive/Interactive.d.ts +2 -1
  71. package/dist/components/Interactive/Interactive.js +14 -12
  72. package/dist/components/Island/Island.d.ts +2 -1
  73. package/dist/components/Island/Island.js +24 -24
  74. package/dist/components/Layout/Box/Box.d.ts +8 -2
  75. package/dist/components/Layout/Box/Box.js +53 -51
  76. package/dist/components/Layout/Box/Box.types.d.ts +22 -0
  77. package/dist/components/Layout/Box/Box.types.js +4 -0
  78. package/dist/components/Layout/Box/index.d.ts +1 -1
  79. package/dist/components/Layout/Box/index.js +3 -3
  80. package/dist/components/Layout/Center/Center.d.ts +2 -1
  81. package/dist/components/Layout/Center/Center.js +19 -18
  82. package/dist/components/Layout/Flex/Flex.d.ts +6 -10
  83. package/dist/components/Layout/Flex/Flex.js +53 -64
  84. package/dist/components/Layout/Flex/FlexRestricter.d.ts +2 -1
  85. package/dist/components/Layout/Flex/FlexRestricter.js +13 -12
  86. package/dist/components/Layout/Flex/FlexShowcase.js +1 -1
  87. package/dist/components/Layout/Flex/index.d.ts +2 -2
  88. package/dist/components/Layout/Flex/index.js +8 -8
  89. package/dist/components/Layout/Page/Page.js +11 -12
  90. package/dist/components/Layout/Scrollable/Rail.d.ts +1 -1
  91. package/dist/components/Layout/Scrollable/Scrollable.d.ts +2 -1
  92. package/dist/components/Layout/Scrollable/Scrollable.js +40 -38
  93. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -1
  94. package/dist/components/Layout/Scrollable/VirtualScrollable.js +98 -98
  95. package/dist/components/Link/LinkShowcase.js +1 -1
  96. package/dist/components/Loaf/Loaf.d.ts +2 -1
  97. package/dist/components/Loaf/Loaf.js +17 -16
  98. package/dist/components/Logos/LogosShowcase.js +1 -1
  99. package/dist/components/Modal/Modal.js +16 -17
  100. package/dist/components/Modal/ModalShowcase.js +14 -11
  101. package/dist/components/NavList/NavList.d.ts +2 -1
  102. package/dist/components/NavList/NavList.js +19 -18
  103. package/dist/components/OnScreenSensor.js +1 -1
  104. package/dist/components/Overlay/Overlay.d.ts +4 -2
  105. package/dist/components/Overlay/Overlay.js +31 -23
  106. package/dist/components/Popover/Popover.d.ts +3 -2
  107. package/dist/components/Popover/Popover.js +31 -30
  108. package/dist/components/Popover/PopoverShowcase.js +4 -4
  109. package/dist/components/PremiumBadge/PremiumBadge.d.ts +2 -1
  110. package/dist/components/PremiumBadge/PremiumBadge.js +12 -11
  111. package/dist/components/Select/Select.d.ts +1 -1
  112. package/dist/components/Select/Select.js +666 -1617
  113. package/dist/components/Select/SelectShowcase.js +1 -1
  114. package/dist/components/Shroud/Shroud.d.ts +2 -1
  115. package/dist/components/Shroud/Shroud.js +16 -14
  116. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  117. package/dist/components/Skeleton/Skeleton.js +26 -27
  118. package/dist/components/Skeleton/SkeletonShowcase.js +4 -4
  119. package/dist/components/Slider/Slider.d.ts +2 -1
  120. package/dist/components/Slider/Slider.js +326 -377
  121. package/dist/components/Slider/SliderShowcase.js +1 -1
  122. package/dist/components/Switch/Switch.js +109 -155
  123. package/dist/components/Table/TableBody.d.ts +8 -0
  124. package/dist/components/Table/TableBody.js +14 -0
  125. package/dist/components/Table/TableCell.d.ts +11 -0
  126. package/dist/components/Table/TableCell.js +54 -0
  127. package/dist/components/Table/TableCellCheckbox.d.ts +11 -0
  128. package/dist/components/Table/TableCellCheckbox.js +20 -0
  129. package/dist/components/Table/TableHeader.d.ts +9 -0
  130. package/dist/components/Table/TableHeader.js +24 -0
  131. package/dist/components/Table/TableIconButton.d.ts +6 -0
  132. package/dist/components/Table/TableIconButton.js +16 -0
  133. package/dist/components/Table/TableRoot.d.ts +8 -0
  134. package/dist/components/Table/TableRoot.js +23 -0
  135. package/dist/components/Table/TableRow.d.ts +13 -0
  136. package/dist/components/Table/TableRow.js +46 -0
  137. package/dist/components/Table/TableShowcase.js +56 -57
  138. package/dist/components/Table/index.d.ts +20 -2
  139. package/dist/components/Table/index.js +17 -5
  140. package/dist/components/Tabular/TabularShowcase.js +1 -1
  141. package/dist/components/Text/Text.d.ts +6 -3
  142. package/dist/components/Text/Text.js +67 -63
  143. package/dist/components/Text/TextShowcase.js +40 -33
  144. package/dist/components/Title/Title.d.ts +3 -1
  145. package/dist/components/Title/TitleShowcase.js +1 -1
  146. package/dist/components/ToggleGroup/ToggleGroupShowcase.js +1 -1
  147. package/dist/index-BHuChyf5.js +238 -0
  148. package/dist/index-Cl_RnsqN.js +386 -0
  149. package/dist/index-DZEAOJqB.js +53 -0
  150. package/dist/index-HDl8nGsm.js +70 -0
  151. package/dist/main.d.ts +6 -4
  152. package/dist/main.js +66 -65
  153. package/dist/{medium-BA3EQDZW.js → medium-Bq5NvyU7.js} +1 -1
  154. package/dist/styles-scss/global.scss +1 -0
  155. package/dist/tslib.es6-CtHwNPxX.js +72 -0
  156. package/dist/utils/hooks/useClipboardComponent.d.ts +1 -1
  157. package/dist/utils/hooks/useOutlet.js +1 -1
  158. package/dist/utils/hooks/usePopoverController.d.ts +1 -1
  159. package/dist/utils/links.js +1 -1
  160. package/dist/utils/mergeRefs.d.ts +1 -1
  161. package/dist/utils/mergeRefs.js +1 -1
  162. package/dist/utils/ui/ui.d.ts +1 -0
  163. package/dist/utils/ui/ui.js +45 -36
  164. package/dist/utils/ui/ui.types.d.ts +4 -0
  165. package/package.json +6 -5
  166. package/dist/Combination-Cbiw1XRb.js +0 -792
  167. package/dist/cfxIcons-BNd1WgpX.js +0 -96
  168. package/dist/components/Table/Table.d.ts +0 -42
  169. package/dist/components/Table/Table.js +0 -170
  170. package/dist/index-2hJuj4UN.js +0 -19069
  171. package/dist/index-AweK2ufS.js +0 -171
  172. package/dist/index-BlbvKsmN.js +0 -82
  173. package/dist/index-ByaXH_ih.js +0 -10
  174. package/dist/index-Bz27DCHt.js +0 -1342
  175. package/dist/index-Cf5Yu9oD.js +0 -67
  176. package/dist/tslib.es6-CBKHJX9H.js +0 -151
@@ -1,792 +0,0 @@
1
- import { a as z, _ as br } from "./inheritsLoose-CyjgKRgL.js";
2
- import * as b from "react";
3
- import pr, { createContext as hr, PureComponent as yr } from "react";
4
- import { P as Se, p as v } from "./index-DQMInta3.js";
5
- import { a as ee, c as gr, u as Fr } from "./medium-BA3EQDZW.js";
6
- function Er(e, r) {
7
- if (e == null) return {};
8
- var n = {};
9
- for (var t in e) if ({}.hasOwnProperty.call(e, t)) {
10
- if (r.includes(t)) continue;
11
- n[t] = e[t];
12
- }
13
- return n;
14
- }
15
- var J = "data-focus-lock", Ie = "data-focus-lock-disabled", Or = "data-no-focus-lock", xr = "data-autofocus-inside", wr = "data-no-autofocus", $ = {
16
- width: "1px",
17
- height: "0px",
18
- padding: 0,
19
- overflow: "hidden",
20
- position: "fixed",
21
- top: "1px",
22
- left: "1px"
23
- };
24
- process.env.NODE_ENV !== "production" && Se.node;
25
- var Ne = ee({}, function(e) {
26
- var r = e.target, n = e.currentTarget;
27
- return {
28
- target: r,
29
- currentTarget: n
30
- };
31
- }), Te = ee(), Sr = ee(), Ir = gr({
32
- async: !0,
33
- ssr: typeof document < "u"
34
- }), Nr = /* @__PURE__ */ hr(void 0), Tr = [], re = /* @__PURE__ */ b.forwardRef(function(r, n) {
35
- var t, o = b.useState(), u = o[0], a = o[1], c = b.useRef(), h = b.useRef(!1), i = b.useRef(null), m = b.useState({}), f = m[1], d = r.children, p = r.disabled, s = p === void 0 ? !1 : p, l = r.noFocusGuards, y = l === void 0 ? !1 : l, F = r.persistentFocus, g = F === void 0 ? !1 : F, O = r.crossFrame, W = O === void 0 ? !0 : O, k = r.autoFocus, Ye = k === void 0 ? !0 : k, ze = r.allowTextSelection, Je = r.group, Qe = r.className, Xe = r.whiteList, Ze = r.hasPositiveIndices, le = r.shards, H = le === void 0 ? Tr : le, ve = r.as, me = ve === void 0 ? "div" : ve, be = r.lockProps, er = be === void 0 ? {} : be, rr = r.sideCar, pe = r.returnFocus, U = pe === void 0 ? !1 : pe, nr = r.focusOptions, V = r.onActivation, j = r.onDeactivation, tr = b.useState({}), or = tr[0], ur = b.useCallback(function(x) {
36
- var N = x.captureFocusRestore;
37
- if (!i.current) {
38
- var T, w = (T = document) == null ? void 0 : T.activeElement;
39
- i.current = w, w !== document.body && (i.current = N(w));
40
- }
41
- c.current && V && V(c.current), h.current = !0, f();
42
- }, [V]), ar = b.useCallback(function() {
43
- h.current = !1, j && j(c.current), f();
44
- }, [j]), ir = b.useCallback(function(x) {
45
- var N = i.current;
46
- if (N) {
47
- var T = (typeof N == "function" ? N() : N) || document.body, w = typeof U == "function" ? U(T) : U;
48
- if (w) {
49
- var ye = typeof w == "object" ? w : void 0;
50
- i.current = null, x ? Promise.resolve().then(function() {
51
- return T.focus(ye);
52
- }) : T.focus(ye);
53
- }
54
- }
55
- }, [U]), cr = b.useCallback(function(x) {
56
- h.current && Ne.useMedium(x);
57
- }, []), fr = Te.useMedium, sr = b.useCallback(function(x) {
58
- c.current !== x && (c.current = x, a(x));
59
- }, []);
60
- process.env.NODE_ENV !== "production" && (typeof ze < "u" && console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"), b.useEffect(function() {
61
- !c.current && typeof me != "string" && console.error("FocusLock: could not obtain ref to internal node");
62
- }, []));
63
- var dr = z((t = {}, t[Ie] = s && "disabled", t[J] = Je, t), er), he = y !== !0, lr = he && y !== "tail", vr = Fr([n, sr]), mr = b.useMemo(function() {
64
- return {
65
- observed: c,
66
- shards: H,
67
- enabled: !s,
68
- active: h.current
69
- };
70
- }, [s, h.current, H, u]);
71
- return /* @__PURE__ */ b.createElement(b.Fragment, null, he && [
72
- /* @__PURE__ */ b.createElement("div", {
73
- key: "guard-first",
74
- "data-focus-guard": !0,
75
- tabIndex: s ? -1 : 0,
76
- style: $
77
- }),
78
- Ze ? /* @__PURE__ */ b.createElement("div", {
79
- key: "guard-nearest",
80
- "data-focus-guard": !0,
81
- tabIndex: s ? -1 : 1,
82
- style: $
83
- }) : null
84
- ], !s && /* @__PURE__ */ b.createElement(rr, {
85
- id: or,
86
- sideCar: Ir,
87
- observed: u,
88
- disabled: s,
89
- persistentFocus: g,
90
- crossFrame: W,
91
- autoFocus: Ye,
92
- whiteList: Xe,
93
- shards: H,
94
- onActivation: ur,
95
- onDeactivation: ar,
96
- returnFocus: ir,
97
- focusOptions: nr
98
- }), /* @__PURE__ */ b.createElement(me, z({
99
- ref: vr
100
- }, dr, {
101
- className: Qe,
102
- onBlur: fr,
103
- onFocus: cr
104
- }), /* @__PURE__ */ b.createElement(Nr.Provider, {
105
- value: mr
106
- }, d)), lr && /* @__PURE__ */ b.createElement("div", {
107
- "data-focus-guard": !0,
108
- tabIndex: s ? -1 : 0,
109
- style: $
110
- }));
111
- });
112
- re.propTypes = process.env.NODE_ENV !== "production" ? {
113
- children: v.node,
114
- disabled: v.bool,
115
- returnFocus: v.oneOfType([v.bool, v.object, v.func]),
116
- focusOptions: v.object,
117
- noFocusGuards: v.bool,
118
- hasPositiveIndices: v.bool,
119
- allowTextSelection: v.bool,
120
- autoFocus: v.bool,
121
- persistentFocus: v.bool,
122
- crossFrame: v.bool,
123
- group: v.string,
124
- className: v.string,
125
- whiteList: v.func,
126
- shards: v.arrayOf(v.any),
127
- as: v.oneOfType([v.string, v.func, v.object]),
128
- lockProps: v.object,
129
- onActivation: v.func,
130
- onDeactivation: v.func,
131
- sideCar: v.any.isRequired
132
- } : {};
133
- function M(e) {
134
- "@babel/helpers - typeof";
135
- return M = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
136
- return typeof r;
137
- } : function(r) {
138
- return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
139
- }, M(e);
140
- }
141
- function Pr(e, r) {
142
- if (M(e) != "object" || !e) return e;
143
- var n = e[Symbol.toPrimitive];
144
- if (n !== void 0) {
145
- var t = n.call(e, r || "default");
146
- if (M(t) != "object") return t;
147
- throw new TypeError("@@toPrimitive must return a primitive value.");
148
- }
149
- return (r === "string" ? String : Number)(e);
150
- }
151
- function Ar(e) {
152
- var r = Pr(e, "string");
153
- return M(r) == "symbol" ? r : r + "";
154
- }
155
- function Dr(e, r, n) {
156
- return (r = Ar(r)) in e ? Object.defineProperty(e, r, {
157
- value: n,
158
- enumerable: !0,
159
- configurable: !0,
160
- writable: !0
161
- }) : e[r] = n, e;
162
- }
163
- function Cr(e, r) {
164
- if (process.env.NODE_ENV !== "production") {
165
- if (typeof e != "function")
166
- throw new Error("Expected reducePropsToState to be a function.");
167
- if (typeof r != "function")
168
- throw new Error("Expected handleStateChangeOnClient to be a function.");
169
- }
170
- function n(t) {
171
- return t.displayName || t.name || "Component";
172
- }
173
- return function(o) {
174
- if (process.env.NODE_ENV !== "production" && typeof o != "function")
175
- throw new Error("Expected WrappedComponent to be a React component.");
176
- var u = [], a;
177
- function c() {
178
- a = e(u.map(function(i) {
179
- return i.props;
180
- })), r(a);
181
- }
182
- var h = /* @__PURE__ */ function(i) {
183
- br(m, i);
184
- function m() {
185
- return i.apply(this, arguments) || this;
186
- }
187
- m.peek = function() {
188
- return a;
189
- };
190
- var f = m.prototype;
191
- return f.componentDidMount = function() {
192
- u.push(this), c();
193
- }, f.componentDidUpdate = function() {
194
- c();
195
- }, f.componentWillUnmount = function() {
196
- var p = u.indexOf(this);
197
- u.splice(p, 1), c();
198
- }, f.render = function() {
199
- return /* @__PURE__ */ pr.createElement(o, this.props);
200
- }, m;
201
- }(yr);
202
- return Dr(h, "displayName", "SideEffect(" + n(o) + ")"), h;
203
- };
204
- }
205
- var E = function(e) {
206
- for (var r = Array(e.length), n = 0; n < e.length; ++n)
207
- r[n] = e[n];
208
- return r;
209
- }, I = function(e) {
210
- return Array.isArray(e) ? e : [e];
211
- }, Pe = function(e) {
212
- return Array.isArray(e) ? e[0] : e;
213
- }, kr = function(e) {
214
- if (e.nodeType !== Node.ELEMENT_NODE)
215
- return !1;
216
- var r = window.getComputedStyle(e, null);
217
- return !r || !r.getPropertyValue ? !1 : r.getPropertyValue("display") === "none" || r.getPropertyValue("visibility") === "hidden";
218
- }, Ae = function(e) {
219
- return e.parentNode && e.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? (
220
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
221
- e.parentNode.host
222
- ) : e.parentNode;
223
- }, De = function(e) {
224
- return e === document || e && e.nodeType === Node.DOCUMENT_NODE;
225
- }, _r = function(e) {
226
- return e.hasAttribute("inert");
227
- }, Mr = function(e, r) {
228
- return !e || De(e) || !kr(e) && !_r(e) && r(Ae(e));
229
- }, Ce = function(e, r) {
230
- var n = e.get(r);
231
- if (n !== void 0)
232
- return n;
233
- var t = Mr(r, Ce.bind(void 0, e));
234
- return e.set(r, t), t;
235
- }, Lr = function(e, r) {
236
- return e && !De(e) ? Ur(e) ? r(Ae(e)) : !1 : !0;
237
- }, ke = function(e, r) {
238
- var n = e.get(r);
239
- if (n !== void 0)
240
- return n;
241
- var t = Lr(r, ke.bind(void 0, e));
242
- return e.set(r, t), t;
243
- }, _e = function(e) {
244
- return e.dataset;
245
- }, Rr = function(e) {
246
- return e.tagName === "BUTTON";
247
- }, Me = function(e) {
248
- return e.tagName === "INPUT";
249
- }, Le = function(e) {
250
- return Me(e) && e.type === "radio";
251
- }, Wr = function(e) {
252
- return !((Me(e) || Rr(e)) && (e.type === "hidden" || e.disabled));
253
- }, Ur = function(e) {
254
- var r = e.getAttribute(wr);
255
- return ![!0, "true", ""].includes(r);
256
- }, ne = function(e) {
257
- var r;
258
- return !!(e && (!((r = _e(e)) === null || r === void 0) && r.focusGuard));
259
- }, Q = function(e) {
260
- return !ne(e);
261
- }, Br = function(e) {
262
- return !!e;
263
- }, Gr = function(e, r) {
264
- var n = Math.max(0, e.tabIndex), t = Math.max(0, r.tabIndex), o = n - t, u = e.index - r.index;
265
- if (o) {
266
- if (!n)
267
- return 1;
268
- if (!t)
269
- return -1;
270
- }
271
- return o || u;
272
- }, Hr = function(e) {
273
- return e.tabIndex < 0 && !e.hasAttribute("tabindex") ? 0 : e.tabIndex;
274
- }, te = function(e, r, n) {
275
- return E(e).map(function(t, o) {
276
- var u = Hr(t);
277
- return {
278
- node: t,
279
- index: o,
280
- tabIndex: n && u === -1 ? (t.dataset || {}).focusGuard ? 0 : -1 : u
281
- };
282
- }).filter(function(t) {
283
- return !r || t.tabIndex >= 0;
284
- }).sort(Gr);
285
- }, Vr = [
286
- "button:enabled",
287
- "select:enabled",
288
- "textarea:enabled",
289
- "input:enabled",
290
- // elements with explicit roles will also use explicit tabindex
291
- // '[role="button"]',
292
- "a[href]",
293
- "area[href]",
294
- "summary",
295
- "iframe",
296
- "object",
297
- "embed",
298
- "audio[controls]",
299
- "video[controls]",
300
- "[tabindex]",
301
- "[contenteditable]",
302
- "[autofocus]"
303
- ], oe = Vr.join(","), jr = "".concat(oe, ", [data-focus-guard]"), Re = function(e, r) {
304
- return E((e.shadowRoot || e).children).reduce(function(n, t) {
305
- return n.concat(t.matches(r ? jr : oe) ? [t] : [], Re(t));
306
- }, []);
307
- }, $r = function(e, r) {
308
- var n;
309
- return e instanceof HTMLIFrameElement && (!((n = e.contentDocument) === null || n === void 0) && n.body) ? C([e.contentDocument.body], r) : [e];
310
- }, C = function(e, r) {
311
- return e.reduce(function(n, t) {
312
- var o, u = Re(t, r), a = (o = []).concat.apply(o, u.map(function(c) {
313
- return $r(c, r);
314
- }));
315
- return n.concat(
316
- // add all tabbables inside and within shadow DOMs in DOM order
317
- a,
318
- // add if node is tabbable itself
319
- t.parentNode ? E(t.parentNode.querySelectorAll(oe)).filter(function(c) {
320
- return c === t;
321
- }) : []
322
- );
323
- }, []);
324
- }, qr = function(e) {
325
- var r = e.querySelectorAll("[".concat(xr, "]"));
326
- return E(r).map(function(n) {
327
- return C([n]);
328
- }).reduce(function(n, t) {
329
- return n.concat(t);
330
- }, []);
331
- }, ue = function(e, r) {
332
- return E(e).filter(function(n) {
333
- return Ce(r, n);
334
- }).filter(function(n) {
335
- return Wr(n);
336
- });
337
- }, ge = function(e, r) {
338
- return r === void 0 && (r = /* @__PURE__ */ new Map()), E(e).filter(function(n) {
339
- return ke(r, n);
340
- });
341
- }, ae = function(e, r, n) {
342
- return te(ue(C(e, n), r), !0, n);
343
- }, B = function(e, r) {
344
- return te(ue(C(e), r), !1);
345
- }, Kr = function(e, r) {
346
- return ue(qr(e), r);
347
- }, S = function(e, r) {
348
- return e.shadowRoot ? S(e.shadowRoot, r) : Object.getPrototypeOf(e).contains !== void 0 && Object.getPrototypeOf(e).contains.call(e, r) ? !0 : E(e.children).some(function(n) {
349
- var t;
350
- if (n instanceof HTMLIFrameElement) {
351
- var o = (t = n.contentDocument) === null || t === void 0 ? void 0 : t.body;
352
- return o ? S(o, r) : !1;
353
- }
354
- return S(n, r);
355
- });
356
- }, Yr = function(e) {
357
- for (var r = /* @__PURE__ */ new Set(), n = e.length, t = 0; t < n; t += 1)
358
- for (var o = t + 1; o < n; o += 1) {
359
- var u = e[t].compareDocumentPosition(e[o]);
360
- (u & Node.DOCUMENT_POSITION_CONTAINED_BY) > 0 && r.add(o), (u & Node.DOCUMENT_POSITION_CONTAINS) > 0 && r.add(t);
361
- }
362
- return e.filter(function(a, c) {
363
- return !r.has(c);
364
- });
365
- }, We = function(e) {
366
- return e.parentNode ? We(e.parentNode) : e;
367
- }, ie = function(e) {
368
- var r = I(e);
369
- return r.filter(Boolean).reduce(function(n, t) {
370
- var o = t.getAttribute(J);
371
- return n.push.apply(n, o ? Yr(E(We(t).querySelectorAll("[".concat(J, '="').concat(o, '"]:not([').concat(Ie, '="disabled"])')))) : [t]), n;
372
- }, []);
373
- }, zr = function(e) {
374
- try {
375
- return e();
376
- } catch {
377
- return;
378
- }
379
- }, L = function(e) {
380
- if (e === void 0 && (e = document), !(!e || !e.activeElement)) {
381
- var r = e.activeElement;
382
- return r.shadowRoot ? L(r.shadowRoot) : r instanceof HTMLIFrameElement && zr(function() {
383
- return r.contentWindow.document;
384
- }) ? L(r.contentWindow.document) : r;
385
- }
386
- }, Jr = function(e, r) {
387
- return e === r;
388
- }, Qr = function(e, r) {
389
- return !!E(e.querySelectorAll("iframe")).some(function(n) {
390
- return Jr(n, r);
391
- });
392
- }, Ue = function(e, r) {
393
- return r === void 0 && (r = L(Pe(e).ownerDocument)), !r || r.dataset && r.dataset.focusGuard ? !1 : ie(e).some(function(n) {
394
- return S(n, r) || Qr(n, r);
395
- });
396
- }, Xr = function(e) {
397
- e === void 0 && (e = document);
398
- var r = L(e);
399
- return r ? E(e.querySelectorAll("[".concat(Or, "]"))).some(function(n) {
400
- return S(n, r);
401
- }) : !1;
402
- }, Zr = function(e, r) {
403
- return r.filter(Le).filter(function(n) {
404
- return n.name === e.name;
405
- }).filter(function(n) {
406
- return n.checked;
407
- })[0] || e;
408
- }, ce = function(e, r) {
409
- return Le(e) && e.name ? Zr(e, r) : e;
410
- }, en = function(e) {
411
- var r = /* @__PURE__ */ new Set();
412
- return e.forEach(function(n) {
413
- return r.add(ce(n, e));
414
- }), e.filter(function(n) {
415
- return r.has(n);
416
- });
417
- }, Fe = function(e) {
418
- return e[0] && e.length > 1 ? ce(e[0], e) : e[0];
419
- }, Ee = function(e, r) {
420
- return e.indexOf(ce(r, e));
421
- }, X = "NEW_FOCUS", rn = function(e, r, n, t, o) {
422
- var u = e.length, a = e[0], c = e[u - 1], h = ne(t);
423
- if (!(t && e.indexOf(t) >= 0)) {
424
- var i = t !== void 0 ? n.indexOf(t) : -1, m = o ? n.indexOf(o) : i, f = o ? e.indexOf(o) : -1;
425
- if (i === -1)
426
- return f !== -1 ? f : X;
427
- if (f === -1)
428
- return X;
429
- var d = i - m, p = n.indexOf(a), s = n.indexOf(c), l = en(n), y = t !== void 0 ? l.indexOf(t) : -1, F = y - (o ? l.indexOf(o) : i);
430
- if (!d && f >= 0 || r.length === 0)
431
- return f;
432
- var g = Ee(e, r[0]), O = Ee(e, r[r.length - 1]);
433
- if (i <= p && h && Math.abs(d) > 1)
434
- return O;
435
- if (i >= s && h && Math.abs(d) > 1)
436
- return g;
437
- if (d && Math.abs(F) > 1)
438
- return f;
439
- if (i <= p)
440
- return O;
441
- if (i > s)
442
- return g;
443
- if (d)
444
- return Math.abs(d) > 1 ? f : (u + f + d) % u;
445
- }
446
- }, nn = function(e) {
447
- return function(r) {
448
- var n, t = (n = _e(r)) === null || n === void 0 ? void 0 : n.autofocus;
449
- return (
450
- // @ts-expect-error
451
- r.autofocus || //
452
- t !== void 0 && t !== "false" || //
453
- e.indexOf(r) >= 0
454
- );
455
- };
456
- }, Oe = function(e, r, n) {
457
- var t = e.map(function(u) {
458
- var a = u.node;
459
- return a;
460
- }), o = ge(t.filter(nn(n)));
461
- return o && o.length ? Fe(o) : Fe(ge(r));
462
- }, Z = function(e, r) {
463
- return r === void 0 && (r = []), r.push(e), e.parentNode && Z(e.parentNode.host || e.parentNode, r), r;
464
- }, q = function(e, r) {
465
- for (var n = Z(e), t = Z(r), o = 0; o < n.length; o += 1) {
466
- var u = n[o];
467
- if (t.indexOf(u) >= 0)
468
- return u;
469
- }
470
- return !1;
471
- }, Be = function(e, r, n) {
472
- var t = I(e), o = I(r), u = t[0], a = !1;
473
- return o.filter(Boolean).forEach(function(c) {
474
- a = q(a || c, c) || a, n.filter(Boolean).forEach(function(h) {
475
- var i = q(u, h);
476
- i && (!a || S(i, a) ? a = i : a = q(i, a));
477
- });
478
- }), a;
479
- }, xe = function(e, r) {
480
- return e.reduce(function(n, t) {
481
- return n.concat(Kr(t, r));
482
- }, []);
483
- }, tn = function(e, r) {
484
- var n = /* @__PURE__ */ new Map();
485
- return r.forEach(function(t) {
486
- return n.set(t.node, t);
487
- }), e.map(function(t) {
488
- return n.get(t);
489
- }).filter(Br);
490
- }, on = function(e, r) {
491
- var n = L(I(e).length > 0 ? document : Pe(e).ownerDocument), t = ie(e).filter(Q), o = Be(n || e, e, t), u = /* @__PURE__ */ new Map(), a = B(t, u), c = a.filter(function(s) {
492
- var l = s.node;
493
- return Q(l);
494
- });
495
- if (c[0]) {
496
- var h = B([o], u).map(function(s) {
497
- var l = s.node;
498
- return l;
499
- }), i = tn(h, c), m = i.map(function(s) {
500
- var l = s.node;
501
- return l;
502
- }), f = i.filter(function(s) {
503
- var l = s.tabIndex;
504
- return l >= 0;
505
- }).map(function(s) {
506
- var l = s.node;
507
- return l;
508
- }), d = rn(m, f, h, n, r);
509
- if (d === X) {
510
- var p = (
511
- // first try only tabbable, and the fallback to all focusable, as long as at least one element should be picked for focus
512
- Oe(a, f, xe(t, u)) || Oe(a, m, xe(t, u))
513
- );
514
- if (p)
515
- return { node: p };
516
- console.warn("focus-lock: cannot find any node to move focus into");
517
- return;
518
- }
519
- return d === void 0 ? d : i[d];
520
- }
521
- }, un = function(e) {
522
- var r = ie(e).filter(Q), n = Be(e, e, r), t = te(C([n], !0), !0, !0), o = C(r, !1);
523
- return t.map(function(u) {
524
- var a = u.node, c = u.index;
525
- return {
526
- node: a,
527
- index: c,
528
- lockItem: o.indexOf(a) >= 0,
529
- guard: ne(a)
530
- };
531
- });
532
- }, fe = function(e, r) {
533
- e && ("focus" in e && e.focus(r), "contentWindow" in e && e.contentWindow && e.contentWindow.focus());
534
- }, K = 0, Y = !1, Ge = function(e, r, n) {
535
- n === void 0 && (n = {});
536
- var t = on(e, r);
537
- if (!Y && t) {
538
- if (K > 2) {
539
- console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"), Y = !0, setTimeout(function() {
540
- Y = !1;
541
- }, 1);
542
- return;
543
- }
544
- K++, fe(t.node, n.focusOptions), K--;
545
- }
546
- };
547
- function _(e) {
548
- if (!e)
549
- return null;
550
- if (typeof WeakRef > "u")
551
- return function() {
552
- return e || null;
553
- };
554
- var r = e ? new WeakRef(e) : null;
555
- return function() {
556
- return (r == null ? void 0 : r.deref()) || null;
557
- };
558
- }
559
- var an = function(e) {
560
- if (!e)
561
- return null;
562
- for (var r = [], n = e; n && n !== document.body; )
563
- r.push({
564
- current: _(n),
565
- parent: _(n.parentElement),
566
- left: _(n.previousElementSibling),
567
- right: _(n.nextElementSibling)
568
- }), n = n.parentElement;
569
- return {
570
- element: _(e),
571
- stack: r,
572
- ownerDocument: e.ownerDocument
573
- };
574
- }, cn = function(e) {
575
- var r, n, t, o, u;
576
- if (e)
577
- for (var a = e.stack, c = e.ownerDocument, h = /* @__PURE__ */ new Map(), i = 0, m = a; i < m.length; i++) {
578
- var f = m[i], d = (r = f.parent) === null || r === void 0 ? void 0 : r.call(f);
579
- if (d && c.contains(d)) {
580
- for (var p = (n = f.left) === null || n === void 0 ? void 0 : n.call(f), s = f.current(), l = d.contains(s) ? s : void 0, y = (t = f.right) === null || t === void 0 ? void 0 : t.call(f), F = ae([d], h), g = (
581
- // that is element itself
582
- (u = (o = l ?? // or something in it's place
583
- (p == null ? void 0 : p.nextElementSibling)) !== null && o !== void 0 ? o : (
584
- // or somebody to the right, still close enough
585
- y
586
- )) !== null && u !== void 0 ? u : (
587
- // or somebody to the left, something?
588
- p
589
- )
590
- ); g; ) {
591
- for (var O = 0, W = F; O < W.length; O++) {
592
- var k = W[O];
593
- if (g != null && g.contains(k.node))
594
- return k.node;
595
- }
596
- g = g.nextElementSibling;
597
- }
598
- if (F.length)
599
- return F[0].node;
600
- }
601
- }
602
- }, fn = function(e) {
603
- var r = an(e);
604
- return function() {
605
- return cn(r);
606
- };
607
- }, sn = function(e, r, n) {
608
- if (!e || !r)
609
- return console.error("no element or scope given"), {};
610
- var t = I(r);
611
- if (t.every(function(a) {
612
- return !S(a, e);
613
- }))
614
- return console.error("Active element is not contained in the scope"), {};
615
- var o = n ? ae(t, /* @__PURE__ */ new Map()) : B(t, /* @__PURE__ */ new Map()), u = o.findIndex(function(a) {
616
- var c = a.node;
617
- return c === e;
618
- });
619
- if (u !== -1)
620
- return {
621
- prev: o[u - 1],
622
- next: o[u + 1],
623
- first: o[0],
624
- last: o[o.length - 1]
625
- };
626
- }, dn = function(e, r) {
627
- var n = r ? ae(I(e), /* @__PURE__ */ new Map()) : B(I(e), /* @__PURE__ */ new Map());
628
- return {
629
- first: n[0],
630
- last: n[n.length - 1]
631
- };
632
- }, ln = function(e) {
633
- return Object.assign({
634
- scope: document.body,
635
- cycle: !0,
636
- onlyTabbable: !0
637
- }, e);
638
- }, He = function(e, r, n) {
639
- r === void 0 && (r = {});
640
- var t = ln(r), o = sn(e, t.scope, t.onlyTabbable);
641
- if (o) {
642
- var u = n(o, t.cycle);
643
- u && fe(u.node, t.focusOptions);
644
- }
645
- }, vn = function(e, r) {
646
- r === void 0 && (r = {}), He(e, r, function(n, t) {
647
- var o = n.next, u = n.first;
648
- return o || t && u;
649
- });
650
- }, mn = function(e, r) {
651
- r === void 0 && (r = {}), He(e, r, function(n, t) {
652
- var o = n.prev, u = n.last;
653
- return o || t && u;
654
- });
655
- }, Ve = function(e, r, n) {
656
- var t, o = dn(e, (t = r.onlyTabbable) !== null && t !== void 0 ? t : !0), u = o[n];
657
- u && fe(u.node, r.focusOptions);
658
- }, bn = function(e, r) {
659
- r === void 0 && (r = {}), Ve(e, r, "first");
660
- }, pn = function(e, r) {
661
- r === void 0 && (r = {}), Ve(e, r, "last");
662
- };
663
- function se(e) {
664
- setTimeout(e, 1);
665
- }
666
- var hn = function(r) {
667
- return r && "current" in r ? r.current : r;
668
- }, yn = function() {
669
- return document && document.activeElement === document.body;
670
- }, gn = function() {
671
- return yn() || Xr();
672
- }, A = null, P = null, D = null, R = !1, Fn = function() {
673
- return !0;
674
- }, En = function(r) {
675
- return (A.whiteList || Fn)(r);
676
- }, On = function(r, n) {
677
- D = {
678
- observerNode: r,
679
- portaledElement: n
680
- };
681
- }, xn = function(r) {
682
- return D && D.portaledElement === r;
683
- };
684
- function we(e, r, n, t) {
685
- var o = null, u = e;
686
- do {
687
- var a = t[u];
688
- if (a.guard)
689
- a.node.dataset.focusAutoGuard && (o = a);
690
- else if (a.lockItem) {
691
- if (u !== e)
692
- return;
693
- o = null;
694
- } else
695
- break;
696
- } while ((u += n) !== r);
697
- o && (o.node.tabIndex = 0);
698
- }
699
- var wn = function(r) {
700
- return r ? !!R : R === "meanwhile";
701
- }, Sn = function e(r, n, t) {
702
- return n && (n.host === r && (!n.activeElement || t.contains(n.activeElement)) || n.parentNode && e(r, n.parentNode, t));
703
- }, In = function(r, n) {
704
- return n.some(function(t) {
705
- return Sn(r, t, t);
706
- });
707
- }, G = function() {
708
- var r = !1;
709
- if (A) {
710
- var n = A, t = n.observed, o = n.persistentFocus, u = n.autoFocus, a = n.shards, c = n.crossFrame, h = n.focusOptions, i = t || D && D.portaledElement, m = document && document.activeElement;
711
- if (i) {
712
- var f = [i].concat(a.map(hn).filter(Boolean));
713
- if ((!m || En(m)) && (o || wn(c) || !gn() || !P && u) && (i && !(Ue(f) || m && In(m, f) || xn(m)) && (document && !P && m && !u ? (m.blur && m.blur(), document.body.focus()) : (r = Ge(f, P, {
714
- focusOptions: h
715
- }), D = {})), R = !1, P = document && document.activeElement), document && m !== document.activeElement && document.querySelector("[data-focus-auto-guard]")) {
716
- var d = document && document.activeElement, p = un(f), s = p.map(function(l) {
717
- var y = l.node;
718
- return y;
719
- }).indexOf(d);
720
- s > -1 && (p.filter(function(l) {
721
- var y = l.guard, F = l.node;
722
- return y && F.dataset.focusAutoGuard;
723
- }).forEach(function(l) {
724
- var y = l.node;
725
- return y.removeAttribute("tabIndex");
726
- }), we(s, p.length, 1, p), we(s, -1, -1, p));
727
- }
728
- }
729
- }
730
- return r;
731
- }, je = function(r) {
732
- G() && r && (r.stopPropagation(), r.preventDefault());
733
- }, de = function() {
734
- return se(G);
735
- }, Nn = function(r) {
736
- var n = r.target, t = r.currentTarget;
737
- t.contains(n) || On(t, n);
738
- }, Tn = function() {
739
- return null;
740
- };
741
- process.env.NODE_ENV !== "production" && Se.node.isRequired;
742
- var $e = function() {
743
- R = "just", se(function() {
744
- R = "meanwhile";
745
- });
746
- }, Pn = function() {
747
- document.addEventListener("focusin", je), document.addEventListener("focusout", de), window.addEventListener("blur", $e);
748
- }, An = function() {
749
- document.removeEventListener("focusin", je), document.removeEventListener("focusout", de), window.removeEventListener("blur", $e);
750
- };
751
- function Dn(e) {
752
- return e.filter(function(r) {
753
- var n = r.disabled;
754
- return !n;
755
- });
756
- }
757
- var qe = {
758
- moveFocusInside: Ge,
759
- focusInside: Ue,
760
- focusNextElement: vn,
761
- focusPrevElement: mn,
762
- focusFirstElement: bn,
763
- focusLastElement: pn,
764
- captureFocusRestore: fn
765
- };
766
- function Cn(e) {
767
- var r = e.slice(-1)[0];
768
- r && !A && Pn();
769
- var n = A, t = n && r && r.id === n.id;
770
- A = r, n && !t && (n.onDeactivation(), e.filter(function(o) {
771
- var u = o.id;
772
- return u === n.id;
773
- }).length || n.returnFocus(!r)), r ? (P = null, (!t || n.observed !== r.observed) && r.onActivation(qe), G(), se(G)) : (An(), P = null);
774
- }
775
- Ne.assignSyncMedium(Nn);
776
- Te.assignMedium(de);
777
- Sr.assignMedium(function(e) {
778
- return e(qe);
779
- });
780
- const kn = Cr(Dn, Cn)(Tn);
781
- var _n = /* @__PURE__ */ b.forwardRef(function(r, n) {
782
- return /* @__PURE__ */ b.createElement(re, z({
783
- sideCar: kn,
784
- ref: n
785
- }, r));
786
- }), Ke = re.propTypes || {};
787
- Ke.sideCar;
788
- var Mn = Er(Ke, ["sideCar"]);
789
- _n.propTypes = process.env.NODE_ENV !== "production" ? Mn : {};
790
- export {
791
- _n as F
792
- };