@okam/stack-ui 1.31.1 → 1.32.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 (418) hide show
  1. package/components/fields/Select/Select.interface.d.ts +2 -2
  2. package/components/fields/TextInputField/index.d.ts +5 -1
  3. package/components/fields/TextInputField/interface.d.ts +3 -1
  4. package/index110.js +1 -1
  5. package/index110.mjs +5 -5
  6. package/index111.js +1 -1
  7. package/index111.mjs +2 -2
  8. package/index112.js +1 -1
  9. package/index112.mjs +1 -1
  10. package/index113.js +1 -1
  11. package/index113.mjs +2 -2
  12. package/index115.js +1 -1
  13. package/index115.mjs +3 -3
  14. package/index116.js +1 -1
  15. package/index116.mjs +2 -2
  16. package/index120.js +1 -1
  17. package/index120.mjs +3 -3
  18. package/index121.js +1 -1
  19. package/index121.mjs +2 -2
  20. package/index123.js +1 -1
  21. package/index123.mjs +8 -8
  22. package/index124.js +1 -1
  23. package/index124.mjs +1 -1
  24. package/index125.js +1 -1
  25. package/index125.mjs +3 -3
  26. package/index126.js +1 -1
  27. package/index126.mjs +3 -3
  28. package/index130.js +1 -1
  29. package/index130.mjs +2 -2
  30. package/index133.js +1 -1
  31. package/index133.mjs +1 -1
  32. package/index138.js +1 -1
  33. package/index138.mjs +2 -2
  34. package/index140.js +1 -1
  35. package/index140.mjs +23 -23
  36. package/index141.js +1 -1
  37. package/index141.mjs +3 -3
  38. package/index144.js +1 -1
  39. package/index144.mjs +1 -1
  40. package/index145.js +1 -1
  41. package/index145.mjs +5 -5
  42. package/index146.js +1 -1
  43. package/index146.mjs +3 -3
  44. package/index147.js +1 -1
  45. package/index147.mjs +1 -1
  46. package/index148.js +1 -1
  47. package/index148.mjs +3 -3
  48. package/index149.js +1 -1
  49. package/index149.mjs +3 -3
  50. package/index150.js +1 -1
  51. package/index150.mjs +1 -1
  52. package/index151.js +1 -1
  53. package/index151.mjs +3 -3
  54. package/index152.js +1 -1
  55. package/index152.mjs +106 -20
  56. package/index153.js +1 -1
  57. package/index153.mjs +83 -107
  58. package/index154.js +1 -1
  59. package/index154.mjs +26 -83
  60. package/index155.js +1 -1
  61. package/index155.mjs +20 -25
  62. package/index156.js +1 -1
  63. package/index156.mjs +17 -123
  64. package/index157.js +1 -1
  65. package/index157.mjs +122 -24
  66. package/index158.js +1 -1
  67. package/index158.mjs +71 -17
  68. package/index159.js +1 -1
  69. package/index159.mjs +338 -62
  70. package/index160.js +1 -1
  71. package/index160.mjs +42 -346
  72. package/index161.js +1 -1
  73. package/index161.mjs +29 -43
  74. package/index162.js +1 -1
  75. package/index162.mjs +24 -28
  76. package/index164.js +1 -1
  77. package/index164.mjs +2 -2
  78. package/index167.js +1 -1
  79. package/index167.mjs +2 -2
  80. package/index169.js +1 -1
  81. package/index169.mjs +4 -4
  82. package/index170.js +1 -1
  83. package/index170.mjs +2 -2
  84. package/index173.js +1 -1
  85. package/index173.mjs +1 -1
  86. package/index175.js +1 -1
  87. package/index175.mjs +1 -1
  88. package/index176.js +1 -1
  89. package/index176.mjs +1 -1
  90. package/index178.js +1 -1
  91. package/index178.mjs +3 -3
  92. package/index179.js +1 -1
  93. package/index179.mjs +1 -1
  94. package/index180.js +1 -1
  95. package/index180.mjs +2 -2
  96. package/index182.js +1 -1
  97. package/index182.mjs +1 -1
  98. package/index184.js +1 -1
  99. package/index184.mjs +1 -1
  100. package/index185.js +1 -1
  101. package/index185.mjs +205 -197
  102. package/index186.js +1 -1
  103. package/index186.mjs +24 -64
  104. package/index187.js +1 -1
  105. package/index187.mjs +4 -143
  106. package/index188.js +1 -1
  107. package/index188.mjs +3 -124
  108. package/index189.js +1 -1
  109. package/index189.mjs +116 -215
  110. package/index190.js +1 -1
  111. package/index190.mjs +23 -184
  112. package/index191.js +1 -1
  113. package/index191.mjs +51 -69
  114. package/index192.js +1 -1
  115. package/index192.mjs +43 -278
  116. package/index193.js +1 -1
  117. package/index193.mjs +31 -92
  118. package/index194.js +1 -1
  119. package/index194.mjs +109 -184
  120. package/index195.js +1 -1
  121. package/index195.mjs +77 -84
  122. package/index196.js +1 -1
  123. package/index196.mjs +101 -58
  124. package/index197.js +1 -1
  125. package/index197.mjs +98 -127
  126. package/index198.js +1 -1
  127. package/index198.mjs +70 -114
  128. package/index199.js +1 -1
  129. package/index199.mjs +91 -118
  130. package/index200.js +1 -1
  131. package/index200.mjs +152 -69
  132. package/index201.js +1 -1
  133. package/index201.mjs +72 -111
  134. package/index202.js +1 -1
  135. package/index202.mjs +41 -51
  136. package/index203.js +1 -1
  137. package/index203.mjs +5 -93
  138. package/index204.js +1 -1
  139. package/index204.mjs +60 -69
  140. package/index205.js +1 -1
  141. package/index205.mjs +58 -55
  142. package/index206.js +1 -1
  143. package/index206.mjs +196 -92
  144. package/index207.js +1 -5
  145. package/index207.mjs +59 -75
  146. package/index208.js +1 -1
  147. package/index208.mjs +126 -2008
  148. package/index209.js +1 -1
  149. package/index209.mjs +121 -56
  150. package/index210.js +1 -1
  151. package/index210.mjs +221 -185
  152. package/index211.js +1 -1
  153. package/index211.mjs +185 -206
  154. package/index212.js +1 -1
  155. package/index212.mjs +69 -24
  156. package/index213.js +1 -1
  157. package/index213.mjs +279 -4
  158. package/index214.js +1 -1
  159. package/index214.mjs +98 -3
  160. package/index215.js +1 -1
  161. package/index215.mjs +179 -116
  162. package/index216.js +1 -1
  163. package/index216.mjs +84 -29
  164. package/index217.js +1 -1
  165. package/index217.mjs +58 -51
  166. package/index218.js +1 -1
  167. package/index218.mjs +125 -43
  168. package/index219.js +1 -1
  169. package/index219.mjs +112 -33
  170. package/index22.js +1 -1
  171. package/index22.mjs +148 -61
  172. package/index220.js +1 -1
  173. package/index220.mjs +119 -110
  174. package/index221.js +1 -1
  175. package/index221.mjs +72 -77
  176. package/index222.js +1 -1
  177. package/index222.mjs +105 -96
  178. package/index223.js +1 -1
  179. package/index223.mjs +53 -98
  180. package/index224.js +1 -1
  181. package/index224.mjs +89 -68
  182. package/index225.js +1 -1
  183. package/index225.mjs +68 -93
  184. package/index226.js +1 -1
  185. package/index226.mjs +52 -151
  186. package/index227.js +1 -1
  187. package/index227.mjs +100 -72
  188. package/index228.js +5 -1
  189. package/index228.mjs +78 -40
  190. package/index229.js +1 -1
  191. package/index229.mjs +2025 -5
  192. package/index230.js +1 -1
  193. package/index230.mjs +59 -61
  194. package/index231.js +1 -1
  195. package/index231.mjs +187 -58
  196. package/index269.js +1 -1
  197. package/index269.mjs +4 -24
  198. package/index270.js +1 -1
  199. package/index270.mjs +46 -45
  200. package/index271.js +1 -1
  201. package/index271.mjs +9 -5
  202. package/index272.js +1 -1
  203. package/index272.mjs +16 -6
  204. package/index273.js +1 -1
  205. package/index273.mjs +16 -15
  206. package/index274.js +1 -1
  207. package/index274.mjs +16 -25
  208. package/index275.js +1 -1
  209. package/index275.mjs +16 -29
  210. package/index276.js +1 -1
  211. package/index276.mjs +16 -32
  212. package/index277.js +1 -1
  213. package/index277.mjs +16 -10
  214. package/index278.js +1 -1
  215. package/index278.mjs +16 -29
  216. package/index279.js +1 -1
  217. package/index279.mjs +16 -10
  218. package/index280.js +1 -1
  219. package/index280.mjs +16 -6
  220. package/index281.js +1 -1
  221. package/index281.mjs +16 -8
  222. package/index282.js +1 -1
  223. package/index282.mjs +16 -14
  224. package/index283.js +1 -1
  225. package/index283.mjs +16 -9
  226. package/index284.js +1 -1
  227. package/index284.mjs +15 -130
  228. package/index285.js +1 -1
  229. package/index285.mjs +16 -191
  230. package/index286.js +1 -1
  231. package/index286.mjs +16 -10
  232. package/index287.js +1 -1
  233. package/index287.mjs +16 -4
  234. package/index288.js +1 -1
  235. package/index288.mjs +16 -37
  236. package/index289.js +1 -1
  237. package/index289.mjs +16 -6
  238. package/index290.js +1 -1
  239. package/index290.mjs +16 -30
  240. package/index291.js +1 -1
  241. package/index291.mjs +16 -7
  242. package/index292.js +1 -1
  243. package/index292.mjs +16 -141
  244. package/index293.js +1 -1
  245. package/index293.mjs +16 -198
  246. package/index294.js +1 -1
  247. package/index294.mjs +16 -23
  248. package/index295.js +1 -1
  249. package/index295.mjs +16 -47
  250. package/index296.js +1 -1
  251. package/index296.mjs +16 -49
  252. package/index297.js +1 -1
  253. package/index297.mjs +16 -101
  254. package/index298.js +1 -1
  255. package/index298.mjs +15 -71
  256. package/index299.js +1 -1
  257. package/index299.mjs +16 -59
  258. package/index300.js +1 -1
  259. package/index300.mjs +16 -8
  260. package/index301.js +1 -1
  261. package/index301.mjs +16 -12
  262. package/index302.js +1 -1
  263. package/index302.mjs +16 -5
  264. package/index303.js +1 -1
  265. package/index303.mjs +16 -49
  266. package/index304.js +1 -1
  267. package/index304.mjs +12 -12
  268. package/index305.js +1 -1
  269. package/index305.mjs +12 -12
  270. package/index306.js +1 -1
  271. package/index306.mjs +25 -16
  272. package/index307.js +1 -1
  273. package/index307.mjs +48 -16
  274. package/index308.js +1 -1
  275. package/index308.mjs +6 -16
  276. package/index309.js +1 -1
  277. package/index309.mjs +6 -16
  278. package/index310.js +1 -1
  279. package/index310.mjs +15 -16
  280. package/index311.js +1 -1
  281. package/index311.mjs +25 -16
  282. package/index312.js +1 -1
  283. package/index312.mjs +29 -16
  284. package/index313.js +1 -1
  285. package/index313.mjs +32 -16
  286. package/index314.js +1 -1
  287. package/index314.mjs +29 -16
  288. package/index315.js +1 -1
  289. package/index315.mjs +10 -16
  290. package/index316.js +1 -1
  291. package/index316.mjs +6 -16
  292. package/index317.js +1 -1
  293. package/index317.mjs +8 -16
  294. package/index318.js +1 -1
  295. package/index318.mjs +14 -16
  296. package/index319.js +1 -1
  297. package/index319.mjs +9 -16
  298. package/index320.js +1 -1
  299. package/index320.mjs +130 -15
  300. package/index321.js +1 -1
  301. package/index321.mjs +191 -16
  302. package/index322.js +1 -1
  303. package/index322.mjs +10 -16
  304. package/index323.js +1 -1
  305. package/index323.mjs +4 -16
  306. package/index324.js +1 -1
  307. package/index324.mjs +37 -16
  308. package/index325.js +1 -1
  309. package/index325.mjs +6 -16
  310. package/index326.js +1 -1
  311. package/index326.mjs +30 -16
  312. package/index327.js +1 -1
  313. package/index327.mjs +7 -16
  314. package/index328.js +1 -1
  315. package/index328.mjs +141 -16
  316. package/index329.js +1 -1
  317. package/index329.mjs +198 -16
  318. package/index330.js +1 -1
  319. package/index330.mjs +23 -16
  320. package/index331.js +1 -1
  321. package/index331.mjs +47 -16
  322. package/index332.js +1 -1
  323. package/index332.mjs +49 -16
  324. package/index333.js +1 -1
  325. package/index333.mjs +101 -16
  326. package/index334.js +1 -1
  327. package/index334.mjs +71 -15
  328. package/index335.js +1 -1
  329. package/index335.mjs +59 -16
  330. package/index336.js +1 -1
  331. package/index336.mjs +8 -16
  332. package/index337.js +1 -1
  333. package/index337.mjs +12 -16
  334. package/index338.js +1 -1
  335. package/index338.mjs +7 -4
  336. package/index339.js +1 -1
  337. package/index339.mjs +68 -6
  338. package/index340.js +1 -1
  339. package/index340.mjs +27 -65
  340. package/index341.js +1 -1
  341. package/index341.mjs +6 -30
  342. package/index342.js +1 -1
  343. package/index342.mjs +6 -6
  344. package/index343.js +1 -1
  345. package/index343.mjs +20 -6
  346. package/index344.js +1 -1
  347. package/index344.mjs +3 -20
  348. package/index381.js +1 -1
  349. package/index381.mjs +6 -5
  350. package/index382.js +1 -1
  351. package/index382.mjs +1 -1
  352. package/index383.js +1 -1
  353. package/index383.mjs +4 -4
  354. package/index384.js +1 -1
  355. package/index384.mjs +1 -1
  356. package/index385.js +1 -1
  357. package/index385.mjs +1 -1
  358. package/index386.js +1 -1
  359. package/index386.mjs +4 -4
  360. package/index387.js +1 -1
  361. package/index387.mjs +4 -4
  362. package/index388.js +1 -1
  363. package/index388.mjs +1 -1
  364. package/index389.js +1 -1
  365. package/index389.mjs +4 -4
  366. package/index390.js +1 -1
  367. package/index390.mjs +4 -4
  368. package/index391.js +1 -1
  369. package/index391.mjs +1 -1
  370. package/index392.js +1 -1
  371. package/index392.mjs +4 -4
  372. package/index393.js +1 -1
  373. package/index393.mjs +4 -4
  374. package/index394.js +1 -1
  375. package/index394.mjs +1 -1
  376. package/index395.js +1 -1
  377. package/index395.mjs +1 -1
  378. package/index396.js +1 -1
  379. package/index396.mjs +4 -4
  380. package/index397.js +1 -1
  381. package/index397.mjs +4 -4
  382. package/index398.js +1 -1
  383. package/index398.mjs +1 -1
  384. package/index399.js +1 -1
  385. package/index399.mjs +4 -4
  386. package/index400.js +1 -1
  387. package/index400.mjs +4 -4
  388. package/index401.js +1 -1
  389. package/index401.mjs +4 -4
  390. package/index402.js +1 -1
  391. package/index402.mjs +1 -1
  392. package/index403.js +1 -1
  393. package/index403.mjs +4 -4
  394. package/index404.js +1 -1
  395. package/index404.mjs +4 -4
  396. package/index405.js +1 -1
  397. package/index405.mjs +4 -4
  398. package/index406.js +1 -1
  399. package/index406.mjs +4 -4
  400. package/index407.js +1 -1
  401. package/index407.mjs +4 -4
  402. package/index408.js +1 -1
  403. package/index408.mjs +1 -1
  404. package/index409.js +1 -1
  405. package/index409.mjs +1 -1
  406. package/index410.js +1 -1
  407. package/index410.mjs +1 -1
  408. package/index411.js +1 -1
  409. package/index411.mjs +4 -4
  410. package/index412.js +1 -1
  411. package/index412.mjs +4 -4
  412. package/index413.js +1 -1
  413. package/index413.mjs +4 -4
  414. package/index414.js +1 -1
  415. package/index414.mjs +4 -4
  416. package/index415.js +1 -1
  417. package/index415.mjs +5 -6
  418. package/package.json +1 -1
