@okam/stack-ui 1.29.1 → 1.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/components/Accordion/components/AccordionItem.d.ts +1 -0
  2. package/components/Accordion/index.d.ts +2 -1
  3. package/components/Accordion/interface.d.ts +3 -2
  4. package/components/Alerts/components/AlertsCloseButton.d.ts +1 -1
  5. package/components/Alerts/index.d.ts +2 -1
  6. package/components/Alerts/interface.d.ts +4 -3
  7. package/components/Box/index.d.ts +3 -2
  8. package/components/Button/index.d.ts +8 -4
  9. package/components/Button/interface.d.ts +3 -2
  10. package/components/Calendar/index.d.ts +5 -1
  11. package/components/Calendar/interface.d.ts +2 -1
  12. package/components/Carousel/components/CarouselNavigationButton.d.ts +3 -3
  13. package/components/Date/index.d.ts +2 -1
  14. package/components/Date/interface.d.ts +2 -1
  15. package/components/Icon/index.d.ts +2 -1
  16. package/components/Icon/interface.d.ts +2 -1
  17. package/components/Lightbox/hooks/overlay/index.d.ts +75 -0
  18. package/components/Lightbox/index.d.ts +2 -1
  19. package/components/Lightbox/interface.d.ts +3 -2
  20. package/components/Menu/Menu.d.ts +2 -1
  21. package/components/Menu/interface.d.ts +5 -4
  22. package/components/Modal/index.d.ts +2 -1
  23. package/components/Modal/interface.d.ts +2 -1
  24. package/components/Popover/index.d.ts +5 -2
  25. package/components/Popover/interface.d.ts +3 -2
  26. package/components/ShareButton/index.d.ts +2 -1
  27. package/components/ShareButton/interface.d.ts +2 -2
  28. package/components/SidePanel/index.d.ts +3 -3
  29. package/components/SidePanel/interface.d.ts +5 -4
  30. package/components/Typography/index.d.ts +3 -2
  31. package/components/Video/index.d.ts +2 -1
  32. package/components/Video/interface.d.ts +2 -1
  33. package/components/WysiwygBlock/index.d.ts +2 -1
  34. package/components/WysiwygBlock/interface.d.ts +2 -1
  35. package/components/fields/Checkbox/Checkbox.interface.d.ts +2 -1
  36. package/components/fields/Checkbox/index.d.ts +2 -1
  37. package/components/fields/CheckboxGroup/index.d.ts +2 -1
  38. package/components/fields/CheckboxGroup/interface.d.ts +2 -1
  39. package/components/fields/DatePicker/index.d.ts +2 -1
  40. package/components/fields/DatePicker/interface.d.ts +2 -1
  41. package/components/fields/Radio/Radio.interface.d.ts +3 -2
  42. package/components/fields/Radio/index.d.ts +3 -2
  43. package/components/fields/RadioGroup/index.d.ts +2 -1
  44. package/components/fields/RadioGroup/interface.d.ts +2 -1
  45. package/components/fields/SearchField/index.d.ts +2 -1
  46. package/components/fields/SearchField/interface.d.ts +2 -1
  47. package/components/fields/Select/Select.d.ts +2 -1
  48. package/components/fields/Select/Select.interface.d.ts +3 -2
  49. package/components/fields/TextArea/index.d.ts +2 -1
  50. package/components/fields/TextInputField/interface.d.ts +3 -2
  51. package/index.d.ts +1 -0
  52. package/index.js +1 -1
  53. package/index.mjs +41 -38
  54. package/index10.js +1 -1
  55. package/index10.mjs +1 -0
  56. package/index100.js +1 -2
  57. package/index100.mjs +22 -21
  58. package/index101.js +2 -1
  59. package/index101.mjs +22 -63
  60. package/index102.js +1 -1
  61. package/index102.mjs +58 -24
  62. package/index103.js +1 -1
  63. package/index103.mjs +29 -52
  64. package/index104.js +1 -1
  65. package/index104.mjs +52 -4
  66. package/index105.js +1 -1
  67. package/index105.mjs +4 -11
  68. package/index106.js +1 -1
  69. package/index106.mjs +11 -14
  70. package/index107.js +1 -1
  71. package/index107.mjs +13 -22
  72. package/index108.js +1 -1
  73. package/index108.mjs +19 -19
  74. package/index109.js +1 -1
  75. package/index109.mjs +22 -38
  76. package/index11.js +1 -1
  77. package/index11.mjs +2 -2
  78. package/index110.js +1 -2
  79. package/index110.mjs +38 -12
  80. package/index111.js +2 -1
  81. package/index111.mjs +12 -7
  82. package/index112.js +1 -1
  83. package/index112.mjs +7 -21
  84. package/index113.js +1 -1
  85. package/index113.mjs +21 -38
  86. package/index114.js +1 -1
  87. package/index114.mjs +38 -49
  88. package/index115.js +1 -1
  89. package/index115.mjs +49 -40
  90. package/index116.js +1 -1
  91. package/index116.mjs +40 -13
  92. package/index117.js +1 -1
  93. package/index117.mjs +14 -26
  94. package/index118.js +1 -1
  95. package/index118.mjs +29 -18
  96. package/index119.js +1 -1
  97. package/index119.mjs +19 -8
  98. package/index120.js +1 -1
  99. package/index120.mjs +9 -30
  100. package/index121.js +1 -1
  101. package/index121.mjs +30 -15
  102. package/index122.js +1 -1
  103. package/index122.mjs +13 -15
  104. package/index123.js +1 -1
  105. package/index123.mjs +17 -21
  106. package/index124.js +1 -1
  107. package/index124.mjs +21 -11
  108. package/index125.js +1 -2
  109. package/index125.mjs +11 -22
  110. package/index126.js +2 -1
  111. package/index126.mjs +22 -12
  112. package/index127.js +1 -1
  113. package/index127.mjs +23 -23
  114. package/index128.js +1 -1
  115. package/index128.mjs +3 -3
  116. package/index13.js +1 -1
  117. package/index13.mjs +10 -9
  118. package/index130.mjs +6 -6
  119. package/index131.js +1 -1
  120. package/index131.mjs +12 -51
  121. package/index132.js +1 -1
  122. package/index132.mjs +49 -25
  123. package/index133.js +1 -1
  124. package/index133.mjs +25 -19
  125. package/index134.js +1 -1
  126. package/index134.mjs +17 -58
  127. package/index135.js +1 -1
  128. package/index135.mjs +194 -89
  129. package/index136.js +1 -1
  130. package/index136.mjs +63 -30
  131. package/index137.js +1 -1
  132. package/index137.mjs +136 -116
  133. package/index138.js +1 -1
  134. package/index138.mjs +118 -26
  135. package/index139.js +1 -1
  136. package/index139.mjs +212 -119
  137. package/index14.js +1 -1
  138. package/index14.mjs +3 -3
  139. package/index140.js +1 -1
  140. package/index140.mjs +187 -131
  141. package/index141.js +1 -1
  142. package/index141.mjs +69 -14
  143. package/index142.js +1 -1
  144. package/index142.mjs +248 -85
  145. package/index143.js +1 -1
  146. package/index143.mjs +93 -102
  147. package/index144.js +1 -1
  148. package/index144.mjs +174 -5
  149. package/index145.js +1 -1
  150. package/index145.mjs +84 -3
  151. package/index146.js +1 -1
  152. package/index146.mjs +56 -123
  153. package/index147.js +1 -1
  154. package/index147.mjs +125 -28
  155. package/index148.js +1 -1
  156. package/index148.mjs +113 -48
  157. package/index149.js +1 -1
  158. package/index149.mjs +119 -41
  159. package/index150.js +1 -1
  160. package/index150.mjs +71 -36
  161. package/index151.js +1 -1
  162. package/index151.mjs +105 -108
  163. package/index152.js +1 -1
  164. package/index152.mjs +52 -77
  165. package/index153.js +1 -1
  166. package/index153.mjs +93 -101
  167. package/index154.js +1 -1
  168. package/index154.mjs +71 -98
  169. package/index155.js +1 -1
  170. package/index155.mjs +50 -193
  171. package/index156.js +1 -1
  172. package/index156.mjs +91 -56
  173. package/index157.js +5 -1
  174. package/index157.mjs +75 -136
  175. package/index158.js +1 -1
  176. package/index158.mjs +1999 -107
  177. package/index159.js +1 -1
  178. package/index159.mjs +56 -214
  179. package/index16.js +1 -1
  180. package/index16.mjs +2 -2
  181. package/index160.js +1 -1
  182. package/index160.mjs +186 -188
  183. package/index161.js +1 -1
  184. package/index161.mjs +59 -67
  185. package/index162.js +1 -1
  186. package/index162.mjs +88 -252
  187. package/index163.js +1 -1
  188. package/index163.mjs +32 -96
  189. package/index164.js +1 -1
  190. package/index164.mjs +117 -170
  191. package/index165.js +1 -1
  192. package/index165.mjs +26 -83
  193. package/index166.js +1 -1
  194. package/index166.mjs +123 -57
  195. package/index167.js +1 -1
  196. package/index167.mjs +130 -122
  197. package/index168.js +1 -1
  198. package/index168.mjs +14 -116
  199. package/index169.js +1 -1
  200. package/index169.mjs +92 -119
  201. package/index170.js +1 -1
  202. package/index170.mjs +105 -71
  203. package/index171.js +1 -1
  204. package/index171.mjs +5 -110
  205. package/index172.js +1 -1
  206. package/index172.mjs +3 -52
  207. package/index173.js +1 -1
  208. package/index173.mjs +124 -92
  209. package/index174.js +1 -1
  210. package/index174.mjs +29 -70
  211. package/index175.js +1 -1
  212. package/index175.mjs +51 -56
  213. package/index176.js +1 -1
  214. package/index176.mjs +44 -99
  215. package/index177.js +1 -5
  216. package/index177.mjs +36 -79
  217. package/index178.js +1 -1
  218. package/index178.mjs +94 -1992
  219. package/index179.js +1 -1
  220. package/index179.mjs +78 -60
  221. package/index18.js +1 -1
  222. package/index18.mjs +7 -7
  223. package/index180.js +1 -1
  224. package/index180.mjs +95 -182
  225. package/index181.js +1 -1
  226. package/index181.mjs +98 -6
  227. package/index19.js +1 -1
  228. package/index19.mjs +2 -2
  229. package/index190.js +1 -1
  230. package/index190.mjs +5 -313
  231. package/index191.js +1 -1
  232. package/index191.mjs +327 -179
  233. package/index192.js +1 -1
  234. package/index192.mjs +183 -8
  235. package/index193.js +1 -1
  236. package/index193.mjs +7 -25
  237. package/index194.js +1 -1
  238. package/index194.mjs +26 -55
  239. package/index195.js +1 -1
  240. package/index195.mjs +55 -46
  241. package/index196.js +1 -1
  242. package/index196.mjs +45 -123
  243. package/index197.js +1 -1
  244. package/index197.mjs +110 -5
  245. package/index198.js +1 -1
  246. package/index198.mjs +31 -27
  247. package/index199.js +1 -1
  248. package/index199.mjs +6 -7
  249. package/index2.js +1 -1
  250. package/index2.mjs +51 -50
  251. package/index20.js +1 -1
  252. package/index20.mjs +1 -1
  253. package/index200.js +1 -1
  254. package/index200.mjs +28 -7
  255. package/index201.js +1 -1
  256. package/index201.mjs +7 -8
  257. package/index202.js +1 -1
  258. package/index202.mjs +6 -3
  259. package/index203.js +1 -1
  260. package/index203.mjs +7 -5
  261. package/index204.js +1 -1
  262. package/index204.mjs +4 -9
  263. package/index205.js +1 -0
  264. package/index205.mjs +8 -0
  265. package/index206.js +1 -0
  266. package/index206.mjs +12 -0
  267. package/index21.js +1 -1
  268. package/index21.mjs +8 -8
  269. package/index22.js +1 -1
  270. package/index22.mjs +2 -2
  271. package/index23.js +1 -1
  272. package/index23.mjs +40 -39
  273. package/index24.js +1 -1
  274. package/index24.mjs +45 -44
  275. package/index26.js +1 -1
  276. package/index26.mjs +28 -21
  277. package/index27.js +1 -1
  278. package/index27.mjs +12 -12
  279. package/index28.js +1 -1
  280. package/index28.mjs +6 -6
  281. package/index29.js +1 -1
  282. package/index29.mjs +1 -1
  283. package/index30.js +1 -1
  284. package/index30.mjs +14 -8
  285. package/index31.js +1 -1
  286. package/index31.mjs +18 -18
  287. package/index32.js +1 -1
  288. package/index32.mjs +1 -1
  289. package/index33.mjs +43 -43
  290. package/index34.js +1 -1
  291. package/index34.mjs +1 -1
  292. package/index35.js +1 -1
  293. package/index35.mjs +3 -3
  294. package/index36.mjs +10 -10
  295. package/index4.js +1 -1
  296. package/index4.mjs +3 -3
  297. package/index6.js +1 -1
  298. package/index6.mjs +47 -46
  299. package/index65.js +1 -1
  300. package/index65.mjs +1 -1
  301. package/index66.js +1 -1
  302. package/index66.mjs +2 -2
  303. package/index67.js +1 -1
  304. package/index67.mjs +1 -1
  305. package/index69.js +1 -1
  306. package/index69.mjs +1 -1
  307. package/index7.mjs +4 -4
  308. package/index70.js +1 -1
  309. package/index70.mjs +1 -1
  310. package/index71.js +1 -1
  311. package/index71.mjs +1 -1
  312. package/index72.js +2 -1
  313. package/index72.mjs +27 -2
  314. package/index73.js +1 -2
  315. package/index73.mjs +2 -9
  316. package/index74.js +1 -1
  317. package/index74.mjs +7 -6
  318. package/index75.js +1 -1
  319. package/index75.mjs +6 -6
  320. package/index76.js +1 -1
  321. package/index76.mjs +6 -6
  322. package/index77.js +2 -1
  323. package/index77.mjs +8 -25
  324. package/index78.js +1 -1
  325. package/index78.mjs +25 -2
  326. package/index79.js +1 -6
  327. package/index79.mjs +2 -94
  328. package/index8.js +1 -1
  329. package/index8.mjs +42 -23
  330. package/index80.js +6 -1
  331. package/index80.mjs +79 -54
  332. package/index81.js +1 -1
  333. package/index81.mjs +61 -33
  334. package/index82.js +1 -42
  335. package/index82.mjs +34 -67
  336. package/index83.js +42 -1
  337. package/index83.mjs +69 -154
  338. package/index84.js +1 -9
  339. package/index84.mjs +149 -47
  340. package/index85.js +9 -1
  341. package/index85.mjs +48 -36
  342. package/index86.js +1 -1
  343. package/index86.mjs +40 -8
  344. package/index87.js +1 -1
  345. package/index87.mjs +9 -31
  346. package/index88.js +1 -1
  347. package/index88.mjs +38 -6
  348. package/index89.js +1 -12
  349. package/index89.mjs +6 -40
  350. package/index9.js +1 -1
  351. package/index9.mjs +7 -7
  352. package/index90.js +12 -1
  353. package/index90.mjs +36 -25
  354. package/index91.js +1 -1
  355. package/index91.mjs +24 -8
  356. package/index92.js +1 -7
  357. package/index92.mjs +7 -13
  358. package/index93.js +6 -14
  359. package/index93.mjs +13 -65
  360. package/index94.js +15 -1
  361. package/index94.mjs +71 -7
  362. package/index95.js +1 -16
  363. package/index95.mjs +7 -25
  364. package/index96.js +16 -1
  365. package/index96.mjs +20 -37
  366. package/index97.js +1 -1
  367. package/index97.mjs +40 -43
  368. package/index98.js +1 -1
  369. package/index98.mjs +44 -47
  370. package/index99.js +1 -1
  371. package/index99.mjs +48 -17
  372. package/package.json +1 -1
  373. package/providers/Translation/index.d.ts +4 -0
  374. package/providers/Translation/interface.d.ts +16 -0
  375. package/theme/Accordion/index.d.ts +12 -12
  376. package/theme/Alerts/index.d.ts +22 -22
  377. package/theme/Box/index.d.ts +8 -8
  378. package/theme/Button/index.d.ts +2 -2
  379. package/theme/Calendar/index.d.ts +12 -12
  380. package/theme/Carousel/index.d.ts +11 -11
  381. package/theme/Checkbox/index.d.ts +8 -8
  382. package/theme/CheckboxGroup/index.d.ts +3 -3
  383. package/theme/DatePicker/index.d.ts +10 -9
  384. package/theme/Image/index.d.ts +1 -1
  385. package/theme/LightBox/index.d.ts +9 -9
  386. package/theme/Radio/index.d.ts +6 -6
  387. package/theme/RadioGroup/index.d.ts +3 -3
  388. package/theme/Search/index.d.ts +3 -3
  389. package/theme/ShareButton/index.d.ts +10 -10
  390. package/theme/SidePanel/index.d.ts +3 -3
  391. package/theme/TextArea/index.d.ts +2 -2
  392. package/theme/Typography/index.d.ts +2 -2
  393. package/transitions/ModalTransition.d.ts +3 -6
  394. package/transitions/RenderWithSlide.d.ts +3 -6
  395. package/transitions/SidePanelTransition.d.ts +3 -6
