@midas-ds/components 1.1.0 → 1.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 (183) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/accordion/AccordionItem.d.ts +2 -2
  3. package/index.cjs +138 -0
  4. package/index.css +1 -0
  5. package/index.d.ts +0 -2
  6. package/index.js +27094 -105
  7. package/package.json +22 -4
  8. package/table/Table.d.ts +3 -4
  9. package/textfield/TextField.d.ts +15 -4
  10. package/theme.cjs +1 -0
  11. package/theme.js +20 -0
  12. package/tokens-BskyMDHv.cjs +1 -0
  13. package/Breadcrumbs.css +0 -1
  14. package/Button-DL6nqUco.js +0 -182
  15. package/Button.css +0 -1
  16. package/ButtonGroup.css +0 -1
  17. package/Card.css +0 -1
  18. package/Checkbox-q0dugR2t.js +0 -402
  19. package/Checkbox.css +0 -1
  20. package/Collection-KMFfVuzU.js +0 -510
  21. package/ComboBox.css +0 -1
  22. package/DatePicker.css +0 -1
  23. package/Dialog-D6Bqrpn-.js +0 -1952
  24. package/Disclosure-dAZYXyTH.js +0 -225
  25. package/Disclosure.css +0 -1
  26. package/DragAndDrop-B0T3WgjL.js +0 -40
  27. package/Dropdown.css +0 -1
  28. package/FileUpload.css +0 -1
  29. package/Flex.css +0 -1
  30. package/Flex.module-CpoxBzQX.js +0 -37
  31. package/FocusScope-B7CkxXNC.js +0 -513
  32. package/Form-BWBjJC6v.js +0 -238
  33. package/Grid.css +0 -1
  34. package/Grid.module-Ia0e9Dix.js +0 -36
  35. package/Group-D7_8007y.js +0 -42
  36. package/Heading-RCRHv6hd.js +0 -15
  37. package/Hidden-CVlUgUJM.js +0 -37
  38. package/InfoBanner.css +0 -1
  39. package/Layout.css +0 -1
  40. package/Link-BnQvB-hH.js +0 -75
  41. package/Link.css +0 -1
  42. package/LinkButton.css +0 -1
  43. package/ListBox-DBBiqvcR.js +0 -474
  44. package/ListKeyboardDelegate-gCXy-Xnn.js +0 -172
  45. package/Logo.css +0 -1
  46. package/Modal.css +0 -1
  47. package/MultiSelect.css +0 -1
  48. package/PressResponder-B4g56kDz.js +0 -31
  49. package/RSPContexts-BW2SEIqe.js +0 -11
  50. package/Radio.css +0 -1
  51. package/SearchField.css +0 -1
  52. package/Select.css +0 -1
  53. package/SelectionManager-BfXUE1qg.js +0 -1031
  54. package/Separator-BBX9m2O2.js +0 -49
  55. package/Spinner.css +0 -1
  56. package/Table.css +0 -1
  57. package/Tabs.css +0 -1
  58. package/Tag-DWt0koFj.js +0 -728
  59. package/Tag.css +0 -1
  60. package/Text-BCF0xvqL.js +0 -15
  61. package/TextArea.css +0 -1
  62. package/TextField-CX4eOQf6.js +0 -225
  63. package/TextField.css +0 -1
  64. package/TextField.module-DdICj682.js +0 -143
  65. package/Toast.css +0 -1
  66. package/VisuallyHidden-Dhr5caPC.js +0 -39
  67. package/chevron-down-Cd1bkzXT.js +0 -13
  68. package/chevron-right-DBMc9VMi.js +0 -23
  69. package/clsx-OuTLNxxd.js +0 -16
  70. package/context-BpJLnOuu.js +0 -80
  71. package/createLucideIcon-DeWljiyi.js +0 -79
  72. package/index-B-jHjTDC.js +0 -120
  73. package/index-BPdc9gJ8.js +0 -3122
  74. package/index-KSgQWWiy.js +0 -26984
  75. package/index10.js +0 -4
  76. package/index11.js +0 -5
  77. package/index12.js +0 -4
  78. package/index13.js +0 -4
  79. package/index14.js +0 -4
  80. package/index15.js +0 -6
  81. package/index16.js +0 -6
  82. package/index17.js +0 -6
  83. package/index18.js +0 -4
  84. package/index19.js +0 -6
  85. package/index2.js +0 -8
  86. package/index20.js +0 -6
  87. package/index21.js +0 -4
  88. package/index22.js +0 -5
  89. package/index23.js +0 -5
  90. package/index24.js +0 -5
  91. package/index25.js +0 -6
  92. package/index26.js +0 -6
  93. package/index27.js +0 -6
  94. package/index28.js +0 -4
  95. package/index29.js +0 -6
  96. package/index3.js +0 -6
  97. package/index30.js +0 -21
  98. package/index31.js +0 -22
  99. package/index32.js +0 -14
  100. package/index33.js +0 -11
  101. package/index34.js +0 -31
  102. package/index35.js +0 -8
  103. package/index36.js +0 -9
  104. package/index37.js +0 -19
  105. package/index38.js +0 -9
  106. package/index39.js +0 -9
  107. package/index4.js +0 -4
  108. package/index40.js +0 -23
  109. package/index41.js +0 -63
  110. package/index42.js +0 -53
  111. package/index43.js +0 -18
  112. package/index44.js +0 -27
  113. package/index45.js +0 -18
  114. package/index46.js +0 -21
  115. package/index47.js +0 -49
  116. package/index48.js +0 -5
  117. package/index49.js +0 -25
  118. package/index5.js +0 -5
  119. package/index50.js +0 -18
  120. package/index51.js +0 -9
  121. package/index52.js +0 -25
  122. package/index53.js +0 -18
  123. package/index54.js +0 -11
  124. package/index55.js +0 -12
  125. package/index56.js +0 -15
  126. package/index57.js +0 -9
  127. package/index58.js +0 -9
  128. package/index59.js +0 -19
  129. package/index6.js +0 -4
  130. package/index60.js +0 -22
  131. package/index61.js +0 -61
  132. package/index62.js +0 -15
  133. package/index63.js +0 -11
  134. package/index64.js +0 -53
  135. package/index65.js +0 -85
  136. package/index66.js +0 -74
  137. package/index67.js +0 -24
  138. package/index68.js +0 -69
  139. package/index69.js +0 -80
  140. package/index7.js +0 -9
  141. package/index70.js +0 -140
  142. package/index71.js +0 -70
  143. package/index72.js +0 -42
  144. package/index73.js +0 -82
  145. package/index74.js +0 -71
  146. package/index75.js +0 -104
  147. package/index76.js +0 -275
  148. package/index77.js +0 -723
  149. package/index78.js +0 -489
  150. package/index79.js +0 -314
  151. package/index8.js +0 -4
  152. package/index80.js +0 -389
  153. package/index81.js +0 -252
  154. package/index82.js +0 -1364
  155. package/index83.js +0 -1009
  156. package/index84.js +0 -386
  157. package/index85.js +0 -2101
  158. package/index86.js +0 -2368
  159. package/index87.js +0 -6831
  160. package/index88.js +0 -17
  161. package/index89.js +0 -14
  162. package/index9.js +0 -5
  163. package/index90.js +0 -6
  164. package/index91.js +0 -9
  165. package/intlStrings-Cd44R5hT.js +0 -278
  166. package/react.esm-sMU8Z7rL.js +0 -11060
  167. package/triangle-alert-1OYl9KWz.js +0 -56
  168. package/useControlledState-Kv9K2AYu.js +0 -30
  169. package/useDescription-B7stiK3j.js +0 -32
  170. package/useEvent-Xk5kn5Ns.js +0 -21
  171. package/useField-DMzJIIN4.js +0 -67
  172. package/useFilter-Bt9dbV1U.js +0 -35
  173. package/useFocusRing-9PXyKy2A.js +0 -1297
  174. package/useFocusable-CcEBZe40.js +0 -59
  175. package/useGridSelectionCheckbox-DYgEnElE.js +0 -22
  176. package/useHasTabbableChild-D6DwR81L.js +0 -34
  177. package/useHighlightSelectionDescription-WYAbP4No.js +0 -552
  178. package/useLabels-9zaZ9oa0.js +0 -17
  179. package/useListState-BfTeKTk5.js +0 -119
  180. package/useLocalizedStringFormatter-BlCbn-hX.js +0 -96
  181. package/useSingleSelectListState-DPkaL0la.js +0 -34
  182. package/useUpdateEffect-Dtz-i14F.js +0 -12
  183. package/x-JK7i-TQC.js +0 -14
