@okam/stack-ui 1.44.0 → 1.44.3

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 (347) hide show
  1. package/CHANGELOG.md +82 -4
  2. package/components/Popover/interface.d.ts +3 -3
  3. package/components/TagGroup/interface.d.ts +2 -2
  4. package/index.d.ts +2 -0
  5. package/index149.js +1 -1
  6. package/index149.mjs +4 -4
  7. package/index155.js +1 -1
  8. package/index155.mjs +4 -4
  9. package/index157.js +1 -1
  10. package/index157.mjs +4 -4
  11. package/index158.js +1 -1
  12. package/index158.mjs +2 -2
  13. package/index159.js +1 -1
  14. package/index159.mjs +1 -1
  15. package/index160.js +1 -1
  16. package/index160.mjs +1 -1
  17. package/index161.js +1 -2
  18. package/index161.mjs +39 -12
  19. package/index162.js +1 -1
  20. package/index162.mjs +12 -38
  21. package/index163.js +2 -1
  22. package/index163.mjs +26 -11
  23. package/index164.js +2 -1
  24. package/index164.mjs +38 -13
  25. package/index165.js +1 -1
  26. package/index165.mjs +21 -38
  27. package/index166.js +1 -2
  28. package/index166.mjs +44 -24
  29. package/index167.js +1 -1
  30. package/index167.mjs +25 -22
  31. package/index168.js +1 -1
  32. package/index168.mjs +40 -45
  33. package/index169.js +2 -1
  34. package/index169.mjs +57 -25
  35. package/index170.js +1 -1
  36. package/index170.mjs +39 -41
  37. package/index171.js +1 -2
  38. package/index171.mjs +30 -57
  39. package/index172.js +2 -1
  40. package/index172.mjs +8 -38
  41. package/index173.js +2 -1
  42. package/index173.mjs +9 -30
  43. package/index174.js +1 -2
  44. package/index174.mjs +32 -9
  45. package/index175.js +1 -2
  46. package/index175.mjs +14 -9
  47. package/index176.js +1 -1
  48. package/index176.mjs +16 -31
  49. package/index177.js +1 -1
  50. package/index177.mjs +11 -15
  51. package/index178.js +2 -1
  52. package/index178.mjs +47 -16
  53. package/index179.js +1 -2
  54. package/index179.mjs +36 -46
  55. package/index180.js +1 -1
  56. package/index180.mjs +31 -36
  57. package/index181.js +1 -1
  58. package/index181.mjs +20 -31
  59. package/index182.js +1 -1
  60. package/index182.mjs +32 -18
  61. package/index183.js +1 -1
  62. package/index183.mjs +14 -36
  63. package/index185.js +1 -1
  64. package/index185.mjs +3 -3
  65. package/index186.js +1 -1
  66. package/index186.mjs +23 -23
  67. package/index188.js +1 -1
  68. package/index188.mjs +5 -2025
  69. package/index189.js +2 -1
  70. package/index189.mjs +48 -58
  71. package/index190.js +1 -1
  72. package/index190.mjs +2010 -174
  73. package/index191.js +1 -1
  74. package/index191.mjs +59 -5
  75. package/index192.js +1 -2
  76. package/index192.mjs +186 -47
  77. package/index193.js +1 -1
  78. package/index193.mjs +203 -11
  79. package/index194.js +1 -1
  80. package/index194.mjs +51 -190
  81. package/index195.js +1 -1
  82. package/index195.mjs +130 -51
  83. package/index196.js +1 -1
  84. package/index196.mjs +111 -130
  85. package/index197.js +1 -1
  86. package/index197.mjs +205 -105
  87. package/index198.js +1 -1
  88. package/index198.mjs +169 -203
  89. package/index199.js +1 -1
  90. package/index199.mjs +61 -182
  91. package/index2.mjs +35 -35
  92. package/index200.js +1 -1
  93. package/index200.mjs +270 -60
  94. package/index201.js +1 -1
  95. package/index201.mjs +89 -270
  96. package/index202.js +1 -1
  97. package/index202.mjs +182 -92
  98. package/index203.js +1 -1
  99. package/index203.mjs +78 -182
  100. package/index204.js +1 -1
  101. package/index204.mjs +49 -75
  102. package/index205.js +1 -1
  103. package/index205.mjs +117 -49
  104. package/index206.js +1 -1
  105. package/index206.mjs +108 -118
  106. package/index207.js +1 -1
  107. package/index207.mjs +112 -106
  108. package/index208.js +1 -1
  109. package/index208.mjs +63 -113
  110. package/index209.js +1 -1
  111. package/index209.mjs +108 -70
  112. package/index210.js +1 -1
  113. package/index210.mjs +50 -108
  114. package/index211.js +1 -1
  115. package/index211.mjs +75 -34
  116. package/index212.js +1 -1
  117. package/index212.mjs +48 -71
  118. package/index213.js +1 -1
  119. package/index213.mjs +43 -57
  120. package/index214.js +1 -1
  121. package/index214.mjs +86 -43
  122. package/index215.js +5 -1
  123. package/index215.mjs +62 -81
  124. package/index216.js +1 -5
  125. package/index216.mjs +11 -80
  126. package/index217.js +1 -1
  127. package/index217.mjs +119 -125
  128. package/index218.js +1 -1
  129. package/index218.mjs +129 -185
  130. package/index219.js +1 -1
  131. package/index219.mjs +72 -121
  132. package/index220.js +1 -1
  133. package/index220.mjs +12 -132
  134. package/index221.js +1 -1
  135. package/index221.mjs +89 -69
  136. package/index222.js +1 -1
  137. package/index222.mjs +104 -12
  138. package/index223.js +1 -1
  139. package/index223.mjs +4 -95
  140. package/index224.js +1 -1
  141. package/index224.mjs +3 -106
  142. package/index225.js +1 -1
  143. package/index225.mjs +125 -4
  144. package/index226.js +1 -1
  145. package/index226.mjs +29 -3
  146. package/index227.js +1 -1
  147. package/index227.mjs +39 -113
  148. package/index228.js +1 -1
  149. package/index228.mjs +34 -19
  150. package/index229.js +1 -1
  151. package/index229.mjs +26 -40
  152. package/index230.js +1 -1
  153. package/index230.mjs +98 -29
  154. package/index231.js +1 -1
  155. package/index231.mjs +68 -28
  156. package/index232.js +1 -1
  157. package/index232.mjs +78 -90
  158. package/index233.js +1 -1
  159. package/index233.mjs +98 -78
  160. package/index234.js +1 -1
  161. package/index234.mjs +125 -96
  162. package/index235.js +1 -1
  163. package/index235.mjs +191 -98
  164. package/index236.js +1 -1
  165. package/index236.mjs +4 -126
  166. package/index237.js +1 -1
  167. package/index237.mjs +20 -67
  168. package/index238.js +1 -7
  169. package/index238.mjs +39 -431
  170. package/index239.js +1 -1
  171. package/index239.mjs +4 -57
  172. package/index240.js +1 -1
  173. package/index240.mjs +24 -3
  174. package/index241.js +1 -1
  175. package/index241.mjs +12 -25
  176. package/index242.js +1 -1
  177. package/index242.mjs +4 -47
  178. package/index243.js +1 -1
  179. package/index243.mjs +14 -5
  180. package/index244.js +1 -1
  181. package/index244.mjs +40 -22
  182. package/index245.js +1 -1
  183. package/index245.mjs +57 -11
  184. package/index246.js +1 -1
  185. package/index246.mjs +43 -4
  186. package/index247.js +1 -1
  187. package/index247.mjs +31 -13
  188. package/index248.js +1 -1
  189. package/index248.mjs +31 -42
  190. package/index249.js +1 -1
  191. package/index249.mjs +13 -57
  192. package/index250.js +1 -1
  193. package/index250.mjs +10 -43
  194. package/index251.js +1 -1
  195. package/index251.mjs +28 -31
  196. package/index252.js +1 -1
  197. package/index252.mjs +14 -30
  198. package/index253.js +1 -1
  199. package/index253.mjs +9 -14
  200. package/index254.js +1 -1
  201. package/index254.mjs +6 -10
  202. package/index255.js +1 -1
  203. package/index255.mjs +5 -29
  204. package/index256.js +1 -1
  205. package/index256.mjs +7 -15
  206. package/index257.js +1 -1
  207. package/index257.mjs +29 -9
  208. package/index258.js +1 -1
  209. package/index258.mjs +17 -6
  210. package/index259.js +1 -1
  211. package/index259.mjs +44 -5
  212. package/index260.js +1 -1
  213. package/index260.mjs +8 -7
  214. package/index261.js +1 -1
  215. package/index261.mjs +13 -26
  216. package/index262.js +1 -1
  217. package/index262.mjs +3 -18
  218. package/index263.js +1 -1
  219. package/index263.mjs +18 -43
  220. package/index264.js +1 -1
  221. package/index264.mjs +33 -7
  222. package/index265.js +1 -1
  223. package/index265.mjs +22 -16
  224. package/index266.js +1 -1
  225. package/index266.mjs +10 -3
  226. package/index267.js +1 -1
  227. package/index267.mjs +2 -18
  228. package/index268.js +1 -1
  229. package/index268.mjs +36 -34
  230. package/index269.js +1 -1
  231. package/index269.mjs +5 -22
  232. package/index270.js +1 -1
  233. package/index270.mjs +28 -53
  234. package/index271.js +1 -1
  235. package/index271.mjs +6 -27
  236. package/index272.js +1 -1
  237. package/index272.mjs +9 -144
  238. package/index273.js +1 -1
  239. package/index273.mjs +127 -207
  240. package/index274.js +1 -1
  241. package/index274.mjs +43 -22
  242. package/index275.js +1 -1
  243. package/index275.mjs +226 -44
  244. package/index276.js +1 -1
  245. package/index276.mjs +121 -42
  246. package/index277.js +1 -6
  247. package/index277.mjs +64 -105
  248. package/index278.js +7 -1
  249. package/index278.mjs +440 -72
  250. package/index279.js +1 -1
  251. package/index279.mjs +56 -72
  252. package/index28.js +1 -1
  253. package/index28.mjs +38 -94
  254. package/index280.js +1 -1
  255. package/index280.mjs +54 -7
  256. package/index281.js +1 -1
  257. package/index281.mjs +27 -11
  258. package/index282.js +1 -1
  259. package/index282.mjs +31 -9
  260. package/index283.js +1 -1
  261. package/index283.mjs +136 -125
  262. package/index284.js +1 -1
  263. package/index284.mjs +209 -39
  264. package/index285.js +1 -1
  265. package/index285.mjs +19 -228
  266. package/index286.js +1 -1
  267. package/index286.mjs +46 -28
  268. package/index287.js +1 -1
  269. package/index287.mjs +45 -8
  270. package/index288.js +6 -1
  271. package/index288.mjs +113 -3
  272. package/index289.js +1 -1
  273. package/index289.mjs +72 -37
  274. package/index29.js +1 -1
  275. package/index29.mjs +2 -2
  276. package/index290.js +1 -1
  277. package/index290.mjs +74 -5
  278. package/index291.js +1 -1
  279. package/index291.mjs +7 -29
  280. package/index292.js +1 -1
  281. package/index292.mjs +11 -6
  282. package/index30.js +1 -1
  283. package/index30.mjs +1 -1
  284. package/index329.js +1 -1
  285. package/index329.mjs +17 -59
  286. package/index33.js +1 -1
  287. package/index33.mjs +2 -2
  288. package/index330.js +1 -1
  289. package/index330.mjs +30 -7
  290. package/index331.js +1 -1
  291. package/index331.mjs +63 -27
  292. package/index332.js +1 -1
  293. package/index332.mjs +15 -87
  294. package/index333.js +1 -1
  295. package/index333.mjs +48 -7
  296. package/index334.js +1 -1
  297. package/index334.mjs +7 -26
  298. package/index335.js +1 -1
  299. package/index335.mjs +26 -32
  300. package/index336.js +1 -1
  301. package/index336.mjs +87 -6
  302. package/index337.js +1 -1
  303. package/index337.mjs +9 -6
  304. package/index338.js +1 -1
  305. package/index338.mjs +23 -48
  306. package/index339.js +1 -1
  307. package/index339.mjs +32 -28
  308. package/index34.js +1 -1
  309. package/index34.mjs +3 -3
  310. package/index340.js +1 -1
  311. package/index340.mjs +6 -15
  312. package/index341.js +1 -1
  313. package/index341.mjs +6 -21
  314. package/index342.js +1 -1
  315. package/index342.mjs +28 -28
  316. package/index345.js +1 -1
  317. package/index345.mjs +1 -1
  318. package/index35.js +1 -1
  319. package/index35.mjs +1 -1
  320. package/index36.js +1 -1
  321. package/index36.mjs +2 -2
  322. package/index38.js +1 -1
  323. package/index38.mjs +3 -3
  324. package/index39.js +1 -1
  325. package/index39.mjs +3 -3
  326. package/index40.js +1 -1
  327. package/index40.mjs +3 -3
  328. package/index42.js +1 -1
  329. package/index42.mjs +1 -1
  330. package/index44.js +1 -1
  331. package/index44.mjs +2 -2
  332. package/index45.js +1 -1
  333. package/index45.mjs +1 -1
  334. package/index48.js +1 -1
  335. package/index48.mjs +2 -2
  336. package/index52.js +1 -1
  337. package/index52.mjs +1 -1
  338. package/index54.js +1 -1
  339. package/index54.mjs +3 -3
  340. package/index56.js +1 -1
  341. package/index56.mjs +2 -2
  342. package/index57.js +1 -1
  343. package/index57.mjs +1 -1
  344. package/index59.js +1 -1
  345. package/index59.mjs +2 -2
  346. package/logger.d.ts +2 -2
  347. package/package.json +2 -2