package/index154.mjs CHANGED
@@ -1,86 +1,29 @@
1
- import { useVisibleRangeDescription as y, hookData as g } from "./index225.mjs";
2
- import { startOfWeek as $, today as k } from "./index153.mjs";
3
- import { useMemo as w } from "react";
4
- import { mergeProps as P } from "./index158.mjs";
5
- import { useLabels as v } from "./index171.mjs";
6
- import { useLocale as n, useDateFormatter as h } from "@react-aria/i18n";
7
- function B(r, e) {
8
- let { startDate: l = e.visibleRange.start, endDate: s = e.visibleRange.end } = r, { direction: o } = n(), f = (a) => {
9
- switch (a.key) {
10
- case "Enter":
11
- case " ":
12
- a.preventDefault(), e.selectFocusedDate();
13
- break;
14
- case "PageUp":
15
- a.preventDefault(), a.stopPropagation(), e.focusPreviousSection(a.shiftKey);
16
- break;
17
- case "PageDown":
18
- a.preventDefault(), a.stopPropagation(), e.focusNextSection(a.shiftKey);
19
- break;
20
- case "End":
21
- a.preventDefault(), a.stopPropagation(), e.focusSectionEnd();
22
- break;
23
- case "Home":
24
- a.preventDefault(), a.stopPropagation(), e.focusSectionStart();
25
- break;
26
- case "ArrowLeft":
27
- a.preventDefault(), a.stopPropagation(), o === "rtl" ? e.focusNextDay() : e.focusPreviousDay();
28
- break;
29
- case "ArrowUp":
30
- a.preventDefault(), a.stopPropagation(), e.focusPreviousRow();
31
- break;
32
- case "ArrowRight":
33
- a.preventDefault(), a.stopPropagation(), o === "rtl" ? e.focusPreviousDay() : e.focusNextDay();
34
- break;
35
- case "ArrowDown":
36
- a.preventDefault(), a.stopPropagation(), e.focusNextRow();
37
- break;
38
- case "Escape":
39
- "setAnchorDate" in e && (a.preventDefault(), e.setAnchorDate(null));
40
- break;
41
- }
42
- }, d = y(l, s, e.timeZone, !0), { ariaLabel: c, ariaLabelledBy: p } = g.get(e), u = v({
43
- "aria-label": [
44
- c,
45
- d
46
- ].filter(Boolean).join(", "),
47
- "aria-labelledby": p
48
- }), t = h({
49
- weekday: r.weekdayStyle || "narrow",
50
- timeZone: e.timeZone
51
- }), { locale: i } = n(), b = w(() => {
52
- let a = $(k(e.timeZone), i);
53
- return [
54
- ...new Array(7).keys()
55
- ].map((D) => {
56
- let m = a.add({
57
- days: D
58
- }).toDate(e.timeZone);
59
- return t.format(m);
60
- });
61
- }, [
62
- i,
63
- e.timeZone,
64
- t
65
- ]);
66
- return {
67
- gridProps: P(u, {
68
- role: "grid",
69
- "aria-readonly": e.isReadOnly || void 0,
70
- "aria-disabled": e.isDisabled || void 0,
71
- "aria-multiselectable": "highlightedRange" in e || void 0,
72
- onKeyDown: f,
73
- onFocus: () => e.setFocused(!0),
74
- onBlur: () => e.setFocused(!1)
75
- }),
76
- headerProps: {
77
- // Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
78
- // The day names are already included in the label of each cell, so there's no need to announce them twice.
79
- "aria-hidden": !0
80
- },
81
- weekDays: b
82
- };
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { isSameDay as h, getDayOfWeek as F } from "./index152.mjs";
3
+ import { useCalendarCell as I } from "./index200.mjs";
4
+ import { useFocusRing as L } from "@react-aria/focus";
5
+ import { mergeProps as V } from "./index156.mjs";
6
+ import { useRef as W } from "react";
7
+ import { useLocale as j } from "react-aria";
8
+ import r from "./index64.mjs";
9
+ function B({ themeName: l = "calendar", tokens: i, state: c, date: e }) {
10
+ const t = W(null), { cellProps: D, buttonProps: b, isSelected: s, isOutsideVisibleRange: x, isDisabled: a, formattedDate: C, isInvalid: d } = I({ date: e }, c, t), o = c == null ? void 0 : c.highlightedRange, f = o == null ? void 0 : o.start, m = o == null ? void 0 : o.end, p = o && f ? h(e, f) : s, u = o && m ? h(e, m) : s, { locale: R } = j(), $ = F(e, R), g = s && (p || $ === 0 || e.day === 1), y = s && (u || $ === 6 || e.day === e.calendar.getDaysInMonth(e)), { focusProps: S, isFocusVisible: P } = L(), v = r(`${l}.cellContainer`, { ...i, isFocusVisible: P }), O = r(`${l}.cell`, {
11
+ ...i,
12
+ isSelected: s,
13
+ isInvalid: d,
14
+ isDisabled: a,
15
+ isRoundedLeft: g,
16
+ isRoundedRight: y
17
+ }), T = r(`${l}.cellDate`, {
18
+ ...i,
19
+ isSelected: s,
20
+ isInvalid: d,
21
+ isDisabled: a,
22
+ isSelectionStart: p,
23
+ isSelectionEnd: u
24
+ });
25
+ return /* @__PURE__ */ n("td", { ...D, "aria-disabled": !1, className: v, children: /* @__PURE__ */ n("div", { ...V(b, S), ref: t, hidden: x, className: O, children: /* @__PURE__ */ n("div", { className: T, children: C }) }) });
83
26
  }
84
27
  export {
85
- B as useCalendarGrid
28
+ B as default
86
29
  };
package/index155.js CHANGED
@@ -1 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),r=require("./index153.js"),$=require("./index226.js"),F=require("@react-aria/focus"),I=require("./index158.js"),L=require("react"),T=require("react-aria"),t=require("./index64.js");function V({themeName:i="calendar",tokens:l,state:n,date:e}){const a=L.useRef(null),{cellProps:C,buttonProps:g,isSelected:c,isOutsideVisibleRange:m,isDisabled:u,formattedDate:y,isInvalid:d}=$.useCalendarCell({date:e},n,a),s=n==null?void 0:n.highlightedRange,f=s==null?void 0:s.start,h=s==null?void 0:s.end,D=s&&f?r.isSameDay(e,f):c,q=s&&h?r.isSameDay(e,h):c,{locale:p}=T.useLocale(),R=r.getDayOfWeek(e,p),S=c&&(D||R===0||e.day===1),b=c&&(q||R===6||e.day===e.calendar.getDaysInMonth(e)),{focusProps:x,isFocusVisible:P}=F.useFocusRing(),j=t(`${i}.cellContainer`,{...l,isFocusVisible:P}),v=t(`${i}.cell`,{...l,isSelected:c,isInvalid:d,isDisabled:u,isRoundedLeft:S,isRoundedRight:b}),O=t(`${i}.cellDate`,{...l,isSelected:c,isInvalid:d,isDisabled:u,isSelectionStart:D,isSelectionEnd:q});return o.jsx("td",{...C,"aria-disabled":!1,className:j,children:o.jsx("div",{...I.mergeProps(g,x),ref:a,hidden:m,className:v,children:o.jsx("div",{className:O,children:y})})})}module.exports=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index381.js"),o=require("./index156.js"),u=require("./index171.js"),s=require("@react-aria/focus");function c(a,e,d){let l=s.useHasTabbableChild(d)?void 0:0;var r;const n=i.generateId(e,(r=a.id)!==null&&r!==void 0?r:e==null?void 0:e.selectedKey,"tabpanel"),b=u.useLabels({...a,id:n,"aria-labelledby":i.generateId(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:o.mergeProps(b,{tabIndex:l,role:"tabpanel","aria-describedby":a["aria-describedby"],"aria-details":a["aria-details"]})}}exports.useTabPanel=c;
package/index155.mjs CHANGED
@@ -1,29 +1,24 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { isSameDay as h, getDayOfWeek as F } from "./index153.mjs";
3
- import { useCalendarCell as I } from "./index226.mjs";
4
- import { useFocusRing as L } from "@react-aria/focus";
5
- import { mergeProps as V } from "./index158.mjs";
6
- import { useRef as W } from "react";
7
- import { useLocale as j } from "react-aria";
8
- import r from "./index64.mjs";
9
- function B({ themeName: l = "calendar", tokens: i, state: c, date: e }) {
10
- const t = W(null), { cellProps: D, buttonProps: b, isSelected: s, isOutsideVisibleRange: x, isDisabled: a, formattedDate: C, isInvalid: d } = I({ date: e }, c, t), o = c == null ? void 0 : c.highlightedRange, f = o == null ? void 0 : o.start, m = o == null ? void 0 : o.end, p = o && f ? h(e, f) : s, u = o && m ? h(e, m) : s, { locale: R } = j(), $ = F(e, R), g = s && (p || $ === 0 || e.day === 1), y = s && (u || $ === 6 || e.day === e.calendar.getDaysInMonth(e)), { focusProps: S, isFocusVisible: P } = L(), v = r(`${l}.cellContainer`, { ...i, isFocusVisible: P }), O = r(`${l}.cell`, {
11
- ...i,
12
- isSelected: s,
13
- isInvalid: d,
14
- isDisabled: a,
15
- isRoundedLeft: g,
16
- isRoundedRight: y
17
- }), T = r(`${l}.cellDate`, {
18
- ...i,
19
- isSelected: s,
20
- isInvalid: d,
21
- isDisabled: a,
22
- isSelectionStart: p,
23
- isSelectionEnd: u
1
+ import { generateId as r } from "./index381.mjs";
2
+ import { mergeProps as n } from "./index156.mjs";
3
+ import { useLabels as c } from "./index171.mjs";
4
+ import { useHasTabbableChild as f } from "@react-aria/focus";
5
+ function m(a, e, b) {
6
+ let i = f(b) ? void 0 : 0;
7
+ var d;
8
+ const l = r(e, (d = a.id) !== null && d !== void 0 ? d : e == null ? void 0 : e.selectedKey, "tabpanel"), o = c({
9
+ ...a,
10
+ id: l,
11
+ "aria-labelledby": r(e, e == null ? void 0 : e.selectedKey, "tab")
24
12
  });
25
- return /* @__PURE__ */ n("td", { ...D, "aria-disabled": !1, className: v, children: /* @__PURE__ */ n("div", { ...V(b, S), ref: t, hidden: x, className: O, children: /* @__PURE__ */ n("div", { className: T, children: C }) }) });
13
+ return {
14
+ tabPanelProps: n(o, {
15
+ tabIndex: i,
16
+ role: "tabpanel",
17
+ "aria-describedby": a["aria-describedby"],
18
+ "aria-details": a["aria-details"]
19
+ })
20
+ };
26
21
  }
27
22
  export {
28
- B as default
23
+ m as useTabPanel
29
24
  };
package/index156.js CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index308.js"),l=require("./index138.js"),f=require("./index310.js");function u(...i){let r={...i[0]};for(let n=1;n<i.length;n++){let s=i[n];for(let e in s){let o=r[e],t=s[e];typeof o=="function"&&typeof t=="function"&&e[0]==="o"&&e[1]==="n"&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?r[e]=c.chain(o,t):(e==="className"||e==="UNSAFE_className")&&typeof o=="string"&&typeof t=="string"?r[e]=f.clsx(o,t):e==="id"&&o&&t?r.id=l.mergeIds(o,t):r[e]=t!==void 0?t:o}}return r}exports.mergeProps=u;
package/index156.mjs CHANGED
@@ -1,128 +1,22 @@
1
- import { createContext as O, useMemo as I, useContext 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 = O({}), 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);
47
- }, [
48
- d,
49
- o
50
- ]);
51
- l != null && l.validationDetails.valid && (l = void 0);
52
- let s = U(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);
102
- }
103
- function k(...a) {
104
- let e = /* @__PURE__ */ new Set(), t = !1, i = {
105
- ...D
1
+ import { chain as n } from "./index308.mjs";
2
+ import { mergeIds as s } from "./index138.mjs";
3
+ import { clsx as l } from "./index310.mjs";
4
+ function a(...r) {
5
+ let o = {
6
+ ...r[0]
106
7
  };
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]);
8
+ for (let c = 1; c < r.length; c++) {
9
+ let i = r[c];
10
+ for (let e in i) {
11
+ let f = o[e], t = i[e];
12
+ typeof f == "function" && typeof t == "function" && // This is a lot faster than a regex.
13
+ e[0] === "o" && e[1] === "n" && e.charCodeAt(2) >= /* 'A' */
14
+ 65 && e.charCodeAt(2) <= /* 'Z' */
15
+ 90 ? o[e] = n(f, t) : (e === "className" || e === "UNSAFE_className") && typeof f == "string" && typeof t == "string" ? o[e] = l(f, t) : e === "id" && f && t ? o.id = s(f, t) : o[e] = t !== void 0 ? t : f;
16
+ }
112
17
  }
113
- return i.valid = !t, {
114
- isInvalid: t,
115
- validationErrors: [
116
- ...e
117
- ],
118
- validationDetails: i
119
- };
18
+ return o;
120
19
  }