@@ -1,1297 +0,0 @@
1
- import L, { useRef as w, useCallback as h, useState as I, useContext as Q, useEffect as B, useMemo as Z, createContext as nt } from "react";
2
- import { c as rt } from "./clsx-OuTLNxxd.js";
3
- const Y = typeof document < "u" ? L.useLayoutEffect : () => {
4
- };
5
- function V(e) {
6
- const t = w(null);
7
- return Y(() => {
8
- t.current = e;
9
- }, [
10
- e
11
- ]), h((...n) => {
12
- const r = t.current;
13
- return r == null ? void 0 : r(...n);
14
- }, []);
15
- }
16
- function at(e) {
17
- let [t, n] = I(e), r = w(null), i = V(() => {
18
- if (!r.current) return;
19
- let o = r.current.next();
20
- if (o.done) {
21
- r.current = null;
22
- return;
23
- }
24
- t === o.value ? i() : n(o.value);
25
- });
26
- Y(() => {
27
- r.current && i();
28
- });
29
- let u = V((o) => {
30
- r.current = o(t), i();
31
- });
32
- return [
33
- t,
34
- u
35
- ];
36
- }
37
- const ue = {
38
- prefix: String(Math.round(Math.random() * 1e10)),
39
- current: 0
40
- }, Ae = /* @__PURE__ */ L.createContext(ue), it = /* @__PURE__ */ L.createContext(!1);
41
- let ot = !!(typeof window < "u" && window.document && window.document.createElement), $e = /* @__PURE__ */ new WeakMap();
42
- function st(e = !1) {
43
- let t = Q(Ae), n = w(null);
44
- if (n.current === null && !e) {
45
- var r, i;
46
- let u = (i = L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || i === void 0 || (r = i.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
47
- if (u) {
48
- let o = $e.get(u);
49
- o == null ? $e.set(u, {
50
- id: t.current,
51
- state: u.memoizedState
52
- }) : u.memoizedState !== o.state && (t.current = o.id, $e.delete(u));
53
- }
54
- n.current = ++t.current;
55
- }
56
- return n.current;
57
- }
58
- function ut(e) {
59
- let t = Q(Ae);
60
- t === ue && !ot && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
61
- let n = st(!!e), r = t === ue && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
62
- return e || `${r}-${n}`;
63
- }
64
- function lt(e) {
65
- let t = L.useId(), [n] = I(De()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${ue.prefix}`;
66
- return e || `${r}-${t}`;
67
- }
68
- const ft = typeof L.useId == "function" ? lt : ut;
69
- function ct() {
70
- return !1;
71
- }
72
- function dt() {
73
- return !0;
74
- }
75
- function pt(e) {
76
- return () => {
77
- };
78
- }
79
- function De() {
80
- return typeof L.useSyncExternalStore == "function" ? L.useSyncExternalStore(pt, ct, dt) : Q(it);
81
- }
82
- let $t = !!(typeof window < "u" && window.document && window.document.createElement), W = /* @__PURE__ */ new Map();
83
- function gt(e) {
84
- let [t, n] = I(e), r = w(null), i = ft(t), u = h((o) => {
85
- r.current = o;
86
- }, []);
87
- return $t && (W.has(i) && !W.get(i).includes(u) ? W.set(i, [
88
- ...W.get(i),
89
- u
90
- ]) : W.set(i, [
91
- u
92
- ])), Y(() => {
93
- let o = i;
94
- return () => {
95
- W.delete(o);
96
- };
97
- }, [
98
- i
99
- ]), B(() => {
100
- let o = r.current;
101
- o && (r.current = null, n(o));
102
- }), i;
103
- }
104
- function bt(e, t) {
105
- if (e === t) return e;
106
- let n = W.get(e);
107
- if (n)
108
- return n.forEach((i) => i(t)), t;
109
- let r = W.get(t);
110
- return r ? (r.forEach((i) => i(e)), e) : t;
111
- }
112
- function on(e = []) {
113
- let t = gt(), [n, r] = at(t), i = h(() => {
114
- r(function* () {
115
- yield t, yield document.getElementById(t) ? t : void 0;
116
- });
117
- }, [
118
- t,
119
- r
120
- ]);
121
- return Y(i, [
122
- t,
123
- i,
124
- ...e
125
- ]), n;
126
- }
127
- function We(...e) {
128
- return (...t) => {
129
- for (let n of e) typeof n == "function" && n(...t);
130
- };
131
- }
132
- const P = (e) => {
133
- var t;
134
- return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
135
- }, K = (e) => e && "window" in e && e.window === e ? e : P(e).defaultView || window;
136
- function we(...e) {
137
- let t = {
138
- ...e[0]
139
- };
140
- for (let n = 1; n < e.length; n++) {
141
- let r = e[n];
142
- for (let i in r) {
143
- let u = t[i], o = r[i];
144
- typeof u == "function" && typeof o == "function" && // This is a lot faster than a regex.
145
- i[0] === "o" && i[1] === "n" && i.charCodeAt(2) >= /* 'A' */
146
- 65 && i.charCodeAt(2) <= /* 'Z' */
147
- 90 ? t[i] = We(u, o) : (i === "className" || i === "UNSAFE_className") && typeof u == "string" && typeof o == "string" ? t[i] = rt(u, o) : i === "id" && u && o ? t.id = bt(u, o) : t[i] = o !== void 0 ? o : u;
148
- }
149
- }
150
- return t;
151
- }
152
- function vt(...e) {
153
- return e.length === 1 && e[0] ? e[0] : (t) => {
154
- for (let n of e)
155
- typeof n == "function" ? n(t) : n != null && (n.current = t);
156
- };
157
- }
158
- const yt = /* @__PURE__ */ new Set([
159
- "id"
160
- ]), ht = /* @__PURE__ */ new Set([
161
- "aria-label",
162
- "aria-labelledby",
163
- "aria-describedby",
164
- "aria-details"
165
- ]), mt = /* @__PURE__ */ new Set([
166
- "href",
167
- "hrefLang",
168
- "target",
169
- "rel",
170
- "download",
171
- "ping",
172
- "referrerPolicy"
173
- ]), Tt = /^(data-.*)$/;
174
- function sn(e, t = {}) {
175
- let { labelable: n, isLink: r, propNames: i } = t, u = {};
176
- for (const o in e) Object.prototype.hasOwnProperty.call(e, o) && (yt.has(o) || n && ht.has(o) || r && mt.has(o) || i != null && i.has(o) || Tt.test(o)) && (u[o] = e[o]);
177
- return u;
178
- }
179
- function U(e) {
180
- if (Et()) e.focus({
181
- preventScroll: !0
182
- });
183
- else {
184
- let t = Pt(e);
185
- e.focus(), wt(t);
186
- }
187
- }
188
- let re = null;
189
- function Et() {
190
- if (re == null) {
191
- re = !1;
192
- try {
193
- document.createElement("div").focus({
194
- get preventScroll() {
195
- return re = !0, !0;
196
- }
197
- });
198
- } catch {
199
- }
200
- }
201
- return re;
202
- }
203
- function Pt(e) {
204
- let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
205
- for (; t instanceof HTMLElement && t !== r; )
206
- (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
207
- element: t,
208
- scrollTop: t.scrollTop,
209
- scrollLeft: t.scrollLeft
210
- }), t = t.parentNode;
211
- return r instanceof HTMLElement && n.push({
212
- element: r,
213
- scrollTop: r.scrollTop,
214
- scrollLeft: r.scrollLeft
215
- }), n;
216
- }
217
- function wt(e) {
218
- for (let { element: t, scrollTop: n, scrollLeft: r } of e)
219
- t.scrollTop = n, t.scrollLeft = r;
220
- }
221
- function de(e) {
222
- var t;
223
- return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
224
- }
225
- function Se(e) {
226
- var t;
227
- return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
228
- }
229
- function A(e) {
230
- let t = null;
231
- return () => (t == null && (t = e()), t);
232
- }
233
- const J = A(function() {
234
- return Se(/^Mac/i);
235
- }), St = A(function() {
236
- return Se(/^iPhone/i);
237
- }), Ve = A(function() {
238
- return Se(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
239
- J() && navigator.maxTouchPoints > 1;
240
- }), xe = A(function() {
241
- return St() || Ve();
242
- }), un = A(function() {
243
- return J() || xe();
244
- }), xt = A(function() {
245
- return de(/AppleWebKit/i) && !Lt();
246
- }), Lt = A(function() {
247
- return de(/Chrome/i);
248
- }), Ne = A(function() {
249
- return de(/Android/i);
250
- }), Mt = A(function() {
251
- return de(/Firefox/i);
252
- }), Ge = /* @__PURE__ */ nt({
253
- isNative: !0,
254
- open: Ct,
255
- useHref: (e) => e
256
- });
257
- function ln(e) {
258
- let { children: t, navigate: n, useHref: r } = e, i = Z(() => ({
259
- isNative: !1,
260
- open: (u, o, c, d) => {
261
- Be(u, (p) => {
262
- Kt(p, o) ? n(c, d) : X(p, o);
263
- });
264
- },
265
- useHref: r || ((u) => u)
266
- }), [
267
- n,
268
- r
269
- ]);
270
- return /* @__PURE__ */ L.createElement(Ge.Provider, {
271
- value: i
272
- }, t);
273
- }
274
- function Ue() {
275
- return Q(Ge);
276
- }
277
- function Kt(e, t) {
278
- let n = e.getAttribute("target");
279
- return (!n || n === "_self") && e.origin === location.origin && !e.hasAttribute("download") && !t.metaKey && // open in new tab (mac)
280
- !t.ctrlKey && // open in new tab (windows)
281
- !t.altKey && // download
282
- !t.shiftKey;
283
- }
284
- function X(e, t, n = !0) {
285
- var r, i;
286
- let { metaKey: u, ctrlKey: o, altKey: c, shiftKey: d } = t;
287
- Mt() && (!((i = window.event) === null || i === void 0 || (r = i.type) === null || r === void 0) && r.startsWith("key")) && e.target === "_blank" && (J() ? u = !0 : o = !0);
288
- let p = xt() && J() && !Ve() ? new KeyboardEvent("keydown", {
289
- keyIdentifier: "Enter",
290
- metaKey: u,
291
- ctrlKey: o,
292
- altKey: c,
293
- shiftKey: d
294
- }) : new MouseEvent("click", {
295
- metaKey: u,
296
- ctrlKey: o,
297
- altKey: c,
298
- shiftKey: d,
299
- bubbles: !0,
300
- cancelable: !0
301
- });
302
- X.isOpening = n, U(e), e.dispatchEvent(p), X.isOpening = !1;
303
- }
304
- X.isOpening = !1;
305
- function Be(e, t) {
306
- if (e instanceof HTMLAnchorElement) t(e);
307
- else if (e.hasAttribute("data-href")) {
308
- let n = document.createElement("a");
309
- n.href = e.getAttribute("data-href"), e.hasAttribute("data-target") && (n.target = e.getAttribute("data-target")), e.hasAttribute("data-rel") && (n.rel = e.getAttribute("data-rel")), e.hasAttribute("data-download") && (n.download = e.getAttribute("data-download")), e.hasAttribute("data-ping") && (n.ping = e.getAttribute("data-ping")), e.hasAttribute("data-referrer-policy") && (n.referrerPolicy = e.getAttribute("data-referrer-policy")), e.appendChild(n), t(n), e.removeChild(n);
310
- }
311
- }
312
- function Ct(e, t) {
313
- Be(e, (n) => X(n, t));
314
- }
315
- function fn(e) {
316
- let t = Ue();
317
- var n;
318
- const r = t.useHref((n = e.href) !== null && n !== void 0 ? n : "");
319
- return {
320
- "data-href": e.href ? r : void 0,
321
- "data-target": e.target,
322
- "data-rel": e.rel,
323
- "data-download": e.download,
324
- "data-ping": e.ping,
325
- "data-referrer-policy": e.referrerPolicy
326
- };
327
- }
328
- function cn(e) {
329
- let t = Ue();
330
- var n;
331
- const r = t.useHref((n = e == null ? void 0 : e.href) !== null && n !== void 0 ? n : "");
332
- return {
333
- href: e != null && e.href ? r : void 0,
334
- target: e == null ? void 0 : e.target,
335
- rel: e == null ? void 0 : e.rel,
336
- download: e == null ? void 0 : e.download,
337
- ping: e == null ? void 0 : e.ping,
338
- referrerPolicy: e == null ? void 0 : e.referrerPolicy
339
- };
340
- }
341
- let q = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Set();
342
- function Me() {
343
- if (typeof window > "u") return;
344
- function e(r) {
345
- return "propertyName" in r;
346
- }
347
- let t = (r) => {
348
- if (!e(r) || !r.target) return;
349
- let i = q.get(r.target);
350
- i || (i = /* @__PURE__ */ new Set(), q.set(r.target, i), r.target.addEventListener("transitioncancel", n, {
351
- once: !0
352
- })), i.add(r.propertyName);
353
- }, n = (r) => {
354
- if (!e(r) || !r.target) return;
355
- let i = q.get(r.target);
356
- if (i && (i.delete(r.propertyName), i.size === 0 && (r.target.removeEventListener("transitioncancel", n), q.delete(r.target)), q.size === 0)) {
357
- for (let u of he) u();
358
- he.clear();
359
- }
360
- };
361
- document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", n);
362
- }
363
- typeof document < "u" && (document.readyState !== "loading" ? Me() : document.addEventListener("DOMContentLoaded", Me));
364
- function Xe(e) {
365
- requestAnimationFrame(() => {
366
- q.size === 0 ? e() : he.add(e);
367
- });
368
- }
369
- function kt() {
370
- let e = w(/* @__PURE__ */ new Map()), t = h((i, u, o, c) => {
371
- let d = c != null && c.once ? (...p) => {
372
- e.current.delete(o), o(...p);
373
- } : o;
374
- e.current.set(o, {
375
- type: u,
376
- eventTarget: i,
377
- fn: d,
378
- options: c
379
- }), i.addEventListener(u, d, c);
380
- }, []), n = h((i, u, o, c) => {
381
- var d;
382
- let p = ((d = e.current.get(o)) === null || d === void 0 ? void 0 : d.fn) || o;
383
- i.removeEventListener(u, p, c), e.current.delete(o);
384
- }, []), r = h(() => {
385
- e.current.forEach((i, u) => {
386
- n(i.eventTarget, i.type, u, i.options);
387
- });
388
- }, [
389
- n
390
- ]);
391
- return B(() => r, [
392
- r
393
- ]), {
394
- addGlobalListener: t,
395
- removeGlobalListener: n,
396
- removeAllGlobalListeners: r
397
- };
398
- }
399
- function Ft(e) {
400
- const t = w(null);
401
- return Z(() => ({
402
- get current() {
403
- return t.current;
404
- },
405
- set current(n) {
406
- t.current = n, typeof e == "function" ? e(n) : e && (e.current = n);
407
- }
408
- }), [
409
- e
410
- ]);
411
- }
412
- function Ht(e, t) {
413
- Y(() => {
414
- if (e && e.ref && t)
415
- return e.ref.current = t.current, () => {
416
- e.ref && (e.ref.current = null);
417
- };
418
- });
419
- }
420
- function me(e) {
421
- return e.mozInputSource === 0 && e.isTrusted ? !0 : Ne() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
422
- }
423
- function It(e) {
424
- return !Ne() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
425
- }
426
- const Ke = Symbol("default");
427
- function dn({ values: e, children: t }) {
428
- for (let [n, r] of e)
429
- t = /* @__PURE__ */ L.createElement(n.Provider, {
430
- value: r
431
- }, t);
432
- return t;
433
- }
434
- function pn(e) {
435
- let { className: t, style: n, children: r, defaultClassName: i, defaultChildren: u, defaultStyle: o, values: c } = e;
436
- return Z(() => {
437
- let d, p, g;
438
- return typeof t == "function" ? d = t({
439
- ...c,
440
- defaultClassName: i
441
- }) : d = t, typeof n == "function" ? p = n({
442
- ...c,
443
- defaultStyle: o || {}
444
- }) : p = n, typeof r == "function" ? g = r({
445
- ...c,
446
- defaultChildren: u
447
- }) : r == null ? g = u : g = r, {
448
- className: d ?? i,
449
- style: p || o ? {
450
- ...o,
451
- ...p
452
- } : void 0,
453
- children: g ?? u,
454
- "data-rac": ""
455
- };
456
- }, [
457
- t,
458
- n,
459
- r,
460
- i,
461
- u,
462
- o,
463
- c
464
- ]);
465
- }
466
- function Ot(e, t) {
467
- let n = Q(e);
468
- if (t === null)
469
- return null;
470
- if (n && typeof n == "object" && "slots" in n && n.slots) {
471
- let r = new Intl.ListFormat().format(Object.keys(n.slots).map((u) => `"${u}"`));
472
- if (!t && !n.slots[Ke]) throw new Error(`A slot prop is required. Valid slot names are ${r}.`);
473
- let i = t || Ke;
474
- if (!n.slots[i])
475
- throw new Error(`Invalid slot "${t}". Valid slot names are ${r}.`);
476
- return n.slots[i];
477
- }
478
- return n;
479
- }
480
- function $n(e, t, n) {
481
- let r = Ot(n, e.slot) || {}, { ref: i, ...u } = r, o = Ft(Z(() => vt(t, i), [
482
- t,
483
- i
484
- ])), c = we(u, e);
485
- return "style" in u && u.style && "style" in e && e.style && (typeof u.style == "function" || typeof e.style == "function" ? c.style = (d) => {
486
- let p = typeof u.style == "function" ? u.style(d) : u.style, g = {
487
- ...d.defaultStyle,
488
- ...p
489
- }, T = typeof e.style == "function" ? e.style({
490
- ...d,
491
- defaultStyle: g
492
- }) : e.style;
493
- return {
494
- ...g,
495
- ...T
496
- };
497
- } : c.style = {
498
- ...u.style,
499
- ...e.style
500
- }), [
501
- c,
502
- o
503
- ];
504
- }
505
- function gn() {
506
- let [e, t] = I(!0), n = w(!1), r = h((i) => {
507
- n.current = !0, t(!!i);
508
- }, []);
509
- return Y(() => {
510
- n.current || t(!1);
511
- }, []), [
512
- r,
513
- e
514
- ];
515
- }
516
- function bn(e) {
517
- const t = /^(data-.*)$/;
518
- let n = {};
519
- for (const r in e) t.test(r) || (n[r] = e[r]);
520
- return n;
521
- }
522
- let R = "default", Te = "", se = /* @__PURE__ */ new WeakMap();
523
- function Ce(e) {
524
- if (xe()) {
525
- if (R === "default") {
526
- const t = P(e);
527
- Te = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
528
- }
529
- R = "disabled";
530
- } else (e instanceof HTMLElement || e instanceof SVGElement) && (se.set(e, e.style.userSelect), e.style.userSelect = "none");
531
- }
532
- function ae(e) {
533
- if (xe()) {
534
- if (R !== "disabled") return;
535
- R = "restoring", setTimeout(() => {
536
- Xe(() => {
537
- if (R === "restoring") {
538
- const t = P(e);
539
- t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = Te || ""), Te = "", R = "default";
540
- }
541
- });
542
- }, 300);
543
- } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && se.has(e)) {
544
- let t = se.get(e);
545
- e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), se.delete(e);
546
- }
547
- }
548
- const je = L.createContext({
549
- register: () => {
550
- }
551
- });
552
- je.displayName = "PressResponderContext";
553
- function At(e, t) {
554
- return t.get ? t.get.call(e) : t.value;
555
- }
556
- function Ye(e, t, n) {
557
- if (!t.has(e)) throw new TypeError("attempted to " + n + " private field on non-instance");
558
- return t.get(e);
559
- }
560
- function Dt(e, t) {
561
- var n = Ye(e, t, "get");
562
- return At(e, n);
563
- }
564
- function Wt(e, t) {
565
- if (t.has(e))
566
- throw new TypeError("Cannot initialize the same private elements twice on an object");
567
- }
568
- function Vt(e, t, n) {
569
- Wt(e, t), t.set(e, n);
570
- }
571
- function Nt(e, t, n) {
572
- if (t.set) t.set.call(e, n);
573
- else {
574
- if (!t.writable)
575
- throw new TypeError("attempted to set read only private field");
576
- t.value = n;
577
- }
578
- }
579
- function ke(e, t, n) {
580
- var r = Ye(e, t, "set");
581
- return Nt(e, r, n), n;
582
- }
583
- function Gt(e) {
584
- let t = Q(je);
585
- if (t) {
586
- let { register: n, ...r } = t;
587
- e = we(r, e), n();
588
- }
589
- return Ht(t, e.ref), e;
590
- }
591
- var ie = /* @__PURE__ */ new WeakMap();
592
- class oe {
593
- continuePropagation() {
594
- ke(this, ie, !1);
595
- }
596
- get shouldStopPropagation() {
597
- return Dt(this, ie);
598
- }
599
- constructor(t, n, r, i) {
600
- Vt(this, ie, {
601
- writable: !0,
602
- value: void 0
603
- }), ke(this, ie, !0);
604
- var u;
605
- let o = (u = i == null ? void 0 : i.target) !== null && u !== void 0 ? u : r.currentTarget;
606
- const c = o == null ? void 0 : o.getBoundingClientRect();
607
- let d, p = 0, g, T = null;
608
- r.clientX != null && r.clientY != null && (g = r.clientX, T = r.clientY), c && (g != null && T != null ? (d = g - c.left, p = T - c.top) : (d = c.width / 2, p = c.height / 2)), this.type = t, this.pointerType = n, this.target = r.currentTarget, this.shiftKey = r.shiftKey, this.metaKey = r.metaKey, this.ctrlKey = r.ctrlKey, this.altKey = r.altKey, this.x = d, this.y = p;
609
- }
610
- }
611
- const Fe = Symbol("linkClicked");
612
- function vn(e) {
613
- let {
614
- onPress: t,
615
- onPressChange: n,
616
- onPressStart: r,
617
- onPressEnd: i,
618
- onPressUp: u,
619
- isDisabled: o,
620
- isPressed: c,
621
- preventFocusOnPress: d,
622
- shouldCancelOnPointerExit: p,
623
- allowTextSelectionOnPress: g,
624
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
625
- ref: T,
626
- ...M
627
- } = Gt(e), [b, C] = I(!1), S = w({
628
- isPressed: !1,
629
- ignoreEmulatedMouseEvents: !1,
630
- ignoreClickAfterPress: !1,
631
- didFirePressStart: !1,
632
- isTriggeringEvent: !1,
633
- activePointerId: null,
634
- target: null,
635
- isOverTarget: !1,
636
- pointerType: null
637
- }), { addGlobalListener: N, removeAllGlobalListeners: z } = kt(), k = V((a, $) => {
638
- let x = S.current;
639
- if (o || x.didFirePressStart) return !1;
640
- let f = !0;
641
- if (x.isTriggeringEvent = !0, r) {
642
- let v = new oe("pressstart", $, a);
643
- r(v), f = v.shouldStopPropagation;
644
- }
645
- return n && n(!0), x.isTriggeringEvent = !1, x.didFirePressStart = !0, C(!0), f;
646
- }), m = V((a, $, x = !0) => {
647
- let f = S.current;
648
- if (!f.didFirePressStart) return !1;
649
- f.ignoreClickAfterPress = !0, f.didFirePressStart = !1, f.isTriggeringEvent = !0;
650
- let v = !0;
651
- if (i) {
652
- let s = new oe("pressend", $, a);
653
- i(s), v = s.shouldStopPropagation;
654
- }
655
- if (n && n(!1), C(!1), t && x && !o) {
656
- let s = new oe("press", $, a);
657
- t(s), v && (v = s.shouldStopPropagation);
658
- }
659
- return f.isTriggeringEvent = !1, v;
660
- }), _ = V((a, $) => {
661
- let x = S.current;
662
- if (o) return !1;
663
- if (u) {
664
- x.isTriggeringEvent = !0;
665
- let f = new oe("pressup", $, a);
666
- return u(f), x.isTriggeringEvent = !1, f.shouldStopPropagation;
667
- }
668
- return !0;
669
- }), G = V((a) => {
670
- let $ = S.current;
671
- $.isPressed && $.target && ($.isOverTarget && $.pointerType != null && m(H($.target, a), $.pointerType, !1), $.isPressed = !1, $.isOverTarget = !1, $.activePointerId = null, $.pointerType = null, z(), g || ae($.target));
672
- }), ne = V((a) => {
673
- p && G(a);
674
- }), tt = Z(() => {
675
- let a = S.current, $ = {
676
- onKeyDown(f) {
677
- if (ge(f.nativeEvent, f.currentTarget) && f.currentTarget.contains(f.target)) {
678
- var v;
679
- Ie(f.target, f.key) && f.preventDefault();
680
- let s = !0;
681
- if (!a.isPressed && !f.repeat) {
682
- a.target = f.currentTarget, a.isPressed = !0, s = k(f, "keyboard");
683
- let l = f.currentTarget, y = (F) => {
684
- ge(F, l) && !F.repeat && l.contains(F.target) && a.target && _(H(a.target, F), "keyboard");
685
- };
686
- N(P(f.currentTarget), "keyup", We(y, x), !0);
687
- }
688
- s && f.stopPropagation(), f.metaKey && J() && ((v = a.metaKeyEvents) === null || v === void 0 || v.set(f.key, f.nativeEvent));
689
- } else f.key === "Meta" && (a.metaKeyEvents = /* @__PURE__ */ new Map());
690
- },
691
- onClick(f) {
692
- if (!(f && !f.currentTarget.contains(f.target)) && f && f.button === 0 && !a.isTriggeringEvent && !X.isOpening) {
693
- let v = !0;
694
- if (o && f.preventDefault(), !a.ignoreClickAfterPress && !a.ignoreEmulatedMouseEvents && !a.isPressed && (a.pointerType === "virtual" || me(f.nativeEvent))) {
695
- !o && !d && U(f.currentTarget);
696
- let s = k(f, "virtual"), l = _(f, "virtual"), y = m(f, "virtual");
697
- v = s && l && y;
698
- }
699
- a.ignoreEmulatedMouseEvents = !1, a.ignoreClickAfterPress = !1, v && f.stopPropagation();
700
- }
701
- }
702
- }, x = (f) => {
703
- var v;
704
- if (a.isPressed && a.target && ge(f, a.target)) {
705
- var s;
706
- Ie(f.target, f.key) && f.preventDefault();
707
- let y = f.target;
708
- m(H(a.target, f), "keyboard", a.target.contains(y)), z(), f.key !== "Enter" && Le(a.target) && a.target.contains(y) && !f[Fe] && (f[Fe] = !0, X(a.target, f, !1)), a.isPressed = !1, (s = a.metaKeyEvents) === null || s === void 0 || s.delete(f.key);
709
- } else if (f.key === "Meta" && (!((v = a.metaKeyEvents) === null || v === void 0) && v.size)) {
710
- var l;
711
- let y = a.metaKeyEvents;
712
- a.metaKeyEvents = void 0;
713
- for (let F of y.values()) (l = a.target) === null || l === void 0 || l.dispatchEvent(new KeyboardEvent("keyup", F));
714
- }
715
- };
716
- if (typeof PointerEvent < "u") {
717
- $.onPointerDown = (l) => {
718
- if (l.button !== 0 || !l.currentTarget.contains(l.target)) return;
719
- if (It(l.nativeEvent)) {
720
- a.pointerType = "virtual";
721
- return;
722
- }
723
- ve(l.currentTarget) && l.preventDefault(), a.pointerType = l.pointerType;
724
- let y = !0;
725
- if (!a.isPressed) {
726
- a.isPressed = !0, a.isOverTarget = !0, a.activePointerId = l.pointerId, a.target = l.currentTarget, !o && !d && U(l.currentTarget), g || Ce(a.target), y = k(l, a.pointerType);
727
- let F = l.target;
728
- "releasePointerCapture" in F && F.releasePointerCapture(l.pointerId), N(P(l.currentTarget), "pointerup", f, !1), N(P(l.currentTarget), "pointercancel", s, !1);
729
- }
730
- y && l.stopPropagation();
731
- }, $.onMouseDown = (l) => {
732
- l.currentTarget.contains(l.target) && l.button === 0 && (ve(l.currentTarget) && l.preventDefault(), l.stopPropagation());
733
- }, $.onPointerUp = (l) => {
734
- !l.currentTarget.contains(l.target) || a.pointerType === "virtual" || l.button === 0 && _(l, a.pointerType || l.pointerType);
735
- }, $.onPointerEnter = (l) => {
736
- l.pointerId === a.activePointerId && a.target && !a.isOverTarget && a.pointerType != null && (a.isOverTarget = !0, k(H(a.target, l), a.pointerType));
737
- }, $.onPointerLeave = (l) => {
738
- l.pointerId === a.activePointerId && a.target && a.isOverTarget && a.pointerType != null && (a.isOverTarget = !1, m(H(a.target, l), a.pointerType, !1), ne(l));
739
- };
740
- let f = (l) => {
741
- l.pointerId === a.activePointerId && a.isPressed && l.button === 0 && a.target && (a.target.contains(l.target) && a.pointerType != null ? m(H(a.target, l), a.pointerType) : a.isOverTarget && a.pointerType != null && m(H(a.target, l), a.pointerType, !1), a.isPressed = !1, a.isOverTarget = !1, a.activePointerId = null, a.pointerType = null, z(), g || ae(a.target), "ontouchend" in a.target && l.pointerType !== "mouse" && N(a.target, "touchend", v, {
742
- once: !0
743
- }));
744
- }, v = (l) => {
745
- ze(l.currentTarget) && l.preventDefault();
746
- }, s = (l) => {
747
- G(l);
748
- };
749
- $.onDragStart = (l) => {
750
- l.currentTarget.contains(l.target) && G(l);
751
- };
752
- } else {
753
- $.onMouseDown = (s) => {
754
- if (s.button !== 0 || !s.currentTarget.contains(s.target)) return;
755
- if (ve(s.currentTarget) && s.preventDefault(), a.ignoreEmulatedMouseEvents) {
756
- s.stopPropagation();
757
- return;
758
- }
759
- a.isPressed = !0, a.isOverTarget = !0, a.target = s.currentTarget, a.pointerType = me(s.nativeEvent) ? "virtual" : "mouse", !o && !d && U(s.currentTarget), k(s, a.pointerType) && s.stopPropagation(), N(P(s.currentTarget), "mouseup", f, !1);
760
- }, $.onMouseEnter = (s) => {
761
- if (!s.currentTarget.contains(s.target)) return;
762
- let l = !0;
763
- a.isPressed && !a.ignoreEmulatedMouseEvents && a.pointerType != null && (a.isOverTarget = !0, l = k(s, a.pointerType)), l && s.stopPropagation();
764
- }, $.onMouseLeave = (s) => {
765
- if (!s.currentTarget.contains(s.target)) return;
766
- let l = !0;
767
- a.isPressed && !a.ignoreEmulatedMouseEvents && a.pointerType != null && (a.isOverTarget = !1, l = m(s, a.pointerType, !1), ne(s)), l && s.stopPropagation();
768
- }, $.onMouseUp = (s) => {
769
- s.currentTarget.contains(s.target) && !a.ignoreEmulatedMouseEvents && s.button === 0 && _(s, a.pointerType || "mouse");
770
- };
771
- let f = (s) => {
772
- if (s.button === 0) {
773
- if (a.isPressed = !1, z(), a.ignoreEmulatedMouseEvents) {
774
- a.ignoreEmulatedMouseEvents = !1;
775
- return;
776
- }
777
- a.target && be(s, a.target) && a.pointerType != null ? m(H(a.target, s), a.pointerType) : a.target && a.isOverTarget && a.pointerType != null && m(H(a.target, s), a.pointerType, !1), a.isOverTarget = !1;
778
- }
779
- };
780
- $.onTouchStart = (s) => {
781
- if (!s.currentTarget.contains(s.target)) return;
782
- let l = Ut(s.nativeEvent);
783
- if (!l) return;
784
- a.activePointerId = l.identifier, a.ignoreEmulatedMouseEvents = !0, a.isOverTarget = !0, a.isPressed = !0, a.target = s.currentTarget, a.pointerType = "touch", !o && !d && U(s.currentTarget), g || Ce(a.target), k(D(a.target, s), a.pointerType) && s.stopPropagation(), N(K(s.currentTarget), "scroll", v, !0);
785
- }, $.onTouchMove = (s) => {
786
- if (!s.currentTarget.contains(s.target)) return;
787
- if (!a.isPressed) {
788
- s.stopPropagation();
789
- return;
790
- }
791
- let l = He(s.nativeEvent, a.activePointerId), y = !0;
792
- l && be(l, s.currentTarget) ? !a.isOverTarget && a.pointerType != null && (a.isOverTarget = !0, y = k(D(a.target, s), a.pointerType)) : a.isOverTarget && a.pointerType != null && (a.isOverTarget = !1, y = m(D(a.target, s), a.pointerType, !1), ne(D(a.target, s))), y && s.stopPropagation();
793
- }, $.onTouchEnd = (s) => {
794
- if (!s.currentTarget.contains(s.target)) return;
795
- if (!a.isPressed) {
796
- s.stopPropagation();
797
- return;
798
- }
799
- let l = He(s.nativeEvent, a.activePointerId), y = !0;
800
- l && be(l, s.currentTarget) && a.pointerType != null ? (_(D(a.target, s), a.pointerType), y = m(D(a.target, s), a.pointerType)) : a.isOverTarget && a.pointerType != null && (y = m(D(a.target, s), a.pointerType, !1)), y && s.stopPropagation(), a.isPressed = !1, a.activePointerId = null, a.isOverTarget = !1, a.ignoreEmulatedMouseEvents = !0, a.target && !g && ae(a.target), z();
801
- }, $.onTouchCancel = (s) => {
802
- s.currentTarget.contains(s.target) && (s.stopPropagation(), a.isPressed && G(D(a.target, s)));
803
- };
804
- let v = (s) => {
805
- a.isPressed && s.target.contains(a.target) && G({
806
- currentTarget: a.target,
807
- shiftKey: !1,
808
- ctrlKey: !1,
809
- metaKey: !1,
810
- altKey: !1
811
- });
812
- };
813
- $.onDragStart = (s) => {
814
- s.currentTarget.contains(s.target) && G(s);
815
- };
816
- }
817
- return $;
818
- }, [
819
- N,
820
- o,
821
- d,
822
- z,
823
- g,
824
- G,
825
- ne,
826
- m,
827
- k,
828
- _
829
- ]);
830
- return B(() => () => {
831
- var a;
832
- g || ae((a = S.current.target) !== null && a !== void 0 ? a : void 0);
833
- }, [
834
- g
835
- ]), {
836
- isPressed: c || b,
837
- pressProps: we(M, tt)
838
- };
839
- }
840
- function Le(e) {
841
- return e.tagName === "A" && e.hasAttribute("href");
842
- }
843
- function ge(e, t) {
844
- const { key: n, code: r } = e, i = t, u = i.getAttribute("role");
845
- return (n === "Enter" || n === " " || n === "Spacebar" || r === "Space") && !(i instanceof K(i).HTMLInputElement && !_e(i, n) || i instanceof K(i).HTMLTextAreaElement || i.isContentEditable) && // Links should only trigger with Enter key
846
- !((u === "link" || !u && Le(i)) && n !== "Enter");
847
- }
848
- function Ut(e) {
849
- const { targetTouches: t } = e;
850
- return t.length > 0 ? t[0] : null;
851
- }
852
- function He(e, t) {
853
- const n = e.changedTouches;
854
- for (let r = 0; r < n.length; r++) {
855
- const i = n[r];
856
- if (i.identifier === t) return i;
857
- }
858
- return null;
859
- }
860
- function D(e, t) {
861
- let n = 0, r = 0;
862
- return t.targetTouches && t.targetTouches.length === 1 && (n = t.targetTouches[0].clientX, r = t.targetTouches[0].clientY), {
863
- currentTarget: e,
864
- shiftKey: t.shiftKey,
865
- ctrlKey: t.ctrlKey,
866
- metaKey: t.metaKey,
867
- altKey: t.altKey,
868
- clientX: n,
869
- clientY: r
870
- };
871
- }
872
- function H(e, t) {
873
- let n = t.clientX, r = t.clientY;
874
- return {
875
- currentTarget: e,
876
- shiftKey: t.shiftKey,
877
- ctrlKey: t.ctrlKey,
878
- metaKey: t.metaKey,
879
- altKey: t.altKey,
880
- clientX: n,
881
- clientY: r
882
- };
883
- }
884
- function Bt(e) {
885
- let t = 0, n = 0;
886
- return e.width !== void 0 ? t = e.width / 2 : e.radiusX !== void 0 && (t = e.radiusX), e.height !== void 0 ? n = e.height / 2 : e.radiusY !== void 0 && (n = e.radiusY), {
887
- top: e.clientY - n,
888
- right: e.clientX + t,
889
- bottom: e.clientY + n,
890
- left: e.clientX - t
891
- };
892
- }
893
- function Xt(e, t) {
894
- return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
895
- }
896
- function be(e, t) {
897
- let n = t.getBoundingClientRect(), r = Bt(e);
898
- return Xt(n, r);
899
- }
900
- function ve(e) {
901
- return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
902
- }
903
- function ze(e) {
904
- return e instanceof HTMLInputElement ? !1 : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !Le(e);
905
- }
906
- function Ie(e, t) {
907
- return e instanceof HTMLInputElement ? !_e(e, t) : ze(e);
908
- }
909
- const jt = /* @__PURE__ */ new Set([
910
- "checkbox",
911
- "radio",
912
- "range",
913
- "color",
914
- "file",
915
- "image",
916
- "button",
917
- "submit",
918
- "reset"
919
- ]);
920
- function _e(e, t) {
921
- return e.type === "checkbox" || e.type === "radio" ? t === " " : jt.has(e.type);
922
- }
923
- class Yt {
924
- isDefaultPrevented() {
925
- return this.nativeEvent.defaultPrevented;
926
- }
927
- preventDefault() {
928
- this.defaultPrevented = !0, this.nativeEvent.preventDefault();
929
- }
930
- stopPropagation() {
931
- this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
932
- }
933
- isPropagationStopped() {
934
- return !1;
935
- }
936
- persist() {
937
- }
938
- constructor(t, n) {
939
- this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
940
- }
941
- }
942
- function qe(e) {
943
- let t = w({
944
- isFocused: !1,
945
- observer: null
946
- });
947
- Y(() => {
948
- const r = t.current;
949
- return () => {
950
- r.observer && (r.observer.disconnect(), r.observer = null);
951
- };
952
- }, []);
953
- let n = V((r) => {
954
- e == null || e(r);
955
- });
956
- return h((r) => {
957
- if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
958
- t.current.isFocused = !0;
959
- let i = r.target, u = (o) => {
960
- t.current.isFocused = !1, i.disabled && n(new Yt("blur", o)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
961
- };
962
- i.addEventListener("focusout", u, {
963
- once: !0
964
- }), t.current.observer = new MutationObserver(() => {
965
- if (t.current.isFocused && i.disabled) {
966
- var o;
967
- (o = t.current.observer) === null || o === void 0 || o.disconnect();
968
- let c = i === document.activeElement ? null : document.activeElement;
969
- i.dispatchEvent(new FocusEvent("blur", {
970
- relatedTarget: c
971
- })), i.dispatchEvent(new FocusEvent("focusout", {
972
- bubbles: !0,
973
- relatedTarget: c
974
- }));
975
- }
976
- }), t.current.observer.observe(i, {
977
- attributes: !0,
978
- attributeFilter: [
979
- "disabled"
980
- ]
981
- });
982
- }
983
- }, [
984
- n
985
- ]);
986
- }
987
- function zt(e) {
988
- let { isDisabled: t, onFocus: n, onBlur: r, onFocusChange: i } = e;
989
- const u = h((d) => {
990
- if (d.target === d.currentTarget)
991
- return r && r(d), i && i(!1), !0;
992
- }, [
993
- r,
994
- i
995
- ]), o = qe(u), c = h((d) => {
996
- const p = P(d.target);
997
- d.target === d.currentTarget && p.activeElement === d.target && (n && n(d), i && i(!0), o(d));
998
- }, [
999
- i,
1000
- n,
1001
- o
1002
- ]);
1003
- return {
1004
- focusProps: {
1005
- onFocus: !t && (n || i || r) ? c : void 0,
1006
- onBlur: !t && (r || i) ? u : void 0
1007
- }
1008
- };
1009
- }
1010
- let O = null, te = /* @__PURE__ */ new Set(), ee = /* @__PURE__ */ new Map(), j = !1, Ee = !1;
1011
- const _t = {
1012
- Tab: !0,
1013
- Escape: !0
1014
- };
1015
- function pe(e, t) {
1016
- for (let n of te) n(e, t);
1017
- }
1018
- function qt(e) {
1019
- return !(e.metaKey || !J() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
1020
- }
1021
- function le(e) {
1022
- j = !0, qt(e) && (O = "keyboard", pe("keyboard", e));
1023
- }
1024
- function E(e) {
1025
- O = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (j = !0, pe("pointer", e));
1026
- }
1027
- function Re(e) {
1028
- me(e) && (j = !0, O = "virtual");
1029
- }
1030
- function Je(e) {
1031
- e.target === window || e.target === document || (!j && !Ee && (O = "virtual", pe("virtual", e)), j = !1, Ee = !1);
1032
- }
1033
- function Qe() {
1034
- j = !1, Ee = !0;
1035
- }
1036
- function fe(e) {
1037
- if (typeof window > "u" || ee.get(K(e))) return;
1038
- const t = K(e), n = P(e);
1039
- let r = t.HTMLElement.prototype.focus;
1040
- t.HTMLElement.prototype.focus = function() {
1041
- j = !0, r.apply(this, arguments);
1042
- }, n.addEventListener("keydown", le, !0), n.addEventListener("keyup", le, !0), n.addEventListener("click", Re, !0), t.addEventListener("focus", Je, !0), t.addEventListener("blur", Qe, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", E, !0), n.addEventListener("pointermove", E, !0), n.addEventListener("pointerup", E, !0)) : (n.addEventListener("mousedown", E, !0), n.addEventListener("mousemove", E, !0), n.addEventListener("mouseup", E, !0)), t.addEventListener("beforeunload", () => {
1043
- Ze(e);
1044
- }, {
1045
- once: !0
1046
- }), ee.set(t, {
1047
- focus: r
1048
- });
1049
- }
1050
- const Ze = (e, t) => {
1051
- const n = K(e), r = P(e);
1052
- t && r.removeEventListener("DOMContentLoaded", t), ee.has(n) && (n.HTMLElement.prototype.focus = ee.get(n).focus, r.removeEventListener("keydown", le, !0), r.removeEventListener("keyup", le, !0), r.removeEventListener("click", Re, !0), n.removeEventListener("focus", Je, !0), n.removeEventListener("blur", Qe, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", E, !0), r.removeEventListener("pointermove", E, !0), r.removeEventListener("pointerup", E, !0)) : (r.removeEventListener("mousedown", E, !0), r.removeEventListener("mousemove", E, !0), r.removeEventListener("mouseup", E, !0)), ee.delete(n));
1053
- };
1054
- function Rt(e) {
1055
- const t = P(e);
1056
- let n;
1057
- return t.readyState !== "loading" ? fe(e) : (n = () => {
1058
- fe(e);
1059
- }, t.addEventListener("DOMContentLoaded", n)), () => Ze(e, n);
1060
- }
1061
- typeof document < "u" && Rt();
1062
- function et() {
1063
- return O !== "pointer";
1064
- }
1065
- function Jt() {
1066
- return O;
1067
- }
1068
- function yn(e) {
1069
- O = e, pe(e, null);
1070
- }
1071
- function hn() {
1072
- fe();
1073
- let [e, t] = I(O);
1074
- return B(() => {
1075
- let n = () => {
1076
- t(O);
1077
- };
1078
- return te.add(n), () => {
1079
- te.delete(n);
1080
- };
1081
- }, []), De() ? null : e;
1082
- }
1083
- const Qt = /* @__PURE__ */ new Set([
1084
- "checkbox",
1085
- "radio",
1086
- "range",
1087
- "color",
1088
- "file",
1089
- "image",
1090
- "button",
1091
- "submit",
1092
- "reset"
1093
- ]);
1094
- function Zt(e, t, n) {
1095
- var r;
1096
- const i = typeof window < "u" ? K(n == null ? void 0 : n.target).HTMLInputElement : HTMLInputElement, u = typeof window < "u" ? K(n == null ? void 0 : n.target).HTMLTextAreaElement : HTMLTextAreaElement, o = typeof window < "u" ? K(n == null ? void 0 : n.target).HTMLElement : HTMLElement, c = typeof window < "u" ? K(n == null ? void 0 : n.target).KeyboardEvent : KeyboardEvent;
1097
- return e = e || (n == null ? void 0 : n.target) instanceof i && !Qt.has(n == null || (r = n.target) === null || r === void 0 ? void 0 : r.type) || (n == null ? void 0 : n.target) instanceof u || (n == null ? void 0 : n.target) instanceof o && (n == null ? void 0 : n.target.isContentEditable), !(e && t === "keyboard" && n instanceof c && !_t[n.key]);
1098
- }
1099
- function en(e, t, n) {
1100
- fe(), B(() => {
1101
- let r = (i, u) => {
1102
- Zt(!!(n != null && n.isTextInput), i, u) && e(et());
1103
- };
1104
- return te.add(r), () => {
1105
- te.delete(r);
1106
- };
1107
- }, t);
1108
- }
1109
- function tn(e) {
1110
- let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: i } = e, u = w({
1111
- isFocusWithin: !1
1112
- }), o = h((p) => {
1113
- u.current.isFocusWithin && !p.currentTarget.contains(p.relatedTarget) && (u.current.isFocusWithin = !1, n && n(p), i && i(!1));
1114
- }, [
1115
- n,
1116
- i,
1117
- u
1118
- ]), c = qe(o), d = h((p) => {
1119
- !u.current.isFocusWithin && document.activeElement === p.target && (r && r(p), i && i(!0), u.current.isFocusWithin = !0, c(p));
1120
- }, [
1121
- r,
1122
- i,
1123
- c
1124
- ]);
1125
- return t ? {
1126
- focusWithinProps: {
1127
- // These should not have been null, that would conflict in mergeProps
1128
- onFocus: void 0,
1129
- onBlur: void 0
1130
- }
1131
- } : {
1132
- focusWithinProps: {
1133
- onFocus: d,
1134
- onBlur: o
1135
- }
1136
- };
1137
- }
1138
- let ce = !1, ye = 0;
1139
- function Pe() {
1140
- ce = !0, setTimeout(() => {
1141
- ce = !1;
1142
- }, 50);
1143
- }
1144
- function Oe(e) {
1145
- e.pointerType === "touch" && Pe();
1146
- }
1147
- function nn() {
1148
- if (!(typeof document > "u"))
1149
- return typeof PointerEvent < "u" ? document.addEventListener("pointerup", Oe) : document.addEventListener("touchend", Pe), ye++, () => {
1150
- ye--, !(ye > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", Oe) : document.removeEventListener("touchend", Pe));
1151
- };
1152
- }
1153
- function mn(e) {
1154
- let { onHoverStart: t, onHoverChange: n, onHoverEnd: r, isDisabled: i } = e, [u, o] = I(!1), c = w({
1155
- isHovered: !1,
1156
- ignoreEmulatedMouseEvents: !1,
1157
- pointerType: "",
1158
- target: null
1159
- }).current;
1160
- B(nn, []);
1161
- let { hoverProps: d, triggerHoverEnd: p } = Z(() => {
1162
- let g = (b, C) => {
1163
- if (c.pointerType = C, i || C === "touch" || c.isHovered || !b.currentTarget.contains(b.target)) return;
1164
- c.isHovered = !0;
1165
- let S = b.currentTarget;
1166
- c.target = S, t && t({
1167
- type: "hoverstart",
1168
- target: S,
1169
- pointerType: C
1170
- }), n && n(!0), o(!0);
1171
- }, T = (b, C) => {
1172
- if (c.pointerType = "", c.target = null, C === "touch" || !c.isHovered) return;
1173
- c.isHovered = !1;
1174
- let S = b.currentTarget;
1175
- r && r({
1176
- type: "hoverend",
1177
- target: S,
1178
- pointerType: C
1179
- }), n && n(!1), o(!1);
1180
- }, M = {};
1181
- return typeof PointerEvent < "u" ? (M.onPointerEnter = (b) => {
1182
- ce && b.pointerType === "mouse" || g(b, b.pointerType);
1183
- }, M.onPointerLeave = (b) => {
1184
- !i && b.currentTarget.contains(b.target) && T(b, b.pointerType);
1185
- }) : (M.onTouchStart = () => {
1186
- c.ignoreEmulatedMouseEvents = !0;
1187
- }, M.onMouseEnter = (b) => {
1188
- !c.ignoreEmulatedMouseEvents && !ce && g(b, "mouse"), c.ignoreEmulatedMouseEvents = !1;
1189
- }, M.onMouseLeave = (b) => {
1190
- !i && b.currentTarget.contains(b.target) && T(b, "mouse");
1191
- }), {
1192
- hoverProps: M,
1193
- triggerHoverEnd: T
1194
- };
1195
- }, [
1196
- t,
1197
- n,
1198
- r,
1199
- i,
1200
- c
1201
- ]);
1202
- return B(() => {
1203
- i && p({
1204
- currentTarget: c.target
1205
- }, c.pointerType);
1206
- }, [
1207
- i
1208
- ]), {
1209
- hoverProps: d,
1210
- isHovered: u
1211
- };
1212
- }
1213
- function Tn(e) {
1214
- const t = P(e);
1215
- if (Jt() === "virtual") {
1216
- let n = t.activeElement;
1217
- Xe(() => {
1218
- t.activeElement === n && e.isConnected && U(e);
1219
- });
1220
- } else U(e);
1221
- }
1222
- function En(e = {}) {
1223
- let { autoFocus: t = !1, isTextInput: n, within: r } = e, i = w({
1224
- isFocused: !1,
1225
- isFocusVisible: t || et()
1226
- }), [u, o] = I(!1), [c, d] = I(() => i.current.isFocused && i.current.isFocusVisible), p = h(() => d(i.current.isFocused && i.current.isFocusVisible), []), g = h((b) => {
1227
- i.current.isFocused = b, o(b), p();
1228
- }, [
1229
- p
1230
- ]);
1231
- en((b) => {
1232
- i.current.isFocusVisible = b, p();
1233
- }, [], {
1234
- isTextInput: n
1235
- });
1236
- let { focusProps: T } = zt({
1237
- isDisabled: r,
1238
- onFocusChange: g
1239
- }), { focusWithinProps: M } = tn({
1240
- isDisabled: !r,
1241
- onFocusWithinChange: g
1242
- });
1243
- return {
1244
- isFocused: u,
1245
- isFocusVisible: c,
1246
- focusProps: r ? M : T
1247
- };
1248
- }
1249
- export {
1250
- ln as $,
1251
- bn as A,
1252
- dn as B,
1253
- on as C,
1254
- zt as D,
1255
- Ke as E,
1256
- vt as F,
1257
- J as G,
1258
- xt as H,
1259
- We as I,
1260
- et as J,
1261
- yn as K,
1262
- kt as L,
1263
- un as M,
1264
- U as N,
1265
- X as O,
1266
- hn as P,
1267
- fn as Q,
1268
- Ve as R,
1269
- xe as S,
1270
- Vt as _,
1271
- $n as a,
1272
- mn as b,
1273
- En as c,
1274
- pn as d,
1275
- we as e,
1276
- tn as f,
1277
- De as g,
1278
- je as h,
1279
- Ft as i,
1280
- Ht as j,
1281
- gt as k,
1282
- Y as l,
1283
- V as m,
1284
- vn as n,
1285
- sn as o,
1286
- Ue as p,
1287
- cn as q,
1288
- Kt as r,
1289
- K as s,
1290
- P as t,
1291
- Tn as u,
1292
- Ne as v,
1293
- Lt as w,
1294
- Jt as x,
1295
- Ot as y,
1296
- gn as z
1297
- };