lizaui 12.0.20 → 12.0.21
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.
- package/dist/button-group/index.es.js +2 -2
- package/dist/button-v2/index.cjs.js +1 -1
- package/dist/button-v2/index.es.js +3 -3
- package/dist/chunks/{Button-DdtCMsXJ.js → Button-Bumy9bze.js} +6 -55
- package/dist/chunks/Button-Bumy9bze.js.map +1 -0
- package/dist/chunks/{Button-B-wLEikV.js → Button-CFYOfByw.js} +9 -58
- package/dist/chunks/Button-CFYOfByw.js.map +1 -0
- package/dist/chunks/{FocusScope-Txa6B8J4.js → FocusScope-4TdD5fCA.js} +2 -2
- package/dist/chunks/{FocusScope-Txa6B8J4.js.map → FocusScope-4TdD5fCA.js.map} +1 -1
- package/dist/chunks/{FocusScope-BVEv8CgQ.js → FocusScope-jSNMAXzg.js} +3 -3
- package/dist/chunks/{FocusScope-BVEv8CgQ.js.map → FocusScope-jSNMAXzg.js.map} +1 -1
- package/dist/chunks/Hidden-BY45Dc0j.js +54 -0
- package/dist/chunks/Hidden-BY45Dc0j.js.map +1 -0
- package/dist/chunks/Hidden-C55DpjMP.js +55 -0
- package/dist/chunks/Hidden-C55DpjMP.js.map +1 -0
- package/dist/chunks/{I18nProvider-Dfr8Km7j.js → I18nProvider-Coj9x7B8.js} +2 -2
- package/dist/chunks/{I18nProvider-Dfr8Km7j.js.map → I18nProvider-Coj9x7B8.js.map} +1 -1
- package/dist/chunks/{ProgressBar-D0THM7Dn.js → ProgressBar-542C1mif.js} +5 -5
- package/dist/chunks/{ProgressBar-D0THM7Dn.js.map → ProgressBar-542C1mif.js.map} +1 -1
- package/dist/chunks/{ProgressBar-BPfa9vzz.js → ProgressBar-BiKRsJ8m.js} +3 -3
- package/dist/chunks/{ProgressBar-BPfa9vzz.js.map → ProgressBar-BiKRsJ8m.js.map} +1 -1
- package/dist/chunks/SharedElementTransition-BSCoaphV.js +106 -0
- package/dist/chunks/{SharedElementTransition-D87oSBzB.js.map → SharedElementTransition-BSCoaphV.js.map} +1 -1
- package/dist/chunks/SharedElementTransition-CJVe1D_I.js +107 -0
- package/dist/chunks/{SharedElementTransition-BxczX23g.js.map → SharedElementTransition-CJVe1D_I.js.map} +1 -1
- package/dist/chunks/{VisuallyHidden-CiBoSB1U.js → VisuallyHidden-CTe1-RoI.js} +3 -39
- package/dist/chunks/VisuallyHidden-CTe1-RoI.js.map +1 -0
- package/dist/chunks/VisuallyHidden-DPJuOMsW.js +50 -0
- package/dist/chunks/VisuallyHidden-DPJuOMsW.js.map +1 -0
- package/dist/chunks/{button-group-CGyXDmwt.js → button-group-DJ5IdBp6.js} +2 -2
- package/dist/chunks/{button-group-CGyXDmwt.js.map → button-group-DJ5IdBp6.js.map} +1 -1
- package/dist/chunks/{compose-Ch-3fhek.js → compose-DOOi0Yan.js} +2 -2
- package/dist/chunks/{compose-Ch-3fhek.js.map → compose-DOOi0Yan.js.map} +1 -1
- package/dist/chunks/{focusSafely-Cxp4n3zg.js → focusSafely-CKxVSn6H.js} +39 -1
- package/dist/chunks/{focusSafely-Cxp4n3zg.js.map → focusSafely-CKxVSn6H.js.map} +1 -1
- package/dist/chunks/{focusSafely--u_yGz_7.js → focusSafely-DfEgLKh6.js} +46 -8
- package/dist/chunks/{focusSafely--u_yGz_7.js.map → focusSafely-DfEgLKh6.js.map} +1 -1
- package/dist/chunks/{number-DigQ78uS.js → number-CYgYWykt.js} +2 -2
- package/dist/chunks/{number-DigQ78uS.js.map → number-CYgYWykt.js.map} +1 -1
- package/dist/chunks/{radio-group-4o00BMkw.js → radio-group-BwXvYzSm.js} +14 -13
- package/dist/chunks/{radio-group-4o00BMkw.js.map → radio-group-BwXvYzSm.js.map} +1 -1
- package/dist/chunks/{radio-group-voOEmmYI.js → radio-group-hO2beGF6.js} +12 -11
- package/dist/chunks/{radio-group-voOEmmYI.js.map → radio-group-hO2beGF6.js.map} +1 -1
- package/dist/chunks/useControlledState-DE_m1RML.js +39 -0
- package/dist/chunks/useControlledState-DE_m1RML.js.map +1 -0
- package/dist/chunks/useControlledState-DZA25XHU.js +40 -0
- package/dist/chunks/useControlledState-DZA25XHU.js.map +1 -0
- package/dist/chunks/{useFormReset-BL4MH85g.js → useFormReset-BYRGk5vb.js} +2 -2
- package/dist/chunks/{useFormReset-BL4MH85g.js.map → useFormReset-BYRGk5vb.js.map} +1 -1
- package/dist/chunks/{useFormReset-YYNrlE-8.js → useFormReset-Bgv2ktIE.js} +2 -2
- package/dist/chunks/{useFormReset-YYNrlE-8.js.map → useFormReset-Bgv2ktIE.js.map} +1 -1
- package/dist/chunks/useHasTabbableChild-CSJ0P5QT.js +2577 -0
- package/dist/chunks/useHasTabbableChild-CSJ0P5QT.js.map +1 -0
- package/dist/chunks/useHasTabbableChild-kl2T5gEX.js +2576 -0
- package/dist/chunks/useHasTabbableChild-kl2T5gEX.js.map +1 -0
- package/dist/chunks/{useHover-_Q7y99al.js → useHover-BHCSbkLb.js} +3 -3
- package/dist/chunks/{useHover-_Q7y99al.js.map → useHover-BHCSbkLb.js.map} +1 -1
- package/dist/chunks/{useHover-COOv7KTv.js → useHover-D9f9xyxz.js} +2 -2
- package/dist/chunks/{useHover-COOv7KTv.js.map → useHover-D9f9xyxz.js.map} +1 -1
- package/dist/chunks/{useLabel-DjFU7E9u.js → useLabel-CzhH-Tov.js} +3 -22
- package/dist/chunks/useLabel-CzhH-Tov.js.map +1 -0
- package/dist/chunks/{useLabel-DgF69V6e.js → useLabel-YLbDMN-c.js} +4 -23
- package/dist/chunks/useLabel-YLbDMN-c.js.map +1 -0
- package/dist/chunks/useLabels-BiXnWBSL.js +23 -0
- package/dist/chunks/useLabels-BiXnWBSL.js.map +1 -0
- package/dist/chunks/useLabels-Bl0mJafM.js +24 -0
- package/dist/chunks/useLabels-Bl0mJafM.js.map +1 -0
- package/dist/chunks/{useMove-KCXqjWm-.js → useMove-DeuS9PRx.js} +3 -3
- package/dist/chunks/{useMove-KCXqjWm-.js.map → useMove-DeuS9PRx.js.map} +1 -1
- package/dist/chunks/{useMove-D5nRSeRO.js → useMove-Xpbmb6OD.js} +3 -3
- package/dist/chunks/{useMove-D5nRSeRO.js.map → useMove-Xpbmb6OD.js.map} +1 -1
- package/dist/chunks/{usePress-BnXPCNhr.js → usePress-Arf10jW0.js} +4 -4
- package/dist/chunks/{usePress-BnXPCNhr.js.map → usePress-Arf10jW0.js.map} +1 -1
- package/dist/chunks/{usePress-4yjnfhQ_.js → usePress-B1yQk_p8.js} +3 -3
- package/dist/chunks/{usePress-4yjnfhQ_.js.map → usePress-B1yQk_p8.js.map} +1 -1
- package/dist/chunks/{useProgressBar-DJZIQMyS.js → useProgressBar-BsO-Q5JP.js} +2 -2
- package/dist/chunks/{useProgressBar-DJZIQMyS.js.map → useProgressBar-BsO-Q5JP.js.map} +1 -1
- package/dist/chunks/{useProgressBar-D2OaXApL.js → useProgressBar-d2k0k8r0.js} +4 -4
- package/dist/chunks/{useProgressBar-D2OaXApL.js.map → useProgressBar-d2k0k8r0.js.map} +1 -1
- package/dist/chunks/{useSlot-CEcR5EcL.js → useSlot-CFaaZeQE.js} +4 -4
- package/dist/chunks/{useSlot-CEcR5EcL.js.map → useSlot-CFaaZeQE.js.map} +1 -1
- package/dist/chunks/{useSlot-YqT3Ml-j.js → useSlot-TNtJf1z8.js} +3 -3
- package/dist/chunks/{useSlot-YqT3Ml-j.js.map → useSlot-TNtJf1z8.js.map} +1 -1
- package/dist/chunks/{utils-B3shU_E6.js → utils-BCEhcDlv.js} +6 -6
- package/dist/chunks/{utils-B3shU_E6.js.map → utils-BCEhcDlv.js.map} +1 -1
- package/dist/components/icons/icons.d.ts +20 -0
- package/dist/components/icons/icons.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +26 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/tabs.d.ts +40 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.styles.d.ts +87 -0
- package/dist/components/tabs/tabs.styles.d.ts.map +1 -0
- package/dist/data-table/index.cjs.js +293 -2810
- package/dist/data-table/index.cjs.js.map +1 -1
- package/dist/data-table/index.es.js +207 -2724
- package/dist/data-table/index.es.js.map +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +3 -3
- package/dist/lib/utils/assertion.d.ts +10 -0
- package/dist/lib/utils/assertion.d.ts.map +1 -0
- package/dist/lib/utils/class-name.d.ts +8 -0
- package/dist/lib/utils/class-name.d.ts.map +1 -0
- package/dist/lib/utils/cn.d.ts +23 -0
- package/dist/lib/utils/cn.d.ts.map +1 -0
- package/dist/lib/utils/collection-prop-injection.d.ts +32 -0
- package/dist/lib/utils/collection-prop-injection.d.ts.map +1 -0
- package/dist/lib/utils/compose.d.ts +8 -0
- package/dist/lib/utils/compose.d.ts.map +1 -0
- package/dist/lib/utils/dom.d.ts +22 -0
- package/dist/lib/utils/dom.d.ts.map +1 -0
- package/dist/lib/utils/field-slots-gate.d.ts +10 -0
- package/dist/lib/utils/field-slots-gate.d.ts.map +1 -0
- package/dist/lib/utils/logger.d.ts +24 -0
- package/dist/lib/utils/logger.d.ts.map +1 -0
- package/dist/lib/utils/normalize.d.ts +6 -0
- package/dist/lib/utils/normalize.d.ts.map +1 -0
- package/dist/lib/utils/use-has-text-slot.d.ts +14 -0
- package/dist/lib/utils/use-has-text-slot.d.ts.map +1 -0
- package/dist/lizaui.css +458 -0
- package/dist/meter/index.cjs.js +2 -2
- package/dist/meter/index.es.js +4 -4
- package/dist/progress-bar/index.cjs.js +1 -1
- package/dist/progress-bar/index.es.js +2 -2
- package/dist/radio/index.cjs.js +1 -1
- package/dist/radio/index.es.js +2 -2
- package/dist/radio-group/index.cjs.js +1 -1
- package/dist/radio-group/index.es.js +2 -2
- package/dist/slider/index.cjs.js +8 -7
- package/dist/slider/index.cjs.js.map +1 -1
- package/dist/slider/index.es.js +10 -9
- package/dist/slider/index.es.js.map +1 -1
- package/dist/tabs/index.cjs.js +1400 -0
- package/dist/tabs/index.cjs.js.map +1 -0
- package/dist/tabs/index.es.js +1400 -0
- package/dist/tabs/index.es.js.map +1 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/toggle-switch/index.cjs.js +8 -7
- package/dist/toggle-switch/index.cjs.js.map +1 -1
- package/dist/toggle-switch/index.es.js +8 -7
- package/dist/toggle-switch/index.es.js.map +1 -1
- package/dist/toolbar/index.cjs.js +2 -2
- package/dist/toolbar/index.es.js +4 -4
- package/package.json +6 -1
- package/dist/chunks/Button-B-wLEikV.js.map +0 -1
- package/dist/chunks/Button-DdtCMsXJ.js.map +0 -1
- package/dist/chunks/SharedElementTransition-BxczX23g.js +0 -12
- package/dist/chunks/SharedElementTransition-D87oSBzB.js +0 -13
- package/dist/chunks/VisuallyHidden-CiBoSB1U.js.map +0 -1
- package/dist/chunks/VisuallyHidden-paROiuP0.js +0 -86
- package/dist/chunks/VisuallyHidden-paROiuP0.js.map +0 -1
- package/dist/chunks/useLabel-DgF69V6e.js.map +0 -1
- package/dist/chunks/useLabel-DjFU7E9u.js.map +0 -1
|
@@ -0,0 +1,2577 @@
|
|
|
1
|
+
import { $ as $6f0c29017aeec335$export$d68d59712b04d9d1, a as $6f0c29017aeec335$export$408d25a4e12db025 } from "./BaseCollection-CdxYWaH6.js";
|
|
2
|
+
import { a as $fe16bffc7a557bf0$export$7f54fc3180508a52, j as $d1116acdf220c2da$export$f9762fab77588ecb, i as $8296dad1a4c5e0dc$export$8f71654801c2f7cd, $ as $48a7d519b337145d$export$4eaf04e54aa8eed6 } from "./useHover-BHCSbkLb.js";
|
|
3
|
+
import { a as $d7f64c32b702fe2c$export$8dc98ba7eadeaa56 } from "./Hidden-C55DpjMP.js";
|
|
4
|
+
import { i as $c7eafbbe1ea5834e$export$535bd6ca7f90a273, g as $c4867b2f328c2698$export$e5c5a5f917a5871c, $ as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, h as $390e54f620492c70$export$f680877a34711e37, d as $bbaa08b3cd72f041$export$9d1611c77c2fe928, j as $a4e76a5424781910$export$e08e3b67e392101e } from "./utils-BCEhcDlv.js";
|
|
5
|
+
import { createPortal, flushSync } from "react-dom";
|
|
6
|
+
import React__default, { useEffect, useMemo, cloneElement, forwardRef, useContext, createContext, useCallback, useState, useRef, isValidElement, version } from "react";
|
|
7
|
+
import { a as $792f28e438b9ad5f$export$c34620ff8881d89f } from "./SharedElementTransition-CJVe1D_I.js";
|
|
8
|
+
import { f as $d447af545b77c9f1$export$b204af158042fbac, g as $23f2114a1b82827e$export$cd4e5573fbe2b576, t as $2add3ce32c6007eb$export$9ac100e40613ea10, C as $d447af545b77c9f1$export$f531f92e2a15358f, w as $2add3ce32c6007eb$export$78551043582a6a98, h as $2add3ce32c6007eb$export$a11b0059900ceec8, a as $23f2114a1b82827e$export$e58f029f0fbfdb29, e as $3b8b240c1bf84ab9$export$4c063cf1350e6fed, v as $2add3ce32c6007eb$export$fedb369cb70207f1, D as $2add3ce32c6007eb$export$e1865c3bedcd822b, c as $23f2114a1b82827e$export$4282f70798064fe0, E as $caaf0dd3060ed57c$export$9a302a45f65d0572, j as $f192c2f16961cbe0$export$80f3e147d781571c, F as $23f2114a1b82827e$export$b4f377a2b6254582, d as $3b8b240c1bf84ab9$export$bebd5a1431fec25d, q as $1969ac565cfec8d0$export$de79e2c695e052f3, k as $8f5a2122b0992be3$export$630ff653c5ada6a9, $ as $d447af545b77c9f1$export$f21a1ffae260145a, s as $caaf0dd3060ed57c$export$95185d699e05d4d7 } from "./focusSafely-DfEgLKh6.js";
|
|
9
|
+
import { a as $535772f9d2c1f38d$export$2d6ec8fc375ceafa } from "./FocusScope-jSNMAXzg.js";
|
|
10
|
+
import { $ as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7 } from "./I18nProvider-Coj9x7B8.js";
|
|
11
|
+
import { a as $7096878c21af5e66$export$a929f3f93e2cc67e, $ as $d27d541f9569d26d$export$45712eceda6fad21 } from "./usePress-Arf10jW0.js";
|
|
12
|
+
import { $ as $3e6197669829fe11$export$40bfa8c7b0832715 } from "./useControlledState-DZA25XHU.js";
|
|
13
|
+
const $8b2399d051d06d4c$export$447a38995de2c711 = "react-aria-clear-focus";
|
|
14
|
+
const $8b2399d051d06d4c$export$831c820ad60f9d12 = "react-aria-focus";
|
|
15
|
+
function $b72f3f7b3b5f42c6$export$76e4e37e5339496d(to) {
|
|
16
|
+
let from = $b72f3f7b3b5f42c6$export$759df0d867455a91($d447af545b77c9f1$export$b204af158042fbac(to));
|
|
17
|
+
if (from !== to) {
|
|
18
|
+
if (from) $b72f3f7b3b5f42c6$export$6c5dc7e81d2cc29a(from, to);
|
|
19
|
+
if (to) $b72f3f7b3b5f42c6$export$2b35b76d2e30e129(to, from);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function $b72f3f7b3b5f42c6$export$6c5dc7e81d2cc29a(from, to) {
|
|
23
|
+
from.dispatchEvent(new FocusEvent("blur", {
|
|
24
|
+
relatedTarget: to
|
|
25
|
+
}));
|
|
26
|
+
from.dispatchEvent(new FocusEvent("focusout", {
|
|
27
|
+
bubbles: true,
|
|
28
|
+
relatedTarget: to
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function $b72f3f7b3b5f42c6$export$2b35b76d2e30e129(to, from) {
|
|
32
|
+
to.dispatchEvent(new FocusEvent("focus", {
|
|
33
|
+
relatedTarget: from
|
|
34
|
+
}));
|
|
35
|
+
to.dispatchEvent(new FocusEvent("focusin", {
|
|
36
|
+
bubbles: true,
|
|
37
|
+
relatedTarget: from
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
function $b72f3f7b3b5f42c6$export$759df0d867455a91(document2) {
|
|
41
|
+
let activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576(document2);
|
|
42
|
+
let activeDescendant = activeElement?.getAttribute("aria-activedescendant");
|
|
43
|
+
if (activeDescendant) return document2.getElementById(activeDescendant) || activeElement;
|
|
44
|
+
return activeElement;
|
|
45
|
+
}
|
|
46
|
+
const $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT = 100;
|
|
47
|
+
const $bb39c0fc1c19b34c$var$KEYBOARD_TIMEOUT = 600;
|
|
48
|
+
const $bb39c0fc1c19b34c$var$state = {
|
|
49
|
+
isOpen: false,
|
|
50
|
+
screenWidth: 0,
|
|
51
|
+
screenHeight: 0,
|
|
52
|
+
screenAngle: 0,
|
|
53
|
+
screenTimeout: 0,
|
|
54
|
+
startTimeStamp: 0,
|
|
55
|
+
endTimeStamp: 0,
|
|
56
|
+
resizeTimeStamp: 0,
|
|
57
|
+
resizeTimeout: 0
|
|
58
|
+
};
|
|
59
|
+
const $bb39c0fc1c19b34c$var$nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
60
|
+
"checkbox",
|
|
61
|
+
"radio",
|
|
62
|
+
"range",
|
|
63
|
+
"color",
|
|
64
|
+
"file",
|
|
65
|
+
"image",
|
|
66
|
+
"button",
|
|
67
|
+
"submit",
|
|
68
|
+
"reset"
|
|
69
|
+
]);
|
|
70
|
+
if (process.env.NODE_ENV === "test" && typeof window !== "undefined" && !Reflect.has(window, "visualViewport")) {
|
|
71
|
+
const visualViewport = Object.assign(new EventTarget(), {
|
|
72
|
+
offsetTop: 0,
|
|
73
|
+
offsetLeft: 0,
|
|
74
|
+
pageTop: 0,
|
|
75
|
+
pageLeft: 0,
|
|
76
|
+
scale: 1
|
|
77
|
+
});
|
|
78
|
+
Reflect.defineProperty(visualViewport, "width", {
|
|
79
|
+
get: () => window.innerWidth,
|
|
80
|
+
configurable: true
|
|
81
|
+
});
|
|
82
|
+
Reflect.defineProperty(visualViewport, "height", {
|
|
83
|
+
get: () => window.innerHeight,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
Reflect.defineProperty(window, "visualViewport", {
|
|
87
|
+
value: visualViewport,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (process.env.NODE_ENV === "test" && typeof window !== "undefined" && !Reflect.has(window.screen, "orientation")) {
|
|
93
|
+
const orientation = Object.assign(new EventTarget(), {
|
|
94
|
+
type: "landscape-primary"
|
|
95
|
+
});
|
|
96
|
+
Reflect.defineProperty(window.screen, "orientation", {
|
|
97
|
+
value: orientation,
|
|
98
|
+
configurable: true,
|
|
99
|
+
writable: true
|
|
100
|
+
});
|
|
101
|
+
Reflect.defineProperty(window.screen.orientation, "angle", {
|
|
102
|
+
get: () => window.orientation ?? 0,
|
|
103
|
+
configurable: true
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function $bb39c0fc1c19b34c$var$getTouchScreen() {
|
|
107
|
+
let screenWidth = Number(window.visualViewport?.width ?? window.innerWidth);
|
|
108
|
+
let screenHeight = Number(window.visualViewport?.height ?? window.innerHeight);
|
|
109
|
+
let visualScale = Number(window.visualViewport?.scale ?? 1);
|
|
110
|
+
return {
|
|
111
|
+
width: screenWidth * visualScale,
|
|
112
|
+
height: screenHeight * visualScale,
|
|
113
|
+
angle: window.screen.orientation.angle
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function $bb39c0fc1c19b34c$var$onResizeStart(e) {
|
|
117
|
+
if ($bb39c0fc1c19b34c$var$state.resizeTimeStamp <= e.timeStamp + 50) {
|
|
118
|
+
$bb39c0fc1c19b34c$var$state.resizeTimeStamp = e.timeStamp + 150;
|
|
119
|
+
window.clearTimeout($bb39c0fc1c19b34c$var$state.resizeTimeout);
|
|
120
|
+
$bb39c0fc1c19b34c$var$state.resizeTimeout = window.setTimeout($bb39c0fc1c19b34c$var$onResizeEnd, 150);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function $bb39c0fc1c19b34c$var$onResizeEnd() {
|
|
124
|
+
let viewportMeta = $7096878c21af5e66$export$a929f3f93e2cc67e("viewport");
|
|
125
|
+
if ($2add3ce32c6007eb$export$a11b0059900ceec8() && viewportMeta?.includes("overlays-content")) return;
|
|
126
|
+
let time = performance.now();
|
|
127
|
+
let screen = $bb39c0fc1c19b34c$var$getTouchScreen();
|
|
128
|
+
let elapsed = time - $bb39c0fc1c19b34c$var$state.startTimeStamp;
|
|
129
|
+
let delta = $bb39c0fc1c19b34c$var$state.screenHeight - screen.height;
|
|
130
|
+
let rotation = $bb39c0fc1c19b34c$var$state.screenAngle - screen.angle;
|
|
131
|
+
if (Math.abs(rotation) % 180 && $bb39c0fc1c19b34c$var$state.screenWidth - screen.height < $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT) {
|
|
132
|
+
$bb39c0fc1c19b34c$var$state.screenWidth = screen.width;
|
|
133
|
+
$bb39c0fc1c19b34c$var$state.screenHeight = screen.height;
|
|
134
|
+
$bb39c0fc1c19b34c$var$state.screenAngle = screen.angle;
|
|
135
|
+
delta = 0;
|
|
136
|
+
}
|
|
137
|
+
if (elapsed > $bb39c0fc1c19b34c$var$KEYBOARD_TIMEOUT) {
|
|
138
|
+
window.clearTimeout($bb39c0fc1c19b34c$var$state.screenTimeout);
|
|
139
|
+
$bb39c0fc1c19b34c$var$state.screenTimeout = window.setTimeout(() => {
|
|
140
|
+
let activeElement = document.hasFocus() ? $23f2114a1b82827e$export$cd4e5573fbe2b576() : null;
|
|
141
|
+
let willKeyboardOpen = $bb39c0fc1c19b34c$export$c57958e35f31ed73(activeElement);
|
|
142
|
+
let screen2 = $bb39c0fc1c19b34c$var$getTouchScreen();
|
|
143
|
+
if (Math.abs($bb39c0fc1c19b34c$var$state.screenAngle - screen2.angle) % 180) return;
|
|
144
|
+
if ($bb39c0fc1c19b34c$var$state.isOpen && willKeyboardOpen) return;
|
|
145
|
+
$bb39c0fc1c19b34c$var$state.screenWidth = screen2.width;
|
|
146
|
+
$bb39c0fc1c19b34c$var$state.screenHeight = screen2.height;
|
|
147
|
+
$bb39c0fc1c19b34c$var$state.screenAngle = screen2.angle;
|
|
148
|
+
$bb39c0fc1c19b34c$var$state.isOpen = false;
|
|
149
|
+
}, $bb39c0fc1c19b34c$var$KEYBOARD_TIMEOUT);
|
|
150
|
+
}
|
|
151
|
+
if (elapsed <= $bb39c0fc1c19b34c$var$KEYBOARD_TIMEOUT && delta >= $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT) $bb39c0fc1c19b34c$var$state.endTimeStamp = time;
|
|
152
|
+
$bb39c0fc1c19b34c$var$state.isOpen = delta >= $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT;
|
|
153
|
+
}
|
|
154
|
+
function $bb39c0fc1c19b34c$var$onOrientationChange() {
|
|
155
|
+
let screen = $bb39c0fc1c19b34c$var$getTouchScreen();
|
|
156
|
+
let rotation = $bb39c0fc1c19b34c$var$state.screenAngle - screen.angle;
|
|
157
|
+
if (Math.abs(rotation) % 180 && !$bb39c0fc1c19b34c$var$state.isOpen) {
|
|
158
|
+
let width = $bb39c0fc1c19b34c$var$state.screenWidth;
|
|
159
|
+
let height = $bb39c0fc1c19b34c$var$state.screenHeight;
|
|
160
|
+
$bb39c0fc1c19b34c$var$state.screenWidth = height;
|
|
161
|
+
$bb39c0fc1c19b34c$var$state.screenHeight = width;
|
|
162
|
+
}
|
|
163
|
+
if (!$bb39c0fc1c19b34c$var$state.isOpen) $bb39c0fc1c19b34c$var$state.screenAngle = screen.angle;
|
|
164
|
+
}
|
|
165
|
+
function $bb39c0fc1c19b34c$var$onFocus(e) {
|
|
166
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
167
|
+
let willKeyboardOpen = $bb39c0fc1c19b34c$export$c57958e35f31ed73(target);
|
|
168
|
+
let time = performance.now();
|
|
169
|
+
let screen = $bb39c0fc1c19b34c$var$getTouchScreen();
|
|
170
|
+
let delta = $bb39c0fc1c19b34c$var$state.screenHeight - screen.height;
|
|
171
|
+
if (delta < $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT && willKeyboardOpen) {
|
|
172
|
+
$bb39c0fc1c19b34c$var$state.screenWidth = screen.width;
|
|
173
|
+
$bb39c0fc1c19b34c$var$state.screenHeight = screen.height;
|
|
174
|
+
$bb39c0fc1c19b34c$var$state.screenAngle = screen.angle;
|
|
175
|
+
$bb39c0fc1c19b34c$var$state.startTimeStamp = time;
|
|
176
|
+
}
|
|
177
|
+
if (willKeyboardOpen) window.clearTimeout($bb39c0fc1c19b34c$var$state.screenTimeout);
|
|
178
|
+
if (delta >= $bb39c0fc1c19b34c$var$KEYBOARD_HEIGHT && willKeyboardOpen) $bb39c0fc1c19b34c$var$state.endTimeStamp = time;
|
|
179
|
+
}
|
|
180
|
+
function $bb39c0fc1c19b34c$var$setupGlobalEvents() {
|
|
181
|
+
let screen = $bb39c0fc1c19b34c$var$getTouchScreen();
|
|
182
|
+
$d447af545b77c9f1$export$f531f92e2a15358f(window.visualViewport, "resize", $2add3ce32c6007eb$export$78551043582a6a98() ? $bb39c0fc1c19b34c$var$onResizeEnd : $bb39c0fc1c19b34c$var$onResizeStart);
|
|
183
|
+
$d447af545b77c9f1$export$f531f92e2a15358f(window.screen.orientation, "change", $bb39c0fc1c19b34c$var$onOrientationChange);
|
|
184
|
+
$d447af545b77c9f1$export$f531f92e2a15358f(window, "focus", $bb39c0fc1c19b34c$var$onFocus, {
|
|
185
|
+
capture: true,
|
|
186
|
+
passive: true
|
|
187
|
+
});
|
|
188
|
+
$bb39c0fc1c19b34c$var$state.screenWidth = screen.width;
|
|
189
|
+
$bb39c0fc1c19b34c$var$state.screenHeight = screen.height;
|
|
190
|
+
$bb39c0fc1c19b34c$var$state.screenAngle = screen.angle;
|
|
191
|
+
}
|
|
192
|
+
if (typeof document !== "undefined") {
|
|
193
|
+
if (document.readyState !== "loading") $bb39c0fc1c19b34c$var$setupGlobalEvents();
|
|
194
|
+
else $d447af545b77c9f1$export$f531f92e2a15358f(document, "DOMContentLoaded", $bb39c0fc1c19b34c$var$setupGlobalEvents);
|
|
195
|
+
}
|
|
196
|
+
function $bb39c0fc1c19b34c$export$c57958e35f31ed73(target) {
|
|
197
|
+
if (!(target instanceof Element) || !$3b8b240c1bf84ab9$export$4c063cf1350e6fed(target)) return false;
|
|
198
|
+
let isTextArea = target instanceof HTMLTextAreaElement;
|
|
199
|
+
let isEditable = target instanceof HTMLElement && target.isContentEditable;
|
|
200
|
+
let isTextInput = target instanceof HTMLInputElement && !$bb39c0fc1c19b34c$var$nonTextInputTypes.has(target.type);
|
|
201
|
+
return isTextArea || isEditable || isTextInput;
|
|
202
|
+
}
|
|
203
|
+
function $bb39c0fc1c19b34c$export$16792effe837dba3(event) {
|
|
204
|
+
return $2add3ce32c6007eb$export$9ac100e40613ea10() ? event.metaKey : event.ctrlKey;
|
|
205
|
+
}
|
|
206
|
+
function $600b3cf69ae46262$export$90fc3a17d93f704c(ref, event, listener, options) {
|
|
207
|
+
let handleEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(listener);
|
|
208
|
+
let isDisabled = listener == null;
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (isDisabled || ref.current == null) return;
|
|
211
|
+
return $d447af545b77c9f1$export$f531f92e2a15358f(ref.current, event, handleEvent, options);
|
|
212
|
+
}, [
|
|
213
|
+
ref,
|
|
214
|
+
event,
|
|
215
|
+
options,
|
|
216
|
+
isDisabled
|
|
217
|
+
]);
|
|
218
|
+
}
|
|
219
|
+
class $96ead35620b8fd36$export$410b0c854570d131 {
|
|
220
|
+
constructor(ownerDocument) {
|
|
221
|
+
this._firstChild = null;
|
|
222
|
+
this._lastChild = null;
|
|
223
|
+
this._previousSibling = null;
|
|
224
|
+
this._nextSibling = null;
|
|
225
|
+
this._parentNode = null;
|
|
226
|
+
this._minInvalidChildIndex = null;
|
|
227
|
+
this.ownerDocument = ownerDocument;
|
|
228
|
+
}
|
|
229
|
+
*[Symbol.iterator]() {
|
|
230
|
+
let node = this.firstChild;
|
|
231
|
+
while (node) {
|
|
232
|
+
yield node;
|
|
233
|
+
node = node.nextSibling;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
get firstChild() {
|
|
237
|
+
return this._firstChild;
|
|
238
|
+
}
|
|
239
|
+
set firstChild(firstChild) {
|
|
240
|
+
this._firstChild = firstChild;
|
|
241
|
+
this.ownerDocument.markDirty(this);
|
|
242
|
+
}
|
|
243
|
+
get lastChild() {
|
|
244
|
+
return this._lastChild;
|
|
245
|
+
}
|
|
246
|
+
set lastChild(lastChild) {
|
|
247
|
+
this._lastChild = lastChild;
|
|
248
|
+
this.ownerDocument.markDirty(this);
|
|
249
|
+
}
|
|
250
|
+
get previousSibling() {
|
|
251
|
+
return this._previousSibling;
|
|
252
|
+
}
|
|
253
|
+
set previousSibling(previousSibling) {
|
|
254
|
+
this._previousSibling = previousSibling;
|
|
255
|
+
this.ownerDocument.markDirty(this);
|
|
256
|
+
}
|
|
257
|
+
get nextSibling() {
|
|
258
|
+
return this._nextSibling;
|
|
259
|
+
}
|
|
260
|
+
set nextSibling(nextSibling) {
|
|
261
|
+
this._nextSibling = nextSibling;
|
|
262
|
+
this.ownerDocument.markDirty(this);
|
|
263
|
+
}
|
|
264
|
+
get parentNode() {
|
|
265
|
+
return this._parentNode;
|
|
266
|
+
}
|
|
267
|
+
set parentNode(parentNode) {
|
|
268
|
+
this._parentNode = parentNode;
|
|
269
|
+
this.ownerDocument.markDirty(this);
|
|
270
|
+
}
|
|
271
|
+
get isConnected() {
|
|
272
|
+
return this.parentNode?.isConnected || false;
|
|
273
|
+
}
|
|
274
|
+
invalidateChildIndices(child) {
|
|
275
|
+
if (this._minInvalidChildIndex == null || !this._minInvalidChildIndex.isConnected || child.index < this._minInvalidChildIndex.index) {
|
|
276
|
+
this._minInvalidChildIndex = child;
|
|
277
|
+
this.ownerDocument.markDirty(this);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
updateChildIndices() {
|
|
281
|
+
let node = this._minInvalidChildIndex;
|
|
282
|
+
while (node) {
|
|
283
|
+
node.index = node.previousSibling ? node.previousSibling.index + 1 : 0;
|
|
284
|
+
node = node.nextSibling;
|
|
285
|
+
}
|
|
286
|
+
this._minInvalidChildIndex = null;
|
|
287
|
+
}
|
|
288
|
+
appendChild(child) {
|
|
289
|
+
if (child.parentNode) child.parentNode.removeChild(child);
|
|
290
|
+
if (this.firstChild == null) this.firstChild = child;
|
|
291
|
+
if (this.lastChild) {
|
|
292
|
+
this.lastChild.nextSibling = child;
|
|
293
|
+
child.index = this.lastChild.index + 1;
|
|
294
|
+
child.previousSibling = this.lastChild;
|
|
295
|
+
} else {
|
|
296
|
+
child.previousSibling = null;
|
|
297
|
+
child.index = 0;
|
|
298
|
+
}
|
|
299
|
+
child.parentNode = this;
|
|
300
|
+
child.nextSibling = null;
|
|
301
|
+
this.lastChild = child;
|
|
302
|
+
this.ownerDocument.markDirty(this);
|
|
303
|
+
if (this.isConnected) this.ownerDocument.queueUpdate();
|
|
304
|
+
}
|
|
305
|
+
insertBefore(newNode, referenceNode) {
|
|
306
|
+
if (referenceNode == null) return this.appendChild(newNode);
|
|
307
|
+
if (newNode.parentNode) newNode.parentNode.removeChild(newNode);
|
|
308
|
+
newNode.nextSibling = referenceNode;
|
|
309
|
+
newNode.previousSibling = referenceNode.previousSibling;
|
|
310
|
+
newNode.index = referenceNode.index - 1;
|
|
311
|
+
if (this.firstChild === referenceNode) this.firstChild = newNode;
|
|
312
|
+
else if (referenceNode.previousSibling) referenceNode.previousSibling.nextSibling = newNode;
|
|
313
|
+
referenceNode.previousSibling = newNode;
|
|
314
|
+
newNode.parentNode = referenceNode.parentNode;
|
|
315
|
+
this.invalidateChildIndices(newNode);
|
|
316
|
+
if (this.isConnected) this.ownerDocument.queueUpdate();
|
|
317
|
+
}
|
|
318
|
+
removeChild(child) {
|
|
319
|
+
if (child.parentNode !== this) return;
|
|
320
|
+
if (this._minInvalidChildIndex === child) this._minInvalidChildIndex = null;
|
|
321
|
+
if (child.nextSibling) {
|
|
322
|
+
this.invalidateChildIndices(child.nextSibling);
|
|
323
|
+
child.nextSibling.previousSibling = child.previousSibling;
|
|
324
|
+
}
|
|
325
|
+
if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling;
|
|
326
|
+
if (this.firstChild === child) this.firstChild = child.nextSibling;
|
|
327
|
+
if (this.lastChild === child) this.lastChild = child.previousSibling;
|
|
328
|
+
child.parentNode = null;
|
|
329
|
+
child.nextSibling = null;
|
|
330
|
+
child.previousSibling = null;
|
|
331
|
+
child.index = 0;
|
|
332
|
+
this.ownerDocument.markDirty(child);
|
|
333
|
+
if (this.isConnected) this.ownerDocument.queueUpdate();
|
|
334
|
+
}
|
|
335
|
+
addEventListener() {
|
|
336
|
+
}
|
|
337
|
+
removeEventListener() {
|
|
338
|
+
}
|
|
339
|
+
get previousVisibleSibling() {
|
|
340
|
+
let node = this.previousSibling;
|
|
341
|
+
while (node && node.isHidden) node = node.previousSibling;
|
|
342
|
+
return node;
|
|
343
|
+
}
|
|
344
|
+
get nextVisibleSibling() {
|
|
345
|
+
let node = this.nextSibling;
|
|
346
|
+
while (node && node.isHidden) node = node.nextSibling;
|
|
347
|
+
return node;
|
|
348
|
+
}
|
|
349
|
+
get firstVisibleChild() {
|
|
350
|
+
let node = this.firstChild;
|
|
351
|
+
while (node && node.isHidden) node = node.nextSibling;
|
|
352
|
+
return node;
|
|
353
|
+
}
|
|
354
|
+
get lastVisibleChild() {
|
|
355
|
+
let node = this.lastChild;
|
|
356
|
+
while (node && node.isHidden) node = node.previousSibling;
|
|
357
|
+
return node;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
class $96ead35620b8fd36$export$dc064fe9e59310fd extends $96ead35620b8fd36$export$410b0c854570d131 {
|
|
361
|
+
constructor(type, ownerDocument) {
|
|
362
|
+
super(ownerDocument), this.nodeType = 8, this.isMutated = true, this._index = 0, this.isHidden = false;
|
|
363
|
+
this.node = null;
|
|
364
|
+
}
|
|
365
|
+
get index() {
|
|
366
|
+
return this._index;
|
|
367
|
+
}
|
|
368
|
+
set index(index) {
|
|
369
|
+
this._index = index;
|
|
370
|
+
this.ownerDocument.markDirty(this);
|
|
371
|
+
}
|
|
372
|
+
get level() {
|
|
373
|
+
if (this.parentNode instanceof $96ead35620b8fd36$export$dc064fe9e59310fd) return this.parentNode.level + (this.parentNode.node?.type === "item" ? 1 : 0);
|
|
374
|
+
return 0;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Lazily gets a mutable instance of a Node. If the node has already
|
|
378
|
+
* been cloned during this update cycle, it just returns the existing one.
|
|
379
|
+
*/
|
|
380
|
+
getMutableNode() {
|
|
381
|
+
if (this.node == null) return null;
|
|
382
|
+
if (!this.isMutated) {
|
|
383
|
+
this.node = this.node.clone();
|
|
384
|
+
this.isMutated = true;
|
|
385
|
+
}
|
|
386
|
+
this.ownerDocument.markDirty(this);
|
|
387
|
+
return this.node;
|
|
388
|
+
}
|
|
389
|
+
updateNode() {
|
|
390
|
+
let nextSibling = this.nextVisibleSibling;
|
|
391
|
+
let node = this.getMutableNode();
|
|
392
|
+
if (node == null) return;
|
|
393
|
+
node.index = this.index;
|
|
394
|
+
node.level = this.level;
|
|
395
|
+
node.parentKey = this.parentNode instanceof $96ead35620b8fd36$export$dc064fe9e59310fd ? this.parentNode.node?.key ?? null : null;
|
|
396
|
+
node.prevKey = this.previousVisibleSibling?.node?.key ?? null;
|
|
397
|
+
node.nextKey = nextSibling?.node?.key ?? null;
|
|
398
|
+
node.hasChildNodes = !!this.firstChild;
|
|
399
|
+
node.firstChildKey = this.firstVisibleChild?.node?.key ?? null;
|
|
400
|
+
node.lastChildKey = this.lastVisibleChild?.node?.key ?? null;
|
|
401
|
+
if ((node.colSpan != null || node.colIndex != null) && nextSibling) {
|
|
402
|
+
let nextColIndex = (node.colIndex ?? node.index) + (node.colSpan ?? 1);
|
|
403
|
+
if (nextSibling.node != null && nextColIndex !== nextSibling.node.colIndex) {
|
|
404
|
+
let siblingNode = nextSibling.getMutableNode();
|
|
405
|
+
siblingNode.colIndex = nextColIndex;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
setProps(obj, ref, CollectionNodeClass, rendered, render) {
|
|
410
|
+
let node;
|
|
411
|
+
let { value: value1, textValue, id, ...props } = obj;
|
|
412
|
+
if (this.node == null) {
|
|
413
|
+
node = new CollectionNodeClass(id ?? `react-aria-${++this.ownerDocument.nodeId}`);
|
|
414
|
+
this.node = node;
|
|
415
|
+
} else node = this.getMutableNode();
|
|
416
|
+
props.ref = ref;
|
|
417
|
+
node.props = props;
|
|
418
|
+
node.rendered = rendered;
|
|
419
|
+
node.render = render;
|
|
420
|
+
node.value = value1;
|
|
421
|
+
if (obj["aria-label"]) node["aria-label"] = obj["aria-label"];
|
|
422
|
+
node.textValue = textValue || (typeof props.children === "string" ? props.children : "") || obj["aria-label"] || "";
|
|
423
|
+
if (id != null && id !== node.key) throw new Error("Cannot change the id of an item");
|
|
424
|
+
if (props.colSpan != null) node.colSpan = props.colSpan;
|
|
425
|
+
if (this.isConnected) this.ownerDocument.queueUpdate();
|
|
426
|
+
}
|
|
427
|
+
get style() {
|
|
428
|
+
let element = this;
|
|
429
|
+
return {
|
|
430
|
+
get display() {
|
|
431
|
+
return element.isHidden ? "none" : "";
|
|
432
|
+
},
|
|
433
|
+
set display(value) {
|
|
434
|
+
let isHidden = value === "none";
|
|
435
|
+
if (element.isHidden !== isHidden) {
|
|
436
|
+
if (element.parentNode?.firstVisibleChild === element || element.parentNode?.lastVisibleChild === element) element.ownerDocument.markDirty(element.parentNode);
|
|
437
|
+
let prev = element.previousVisibleSibling;
|
|
438
|
+
let next = element.nextVisibleSibling;
|
|
439
|
+
if (prev) element.ownerDocument.markDirty(prev);
|
|
440
|
+
if (next) element.ownerDocument.markDirty(next);
|
|
441
|
+
element.isHidden = isHidden;
|
|
442
|
+
element.ownerDocument.markDirty(element);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
hasAttribute() {
|
|
448
|
+
}
|
|
449
|
+
setAttribute() {
|
|
450
|
+
}
|
|
451
|
+
setAttributeNS() {
|
|
452
|
+
}
|
|
453
|
+
removeAttribute() {
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
class $96ead35620b8fd36$export$b34a105447964f9f extends $96ead35620b8fd36$export$410b0c854570d131 {
|
|
457
|
+
constructor(collection) {
|
|
458
|
+
super(null), this.nodeType = 11, this.ownerDocument = this, this.dirtyNodes = /* @__PURE__ */ new Set(), this.isSSR = false, this.nodeId = 0, this.nodesByProps = /* @__PURE__ */ new WeakMap(), this.keyOwners = /* @__PURE__ */ new Map(), this.nextCollection = null, this.subscriptions = /* @__PURE__ */ new Set(), this.queuedRender = false, this.inSubscription = false;
|
|
459
|
+
this.collection = collection;
|
|
460
|
+
this.nextCollection = collection;
|
|
461
|
+
}
|
|
462
|
+
get isConnected() {
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
createElement(type) {
|
|
466
|
+
return new $96ead35620b8fd36$export$dc064fe9e59310fd(type, this);
|
|
467
|
+
}
|
|
468
|
+
getMutableCollection() {
|
|
469
|
+
if (!this.nextCollection) this.nextCollection = this.collection.clone();
|
|
470
|
+
return this.nextCollection;
|
|
471
|
+
}
|
|
472
|
+
markDirty(node) {
|
|
473
|
+
this.dirtyNodes.add(node);
|
|
474
|
+
}
|
|
475
|
+
addNode(element) {
|
|
476
|
+
if (element.isHidden || element.node == null) return;
|
|
477
|
+
if (process.env.NODE_ENV !== "production") {
|
|
478
|
+
let key = element.node.key;
|
|
479
|
+
let owner = this.keyOwners.get(key);
|
|
480
|
+
if (owner && owner !== element) throw new Error(`Duplicate key "${String(key)}" found in collection. Every item in a collection must have a unique key.`);
|
|
481
|
+
this.keyOwners.set(key, element);
|
|
482
|
+
}
|
|
483
|
+
let collection = this.getMutableCollection();
|
|
484
|
+
if (!collection.getItem(element.node.key)) for (let child of element) this.addNode(child);
|
|
485
|
+
collection.addNode(element.node);
|
|
486
|
+
}
|
|
487
|
+
removeNode(node) {
|
|
488
|
+
for (let child of node) this.removeNode(child);
|
|
489
|
+
if (node.node) {
|
|
490
|
+
let collection = this.getMutableCollection();
|
|
491
|
+
collection.removeNode(node.node.key);
|
|
492
|
+
if (process.env.NODE_ENV !== "production" && this.keyOwners.get(node.node.key) === node) this.keyOwners.delete(node.node.key);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/** Finalizes the collection update, updating all nodes and freezing the collection. */
|
|
496
|
+
getCollection() {
|
|
497
|
+
if (this.inSubscription) return this.collection;
|
|
498
|
+
this.queuedRender = false;
|
|
499
|
+
this.updateCollection();
|
|
500
|
+
return this.collection;
|
|
501
|
+
}
|
|
502
|
+
updateCollection() {
|
|
503
|
+
for (let element of this.dirtyNodes) if (element instanceof $96ead35620b8fd36$export$dc064fe9e59310fd && (!element.isConnected || element.isHidden)) this.removeNode(element);
|
|
504
|
+
else element.updateChildIndices();
|
|
505
|
+
for (let element of this.dirtyNodes) if (element instanceof $96ead35620b8fd36$export$dc064fe9e59310fd) {
|
|
506
|
+
if (element.isConnected && !element.isHidden) {
|
|
507
|
+
element.updateNode();
|
|
508
|
+
this.addNode(element);
|
|
509
|
+
}
|
|
510
|
+
if (element.node) this.dirtyNodes.delete(element);
|
|
511
|
+
element.isMutated = false;
|
|
512
|
+
} else this.dirtyNodes.delete(element);
|
|
513
|
+
if (this.nextCollection) {
|
|
514
|
+
this.nextCollection.commit(this.firstVisibleChild?.node?.key ?? null, this.lastVisibleChild?.node?.key ?? null, this.isSSR);
|
|
515
|
+
if (!this.isSSR) {
|
|
516
|
+
this.collection = this.nextCollection;
|
|
517
|
+
this.nextCollection = null;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
queueUpdate() {
|
|
522
|
+
if (this.dirtyNodes.size === 0 || this.queuedRender) return;
|
|
523
|
+
this.queuedRender = true;
|
|
524
|
+
this.inSubscription = true;
|
|
525
|
+
if (!this.isSSR) this.collection = this.collection.clone();
|
|
526
|
+
for (let fn of this.subscriptions) fn();
|
|
527
|
+
this.inSubscription = false;
|
|
528
|
+
}
|
|
529
|
+
subscribe(fn) {
|
|
530
|
+
this.subscriptions.add(fn);
|
|
531
|
+
if (this.queuedRender) fn();
|
|
532
|
+
return () => this.subscriptions.delete(fn);
|
|
533
|
+
}
|
|
534
|
+
resetAfterSSR() {
|
|
535
|
+
if (this.isSSR) {
|
|
536
|
+
this.isSSR = false;
|
|
537
|
+
this.firstChild = null;
|
|
538
|
+
this.lastChild = null;
|
|
539
|
+
this.nodeId = 0;
|
|
540
|
+
this.keyOwners.clear();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function $a80bd3e9349588e7$export$727c8fc270210f13(props) {
|
|
545
|
+
let { children, items, idScope, addIdAndValue, dependencies = [] } = props;
|
|
546
|
+
let childrenString = useMemo(() => process.env.NODE_ENV !== "production" && typeof children === "function" ? children.toString() : void 0, [
|
|
547
|
+
children
|
|
548
|
+
]);
|
|
549
|
+
let cache = useMemo(() => /* @__PURE__ */ new WeakMap(), [
|
|
550
|
+
...dependencies,
|
|
551
|
+
childrenString
|
|
552
|
+
]);
|
|
553
|
+
return useMemo(() => {
|
|
554
|
+
if (items && typeof children === "function") {
|
|
555
|
+
let res = [];
|
|
556
|
+
for (let item of items) {
|
|
557
|
+
let cacheKey = $a80bd3e9349588e7$var$isWeakKey(item) ? item : null;
|
|
558
|
+
let rendered = cacheKey ? cache.get(cacheKey) : null;
|
|
559
|
+
if (!rendered) {
|
|
560
|
+
rendered = children(item);
|
|
561
|
+
let id = rendered.props.id ?? item?.key ?? item?.id;
|
|
562
|
+
if (idScope != null && rendered.props.id == null && id != null) id = idScope + ":" + id;
|
|
563
|
+
let key = id ?? res.length;
|
|
564
|
+
rendered = cloneElement(rendered, addIdAndValue ? {
|
|
565
|
+
key,
|
|
566
|
+
id,
|
|
567
|
+
value: item
|
|
568
|
+
} : {
|
|
569
|
+
key
|
|
570
|
+
});
|
|
571
|
+
if (cacheKey) cache.set(cacheKey, rendered);
|
|
572
|
+
}
|
|
573
|
+
res.push(rendered);
|
|
574
|
+
}
|
|
575
|
+
return res;
|
|
576
|
+
} else if (typeof children !== "function") return children;
|
|
577
|
+
}, [
|
|
578
|
+
children,
|
|
579
|
+
items,
|
|
580
|
+
cache,
|
|
581
|
+
idScope,
|
|
582
|
+
addIdAndValue
|
|
583
|
+
]);
|
|
584
|
+
}
|
|
585
|
+
function $a80bd3e9349588e7$var$isWeakKey(value) {
|
|
586
|
+
switch (typeof value) {
|
|
587
|
+
case "object":
|
|
588
|
+
return value != null;
|
|
589
|
+
case "function":
|
|
590
|
+
case "symbol":
|
|
591
|
+
return true;
|
|
592
|
+
default:
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
var shim = { exports: {} };
|
|
597
|
+
var useSyncExternalStoreShim_production = {};
|
|
598
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
599
|
+
function requireUseSyncExternalStoreShim_production() {
|
|
600
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
601
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
602
|
+
var React = React__default;
|
|
603
|
+
function is(x, y) {
|
|
604
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
605
|
+
}
|
|
606
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
|
|
607
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
608
|
+
var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
609
|
+
useLayoutEffect(
|
|
610
|
+
function() {
|
|
611
|
+
inst.value = value;
|
|
612
|
+
inst.getSnapshot = getSnapshot;
|
|
613
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
614
|
+
},
|
|
615
|
+
[subscribe, value, getSnapshot]
|
|
616
|
+
);
|
|
617
|
+
useEffect2(
|
|
618
|
+
function() {
|
|
619
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
620
|
+
return subscribe(function() {
|
|
621
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
[subscribe]
|
|
625
|
+
);
|
|
626
|
+
useDebugValue(value);
|
|
627
|
+
return value;
|
|
628
|
+
}
|
|
629
|
+
function checkIfSnapshotChanged(inst) {
|
|
630
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
631
|
+
inst = inst.value;
|
|
632
|
+
try {
|
|
633
|
+
var nextValue = latestGetSnapshot();
|
|
634
|
+
return !objectIs(inst, nextValue);
|
|
635
|
+
} catch (error) {
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
640
|
+
return getSnapshot();
|
|
641
|
+
}
|
|
642
|
+
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
643
|
+
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
644
|
+
return useSyncExternalStoreShim_production;
|
|
645
|
+
}
|
|
646
|
+
var useSyncExternalStoreShim_development = {};
|
|
647
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
648
|
+
function requireUseSyncExternalStoreShim_development() {
|
|
649
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
650
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
651
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
652
|
+
function is(x, y) {
|
|
653
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
654
|
+
}
|
|
655
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
656
|
+
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = true, void 0);
|
|
657
|
+
var value = getSnapshot();
|
|
658
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
659
|
+
var cachedValue = getSnapshot();
|
|
660
|
+
objectIs(value, cachedValue) || (void 0, didWarnUncachedGetSnapshot = true);
|
|
661
|
+
}
|
|
662
|
+
cachedValue = useState2({
|
|
663
|
+
inst: { value, getSnapshot }
|
|
664
|
+
});
|
|
665
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
666
|
+
useLayoutEffect(
|
|
667
|
+
function() {
|
|
668
|
+
inst.value = value;
|
|
669
|
+
inst.getSnapshot = getSnapshot;
|
|
670
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
671
|
+
},
|
|
672
|
+
[subscribe, value, getSnapshot]
|
|
673
|
+
);
|
|
674
|
+
useEffect2(
|
|
675
|
+
function() {
|
|
676
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
677
|
+
return subscribe(function() {
|
|
678
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
679
|
+
});
|
|
680
|
+
},
|
|
681
|
+
[subscribe]
|
|
682
|
+
);
|
|
683
|
+
useDebugValue(value);
|
|
684
|
+
return value;
|
|
685
|
+
}
|
|
686
|
+
function checkIfSnapshotChanged(inst) {
|
|
687
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
688
|
+
inst = inst.value;
|
|
689
|
+
try {
|
|
690
|
+
var nextValue = latestGetSnapshot();
|
|
691
|
+
return !objectIs(inst, nextValue);
|
|
692
|
+
} catch (error) {
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
697
|
+
return getSnapshot();
|
|
698
|
+
}
|
|
699
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
700
|
+
var React = React__default, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
701
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
702
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
703
|
+
})();
|
|
704
|
+
return useSyncExternalStoreShim_development;
|
|
705
|
+
}
|
|
706
|
+
var hasRequiredShim;
|
|
707
|
+
function requireShim() {
|
|
708
|
+
if (hasRequiredShim) return shim.exports;
|
|
709
|
+
hasRequiredShim = 1;
|
|
710
|
+
if (process.env.NODE_ENV === "production") {
|
|
711
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
712
|
+
} else {
|
|
713
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
714
|
+
}
|
|
715
|
+
return shim.exports;
|
|
716
|
+
}
|
|
717
|
+
var shimExports = requireShim();
|
|
718
|
+
const $42ceafc619f9c3ba$var$ShallowRenderContext = /* @__PURE__ */ createContext(false);
|
|
719
|
+
const $42ceafc619f9c3ba$var$CollectionDocumentContext = /* @__PURE__ */ createContext(null);
|
|
720
|
+
function $42ceafc619f9c3ba$export$bf788dd355e3a401(props) {
|
|
721
|
+
let doc = useContext($42ceafc619f9c3ba$var$CollectionDocumentContext);
|
|
722
|
+
if (doc)
|
|
723
|
+
return props.content;
|
|
724
|
+
let { collection, document: document2 } = $42ceafc619f9c3ba$var$useCollectionDocument(props.createCollection);
|
|
725
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement($d7f64c32b702fe2c$export$8dc98ba7eadeaa56, null, /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$CollectionDocumentContext.Provider, {
|
|
726
|
+
value: document2
|
|
727
|
+
}, props.content)), /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$CollectionInner, {
|
|
728
|
+
render: props.children,
|
|
729
|
+
collection
|
|
730
|
+
}));
|
|
731
|
+
}
|
|
732
|
+
function $42ceafc619f9c3ba$var$CollectionInner({ collection, render }) {
|
|
733
|
+
return render(collection);
|
|
734
|
+
}
|
|
735
|
+
function $42ceafc619f9c3ba$var$useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) {
|
|
736
|
+
let isSSR = $c7eafbbe1ea5834e$export$535bd6ca7f90a273();
|
|
737
|
+
let isSSRRef = useRef(isSSR);
|
|
738
|
+
isSSRRef.current = isSSR;
|
|
739
|
+
let getSnapshotWrapper = useCallback(() => {
|
|
740
|
+
return isSSRRef.current ? getServerSnapshot() : getSnapshot();
|
|
741
|
+
}, [
|
|
742
|
+
getSnapshot,
|
|
743
|
+
getServerSnapshot
|
|
744
|
+
]);
|
|
745
|
+
return shimExports.useSyncExternalStore(subscribe, getSnapshotWrapper);
|
|
746
|
+
}
|
|
747
|
+
const $42ceafc619f9c3ba$var$useSyncExternalStore = typeof React__default["useSyncExternalStore"] === "function" ? React__default["useSyncExternalStore"] : $42ceafc619f9c3ba$var$useSyncExternalStoreFallback;
|
|
748
|
+
function $42ceafc619f9c3ba$var$useCollectionDocument(createCollection) {
|
|
749
|
+
let [document2] = useState(() => new $96ead35620b8fd36$export$b34a105447964f9f(createCollection?.() || new $6f0c29017aeec335$export$408d25a4e12db025()));
|
|
750
|
+
let subscribe = useCallback((fn) => document2.subscribe(fn), [
|
|
751
|
+
document2
|
|
752
|
+
]);
|
|
753
|
+
let getSnapshot = useCallback(() => {
|
|
754
|
+
let collection2 = document2.getCollection();
|
|
755
|
+
if (document2.isSSR)
|
|
756
|
+
document2.resetAfterSSR();
|
|
757
|
+
return collection2;
|
|
758
|
+
}, [
|
|
759
|
+
document2
|
|
760
|
+
]);
|
|
761
|
+
let getServerSnapshot = useCallback(() => {
|
|
762
|
+
document2.isSSR = true;
|
|
763
|
+
return document2.getCollection();
|
|
764
|
+
}, [
|
|
765
|
+
document2
|
|
766
|
+
]);
|
|
767
|
+
let collection = $42ceafc619f9c3ba$var$useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
768
|
+
return {
|
|
769
|
+
collection,
|
|
770
|
+
document: document2
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
const $42ceafc619f9c3ba$var$SSRContext = /* @__PURE__ */ createContext(null);
|
|
774
|
+
function $42ceafc619f9c3ba$var$createCollectionNodeClass(type) {
|
|
775
|
+
var _a;
|
|
776
|
+
let NodeClass = (_a = class extends $6f0c29017aeec335$export$d68d59712b04d9d1 {
|
|
777
|
+
}, _a.type = type, _a);
|
|
778
|
+
return NodeClass;
|
|
779
|
+
}
|
|
780
|
+
function $42ceafc619f9c3ba$var$useSSRCollectionNode(CollectionNodeClass, props, ref, rendered, children, render) {
|
|
781
|
+
if (typeof CollectionNodeClass === "string")
|
|
782
|
+
CollectionNodeClass = $42ceafc619f9c3ba$var$createCollectionNodeClass(CollectionNodeClass);
|
|
783
|
+
let itemRef = useCallback((element) => {
|
|
784
|
+
element?.setProps(props, ref, CollectionNodeClass, rendered, render);
|
|
785
|
+
}, [
|
|
786
|
+
props,
|
|
787
|
+
ref,
|
|
788
|
+
rendered,
|
|
789
|
+
render,
|
|
790
|
+
CollectionNodeClass
|
|
791
|
+
]);
|
|
792
|
+
let parentNode = useContext($42ceafc619f9c3ba$var$SSRContext);
|
|
793
|
+
if (parentNode) {
|
|
794
|
+
let element = parentNode.ownerDocument.nodesByProps.get(props);
|
|
795
|
+
if (!element) {
|
|
796
|
+
element = parentNode.ownerDocument.createElement(CollectionNodeClass.type);
|
|
797
|
+
element.setProps(props, ref, CollectionNodeClass, rendered, render);
|
|
798
|
+
parentNode.appendChild(element);
|
|
799
|
+
parentNode.ownerDocument.updateCollection();
|
|
800
|
+
parentNode.ownerDocument.nodesByProps.set(props, element);
|
|
801
|
+
}
|
|
802
|
+
return children ? /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$SSRContext.Provider, {
|
|
803
|
+
value: element
|
|
804
|
+
}, children) : null;
|
|
805
|
+
}
|
|
806
|
+
return /* @__PURE__ */ React__default.createElement(CollectionNodeClass.type, {
|
|
807
|
+
ref: itemRef
|
|
808
|
+
}, children);
|
|
809
|
+
}
|
|
810
|
+
function $42ceafc619f9c3ba$export$18af5c7a9e9b3664(CollectionNodeClass, render) {
|
|
811
|
+
let Component = ({ node }) => render(node.props, node.props.ref, node);
|
|
812
|
+
let Result = forwardRef((props, ref) => {
|
|
813
|
+
let focusableProps = useContext($d1116acdf220c2da$export$f9762fab77588ecb);
|
|
814
|
+
let isShallow = useContext($42ceafc619f9c3ba$var$ShallowRenderContext);
|
|
815
|
+
if (!isShallow) {
|
|
816
|
+
if (render.length >= 3) throw new Error(render.name + " cannot be rendered outside a collection.");
|
|
817
|
+
return render(props, ref);
|
|
818
|
+
}
|
|
819
|
+
return $42ceafc619f9c3ba$var$useSSRCollectionNode(CollectionNodeClass, props, ref, "children" in props ? props.children : null, null, (node) => (
|
|
820
|
+
// Forward FocusableContext to real DOM tree so tooltips work.
|
|
821
|
+
/* @__PURE__ */ React__default.createElement($d1116acdf220c2da$export$f9762fab77588ecb.Provider, {
|
|
822
|
+
value: focusableProps
|
|
823
|
+
}, /* @__PURE__ */ React__default.createElement(Component, {
|
|
824
|
+
node
|
|
825
|
+
}))
|
|
826
|
+
));
|
|
827
|
+
});
|
|
828
|
+
Result.displayName = render.name;
|
|
829
|
+
return Result;
|
|
830
|
+
}
|
|
831
|
+
function $42ceafc619f9c3ba$export$e953bb1cd0f19726(CollectionNodeClass, render, useChildren = $42ceafc619f9c3ba$var$useCollectionChildren) {
|
|
832
|
+
let Component = ({ node }) => render(node.props, node.props.ref, node);
|
|
833
|
+
let Result = forwardRef((props, ref) => {
|
|
834
|
+
let children = useChildren(props);
|
|
835
|
+
return $42ceafc619f9c3ba$var$useSSRCollectionNode(CollectionNodeClass, props, ref, null, children, (node) => /* @__PURE__ */ React__default.createElement(Component, {
|
|
836
|
+
node
|
|
837
|
+
})) ?? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
838
|
+
});
|
|
839
|
+
Result.displayName = render.name;
|
|
840
|
+
return Result;
|
|
841
|
+
}
|
|
842
|
+
function $42ceafc619f9c3ba$var$useCollectionChildren(options) {
|
|
843
|
+
return $a80bd3e9349588e7$export$727c8fc270210f13({
|
|
844
|
+
...options,
|
|
845
|
+
addIdAndValue: true
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
const $42ceafc619f9c3ba$var$CollectionContext = /* @__PURE__ */ createContext(null);
|
|
849
|
+
function $42ceafc619f9c3ba$export$fb8073518f34e6ec(props) {
|
|
850
|
+
let ctx = useContext($42ceafc619f9c3ba$var$CollectionContext);
|
|
851
|
+
let dependencies = (ctx?.dependencies || []).concat(props.dependencies);
|
|
852
|
+
let idScope = props.idScope ?? ctx?.idScope;
|
|
853
|
+
let children = $42ceafc619f9c3ba$var$useCollectionChildren({
|
|
854
|
+
...props,
|
|
855
|
+
idScope,
|
|
856
|
+
dependencies
|
|
857
|
+
});
|
|
858
|
+
let doc = useContext($42ceafc619f9c3ba$var$CollectionDocumentContext);
|
|
859
|
+
if (doc) children = /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$CollectionRoot, null, children);
|
|
860
|
+
ctx = useMemo(
|
|
861
|
+
() => ({
|
|
862
|
+
dependencies: (
|
|
863
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
864
|
+
dependencies
|
|
865
|
+
),
|
|
866
|
+
idScope
|
|
867
|
+
}),
|
|
868
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
869
|
+
// oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
|
|
870
|
+
[
|
|
871
|
+
idScope,
|
|
872
|
+
...dependencies
|
|
873
|
+
]
|
|
874
|
+
);
|
|
875
|
+
return /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$CollectionContext.Provider, {
|
|
876
|
+
value: ctx
|
|
877
|
+
}, children);
|
|
878
|
+
}
|
|
879
|
+
function $42ceafc619f9c3ba$var$CollectionRoot({ children }) {
|
|
880
|
+
let doc = useContext($42ceafc619f9c3ba$var$CollectionDocumentContext);
|
|
881
|
+
let wrappedChildren = useMemo(() => /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$CollectionDocumentContext.Provider, {
|
|
882
|
+
value: null
|
|
883
|
+
}, /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$ShallowRenderContext.Provider, {
|
|
884
|
+
value: true
|
|
885
|
+
}, children)), [
|
|
886
|
+
children
|
|
887
|
+
]);
|
|
888
|
+
return $c7eafbbe1ea5834e$export$535bd6ca7f90a273() ? /* @__PURE__ */ React__default.createElement($42ceafc619f9c3ba$var$SSRContext.Provider, {
|
|
889
|
+
value: doc
|
|
890
|
+
}, wrappedChildren) : /* @__PURE__ */ createPortal(wrappedChildren, doc);
|
|
891
|
+
}
|
|
892
|
+
const $263ab7fc0f95ccdb$export$a164736487e3f0ae = {
|
|
893
|
+
CollectionRoot({ collection, renderDropIndicator }) {
|
|
894
|
+
return $263ab7fc0f95ccdb$var$useCollectionRender(collection, null, renderDropIndicator);
|
|
895
|
+
},
|
|
896
|
+
CollectionBranch({ collection, parent, renderDropIndicator }) {
|
|
897
|
+
return $263ab7fc0f95ccdb$var$useCollectionRender(collection, parent, renderDropIndicator);
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
function $263ab7fc0f95ccdb$var$useCollectionRender(collection, parent, renderDropIndicator) {
|
|
901
|
+
return $a80bd3e9349588e7$export$727c8fc270210f13({
|
|
902
|
+
items: parent ? collection.getChildren(parent.key) : collection,
|
|
903
|
+
dependencies: [
|
|
904
|
+
renderDropIndicator
|
|
905
|
+
],
|
|
906
|
+
children(node) {
|
|
907
|
+
if (node.type === "content") return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
908
|
+
let rendered = node.render(node);
|
|
909
|
+
if (!renderDropIndicator || node.type !== "item") return rendered;
|
|
910
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderDropIndicator({
|
|
911
|
+
type: "item",
|
|
912
|
+
key: node.key,
|
|
913
|
+
dropPosition: "before"
|
|
914
|
+
}), rendered, $263ab7fc0f95ccdb$export$2dbbd341daed716d(collection, node, renderDropIndicator));
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
function $263ab7fc0f95ccdb$export$2dbbd341daed716d(collection, node, renderDropIndicator) {
|
|
919
|
+
let key = node.key;
|
|
920
|
+
let keyAfter = collection.getKeyAfter(key);
|
|
921
|
+
let nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;
|
|
922
|
+
while (nextItemInFlattenedCollection != null && nextItemInFlattenedCollection.type !== "item") {
|
|
923
|
+
keyAfter = collection.getKeyAfter(nextItemInFlattenedCollection.key);
|
|
924
|
+
nextItemInFlattenedCollection = keyAfter != null ? collection.getItem(keyAfter) : null;
|
|
925
|
+
}
|
|
926
|
+
let nextItemInSameLevel = node.nextKey != null ? collection.getItem(node.nextKey) : null;
|
|
927
|
+
while (nextItemInSameLevel != null && nextItemInSameLevel.type !== "item") nextItemInSameLevel = nextItemInSameLevel.nextKey != null ? collection.getItem(nextItemInSameLevel.nextKey) : null;
|
|
928
|
+
let afterIndicators = [];
|
|
929
|
+
if (nextItemInSameLevel == null) {
|
|
930
|
+
let current = node;
|
|
931
|
+
while (current?.type === "item" && (!nextItemInFlattenedCollection || current.parentKey !== nextItemInFlattenedCollection.parentKey && nextItemInFlattenedCollection.level < current.level)) {
|
|
932
|
+
let indicator = renderDropIndicator({
|
|
933
|
+
type: "item",
|
|
934
|
+
key: current.key,
|
|
935
|
+
dropPosition: "after"
|
|
936
|
+
});
|
|
937
|
+
if (/* @__PURE__ */ isValidElement(indicator)) afterIndicators.push(/* @__PURE__ */ cloneElement(indicator, {
|
|
938
|
+
key: `${current.key}-after`
|
|
939
|
+
}));
|
|
940
|
+
current = current.parentKey != null ? collection.getItem(current.parentKey) : null;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
return afterIndicators;
|
|
944
|
+
}
|
|
945
|
+
const $263ab7fc0f95ccdb$export$4feb769f8ddf26c5 = /* @__PURE__ */ createContext($263ab7fc0f95ccdb$export$a164736487e3f0ae);
|
|
946
|
+
function $263ab7fc0f95ccdb$export$90e00781bc59d8f9(focusedKey) {
|
|
947
|
+
return useMemo(() => focusedKey != null ? /* @__PURE__ */ new Set([
|
|
948
|
+
focusedKey
|
|
949
|
+
]) : null, [
|
|
950
|
+
focusedKey
|
|
951
|
+
]);
|
|
952
|
+
}
|
|
953
|
+
function $901761b40e390936$export$2bb74740c4e19def(node, checkForOverflow) {
|
|
954
|
+
if (!node) return false;
|
|
955
|
+
let style = window.getComputedStyle(node);
|
|
956
|
+
let root = document.scrollingElement || document.documentElement;
|
|
957
|
+
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
958
|
+
if (node === root && style.overflow !== "hidden") isScrollable = true;
|
|
959
|
+
if (isScrollable && checkForOverflow) isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
|
|
960
|
+
return isScrollable;
|
|
961
|
+
}
|
|
962
|
+
function $76d97191f0f90600$export$94ed1c92c7beeb22(node, checkForOverflow) {
|
|
963
|
+
let parentElements = [];
|
|
964
|
+
let root = document.scrollingElement || document.documentElement;
|
|
965
|
+
while (node) {
|
|
966
|
+
if ($901761b40e390936$export$2bb74740c4e19def(node, checkForOverflow)) parentElements.push(node);
|
|
967
|
+
if (node === root) break;
|
|
968
|
+
node = node.parentElement;
|
|
969
|
+
}
|
|
970
|
+
return parentElements;
|
|
971
|
+
}
|
|
972
|
+
function $51a3e22a5186a962$export$53a0910f038337bd(scrollView, element, opts = {}) {
|
|
973
|
+
if (scrollView === element) return;
|
|
974
|
+
let target = element.getBoundingClientRect();
|
|
975
|
+
$51a3e22a5186a962$export$f064fd83a2c6e9ca(scrollView, element, target, opts);
|
|
976
|
+
}
|
|
977
|
+
function $51a3e22a5186a962$export$f064fd83a2c6e9ca(scrollView, element, target, opts = {}) {
|
|
978
|
+
let { block = "nearest", inline = "nearest" } = opts;
|
|
979
|
+
let y = scrollView.scrollTop;
|
|
980
|
+
let x = scrollView.scrollLeft;
|
|
981
|
+
let view = scrollView.getBoundingClientRect();
|
|
982
|
+
let itemStyle = window.getComputedStyle(element);
|
|
983
|
+
let viewStyle = window.getComputedStyle(scrollView);
|
|
984
|
+
let root = document.scrollingElement || document.documentElement;
|
|
985
|
+
let isRoot = scrollView === root;
|
|
986
|
+
let viewTop = scrollView === root ? 0 : view.top;
|
|
987
|
+
let viewBottom = scrollView === root ? scrollView.clientHeight : view.bottom;
|
|
988
|
+
let viewLeft = scrollView === root ? 0 : view.left;
|
|
989
|
+
let viewRight = scrollView === root ? scrollView.clientWidth : view.right;
|
|
990
|
+
let scrollMarginTop = parseFloat(itemStyle.scrollMarginTop) || 0;
|
|
991
|
+
let scrollMarginBottom = parseFloat(itemStyle.scrollMarginBottom) || 0;
|
|
992
|
+
let scrollMarginLeft = parseFloat(itemStyle.scrollMarginLeft) || 0;
|
|
993
|
+
let scrollMarginRight = parseFloat(itemStyle.scrollMarginRight) || 0;
|
|
994
|
+
let scrollPaddingTop = parseFloat(viewStyle.scrollPaddingTop) || 0;
|
|
995
|
+
let scrollPaddingBottom = parseFloat(viewStyle.scrollPaddingBottom) || 0;
|
|
996
|
+
let scrollPaddingLeft = parseFloat(viewStyle.scrollPaddingLeft) || 0;
|
|
997
|
+
let scrollPaddingRight = parseFloat(viewStyle.scrollPaddingRight) || 0;
|
|
998
|
+
let borderTopWidth = parseFloat(viewStyle.borderTopWidth) || 0;
|
|
999
|
+
let borderBottomWidth = parseFloat(viewStyle.borderBottomWidth) || 0;
|
|
1000
|
+
let borderLeftWidth = parseFloat(viewStyle.borderLeftWidth) || 0;
|
|
1001
|
+
let borderRightWidth = parseFloat(viewStyle.borderRightWidth) || 0;
|
|
1002
|
+
let scrollAreaTop = target.top - scrollMarginTop;
|
|
1003
|
+
let scrollAreaBottom = target.bottom + scrollMarginBottom;
|
|
1004
|
+
let scrollAreaLeft = target.left - scrollMarginLeft;
|
|
1005
|
+
let scrollAreaRight = target.right + scrollMarginRight;
|
|
1006
|
+
let scrollBarOffsetX = scrollView === root ? 0 : borderLeftWidth + borderRightWidth;
|
|
1007
|
+
let scrollBarOffsetY = scrollView === root ? 0 : borderTopWidth + borderBottomWidth;
|
|
1008
|
+
let scrollBarWidth = scrollView === root ? 0 : scrollView.offsetWidth - scrollView.clientWidth - scrollBarOffsetX;
|
|
1009
|
+
let scrollBarHeight = scrollView === root ? 0 : scrollView.offsetHeight - scrollView.clientHeight - scrollBarOffsetY;
|
|
1010
|
+
let scrollPortTop = viewTop + (isRoot ? 0 : borderTopWidth) + scrollPaddingTop;
|
|
1011
|
+
let scrollPortBottom = viewBottom - (isRoot ? 0 : borderBottomWidth) - scrollPaddingBottom - scrollBarHeight;
|
|
1012
|
+
let scrollPortLeft = viewLeft + (isRoot ? 0 : borderLeftWidth) + scrollPaddingLeft;
|
|
1013
|
+
let scrollPortRight = viewRight - (isRoot ? 0 : borderRightWidth) - scrollPaddingRight;
|
|
1014
|
+
if ($2add3ce32c6007eb$export$fedb369cb70207f1() && $2add3ce32c6007eb$export$78551043582a6a98() || viewStyle.direction === "ltr") scrollPortRight -= scrollBarWidth;
|
|
1015
|
+
else if (viewStyle.direction === "rtl") scrollPortLeft += scrollBarWidth;
|
|
1016
|
+
let shouldScrollBlock = scrollAreaTop < scrollPortTop || scrollAreaBottom > scrollPortBottom;
|
|
1017
|
+
let shouldScrollInline = scrollAreaLeft < scrollPortLeft || scrollAreaRight > scrollPortRight;
|
|
1018
|
+
if (shouldScrollBlock && block === "start") y += scrollAreaTop - scrollPortTop;
|
|
1019
|
+
else if (shouldScrollBlock && block === "center") y += (scrollAreaTop + scrollAreaBottom) / 2 - (scrollPortTop + scrollPortBottom) / 2;
|
|
1020
|
+
else if (shouldScrollBlock && block === "end") y += scrollAreaBottom - scrollPortBottom;
|
|
1021
|
+
else if (shouldScrollBlock && block === "nearest") {
|
|
1022
|
+
let start = scrollAreaTop - scrollPortTop;
|
|
1023
|
+
let end = scrollAreaBottom - scrollPortBottom;
|
|
1024
|
+
y += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
1025
|
+
}
|
|
1026
|
+
if (shouldScrollInline && inline === "start") x += scrollAreaLeft - scrollPortLeft;
|
|
1027
|
+
else if (shouldScrollInline && inline === "center") x += (scrollAreaLeft + scrollAreaRight) / 2 - (scrollPortLeft + scrollPortRight) / 2;
|
|
1028
|
+
else if (shouldScrollInline && inline === "end") x += scrollAreaRight - scrollPortRight;
|
|
1029
|
+
else if (shouldScrollInline && inline === "nearest") {
|
|
1030
|
+
let start = scrollAreaLeft - scrollPortLeft;
|
|
1031
|
+
let end = scrollAreaRight - scrollPortRight;
|
|
1032
|
+
x += Math.abs(start) <= Math.abs(end) ? start : end;
|
|
1033
|
+
}
|
|
1034
|
+
if (process.env.NODE_ENV === "test") {
|
|
1035
|
+
scrollView.scrollLeft = x;
|
|
1036
|
+
scrollView.scrollTop = y;
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
scrollView.scrollTo({
|
|
1040
|
+
left: x,
|
|
1041
|
+
top: y
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
function $51a3e22a5186a962$export$c826860796309d1b(targetElement, opts = {}) {
|
|
1045
|
+
let { containingElement } = opts;
|
|
1046
|
+
if (targetElement && targetElement.isConnected) {
|
|
1047
|
+
let root = document.scrollingElement || document.documentElement;
|
|
1048
|
+
let isScrollPrevented = window.getComputedStyle(root).overflow === "hidden";
|
|
1049
|
+
if (!isScrollPrevented) {
|
|
1050
|
+
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
1051
|
+
targetElement?.scrollIntoView?.({
|
|
1052
|
+
block: "nearest"
|
|
1053
|
+
});
|
|
1054
|
+
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
1055
|
+
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
1056
|
+
containingElement?.scrollIntoView?.({
|
|
1057
|
+
block: "center",
|
|
1058
|
+
inline: "center"
|
|
1059
|
+
});
|
|
1060
|
+
targetElement.scrollIntoView?.({
|
|
1061
|
+
block: "nearest"
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
} else {
|
|
1065
|
+
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
|
|
1066
|
+
let scrollParents = $76d97191f0f90600$export$94ed1c92c7beeb22(targetElement, true);
|
|
1067
|
+
for (let scrollParent of scrollParents) $51a3e22a5186a962$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1068
|
+
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
|
|
1069
|
+
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
|
|
1070
|
+
scrollParents = containingElement ? $76d97191f0f90600$export$94ed1c92c7beeb22(containingElement, true) : [];
|
|
1071
|
+
for (let scrollParent of scrollParents) $51a3e22a5186a962$export$53a0910f038337bd(scrollParent, containingElement, {
|
|
1072
|
+
block: "center",
|
|
1073
|
+
inline: "center"
|
|
1074
|
+
});
|
|
1075
|
+
for (let scrollParent of $76d97191f0f90600$export$94ed1c92c7beeb22(targetElement, true)) $51a3e22a5186a962$export$53a0910f038337bd(scrollParent, targetElement);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
let $121970af65029459$var$descriptionId = 0;
|
|
1081
|
+
const $121970af65029459$var$descriptionNodes = /* @__PURE__ */ new Map();
|
|
1082
|
+
function $121970af65029459$export$f8aeda7b10753fa1(description) {
|
|
1083
|
+
let [id, setId] = useState();
|
|
1084
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
1085
|
+
if (!description) return;
|
|
1086
|
+
let desc = $121970af65029459$var$descriptionNodes.get(description);
|
|
1087
|
+
if (!desc) {
|
|
1088
|
+
let id2 = `react-aria-description-${$121970af65029459$var$descriptionId++}`;
|
|
1089
|
+
setId(id2);
|
|
1090
|
+
let node = document.createElement("div");
|
|
1091
|
+
node.id = id2;
|
|
1092
|
+
node.style.display = "none";
|
|
1093
|
+
node.textContent = description;
|
|
1094
|
+
document.body.appendChild(node);
|
|
1095
|
+
desc = {
|
|
1096
|
+
refCount: 0,
|
|
1097
|
+
element: node
|
|
1098
|
+
};
|
|
1099
|
+
$121970af65029459$var$descriptionNodes.set(description, desc);
|
|
1100
|
+
} else setId(desc.element.id);
|
|
1101
|
+
desc.refCount++;
|
|
1102
|
+
return () => {
|
|
1103
|
+
if (desc && --desc.refCount === 0) {
|
|
1104
|
+
desc.element.remove();
|
|
1105
|
+
$121970af65029459$var$descriptionNodes.delete(description);
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
}, [
|
|
1109
|
+
description
|
|
1110
|
+
]);
|
|
1111
|
+
return {
|
|
1112
|
+
"aria-describedby": description ? id : void 0
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
const $91fe5e721c7f36c1$export$c9549807523555e0 = /* @__PURE__ */ createContext({
|
|
1116
|
+
isSelected: false
|
|
1117
|
+
});
|
|
1118
|
+
const $91fe5e721c7f36c1$export$17f80983afe4e444 = /* @__PURE__ */ forwardRef(function SelectionIndicator(props, ref) {
|
|
1119
|
+
[props, ref] = $7230ffa83bc0c2cf$export$29f1550f4b0d4415(props, ref, $91fe5e721c7f36c1$export$c9549807523555e0);
|
|
1120
|
+
let { isSelected, ...otherProps } = props;
|
|
1121
|
+
return /* @__PURE__ */ React__default.createElement($792f28e438b9ad5f$export$c34620ff8881d89f, {
|
|
1122
|
+
...otherProps,
|
|
1123
|
+
ref,
|
|
1124
|
+
className: props.className || "react-aria-SelectionIndicator",
|
|
1125
|
+
name: "SelectionIndicator",
|
|
1126
|
+
isVisible: isSelected
|
|
1127
|
+
});
|
|
1128
|
+
});
|
|
1129
|
+
function $22bbea12c2567021$export$d3e3bd3e26688c04(e) {
|
|
1130
|
+
return $2add3ce32c6007eb$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
|
|
1131
|
+
}
|
|
1132
|
+
function $22bbea12c2567021$export$c3d8340acf92597f(collectionRef, key) {
|
|
1133
|
+
let selector = `[data-key="${CSS.escape(String(key))}"]`;
|
|
1134
|
+
let collection = collectionRef.current?.dataset.collection;
|
|
1135
|
+
if (collection) selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
|
|
1136
|
+
return collectionRef.current?.querySelector(selector);
|
|
1137
|
+
}
|
|
1138
|
+
const $22bbea12c2567021$var$collectionMap = /* @__PURE__ */ new WeakMap();
|
|
1139
|
+
function $22bbea12c2567021$export$881eb0d9f3605d9d(collection) {
|
|
1140
|
+
let id = $390e54f620492c70$export$f680877a34711e37();
|
|
1141
|
+
$22bbea12c2567021$var$collectionMap.set(collection, id);
|
|
1142
|
+
return id;
|
|
1143
|
+
}
|
|
1144
|
+
function $22bbea12c2567021$export$6aeb1680a0ae8741(collection) {
|
|
1145
|
+
return $22bbea12c2567021$var$collectionMap.get(collection);
|
|
1146
|
+
}
|
|
1147
|
+
const $f5a4a9a3486154da$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
|
|
1148
|
+
function $f5a4a9a3486154da$export$e32c88dfddc6e1d8(options) {
|
|
1149
|
+
let { keyboardDelegate, selectionManager, onTypeSelect } = options;
|
|
1150
|
+
let state = useRef({
|
|
1151
|
+
search: "",
|
|
1152
|
+
timeout: void 0
|
|
1153
|
+
});
|
|
1154
|
+
let onKeyDownCapture = (e) => {
|
|
1155
|
+
if (state.current.search.length > 0 && e.key === " ") {
|
|
1156
|
+
e.preventDefault();
|
|
1157
|
+
if (!("continuePropagation" in e) || "continuePropagation" in e && !e.isPropagationStopped()) e.stopPropagation();
|
|
1158
|
+
state.current.search += " ";
|
|
1159
|
+
if (keyboardDelegate.getKeyForSearch != null) {
|
|
1160
|
+
let key = keyboardDelegate.getKeyForSearch(state.current.search, selectionManager.focusedKey);
|
|
1161
|
+
if (key == null) key = keyboardDelegate.getKeyForSearch(state.current.search);
|
|
1162
|
+
if (key != null) {
|
|
1163
|
+
selectionManager.setFocusedKey(key);
|
|
1164
|
+
if (onTypeSelect) onTypeSelect(key);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
clearTimeout(state.current.timeout);
|
|
1168
|
+
state.current.timeout = setTimeout(() => {
|
|
1169
|
+
state.current.search = "";
|
|
1170
|
+
}, $f5a4a9a3486154da$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
let onKeyDown = (e) => {
|
|
1174
|
+
let character = $f5a4a9a3486154da$var$getStringForKey(e.key);
|
|
1175
|
+
if (!character || e.ctrlKey || e.metaKey || e.altKey || !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) || state.current.search.length === 0 && character === " ") return;
|
|
1176
|
+
state.current.search += character;
|
|
1177
|
+
if (keyboardDelegate.getKeyForSearch != null) {
|
|
1178
|
+
let key = keyboardDelegate.getKeyForSearch(state.current.search, selectionManager.focusedKey);
|
|
1179
|
+
if (key == null) key = keyboardDelegate.getKeyForSearch(state.current.search);
|
|
1180
|
+
if (key != null) {
|
|
1181
|
+
selectionManager.setFocusedKey(key);
|
|
1182
|
+
if (onTypeSelect) onTypeSelect(key);
|
|
1183
|
+
e.preventDefault();
|
|
1184
|
+
if (!("continuePropagation" in e)) e.stopPropagation();
|
|
1185
|
+
} else {
|
|
1186
|
+
state.current.search = "";
|
|
1187
|
+
clearTimeout(state.current.timeout);
|
|
1188
|
+
state.current.timeout = void 0;
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
clearTimeout(state.current.timeout);
|
|
1193
|
+
state.current.timeout = setTimeout(() => {
|
|
1194
|
+
state.current.search = "";
|
|
1195
|
+
}, $f5a4a9a3486154da$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
1196
|
+
};
|
|
1197
|
+
useEffect(() => {
|
|
1198
|
+
let timeout = state.current.timeout;
|
|
1199
|
+
return () => {
|
|
1200
|
+
clearTimeout(timeout);
|
|
1201
|
+
};
|
|
1202
|
+
}, [
|
|
1203
|
+
state
|
|
1204
|
+
]);
|
|
1205
|
+
return {
|
|
1206
|
+
typeSelectProps: {
|
|
1207
|
+
// Using a capturing listener to catch the keydown event before
|
|
1208
|
+
// other hooks in order to handle the Spacebar event.
|
|
1209
|
+
onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDownCapture : void 0,
|
|
1210
|
+
onKeyDown: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
function $f5a4a9a3486154da$var$getStringForKey(key) {
|
|
1215
|
+
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
1216
|
+
return "";
|
|
1217
|
+
}
|
|
1218
|
+
function $a475cdc2445827b5$export$72ef708ab07251f1(effect, dependencies) {
|
|
1219
|
+
const isInitialMount = useRef(true);
|
|
1220
|
+
const lastDeps = useRef(null);
|
|
1221
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
1222
|
+
isInitialMount.current = true;
|
|
1223
|
+
return () => {
|
|
1224
|
+
isInitialMount.current = false;
|
|
1225
|
+
};
|
|
1226
|
+
}, []);
|
|
1227
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
1228
|
+
if (isInitialMount.current) isInitialMount.current = false;
|
|
1229
|
+
else if (!lastDeps.current || dependencies.some((dep, i) => !Object.is(dep, lastDeps[i]))) effect();
|
|
1230
|
+
lastDeps.current = dependencies;
|
|
1231
|
+
}, dependencies);
|
|
1232
|
+
}
|
|
1233
|
+
function $d667c2af82d35a98$export$d6daf82dcd84e87c(options) {
|
|
1234
|
+
let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, scrollRef = ref, linkBehavior = "action", UNSTABLE_focusOnEntry } = options;
|
|
1235
|
+
let { direction } = $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7();
|
|
1236
|
+
let router = $caaf0dd3060ed57c$export$9a302a45f65d0572();
|
|
1237
|
+
const navigateToKey = (e, key, childFocus) => {
|
|
1238
|
+
if (key != null) {
|
|
1239
|
+
if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$22bbea12c2567021$export$d3e3bd3e26688c04(e)) {
|
|
1240
|
+
flushSync(() => {
|
|
1241
|
+
manager.setFocusedKey(key, childFocus);
|
|
1242
|
+
});
|
|
1243
|
+
let item = $22bbea12c2567021$export$c3d8340acf92597f(ref, key);
|
|
1244
|
+
let itemProps = manager.getItemProps(key);
|
|
1245
|
+
if (item) {
|
|
1246
|
+
router.open(item, e, itemProps.href, itemProps.routerOptions);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
manager.setFocusedKey(key, childFocus);
|
|
1252
|
+
if (manager.isLink(key) && linkBehavior === "override") return false;
|
|
1253
|
+
if (e.shiftKey && manager.selectionMode === "multiple") {
|
|
1254
|
+
manager.extendSelection(key);
|
|
1255
|
+
return;
|
|
1256
|
+
} else if (selectOnFocus && !$22bbea12c2567021$export$d3e3bd3e26688c04(e)) {
|
|
1257
|
+
manager.replaceSelection(key);
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return false;
|
|
1262
|
+
};
|
|
1263
|
+
let arrowDown = (e) => {
|
|
1264
|
+
if (delegate.getKeyBelow) {
|
|
1265
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow?.(manager.focusedKey) : delegate.getFirstKey?.();
|
|
1266
|
+
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getFirstKey?.(manager.focusedKey);
|
|
1267
|
+
if (nextKey != null) {
|
|
1268
|
+
navigateToKey(e, nextKey);
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
return false;
|
|
1273
|
+
};
|
|
1274
|
+
let arrowUp = (e) => {
|
|
1275
|
+
if (delegate.getKeyAbove) {
|
|
1276
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove?.(manager.focusedKey) : delegate.getLastKey?.();
|
|
1277
|
+
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getLastKey?.(manager.focusedKey);
|
|
1278
|
+
if (nextKey != null) {
|
|
1279
|
+
navigateToKey(e, nextKey);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
return false;
|
|
1284
|
+
};
|
|
1285
|
+
let home = (e) => {
|
|
1286
|
+
if (delegate.getFirstKey) {
|
|
1287
|
+
if (manager.focusedKey === null && e.shiftKey) return false;
|
|
1288
|
+
let firstKey2 = delegate.getFirstKey(manager.focusedKey, $bb39c0fc1c19b34c$export$16792effe837dba3(e));
|
|
1289
|
+
manager.setFocusedKey(firstKey2);
|
|
1290
|
+
if (firstKey2 != null) {
|
|
1291
|
+
if ($bb39c0fc1c19b34c$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") {
|
|
1292
|
+
manager.extendSelection(firstKey2);
|
|
1293
|
+
return;
|
|
1294
|
+
} else if (selectOnFocus) {
|
|
1295
|
+
manager.replaceSelection(firstKey2);
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
return false;
|
|
1301
|
+
};
|
|
1302
|
+
let arrowLeft = (e) => {
|
|
1303
|
+
if (delegate.getKeyLeftOf) {
|
|
1304
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyLeftOf?.(manager.focusedKey) : delegate.getFirstKey?.();
|
|
1305
|
+
if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? delegate.getFirstKey?.(manager.focusedKey) : delegate.getLastKey?.(manager.focusedKey);
|
|
1306
|
+
if (nextKey != null) {
|
|
1307
|
+
navigateToKey(e, nextKey, direction === "rtl" ? "first" : "last");
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return false;
|
|
1312
|
+
};
|
|
1313
|
+
let arrowRight = (e) => {
|
|
1314
|
+
if (delegate.getKeyRightOf) {
|
|
1315
|
+
let nextKey = manager.focusedKey != null ? delegate.getKeyRightOf?.(manager.focusedKey) : delegate.getFirstKey?.();
|
|
1316
|
+
if (nextKey == null && shouldFocusWrap) nextKey = direction === "rtl" ? delegate.getLastKey?.(manager.focusedKey) : delegate.getFirstKey?.(manager.focusedKey);
|
|
1317
|
+
if (nextKey != null) {
|
|
1318
|
+
navigateToKey(e, nextKey, direction === "rtl" ? "last" : "first");
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return false;
|
|
1323
|
+
};
|
|
1324
|
+
let end = (e) => {
|
|
1325
|
+
if (delegate.getLastKey) {
|
|
1326
|
+
if (manager.focusedKey === null && e.shiftKey) return false;
|
|
1327
|
+
let lastKey = delegate.getLastKey(manager.focusedKey, $bb39c0fc1c19b34c$export$16792effe837dba3(e));
|
|
1328
|
+
manager.setFocusedKey(lastKey);
|
|
1329
|
+
if (lastKey != null) {
|
|
1330
|
+
if ($bb39c0fc1c19b34c$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple") {
|
|
1331
|
+
manager.extendSelection(lastKey);
|
|
1332
|
+
return;
|
|
1333
|
+
} else if (selectOnFocus) {
|
|
1334
|
+
manager.replaceSelection(lastKey);
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
return false;
|
|
1340
|
+
};
|
|
1341
|
+
let pageDown = (e) => {
|
|
1342
|
+
if (delegate.getKeyPageBelow && manager.focusedKey != null) {
|
|
1343
|
+
let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
|
|
1344
|
+
if (nextKey != null) return navigateToKey(e, nextKey);
|
|
1345
|
+
}
|
|
1346
|
+
return false;
|
|
1347
|
+
};
|
|
1348
|
+
let pageUp = (e) => {
|
|
1349
|
+
if (delegate.getKeyPageAbove && manager.focusedKey != null) {
|
|
1350
|
+
let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
|
|
1351
|
+
if (nextKey != null) return navigateToKey(e, nextKey);
|
|
1352
|
+
}
|
|
1353
|
+
return false;
|
|
1354
|
+
};
|
|
1355
|
+
let aHandler = () => {
|
|
1356
|
+
if (manager.selectionMode === "multiple" && disallowSelectAll !== true) {
|
|
1357
|
+
manager.selectAll();
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
return false;
|
|
1361
|
+
};
|
|
1362
|
+
let escape = () => {
|
|
1363
|
+
if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
|
|
1364
|
+
manager.clearSelection();
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
return false;
|
|
1368
|
+
};
|
|
1369
|
+
let tab = () => {
|
|
1370
|
+
if (!allowsTabNavigation && ref.current) {
|
|
1371
|
+
let walker = $535772f9d2c1f38d$export$2d6ec8fc375ceafa(ref.current, {
|
|
1372
|
+
tabbable: true
|
|
1373
|
+
});
|
|
1374
|
+
let next = void 0;
|
|
1375
|
+
let last;
|
|
1376
|
+
do {
|
|
1377
|
+
last = walker.lastChild();
|
|
1378
|
+
if (last) next = last;
|
|
1379
|
+
} while (last);
|
|
1380
|
+
let activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576();
|
|
1381
|
+
if (next && (!$23f2114a1b82827e$export$b4f377a2b6254582(next) || activeElement && !$3b8b240c1bf84ab9$export$bebd5a1431fec25d(activeElement))) $1969ac565cfec8d0$export$de79e2c695e052f3(next);
|
|
1382
|
+
}
|
|
1383
|
+
return {
|
|
1384
|
+
shouldContinuePropagation: true,
|
|
1385
|
+
shouldPreventDefault: false
|
|
1386
|
+
};
|
|
1387
|
+
};
|
|
1388
|
+
let shiftTab = () => {
|
|
1389
|
+
if (!allowsTabNavigation && ref.current) ref.current.focus();
|
|
1390
|
+
return {
|
|
1391
|
+
shouldContinuePropagation: true,
|
|
1392
|
+
shouldPreventDefault: false
|
|
1393
|
+
};
|
|
1394
|
+
};
|
|
1395
|
+
let withShiftSel = (key, callback) => {
|
|
1396
|
+
return {
|
|
1397
|
+
[$2add3ce32c6007eb$export$9ac100e40613ea10() ? key + "+Shift+Alt" : key + "+Shift+Control"]: callback,
|
|
1398
|
+
[key + "+Shift"]: callback,
|
|
1399
|
+
[$2add3ce32c6007eb$export$9ac100e40613ea10() ? key + "+Alt" : key + "+Control"]: callback,
|
|
1400
|
+
[key]: callback
|
|
1401
|
+
};
|
|
1402
|
+
};
|
|
1403
|
+
let { keyboardProps: repeatKeyboardProps } = $8296dad1a4c5e0dc$export$8f71654801c2f7cd({
|
|
1404
|
+
shortcuts: {
|
|
1405
|
+
...withShiftSel("ArrowDown", arrowDown),
|
|
1406
|
+
...withShiftSel("ArrowUp", arrowUp),
|
|
1407
|
+
...withShiftSel("ArrowLeft", arrowLeft),
|
|
1408
|
+
...withShiftSel("ArrowRight", arrowRight),
|
|
1409
|
+
...withShiftSel("PageDown", pageDown),
|
|
1410
|
+
...withShiftSel("PageUp", pageUp)
|
|
1411
|
+
},
|
|
1412
|
+
allowRepeats: true
|
|
1413
|
+
});
|
|
1414
|
+
let { keyboardProps } = $8296dad1a4c5e0dc$export$8f71654801c2f7cd({
|
|
1415
|
+
shortcuts: {
|
|
1416
|
+
...withShiftSel("Home", home),
|
|
1417
|
+
...withShiftSel("End", end),
|
|
1418
|
+
"Mod+A": aHandler,
|
|
1419
|
+
Escape: escape,
|
|
1420
|
+
Tab: tab,
|
|
1421
|
+
"Tab+Shift": shiftTab
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
let scrollPos = useRef({
|
|
1425
|
+
top: 0,
|
|
1426
|
+
left: 0
|
|
1427
|
+
});
|
|
1428
|
+
$600b3cf69ae46262$export$90fc3a17d93f704c(scrollRef, "scroll", () => {
|
|
1429
|
+
scrollPos.current = {
|
|
1430
|
+
top: scrollRef.current?.scrollTop ?? 0,
|
|
1431
|
+
left: scrollRef.current?.scrollLeft ?? 0
|
|
1432
|
+
};
|
|
1433
|
+
});
|
|
1434
|
+
let onFocus = (e) => {
|
|
1435
|
+
if (manager.isFocused) {
|
|
1436
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) manager.setFocused(false);
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
1440
|
+
let modality = $8f5a2122b0992be3$export$630ff653c5ada6a9();
|
|
1441
|
+
manager.setFocused(true);
|
|
1442
|
+
let navigateToKey2 = (key) => {
|
|
1443
|
+
if (key != null) {
|
|
1444
|
+
manager.setFocusedKey(key);
|
|
1445
|
+
if (selectOnFocus && !manager.isSelected(key)) manager.replaceSelection(key);
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
if (UNSTABLE_focusOnEntry && (modality === "keyboard" || modality === "virtual"))
|
|
1449
|
+
navigateToKey2(UNSTABLE_focusOnEntry === "first" ? delegate.getFirstKey?.() : delegate.getLastKey?.());
|
|
1450
|
+
else if (manager.focusedKey == null) {
|
|
1451
|
+
let relatedTarget = e.relatedTarget;
|
|
1452
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToKey2(manager.lastSelectedKey ?? delegate.getLastKey?.());
|
|
1453
|
+
else navigateToKey2(manager.firstSelectedKey ?? delegate.getFirstKey?.());
|
|
1454
|
+
} else if (scrollRef.current) {
|
|
1455
|
+
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
1456
|
+
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
1457
|
+
}
|
|
1458
|
+
if (manager.focusedKey != null && scrollRef.current) {
|
|
1459
|
+
let element = $22bbea12c2567021$export$c3d8340acf92597f(ref, manager.focusedKey);
|
|
1460
|
+
if (element instanceof HTMLElement) {
|
|
1461
|
+
if (!$23f2114a1b82827e$export$b4f377a2b6254582(element) && !shouldUseVirtualFocus) $1969ac565cfec8d0$export$de79e2c695e052f3(element);
|
|
1462
|
+
if (modality === "keyboard" || UNSTABLE_focusOnEntry && modality === "virtual") $51a3e22a5186a962$export$c826860796309d1b(element, {
|
|
1463
|
+
containingElement: ref.current
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
let onBlur = (e) => {
|
|
1469
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, e.relatedTarget)) manager.setFocused(false);
|
|
1470
|
+
};
|
|
1471
|
+
let shouldVirtualFocusFirst = useRef(false);
|
|
1472
|
+
$600b3cf69ae46262$export$90fc3a17d93f704c(ref, $8b2399d051d06d4c$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e) => {
|
|
1473
|
+
let { detail } = e;
|
|
1474
|
+
e.stopPropagation();
|
|
1475
|
+
manager.setFocused(true);
|
|
1476
|
+
if (detail?.focusStrategy === "first") shouldVirtualFocusFirst.current = true;
|
|
1477
|
+
});
|
|
1478
|
+
let firstKey = delegate.getFirstKey?.() ?? null;
|
|
1479
|
+
$a475cdc2445827b5$export$72ef708ab07251f1(() => {
|
|
1480
|
+
if (shouldVirtualFocusFirst.current) {
|
|
1481
|
+
if (firstKey == null) {
|
|
1482
|
+
let previousActiveElement = $23f2114a1b82827e$export$cd4e5573fbe2b576();
|
|
1483
|
+
$b72f3f7b3b5f42c6$export$76e4e37e5339496d(ref.current);
|
|
1484
|
+
$b72f3f7b3b5f42c6$export$2b35b76d2e30e129(previousActiveElement, null);
|
|
1485
|
+
if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
|
|
1486
|
+
} else {
|
|
1487
|
+
manager.setFocusedKey(firstKey);
|
|
1488
|
+
shouldVirtualFocusFirst.current = false;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}, [
|
|
1492
|
+
firstKey,
|
|
1493
|
+
manager.collection.size
|
|
1494
|
+
]);
|
|
1495
|
+
$a475cdc2445827b5$export$72ef708ab07251f1(() => {
|
|
1496
|
+
if (manager.collection.size > 0) shouldVirtualFocusFirst.current = false;
|
|
1497
|
+
}, [
|
|
1498
|
+
manager.focusedKey
|
|
1499
|
+
]);
|
|
1500
|
+
$600b3cf69ae46262$export$90fc3a17d93f704c(ref, $8b2399d051d06d4c$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e) => {
|
|
1501
|
+
e.stopPropagation();
|
|
1502
|
+
manager.setFocused(false);
|
|
1503
|
+
if (e.detail?.clearFocusKey) manager.setFocusedKey(null);
|
|
1504
|
+
});
|
|
1505
|
+
const autoFocusRef = useRef(autoFocus);
|
|
1506
|
+
const didAutoFocusRef = useRef(false);
|
|
1507
|
+
useEffect(() => {
|
|
1508
|
+
if (autoFocusRef.current) {
|
|
1509
|
+
let focusedKey = null;
|
|
1510
|
+
if (autoFocus === "first") focusedKey = delegate.getFirstKey?.() ?? null;
|
|
1511
|
+
if (autoFocus === "last") focusedKey = delegate.getLastKey?.() ?? null;
|
|
1512
|
+
let selectedKeys = manager.selectedKeys;
|
|
1513
|
+
if (selectedKeys.size) {
|
|
1514
|
+
for (let key of selectedKeys) if (manager.canSelectItem(key)) {
|
|
1515
|
+
focusedKey = key;
|
|
1516
|
+
break;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
manager.setFocused(true);
|
|
1520
|
+
manager.setFocusedKey(focusedKey);
|
|
1521
|
+
if (focusedKey != null && selectOnFocus && !selectedKeys.size && manager.canSelectItem(focusedKey)) manager.replaceSelection(focusedKey);
|
|
1522
|
+
if (focusedKey == null && !shouldUseVirtualFocus && ref.current) $f192c2f16961cbe0$export$80f3e147d781571c(ref.current);
|
|
1523
|
+
if (manager.collection.size > 0) {
|
|
1524
|
+
autoFocusRef.current = false;
|
|
1525
|
+
didAutoFocusRef.current = true;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1529
|
+
let lastFocusedKey = useRef(manager.focusedKey);
|
|
1530
|
+
let raf = useRef(null);
|
|
1531
|
+
useEffect(() => {
|
|
1532
|
+
if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
|
|
1533
|
+
let modality = $8f5a2122b0992be3$export$630ff653c5ada6a9();
|
|
1534
|
+
let element = $22bbea12c2567021$export$c3d8340acf92597f(ref, manager.focusedKey);
|
|
1535
|
+
if (!(element instanceof HTMLElement))
|
|
1536
|
+
return;
|
|
1537
|
+
if (modality === "keyboard" || didAutoFocusRef.current) {
|
|
1538
|
+
if (raf.current) cancelAnimationFrame(raf.current);
|
|
1539
|
+
raf.current = requestAnimationFrame(() => {
|
|
1540
|
+
if (scrollRef.current) {
|
|
1541
|
+
$51a3e22a5186a962$export$53a0910f038337bd(scrollRef.current, element);
|
|
1542
|
+
if (modality !== "virtual") $51a3e22a5186a962$export$c826860796309d1b(element, {
|
|
1543
|
+
containingElement: ref.current
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current) $f192c2f16961cbe0$export$80f3e147d781571c(ref.current);
|
|
1550
|
+
lastFocusedKey.current = manager.focusedKey;
|
|
1551
|
+
didAutoFocusRef.current = false;
|
|
1552
|
+
});
|
|
1553
|
+
useEffect(() => {
|
|
1554
|
+
return () => {
|
|
1555
|
+
if (raf.current) cancelAnimationFrame(raf.current);
|
|
1556
|
+
};
|
|
1557
|
+
}, []);
|
|
1558
|
+
$600b3cf69ae46262$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e) => {
|
|
1559
|
+
e.preventDefault();
|
|
1560
|
+
manager.setFocused(true);
|
|
1561
|
+
});
|
|
1562
|
+
let handlers = {
|
|
1563
|
+
...$bbaa08b3cd72f041$export$9d1611c77c2fe928(keyboardProps, repeatKeyboardProps),
|
|
1564
|
+
onFocus,
|
|
1565
|
+
onBlur,
|
|
1566
|
+
onMouseDown(e) {
|
|
1567
|
+
if (scrollRef.current === $23f2114a1b82827e$export$e58f029f0fbfdb29(e))
|
|
1568
|
+
e.preventDefault();
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
let { typeSelectProps } = $f5a4a9a3486154da$export$e32c88dfddc6e1d8({
|
|
1572
|
+
keyboardDelegate: delegate,
|
|
1573
|
+
selectionManager: manager
|
|
1574
|
+
});
|
|
1575
|
+
if (!disallowTypeAhead)
|
|
1576
|
+
handlers = $bbaa08b3cd72f041$export$9d1611c77c2fe928(typeSelectProps, handlers);
|
|
1577
|
+
let tabIndex = void 0;
|
|
1578
|
+
if (!shouldUseVirtualFocus) tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
1579
|
+
let collectionId = $22bbea12c2567021$export$881eb0d9f3605d9d(manager.collection);
|
|
1580
|
+
return {
|
|
1581
|
+
// oxlint-disable-next-line react/react-compiler
|
|
1582
|
+
collectionProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(handlers, {
|
|
1583
|
+
tabIndex,
|
|
1584
|
+
"data-collection": collectionId
|
|
1585
|
+
})
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
const $7b01448eaad0fe7c$var$DEFAULT_THRESHOLD = 500;
|
|
1589
|
+
function $7b01448eaad0fe7c$export$c24ed0104d07eab9(props) {
|
|
1590
|
+
let { isDisabled, pointerType, onLongPressStart, onLongPressEnd, onLongPress, threshold = $7b01448eaad0fe7c$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
|
|
1591
|
+
const timeRef = useRef(void 0);
|
|
1592
|
+
let { addGlobalListener, removeAllGlobalListeners } = $48a7d519b337145d$export$4eaf04e54aa8eed6();
|
|
1593
|
+
let isAcceptedPointerType = (e) => pointerType ? e.pointerType === pointerType : e.pointerType === "mouse" || e.pointerType === "touch";
|
|
1594
|
+
let { pressProps } = $d27d541f9569d26d$export$45712eceda6fad21({
|
|
1595
|
+
isDisabled,
|
|
1596
|
+
onPressStart(e) {
|
|
1597
|
+
e.continuePropagation();
|
|
1598
|
+
if (isAcceptedPointerType(e)) {
|
|
1599
|
+
if (onLongPressStart) onLongPressStart({
|
|
1600
|
+
...e,
|
|
1601
|
+
type: "longpressstart"
|
|
1602
|
+
});
|
|
1603
|
+
timeRef.current = setTimeout(() => {
|
|
1604
|
+
e.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
1605
|
+
bubbles: true
|
|
1606
|
+
}));
|
|
1607
|
+
addGlobalListener(e.target, "click", (e2) => e2.preventDefault(), {
|
|
1608
|
+
once: true
|
|
1609
|
+
});
|
|
1610
|
+
if ($d447af545b77c9f1$export$b204af158042fbac(e.target).activeElement !== e.target) $1969ac565cfec8d0$export$de79e2c695e052f3(e.target);
|
|
1611
|
+
if (onLongPress) onLongPress({
|
|
1612
|
+
...e,
|
|
1613
|
+
type: "longpress"
|
|
1614
|
+
});
|
|
1615
|
+
timeRef.current = void 0;
|
|
1616
|
+
}, threshold);
|
|
1617
|
+
if (e.pointerType === "touch") addGlobalListener(e.target, "contextmenu", (e2) => e2.preventDefault(), {
|
|
1618
|
+
once: true
|
|
1619
|
+
});
|
|
1620
|
+
let ownerWindow = $d447af545b77c9f1$export$f21a1ffae260145a(e.target);
|
|
1621
|
+
addGlobalListener(ownerWindow, "pointerup", () => {
|
|
1622
|
+
setTimeout(() => {
|
|
1623
|
+
removeAllGlobalListeners();
|
|
1624
|
+
}, 100);
|
|
1625
|
+
}, {
|
|
1626
|
+
once: true
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
onPressEnd(e) {
|
|
1631
|
+
if (timeRef.current) clearTimeout(timeRef.current);
|
|
1632
|
+
if (onLongPressEnd && isAcceptedPointerType(e)) onLongPressEnd({
|
|
1633
|
+
...e,
|
|
1634
|
+
type: "longpressend"
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
let descriptionProps = $121970af65029459$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : void 0);
|
|
1639
|
+
return {
|
|
1640
|
+
longPressProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(pressProps, descriptionProps)
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
function $f6ba6936bfd098a0$export$ecf600387e221c37(options) {
|
|
1644
|
+
let { id, selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin, linkBehavior = "action" } = options;
|
|
1645
|
+
let router = $caaf0dd3060ed57c$export$9a302a45f65d0572();
|
|
1646
|
+
id = $390e54f620492c70$export$f680877a34711e37(id);
|
|
1647
|
+
let onSelect = (e) => {
|
|
1648
|
+
if (e.pointerType === "keyboard" && $22bbea12c2567021$export$d3e3bd3e26688c04(e)) manager.toggleSelection(key);
|
|
1649
|
+
else {
|
|
1650
|
+
if (manager.selectionMode === "none") return;
|
|
1651
|
+
if (manager.isLink(key)) {
|
|
1652
|
+
if (linkBehavior === "selection" && ref.current) {
|
|
1653
|
+
let itemProps2 = manager.getItemProps(key);
|
|
1654
|
+
router.open(ref.current, e, itemProps2.href, itemProps2.routerOptions);
|
|
1655
|
+
manager.setSelectedKeys(manager.selectedKeys);
|
|
1656
|
+
return;
|
|
1657
|
+
} else if (linkBehavior === "override" || linkBehavior === "none") return;
|
|
1658
|
+
}
|
|
1659
|
+
if (manager.selectionMode === "single") {
|
|
1660
|
+
if (manager.isSelected(key) && !manager.disallowEmptySelection) manager.toggleSelection(key);
|
|
1661
|
+
else manager.replaceSelection(key);
|
|
1662
|
+
} else if (e && e.shiftKey) manager.extendSelection(key);
|
|
1663
|
+
else if (manager.selectionBehavior === "toggle" || e && ($bb39c0fc1c19b34c$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
1664
|
+
manager.toggleSelection(key);
|
|
1665
|
+
else manager.replaceSelection(key);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
useEffect(() => {
|
|
1669
|
+
let isFocused = key === manager.focusedKey;
|
|
1670
|
+
if (isFocused && manager.isFocused) {
|
|
1671
|
+
if (!shouldUseVirtualFocus) {
|
|
1672
|
+
if (focus) focus();
|
|
1673
|
+
else if ($23f2114a1b82827e$export$cd4e5573fbe2b576() !== ref.current && ref.current) $f192c2f16961cbe0$export$80f3e147d781571c(ref.current);
|
|
1674
|
+
} else $b72f3f7b3b5f42c6$export$76e4e37e5339496d(ref.current);
|
|
1675
|
+
}
|
|
1676
|
+
}, [
|
|
1677
|
+
ref,
|
|
1678
|
+
key,
|
|
1679
|
+
manager.focusedKey,
|
|
1680
|
+
manager.childFocusStrategy,
|
|
1681
|
+
manager.isFocused,
|
|
1682
|
+
shouldUseVirtualFocus
|
|
1683
|
+
]);
|
|
1684
|
+
isDisabled = isDisabled || manager.isDisabled(key);
|
|
1685
|
+
let itemProps = {};
|
|
1686
|
+
if (!shouldUseVirtualFocus && !isDisabled) itemProps = {
|
|
1687
|
+
tabIndex: key === manager.focusedKey ? 0 : -1,
|
|
1688
|
+
onFocus(e) {
|
|
1689
|
+
if ($23f2114a1b82827e$export$e58f029f0fbfdb29(e) === ref.current) manager.setFocusedKey(key);
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
else if (isDisabled) itemProps.onMouseDown = (e) => {
|
|
1693
|
+
e.preventDefault();
|
|
1694
|
+
};
|
|
1695
|
+
useEffect(() => {
|
|
1696
|
+
if (isDisabled && manager.focusedKey === key) manager.setFocusedKey(null);
|
|
1697
|
+
}, [
|
|
1698
|
+
manager,
|
|
1699
|
+
isDisabled,
|
|
1700
|
+
key
|
|
1701
|
+
]);
|
|
1702
|
+
let isLinkOverride = manager.isLink(key) && linkBehavior === "override";
|
|
1703
|
+
let isActionOverride = onAction && options["UNSTABLE_itemBehavior"] === "action";
|
|
1704
|
+
let hasLinkAction = manager.isLink(key) && linkBehavior !== "selection" && linkBehavior !== "none";
|
|
1705
|
+
let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride && !isActionOverride;
|
|
1706
|
+
let allowsActions = (onAction || hasLinkAction) && !isDisabled;
|
|
1707
|
+
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : !allowsSelection || manager.isEmpty);
|
|
1708
|
+
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
|
|
1709
|
+
let hasAction = hasPrimaryAction || hasSecondaryAction;
|
|
1710
|
+
let modality = useRef(null);
|
|
1711
|
+
let longPressEnabled = hasAction && allowsSelection;
|
|
1712
|
+
let longPressEnabledOnPressStart = useRef(false);
|
|
1713
|
+
let hadPrimaryActionOnPressStart = useRef(false);
|
|
1714
|
+
let collectionItemProps = manager.getItemProps(key);
|
|
1715
|
+
let performAction = (e) => {
|
|
1716
|
+
if (onAction) {
|
|
1717
|
+
onAction();
|
|
1718
|
+
ref.current?.dispatchEvent(new CustomEvent("react-aria-item-action", {
|
|
1719
|
+
bubbles: true
|
|
1720
|
+
}));
|
|
1721
|
+
}
|
|
1722
|
+
if (hasLinkAction && ref.current) router.open(ref.current, e, collectionItemProps.href, collectionItemProps.routerOptions);
|
|
1723
|
+
};
|
|
1724
|
+
let itemPressProps = {
|
|
1725
|
+
ref
|
|
1726
|
+
};
|
|
1727
|
+
if (shouldSelectOnPressUp) {
|
|
1728
|
+
itemPressProps.onPressStart = (e) => {
|
|
1729
|
+
modality.current = e.pointerType;
|
|
1730
|
+
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
1731
|
+
if (e.pointerType === "keyboard" && (!hasAction || $f6ba6936bfd098a0$var$isSelectionKey(e.key))) onSelect(e);
|
|
1732
|
+
};
|
|
1733
|
+
if (!allowsDifferentPressOrigin)
|
|
1734
|
+
itemPressProps.onPress = (e) => {
|
|
1735
|
+
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
|
|
1736
|
+
if (e.pointerType === "keyboard" && !$f6ba6936bfd098a0$var$isActionKey(e.key)) return;
|
|
1737
|
+
performAction(e);
|
|
1738
|
+
} else if (e.pointerType !== "keyboard" && allowsSelection) onSelect(e);
|
|
1739
|
+
};
|
|
1740
|
+
else {
|
|
1741
|
+
itemPressProps.onPressUp = hasPrimaryAction ? void 0 : (e) => {
|
|
1742
|
+
if (e.pointerType === "mouse" && allowsSelection) onSelect(e);
|
|
1743
|
+
};
|
|
1744
|
+
itemPressProps.onPress = hasPrimaryAction ? performAction : (e) => {
|
|
1745
|
+
if (e.pointerType !== "keyboard" && e.pointerType !== "mouse" && allowsSelection) onSelect(e);
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
} else {
|
|
1749
|
+
itemPressProps.onPressStart = (e) => {
|
|
1750
|
+
modality.current = e.pointerType;
|
|
1751
|
+
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
1752
|
+
hadPrimaryActionOnPressStart.current = hasPrimaryAction;
|
|
1753
|
+
if (allowsSelection && (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!allowsActions || $f6ba6936bfd098a0$var$isSelectionKey(e.key)))) onSelect(e);
|
|
1754
|
+
};
|
|
1755
|
+
itemPressProps.onPress = (e) => {
|
|
1756
|
+
if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $f6ba6936bfd098a0$var$isActionKey(e.key) || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
|
|
1757
|
+
if (hasAction) performAction(e);
|
|
1758
|
+
else if (allowsSelection) onSelect(e);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
let collectionId = $22bbea12c2567021$export$6aeb1680a0ae8741(manager.collection);
|
|
1763
|
+
itemProps["data-collection"] = collectionId;
|
|
1764
|
+
itemProps["data-key"] = key;
|
|
1765
|
+
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
1766
|
+
if (shouldUseVirtualFocus)
|
|
1767
|
+
itemPressProps = $bbaa08b3cd72f041$export$9d1611c77c2fe928(itemPressProps, {
|
|
1768
|
+
onPressStart(e) {
|
|
1769
|
+
if (e.pointerType !== "touch") {
|
|
1770
|
+
manager.setFocused(true);
|
|
1771
|
+
manager.setFocusedKey(key);
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
onPress(e) {
|
|
1775
|
+
if (e.pointerType === "touch") {
|
|
1776
|
+
manager.setFocused(true);
|
|
1777
|
+
manager.setFocusedKey(key);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
if (collectionItemProps) {
|
|
1782
|
+
for (let key2 of [
|
|
1783
|
+
"onPressStart",
|
|
1784
|
+
"onPressEnd",
|
|
1785
|
+
"onPressChange",
|
|
1786
|
+
"onPress",
|
|
1787
|
+
"onPressUp",
|
|
1788
|
+
"onClick"
|
|
1789
|
+
]) if (collectionItemProps[key2])
|
|
1790
|
+
itemPressProps[key2] = $a4e76a5424781910$export$e08e3b67e392101e(itemPressProps[key2], collectionItemProps[key2]);
|
|
1791
|
+
}
|
|
1792
|
+
let { pressProps, isPressed } = $d27d541f9569d26d$export$45712eceda6fad21(itemPressProps);
|
|
1793
|
+
let onDoubleClick = hasSecondaryAction ? (e) => {
|
|
1794
|
+
if (modality.current === "mouse") {
|
|
1795
|
+
e.stopPropagation();
|
|
1796
|
+
e.preventDefault();
|
|
1797
|
+
performAction(e);
|
|
1798
|
+
}
|
|
1799
|
+
} : void 0;
|
|
1800
|
+
let { longPressProps } = $7b01448eaad0fe7c$export$c24ed0104d07eab9({
|
|
1801
|
+
isDisabled: !longPressEnabled,
|
|
1802
|
+
onLongPress(e) {
|
|
1803
|
+
if (e.pointerType === "touch") {
|
|
1804
|
+
onSelect(e);
|
|
1805
|
+
manager.setSelectionBehavior("toggle");
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
let onDragStartCapture = (e) => {
|
|
1810
|
+
if (modality.current === "touch" && longPressEnabledOnPressStart.current) e.preventDefault();
|
|
1811
|
+
};
|
|
1812
|
+
let onClick = linkBehavior !== "none" && manager.isLink(key) ? (e) => {
|
|
1813
|
+
if (!$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening) e.preventDefault();
|
|
1814
|
+
} : void 0;
|
|
1815
|
+
let mergedItemProps = $bbaa08b3cd72f041$export$9d1611c77c2fe928(
|
|
1816
|
+
// oxlint-disable-next-line react/react-compiler
|
|
1817
|
+
itemProps,
|
|
1818
|
+
allowsSelection || hasPrimaryAction || shouldUseVirtualFocus && !isDisabled ? pressProps : {},
|
|
1819
|
+
longPressEnabled ? longPressProps : {},
|
|
1820
|
+
// oxlint-disable-next-line react/react-compiler
|
|
1821
|
+
{
|
|
1822
|
+
onDoubleClick,
|
|
1823
|
+
onDragStartCapture,
|
|
1824
|
+
onClick,
|
|
1825
|
+
id
|
|
1826
|
+
},
|
|
1827
|
+
// Prevent DOM focus from moving on mouse down when using virtual focus
|
|
1828
|
+
shouldUseVirtualFocus ? {
|
|
1829
|
+
onMouseDown: (e) => e.preventDefault()
|
|
1830
|
+
} : void 0
|
|
1831
|
+
);
|
|
1832
|
+
let isChildInteraction = (target) => {
|
|
1833
|
+
let el = target;
|
|
1834
|
+
while (el && el !== ref.current) {
|
|
1835
|
+
let elCollection = el.getAttribute("data-collection");
|
|
1836
|
+
if (elCollection != null) return elCollection !== collectionId;
|
|
1837
|
+
el = el.parentElement;
|
|
1838
|
+
}
|
|
1839
|
+
return $3b8b240c1bf84ab9$export$bebd5a1431fec25d(target);
|
|
1840
|
+
};
|
|
1841
|
+
let baseOnPointerDown = mergedItemProps.onPointerDown;
|
|
1842
|
+
mergedItemProps.onPointerDown = (e) => {
|
|
1843
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
1844
|
+
if (target && target !== ref.current && isChildInteraction(target)) {
|
|
1845
|
+
e.stopPropagation();
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
baseOnPointerDown?.(e);
|
|
1849
|
+
};
|
|
1850
|
+
let baseOnMouseDown = mergedItemProps.onMouseDown;
|
|
1851
|
+
mergedItemProps.onMouseDown = (e) => {
|
|
1852
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
1853
|
+
if (target && target !== ref.current && isChildInteraction(target)) {
|
|
1854
|
+
e.stopPropagation();
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
baseOnMouseDown?.(e);
|
|
1858
|
+
};
|
|
1859
|
+
return {
|
|
1860
|
+
itemProps: mergedItemProps,
|
|
1861
|
+
isPressed,
|
|
1862
|
+
isSelected: manager.isSelected(key),
|
|
1863
|
+
isFocused: manager.isFocused && manager.focusedKey === key,
|
|
1864
|
+
isDisabled,
|
|
1865
|
+
allowsSelection,
|
|
1866
|
+
hasAction
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
function $f6ba6936bfd098a0$var$isActionKey(key) {
|
|
1870
|
+
return key === "Enter";
|
|
1871
|
+
}
|
|
1872
|
+
function $f6ba6936bfd098a0$var$isSelectionKey(key) {
|
|
1873
|
+
return key === " ";
|
|
1874
|
+
}
|
|
1875
|
+
function $cd5ea4b915021f1d$export$1005530eda016c13(node, collection) {
|
|
1876
|
+
if (typeof collection.getChildren === "function") return collection.getChildren(node.key);
|
|
1877
|
+
return node.childNodes;
|
|
1878
|
+
}
|
|
1879
|
+
function $cd5ea4b915021f1d$export$fbdeaa6a76694f71(iterable) {
|
|
1880
|
+
return $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, 0);
|
|
1881
|
+
}
|
|
1882
|
+
function $cd5ea4b915021f1d$export$5f3398f8733f90e2(iterable, index) {
|
|
1883
|
+
if (index < 0) return void 0;
|
|
1884
|
+
let i = 0;
|
|
1885
|
+
for (let item of iterable) {
|
|
1886
|
+
if (i === index) return item;
|
|
1887
|
+
i++;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
function $cd5ea4b915021f1d$export$7475b2c64539e4cf(iterable) {
|
|
1891
|
+
let lastItem = void 0;
|
|
1892
|
+
for (let value of iterable) lastItem = value;
|
|
1893
|
+
return lastItem;
|
|
1894
|
+
}
|
|
1895
|
+
function $cd5ea4b915021f1d$export$8c434b3a7a4dad6(collection, a, b) {
|
|
1896
|
+
if (a.parentKey === b.parentKey) return a.index - b.index;
|
|
1897
|
+
let aAncestors = [
|
|
1898
|
+
...$cd5ea4b915021f1d$var$getAncestors(collection, a),
|
|
1899
|
+
a
|
|
1900
|
+
];
|
|
1901
|
+
let bAncestors = [
|
|
1902
|
+
...$cd5ea4b915021f1d$var$getAncestors(collection, b),
|
|
1903
|
+
b
|
|
1904
|
+
];
|
|
1905
|
+
let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a2, i) => a2 !== bAncestors[i]);
|
|
1906
|
+
if (firstNonMatchingAncestor !== -1) {
|
|
1907
|
+
a = aAncestors[firstNonMatchingAncestor];
|
|
1908
|
+
b = bAncestors[firstNonMatchingAncestor];
|
|
1909
|
+
return a.index - b.index;
|
|
1910
|
+
}
|
|
1911
|
+
if (aAncestors.findIndex((node) => node === b) >= 0) return 1;
|
|
1912
|
+
else if (bAncestors.findIndex((node) => node === a) >= 0) return -1;
|
|
1913
|
+
return -1;
|
|
1914
|
+
}
|
|
1915
|
+
function $cd5ea4b915021f1d$var$getAncestors(collection, node) {
|
|
1916
|
+
let parents = [];
|
|
1917
|
+
let currNode = node;
|
|
1918
|
+
while (currNode?.parentKey != null) {
|
|
1919
|
+
currNode = collection.getItem(currNode.parentKey);
|
|
1920
|
+
if (currNode) parents.unshift(currNode);
|
|
1921
|
+
}
|
|
1922
|
+
return parents;
|
|
1923
|
+
}
|
|
1924
|
+
function $b24d1bc31a0f941d$export$a9d04c5684123369(value) {
|
|
1925
|
+
const pieces = version.split(".");
|
|
1926
|
+
const major = parseInt(pieces[0], 10);
|
|
1927
|
+
if (major >= 19) return value;
|
|
1928
|
+
return value ? "true" : void 0;
|
|
1929
|
+
}
|
|
1930
|
+
class $8b2540e09867b15e$export$52baac22726c72bf extends Set {
|
|
1931
|
+
constructor(keys, anchorKey, currentKey) {
|
|
1932
|
+
super(keys);
|
|
1933
|
+
if (keys instanceof $8b2540e09867b15e$export$52baac22726c72bf) {
|
|
1934
|
+
this.anchorKey = anchorKey ?? keys.anchorKey;
|
|
1935
|
+
this.currentKey = currentKey ?? keys.currentKey;
|
|
1936
|
+
} else {
|
|
1937
|
+
this.anchorKey = anchorKey ?? null;
|
|
1938
|
+
this.currentKey = currentKey ?? null;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
function $60f19cefd567a3e4$var$equalSets(setA, setB) {
|
|
1943
|
+
if (setA.size !== setB.size) return false;
|
|
1944
|
+
for (let item of setA) {
|
|
1945
|
+
if (!setB.has(item)) return false;
|
|
1946
|
+
}
|
|
1947
|
+
return true;
|
|
1948
|
+
}
|
|
1949
|
+
function $60f19cefd567a3e4$export$253fe78d46329472(props) {
|
|
1950
|
+
let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
|
|
1951
|
+
let isFocusedRef = useRef(false);
|
|
1952
|
+
let [, setFocused] = useState(false);
|
|
1953
|
+
let focusedKeyRef = useRef(null);
|
|
1954
|
+
let childFocusStrategyRef = useRef(null);
|
|
1955
|
+
let [, setFocusedKey] = useState(null);
|
|
1956
|
+
let selectedKeysProp = useMemo(() => $60f19cefd567a3e4$var$convertSelection(props.selectedKeys), [
|
|
1957
|
+
props.selectedKeys
|
|
1958
|
+
]);
|
|
1959
|
+
let defaultSelectedKeys = useMemo(() => $60f19cefd567a3e4$var$convertSelection(props.defaultSelectedKeys, new $8b2540e09867b15e$export$52baac22726c72bf()), [
|
|
1960
|
+
props.defaultSelectedKeys
|
|
1961
|
+
]);
|
|
1962
|
+
let [selectedKeys, setSelectedKeys] = $3e6197669829fe11$export$40bfa8c7b0832715(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
|
|
1963
|
+
let disabledKeysProp = useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
|
|
1964
|
+
props.disabledKeys
|
|
1965
|
+
]);
|
|
1966
|
+
let [selectionBehavior, setSelectionBehavior] = useState(selectionBehaviorProp);
|
|
1967
|
+
if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0) setSelectionBehavior("replace");
|
|
1968
|
+
let lastSelectionBehavior = useRef(selectionBehaviorProp);
|
|
1969
|
+
useEffect(() => {
|
|
1970
|
+
if (selectionBehaviorProp !== lastSelectionBehavior.current) {
|
|
1971
|
+
setSelectionBehavior(selectionBehaviorProp);
|
|
1972
|
+
lastSelectionBehavior.current = selectionBehaviorProp;
|
|
1973
|
+
}
|
|
1974
|
+
}, [
|
|
1975
|
+
selectionBehaviorProp
|
|
1976
|
+
]);
|
|
1977
|
+
return {
|
|
1978
|
+
selectionMode,
|
|
1979
|
+
disallowEmptySelection,
|
|
1980
|
+
selectionBehavior,
|
|
1981
|
+
setSelectionBehavior,
|
|
1982
|
+
get isFocused() {
|
|
1983
|
+
return isFocusedRef.current;
|
|
1984
|
+
},
|
|
1985
|
+
setFocused(f) {
|
|
1986
|
+
isFocusedRef.current = f;
|
|
1987
|
+
setFocused(f);
|
|
1988
|
+
},
|
|
1989
|
+
get focusedKey() {
|
|
1990
|
+
return focusedKeyRef.current;
|
|
1991
|
+
},
|
|
1992
|
+
get childFocusStrategy() {
|
|
1993
|
+
return childFocusStrategyRef.current;
|
|
1994
|
+
},
|
|
1995
|
+
setFocusedKey(k, childFocusStrategy = "first") {
|
|
1996
|
+
focusedKeyRef.current = k;
|
|
1997
|
+
childFocusStrategyRef.current = childFocusStrategy;
|
|
1998
|
+
setFocusedKey(k);
|
|
1999
|
+
},
|
|
2000
|
+
selectedKeys,
|
|
2001
|
+
setSelectedKeys(keys) {
|
|
2002
|
+
if (allowDuplicateSelectionEvents || !$60f19cefd567a3e4$var$equalSets(keys, selectedKeys)) setSelectedKeys(keys);
|
|
2003
|
+
},
|
|
2004
|
+
disabledKeys: disabledKeysProp,
|
|
2005
|
+
disabledBehavior
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function $60f19cefd567a3e4$var$convertSelection(selection, defaultValue) {
|
|
2009
|
+
if (!selection) return defaultValue;
|
|
2010
|
+
return selection === "all" ? "all" : new $8b2540e09867b15e$export$52baac22726c72bf(selection);
|
|
2011
|
+
}
|
|
2012
|
+
class $4a07ac835f260f78$export$6c8a5aaad13c9852 {
|
|
2013
|
+
constructor(collection, state, options) {
|
|
2014
|
+
this.collection = collection;
|
|
2015
|
+
this.state = state;
|
|
2016
|
+
this.allowsCellSelection = options?.allowsCellSelection ?? false;
|
|
2017
|
+
this._isSelectAll = null;
|
|
2018
|
+
this.layoutDelegate = options?.layoutDelegate || null;
|
|
2019
|
+
this.fullCollection = options?.fullCollection || null;
|
|
2020
|
+
}
|
|
2021
|
+
/**
|
|
2022
|
+
* The type of selection that is allowed in the collection.
|
|
2023
|
+
*/
|
|
2024
|
+
get selectionMode() {
|
|
2025
|
+
return this.state.selectionMode;
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Whether the collection allows empty selection.
|
|
2029
|
+
*/
|
|
2030
|
+
get disallowEmptySelection() {
|
|
2031
|
+
return this.state.disallowEmptySelection;
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* The selection behavior for the collection.
|
|
2035
|
+
*/
|
|
2036
|
+
get selectionBehavior() {
|
|
2037
|
+
return this.state.selectionBehavior;
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Sets the selection behavior for the collection.
|
|
2041
|
+
*/
|
|
2042
|
+
setSelectionBehavior(selectionBehavior) {
|
|
2043
|
+
this.state.setSelectionBehavior(selectionBehavior);
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Whether the collection is currently focused.
|
|
2047
|
+
*/
|
|
2048
|
+
get isFocused() {
|
|
2049
|
+
return this.state.isFocused;
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Sets whether the collection is focused.
|
|
2053
|
+
*/
|
|
2054
|
+
setFocused(isFocused) {
|
|
2055
|
+
this.state.setFocused(isFocused);
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* The current focused key in the collection.
|
|
2059
|
+
*/
|
|
2060
|
+
get focusedKey() {
|
|
2061
|
+
return this.state.focusedKey;
|
|
2062
|
+
}
|
|
2063
|
+
/** Whether the first or last child of the focused key should receive focus. */
|
|
2064
|
+
get childFocusStrategy() {
|
|
2065
|
+
return this.state.childFocusStrategy;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Sets the focused key.
|
|
2069
|
+
*/
|
|
2070
|
+
setFocusedKey(key, childFocusStrategy) {
|
|
2071
|
+
if (key == null || this.collection.getItem(key)) this.state.setFocusedKey(key, childFocusStrategy);
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* The currently selected keys in the collection.
|
|
2075
|
+
*/
|
|
2076
|
+
get selectedKeys() {
|
|
2077
|
+
return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* The raw selection value for the collection.
|
|
2081
|
+
* Either 'all' for select all, or a set of keys.
|
|
2082
|
+
*/
|
|
2083
|
+
get rawSelection() {
|
|
2084
|
+
return this.state.selectedKeys;
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Returns whether a key is selected.
|
|
2088
|
+
*/
|
|
2089
|
+
isSelected(key) {
|
|
2090
|
+
if (this.state.selectionMode === "none") return false;
|
|
2091
|
+
let mappedKey = this.getKey(key);
|
|
2092
|
+
if (mappedKey == null) return false;
|
|
2093
|
+
return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Whether the selection is empty.
|
|
2097
|
+
*/
|
|
2098
|
+
get isEmpty() {
|
|
2099
|
+
return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Whether all items in the collection are selected.
|
|
2103
|
+
*/
|
|
2104
|
+
get isSelectAll() {
|
|
2105
|
+
if (this.isEmpty) return false;
|
|
2106
|
+
if (this.state.selectedKeys === "all") return true;
|
|
2107
|
+
if (this._isSelectAll != null) return this._isSelectAll;
|
|
2108
|
+
let allKeys = this.getSelectAllKeys();
|
|
2109
|
+
let selectedKeys = this.state.selectedKeys;
|
|
2110
|
+
this._isSelectAll = allKeys.every((k) => selectedKeys.has(k));
|
|
2111
|
+
return this._isSelectAll;
|
|
2112
|
+
}
|
|
2113
|
+
get firstSelectedKey() {
|
|
2114
|
+
let first = null;
|
|
2115
|
+
for (let key of this.state.selectedKeys) {
|
|
2116
|
+
let item = this.collection.getItem(key);
|
|
2117
|
+
if (!first || item && $cd5ea4b915021f1d$export$8c434b3a7a4dad6(this.collection, item, first) < 0) first = item;
|
|
2118
|
+
}
|
|
2119
|
+
return first?.key ?? null;
|
|
2120
|
+
}
|
|
2121
|
+
get lastSelectedKey() {
|
|
2122
|
+
let last = null;
|
|
2123
|
+
for (let key of this.state.selectedKeys) {
|
|
2124
|
+
let item = this.collection.getItem(key);
|
|
2125
|
+
if (!last || item && $cd5ea4b915021f1d$export$8c434b3a7a4dad6(this.collection, item, last) > 0) last = item;
|
|
2126
|
+
}
|
|
2127
|
+
return last?.key ?? null;
|
|
2128
|
+
}
|
|
2129
|
+
get disabledKeys() {
|
|
2130
|
+
return this.state.disabledKeys;
|
|
2131
|
+
}
|
|
2132
|
+
get disabledBehavior() {
|
|
2133
|
+
return this.state.disabledBehavior;
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Extends the selection to the given key.
|
|
2137
|
+
*/
|
|
2138
|
+
extendSelection(toKey) {
|
|
2139
|
+
if (this.selectionMode === "none") return;
|
|
2140
|
+
if (this.selectionMode === "single") {
|
|
2141
|
+
this.replaceSelection(toKey);
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
let mappedToKey = this.getKey(toKey);
|
|
2145
|
+
if (mappedToKey == null) return;
|
|
2146
|
+
let selection;
|
|
2147
|
+
if (this.state.selectedKeys === "all") selection = new $8b2540e09867b15e$export$52baac22726c72bf([
|
|
2148
|
+
mappedToKey
|
|
2149
|
+
], mappedToKey, mappedToKey);
|
|
2150
|
+
else {
|
|
2151
|
+
let selectedKeys = this.state.selectedKeys;
|
|
2152
|
+
let anchorKey = selectedKeys.anchorKey ?? mappedToKey;
|
|
2153
|
+
selection = new $8b2540e09867b15e$export$52baac22726c72bf(selectedKeys, anchorKey, mappedToKey);
|
|
2154
|
+
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? mappedToKey)) selection.delete(key);
|
|
2155
|
+
for (let key of this.getKeyRange(mappedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
|
|
2156
|
+
}
|
|
2157
|
+
this.state.setSelectedKeys(selection);
|
|
2158
|
+
}
|
|
2159
|
+
getKeyRange(from, to) {
|
|
2160
|
+
let fromItem = this.collection.getItem(from);
|
|
2161
|
+
let toItem = this.collection.getItem(to);
|
|
2162
|
+
if (fromItem && toItem) {
|
|
2163
|
+
if ($cd5ea4b915021f1d$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0) return this.getKeyRangeInternal(from, to);
|
|
2164
|
+
return this.getKeyRangeInternal(to, from);
|
|
2165
|
+
}
|
|
2166
|
+
return [];
|
|
2167
|
+
}
|
|
2168
|
+
getKeyRangeInternal(from, to) {
|
|
2169
|
+
if (this.layoutDelegate?.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
|
|
2170
|
+
let keys = [];
|
|
2171
|
+
let key = from;
|
|
2172
|
+
while (key != null) {
|
|
2173
|
+
let item = this.collection.getItem(key);
|
|
2174
|
+
if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection)) keys.push(key);
|
|
2175
|
+
if (key === to) return keys;
|
|
2176
|
+
key = this.collection.getKeyAfter(key);
|
|
2177
|
+
}
|
|
2178
|
+
return [];
|
|
2179
|
+
}
|
|
2180
|
+
getKey(key) {
|
|
2181
|
+
let item = this.collection.getItem(key);
|
|
2182
|
+
if (!item)
|
|
2183
|
+
return key;
|
|
2184
|
+
if (item.type === "cell" && this.allowsCellSelection) return key;
|
|
2185
|
+
while (item && item.type !== "item" && item.parentKey != null) item = this.collection.getItem(item.parentKey);
|
|
2186
|
+
if (!item || item.type !== "item") return null;
|
|
2187
|
+
return item.key;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Toggles whether the given key is selected.
|
|
2191
|
+
*/
|
|
2192
|
+
toggleSelection(key) {
|
|
2193
|
+
if (this.selectionMode === "none") return;
|
|
2194
|
+
if (this.selectionMode === "single" && !this.isSelected(key)) {
|
|
2195
|
+
this.replaceSelection(key);
|
|
2196
|
+
return;
|
|
2197
|
+
}
|
|
2198
|
+
let mappedKey = this.getKey(key);
|
|
2199
|
+
if (mappedKey == null) return;
|
|
2200
|
+
let keys = new $8b2540e09867b15e$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
|
2201
|
+
if (keys.has(mappedKey)) keys.delete(mappedKey);
|
|
2202
|
+
else if (this.canSelectItem(mappedKey)) {
|
|
2203
|
+
keys.add(mappedKey);
|
|
2204
|
+
keys.anchorKey = mappedKey;
|
|
2205
|
+
keys.currentKey = mappedKey;
|
|
2206
|
+
}
|
|
2207
|
+
if (this.disallowEmptySelection && keys.size === 0) return;
|
|
2208
|
+
this.state.setSelectedKeys(keys);
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Replaces the selection with only the given key.
|
|
2212
|
+
*/
|
|
2213
|
+
replaceSelection(key) {
|
|
2214
|
+
if (this.selectionMode === "none") return;
|
|
2215
|
+
let mappedKey = this.getKey(key);
|
|
2216
|
+
if (mappedKey == null) return;
|
|
2217
|
+
let selection = this.canSelectItem(mappedKey) ? new $8b2540e09867b15e$export$52baac22726c72bf([
|
|
2218
|
+
mappedKey
|
|
2219
|
+
], mappedKey, mappedKey) : new $8b2540e09867b15e$export$52baac22726c72bf();
|
|
2220
|
+
this.state.setSelectedKeys(selection);
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* Replaces the selection with the given keys.
|
|
2224
|
+
*/
|
|
2225
|
+
setSelectedKeys(keys) {
|
|
2226
|
+
if (this.selectionMode === "none") return;
|
|
2227
|
+
let selection = new $8b2540e09867b15e$export$52baac22726c72bf();
|
|
2228
|
+
for (let key of keys) {
|
|
2229
|
+
let mappedKey = this.getKey(key);
|
|
2230
|
+
if (mappedKey != null) {
|
|
2231
|
+
selection.add(mappedKey);
|
|
2232
|
+
if (this.selectionMode === "single") break;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
this.state.setSelectedKeys(selection);
|
|
2236
|
+
}
|
|
2237
|
+
getSelectAllKeys() {
|
|
2238
|
+
let collection = this.fullCollection ?? this.collection;
|
|
2239
|
+
let keys = [];
|
|
2240
|
+
let addKeys = (key) => {
|
|
2241
|
+
while (key != null) {
|
|
2242
|
+
if (this.canSelectItemIn(key, collection)) {
|
|
2243
|
+
let item = collection.getItem(key);
|
|
2244
|
+
if (item?.type === "item") keys.push(key);
|
|
2245
|
+
if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== "item")) addKeys($cd5ea4b915021f1d$export$fbdeaa6a76694f71($cd5ea4b915021f1d$export$1005530eda016c13(item, collection))?.key ?? null);
|
|
2246
|
+
}
|
|
2247
|
+
key = collection.getKeyAfter(key);
|
|
2248
|
+
}
|
|
2249
|
+
};
|
|
2250
|
+
addKeys(collection.getFirstKey());
|
|
2251
|
+
return keys;
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* Selects all items in the collection.
|
|
2255
|
+
*/
|
|
2256
|
+
selectAll() {
|
|
2257
|
+
if (!this.isSelectAll && this.selectionMode === "multiple") this.state.setSelectedKeys("all");
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Removes all keys from the selection.
|
|
2261
|
+
*/
|
|
2262
|
+
clearSelection() {
|
|
2263
|
+
if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0)) this.state.setSelectedKeys(new $8b2540e09867b15e$export$52baac22726c72bf());
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Toggles between select all and an empty selection.
|
|
2267
|
+
*/
|
|
2268
|
+
toggleSelectAll() {
|
|
2269
|
+
if (this.isSelectAll) this.clearSelection();
|
|
2270
|
+
else this.selectAll();
|
|
2271
|
+
}
|
|
2272
|
+
select(key, e) {
|
|
2273
|
+
if (this.selectionMode === "none") return;
|
|
2274
|
+
if (this.selectionMode === "single") {
|
|
2275
|
+
if (this.isSelected(key) && !this.disallowEmptySelection) this.toggleSelection(key);
|
|
2276
|
+
else this.replaceSelection(key);
|
|
2277
|
+
} else if (this.selectionBehavior === "toggle" || e && (e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
2278
|
+
this.toggleSelection(key);
|
|
2279
|
+
else this.replaceSelection(key);
|
|
2280
|
+
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Returns whether the current selection is equal to the given selection.
|
|
2283
|
+
*/
|
|
2284
|
+
isSelectionEqual(selection) {
|
|
2285
|
+
if (selection === this.state.selectedKeys) return true;
|
|
2286
|
+
let selectedKeys = this.selectedKeys;
|
|
2287
|
+
if (selection.size !== selectedKeys.size) return false;
|
|
2288
|
+
for (let key of selection) {
|
|
2289
|
+
if (!selectedKeys.has(key)) return false;
|
|
2290
|
+
}
|
|
2291
|
+
for (let key of selectedKeys) {
|
|
2292
|
+
if (!selection.has(key)) return false;
|
|
2293
|
+
}
|
|
2294
|
+
return true;
|
|
2295
|
+
}
|
|
2296
|
+
canSelectItem(key) {
|
|
2297
|
+
return this.canSelectItemIn(key, this.collection);
|
|
2298
|
+
}
|
|
2299
|
+
canSelectItemIn(key, collection) {
|
|
2300
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key)) return false;
|
|
2301
|
+
let item = collection.getItem(key);
|
|
2302
|
+
if (!item || item?.props?.isDisabled || item.type === "cell" && !this.allowsCellSelection) return false;
|
|
2303
|
+
return true;
|
|
2304
|
+
}
|
|
2305
|
+
isDisabled(key) {
|
|
2306
|
+
let item = this.collection.getItem(key);
|
|
2307
|
+
return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!item?.props?.isDisabled) && item?.props?.disabledBehavior !== "selection";
|
|
2308
|
+
}
|
|
2309
|
+
isLink(key) {
|
|
2310
|
+
return !!this.collection.getItem(key)?.props?.href;
|
|
2311
|
+
}
|
|
2312
|
+
getItemProps(key) {
|
|
2313
|
+
return this.collection.getItem(key)?.props;
|
|
2314
|
+
}
|
|
2315
|
+
withCollection(collection) {
|
|
2316
|
+
return new $4a07ac835f260f78$export$6c8a5aaad13c9852(collection, this.state, {
|
|
2317
|
+
allowsCellSelection: this.allowsCellSelection,
|
|
2318
|
+
layoutDelegate: this.layoutDelegate || void 0,
|
|
2319
|
+
fullCollection: this.fullCollection ?? this.collection
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
class $bda7a7e55e1ff206$export$bf788dd355e3a401 {
|
|
2324
|
+
build(props, context) {
|
|
2325
|
+
this.context = context;
|
|
2326
|
+
return $bda7a7e55e1ff206$var$iterable(() => this.iterateCollection(props));
|
|
2327
|
+
}
|
|
2328
|
+
*iterateCollection(props) {
|
|
2329
|
+
let { children, items } = props;
|
|
2330
|
+
if (React__default.isValidElement(children) && children.type === React__default.Fragment) yield* this.iterateCollection({
|
|
2331
|
+
children: children.props.children,
|
|
2332
|
+
items
|
|
2333
|
+
});
|
|
2334
|
+
else if (typeof children === "function") {
|
|
2335
|
+
if (!items) throw new Error("props.children was a function but props.items is missing");
|
|
2336
|
+
let index = 0;
|
|
2337
|
+
for (let item of items) {
|
|
2338
|
+
yield* this.getFullNode({
|
|
2339
|
+
value: item,
|
|
2340
|
+
index
|
|
2341
|
+
}, {
|
|
2342
|
+
renderer: children
|
|
2343
|
+
});
|
|
2344
|
+
index++;
|
|
2345
|
+
}
|
|
2346
|
+
} else {
|
|
2347
|
+
let items2 = [];
|
|
2348
|
+
React__default.Children.forEach(children, (child) => {
|
|
2349
|
+
if (child) items2.push(child);
|
|
2350
|
+
});
|
|
2351
|
+
let index = 0;
|
|
2352
|
+
for (let item of items2) {
|
|
2353
|
+
let nodes = this.getFullNode({
|
|
2354
|
+
element: item,
|
|
2355
|
+
index
|
|
2356
|
+
}, {});
|
|
2357
|
+
for (let node of nodes) {
|
|
2358
|
+
index++;
|
|
2359
|
+
yield node;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
getKey(item, partialNode, state, parentKey) {
|
|
2365
|
+
if (item.key != null) return item.key;
|
|
2366
|
+
if (partialNode.type === "cell" && partialNode.key != null) return `${parentKey}${partialNode.key}`;
|
|
2367
|
+
let v = partialNode.value;
|
|
2368
|
+
if (v != null) {
|
|
2369
|
+
let key = v.key ?? v.id;
|
|
2370
|
+
if (key == null) throw new Error("No key found for item");
|
|
2371
|
+
return key;
|
|
2372
|
+
}
|
|
2373
|
+
return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
|
|
2374
|
+
}
|
|
2375
|
+
getChildState(state, partialNode) {
|
|
2376
|
+
return {
|
|
2377
|
+
renderer: partialNode.renderer || state.renderer
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
*getFullNode(partialNode, state, parentKey, parentNode) {
|
|
2381
|
+
if (React__default.isValidElement(partialNode.element) && partialNode.element.type === React__default.Fragment) {
|
|
2382
|
+
let children = [];
|
|
2383
|
+
React__default.Children.forEach(partialNode.element.props.children, (child) => {
|
|
2384
|
+
children.push(child);
|
|
2385
|
+
});
|
|
2386
|
+
let index = partialNode.index ?? 0;
|
|
2387
|
+
for (const child of children) yield* this.getFullNode({
|
|
2388
|
+
element: child,
|
|
2389
|
+
index: index++
|
|
2390
|
+
}, state, parentKey, parentNode);
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
let element = partialNode.element;
|
|
2394
|
+
if (!element && partialNode.value && state && state.renderer) {
|
|
2395
|
+
let cached = this.cache.get(partialNode.value);
|
|
2396
|
+
if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
|
|
2397
|
+
cached.index = partialNode.index;
|
|
2398
|
+
cached.parentKey = parentNode ? parentNode.key : null;
|
|
2399
|
+
yield cached;
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
element = state.renderer(partialNode.value);
|
|
2403
|
+
}
|
|
2404
|
+
if (React__default.isValidElement(element)) {
|
|
2405
|
+
let type = element.type;
|
|
2406
|
+
if (typeof type !== "function" && typeof type.getCollectionNode !== "function") {
|
|
2407
|
+
let name = element.type;
|
|
2408
|
+
throw new Error(`Unknown element <${name}> in collection.`);
|
|
2409
|
+
}
|
|
2410
|
+
let childNodes = type.getCollectionNode(element.props, this.context);
|
|
2411
|
+
let index = partialNode.index ?? 0;
|
|
2412
|
+
let result = childNodes.next();
|
|
2413
|
+
while (!result.done && result.value) {
|
|
2414
|
+
let childNode = result.value;
|
|
2415
|
+
partialNode.index = index;
|
|
2416
|
+
let nodeKey = childNode.key ?? null;
|
|
2417
|
+
if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
|
|
2418
|
+
let nodes = this.getFullNode({
|
|
2419
|
+
...childNode,
|
|
2420
|
+
key: nodeKey,
|
|
2421
|
+
index,
|
|
2422
|
+
wrapper: $bda7a7e55e1ff206$var$compose(partialNode.wrapper, childNode.wrapper)
|
|
2423
|
+
}, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
|
|
2424
|
+
let children = [
|
|
2425
|
+
...nodes
|
|
2426
|
+
];
|
|
2427
|
+
for (let node2 of children) {
|
|
2428
|
+
node2.value = childNode.value ?? partialNode.value ?? null;
|
|
2429
|
+
if (node2.value) this.cache.set(node2.value, node2);
|
|
2430
|
+
if (partialNode.type && node2.type !== partialNode.type) throw new Error(`Unsupported type <${$bda7a7e55e1ff206$var$capitalize(node2.type)}> in <${$bda7a7e55e1ff206$var$capitalize(parentNode?.type ?? "unknown parent type")}>. Only <${$bda7a7e55e1ff206$var$capitalize(partialNode.type)}> is supported.`);
|
|
2431
|
+
index++;
|
|
2432
|
+
yield node2;
|
|
2433
|
+
}
|
|
2434
|
+
result = childNodes.next(children);
|
|
2435
|
+
}
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
if (partialNode.key == null || partialNode.type == null) return;
|
|
2439
|
+
let builder = this;
|
|
2440
|
+
let node = {
|
|
2441
|
+
type: partialNode.type,
|
|
2442
|
+
props: partialNode.props,
|
|
2443
|
+
key: partialNode.key,
|
|
2444
|
+
parentKey: parentNode ? parentNode.key : null,
|
|
2445
|
+
value: partialNode.value ?? null,
|
|
2446
|
+
level: (parentNode?.level ?? 0) + (parentNode?.type === "item" ? 1 : 0),
|
|
2447
|
+
index: partialNode.index,
|
|
2448
|
+
rendered: partialNode.rendered,
|
|
2449
|
+
textValue: partialNode.textValue ?? "",
|
|
2450
|
+
"aria-label": partialNode["aria-label"],
|
|
2451
|
+
wrapper: partialNode.wrapper,
|
|
2452
|
+
shouldInvalidate: partialNode.shouldInvalidate,
|
|
2453
|
+
hasChildNodes: partialNode.hasChildNodes || false,
|
|
2454
|
+
childNodes: $bda7a7e55e1ff206$var$iterable(function* () {
|
|
2455
|
+
if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
|
|
2456
|
+
let index = 0;
|
|
2457
|
+
for (let child of partialNode.childNodes()) {
|
|
2458
|
+
if (child.key != null)
|
|
2459
|
+
child.key = `${node.key}${child.key}`;
|
|
2460
|
+
let nodes = builder.getFullNode({
|
|
2461
|
+
...child,
|
|
2462
|
+
index
|
|
2463
|
+
}, builder.getChildState(state, child), node.key, node);
|
|
2464
|
+
for (let node2 of nodes) {
|
|
2465
|
+
index++;
|
|
2466
|
+
yield node2;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
})
|
|
2470
|
+
};
|
|
2471
|
+
yield node;
|
|
2472
|
+
}
|
|
2473
|
+
constructor() {
|
|
2474
|
+
this.cache = /* @__PURE__ */ new WeakMap();
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
function $bda7a7e55e1ff206$var$iterable(iterator) {
|
|
2478
|
+
let cache = [];
|
|
2479
|
+
let iterable = null;
|
|
2480
|
+
return {
|
|
2481
|
+
*[Symbol.iterator]() {
|
|
2482
|
+
for (let item of cache) yield item;
|
|
2483
|
+
if (!iterable) iterable = iterator();
|
|
2484
|
+
for (let item of iterable) {
|
|
2485
|
+
cache.push(item);
|
|
2486
|
+
yield item;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
function $bda7a7e55e1ff206$var$compose(outer, inner) {
|
|
2492
|
+
if (outer && inner) return (element) => outer(inner(element));
|
|
2493
|
+
if (outer) return outer;
|
|
2494
|
+
if (inner) return inner;
|
|
2495
|
+
}
|
|
2496
|
+
function $bda7a7e55e1ff206$var$capitalize(str) {
|
|
2497
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
2498
|
+
}
|
|
2499
|
+
function $d03379b88399b8c5$export$6cd28814d92fa9c9(props, factory, context) {
|
|
2500
|
+
let builder = useMemo(() => new $bda7a7e55e1ff206$export$bf788dd355e3a401(), []);
|
|
2501
|
+
let { children, items, collection } = props;
|
|
2502
|
+
let result = useMemo(() => {
|
|
2503
|
+
if (collection) return collection;
|
|
2504
|
+
let nodes = builder.build({
|
|
2505
|
+
children,
|
|
2506
|
+
items
|
|
2507
|
+
}, context);
|
|
2508
|
+
return factory(nodes);
|
|
2509
|
+
}, [
|
|
2510
|
+
builder,
|
|
2511
|
+
children,
|
|
2512
|
+
items,
|
|
2513
|
+
collection,
|
|
2514
|
+
context,
|
|
2515
|
+
factory
|
|
2516
|
+
]);
|
|
2517
|
+
return result;
|
|
2518
|
+
}
|
|
2519
|
+
function $bf14c9739fda2eb3$export$eac1895992b9f3d6(ref, options) {
|
|
2520
|
+
let isDisabled = options?.isDisabled;
|
|
2521
|
+
let [hasTabbableChild, setHasTabbableChild] = useState(false);
|
|
2522
|
+
$c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
|
|
2523
|
+
if (ref?.current && !isDisabled) {
|
|
2524
|
+
let update = () => {
|
|
2525
|
+
if (ref.current) {
|
|
2526
|
+
let walker = $535772f9d2c1f38d$export$2d6ec8fc375ceafa(ref.current, {
|
|
2527
|
+
tabbable: true
|
|
2528
|
+
});
|
|
2529
|
+
setHasTabbableChild(!!walker.nextNode());
|
|
2530
|
+
}
|
|
2531
|
+
};
|
|
2532
|
+
update();
|
|
2533
|
+
let observer = new MutationObserver(update);
|
|
2534
|
+
observer.observe(ref.current, {
|
|
2535
|
+
subtree: true,
|
|
2536
|
+
childList: true,
|
|
2537
|
+
attributes: true,
|
|
2538
|
+
attributeFilter: [
|
|
2539
|
+
"tabIndex",
|
|
2540
|
+
"disabled"
|
|
2541
|
+
]
|
|
2542
|
+
});
|
|
2543
|
+
return () => {
|
|
2544
|
+
observer.disconnect();
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
return isDisabled ? false : hasTabbableChild;
|
|
2549
|
+
}
|
|
2550
|
+
export {
|
|
2551
|
+
$60f19cefd567a3e4$export$253fe78d46329472 as $,
|
|
2552
|
+
$d03379b88399b8c5$export$6cd28814d92fa9c9 as a,
|
|
2553
|
+
$4a07ac835f260f78$export$6c8a5aaad13c9852 as b,
|
|
2554
|
+
$f6ba6936bfd098a0$export$ecf600387e221c37 as c,
|
|
2555
|
+
$bf14c9739fda2eb3$export$eac1895992b9f3d6 as d,
|
|
2556
|
+
$d667c2af82d35a98$export$d6daf82dcd84e87c as e,
|
|
2557
|
+
$42ceafc619f9c3ba$export$bf788dd355e3a401 as f,
|
|
2558
|
+
$42ceafc619f9c3ba$export$18af5c7a9e9b3664 as g,
|
|
2559
|
+
$91fe5e721c7f36c1$export$c9549807523555e0 as h,
|
|
2560
|
+
$42ceafc619f9c3ba$export$fb8073518f34e6ec as i,
|
|
2561
|
+
$b24d1bc31a0f941d$export$a9d04c5684123369 as j,
|
|
2562
|
+
$263ab7fc0f95ccdb$export$4feb769f8ddf26c5 as k,
|
|
2563
|
+
$263ab7fc0f95ccdb$export$a164736487e3f0ae as l,
|
|
2564
|
+
$263ab7fc0f95ccdb$export$90e00781bc59d8f9 as m,
|
|
2565
|
+
$91fe5e721c7f36c1$export$17f80983afe4e444 as n,
|
|
2566
|
+
$901761b40e390936$export$2bb74740c4e19def as o,
|
|
2567
|
+
$22bbea12c2567021$export$c3d8340acf92597f as p,
|
|
2568
|
+
$121970af65029459$export$f8aeda7b10753fa1 as q,
|
|
2569
|
+
$cd5ea4b915021f1d$export$fbdeaa6a76694f71 as r,
|
|
2570
|
+
$cd5ea4b915021f1d$export$7475b2c64539e4cf as s,
|
|
2571
|
+
$cd5ea4b915021f1d$export$1005530eda016c13 as t,
|
|
2572
|
+
$cd5ea4b915021f1d$export$5f3398f8733f90e2 as u,
|
|
2573
|
+
$51a3e22a5186a962$export$c826860796309d1b as v,
|
|
2574
|
+
$42ceafc619f9c3ba$export$e953bb1cd0f19726 as w,
|
|
2575
|
+
$a80bd3e9349588e7$export$727c8fc270210f13 as x
|
|
2576
|
+
};
|
|
2577
|
+
//# sourceMappingURL=useHasTabbableChild-CSJ0P5QT.js.map
|