@okam/stack-ui 1.29.0 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) 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 +2 -1
  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/attributes.d.ts +2 -0
  34. package/components/WysiwygBlock/index.d.ts +2 -1
  35. package/components/WysiwygBlock/interface.d.ts +2 -1
  36. package/components/fields/Checkbox/Checkbox.interface.d.ts +2 -1
  37. package/components/fields/Checkbox/index.d.ts +2 -1
  38. package/components/fields/CheckboxGroup/index.d.ts +2 -1
  39. package/components/fields/CheckboxGroup/interface.d.ts +2 -1
  40. package/components/fields/DatePicker/index.d.ts +2 -1
  41. package/components/fields/DatePicker/interface.d.ts +2 -1
  42. package/components/fields/Radio/Radio.interface.d.ts +3 -2
  43. package/components/fields/Radio/index.d.ts +3 -2
  44. package/components/fields/RadioGroup/index.d.ts +2 -1
  45. package/components/fields/RadioGroup/interface.d.ts +2 -1
  46. package/components/fields/SearchField/index.d.ts +2 -1
  47. package/components/fields/SearchField/interface.d.ts +2 -1
  48. package/components/fields/Select/Select.d.ts +2 -1
  49. package/components/fields/Select/Select.interface.d.ts +3 -2
  50. package/components/fields/TextArea/index.d.ts +2 -1
  51. package/components/fields/TextInputField/interface.d.ts +3 -2
  52. package/index.d.ts +1 -0
  53. package/index.js +1 -1
  54. package/index.mjs +41 -38
  55. package/index100.js +1 -2
  56. package/index100.mjs +22 -21
  57. package/index101.js +2 -1
  58. package/index101.mjs +22 -63
  59. package/index102.js +1 -1
  60. package/index102.mjs +58 -24
  61. package/index103.js +1 -1
  62. package/index103.mjs +29 -4
  63. package/index104.js +1 -1
  64. package/index104.mjs +52 -11
  65. package/index105.js +1 -1
  66. package/index105.mjs +4 -14
  67. package/index106.js +1 -1
  68. package/index106.mjs +11 -23
  69. package/index107.js +1 -1
  70. package/index107.mjs +13 -22
  71. package/index108.js +1 -1
  72. package/index108.mjs +23 -39
  73. package/index109.js +1 -2
  74. package/index109.mjs +22 -12
  75. package/index11.js +1 -1
  76. package/index11.mjs +2 -2
  77. package/index110.js +1 -1
  78. package/index110.mjs +38 -7
  79. package/index111.js +2 -1
  80. package/index111.mjs +12 -21
  81. package/index112.js +1 -1
  82. package/index112.mjs +7 -38
  83. package/index113.js +1 -1
  84. package/index113.mjs +20 -48
  85. package/index114.js +1 -1
  86. package/index114.mjs +38 -40
  87. package/index115.js +1 -1
  88. package/index115.mjs +47 -11
  89. package/index116.js +1 -1
  90. package/index116.mjs +41 -26
  91. package/index117.js +1 -1
  92. package/index117.mjs +14 -20
  93. package/index118.js +1 -1
  94. package/index118.mjs +30 -8
  95. package/index119.js +1 -1
  96. package/index119.mjs +20 -30
  97. package/index120.js +1 -1
  98. package/index120.mjs +8 -14
  99. package/index121.js +1 -1
  100. package/index121.mjs +29 -16
  101. package/index122.js +1 -1
  102. package/index122.mjs +15 -21
  103. package/index123.js +1 -1
  104. package/index123.mjs +17 -11
  105. package/index124.js +1 -2
  106. package/index124.mjs +20 -21
  107. package/index125.js +1 -1
  108. package/index125.mjs +11 -12
  109. package/index126.js +2 -1
  110. package/index126.mjs +22 -46
  111. package/index127.js +1 -1
  112. package/index127.mjs +12 -241
  113. package/index128.js +1 -2
  114. package/index128.mjs +46 -13
  115. package/index129.js +1 -1
  116. package/index129.mjs +239 -28
  117. package/index13.js +1 -1
  118. package/index13.mjs +8 -5
  119. package/index130.js +2 -1
  120. package/index130.mjs +13 -51
  121. package/index131.js +1 -1
  122. package/index131.mjs +30 -27
  123. package/index132.js +1 -1
  124. package/index132.mjs +49 -19
  125. package/index133.js +1 -1
  126. package/index133.mjs +26 -61
  127. package/index134.js +1 -1
  128. package/index134.mjs +17 -91
  129. package/index135.js +1 -1
  130. package/index135.mjs +59 -29
  131. package/index136.js +1 -1
  132. package/index136.mjs +90 -117
  133. package/index137.js +1 -1
  134. package/index137.mjs +32 -26
  135. package/index138.js +1 -1
  136. package/index138.mjs +118 -121
  137. package/index139.js +1 -1
  138. package/index139.mjs +27 -134
  139. package/index14.js +1 -1
  140. package/index14.mjs +3 -3
  141. package/index140.js +1 -1
  142. package/index140.mjs +122 -12
  143. package/index141.js +1 -1
  144. package/index141.mjs +131 -92
  145. package/index142.js +1 -1
  146. package/index142.mjs +12 -104
  147. package/index143.js +1 -1
  148. package/index143.mjs +95 -5
  149. package/index144.js +1 -1
  150. package/index144.mjs +106 -3
  151. package/index145.js +1 -1
  152. package/index145.mjs +5 -125
  153. package/index146.js +1 -1
  154. package/index146.mjs +3 -29
  155. package/index147.js +1 -1
  156. package/index147.mjs +113 -39
  157. package/index148.js +1 -1
  158. package/index148.mjs +19 -34
  159. package/index149.js +1 -1
  160. package/index149.mjs +40 -26
  161. package/index150.js +1 -1
  162. package/index150.mjs +29 -98
  163. package/index151.js +1 -1
  164. package/index151.mjs +28 -68
  165. package/index152.js +1 -1
  166. package/index152.mjs +90 -78
  167. package/index153.js +1 -1
  168. package/index153.mjs +78 -98
  169. package/index154.js +1 -1
  170. package/index154.mjs +101 -199
  171. package/index155.js +1 -1
  172. package/index155.mjs +98 -65
  173. package/index156.js +1 -1
  174. package/index156.mjs +185 -127
  175. package/index157.js +1 -1
  176. package/index157.mjs +54 -109
  177. package/index158.js +1 -1
  178. package/index158.mjs +126 -202
  179. package/index159.js +1 -1
  180. package/index159.mjs +104 -175
  181. package/index16.js +1 -1
  182. package/index16.mjs +2 -2
  183. package/index160.js +1 -1
  184. package/index160.mjs +208 -60
  185. package/index161.js +1 -1
  186. package/index161.mjs +178 -246
  187. package/index162.js +1 -1
  188. package/index162.mjs +63 -91
  189. package/index163.js +1 -1
  190. package/index163.mjs +250 -166
  191. package/index164.js +1 -1
  192. package/index164.mjs +91 -78
  193. package/index165.js +1 -1
  194. package/index165.mjs +170 -54
  195. package/index166.js +1 -1
  196. package/index166.mjs +72 -114
  197. package/index167.js +1 -1
  198. package/index167.mjs +51 -109
  199. package/index168.js +1 -1
  200. package/index168.mjs +112 -108
  201. package/index169.js +1 -1
  202. package/index169.mjs +109 -65
  203. package/index170.js +1 -1
  204. package/index170.mjs +117 -105
  205. package/index171.js +1 -1
  206. package/index171.mjs +68 -48
  207. package/index172.js +1 -1
  208. package/index172.mjs +108 -91
  209. package/index173.js +1 -1
  210. package/index173.mjs +37 -55
  211. package/index174.js +1 -1
  212. package/index174.mjs +80 -43
  213. package/index175.js +1 -1
  214. package/index175.mjs +52 -81
  215. package/index176.js +1 -5
  216. package/index176.mjs +42 -66
  217. package/index177.js +1 -1
  218. package/index177.mjs +87 -1999
  219. package/index178.js +5 -1
  220. package/index178.mjs +79 -58
  221. package/index179.js +1 -1
  222. package/index179.mjs +1998 -175
  223. package/index18.js +1 -1
  224. package/index18.mjs +7 -7
  225. package/index180.js +1 -1
  226. package/index180.mjs +59 -5
  227. package/index181.js +1 -1
  228. package/index181.mjs +183 -125
  229. package/index182.js +1 -1
  230. package/index182.mjs +5 -179
  231. package/index183.js +1 -1
  232. package/index183.mjs +129 -8
  233. package/index184.js +1 -1
  234. package/index184.mjs +179 -3
  235. package/index185.js +1 -1
  236. package/index185.mjs +8 -35
  237. package/index186.js +1 -1
  238. package/index186.mjs +3 -5
  239. package/index187.js +1 -1
  240. package/index187.mjs +35 -28
  241. package/index188.js +1 -1
  242. package/index188.mjs +5 -6
  243. package/index189.js +1 -1
  244. package/index189.mjs +26 -310
  245. package/index19.js +1 -1
  246. package/index19.mjs +2 -2
  247. package/index190.js +1 -1
  248. package/index190.mjs +6 -192
  249. package/index191.js +1 -1
  250. package/index191.mjs +339 -7
  251. package/index192.js +1 -1
  252. package/index192.mjs +180 -23
  253. package/index193.js +1 -1
  254. package/index193.mjs +6 -53
  255. package/index194.js +1 -1
  256. package/index194.mjs +24 -44
  257. package/index195.js +1 -1
  258. package/index195.mjs +55 -124
  259. package/index196.js +1 -1
  260. package/index196.mjs +46 -5
  261. package/index197.js +1 -1
  262. package/index197.mjs +108 -26
  263. package/index198.js +1 -1
  264. package/index198.mjs +32 -6
  265. package/index199.js +1 -1
  266. package/index199.mjs +5 -7
  267. package/index2.js +1 -1
  268. package/index2.mjs +19 -19
  269. package/index20.js +1 -1
  270. package/index20.mjs +1 -1
  271. package/index200.js +1 -1
  272. package/index200.mjs +28 -7
  273. package/index201.js +1 -1
  274. package/index201.mjs +7 -5
  275. package/index202.js +1 -1
  276. package/index202.mjs +7 -5
  277. package/index203.js +1 -1
  278. package/index203.mjs +7 -9
  279. package/index204.js +1 -0
  280. package/index204.mjs +7 -0
  281. package/index205.js +1 -0
  282. package/index205.mjs +8 -0
  283. package/index206.js +1 -0
  284. package/index206.mjs +12 -0
  285. package/index21.js +1 -1
  286. package/index21.mjs +8 -8
  287. package/index22.js +1 -1
  288. package/index22.mjs +2 -2
  289. package/index23.js +1 -1
  290. package/index23.mjs +3 -3
  291. package/index24.js +1 -1
  292. package/index24.mjs +14 -14
  293. package/index26.js +1 -1
  294. package/index26.mjs +28 -21
  295. package/index27.js +1 -1
  296. package/index27.mjs +12 -12
  297. package/index28.js +1 -1
  298. package/index28.mjs +6 -6
  299. package/index29.js +1 -1
  300. package/index29.mjs +1 -1
  301. package/index30.js +1 -1
  302. package/index30.mjs +14 -8
  303. package/index31.js +1 -1
  304. package/index31.mjs +18 -18
  305. package/index32.js +1 -1
  306. package/index32.mjs +1 -1
  307. package/index33.mjs +43 -43
  308. package/index34.js +1 -1
  309. package/index34.mjs +1 -1
  310. package/index35.js +1 -1
  311. package/index35.mjs +3 -3
  312. package/index36.mjs +10 -10
  313. package/index4.js +1 -1
  314. package/index4.mjs +3 -3
  315. package/index6.js +1 -1
  316. package/index6.mjs +34 -33
  317. package/index65.js +1 -1
  318. package/index65.mjs +1 -1
  319. package/index66.js +1 -1
  320. package/index66.mjs +2 -2
  321. package/index67.js +1 -1
  322. package/index67.mjs +1 -1
  323. package/index69.js +1 -1
  324. package/index69.mjs +1 -1
  325. package/index7.mjs +4 -4
  326. package/index70.js +1 -1
  327. package/index70.mjs +1 -1
  328. package/index71.js +1 -1
  329. package/index71.mjs +1 -1
  330. package/index72.js +2 -1
  331. package/index72.mjs +27 -2
  332. package/index73.js +1 -2
  333. package/index73.mjs +2 -9
  334. package/index74.js +1 -1
  335. package/index74.mjs +7 -6
  336. package/index75.js +1 -1
  337. package/index75.mjs +6 -6
  338. package/index76.js +1 -1
  339. package/index76.mjs +6 -6
  340. package/index77.js +2 -1
  341. package/index77.mjs +8 -25
  342. package/index78.js +1 -1
  343. package/index78.mjs +25 -2
  344. package/index79.js +1 -6
  345. package/index79.mjs +2 -94
  346. package/index8.js +1 -1
  347. package/index8.mjs +42 -23
  348. package/index80.js +6 -1
  349. package/index80.mjs +79 -54
  350. package/index81.js +1 -1
  351. package/index81.mjs +61 -33
  352. package/index82.js +1 -42
  353. package/index82.mjs +34 -67
  354. package/index83.js +42 -1
  355. package/index83.mjs +69 -154
  356. package/index84.js +1 -9
  357. package/index84.mjs +149 -47
  358. package/index85.js +9 -1
  359. package/index85.mjs +48 -36
  360. package/index86.js +1 -1
  361. package/index86.mjs +40 -8
  362. package/index87.js +1 -1
  363. package/index87.mjs +9 -31
  364. package/index88.js +1 -1
  365. package/index88.mjs +35 -6
  366. package/index89.js +1 -12
  367. package/index89.mjs +6 -40
  368. package/index9.js +1 -1
  369. package/index9.mjs +7 -7
  370. package/index90.js +12 -1
  371. package/index90.mjs +36 -25
  372. package/index91.js +1 -1
  373. package/index91.mjs +24 -8
  374. package/index92.js +1 -7
  375. package/index92.mjs +7 -13
  376. package/index93.js +6 -14
  377. package/index93.mjs +13 -65
  378. package/index94.js +15 -1
  379. package/index94.mjs +71 -7
  380. package/index95.js +1 -16
  381. package/index95.mjs +7 -25
  382. package/index96.js +16 -1
  383. package/index96.mjs +20 -37
  384. package/index97.js +1 -1
  385. package/index97.mjs +40 -43
  386. package/index98.js +1 -1
  387. package/index98.mjs +44 -47
  388. package/index99.js +1 -1
  389. package/index99.mjs +48 -17
  390. package/package.json +1 -1
  391. package/providers/Translation/index.d.ts +4 -0
  392. package/providers/Translation/interface.d.ts +16 -0
  393. package/theme/Accordion/index.d.ts +12 -12
  394. package/theme/Alerts/index.d.ts +22 -22
  395. package/theme/Box/index.d.ts +8 -8
  396. package/theme/Button/index.d.ts +2 -2
  397. package/theme/Calendar/index.d.ts +12 -12
  398. package/theme/Carousel/index.d.ts +11 -11
  399. package/theme/Checkbox/index.d.ts +8 -8
  400. package/theme/CheckboxGroup/index.d.ts +3 -3
  401. package/theme/DatePicker/index.d.ts +9 -9
  402. package/theme/Image/index.d.ts +1 -1
  403. package/theme/LightBox/index.d.ts +9 -9
  404. package/theme/Radio/index.d.ts +6 -6
  405. package/theme/RadioGroup/index.d.ts +3 -3
  406. package/theme/Search/index.d.ts +3 -3
  407. package/theme/ShareButton/index.d.ts +10 -10
  408. package/theme/SidePanel/index.d.ts +3 -3
  409. package/theme/TextArea/index.d.ts +2 -2
  410. package/theme/Typography/index.d.ts +2 -2
  411. package/transitions/ModalTransition.d.ts +3 -6
  412. package/transitions/RenderWithSlide.d.ts +3 -6
  413. package/transitions/SidePanelTransition.d.ts +3 -6