package/index275.mjs CHANGED
@@ -1,52 +1,234 @@
1
- import { isElementInChildOfActiveScope as g } from "@react-aria/focus";
2
- import { useEffect as m } from "react";
3
- import { useFocusWithin as v } from "./index270.mjs";
4
- import { useInteractOutside as b } from "./index276.mjs";
5
- const t = [];
6
- function C(a, i) {
7
- let { onClose: o, shouldCloseOnBlur: l, isOpen: n, isDismissable: d = !1, isKeyboardDismissDisabled: u = !1, shouldCloseOnInteractOutside: s } = a;
8
- m(() => {
9
- if (n && !t.includes(i))
10
- return t.push(i), () => {
11
- let e = t.indexOf(i);
12
- e >= 0 && t.splice(e, 1);
13
- };
1
+ import { getItemElement as B, useCollectionId as ue, isNonContiguousSelectionModifier as H } from "./index329.mjs";
2
+ import { useTypeSelect as fe } from "./index330.mjs";
3
+ import { getActiveElement as se } from "./index240.mjs";
4
+ import { mergeProps as q } from "./index158.mjs";
5
+ import { focusWithoutScrolling as G } from "./index244.mjs";
6
+ import { useRouter as ae } from "./index245.mjs";
7
+ import { useUpdateLayoutEffect as j } from "./index250.mjs";
8
+ import { useEvent as S } from "./index258.mjs";
9
+ import { scrollIntoView as de, scrollIntoViewport as J } from "./index259.mjs";
10
+ import { FOCUS_EVENT as ve, CLEAR_FOCUS_EVENT as pe } from "./index262.mjs";
11
+ import { isCtrlKeyPressed as F } from "./index263.mjs";
12
+ import { isTabbable as be } from "./index264.mjs";
13
+ import { moveVirtualFocus as me, dispatchVirtualFocus as ye, getFocusableTreeWalker as $e } from "@react-aria/focus";
14
+ import { flushSync as Ke } from "react-dom";
15
+ import { useRef as m, useEffect as C } from "react";
16
+ import { getInteractionModality as Q } from "./index331.mjs";
17
+ import { focusSafely as X } from "./index332.mjs";
18
+ import { useLocale as Fe } from "@react-aria/i18n";
19
+ function Ue(Y) {
20
+ let { selectionManager: e, keyboardDelegate: o, ref: i, autoFocus: w = !1, shouldFocusWrap: x = !1, disallowEmptySelection: Z = !1, disallowSelectAll: g = !1, escapeKeyBehavior: _ = "clearSelection", selectOnFocus: y = e.selectionBehavior === "replace", disallowTypeAhead: ee = !1, shouldUseVirtualFocus: b, allowsTabNavigation: le = !1, isVirtualized: N, scrollRef: s = i, linkBehavior: U = "action" } = Y, { direction: T } = Fe(), oe = ae(), te = (l) => {
21
+ var r;
22
+ if (l.altKey && l.key === "Tab" && l.preventDefault(), !(!((r = i.current) === null || r === void 0) && r.contains(l.target))) return;
23
+ const c = (t, v) => {
24
+ if (t != null) {
25
+ if (e.isLink(t) && U === "selection" && y && !H(l)) {
26
+ Ke(() => {
27
+ e.setFocusedKey(t, v);
28
+ });
29
+ let p = B(i, t), W = e.getItemProps(t);
30
+ p && oe.open(p, l, W.href, W.routerOptions);
31
+ return;
32
+ }
33
+ if (e.setFocusedKey(t, v), e.isLink(t) && U === "override") return;
34
+ l.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(t) : y && !H(l) && e.replaceSelection(t);
35
+ }
36
+ };
37
+ switch (l.key) {
38
+ case "ArrowDown":
39
+ if (o.getKeyBelow) {
40
+ var n, f, u;
41
+ let t = e.focusedKey != null ? (n = o.getKeyBelow) === null || n === void 0 ? void 0 : n.call(o, e.focusedKey) : (f = o.getFirstKey) === null || f === void 0 ? void 0 : f.call(o);
42
+ t == null && x && (t = (u = o.getFirstKey) === null || u === void 0 ? void 0 : u.call(o, e.focusedKey)), t != null && (l.preventDefault(), c(t));
43
+ }
44
+ break;
45
+ case "ArrowUp":
46
+ if (o.getKeyAbove) {
47
+ var a, d, A;
48
+ let t = e.focusedKey != null ? (a = o.getKeyAbove) === null || a === void 0 ? void 0 : a.call(o, e.focusedKey) : (d = o.getLastKey) === null || d === void 0 ? void 0 : d.call(o);
49
+ t == null && x && (t = (A = o.getLastKey) === null || A === void 0 ? void 0 : A.call(o, e.focusedKey)), t != null && (l.preventDefault(), c(t));
50
+ }
51
+ break;
52
+ case "ArrowLeft":
53
+ if (o.getKeyLeftOf) {
54
+ var k, I, M;
55
+ let t = e.focusedKey != null ? (k = o.getKeyLeftOf) === null || k === void 0 ? void 0 : k.call(o, e.focusedKey) : null;
56
+ t == null && x && (t = T === "rtl" ? (I = o.getFirstKey) === null || I === void 0 ? void 0 : I.call(o, e.focusedKey) : (M = o.getLastKey) === null || M === void 0 ? void 0 : M.call(o, e.focusedKey)), t != null && (l.preventDefault(), c(t, T === "rtl" ? "first" : "last"));
57
+ }
58
+ break;
59
+ case "ArrowRight":
60
+ if (o.getKeyRightOf) {
61
+ var R, V, O;
62
+ let t = e.focusedKey != null ? (R = o.getKeyRightOf) === null || R === void 0 ? void 0 : R.call(o, e.focusedKey) : null;
63
+ t == null && x && (t = T === "rtl" ? (V = o.getLastKey) === null || V === void 0 ? void 0 : V.call(o, e.focusedKey) : (O = o.getFirstKey) === null || O === void 0 ? void 0 : O.call(o, e.focusedKey)), t != null && (l.preventDefault(), c(t, T === "rtl" ? "last" : "first"));
64
+ }
65
+ break;
66
+ case "Home":
67
+ if (o.getFirstKey) {
68
+ if (e.focusedKey === null && l.shiftKey) return;
69
+ l.preventDefault();
70
+ let t = o.getFirstKey(e.focusedKey, F(l));
71
+ e.setFocusedKey(t), t != null && (F(l) && l.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(t) : y && e.replaceSelection(t));
72
+ }
73
+ break;
74
+ case "End":
75
+ if (o.getLastKey) {
76
+ if (e.focusedKey === null && l.shiftKey) return;
77
+ l.preventDefault();
78
+ let t = o.getLastKey(e.focusedKey, F(l));
79
+ e.setFocusedKey(t), t != null && (F(l) && l.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(t) : y && e.replaceSelection(t));
80
+ }
81
+ break;
82
+ case "PageDown":
83
+ if (o.getKeyPageBelow && e.focusedKey != null) {
84
+ let t = o.getKeyPageBelow(e.focusedKey);
85
+ t != null && (l.preventDefault(), c(t));
86
+ }
87
+ break;
88
+ case "PageUp":
89
+ if (o.getKeyPageAbove && e.focusedKey != null) {
90
+ let t = o.getKeyPageAbove(e.focusedKey);
91
+ t != null && (l.preventDefault(), c(t));
92
+ }
93
+ break;
94
+ case "a":
95
+ F(l) && e.selectionMode === "multiple" && g !== !0 && (l.preventDefault(), e.selectAll());
96
+ break;
97
+ case "Escape":
98
+ _ === "clearSelection" && !Z && e.selectedKeys.size !== 0 && (l.stopPropagation(), l.preventDefault(), e.clearSelection());
99
+ break;
100
+ case "Tab":
101
+ if (!le) {
102
+ if (l.shiftKey) i.current.focus();
103
+ else {
104
+ let t = $e(i.current, {
105
+ tabbable: !0
106
+ }), v, p;
107
+ do
108
+ p = t.lastChild(), p && (v = p);
109
+ while (p);
110
+ v && (!v.contains(document.activeElement) || document.activeElement && !be(document.activeElement)) && G(v);
111
+ }
112
+ break;
113
+ }
114
+ }
115
+ }, E = m({
116
+ top: 0,
117
+ left: 0
118
+ });
119
+ S(s, "scroll", N ? void 0 : () => {
120
+ var l, r, c, n;
121
+ E.current = {
122
+ top: (c = (l = s.current) === null || l === void 0 ? void 0 : l.scrollTop) !== null && c !== void 0 ? c : 0,
123
+ left: (n = (r = s.current) === null || r === void 0 ? void 0 : r.scrollLeft) !== null && n !== void 0 ? n : 0
124
+ };
125
+ });
126
+ let re = (l) => {
127
+ if (e.isFocused) {
128
+ l.currentTarget.contains(l.target) || e.setFocused(!1);
129
+ return;
130
+ }
131
+ if (l.currentTarget.contains(l.target)) {
132
+ if (e.setFocused(!0), e.focusedKey == null) {
133
+ var r, c;
134
+ let u = (d) => {
135
+ d != null && (e.setFocusedKey(d), y && !e.isSelected(d) && e.replaceSelection(d));
136
+ }, a = l.relatedTarget;
137
+ var n, f;
138
+ a && l.currentTarget.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_FOLLOWING ? u((n = e.lastSelectedKey) !== null && n !== void 0 ? n : (r = o.getLastKey) === null || r === void 0 ? void 0 : r.call(o)) : u((f = e.firstSelectedKey) !== null && f !== void 0 ? f : (c = o.getFirstKey) === null || c === void 0 ? void 0 : c.call(o));
139
+ } else !N && s.current && (s.current.scrollTop = E.current.top, s.current.scrollLeft = E.current.left);
140
+ if (e.focusedKey != null && s.current) {
141
+ let u = B(i, e.focusedKey);
142
+ u instanceof HTMLElement && (!u.contains(document.activeElement) && !b && G(u), Q() === "keyboard" && J(u, {
143
+ containingElement: i.current
144
+ }));
145
+ }
146
+ }
147
+ }, ce = (l) => {
148
+ l.currentTarget.contains(l.relatedTarget) || e.setFocused(!1);
149
+ }, $ = m(!1);
150
+ S(i, ve, b ? (l) => {
151
+ let { detail: r } = l;
152
+ l.stopPropagation(), e.setFocused(!0), (r == null ? void 0 : r.focusStrategy) === "first" && ($.current = !0);
153
+ } : void 0), j(() => {
154
+ if ($.current) {
155
+ var l, r;
156
+ let c = (r = (l = o.getFirstKey) === null || l === void 0 ? void 0 : l.call(o)) !== null && r !== void 0 ? r : null;
157
+ if (c == null) {
158
+ let n = se();
159
+ me(i.current), ye(n, null), e.collection.size > 0 && ($.current = !1);
160
+ } else
161
+ e.setFocusedKey(c), $.current = !1;
162
+ }
14
163
  }, [
15
- n,
16
- i
17
- ]);
18
- let r = () => {
19
- t[t.length - 1] === i && o && o();
20
- }, f = (e) => {
21
- (!s || s(e.target)) && t[t.length - 1] === i && (e.stopPropagation(), e.preventDefault());
22
- }, p = (e) => {
23
- (!s || s(e.target)) && (t[t.length - 1] === i && (e.stopPropagation(), e.preventDefault()), r());
24
- }, c = (e) => {
25
- e.key === "Escape" && !u && !e.nativeEvent.isComposing && (e.stopPropagation(), e.preventDefault(), r());
26
- };
27
- b({
28
- ref: i,
29
- onInteractOutside: d && n ? p : void 0,
30
- onInteractOutsideStart: f
164
+ e.collection
165
+ ]), j(() => {
166
+ e.collection.size > 0 && ($.current = !1);
167
+ }, [
168
+ e.focusedKey
169
+ ]), S(i, pe, b ? (l) => {
170
+ var r;
171
+ l.stopPropagation(), e.setFocused(!1), !((r = l.detail) === null || r === void 0) && r.clearFocusKey && e.setFocusedKey(null);
172
+ } : void 0);
173
+ const z = m(w), h = m(!1);
174
+ C(() => {
175
+ if (z.current) {
176
+ var l, r;
177
+ let f = null;
178
+ var c;
179
+ w === "first" && (f = (c = (l = o.getFirstKey) === null || l === void 0 ? void 0 : l.call(o)) !== null && c !== void 0 ? c : null);
180
+ var n;
181
+ w === "last" && (f = (n = (r = o.getLastKey) === null || r === void 0 ? void 0 : r.call(o)) !== null && n !== void 0 ? n : null);
182
+ let u = e.selectedKeys;
183
+ if (u.size) {
184
+ for (let a of u) if (e.canSelectItem(a)) {
185
+ f = a;
186
+ break;
187
+ }
188
+ }
189
+ e.setFocused(!0), e.setFocusedKey(f), f == null && !b && i.current && X(i.current), e.collection.size > 0 && (z.current = !1, h.current = !0);
190
+ }
31
191
  });
32
- let { focusWithinProps: O } = v({
33
- isDisabled: !l,
34
- onBlurWithin: (e) => {
35
- !e.relatedTarget || g(e.relatedTarget) || (!s || s(e.relatedTarget)) && (o == null || o());
192
+ let D = m(e.focusedKey), K = m(null);
193
+ C(() => {
194
+ if (e.isFocused && e.focusedKey != null && (e.focusedKey !== D.current || h.current) && s.current && i.current) {
195
+ let l = Q(), r = B(i, e.focusedKey);
196
+ if (!(r instanceof HTMLElement))
197
+ return;
198
+ (l === "keyboard" || h.current) && (K.current && cancelAnimationFrame(K.current), K.current = requestAnimationFrame(() => {
199
+ s.current && (de(s.current, r), l !== "virtual" && J(r, {
200
+ containingElement: i.current
201
+ }));
202
+ }));
36
203
  }
37
- }), D = (e) => {
38
- e.target === e.currentTarget && e.preventDefault();
39
- };
40
- return {
41
- overlayProps: {
42
- onKeyDown: c,
43
- ...O
44
- },
45
- underlayProps: {
46
- onPointerDown: D
204
+ !b && e.isFocused && e.focusedKey == null && D.current != null && i.current && X(i.current), D.current = e.focusedKey, h.current = !1;
205
+ }), C(() => () => {
206
+ K.current && cancelAnimationFrame(K.current);
207
+ }, []), S(i, "react-aria-focus-scope-restore", (l) => {
208
+ l.preventDefault(), e.setFocused(!0);
209
+ });
210
+ let P = {
211
+ onKeyDown: te,
212
+ onFocus: re,
213
+ onBlur: ce,
214
+ onMouseDown(l) {
215
+ s.current === l.target && l.preventDefault();
47
216
  }
217
+ }, { typeSelectProps: ie } = fe({
218
+ keyboardDelegate: o,
219
+ selectionManager: e
220
+ });
221
+ ee || (P = q(ie, P));
222
+ let L;
223
+ b || (L = e.focusedKey == null ? 0 : -1);
224
+ let ne = ue(e.collection);
225
+ return {
226
+ collectionProps: q(P, {
227
+ tabIndex: L,
228
+ "data-collection": ne
229
+ })
48
230
  };
49
231
  }
50
232
  export {
51
- C as useOverlay
233
+ Ue as useSelectableCollection
52
234
  };
package/index276.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./index245.js"),v=require("./index256.js"),m=require("react");function g(r){let{ref:n,onInteractOutside:o,isDisabled:d,onInteractOutsideStart:l}=r,E=m.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=v.useEffectEvent(e=>{o&&c(e,n)&&(l&&l(e),E.current.isPointerDown=!0)}),f=v.useEffectEvent(e=>{o&&o(e)});m.useEffect(()=>{let e=E.current;if(d)return;const w=n.current,t=D.getOwnerDocument(w);if(typeof PointerEvent<"u"){let i=u=>{e.isPointerDown&&c(u,n)&&f(u),e.isPointerDown=!1};return t.addEventListener("pointerdown",s,!0),t.addEventListener("click",i,!0),()=>{t.removeEventListener("pointerdown",s,!0),t.removeEventListener("click",i,!0)}}else if(process.env.NODE_ENV==="test"){let i=a=>{e.ignoreEmulatedMouseEvents?e.ignoreEmulatedMouseEvents=!1:e.isPointerDown&&c(a,n)&&f(a),e.isPointerDown=!1},u=a=>{e.ignoreEmulatedMouseEvents=!0,e.isPointerDown&&c(a,n)&&f(a),e.isPointerDown=!1};return t.addEventListener("mousedown",s,!0),t.addEventListener("mouseup",i,!0),t.addEventListener("touchstart",s,!0),t.addEventListener("touchend",u,!0),()=>{t.removeEventListener("mousedown",s,!0),t.removeEventListener("mouseup",i,!0),t.removeEventListener("touchstart",s,!0),t.removeEventListener("touchend",u,!0)}}},[n,d])}function c(r,n){if(r.button>0)return!1;if(r.target){const o=r.target.ownerDocument;if(!o||!o.documentElement.contains(r.target)||r.target.closest("[data-react-aria-top-layer]"))return!1}return n.current?!r.composedPath().includes(n.current):!1}exports.useInteractOutside=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),v={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},x={...v,customError:!0,valid:!1},c={isInvalid:!1,validationDetails:v,validationErrors:[]},h=n.createContext({}),I="__formValidationState"+Date.now();function R(e){if(e[I]){let{realtimeValidation:a,displayValidation:t,updateValidation:i,resetValidation:d,commitValidation:l}=e[I];return{realtimeValidation:a,displayValidation:t,updateValidation:i,resetValidation:d,commitValidation:l}}return w(e)}function w(e){let{isInvalid:a,validationState:t,name:i,value:d,builtinValidation:l,validate:s,validationBehavior:o="aria"}=e;t&&(a||(a=t==="invalid"));let V=a!==void 0?{isInvalid:a,validationErrors:[],validationDetails:x}:null,m=n.useMemo(()=>{if(!s||d==null)return null;let r=F(s,d);return T(r)},[s,d]);l!=null&&l.validationDetails.valid&&(l=void 0);let u=n.useContext(h),A=n.useMemo(()=>i?Array.isArray(i)?i.flatMap(r=>D(u[r])):D(u[i]):[],[u,i]),[C,L]=n.useState(u),[g,$]=n.useState(!1);u!==C&&(L(u),$(!1));let b=n.useMemo(()=>T(g?[]:A),[g,A]),M=n.useRef(c),[E,p]=n.useState(c),f=n.useRef(c),_=()=>{if(!O)return;S(!1);let r=m||l||M.current;y(r,f.current)||(f.current=r,p(r))},[O,S]=n.useState(!1);return n.useEffect(_),{realtimeValidation:V||b||m||l||c,displayValidation:o==="native"?V||b||E:V||b||m||l||E,updateValidation(r){o==="aria"&&!y(E,r)?p(r):M.current=r},resetValidation(){let r=c;y(r,f.current)||(f.current=r,p(r)),o==="native"&&S(!1),$(!0)},commitValidation(){o==="native"&&S(!0),$(!0)}}}function D(e){return e?Array.isArray(e)?e:[e]:[]}function F(e,a){if(typeof e=="function"){let t=e(a);if(t&&typeof t!="boolean")return D(t)}return[]}function T(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:x}:null}function y(e,a){return e===a?!0:!!e&&!!a&&e.isInvalid===a.isInvalid&&e.validationErrors.length===a.validationErrors.length&&e.validationErrors.every((t,i)=>t===a.validationErrors[i])&&Object.entries(e.validationDetails).every(([t,i])=>a.validationDetails[t]===i)}function U(...e){let a=new Set,t=!1,i={...v};for(let s of e){var d,l;for(let o of s.validationErrors)a.add(o);t||(t=s.isInvalid);for(let o in i)(d=i)[l=o]||(d[l]=s.validationDetails[o])}return i.valid=!t,{isInvalid:t,validationErrors:[...a],validationDetails:i}}exports.DEFAULT_VALIDATION_RESULT=c;exports.FormValidationContext=h;exports.VALID_VALIDITY_STATE=v;exports.mergeValidation=U;exports.privateValidationStateProp=I;exports.useFormValidationState=R;
package/index276.mjs CHANGED
@@ -1,49 +1,128 @@
1
- import { getOwnerDocument as p } from "./index245.mjs";
2
- import { useEffectEvent as m } from "./index256.mjs";
3
- import { useRef as w, useEffect as D } from "react";
4
- function g(r) {
5
- let { ref: n, onInteractOutside: o, isDisabled: d, onInteractOutsideStart: l } = r, E = w({
6
- isPointerDown: !1,
7
- ignoreEmulatedMouseEvents: !1
8
- }), s = m((e) => {
9
- o && f(e, n) && (l && l(e), E.current.isPointerDown = !0);
10
- }), c = m((e) => {
11
- o && o(e);
12
- });
13
- D(() => {
14
- let e = E.current;
15
- if (d) return;
16
- const v = n.current, t = p(v);
17
- if (typeof PointerEvent < "u") {
18
- let i = (u) => {
19
- e.isPointerDown && f(u, n) && c(u), e.isPointerDown = !1;
20
- };
21
- return t.addEventListener("pointerdown", s, !0), t.addEventListener("click", i, !0), () => {
22
- t.removeEventListener("pointerdown", s, !0), t.removeEventListener("click", i, !0);
23
- };
24
- } else if (process.env.NODE_ENV === "test") {
25
- let i = (a) => {
26
- e.ignoreEmulatedMouseEvents ? e.ignoreEmulatedMouseEvents = !1 : e.isPointerDown && f(a, n) && c(a), e.isPointerDown = !1;
27
- }, u = (a) => {
28
- e.ignoreEmulatedMouseEvents = !0, e.isPointerDown && f(a, n) && c(a), e.isPointerDown = !1;
29
- };
30
- return t.addEventListener("mousedown", s, !0), t.addEventListener("mouseup", i, !0), t.addEventListener("touchstart", s, !0), t.addEventListener("touchend", u, !0), () => {
31
- t.removeEventListener("mousedown", s, !0), t.removeEventListener("mouseup", i, !0), t.removeEventListener("touchstart", s, !0), t.removeEventListener("touchend", u, !0);
32
- };
33
- }
1
+ import { useMemo as I, useContext as O, createContext as U, useState as f, useRef as T, useEffect as R } from "react";
2
+ const D = {
3
+ badInput: !1,
4
+ customError: !1,
5
+ patternMismatch: !1,
6
+ rangeOverflow: !1,
7
+ rangeUnderflow: !1,
8
+ stepMismatch: !1,
9
+ tooLong: !1,
10
+ tooShort: !1,
11
+ typeMismatch: !1,
12
+ valueMissing: !1,
13
+ valid: !0
14
+ }, L = {
15
+ ...D,
16
+ customError: !0,
17
+ valid: !1
18
+ }, u = {
19
+ isInvalid: !1,
20
+ validationDetails: D,
21
+ validationErrors: []
22
+ }, B = U({}), h = "__formValidationState" + Date.now();
23
+ function P(a) {
24
+ if (a[h]) {
25
+ let { realtimeValidation: e, displayValidation: t, updateValidation: i, resetValidation: o, commitValidation: l } = a[h];
26
+ return {
27
+ realtimeValidation: e,
28
+ displayValidation: t,
29
+ updateValidation: i,
30
+ resetValidation: o,
31
+ commitValidation: l
32
+ };
33
+ }
34
+ return Q(a);
35
+ }
36
+ function Q(a) {
37
+ let { isInvalid: e, validationState: t, name: i, value: o, builtinValidation: l, validate: d, validationBehavior: n = "aria" } = a;
38
+ t && (e || (e = t === "invalid"));
39
+ let v = e !== void 0 ? {
40
+ isInvalid: e,
41
+ validationErrors: [],
42
+ validationDetails: L
43
+ } : null, V = I(() => {
44
+ if (!d || o == null) return null;
45
+ let r = Y(d, o);
46
+ return C(r);
34
47
  }, [
35
- n,
36
- d
48
+ d,
49
+ o
37
50
  ]);
51
+ l != null && l.validationDetails.valid && (l = void 0);
52
+ let s = O(B), A = I(() => i ? Array.isArray(i) ? i.flatMap((r) => S(s[r])) : S(s[i]) : [], [
53
+ s,
54
+ i
55
+ ]), [M, _] = f(s), [x, m] = f(!1);
56
+ s !== M && (_(s), m(!1));
57
+ let $ = I(() => C(x ? [] : A), [
58
+ x,
59
+ A
60
+ ]), g = T(u), [b, E] = f(u), c = T(u), w = () => {
61
+ if (!F) return;
62
+ p(!1);
63
+ let r = V || l || g.current;
64
+ y(r, c.current) || (c.current = r, E(r));
65
+ }, [F, p] = f(!1);
66
+ return R(w), {
67
+ realtimeValidation: v || $ || V || l || u,
68
+ displayValidation: n === "native" ? v || $ || b : v || $ || V || l || b,
69
+ updateValidation(r) {
70
+ n === "aria" && !y(b, r) ? E(r) : g.current = r;
71
+ },
72
+ resetValidation() {
73
+ let r = u;
74
+ y(r, c.current) || (c.current = r, E(r)), n === "native" && p(!1), m(!0);
75
+ },
76
+ commitValidation() {
77
+ n === "native" && p(!0), m(!0);
78
+ }
79
+ };
80
+ }
81
+ function S(a) {
82
+ return a ? Array.isArray(a) ? a : [
83
+ a
84
+ ] : [];
85
+ }
86
+ function Y(a, e) {
87
+ if (typeof a == "function") {
88
+ let t = a(e);
89
+ if (t && typeof t != "boolean") return S(t);
90
+ }
91
+ return [];
92
+ }
93
+ function C(a) {
94
+ return a.length ? {
95
+ isInvalid: !0,
96
+ validationErrors: a,
97
+ validationDetails: L
98
+ } : null;
99
+ }
100
+ function y(a, e) {
101
+ return a === e ? !0 : !!a && !!e && a.isInvalid === e.isInvalid && a.validationErrors.length === e.validationErrors.length && a.validationErrors.every((t, i) => t === e.validationErrors[i]) && Object.entries(a.validationDetails).every(([t, i]) => e.validationDetails[t] === i);
38
102
  }
39
- function f(r, n) {
40
- if (r.button > 0) return !1;
41
- if (r.target) {
42
- const o = r.target.ownerDocument;
43
- if (!o || !o.documentElement.contains(r.target) || r.target.closest("[data-react-aria-top-layer]")) return !1;
103
+ function k(...a) {
104
+ let e = /* @__PURE__ */ new Set(), t = !1, i = {
105
+ ...D
106
+ };
107
+ for (let d of a) {
108
+ var o, l;
109
+ for (let n of d.validationErrors) e.add(n);
110
+ t || (t = d.isInvalid);
111
+ for (let n in i) (o = i)[l = n] || (o[l] = d.validationDetails[n]);
44
112
  }
45
- return n.current ? !r.composedPath().includes(n.current) : !1;
113
+ return i.valid = !t, {
114
+ isInvalid: t,
115
+ validationErrors: [
116
+ ...e
117
+ ],
118
+ validationDetails: i
119
+ };
46
120
  }
47
121
  export {
48
- g as useInteractOutside
122
+ u as DEFAULT_VALIDATION_RESULT,
123
+ B as FormValidationContext,
124
+ D as VALID_VALIDITY_STATE,
125
+ k as mergeValidation,
126
+ h as privateValidationStateProp,
127
+ P as useFormValidationState
49
128
  };
package/index277.js CHANGED
@@ -1,6 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index243.js"),w=require("./index240.js"),y=require("./index258.js"),T=require("./index259.js"),M=require("./index250.js"),p=require("./index267.js"),a=typeof document<"u"&&window.visualViewport;let s=0,h;function H(e={}){let{isDisabled:t}=e;w.useLayoutEffect(()=>{if(!t)return s++,s===1&&(M.isIOS()?h=q():h=L()),()=>{s--,s===0&&h()}},[t])}function L(){let e=window.innerWidth-document.documentElement.clientWidth;return S.chain(e>0&&("scrollbarGutter"in document.documentElement.style?$(document.documentElement,"scrollbarGutter","stable"):$(document.documentElement,"paddingRight",`${e}px`)),$(document.documentElement,"overflow","hidden"))}function q(){let e,t=!1,n=c=>{let l=c.target;e=T.isScrollable(l)?l:y.getScrollParent(l,!0),t=!1;let r=l.ownerDocument.defaultView.getSelection();r&&!r.isCollapsed&&r.containsNode(l,!0)&&(t=!0),"selectionStart"in l&&"selectionEnd"in l&&l.selectionStart<l.selectionEnd&&l.ownerDocument.activeElement===l&&(t=!0)},o=document.createElement("style");o.textContent=`
2
- @layer {
3
- * {
4
- overscroll-behavior: contain;
5
- }
6
- }`.trim(),document.head.prepend(o);let i=c=>{if(!(c.touches.length===2||t)){if(!e||e===document.documentElement||e===document.body){c.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&c.preventDefault()}},u=c=>{let l=c.target,r=c.relatedTarget;if(r&&p.willOpenKeyboard(r))r.focus({preventScroll:!0}),g(r,p.willOpenKeyboard(l));else if(!r){var f;let v=(f=l.parentElement)===null||f===void 0?void 0:f.closest("[tabindex]");v==null||v.focus({preventScroll:!0})}},d=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(c){let l=document.activeElement!=null&&p.willOpenKeyboard(document.activeElement);d.call(this,{...c,preventScroll:!0}),(!c||!c.preventScroll)&&g(this,l)};let m=S.chain(b(document,"touchstart",n,{passive:!1,capture:!0}),b(document,"touchmove",i,{passive:!1,capture:!0}),b(document,"blur",u,!0));return()=>{m(),o.remove(),HTMLElement.prototype.focus=d}}function $(e,t,n){let o=e.style[t];return e.style[t]=n,()=>{e.style[t]=o}}function b(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function g(e,t){t||!a?E(e):a.addEventListener("resize",()=>E(e),{once:!0})}function E(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let o=y.getScrollParent(n);if(o!==document.documentElement&&o!==document.body&&o!==n){let i=o.getBoundingClientRect(),u=n.getBoundingClientRect();if(u.top<i.top||u.bottom>i.top+n.clientHeight){let d=i.bottom;a&&(d=Math.min(d,a.offsetTop+a.height));let m=u.top-i.top-((d-i.top)/2-u.height/2);o.scrollTo({top:Math.max(0,Math.min(o.scrollHeight-o.clientHeight,o.scrollTop+m)),behavior:"smooth"})}}n=o.parentElement}}exports.usePreventScroll=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index331.js"),m=require("react"),E=require("./index236.js"),d=require("./index252.js");function y(n,e,t){let{validationBehavior:v,focus:s}=n;E.useLayoutEffect(()=>{if(v==="native"&&(t!=null&&t.current)&&!t.current.disabled){let a=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(a),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(M(t.current))}});let l=m.useRef(!1),u=d.useEffectEvent(()=>{l.current||e.resetValidation()}),c=d.useEffectEvent(a=>{var i;e.displayValidation.isInvalid||e.commitValidation();let o=t==null||(i=t.current)===null||i===void 0?void 0:i.form;if(!a.defaultPrevented&&t&&o&&b(o)===t.current){var r;s?s():(r=t.current)===null||r===void 0||r.focus(),g.setInteractionModality("keyboard")}a.preventDefault()}),f=d.useEffectEvent(()=>{e.commitValidation()});m.useEffect(()=>{let a=t==null?void 0:t.current;if(!a)return;let i=a.form,o=i==null?void 0:i.reset;return i&&(i.reset=()=>{l.current=!window.event||window.event.type==="message"&&window.event.target instanceof MessagePort,o==null||o.call(i),l.current=!1}),a.addEventListener("invalid",c),a.addEventListener("change",f),i==null||i.addEventListener("reset",u),()=>{a.removeEventListener("invalid",c),a.removeEventListener("change",f),i==null||i.removeEventListener("reset",u),i&&(i.reset=o)}},[t,v])}function h(n){let e=n.validity;return{badInput:e.badInput,customError:e.customError,patternMismatch:e.patternMismatch,rangeOverflow:e.rangeOverflow,rangeUnderflow:e.rangeUnderflow,stepMismatch:e.stepMismatch,tooLong:e.tooLong,tooShort:e.tooShort,typeMismatch:e.typeMismatch,valueMissing:e.valueMissing,valid:e.valid}}function M(n){return{isInvalid:!n.validity.valid,validationDetails:h(n),validationErrors:n.validationMessage?[n.validationMessage]:[]}}function b(n){for(let e=0;e<n.elements.length;e++){let t=n.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=y;