121
20
  export {
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
21
+ a as mergeProps
128
22
  };
package/index157.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function C(o,b,u){let[p,s]=l.useState(o||b),i=l.useRef(o!==void 0),e=o!==void 0;l.useEffect(()=>{let t=i.current;t!==e&&console.warn(`WARN: A component changed from ${t?"controlled":"uncontrolled"} to ${e?"controlled":"uncontrolled"}.`),i.current=e},[e]);let n=e?o:p,S=l.useCallback((t,...f)=>{let a=(r,...c)=>{u&&(Object.is(n,r)||u(r,...c)),e||(n=r)};typeof t=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),s((c,...m)=>{let d=t(e?n:c,...m);return a(d,...f),e?c:d})):(e||s(t),a(t,...f))},[e,n,u]);return[n,S]}exports.useControlledState=C;
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/index157.mjs CHANGED
@@ -1,30 +1,128 @@
1
- import { useState as C, useRef as $, useEffect as S, useCallback as V } from "react";
2
- function w(o, d, c) {
3
- let [p, s] = C(o || d), u = $(o !== void 0), e = o !== void 0;
4
- S(() => {
5
- let t = u.current;
6
- t !== e && console.warn(`WARN: A component changed from ${t ? "controlled" : "uncontrolled"} to ${e ? "controlled" : "uncontrolled"}.`), u.current = e;
7
- }, [
8
- e
9
- ]);
10
- let n = e ? o : p, b = V((t, ...i) => {
11
- let f = (r, ...l) => {
12
- c && (Object.is(n, r) || c(r, ...l)), e || (n = r);
1
+ import { createContext as O, useMemo as I, useContext 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 = O({}), 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
13
32
  };
14
- typeof t == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), s((l, ...m) => {
15
- let a = t(e ? n : l, ...m);
16
- return f(a, ...i), e ? l : a;
17
- })) : (e || s(t), f(t, ...i));
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);
18
47
  }, [
19
- e,
20
- n,
21
- c
48
+ d,
49
+ o
22
50
  ]);