package/index191.mjs CHANGED
@@ -1,195 +1,343 @@
1
- import { isCtrlKeyPressed as K, isNonContiguousSelectionModifier as E } from "./index192.mjs";
2
- import { useTypeSelect as J } from "./index193.mjs";
3
- import { flushSync as Q } from "react-dom";
4
- import { useRef as k, useEffect as I } from "react";
5
- import { focusSafely as L, getFocusableTreeWalker as X } from "@react-aria/focus";
6
- import { useRouter as Y, useEvent as Z, scrollIntoView as _, scrollIntoViewport as M, mergeProps as ee, focusWithoutScrolling as B } from "@react-aria/utils";
7
- import { getInteractionModality as C } from "./index194.mjs";
8
- import { useLocale as te } from "@react-aria/i18n";
9
- function ae(R) {
10
- let { selectionManager: e, keyboardDelegate: o, ref: n, autoFocus: m = !1, shouldFocusWrap: v = !1, disallowEmptySelection: N = !1, disallowSelectAll: V = !1, selectOnFocus: y = e.selectionBehavior === "replace", disallowTypeAhead: U = !1, shouldUseVirtualFocus: x, allowsTabNavigation: W = !1, isVirtualized: p, scrollRef: i = n, linkBehavior: $ = "action" } = R, { direction: b } = te(), z = Y(), q = (t) => {
11
- if (t.altKey && t.key === "Tab" && t.preventDefault(), !n.current.contains(t.target)) return;
12
- const r = (l, f) => {
13
- if (l != null) {
14
- if (e.isLink(l) && $ === "selection" && y && !E(t)) {
15
- Q(() => {
16
- e.setFocusedKey(l, f);
17
- });
18
- let d = i.current.querySelector(`[data-key="${CSS.escape(l.toString())}"]`), O = e.getItemProps(l);
19
- z.open(d, t, O.href, O.routerOptions);
20
- return;
1
+ import { restoreTextSelection as L, disableTextSelection as G } from "./index200.mjs";
2
+ import { PressResponderContext as re } from "./index201.mjs";
3
+ import { _class_private_field_get as ne } from "./index202.mjs";
4
+ import { _class_private_field_init as ie } from "./index171.mjs";
5
+ import { _class_private_field_set as B } from "./index203.mjs";
6
+ import { useGlobalListeners as ae, useEffectEvent as w, isVirtualPointerEvent as se, focusWithoutScrolling as X, getOwnerDocument as C, isVirtualClick as V, getOwnerWindow as R, mergeProps as q, useSyncRef as oe, chain as le, isMac as ue, openLink as W } from "@react-aria/utils";
7
+ import { useState as fe, useRef as ce, useMemo as ge, useEffect as pe, useContext as de } from "react";
8
+ function Te(i) {
9
+ let a = de(re);
10
+ if (a) {
11
+ let { register: o, ...l } = a;
12
+ i = q(l, i), o();
13
+ }
14
+ return oe(a, i.ref), i;
15
+ }
16
+ var Y = /* @__PURE__ */ new WeakMap();
17
+ class A {
18
+ continuePropagation() {
19
+ B(this, Y, !1);
20
+ }
21
+ get shouldStopPropagation() {
22
+ return ne(this, Y);
23
+ }
24
+ constructor(a, o, l, c) {
25
+ ie(this, Y, {
26
+ writable: !0,
27
+ value: void 0
28
+ }), B(this, Y, !0);
29
+ var v;
30
+ let g = (v = c == null ? void 0 : c.target) !== null && v !== void 0 ? v : l.currentTarget;
31
+ const b = g == null ? void 0 : g.getBoundingClientRect();
32
+ let P, x = 0, d, D = null;
33
+ l.clientX != null && l.clientY != null && (d = l.clientX, D = l.clientY), b && (d != null && D != null ? (P = d - b.left, x = D - b.top) : (P = b.width / 2, x = b.height / 2)), this.type = a, this.pointerType = o, this.target = l.currentTarget, this.shiftKey = l.shiftKey, this.metaKey = l.metaKey, this.ctrlKey = l.ctrlKey, this.altKey = l.altKey, this.x = P, this.y = x;
34
+ }
35
+ }
36
+ const N = Symbol("linkClicked");
37
+ function Me(i) {
38
+ let {
39
+ onPress: a,
40
+ onPressChange: o,
41
+ onPressStart: l,
42
+ onPressEnd: c,
43
+ onPressUp: v,
44
+ isDisabled: g,
45
+ isPressed: b,
46
+ preventFocusOnPress: P,
47
+ shouldCancelOnPointerExit: x,
48
+ allowTextSelectionOnPress: d,
49
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
+ ref: D,
51
+ ...Z
52
+ } = Te(i), [ee, H] = fe(!1), K = ce({
53
+ isPressed: !1,
54
+ ignoreEmulatedMouseEvents: !1,
55
+ ignoreClickAfterPress: !1,
56
+ didFirePressStart: !1,
57
+ isTriggeringEvent: !1,
58
+ activePointerId: null,
59
+ target: null,
60
+ isOverTarget: !1,
61
+ pointerType: null
62
+ }), { addGlobalListener: E, removeAllGlobalListeners: O } = ae(), y = w((e, s) => {
63
+ let T = K.current;
64
+ if (g || T.didFirePressStart) return !1;
65
+ let n = !0;
66
+ if (T.isTriggeringEvent = !0, l) {
67
+ let f = new A("pressstart", s, e);
68
+ l(f), n = f.shouldStopPropagation;
69
+ }
70
+ return o && o(!0), T.isTriggeringEvent = !1, T.didFirePressStart = !0, H(!0), n;
71
+ }), p = w((e, s, T = !0) => {
72
+ let n = K.current;
73
+ if (!n.didFirePressStart) return !1;
74
+ n.ignoreClickAfterPress = !0, n.didFirePressStart = !1, n.isTriggeringEvent = !0;
75
+ let f = !0;
76
+ if (c) {
77
+ let t = new A("pressend", s, e);
78
+ c(t), f = t.shouldStopPropagation;
79
+ }
80
+ if (o && o(!1), H(!1), a && T && !g) {
81
+ let t = new A("press", s, e);
82
+ a(t), f && (f = t.shouldStopPropagation);
83
+ }
84
+ return n.isTriggeringEvent = !1, f;
85
+ }), M = w((e, s) => {
86
+ let T = K.current;
87
+ if (g) return !1;
88
+ if (v) {
89
+ T.isTriggeringEvent = !0;
90
+ let n = new A("pressup", s, e);
91
+ return v(n), T.isTriggeringEvent = !1, n.shouldStopPropagation;
92
+ }
93
+ return !0;
94
+ }), S = w((e) => {
95
+ let s = K.current;
96
+ s.isPressed && s.target && (s.isOverTarget && s.pointerType != null && p($(s.target, e), s.pointerType, !1), s.isPressed = !1, s.isOverTarget = !1, s.activePointerId = null, s.pointerType = null, O(), d || L(s.target));
97
+ }), I = w((e) => {
98
+ x && S(e);
99
+ }), te = ge(() => {
100
+ let e = K.current, s = {
101
+ onKeyDown(n) {
102
+ if (U(n.nativeEvent, n.currentTarget) && n.currentTarget.contains(n.target)) {
103
+ var f;
104
+ j(n.target, n.key) && n.preventDefault();
105
+ let t = !0;
106
+ if (!e.isPressed && !n.repeat) {
107
+ e.target = n.currentTarget, e.isPressed = !0, t = y(n, "keyboard");
108
+ let u = n.currentTarget, r = (h) => {
109
+ U(h, u) && !h.repeat && u.contains(h.target) && e.target && M($(e.target, h), "keyboard");
110
+ };
111
+ E(C(n.currentTarget), "keyup", le(r, T), !0);
112
+ }
113
+ t && n.stopPropagation(), n.metaKey && ue() && ((f = e.metaKeyEvents) === null || f === void 0 || f.set(n.key, n.nativeEvent));
114
+ } else n.key === "Meta" && (e.metaKeyEvents = /* @__PURE__ */ new Map());
115
+ },
116
+ onClick(n) {
117
+ if (!(n && !n.currentTarget.contains(n.target)) && n && n.button === 0 && !e.isTriggeringEvent && !W.isOpening) {
118
+ let f = !0;
119
+ if (g && n.preventDefault(), !e.ignoreClickAfterPress && !e.ignoreEmulatedMouseEvents && !e.isPressed && (e.pointerType === "virtual" || V(n.nativeEvent))) {
120
+ !g && !P && X(n.currentTarget);
121
+ let t = y(n, "virtual"), u = M(n, "virtual"), r = p(n, "virtual");
122
+ f = t && u && r;
123
+ }
124
+ e.ignoreEmulatedMouseEvents = !1, e.ignoreClickAfterPress = !1, f && n.stopPropagation();
21
125
  }
22
- if (e.setFocusedKey(l, f), e.isLink(l) && $ === "override") return;
23
- t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && !E(t) && e.replaceSelection(l);
126
+ }
127
+ }, T = (n) => {
128
+ var f;
129
+ if (e.isPressed && e.target && U(n, e.target)) {
130
+ var t;
131
+ j(n.target, n.key) && n.preventDefault();
132
+ let r = n.target;
133
+ p($(e.target, n), "keyboard", e.target.contains(r)), O(), n.key !== "Enter" && F(e.target) && e.target.contains(r) && !n[N] && (n[N] = !0, W(e.target, n, !1)), e.isPressed = !1, (t = e.metaKeyEvents) === null || t === void 0 || t.delete(n.key);
134
+ } else if (n.key === "Meta" && (!((f = e.metaKeyEvents) === null || f === void 0) && f.size)) {
135
+ var u;
136
+ let r = e.metaKeyEvents;
137
+ e.metaKeyEvents = void 0;
138
+ for (let h of r.values()) (u = e.target) === null || u === void 0 || u.dispatchEvent(new KeyboardEvent("keyup", h));
24
139
  }
25
140
  };
26
- switch (t.key) {
27
- case "ArrowDown":
28
- if (o.getKeyBelow) {
29
- var c, s;
30
- t.preventDefault();
31
- let l = e.focusedKey != null ? o.getKeyBelow(e.focusedKey) : (c = o.getFirstKey) === null || c === void 0 ? void 0 : c.call(o);
32
- l == null && v && (l = (s = o.getFirstKey) === null || s === void 0 ? void 0 : s.call(o, e.focusedKey)), r(l);
33
- }
34
- break;
35
- case "ArrowUp":
36
- if (o.getKeyAbove) {
37
- var u, a;
38
- t.preventDefault();
39
- let l = e.focusedKey != null ? o.getKeyAbove(e.focusedKey) : (u = o.getLastKey) === null || u === void 0 ? void 0 : u.call(o);
40
- l == null && v && (l = (a = o.getLastKey) === null || a === void 0 ? void 0 : a.call(o, e.focusedKey)), r(l);
41
- }
42
- break;
43
- case "ArrowLeft":
44
- if (o.getKeyLeftOf) {
45
- var w, h;
46
- t.preventDefault();
47
- let l = o.getKeyLeftOf(e.focusedKey);
48
- l == null && v && (l = b === "rtl" ? (w = o.getFirstKey) === null || w === void 0 ? void 0 : w.call(o, e.focusedKey) : (h = o.getLastKey) === null || h === void 0 ? void 0 : h.call(o, e.focusedKey)), r(l, b === "rtl" ? "first" : "last");
49
- }
50
- break;
51
- case "ArrowRight":
52
- if (o.getKeyRightOf) {
53
- var D, T;
54
- t.preventDefault();
55
- let l = o.getKeyRightOf(e.focusedKey);
56
- l == null && v && (l = b === "rtl" ? (D = o.getLastKey) === null || D === void 0 ? void 0 : D.call(o, e.focusedKey) : (T = o.getFirstKey) === null || T === void 0 ? void 0 : T.call(o, e.focusedKey)), r(l, b === "rtl" ? "last" : "first");
57
- }
58
- break;
59
- case "Home":
60
- if (o.getFirstKey) {
61
- t.preventDefault();
62
- let l = o.getFirstKey(e.focusedKey, K(t));
63
- e.setFocusedKey(l), K(t) && t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && e.replaceSelection(l);
64
- }
65
- break;
66
- case "End":
67
- if (o.getLastKey) {
68
- t.preventDefault();
69
- let l = o.getLastKey(e.focusedKey, K(t));
70
- e.setFocusedKey(l), K(t) && t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && e.replaceSelection(l);
71
- }
72
- break;
73
- case "PageDown":
74
- if (o.getKeyPageBelow) {
75
- t.preventDefault();
76
- let l = o.getKeyPageBelow(e.focusedKey);
77
- r(l);
141
+ if (typeof PointerEvent < "u") {
142
+ s.onPointerDown = (r) => {
143
+ if (r.button !== 0 || !r.currentTarget.contains(r.target)) return;
144
+ if (se(r.nativeEvent)) {
145
+ e.pointerType = "virtual";
146
+ return;
78
147
  }
79
- break;
80
- case "PageUp":
81
- if (o.getKeyPageAbove) {
82
- t.preventDefault();
83
- let l = o.getKeyPageAbove(e.focusedKey);
84
- r(l);
148
+ _(r.currentTarget) && r.preventDefault(), e.pointerType = r.pointerType;
149
+ let h = !0;
150
+ e.isPressed || (e.isPressed = !0, e.isOverTarget = !0, e.activePointerId = r.pointerId, e.target = r.currentTarget, !g && !P && X(r.currentTarget), d || G(e.target), h = y(r, e.pointerType), E(C(r.currentTarget), "pointermove", n, !1), E(C(r.currentTarget), "pointerup", f, !1), E(C(r.currentTarget), "pointercancel", u, !1)), h && r.stopPropagation();
151
+ }, s.onMouseDown = (r) => {
152
+ r.currentTarget.contains(r.target) && r.button === 0 && (_(r.currentTarget) && r.preventDefault(), r.stopPropagation());
153
+ }, s.onPointerUp = (r) => {
154
+ !r.currentTarget.contains(r.target) || e.pointerType === "virtual" || r.button === 0 && k(r, r.currentTarget) && M(r, e.pointerType || r.pointerType);
155
+ };
156
+ let n = (r) => {
157
+ r.pointerId === e.activePointerId && (e.target && k(r, e.target) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, y($(e.target, r), e.pointerType)) : e.target && e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, p($(e.target, r), e.pointerType, !1), I(r)));
158
+ }, f = (r) => {
159
+ r.pointerId === e.activePointerId && e.isPressed && r.button === 0 && e.target && (k(r, e.target) && e.pointerType != null ? p($(e.target, r), e.pointerType) : e.isOverTarget && e.pointerType != null && p($(e.target, r), e.pointerType, !1), e.isPressed = !1, e.isOverTarget = !1, e.activePointerId = null, e.pointerType = null, O(), d || L(e.target), "ontouchend" in e.target && r.pointerType !== "mouse" && E(e.target, "touchend", t, {
160
+ once: !0
161
+ }));
162
+ }, t = (r) => {
163
+ J(r.target) && r.preventDefault();
164
+ }, u = (r) => {
165
+ S(r);
166
+ };
167
+ s.onDragStart = (r) => {
168
+ r.currentTarget.contains(r.target) && S(r);
169
+ };
170
+ } else {
171
+ s.onMouseDown = (t) => {
172
+ if (t.button !== 0 || !t.currentTarget.contains(t.target)) return;
173
+ if (_(t.currentTarget) && t.preventDefault(), e.ignoreEmulatedMouseEvents) {
174
+ t.stopPropagation();
175
+ return;
85
176
  }
86
- break;
87
- case "a":
88
- K(t) && e.selectionMode === "multiple" && V !== !0 && (t.preventDefault(), e.selectAll());
89
- break;
90
- case "Escape":
91
- !N && e.selectedKeys.size !== 0 && (t.stopPropagation(), t.preventDefault(), e.clearSelection());
92
- break;
93
- case "Tab":
94
- if (!W) {
95
- if (t.shiftKey) n.current.focus();
96
- else {
97
- let l = X(n.current, {
98
- tabbable: !0
99
- }), f, d;
100
- do
101
- d = l.lastChild(), d && (f = d);
102
- while (d);
103
- f && !f.contains(document.activeElement) && B(f);
177
+ e.isPressed = !0, e.isOverTarget = !0, e.target = t.currentTarget, e.pointerType = V(t.nativeEvent) ? "virtual" : "mouse", !g && !P && X(t.currentTarget), y(t, e.pointerType) && t.stopPropagation(), E(C(t.currentTarget), "mouseup", n, !1);
178
+ }, s.onMouseEnter = (t) => {
179
+ if (!t.currentTarget.contains(t.target)) return;
180
+ let u = !0;
181
+ e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !0, u = y(t, e.pointerType)), u && t.stopPropagation();
182
+ }, s.onMouseLeave = (t) => {
183
+ if (!t.currentTarget.contains(t.target)) return;
184
+ let u = !0;
185
+ e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !1, u = p(t, e.pointerType, !1), I(t)), u && t.stopPropagation();
186
+ }, s.onMouseUp = (t) => {
187
+ t.currentTarget.contains(t.target) && !e.ignoreEmulatedMouseEvents && t.button === 0 && M(t, e.pointerType || "mouse");
188
+ };
189
+ let n = (t) => {
190
+ if (t.button === 0) {
191
+ if (e.isPressed = !1, O(), e.ignoreEmulatedMouseEvents) {
192
+ e.ignoreEmulatedMouseEvents = !1;
193
+ return;
104
194
  }
105
- break;
195
+ e.target && k(t, e.target) && e.pointerType != null ? p($(e.target, t), e.pointerType) : e.target && e.isOverTarget && e.pointerType != null && p($(e.target, t), e.pointerType, !1), e.isOverTarget = !1;
106
196
  }
107
- }
108
- }, g = k({
109
- top: 0,
110
- left: 0
111
- });
112
- Z(i, "scroll", p ? null : () => {
113
- g.current = {
114
- top: i.current.scrollTop,
115
- left: i.current.scrollLeft
116
- };
117
- });
118
- let G = (t) => {
119
- if (e.isFocused) {
120
- t.currentTarget.contains(t.target) || e.setFocused(!1);
121
- return;
122
- }
123
- if (t.currentTarget.contains(t.target)) {
124
- if (e.setFocused(!0), e.focusedKey == null) {
125
- let s = (a) => {
126
- a != null && (e.setFocusedKey(a), y && e.replaceSelection(a));
127
- }, u = t.relatedTarget;
128
- var r, c;
129
- u && t.currentTarget.compareDocumentPosition(u) & Node.DOCUMENT_POSITION_FOLLOWING ? s((r = e.lastSelectedKey) !== null && r !== void 0 ? r : o.getLastKey()) : s((c = e.firstSelectedKey) !== null && c !== void 0 ? c : o.getFirstKey());
130
- } else p || (i.current.scrollTop = g.current.top, i.current.scrollLeft = g.current.left);
131
- if (!p && e.focusedKey != null) {
132
- let s = i.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
133
- s && (s.contains(document.activeElement) || B(s), C() === "keyboard" && M(s, {
134
- containingElement: n.current
135
- }));
136
- }
137
- }
138
- }, H = (t) => {
139
- t.currentTarget.contains(t.relatedTarget) || e.setFocused(!1);
140
- };
141
- const S = k(m);
142
- I(() => {
143
- if (S.current) {
144
- let t = null;
145
- m === "first" && (t = o.getFirstKey()), m === "last" && (t = o.getLastKey());
146
- let r = e.selectedKeys;
147
- if (r.size) {
148
- for (let c of r) if (e.canSelectItem(c)) {
149
- t = c;
150
- break;
197
+ };
198
+ s.onTouchStart = (t) => {
199
+ if (!t.currentTarget.contains(t.target)) return;
200
+ let u = ve(t.nativeEvent);
201
+ if (!u) return;
202
+ e.activePointerId = u.identifier, e.ignoreEmulatedMouseEvents = !0, e.isOverTarget = !0, e.isPressed = !0, e.target = t.currentTarget, e.pointerType = "touch", !g && !P && X(t.currentTarget), d || G(e.target), y(m(e.target, t), e.pointerType) && t.stopPropagation(), E(R(t.currentTarget), "scroll", f, !0);
203
+ }, s.onTouchMove = (t) => {
204
+ if (!t.currentTarget.contains(t.target)) return;
205
+ if (!e.isPressed) {
206
+ t.stopPropagation();
207
+ return;
151
208
  }
152
- }
153
- e.setFocused(!0), e.setFocusedKey(t), t == null && !x && L(n.current);
154
- }
155
- }, []);
156
- let P = k(e.focusedKey);
157
- I(() => {
158
- let t = C();
159
- if (e.isFocused && e.focusedKey != null && (i != null && i.current)) {
160
- let r = i.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
161
- r && (t === "keyboard" || S.current) && (p || _(i.current, r), t !== "virtual" && M(r, {
162
- containingElement: n.current
163
- }));
209
+ let u = z(t.nativeEvent, e.activePointerId), r = !0;
210
+ u && k(u, t.currentTarget) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, r = y(m(e.target, t), e.pointerType)) : e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, r = p(m(e.target, t), e.pointerType, !1), I(m(e.target, t))), r && t.stopPropagation();
211
+ }, s.onTouchEnd = (t) => {
212
+ if (!t.currentTarget.contains(t.target)) return;
213
+ if (!e.isPressed) {
214
+ t.stopPropagation();
215
+ return;
216
+ }
217
+ let u = z(t.nativeEvent, e.activePointerId), r = !0;
218
+ u && k(u, t.currentTarget) && e.pointerType != null ? (M(m(e.target, t), e.pointerType), r = p(m(e.target, t), e.pointerType)) : e.isOverTarget && e.pointerType != null && (r = p(m(e.target, t), e.pointerType, !1)), r && t.stopPropagation(), e.isPressed = !1, e.activePointerId = null, e.isOverTarget = !1, e.ignoreEmulatedMouseEvents = !0, e.target && !d && L(e.target), O();
219
+ }, s.onTouchCancel = (t) => {
220
+ t.currentTarget.contains(t.target) && (t.stopPropagation(), e.isPressed && S(m(e.target, t)));
221
+ };
222
+ let f = (t) => {
223
+ e.isPressed && t.target.contains(e.target) && S({
224
+ currentTarget: e.target,
225
+ shiftKey: !1,
226
+ ctrlKey: !1,
227
+ metaKey: !1,
228
+ altKey: !1
229
+ });
230
+ };
231
+ s.onDragStart = (t) => {
232
+ t.currentTarget.contains(t.target) && S(t);
233
+ };
164
234
  }
165
- e.isFocused && e.focusedKey == null && P.current != null && L(n.current), P.current = e.focusedKey, S.current = !1;
235
+ return s;
166
236
  }, [
237
+ E,
238
+ g,
239
+ P,
240
+ O,
241
+ d,
242
+ S,
243
+ I,
167
244
  p,
168
- i,
169
- e.focusedKey,
170
- e.isFocused,
171
- n
245
+ y,
246
+ M
172
247
  ]);
173
- let F = {
174
- onKeyDown: q,
175
- onFocus: G,
176
- onBlur: H,
177
- onMouseDown(t) {
178
- i.current === t.target && t.preventDefault();
179
- }
180
- }, { typeSelectProps: j } = J({
181
- keyboardDelegate: o,
182
- selectionManager: e
183
- });
184
- U || (F = ee(j, F));
185
- let A;
186
- return x || (A = e.focusedKey == null ? 0 : -1), {
187
- collectionProps: {
188
- ...F,
189
- tabIndex: A
190
- }
248
+ return pe(() => () => {
249
+ var e;
250
+ d || L((e = K.current.target) !== null && e !== void 0 ? e : void 0);
251
+ }, [
252
+ d
253
+ ]), {
254
+ isPressed: b || ee,
255
+ pressProps: q(Z, te)
191
256
  };
192
257
  }
258
+ function F(i) {
259
+ return i.tagName === "A" && i.hasAttribute("href");
260
+ }
261
+ function U(i, a) {
262
+ const { key: o, code: l } = i, c = a, v = c.getAttribute("role");
263
+ return (o === "Enter" || o === " " || o === "Spacebar" || l === "Space") && !(c instanceof R(c).HTMLInputElement && !Q(c, o) || c instanceof R(c).HTMLTextAreaElement || c.isContentEditable) && // Links should only trigger with Enter key
264
+ !((v === "link" || !v && F(c)) && o !== "Enter");
265
+ }
266
+ function ve(i) {
267
+ const { targetTouches: a } = i;
268
+ return a.length > 0 ? a[0] : null;
269
+ }
270
+ function z(i, a) {
271
+ const o = i.changedTouches;
272
+ for (let l = 0; l < o.length; l++) {
273
+ const c = o[l];
274
+ if (c.identifier === a) return c;
275
+ }
276
+ return null;
277
+ }
278
+ function m(i, a) {
279
+ let o = 0, l = 0;
280
+ return a.targetTouches && a.targetTouches.length === 1 && (o = a.targetTouches[0].clientX, l = a.targetTouches[0].clientY), {
281
+ currentTarget: i,
282
+ shiftKey: a.shiftKey,
283
+ ctrlKey: a.ctrlKey,
284
+ metaKey: a.metaKey,
285
+ altKey: a.altKey,
286
+ clientX: o,
287
+ clientY: l
288
+ };
289
+ }
290
+ function $(i, a) {
291
+ let o = a.clientX, l = a.clientY;
292
+ return {
293
+ currentTarget: i,
294
+ shiftKey: a.shiftKey,
295
+ ctrlKey: a.ctrlKey,
296
+ metaKey: a.metaKey,
297
+ altKey: a.altKey,
298
+ clientX: o,
299
+ clientY: l
300
+ };
301
+ }
302
+ function Pe(i) {
303
+ let a = 0, o = 0;
304
+ return i.width !== void 0 ? a = i.width / 2 : i.radiusX !== void 0 && (a = i.radiusX), i.height !== void 0 ? o = i.height / 2 : i.radiusY !== void 0 && (o = i.radiusY), {
305
+ top: i.clientY - o,
306
+ right: i.clientX + a,
307
+ bottom: i.clientY + o,
308
+ left: i.clientX - a
309
+ };
310
+ }
311
+ function ye(i, a) {
312
+ return !(i.left > a.right || a.left > i.right || i.top > a.bottom || a.top > i.bottom);
313
+ }
314
+ function k(i, a) {
315
+ let o = a.getBoundingClientRect(), l = Pe(i);
316
+ return ye(o, l);
317
+ }
318
+ function _(i) {
319
+ return !(i instanceof HTMLElement) || !i.hasAttribute("draggable");
320
+ }
321
+ function J(i) {
322
+ return i instanceof HTMLInputElement ? !1 : i instanceof HTMLButtonElement ? i.type !== "submit" && i.type !== "reset" : !F(i);
323
+ }
324
+ function j(i, a) {
325
+ return i instanceof HTMLInputElement ? !Q(i, a) : J(i);
326
+ }
327
+ const he = /* @__PURE__ */ new Set([
328
+ "checkbox",
329
+ "radio",
330
+ "range",
331
+ "color",
332
+ "file",
333
+ "image",
334
+ "button",
335
+ "submit",
336
+ "reset"
337
+ ]);
338
+ function Q(i, a) {
339
+ return i.type === "checkbox" || i.type === "radio" ? a === " " : he.has(i.type);
340
+ }
193
341
  export {
194
- ae as useSelectableCollection
342
+ Me as usePress
195
343
  };
package/index192.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@react-aria/utils");function r(e){return t.isAppleDevice()?e.altKey:e.ctrlKey}function f(e){return t.isMac()?e.metaKey:e.ctrlKey}exports.isCtrlKeyPressed=f;exports.isNonContiguousSelectionModifier=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index193.js"),Q=require("./index194.js"),X=require("react-dom"),p=require("react"),q=require("@react-aria/focus"),n=require("@react-aria/utils"),N=require("./index195.js"),Y=require("@react-aria/i18n");function Z(V){let{selectionManager:e,keyboardDelegate:o,ref:c,autoFocus:w=!1,shouldFocusWrap:S=!1,disallowEmptySelection:B=!1,disallowSelectAll:$=!1,selectOnFocus:K=e.selectionBehavior==="replace",disallowTypeAhead:W=!1,shouldUseVirtualFocus:m,allowsTabNavigation:U=!1,isVirtualized:A,scrollRef:s=c,linkBehavior:O="action"}=V,{direction:b}=Y.useLocale(),z=n.useRouter(),j=t=>{if(t.altKey&&t.key==="Tab"&&t.preventDefault(),!c.current.contains(t.target))return;const r=(l,d)=>{if(l!=null){if(e.isLink(l)&&O==="selection"&&K&&!y.isNonContiguousSelectionModifier(t)){X.flushSync(()=>{e.setFocusedKey(l,d)});let v=s.current.querySelector(`[data-key="${CSS.escape(l.toString())}"]`),L=e.getItemProps(l);z.open(v,t,L.href,L.routerOptions);return}if(e.setFocusedKey(l,d),e.isLink(l)&&O==="override")return;t.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(l):K&&!y.isNonContiguousSelectionModifier(t)&&e.replaceSelection(l)}};switch(t.key){case"ArrowDown":if(o.getKeyBelow){var u,i,a;let l=e.focusedKey!=null?(u=o.getKeyBelow)===null||u===void 0?void 0:u.call(o,e.focusedKey):(i=o.getFirstKey)===null||i===void 0?void 0:i.call(o);l==null&&S&&(l=(a=o.getFirstKey)===null||a===void 0?void 0:a.call(o,e.focusedKey)),l!=null&&(t.preventDefault(),r(l))}break;case"ArrowUp":if(o.getKeyAbove){var f,g,h;let l=e.focusedKey!=null?(f=o.getKeyAbove)===null||f===void 0?void 0:f.call(o,e.focusedKey):(g=o.getLastKey)===null||g===void 0?void 0:g.call(o);l==null&&S&&(l=(h=o.getLastKey)===null||h===void 0?void 0:h.call(o,e.focusedKey)),l!=null&&(t.preventDefault(),r(l))}break;case"ArrowLeft":if(o.getKeyLeftOf){var k,x,C;let l=(k=o.getKeyLeftOf)===null||k===void 0?void 0:k.call(o,e.focusedKey);l==null&&S&&(l=b==="rtl"?(x=o.getFirstKey)===null||x===void 0?void 0:x.call(o,e.focusedKey):(C=o.getLastKey)===null||C===void 0?void 0:C.call(o,e.focusedKey)),l!=null&&(t.preventDefault(),r(l,b==="rtl"?"first":"last"))}break;case"ArrowRight":if(o.getKeyRightOf){var E,M,I;let l=(E=o.getKeyRightOf)===null||E===void 0?void 0:E.call(o,e.focusedKey);l==null&&S&&(l=b==="rtl"?(M=o.getLastKey)===null||M===void 0?void 0:M.call(o,e.focusedKey):(I=o.getFirstKey)===null||I===void 0?void 0:I.call(o,e.focusedKey)),l!=null&&(t.preventDefault(),r(l,b==="rtl"?"last":"first"))}break;case"Home":if(o.getFirstKey){t.preventDefault();let l=o.getFirstKey(e.focusedKey,y.isCtrlKeyPressed(t));e.setFocusedKey(l),y.isCtrlKeyPressed(t)&&t.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(l):K&&e.replaceSelection(l)}break;case"End":if(o.getLastKey){t.preventDefault();let l=o.getLastKey(e.focusedKey,y.isCtrlKeyPressed(t));e.setFocusedKey(l),y.isCtrlKeyPressed(t)&&t.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(l):K&&e.replaceSelection(l)}break;case"PageDown":if(o.getKeyPageBelow){let l=o.getKeyPageBelow(e.focusedKey);l!=null&&(t.preventDefault(),r(l))}break;case"PageUp":if(o.getKeyPageAbove){let l=o.getKeyPageAbove(e.focusedKey);l!=null&&(t.preventDefault(),r(l))}break;case"a":y.isCtrlKeyPressed(t)&&e.selectionMode==="multiple"&&$!==!0&&(t.preventDefault(),e.selectAll());break;case"Escape":!B&&e.selectedKeys.size!==0&&(t.stopPropagation(),t.preventDefault(),e.clearSelection());break;case"Tab":if(!U){if(t.shiftKey)c.current.focus();else{let l=q.getFocusableTreeWalker(c.current,{tabbable:!0}),d,v;do v=l.lastChild(),v&&(d=v);while(v);d&&!d.contains(document.activeElement)&&n.focusWithoutScrolling(d)}break}}},D=p.useRef({top:0,left:0});n.useEvent(s,"scroll",A?null:()=>{D.current={top:s.current.scrollTop,left:s.current.scrollLeft}});let G=t=>{if(e.isFocused){t.currentTarget.contains(t.target)||e.setFocused(!1);return}if(t.currentTarget.contains(t.target)){if(e.setFocused(!0),e.focusedKey==null){let i=f=>{f!=null&&(e.setFocusedKey(f),K&&e.replaceSelection(f))},a=t.relatedTarget;var r,u;a&&t.currentTarget.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING?i((r=e.lastSelectedKey)!==null&&r!==void 0?r:o.getLastKey()):i((u=e.firstSelectedKey)!==null&&u!==void 0?u:o.getFirstKey())}else A||(s.current.scrollTop=D.current.top,s.current.scrollLeft=D.current.left);if(e.focusedKey!=null){let i=s.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);i&&(i.contains(document.activeElement)||n.focusWithoutScrolling(i),N.getInteractionModality()==="keyboard"&&n.scrollIntoViewport(i,{containingElement:c.current}))}}},H=t=>{t.currentTarget.contains(t.relatedTarget)||e.setFocused(!1)};const F=p.useRef(w);p.useEffect(()=>{if(F.current){let t=null;w==="first"&&(t=o.getFirstKey()),w==="last"&&(t=o.getLastKey());let r=e.selectedKeys;if(r.size){for(let u of r)if(e.canSelectItem(u)){t=u;break}}e.setFocused(!0),e.setFocusedKey(t),t==null&&!m&&q.focusSafely(c.current)}},[]);let T=p.useRef(e.focusedKey);p.useEffect(()=>{if(e.isFocused&&e.focusedKey!=null&&(e.focusedKey!==T.current||F.current)&&(s!=null&&s.current)){let t=N.getInteractionModality(),r=c.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);if(!r)return;(t==="keyboard"||F.current)&&(n.scrollIntoView(s.current,r),t!=="virtual"&&n.scrollIntoViewport(r,{containingElement:c.current}))}!m&&e.isFocused&&e.focusedKey==null&&T.current!=null&&q.focusSafely(c.current),T.current=e.focusedKey,F.current=!1}),n.useEvent(c,"react-aria-focus-scope-restore",t=>{t.preventDefault(),e.setFocused(!0)});let P={onKeyDown:j,onFocus:G,onBlur:H,onMouseDown(t){s.current===t.target&&t.preventDefault()}},{typeSelectProps:J}=Q.useTypeSelect({keyboardDelegate:o,selectionManager:e});W||(P=n.mergeProps(J,P));let R;return m||(R=e.focusedKey==null?0:-1),{collectionProps:{...P,tabIndex:R}}}exports.useSelectableCollection=Z;