package/index192.mjs CHANGED
@@ -1,29 +1,186 @@
1
- import { useRef as u } from "react";
2
- const s = 1e3;
3
- function g(r) {
4
- let { keyboardDelegate: o, selectionManager: c, onTypeSelect: l } = r, t = u({
5
- search: "",
6
- timeout: null
7
- }).current, i = (e) => {
8
- let a = f(e.key);
9
- if (!a || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target)) return;
10
- a === " " && t.search.trim().length > 0 && (e.preventDefault(), "continuePropagation" in e || e.stopPropagation()), t.search += a;
11
- let n = o.getKeyForSearch(t.search, c.focusedKey);
12
- n == null && (n = o.getKeyForSearch(t.search)), n != null && (c.setFocusedKey(n), l && l(n)), clearTimeout(t.timeout), t.timeout = setTimeout(() => {
13
- t.search = "";
14
- }, s);
1
+ import { isCtrlKeyPressed as p, isNonContiguousSelectionModifier as O } from "./index193.mjs";
2
+ import { useTypeSelect as _ } from "./index194.mjs";
3
+ import { flushSync as ee } from "react-dom";
4
+ import { useRef as E, useEffect as B } from "react";
5
+ import { focusSafely as N, getFocusableTreeWalker as te } from "@react-aria/focus";
6
+ import { useRouter as le, useEvent as R, scrollIntoView as oe, scrollIntoViewport as V, mergeProps as re, focusWithoutScrolling as U } from "@react-aria/utils";
7
+ import { getInteractionModality as W } from "./index195.mjs";
8
+ import { useLocale as ie } from "@react-aria/i18n";
9
+ function pe(z) {
10
+ let { selectionManager: e, keyboardDelegate: o, ref: s, autoFocus: m = !1, shouldFocusWrap: v = !1, disallowEmptySelection: q = !1, disallowSelectAll: G = !1, selectOnFocus: y = e.selectionBehavior === "replace", disallowTypeAhead: H = !1, shouldUseVirtualFocus: S, allowsTabNavigation: j = !1, isVirtualized: I, scrollRef: i = s, linkBehavior: M = "action" } = z, { direction: K } = ie(), J = le(), Q = (t) => {
11
+ if (t.altKey && t.key === "Tab" && t.preventDefault(), !s.current.contains(t.target)) return;
12
+ const r = (l, a) => {
13
+ if (l != null) {
14
+ if (e.isLink(l) && M === "selection" && y && !O(t)) {
15
+ ee(() => {
16
+ e.setFocusedKey(l, a);
17
+ });
18
+ let d = i.current.querySelector(`[data-key="${CSS.escape(l.toString())}"]`), L = e.getItemProps(l);
19
+ J.open(d, t, L.href, L.routerOptions);
20
+ return;
21
+ }
22
+ if (e.setFocusedKey(l, a), e.isLink(l) && M === "override") return;
23
+ t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && !O(t) && e.replaceSelection(l);
24
+ }
25
+ };
26
+ switch (t.key) {
27
+ case "ArrowDown":
28
+ if (o.getKeyBelow) {
29
+ var n, c, u;
30
+ let l = e.focusedKey != null ? (n = o.getKeyBelow) === null || n === void 0 ? void 0 : n.call(o, e.focusedKey) : (c = o.getFirstKey) === null || c === void 0 ? void 0 : c.call(o);
31
+ l == null && v && (l = (u = o.getFirstKey) === null || u === void 0 ? void 0 : u.call(o, e.focusedKey)), l != null && (t.preventDefault(), r(l));
32
+ }
33
+ break;
34
+ case "ArrowUp":
35
+ if (o.getKeyAbove) {
36
+ var f, T, h;
37
+ let l = e.focusedKey != null ? (f = o.getKeyAbove) === null || f === void 0 ? void 0 : f.call(o, e.focusedKey) : (T = o.getLastKey) === null || T === void 0 ? void 0 : T.call(o);
38
+ l == null && v && (l = (h = o.getLastKey) === null || h === void 0 ? void 0 : h.call(o, e.focusedKey)), l != null && (t.preventDefault(), r(l));
39
+ }
40
+ break;
41
+ case "ArrowLeft":
42
+ if (o.getKeyLeftOf) {
43
+ var k, x, $;
44
+ let l = (k = o.getKeyLeftOf) === null || k === void 0 ? void 0 : k.call(o, e.focusedKey);
45
+ l == null && v && (l = K === "rtl" ? (x = o.getFirstKey) === null || x === void 0 ? void 0 : x.call(o, e.focusedKey) : ($ = o.getLastKey) === null || $ === void 0 ? void 0 : $.call(o, e.focusedKey)), l != null && (t.preventDefault(), r(l, K === "rtl" ? "first" : "last"));
46
+ }
47
+ break;
48
+ case "ArrowRight":
49
+ if (o.getKeyRightOf) {
50
+ var P, g, A;
51
+ let l = (P = o.getKeyRightOf) === null || P === void 0 ? void 0 : P.call(o, e.focusedKey);
52
+ l == null && v && (l = K === "rtl" ? (g = o.getLastKey) === null || g === void 0 ? void 0 : g.call(o, e.focusedKey) : (A = o.getFirstKey) === null || A === void 0 ? void 0 : A.call(o, e.focusedKey)), l != null && (t.preventDefault(), r(l, K === "rtl" ? "last" : "first"));
53
+ }
54
+ break;
55
+ case "Home":
56
+ if (o.getFirstKey) {
57
+ t.preventDefault();
58
+ let l = o.getFirstKey(e.focusedKey, p(t));
59
+ e.setFocusedKey(l), p(t) && t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && e.replaceSelection(l);
60
+ }
61
+ break;
62
+ case "End":
63
+ if (o.getLastKey) {
64
+ t.preventDefault();
65
+ let l = o.getLastKey(e.focusedKey, p(t));
66
+ e.setFocusedKey(l), p(t) && t.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(l) : y && e.replaceSelection(l);
67
+ }
68
+ break;
69
+ case "PageDown":
70
+ if (o.getKeyPageBelow) {
71
+ let l = o.getKeyPageBelow(e.focusedKey);
72
+ l != null && (t.preventDefault(), r(l));
73
+ }
74
+ break;
75
+ case "PageUp":
76
+ if (o.getKeyPageAbove) {
77
+ let l = o.getKeyPageAbove(e.focusedKey);
78
+ l != null && (t.preventDefault(), r(l));
79
+ }
80
+ break;
81
+ case "a":
82
+ p(t) && e.selectionMode === "multiple" && G !== !0 && (t.preventDefault(), e.selectAll());
83
+ break;
84
+ case "Escape":
85
+ !q && e.selectedKeys.size !== 0 && (t.stopPropagation(), t.preventDefault(), e.clearSelection());
86
+ break;
87
+ case "Tab":
88
+ if (!j) {
89
+ if (t.shiftKey) s.current.focus();
90
+ else {
91
+ let l = te(s.current, {
92
+ tabbable: !0
93
+ }), a, d;
94
+ do
95
+ d = l.lastChild(), d && (a = d);
96
+ while (d);
97
+ a && !a.contains(document.activeElement) && U(a);
98
+ }
99
+ break;
100
+ }
101
+ }
102
+ }, F = E({
103
+ top: 0,
104
+ left: 0
105
+ });
106
+ R(i, "scroll", I ? null : () => {
107
+ F.current = {
108
+ top: i.current.scrollTop,
109
+ left: i.current.scrollLeft
110
+ };
111
+ });
112
+ let X = (t) => {
113
+ if (e.isFocused) {
114
+ t.currentTarget.contains(t.target) || e.setFocused(!1);
115
+ return;
116
+ }
117
+ if (t.currentTarget.contains(t.target)) {
118
+ if (e.setFocused(!0), e.focusedKey == null) {
119
+ let c = (f) => {
120
+ f != null && (e.setFocusedKey(f), y && e.replaceSelection(f));
121
+ }, u = t.relatedTarget;
122
+ var r, n;
123
+ u && t.currentTarget.compareDocumentPosition(u) & Node.DOCUMENT_POSITION_FOLLOWING ? c((r = e.lastSelectedKey) !== null && r !== void 0 ? r : o.getLastKey()) : c((n = e.firstSelectedKey) !== null && n !== void 0 ? n : o.getFirstKey());
124
+ } else I || (i.current.scrollTop = F.current.top, i.current.scrollLeft = F.current.left);
125
+ if (e.focusedKey != null) {
126
+ let c = i.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
127
+ c && (c.contains(document.activeElement) || U(c), W() === "keyboard" && V(c, {
128
+ containingElement: s.current
129
+ }));
130
+ }
131
+ }
132
+ }, Y = (t) => {
133
+ t.currentTarget.contains(t.relatedTarget) || e.setFocused(!1);
15
134
  };
16
- return {
17
- typeSelectProps: {
18
- // Using a capturing listener to catch the keydown event before
19
- // other hooks in order to handle the Spacebar event.
20
- onKeyDownCapture: o.getKeyForSearch ? i : null
135
+ const b = E(m);
136
+ B(() => {
137
+ if (b.current) {
138
+ let t = null;
139
+ m === "first" && (t = o.getFirstKey()), m === "last" && (t = o.getLastKey());
140
+ let r = e.selectedKeys;
141
+ if (r.size) {
142
+ for (let n of r) if (e.canSelectItem(n)) {
143
+ t = n;
144
+ break;
145
+ }
146
+ }
147
+ e.setFocused(!0), e.setFocusedKey(t), t == null && !S && N(s.current);
148
+ }
149
+ }, []);
150
+ let w = E(e.focusedKey);
151
+ B(() => {
152
+ if (e.isFocused && e.focusedKey != null && (e.focusedKey !== w.current || b.current) && (i != null && i.current)) {
153
+ let t = W(), r = s.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
154
+ if (!r)
155
+ return;
156
+ (t === "keyboard" || b.current) && (oe(i.current, r), t !== "virtual" && V(r, {
157
+ containingElement: s.current
158
+ }));
159
+ }
160
+ !S && e.isFocused && e.focusedKey == null && w.current != null && N(s.current), w.current = e.focusedKey, b.current = !1;
161
+ }), R(s, "react-aria-focus-scope-restore", (t) => {
162
+ t.preventDefault(), e.setFocused(!0);
163
+ });
164
+ let D = {
165
+ onKeyDown: Q,
166
+ onFocus: X,
167
+ onBlur: Y,
168
+ onMouseDown(t) {
169
+ i.current === t.target && t.preventDefault();
170
+ }
171
+ }, { typeSelectProps: Z } = _({
172
+ keyboardDelegate: o,
173
+ selectionManager: e
174
+ });
175
+ H || (D = re(Z, D));
176
+ let C;
177
+ return S || (C = e.focusedKey == null ? 0 : -1), {
178
+ collectionProps: {
179
+ ...D,
180
+ tabIndex: C
21
181
  }
22
182
  };
23
183
  }
24
- function f(r) {
25
- return r.length === 1 || !/^[A-Z]/i.test(r) ? r : "";
26
- }
27
184
  export {
28
- g as useTypeSelect
185
+ pe as useSelectableCollection
29
186
  };
package/index193.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@react-aria/utils");require("react");let d=null,w=new Set,u=new Map,i=!1,s=!1;function c(e,n){for(let t of w)t(e,n)}function L(e){return!(e.metaKey||!a.isMac()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function f(e){i=!0,L(e)&&(d="keyboard",c("keyboard",e))}function o(e){d="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(i=!0,c("pointer",e))}function l(e){a.isVirtualClick(e)&&(i=!0,d="virtual")}function b(e){e.target===window||e.target===document||(!i&&!s&&(d="virtual",c("virtual",e)),i=!1,s=!1)}function $(){i=!1,s=!0}function v(e){if(typeof window>"u"||u.get(a.getOwnerWindow(e)))return;const n=a.getOwnerWindow(e),t=a.getOwnerDocument(e);let r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){i=!0,r.apply(this,arguments)},t.addEventListener("keydown",f,!0),t.addEventListener("keyup",f,!0),t.addEventListener("click",l,!0),n.addEventListener("focus",b,!0),n.addEventListener("blur",$,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",o,!0),t.addEventListener("pointermove",o,!0),t.addEventListener("pointerup",o,!0)):(t.addEventListener("mousedown",o,!0),t.addEventListener("mousemove",o,!0),t.addEventListener("mouseup",o,!0)),n.addEventListener("beforeunload",()=>{p(e)},{once:!0}),u.set(n,{focus:r})}const p=(e,n)=>{const t=a.getOwnerWindow(e),r=a.getOwnerDocument(e);n&&r.removeEventListener("DOMContentLoaded",n),u.has(t)&&(t.HTMLElement.prototype.focus=u.get(t).focus,r.removeEventListener("keydown",f,!0),r.removeEventListener("keyup",f,!0),r.removeEventListener("click",l,!0),t.removeEventListener("focus",b,!0),t.removeEventListener("blur",$,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",o,!0),r.removeEventListener("pointermove",o,!0),r.removeEventListener("pointerup",o,!0)):(r.removeEventListener("mousedown",o,!0),r.removeEventListener("mousemove",o,!0),r.removeEventListener("mouseup",o,!0)),u.delete(t))};function E(e){const n=a.getOwnerDocument(e);let t;return n.readyState!=="loading"?v(e):(t=()=>{v(e)},n.addEventListener("DOMContentLoaded",t)),()=>p(e,t)}typeof document<"u"&&E();function m(){return d}exports.addWindowFocusTracking=E;exports.getInteractionModality=m;exports.hasSetupGlobalListeners=u;
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;
package/index193.mjs CHANGED
@@ -1,58 +1,11 @@
1
- import { getOwnerDocument as c, getOwnerWindow as d, isVirtualClick as L, isMac as m } from "@react-aria/utils";
2
- import "react";
3
- let u = null, y = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = !1, s = !1;
4
- function v(e, n) {
5
- for (let t of y) t(e, n);
6
- }
7
- function w(e) {
8
- return !(e.metaKey || !m() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
9
- }
10
- function f(e) {
11
- a = !0, w(e) && (u = "keyboard", v("keyboard", e));
1
+ import { isAppleDevice as f, isMac as r } from "@react-aria/utils";
2
+ function i(e) {
3
+ return f() ? e.altKey : e.ctrlKey;
12
4
  }
13
5
  function o(e) {
14
- u = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (a = !0, v("pointer", e));
15
- }
16
- function $(e) {
17
- L(e) && (a = !0, u = "virtual");
18
- }
19
- function b(e) {
20
- e.target === window || e.target === document || (!a && !s && (u = "virtual", v("virtual", e)), a = !1, s = !1);
21
- }
22
- function p() {
23
- a = !1, s = !0;
24
- }
25
- function l(e) {
26
- if (typeof window > "u" || i.get(d(e))) return;
27
- const n = d(e), t = c(e);
28
- let r = n.HTMLElement.prototype.focus;
29
- n.HTMLElement.prototype.focus = function() {
30
- a = !0, r.apply(this, arguments);
31
- }, t.addEventListener("keydown", f, !0), t.addEventListener("keyup", f, !0), t.addEventListener("click", $, !0), n.addEventListener("focus", b, !0), n.addEventListener("blur", p, !1), typeof PointerEvent < "u" ? (t.addEventListener("pointerdown", o, !0), t.addEventListener("pointermove", o, !0), t.addEventListener("pointerup", o, !0)) : (t.addEventListener("mousedown", o, !0), t.addEventListener("mousemove", o, !0), t.addEventListener("mouseup", o, !0)), n.addEventListener("beforeunload", () => {
32
- E(e);
33
- }, {
34
- once: !0
35
- }), i.set(n, {
36
- focus: r
37
- });
38
- }
39
- const E = (e, n) => {
40
- const t = d(e), r = c(e);
41
- n && r.removeEventListener("DOMContentLoaded", n), i.has(t) && (t.HTMLElement.prototype.focus = i.get(t).focus, r.removeEventListener("keydown", f, !0), r.removeEventListener("keyup", f, !0), r.removeEventListener("click", $, !0), t.removeEventListener("focus", b, !0), t.removeEventListener("blur", p, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", o, !0), r.removeEventListener("pointermove", o, !0), r.removeEventListener("pointerup", o, !0)) : (r.removeEventListener("mousedown", o, !0), r.removeEventListener("mousemove", o, !0), r.removeEventListener("mouseup", o, !0)), i.delete(t));
42
- };
43
- function g(e) {
44
- const n = c(e);
45
- let t;
46
- return n.readyState !== "loading" ? l(e) : (t = () => {
47
- l(e);
48
- }, n.addEventListener("DOMContentLoaded", t)), () => E(e, t);
49
- }
50
- typeof document < "u" && g();
51
- function M() {
52
- return u;
6
+ return r() ? e.metaKey : e.ctrlKey;
53
7
  }
54
8
  export {
55
- g as addWindowFocusTracking,
56
- M as getInteractionModality,
57
- i as hasSetupGlobalListeners
9
+ o as isCtrlKeyPressed,
10
+ i as isNonContiguousSelectionModifier
58
11
  };
package/index194.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index189.js"),r=require("@react-aria/utils"),f=require("react"),m=500;function y(c){let{isDisabled:n,onLongPressStart:o,onLongPressEnd:i,onLongPress:s,threshold:l=m,accessibilityDescription:a}=c;const t=f.useRef();let{addGlobalListener:u,removeGlobalListener:d}=r.useGlobalListeners(),{pressProps:P}=L.usePress({isDisabled:n,onPressStart(e){if(e.continuePropagation(),(e.pointerType==="mouse"||e.pointerType==="touch")&&(o&&o({...e,type:"longpressstart"}),t.current=setTimeout(()=>{e.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),s&&s({...e,type:"longpress"}),t.current=void 0},l),e.pointerType==="touch")){let p=b=>{b.preventDefault()};u(e.target,"contextmenu",p,{once:!0}),u(window,"pointerup",()=>{setTimeout(()=>{d(e.target,"contextmenu",p)},30)},{once:!0})}},onPressEnd(e){t.current&&clearTimeout(t.current),i&&(e.pointerType==="mouse"||e.pointerType==="touch")&&i({...e,type:"longpressend"})}}),g=r.useDescription(s&&!n?a:void 0);return{longPressProps:r.mergeProps(P,g)}}exports.useLongPress=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),s=1e3;function f(r){let{keyboardDelegate:o,selectionManager:c,onTypeSelect:l}=r,t=u.useRef({search:"",timeout:null}).current,i=e=>{let a=y(e.key);if(!a||e.ctrlKey||e.metaKey||!e.currentTarget.contains(e.target))return;a===" "&&t.search.trim().length>0&&(e.preventDefault(),"continuePropagation"in e||e.stopPropagation()),t.search+=a;let n=o.getKeyForSearch(t.search,c.focusedKey);n==null&&(n=o.getKeyForSearch(t.search)),n!=null&&(c.setFocusedKey(n),l&&l(n)),clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.search=""},s)};return{typeSelectProps:{onKeyDownCapture:o.getKeyForSearch?i:null}}}function y(r){return r.length===1||!/^[A-Z]/i.test(r)?r:""}exports.useTypeSelect=f;
package/index194.mjs CHANGED
@@ -1,49 +1,29 @@
1
- import { usePress as m } from "./index189.mjs";
2
- import { useGlobalListeners as g, useDescription as b, mergeProps as L } from "@react-aria/utils";
3
- import { useRef as y } from "react";
4
- const T = 500;
5
- function E(a) {
6
- let { isDisabled: o, onLongPressStart: s, onLongPressEnd: n, onLongPress: r, threshold: c = T, accessibilityDescription: u } = a;
7
- const t = y();
8
- let { addGlobalListener: i, removeGlobalListener: l } = g(), { pressProps: d } = m({
9
- isDisabled: o,
10
- onPressStart(e) {
11
- if (e.continuePropagation(), (e.pointerType === "mouse" || e.pointerType === "touch") && (s && s({
12
- ...e,
13
- type: "longpressstart"
14
- }), t.current = setTimeout(() => {
15
- e.target.dispatchEvent(new PointerEvent("pointercancel", {
16
- bubbles: !0
17
- })), r && r({
18
- ...e,
19
- type: "longpress"
20
- }), t.current = void 0;
21
- }, c), e.pointerType === "touch")) {
22
- let p = (P) => {
23
- P.preventDefault();
24
- };
25
- i(e.target, "contextmenu", p, {
26
- once: !0
27
- }), i(window, "pointerup", () => {
28
- setTimeout(() => {
29
- l(e.target, "contextmenu", p);
30
- }, 30);
31
- }, {
32
- once: !0
33
- });
34
- }
35
- },
36
- onPressEnd(e) {
37
- t.current && clearTimeout(t.current), n && (e.pointerType === "mouse" || e.pointerType === "touch") && n({
38
- ...e,
39
- type: "longpressend"
40
- });
41
- }
42
- }), f = b(r && !o ? u : void 0);
1
+ import { useRef as u } from "react";
2
+ const s = 1e3;
3
+ function g(r) {
4
+ let { keyboardDelegate: o, selectionManager: c, onTypeSelect: l } = r, t = u({
5
+ search: "",
6
+ timeout: null
7
+ }).current, i = (e) => {
8
+ let a = f(e.key);
9
+ if (!a || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target)) return;
10
+ a === " " && t.search.trim().length > 0 && (e.preventDefault(), "continuePropagation" in e || e.stopPropagation()), t.search += a;
11
+ let n = o.getKeyForSearch(t.search, c.focusedKey);
12
+ n == null && (n = o.getKeyForSearch(t.search)), n != null && (c.setFocusedKey(n), l && l(n)), clearTimeout(t.timeout), t.timeout = setTimeout(() => {
13
+ t.search = "";
14
+ }, s);
15
+ };
43
16
  return {
44
- longPressProps: L(d, f)
17
+ typeSelectProps: {
18
+ // Using a capturing listener to catch the keydown event before
19
+ // other hooks in order to handle the Spacebar event.
20
+ onKeyDownCapture: o.getKeyForSearch ? i : null
21
+ }
45
22
  };
46
23
  }
24
+ function f(r) {
25
+ return r.length === 1 || !/^[A-Z]/i.test(r) ? r : "";
26
+ }
47
27
  export {
48
- E as useLongPress
28
+ g as useTypeSelect
49
29
  };
package/index195.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@react-aria/utils");class h{isDisabled(t){var e;return this.disabledBehavior==="all"&&(((e=t.props)===null||e===void 0?void 0:e.isDisabled)||this.disabledKeys.has(t.key))}getNextKey(t){for(t=this.collection.getKeyAfter(t);t!=null;){let e=this.collection.getItem(t);if(e.type==="item"&&!this.isDisabled(e))return t;t=this.collection.getKeyAfter(t)}return null}getPreviousKey(t){for(t=this.collection.getKeyBefore(t);t!=null;){let e=this.collection.getItem(t);if(e.type==="item"&&!this.isDisabled(e))return t;t=this.collection.getKeyBefore(t)}return null}findKey(t,e,i){let n=this.getItem(t);if(!n)return null;let l=n.getBoundingClientRect();do t=e(t),n=this.getItem(t);while(n&&i(l,n.getBoundingClientRect()));return t}isSameRow(t,e){return t.top===e.top||t.left!==e.left}isSameColumn(t,e){return t.left===e.left||t.top!==e.top}getKeyBelow(t){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(t,e=>this.getNextKey(e),this.isSameRow):this.getNextKey(t)}getKeyAbove(t){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(t,e=>this.getPreviousKey(e),this.isSameRow):this.getPreviousKey(t)}getNextColumn(t,e){return e?this.getPreviousKey(t):this.getNextKey(t)}getKeyRightOf(t){return this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(t,this.direction==="rtl"):this.findKey(t,e=>this.getNextColumn(e,this.direction==="rtl"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(t,this.direction==="rtl"):null}getKeyLeftOf(t){return this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(t,this.direction==="ltr"):this.findKey(t,e=>this.getNextColumn(e,this.direction==="ltr"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(t,this.direction==="ltr"):null}getFirstKey(){let t=this.collection.getFirstKey();for(;t!=null;){let e=this.collection.getItem(t);if((e==null?void 0:e.type)==="item"&&!this.isDisabled(e))return t;t=this.collection.getKeyAfter(t)}return null}getLastKey(){let t=this.collection.getLastKey();for(;t!=null;){let e=this.collection.getItem(t);if(e.type==="item"&&!this.isDisabled(e))return t;t=this.collection.getKeyBefore(t)}return null}getItem(t){return t!==null?this.ref.current.querySelector(`[data-key="${CSS.escape(t.toString())}"]`):null}getKeyPageAbove(t){let e=this.ref.current,i=this.getItem(t);if(!i)return null;if(!s.isScrollable(e))return this.getFirstKey();let n=e.getBoundingClientRect(),l=i.getBoundingClientRect();if(this.orientation==="horizontal"){let o=n.x-e.scrollLeft,r=Math.max(0,l.x-o+l.width-n.width);for(;i&&l.x-o>r;)t=this.getKeyAbove(t),i=t==null?null:this.getItem(t),l=i==null?void 0:i.getBoundingClientRect()}else{let o=n.y-e.scrollTop,r=Math.max(0,l.y-o+l.height-n.height);for(;i&&l.y-o>r;)t=this.getKeyAbove(t),i=t==null?null:this.getItem(t),l=i==null?void 0:i.getBoundingClientRect()}return t??this.getFirstKey()}getKeyPageBelow(t){let e=this.ref.current,i=this.getItem(t);if(!i)return null;if(!s.isScrollable(e))return this.getLastKey();let n=e.getBoundingClientRect(),l=i.getBoundingClientRect();if(this.orientation==="horizontal"){let o=n.x-e.scrollLeft,r=Math.min(e.scrollWidth,l.x-o-l.width+n.width);for(;i&&l.x-o<r;)t=this.getKeyBelow(t),i=t==null?null:this.getItem(t),l=i==null?void 0:i.getBoundingClientRect()}else{let o=n.y-e.scrollTop,r=Math.min(e.scrollHeight,l.y-o-l.height+n.height);for(;i&&l.y-o<r;)t=this.getKeyBelow(t),i=t==null?null:this.getItem(t),l=i==null?void 0:i.getBoundingClientRect()}return t??this.getLastKey()}getKeyForSearch(t,e){if(!this.collator)return null;let i=this.collection,n=e||this.getFirstKey();for(;n!=null;){let l=i.getItem(n),o=l.textValue.slice(0,t.length);if(l.textValue&&this.collator.compare(o,t)===0)return n;n=this.getKeyBelow(n)}return null}constructor(...t){if(t.length===1){let e=t[0];this.collection=e.collection,this.ref=e.ref,this.collator=e.collator,this.disabledKeys=e.disabledKeys||new Set,this.disabledBehavior=e.disabledBehavior||"all",this.orientation=e.orientation,this.direction=e.direction,this.layout=e.layout||"stack"}else this.collection=t[0],this.disabledKeys=t[1],this.ref=t[2],this.collator=t[3],this.layout="stack",this.orientation="vertical",this.disabledBehavior="all";this.layout==="stack"&&this.orientation==="vertical"&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}}exports.ListKeyboardDelegate=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@react-aria/utils");require("react");let d=null,w=new Set,u=new Map,i=!1,s=!1;function c(e,n){for(let t of w)t(e,n)}function L(e){return!(e.metaKey||!a.isMac()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function f(e){i=!0,L(e)&&(d="keyboard",c("keyboard",e))}function o(e){d="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(i=!0,c("pointer",e))}function l(e){a.isVirtualClick(e)&&(i=!0,d="virtual")}function b(e){e.target===window||e.target===document||(!i&&!s&&(d="virtual",c("virtual",e)),i=!1,s=!1)}function $(){i=!1,s=!0}function v(e){if(typeof window>"u"||u.get(a.getOwnerWindow(e)))return;const n=a.getOwnerWindow(e),t=a.getOwnerDocument(e);let r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){i=!0,r.apply(this,arguments)},t.addEventListener("keydown",f,!0),t.addEventListener("keyup",f,!0),t.addEventListener("click",l,!0),n.addEventListener("focus",b,!0),n.addEventListener("blur",$,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",o,!0),t.addEventListener("pointermove",o,!0),t.addEventListener("pointerup",o,!0)):(t.addEventListener("mousedown",o,!0),t.addEventListener("mousemove",o,!0),t.addEventListener("mouseup",o,!0)),n.addEventListener("beforeunload",()=>{p(e)},{once:!0}),u.set(n,{focus:r})}const p=(e,n)=>{const t=a.getOwnerWindow(e),r=a.getOwnerDocument(e);n&&r.removeEventListener("DOMContentLoaded",n),u.has(t)&&(t.HTMLElement.prototype.focus=u.get(t).focus,r.removeEventListener("keydown",f,!0),r.removeEventListener("keyup",f,!0),r.removeEventListener("click",l,!0),t.removeEventListener("focus",b,!0),t.removeEventListener("blur",$,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",o,!0),r.removeEventListener("pointermove",o,!0),r.removeEventListener("pointerup",o,!0)):(r.removeEventListener("mousedown",o,!0),r.removeEventListener("mousemove",o,!0),r.removeEventListener("mouseup",o,!0)),u.delete(t))};function E(e){const n=a.getOwnerDocument(e);let t;return n.readyState!=="loading"?v(e):(t=()=>{v(e)},n.addEventListener("DOMContentLoaded",t)),()=>p(e,t)}typeof document<"u"&&E();function m(){return d}exports.addWindowFocusTracking=E;exports.getInteractionModality=m;exports.hasSetupGlobalListeners=u;
package/index195.mjs CHANGED
@@ -1,127 +1,58 @@
1
- import { isScrollable as s } from "@react-aria/utils";
2
- class a {
3
- isDisabled(t) {
4
- var e;
5
- return this.disabledBehavior === "all" && (((e = t.props) === null || e === void 0 ? void 0 : e.isDisabled) || this.disabledKeys.has(t.key));
6
- }
7
- getNextKey(t) {
8
- for (t = this.collection.getKeyAfter(t); t != null; ) {
9
- let e = this.collection.getItem(t);
10
- if (e.type === "item" && !this.isDisabled(e)) return t;
11
- t = this.collection.getKeyAfter(t);
12
- }
13
- return null;
14
- }
15
- getPreviousKey(t) {
16
- for (t = this.collection.getKeyBefore(t); t != null; ) {
17
- let e = this.collection.getItem(t);
18
- if (e.type === "item" && !this.isDisabled(e)) return t;
19
- t = this.collection.getKeyBefore(t);
20
- }
21
- return null;
22
- }
23
- findKey(t, e, i) {
24
- let n = this.getItem(t);
25
- if (!n) return null;
26
- let l = n.getBoundingClientRect();
27
- do
28
- t = e(t), n = this.getItem(t);
29
- while (n && i(l, n.getBoundingClientRect()));
30
- return t;
31
- }
32
- isSameRow(t, e) {
33
- return t.top === e.top || t.left !== e.left;
34
- }
35
- isSameColumn(t, e) {
36
- return t.left === e.left || t.top !== e.top;
37
- }
38
- getKeyBelow(t) {
39
- return this.layout === "grid" && this.orientation === "vertical" ? this.findKey(t, (e) => this.getNextKey(e), this.isSameRow) : this.getNextKey(t);
40
- }
41
- getKeyAbove(t) {
42
- return this.layout === "grid" && this.orientation === "vertical" ? this.findKey(t, (e) => this.getPreviousKey(e), this.isSameRow) : this.getPreviousKey(t);
43
- }
44
- getNextColumn(t, e) {
45
- return e ? this.getPreviousKey(t) : this.getNextKey(t);
46
- }
47
- getKeyRightOf(t) {
48
- return this.layout === "grid" ? this.orientation === "vertical" ? this.getNextColumn(t, this.direction === "rtl") : this.findKey(t, (e) => this.getNextColumn(e, this.direction === "rtl"), this.isSameColumn) : this.orientation === "horizontal" ? this.getNextColumn(t, this.direction === "rtl") : null;
49
- }
50
- getKeyLeftOf(t) {
51
- return this.layout === "grid" ? this.orientation === "vertical" ? this.getNextColumn(t, this.direction === "ltr") : this.findKey(t, (e) => this.getNextColumn(e, this.direction === "ltr"), this.isSameColumn) : this.orientation === "horizontal" ? this.getNextColumn(t, this.direction === "ltr") : null;
52
- }
53
- getFirstKey() {
54
- let t = this.collection.getFirstKey();
55
- for (; t != null; ) {
56
- let e = this.collection.getItem(t);
57
- if ((e == null ? void 0 : e.type) === "item" && !this.isDisabled(e)) return t;
58
- t = this.collection.getKeyAfter(t);
59
- }
60
- return null;
61
- }
62
- getLastKey() {
63
- let t = this.collection.getLastKey();
64
- for (; t != null; ) {
65
- let e = this.collection.getItem(t);
66
- if (e.type === "item" && !this.isDisabled(e)) return t;
67
- t = this.collection.getKeyBefore(t);
68
- }
69
- return null;
70
- }
71
- getItem(t) {
72
- return t !== null ? this.ref.current.querySelector(`[data-key="${CSS.escape(t.toString())}"]`) : null;
73
- }
74
- getKeyPageAbove(t) {
75
- let e = this.ref.current, i = this.getItem(t);
76
- if (!i) return null;
77
- if (!s(e)) return this.getFirstKey();
78
- let n = e.getBoundingClientRect(), l = i.getBoundingClientRect();
79
- if (this.orientation === "horizontal") {
80
- let o = n.x - e.scrollLeft, r = Math.max(0, l.x - o + l.width - n.width);
81
- for (; i && l.x - o > r; )
82
- t = this.getKeyAbove(t), i = t == null ? null : this.getItem(t), l = i == null ? void 0 : i.getBoundingClientRect();
83
- } else {
84
- let o = n.y - e.scrollTop, r = Math.max(0, l.y - o + l.height - n.height);
85
- for (; i && l.y - o > r; )
86
- t = this.getKeyAbove(t), i = t == null ? null : this.getItem(t), l = i == null ? void 0 : i.getBoundingClientRect();
87
- }
88
- return t ?? this.getFirstKey();
89
- }
90
- getKeyPageBelow(t) {
91
- let e = this.ref.current, i = this.getItem(t);
92
- if (!i) return null;
93
- if (!s(e)) return this.getLastKey();
94
- let n = e.getBoundingClientRect(), l = i.getBoundingClientRect();
95
- if (this.orientation === "horizontal") {
96
- let o = n.x - e.scrollLeft, r = Math.min(e.scrollWidth, l.x - o - l.width + n.width);
97
- for (; i && l.x - o < r; )
98
- t = this.getKeyBelow(t), i = t == null ? null : this.getItem(t), l = i == null ? void 0 : i.getBoundingClientRect();
99
- } else {
100
- let o = n.y - e.scrollTop, r = Math.min(e.scrollHeight, l.y - o - l.height + n.height);
101
- for (; i && l.y - o < r; )
102
- t = this.getKeyBelow(t), i = t == null ? null : this.getItem(t), l = i == null ? void 0 : i.getBoundingClientRect();
103
- }
104
- return t ?? this.getLastKey();
105
- }
106
- getKeyForSearch(t, e) {
107
- if (!this.collator) return null;
108
- let i = this.collection, n = e || this.getFirstKey();
109
- for (; n != null; ) {
110
- let l = i.getItem(n), o = l.textValue.slice(0, t.length);
111
- if (l.textValue && this.collator.compare(o, t) === 0) return n;
112
- n = this.getKeyBelow(n);
113
- }
114
- return null;
115
- }
116
- constructor(...t) {
117
- if (t.length === 1) {
118
- let e = t[0];
119
- this.collection = e.collection, this.ref = e.ref, this.collator = e.collator, this.disabledKeys = e.disabledKeys || /* @__PURE__ */ new Set(), this.disabledBehavior = e.disabledBehavior || "all", this.orientation = e.orientation, this.direction = e.direction, this.layout = e.layout || "stack";
120
- } else
121
- this.collection = t[0], this.disabledKeys = t[1], this.ref = t[2], this.collator = t[3], this.layout = "stack", this.orientation = "vertical", this.disabledBehavior = "all";
122
- this.layout === "stack" && this.orientation === "vertical" && (this.getKeyLeftOf = void 0, this.getKeyRightOf = void 0);
123
- }
1
+ import { getOwnerDocument as c, getOwnerWindow as d, isVirtualClick as L, isMac as m } from "@react-aria/utils";
2
+ import "react";
3
+ let u = null, y = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = !1, s = !1;
4
+ function v(e, n) {
5
+ for (let t of y) t(e, n);
6
+ }
7
+ function w(e) {
8
+ return !(e.metaKey || !m() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
9
+ }
10
+ function f(e) {
11
+ a = !0, w(e) && (u = "keyboard", v("keyboard", e));
12
+ }
13
+ function o(e) {
14
+ u = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (a = !0, v("pointer", e));
15
+ }
16
+ function $(e) {
17
+ L(e) && (a = !0, u = "virtual");
18
+ }
19
+ function b(e) {
20
+ e.target === window || e.target === document || (!a && !s && (u = "virtual", v("virtual", e)), a = !1, s = !1);
21
+ }
22
+ function p() {
23
+ a = !1, s = !0;
24
+ }
25
+ function l(e) {
26
+ if (typeof window > "u" || i.get(d(e))) return;
27
+ const n = d(e), t = c(e);
28
+ let r = n.HTMLElement.prototype.focus;
29
+ n.HTMLElement.prototype.focus = function() {
30
+ a = !0, r.apply(this, arguments);
31
+ }, t.addEventListener("keydown", f, !0), t.addEventListener("keyup", f, !0), t.addEventListener("click", $, !0), n.addEventListener("focus", b, !0), n.addEventListener("blur", p, !1), typeof PointerEvent < "u" ? (t.addEventListener("pointerdown", o, !0), t.addEventListener("pointermove", o, !0), t.addEventListener("pointerup", o, !0)) : (t.addEventListener("mousedown", o, !0), t.addEventListener("mousemove", o, !0), t.addEventListener("mouseup", o, !0)), n.addEventListener("beforeunload", () => {
32
+ E(e);
33
+ }, {
34
+ once: !0
35
+ }), i.set(n, {
36
+ focus: r
37
+ });
38
+ }
39
+ const E = (e, n) => {
40
+ const t = d(e), r = c(e);
41
+ n && r.removeEventListener("DOMContentLoaded", n), i.has(t) && (t.HTMLElement.prototype.focus = i.get(t).focus, r.removeEventListener("keydown", f, !0), r.removeEventListener("keyup", f, !0), r.removeEventListener("click", $, !0), t.removeEventListener("focus", b, !0), t.removeEventListener("blur", p, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", o, !0), r.removeEventListener("pointermove", o, !0), r.removeEventListener("pointerup", o, !0)) : (r.removeEventListener("mousedown", o, !0), r.removeEventListener("mousemove", o, !0), r.removeEventListener("mouseup", o, !0)), i.delete(t));
42
+ };
43
+ function g(e) {
44
+ const n = c(e);
45
+ let t;
46
+ return n.readyState !== "loading" ? l(e) : (t = () => {
47
+ l(e);
48
+ }, n.addEventListener("DOMContentLoaded", t)), () => E(e, t);
49
+ }
50
+ typeof document < "u" && g();
51
+ function M() {
52
+ return u;
124
53
  }
125
54
  export {
126
- a as ListKeyboardDelegate
55
+ g as addWindowFocusTracking,
56
+ M as getInteractionModality,
57
+ i as hasSetupGlobalListeners
127
58
  };
package/index196.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=new WeakMap;function f(a,e,r){return typeof e=="string"&&(e=e.replace(/\s+/g,"")),`${t.get(a)}-${r}-${e}`}exports.generateId=f;exports.tabsIds=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index191.js"),r=require("@react-aria/utils"),L=require("react"),m=500;function y(c){let{isDisabled:n,onLongPressStart:o,onLongPressEnd:i,onLongPress:s,threshold:l=m,accessibilityDescription:a}=c;const t=L.useRef(void 0);let{addGlobalListener:u,removeGlobalListener:d}=r.useGlobalListeners(),{pressProps:P}=f.usePress({isDisabled:n,onPressStart(e){if(e.continuePropagation(),(e.pointerType==="mouse"||e.pointerType==="touch")&&(o&&o({...e,type:"longpressstart"}),t.current=setTimeout(()=>{e.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),s&&s({...e,type:"longpress"}),t.current=void 0},l),e.pointerType==="touch")){let p=b=>{b.preventDefault()};u(e.target,"contextmenu",p,{once:!0}),u(window,"pointerup",()=>{setTimeout(()=>{d(e.target,"contextmenu",p)},30)},{once:!0})}},onPressEnd(e){t.current&&clearTimeout(t.current),i&&(e.pointerType==="mouse"||e.pointerType==="touch")&&i({...e,type:"longpressend"})}}),g=r.useDescription(s&&!n?a:void 0);return{longPressProps:r.mergeProps(P,g)}}exports.useLongPress=y;