23
- return [
24
- n,
25
- b
26
- ];
51
+ l != null && l.validationDetails.valid && (l = void 0);
52
+ let s = U(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);
102
+ }
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]);
112
+ }
113
+ return i.valid = !t, {
114
+ isInvalid: t,
115
+ validationErrors: [
116
+ ...e
117
+ ],
118
+ validationDetails: i
119
+ };
27
120
  }
28
121
  export {
29
- w as useControlledState
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
30
128
  };
package/index158.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index271.js"),l=require("./index138.js"),f=require("./index273.js");function u(...i){let r={...i[0]};for(let n=1;n<i.length;n++){let s=i[n];for(let e in s){let o=r[e],t=s[e];typeof o=="function"&&typeof t=="function"&&e[0]==="o"&&e[1]==="n"&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?r[e]=c.chain(o,t):(e==="className"||e==="UNSAFE_className")&&typeof o=="string"&&typeof t=="string"?r[e]=f.clsx(o,t):e==="id"&&o&&t?r.id=l.mergeIds(o,t):r[e]=t!==void 0?t:o}}return r}exports.mergeProps=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index204.js"),f=require("react"),E=require("./index172.js"),v=require("./index318.js");function g(i,e,t){let{validationBehavior:s,focus:u}=i;E.useLayoutEffect(()=>{if(s==="native"&&(t!=null&&t.current)){let n=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(n),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let o=v.useEffectEvent(()=>{e.resetValidation()}),l=v.useEffectEvent(n=>{var a;e.displayValidation.isInvalid||e.commitValidation();let c=t==null||(a=t.current)===null||a===void 0?void 0:a.form;if(!n.defaultPrevented&&t&&c&&M(c)===t.current){var d;u?u():(d=t.current)===null||d===void 0||d.focus(),m.setInteractionModality("keyboard")}n.preventDefault()}),r=v.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let n=t==null?void 0:t.current;if(!n)return;let a=n.form;return n.addEventListener("invalid",l),n.addEventListener("change",r),a==null||a.addEventListener("reset",o),()=>{n.removeEventListener("invalid",l),n.removeEventListener("change",r),a==null||a.removeEventListener("reset",o)}},[t,l,r,o,s])}function y(i){let e=i.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 h(i){return{isInvalid:!i.validity.valid,validationDetails:y(i),validationErrors:i.validationMessage?[i.validationMessage]:[]}}function M(i){for(let e=0;e<i.elements.length;e++){let t=i.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=g;
package/index158.mjs CHANGED
@@ -1,22 +1,76 @@
1
- import { chain as n } from "./index271.mjs";
2
- import { mergeIds as s } from "./index138.mjs";
3
- import { clsx as l } from "./index273.mjs";
4
- function a(...r) {
5
- let o = {
6
- ...r[0]
7
- };
8
- for (let c = 1; c < r.length; c++) {
9
- let i = r[c];
10
- for (let e in i) {
11
- let f = o[e], t = i[e];
12
- typeof f == "function" && typeof t == "function" && // This is a lot faster than a regex.
13
- e[0] === "o" && e[1] === "n" && e.charCodeAt(2) >= /* 'A' */
14
- 65 && e.charCodeAt(2) <= /* 'Z' */
15
- 90 ? o[e] = n(f, t) : (e === "className" || e === "UNSAFE_className") && typeof f == "string" && typeof t == "string" ? o[e] = l(f, t) : e === "id" && f && t ? o.id = s(f, t) : o[e] = t !== void 0 ? t : f;
1
+ import { setInteractionModality as m } from "./index204.mjs";
2
+ import { useEffect as f } from "react";
3
+ import { useLayoutEffect as $ } from "./index172.mjs";
4
+ import { useEffectEvent as v } from "./index318.mjs";
5
+ function V(t, i, e) {
6
+ let { validationBehavior: s, focus: u } = t;
7
+ $(() => {
8
+ if (s === "native" && (e != null && e.current)) {
9
+ let a = i.realtimeValidation.isInvalid ? i.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
10
+ e.current.setCustomValidity(a), e.current.hasAttribute("title") || (e.current.title = ""), i.realtimeValidation.isInvalid || i.updateValidation(g(e.current));
11
+ }
12
+ });
13
+ let o = v(() => {
14
+ i.resetValidation();
15
+ }), l = v((a) => {
16
+ var n;
17
+ i.displayValidation.isInvalid || i.commitValidation();
18
+ let c = e == null || (n = e.current) === null || n === void 0 ? void 0 : n.form;
19
+ if (!a.defaultPrevented && e && c && h(c) === e.current) {
20
+ var d;
21
+ u ? u() : (d = e.current) === null || d === void 0 || d.focus(), m("keyboard");
16
22
  }
23
+ a.preventDefault();
24
+ }), r = v(() => {
25
+ i.commitValidation();
26
+ });
27
+ f(() => {
28
+ let a = e == null ? void 0 : e.current;
29
+ if (!a) return;
30
+ let n = a.form;
31
+ return a.addEventListener("invalid", l), a.addEventListener("change", r), n == null || n.addEventListener("reset", o), () => {
32
+ a.removeEventListener("invalid", l), a.removeEventListener("change", r), n == null || n.removeEventListener("reset", o);
33
+ };
34
+ }, [
35
+ e,
36
+ l,
37
+ r,
38
+ o,
39
+ s
40
+ ]);
41
+ }
42
+ function p(t) {
43
+ let i = t.validity;
44
+ return {
45
+ badInput: i.badInput,
46
+ customError: i.customError,
47
+ patternMismatch: i.patternMismatch,
48
+ rangeOverflow: i.rangeOverflow,
49
+ rangeUnderflow: i.rangeUnderflow,
50
+ stepMismatch: i.stepMismatch,
51
+ tooLong: i.tooLong,
52
+ tooShort: i.tooShort,
53
+ typeMismatch: i.typeMismatch,
54
+ valueMissing: i.valueMissing,
55
+ valid: i.valid
56
+ };
57
+ }
58
+ function g(t) {
59
+ return {
60
+ isInvalid: !t.validity.valid,
61
+ validationDetails: p(t),
62
+ validationErrors: t.validationMessage ? [
63
+ t.validationMessage
64
+ ] : []
65
+ };
66
+ }
67
+ function h(t) {
68
+ for (let i = 0; i < t.elements.length; i++) {
69
+ let e = t.elements[i];
70
+ if (!e.validity.valid) return e;
17
71
  }
18
- return o;
72
+ return null;
19
73
  }
20
74
  export {
21
- a as mergeProps
75
+ V as useFormValidation
22
76
  };
package/index159.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index230.js"),f=require("react"),E=require("./index172.js"),v=require("./index282.js");function g(i,e,t){let{validationBehavior:s,focus:u}=i;E.useLayoutEffect(()=>{if(s==="native"&&(t!=null&&t.current)){let n=e.realtimeValidation.isInvalid?e.realtimeValidation.validationErrors.join(" ")||"Invalid value.":"";t.current.setCustomValidity(n),t.current.hasAttribute("title")||(t.current.title=""),e.realtimeValidation.isInvalid||e.updateValidation(h(t.current))}});let o=v.useEffectEvent(()=>{e.resetValidation()}),l=v.useEffectEvent(n=>{var a;e.displayValidation.isInvalid||e.commitValidation();let c=t==null||(a=t.current)===null||a===void 0?void 0:a.form;if(!n.defaultPrevented&&t&&c&&M(c)===t.current){var d;u?u():(d=t.current)===null||d===void 0||d.focus(),m.setInteractionModality("keyboard")}n.preventDefault()}),r=v.useEffectEvent(()=>{e.commitValidation()});f.useEffect(()=>{let n=t==null?void 0:t.current;if(!n)return;let a=n.form;return n.addEventListener("invalid",l),n.addEventListener("change",r),a==null||a.addEventListener("reset",o),()=>{n.removeEventListener("invalid",l),n.removeEventListener("change",r),a==null||a.removeEventListener("reset",o)}},[t,l,r,o,s])}function y(i){let e=i.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 h(i){return{isInvalid:!i.validity.valid,validationDetails:y(i),validationErrors:i.validationMessage?[i.validationMessage]:[]}}function M(i){for(let e=0;e<i.elements.length;e++){let t=i.elements[e];if(!t.validity.valid)return t}return null}exports.useFormValidation=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index340.js"),te=require("./index338.js"),re=require("./index341.js"),ne=require("./index187.js"),H=require("./index342.js"),ie=require("./index308.js"),S=require("./index309.js"),j=require("./index156.js"),X=require("./index202.js"),G=require("./index311.js"),se=require("./index313.js"),oe=require("./index315.js"),ae=require("./index174.js"),A=require("./index319.js"),C=require("./index318.js"),I=require("react");function ue(i){let s=I.useContext(te.PressResponderContext);if(s){let{register:a,...u}=s;i=j.mergeProps(u,i),a()}return oe.useSyncRef(s,i.ref),i}var Y=new WeakMap;class _{continuePropagation(){H._(this,Y,!1)}get shouldStopPropagation(){return re._(this,Y)}constructor(s,a,u,f){ne._(this,Y,{writable:!0,value:void 0}),H._(this,Y,!0);var T;let g=(T=f==null?void 0:f.target)!==null&&T!==void 0?T:u.currentTarget;const O=g==null?void 0:g.getBoundingClientRect();let P,D=0,d,L=null;u.clientX!=null&&u.clientY!=null&&(d=u.clientX,L=u.clientY),O&&(d!=null&&L!=null?(P=d-O.left,D=L-O.top):(P=O.width/2,D=O.height/2)),this.type=s,this.pointerType=a,this.target=u.currentTarget,this.shiftKey=u.shiftKey,this.metaKey=u.metaKey,this.ctrlKey=u.ctrlKey,this.altKey=u.altKey,this.x=P,this.y=D}}const V=Symbol("linkClicked");function le(i){let{onPress:s,onPressChange:a,onPressStart:u,onPressEnd:f,onPressUp:T,isDisabled:g,isPressed:O,preventFocusOnPress:P,shouldCancelOnPointerExit:D,allowTextSelectionOnPress:d,ref:L,...Q}=ue(i),[Z,F]=I.useState(!1),b=I.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:m,removeAllGlobalListeners:M}=se.useGlobalListeners(),y=C.useEffectEvent((e,o)=>{let v=b.current;if(g||v.didFirePressStart)return!1;let n=!0;if(v.isTriggeringEvent=!0,u){let c=new _("pressstart",o,e);u(c),n=c.shouldStopPropagation}return a&&a(!0),v.isTriggeringEvent=!1,v.didFirePressStart=!0,F(!0),n}),p=C.useEffectEvent((e,o,v=!0)=>{let n=b.current;if(!n.didFirePressStart)return!1;n.ignoreClickAfterPress=!0,n.didFirePressStart=!1,n.isTriggeringEvent=!0;let c=!0;if(f){let t=new _("pressend",o,e);f(t),c=t.shouldStopPropagation}if(a&&a(!1),F(!1),s&&v&&!g){let t=new _("press",o,e);s(t),c&&(c=t.shouldStopPropagation)}return n.isTriggeringEvent=!1,c}),k=C.useEffectEvent((e,o)=>{let v=b.current;if(g)return!1;if(T){v.isTriggeringEvent=!0;let n=new _("pressup",o,e);return T(n),v.isTriggeringEvent=!1,n.shouldStopPropagation}return!0}),K=C.useEffectEvent(e=>{let o=b.current;o.isPressed&&o.target&&(o.isOverTarget&&o.pointerType!=null&&p(E(o.target,e),o.pointerType,!1),o.isPressed=!1,o.isOverTarget=!1,o.activePointerId=null,o.pointerType=null,M(),d||w.restoreTextSelection(o.target))}),q=C.useEffectEvent(e=>{D&&K(e)}),ee=I.useMemo(()=>{let e=b.current,o={onKeyDown(n){if(R(n.nativeEvent,n.currentTarget)&&n.currentTarget.contains(n.target)){var c;N(n.target,n.key)&&n.preventDefault();let t=!0;if(!e.isPressed&&!n.repeat){e.target=n.currentTarget,e.isPressed=!0,t=y(n,"keyboard");let l=n.currentTarget,r=h=>{R(h,l)&&!h.repeat&&l.contains(h.target)&&e.target&&k(E(e.target,h),"keyboard")};m(S.getOwnerDocument(n.currentTarget),"keyup",ie.chain(r,v),!0)}t&&n.stopPropagation(),n.metaKey&&ae.isMac()&&((c=e.metaKeyEvents)===null||c===void 0||c.set(n.key,n.nativeEvent))}else n.key==="Meta"&&(e.metaKeyEvents=new Map)},onClick(n){if(!(n&&!n.currentTarget.contains(n.target))&&n&&n.button===0&&!e.isTriggeringEvent&&!G.openLink.isOpening){let c=!0;if(g&&n.preventDefault(),!e.ignoreClickAfterPress&&!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType==="virtual"||A.isVirtualClick(n.nativeEvent))){!g&&!P&&X.focusWithoutScrolling(n.currentTarget);let t=y(n,"virtual"),l=k(n,"virtual"),r=p(n,"virtual");c=t&&l&&r}e.ignoreEmulatedMouseEvents=!1,e.ignoreClickAfterPress=!1,c&&n.stopPropagation()}}},v=n=>{var c;if(e.isPressed&&e.target&&R(n,e.target)){var t;N(n.target,n.key)&&n.preventDefault();let r=n.target;p(E(e.target,n),"keyboard",e.target.contains(r)),M(),n.key!=="Enter"&&W(e.target)&&e.target.contains(r)&&!n[V]&&(n[V]=!0,G.openLink(e.target,n,!1)),e.isPressed=!1,(t=e.metaKeyEvents)===null||t===void 0||t.delete(n.key)}else if(n.key==="Meta"&&(!((c=e.metaKeyEvents)===null||c===void 0)&&c.size)){var l;let r=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let h of r.values())(l=e.target)===null||l===void 0||l.dispatchEvent(new KeyboardEvent("keyup",h))}};if(typeof PointerEvent<"u"){o.onPointerDown=r=>{if(r.button!==0||!r.currentTarget.contains(r.target))return;if(A.isVirtualPointerEvent(r.nativeEvent)){e.pointerType="virtual";return}U(r.currentTarget)&&r.preventDefault(),e.pointerType=r.pointerType;let h=!0;e.isPressed||(e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=r.pointerId,e.target=r.currentTarget,!g&&!P&&X.focusWithoutScrolling(r.currentTarget),d||w.disableTextSelection(e.target),h=y(r,e.pointerType),m(S.getOwnerDocument(r.currentTarget),"pointermove",n,!1),m(S.getOwnerDocument(r.currentTarget),"pointerup",c,!1),m(S.getOwnerDocument(r.currentTarget),"pointercancel",l,!1)),h&&r.stopPropagation()},o.onMouseDown=r=>{r.currentTarget.contains(r.target)&&r.button===0&&(U(r.currentTarget)&&r.preventDefault(),r.stopPropagation())},o.onPointerUp=r=>{!r.currentTarget.contains(r.target)||e.pointerType==="virtual"||r.button===0&&x(r,r.currentTarget)&&k(r,e.pointerType||r.pointerType)};let n=r=>{r.pointerId===e.activePointerId&&(e.target&&x(r,e.target)?!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,y(E(e.target,r),e.pointerType)):e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,p(E(e.target,r),e.pointerType,!1),q(r)))},c=r=>{r.pointerId===e.activePointerId&&e.isPressed&&r.button===0&&e.target&&(x(r,e.target)&&e.pointerType!=null?p(E(e.target,r),e.pointerType):e.isOverTarget&&e.pointerType!=null&&p(E(e.target,r),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,M(),d||w.restoreTextSelection(e.target),"ontouchend"in e.target&&r.pointerType!=="mouse"&&m(e.target,"touchend",t,{once:!0}))},t=r=>{z(r.currentTarget)&&r.preventDefault()},l=r=>{K(r)};o.onDragStart=r=>{r.currentTarget.contains(r.target)&&K(r)}}else{o.onMouseDown=t=>{if(t.button!==0||!t.currentTarget.contains(t.target))return;if(U(t.currentTarget)&&t.preventDefault(),e.ignoreEmulatedMouseEvents){t.stopPropagation();return}e.isPressed=!0,e.isOverTarget=!0,e.target=t.currentTarget,e.pointerType=A.isVirtualClick(t.nativeEvent)?"virtual":"mouse",!g&&!P&&X.focusWithoutScrolling(t.currentTarget),y(t,e.pointerType)&&t.stopPropagation(),m(S.getOwnerDocument(t.currentTarget),"mouseup",n,!1)},o.onMouseEnter=t=>{if(!t.currentTarget.contains(t.target))return;let l=!0;e.isPressed&&!e.ignoreEmulatedMouseEvents&&e.pointerType!=null&&(e.isOverTarget=!0,l=y(t,e.pointerType)),l&&t.stopPropagation()},o.onMouseLeave=t=>{if(!t.currentTarget.contains(t.target))return;let l=!0;e.isPressed&&!e.ignoreEmulatedMouseEvents&&e.pointerType!=null&&(e.isOverTarget=!1,l=p(t,e.pointerType,!1),q(t)),l&&t.stopPropagation()},o.onMouseUp=t=>{t.currentTarget.contains(t.target)&&!e.ignoreEmulatedMouseEvents&&t.button===0&&k(t,e.pointerType||"mouse")};let n=t=>{if(t.button===0){if(e.isPressed=!1,M(),e.ignoreEmulatedMouseEvents){e.ignoreEmulatedMouseEvents=!1;return}e.target&&x(t,e.target)&&e.pointerType!=null?p(E(e.target,t),e.pointerType):e.target&&e.isOverTarget&&e.pointerType!=null&&p(E(e.target,t),e.pointerType,!1),e.isOverTarget=!1}};o.onTouchStart=t=>{if(!t.currentTarget.contains(t.target))return;let l=ce(t.nativeEvent);if(!l)return;e.activePointerId=l.identifier,e.ignoreEmulatedMouseEvents=!0,e.isOverTarget=!0,e.isPressed=!0,e.target=t.currentTarget,e.pointerType="touch",!g&&!P&&X.focusWithoutScrolling(t.currentTarget),d||w.disableTextSelection(e.target),y($(e.target,t),e.pointerType)&&t.stopPropagation(),m(S.getOwnerWindow(t.currentTarget),"scroll",c,!0)},o.onTouchMove=t=>{if(!t.currentTarget.contains(t.target))return;if(!e.isPressed){t.stopPropagation();return}let l=B(t.nativeEvent,e.activePointerId),r=!0;l&&x(l,t.currentTarget)?!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,r=y($(e.target,t),e.pointerType)):e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,r=p($(e.target,t),e.pointerType,!1),q($(e.target,t))),r&&t.stopPropagation()},o.onTouchEnd=t=>{if(!t.currentTarget.contains(t.target))return;if(!e.isPressed){t.stopPropagation();return}let l=B(t.nativeEvent,e.activePointerId),r=!0;l&&x(l,t.currentTarget)&&e.pointerType!=null?(k($(e.target,t),e.pointerType),r=p($(e.target,t),e.pointerType)):e.isOverTarget&&e.pointerType!=null&&(r=p($(e.target,t),e.pointerType,!1)),r&&t.stopPropagation(),e.isPressed=!1,e.activePointerId=null,e.isOverTarget=!1,e.ignoreEmulatedMouseEvents=!0,e.target&&!d&&w.restoreTextSelection(e.target),M()},o.onTouchCancel=t=>{t.currentTarget.contains(t.target)&&(t.stopPropagation(),e.isPressed&&K($(e.target,t)))};let c=t=>{e.isPressed&&t.target.contains(e.target)&&K({currentTarget:e.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};o.onDragStart=t=>{t.currentTarget.contains(t.target)&&K(t)}}return o},[m,g,P,M,d,K,q,p,y,k]);return I.useEffect(()=>()=>{var e;d||w.restoreTextSelection((e=b.current.target)!==null&&e!==void 0?e:void 0)},[d]),{isPressed:O||Z,pressProps:j.mergeProps(Q,ee)}}function W(i){return i.tagName==="A"&&i.hasAttribute("href")}function R(i,s){const{key:a,code:u}=i,f=s,T=f.getAttribute("role");return(a==="Enter"||a===" "||a==="Spacebar"||u==="Space")&&!(f instanceof S.getOwnerWindow(f).HTMLInputElement&&!J(f,a)||f instanceof S.getOwnerWindow(f).HTMLTextAreaElement||f.isContentEditable)&&!((T==="link"||!T&&W(f))&&a!=="Enter")}function ce(i){const{targetTouches:s}=i;return s.length>0?s[0]:null}function B(i,s){const a=i.changedTouches;for(let u=0;u<a.length;u++){const f=a[u];if(f.identifier===s)return f}return null}function $(i,s){let a=0,u=0;return s.targetTouches&&s.targetTouches.length===1&&(a=s.targetTouches[0].clientX,u=s.targetTouches[0].clientY),{currentTarget:i,shiftKey:s.shiftKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,altKey:s.altKey,clientX:a,clientY:u}}function E(i,s){let a=s.clientX,u=s.clientY;return{currentTarget:i,shiftKey:s.shiftKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,altKey:s.altKey,clientX:a,clientY:u}}function fe(i){let s=0,a=0;return i.width!==void 0?s=i.width/2:i.radiusX!==void 0&&(s=i.radiusX),i.height!==void 0?a=i.height/2:i.radiusY!==void 0&&(a=i.radiusY),{top:i.clientY-a,right:i.clientX+s,bottom:i.clientY+a,left:i.clientX-s}}function ge(i,s){return!(i.left>s.right||s.left>i.right||i.top>s.bottom||s.top>i.bottom)}function x(i,s){let a=s.getBoundingClientRect(),u=fe(i);return ge(a,u)}function U(i){return!(i instanceof HTMLElement)||!i.hasAttribute("draggable")}function z(i){return i instanceof HTMLInputElement?!1:i instanceof HTMLButtonElement?i.type!=="submit"&&i.type!=="reset":!W(i)}function N(i,s){return i instanceof HTMLInputElement?!J(i,s):z(i)}const pe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function J(i,s){return i.type==="checkbox"||i.type==="radio"?s===" ":pe.has(i.type)}exports.usePress=le;