@okam/stack-ui 1.32.5 → 1.32.6

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 (447) hide show
  1. package/index115.js +1 -1
  2. package/index115.mjs +6 -6
  3. package/index116.js +1 -1
  4. package/index116.mjs +4 -4
  5. package/index118.js +1 -1
  6. package/index118.mjs +3 -3
  7. package/index119.js +1 -1
  8. package/index119.mjs +3 -3
  9. package/index120.js +1 -1
  10. package/index120.mjs +6 -6
  11. package/index121.js +1 -1
  12. package/index121.mjs +4 -4
  13. package/index122.js +1 -1
  14. package/index122.mjs +2 -2
  15. package/index123.js +1 -1
  16. package/index123.mjs +1 -1
  17. package/index124.js +1 -1
  18. package/index124.mjs +1 -1
  19. package/index125.js +1 -1
  20. package/index125.mjs +4 -4
  21. package/index139.js +1 -1
  22. package/index139.mjs +1 -1
  23. package/index140.js +1 -1
  24. package/index140.mjs +23 -23
  25. package/index141.js +1 -1
  26. package/index141.mjs +3 -3
  27. package/index144.js +1 -1
  28. package/index144.mjs +23 -21
  29. package/index145.js +1 -1
  30. package/index145.mjs +113 -38
  31. package/index146.js +1 -1
  32. package/index146.mjs +22 -25
  33. package/index147.js +1 -1
  34. package/index147.mjs +35 -251
  35. package/index148.js +1 -1
  36. package/index148.mjs +25 -106
  37. package/index149.js +1 -1
  38. package/index149.mjs +242 -320
  39. package/index150.js +1 -1
  40. package/index150.mjs +105 -23
  41. package/index151.js +1 -1
  42. package/index151.mjs +323 -104
  43. package/index152.js +1 -1
  44. package/index152.mjs +1 -1
  45. package/index153.js +1 -1
  46. package/index153.mjs +2 -2
  47. package/index154.js +1 -1
  48. package/index154.mjs +1 -1
  49. package/index155.js +1 -1
  50. package/index155.mjs +2 -2
  51. package/index158.js +1 -1
  52. package/index158.mjs +2 -2
  53. package/index159.js +1 -1
  54. package/index159.mjs +2 -2
  55. package/index160.js +1 -1
  56. package/index160.mjs +2 -2
  57. package/index163.js +1 -1
  58. package/index163.mjs +136 -71
  59. package/index164.js +1 -1
  60. package/index164.mjs +132 -50
  61. package/index165.js +1 -1
  62. package/index165.mjs +96 -21
  63. package/index166.js +1 -1
  64. package/index166.mjs +24 -27
  65. package/index167.js +1 -1
  66. package/index167.mjs +381 -33
  67. package/index168.js +1 -1
  68. package/index168.mjs +90 -24
  69. package/index169.js +1 -1
  70. package/index169.mjs +72 -217
  71. package/index170.js +1 -1
  72. package/index170.mjs +50 -132
  73. package/index171.js +1 -1
  74. package/index171.mjs +21 -14
  75. package/index172.js +1 -1
  76. package/index172.mjs +30 -4
  77. package/index173.js +1 -1
  78. package/index173.mjs +33 -6
  79. package/index174.js +1 -1
  80. package/index174.mjs +27 -35
  81. package/index175.js +1 -1
  82. package/index175.mjs +215 -17
  83. package/index176.js +1 -1
  84. package/index176.mjs +14 -43
  85. package/index177.js +1 -1
  86. package/index177.mjs +4 -154
  87. package/index178.js +1 -1
  88. package/index178.mjs +6 -100
  89. package/index179.js +1 -1
  90. package/index179.mjs +37 -17
  91. package/index180.js +1 -1
  92. package/index180.mjs +16 -134
  93. package/index181.js +1 -1
  94. package/index181.mjs +40 -93
  95. package/index182.js +1 -1
  96. package/index182.mjs +151 -24
  97. package/index183.js +1 -1
  98. package/index183.mjs +100 -381
  99. package/index184.js +1 -1
  100. package/index184.mjs +16 -94
  101. package/index185.js +1 -1
  102. package/index185.mjs +2 -2
  103. package/index186.js +1 -1
  104. package/index186.mjs +2 -2
  105. package/index189.js +1 -1
  106. package/index189.mjs +2 -2
  107. package/index190.js +1 -1
  108. package/index190.mjs +2 -2
  109. package/index191.js +1 -1
  110. package/index191.mjs +2 -2
  111. package/index192.js +1 -1
  112. package/index192.mjs +1 -1
  113. package/index193.js +1 -1
  114. package/index193.mjs +2 -2
  115. package/index194.js +1 -1
  116. package/index194.mjs +1 -1
  117. package/index195.js +1 -1
  118. package/index195.mjs +1 -1
  119. package/index196.js +1 -1
  120. package/index196.mjs +1 -1
  121. package/index198.js +1 -1
  122. package/index198.mjs +70 -201
  123. package/index199.js +1 -1
  124. package/index199.mjs +91 -60
  125. package/index200.js +1 -1
  126. package/index200.mjs +151 -139
  127. package/index201.js +1 -1
  128. package/index201.mjs +72 -125
  129. package/index202.js +1 -1
  130. package/index202.mjs +38 -220
  131. package/index203.js +1 -1
  132. package/index203.mjs +5 -190
  133. package/index204.js +1 -1
  134. package/index204.mjs +60 -68
  135. package/index205.js +1 -1
  136. package/index205.mjs +53 -273
  137. package/index206.js +1 -1
  138. package/index206.mjs +191 -86
  139. package/index207.js +1 -1
  140. package/index207.mjs +56 -180
  141. package/index208.js +1 -1
  142. package/index208.mjs +134 -75
  143. package/index209.js +1 -1
  144. package/index209.mjs +118 -52
  145. package/index21.js +1 -1
  146. package/index21.mjs +96 -92
  147. package/index210.js +1 -1
  148. package/index210.mjs +214 -116
  149. package/index211.js +1 -1
  150. package/index211.mjs +181 -107
  151. package/index212.js +1 -1
  152. package/index212.mjs +61 -114
  153. package/index213.js +1 -1
  154. package/index213.mjs +272 -65
  155. package/index214.js +1 -1
  156. package/index214.mjs +93 -105
  157. package/index215.js +1 -1
  158. package/index215.mjs +183 -47
  159. package/index216.js +1 -1
  160. package/index216.mjs +77 -86
  161. package/index217.js +1 -1
  162. package/index217.mjs +53 -65
  163. package/index218.js +1 -1
  164. package/index218.mjs +122 -52
  165. package/index219.js +1 -1
  166. package/index219.mjs +111 -94
  167. package/index220.js +1 -5
  168. package/index220.mjs +117 -75
  169. package/index221.js +1 -1
  170. package/index221.mjs +63 -2016
  171. package/index222.js +1 -1
  172. package/index222.mjs +105 -54
  173. package/index223.js +1 -1
  174. package/index223.mjs +50 -186
  175. package/index224.js +1 -1
  176. package/index224.mjs +89 -68
  177. package/index225.js +1 -1
  178. package/index225.mjs +68 -93
  179. package/index226.js +1 -1
  180. package/index226.mjs +52 -151
  181. package/index227.js +1 -1
  182. package/index227.mjs +100 -72
  183. package/index228.js +5 -1
  184. package/index228.mjs +78 -40
  185. package/index229.js +1 -1
  186. package/index229.mjs +2025 -5
  187. package/index230.js +1 -1
  188. package/index230.mjs +59 -61
  189. package/index231.js +1 -1
  190. package/index231.mjs +187 -58
  191. package/index232.js +1 -1
  192. package/index232.mjs +71 -19
  193. package/index233.js +1 -1
  194. package/index233.mjs +45 -20
  195. package/index234.js +1 -1
  196. package/index234.mjs +30 -20
  197. package/index235.js +1 -1
  198. package/index235.mjs +19 -19
  199. package/index236.js +1 -1
  200. package/index236.mjs +19 -19
  201. package/index237.js +1 -1
  202. package/index237.mjs +19 -19
  203. package/index238.js +1 -1
  204. package/index238.mjs +15 -15
  205. package/index239.js +1 -1
  206. package/index239.mjs +19 -19
  207. package/index240.js +1 -1
  208. package/index240.mjs +19 -19
  209. package/index241.js +1 -1
  210. package/index241.mjs +19 -19
  211. package/index242.js +1 -1
  212. package/index242.mjs +16 -16
  213. package/index243.js +1 -1
  214. package/index243.mjs +19 -19
  215. package/index244.js +1 -1
  216. package/index244.mjs +16 -16
  217. package/index245.js +1 -1
  218. package/index245.mjs +16 -16
  219. package/index246.js +1 -1
  220. package/index246.mjs +19 -19
  221. package/index247.js +1 -1
  222. package/index247.mjs +19 -19
  223. package/index248.js +1 -1
  224. package/index248.mjs +19 -19
  225. package/index249.js +1 -1
  226. package/index249.mjs +18 -18
  227. package/index250.js +1 -1
  228. package/index250.mjs +19 -19
  229. package/index251.js +1 -1
  230. package/index251.mjs +19 -19
  231. package/index252.js +1 -1
  232. package/index252.mjs +19 -19
  233. package/index253.js +1 -1
  234. package/index253.mjs +16 -16
  235. package/index254.js +1 -1
  236. package/index254.mjs +19 -19
  237. package/index255.js +1 -1
  238. package/index255.mjs +19 -19
  239. package/index256.js +1 -1
  240. package/index256.mjs +16 -16
  241. package/index257.js +1 -1
  242. package/index257.mjs +18 -18
  243. package/index258.js +1 -1
  244. package/index258.mjs +16 -16
  245. package/index259.js +1 -1
  246. package/index259.mjs +16 -16
  247. package/index260.js +1 -1
  248. package/index260.mjs +16 -16
  249. package/index261.js +1 -1
  250. package/index261.mjs +19 -19
  251. package/index262.js +1 -1
  252. package/index262.mjs +16 -16
  253. package/index263.js +1 -1
  254. package/index263.mjs +15 -15
  255. package/index264.js +1 -1
  256. package/index264.mjs +19 -19
  257. package/index265.js +1 -1
  258. package/index265.mjs +19 -19
  259. package/index266.js +1 -1
  260. package/index266.mjs +19 -71
  261. package/index267.js +1 -1
  262. package/index267.mjs +20 -45
  263. package/index268.js +1 -1
  264. package/index268.mjs +20 -30
  265. package/index270.js +1 -1
  266. package/index270.mjs +1 -1
  267. package/index275.js +1 -1
  268. package/index275.mjs +2 -2
  269. package/index280.js +1 -1
  270. package/index280.mjs +1 -1
  271. package/index283.js +1 -1
  272. package/index283.mjs +1 -1
  273. package/index284.js +1 -1
  274. package/index284.mjs +1 -1
  275. package/index285.js +1 -1
  276. package/index285.mjs +44 -126
  277. package/index286.js +1 -1
  278. package/index286.mjs +16 -191
  279. package/index287.js +1 -1
  280. package/index287.mjs +16 -10
  281. package/index288.js +1 -1
  282. package/index288.mjs +16 -4
  283. package/index289.js +1 -1
  284. package/index289.mjs +16 -37
  285. package/index290.js +1 -1
  286. package/index290.mjs +16 -6
  287. package/index291.js +1 -1
  288. package/index291.mjs +16 -30
  289. package/index292.js +1 -1
  290. package/index292.mjs +16 -7
  291. package/index293.js +1 -1
  292. package/index293.mjs +16 -49
  293. package/index294.js +1 -1
  294. package/index294.mjs +15 -15
  295. package/index295.js +1 -1
  296. package/index295.mjs +15 -15
  297. package/index296.js +1 -1
  298. package/index296.mjs +12 -12
  299. package/index297.js +1 -1
  300. package/index297.mjs +15 -15
  301. package/index298.js +1 -1
  302. package/index298.mjs +15 -15
  303. package/index299.js +1 -1
  304. package/index299.mjs +15 -15
  305. package/index300.js +1 -1
  306. package/index300.mjs +15 -15
  307. package/index301.js +1 -1
  308. package/index301.mjs +15 -15
  309. package/index302.js +1 -1
  310. package/index302.mjs +15 -15
  311. package/index303.js +1 -1
  312. package/index303.mjs +15 -15
  313. package/index304.js +1 -1
  314. package/index304.mjs +12 -12
  315. package/index305.js +1 -1
  316. package/index305.mjs +15 -15
  317. package/index306.js +1 -1
  318. package/index306.mjs +15 -15
  319. package/index307.js +1 -1
  320. package/index307.mjs +15 -15
  321. package/index308.js +1 -1
  322. package/index308.mjs +12 -12
  323. package/index309.js +1 -1
  324. package/index309.mjs +15 -15
  325. package/index310.js +1 -1
  326. package/index310.mjs +15 -15
  327. package/index311.js +1 -1
  328. package/index311.mjs +15 -15
  329. package/index312.js +1 -1
  330. package/index312.mjs +12 -12
  331. package/index313.js +1 -1
  332. package/index313.mjs +15 -15
  333. package/index314.js +1 -1
  334. package/index314.mjs +15 -15
  335. package/index315.js +1 -1
  336. package/index315.mjs +15 -15
  337. package/index316.js +1 -1
  338. package/index316.mjs +12 -12
  339. package/index317.js +1 -1
  340. package/index317.mjs +15 -15
  341. package/index318.js +1 -1
  342. package/index318.mjs +15 -15
  343. package/index319.js +1 -1
  344. package/index319.mjs +12 -12
  345. package/index320.js +1 -1
  346. package/index320.mjs +130 -15
  347. package/index321.js +1 -1
  348. package/index321.mjs +191 -16
  349. package/index322.js +1 -1
  350. package/index322.mjs +10 -16
  351. package/index323.js +1 -1
  352. package/index323.mjs +4 -16
  353. package/index324.js +1 -1
  354. package/index324.mjs +37 -16
  355. package/index325.js +1 -1
  356. package/index325.mjs +6 -16
  357. package/index326.js +1 -1
  358. package/index326.mjs +30 -16
  359. package/index327.js +1 -1
  360. package/index327.mjs +7 -16
  361. package/index328.js +1 -1
  362. package/index328.mjs +1 -1
  363. package/index329.js +1 -1
  364. package/index329.mjs +1 -1
  365. package/index333.js +1 -1
  366. package/index333.mjs +3 -3
  367. package/index339.js +1 -1
  368. package/index339.mjs +1 -1
  369. package/index340.js +1 -1
  370. package/index340.mjs +1 -1
  371. package/index343.js +1 -1
  372. package/index343.mjs +1 -1
  373. package/index345.js +1 -1
  374. package/index345.mjs +8 -6
  375. package/index346.js +1 -1
  376. package/index346.mjs +7 -117
  377. package/index347.js +1 -1
  378. package/index347.mjs +7 -71
  379. package/index348.js +1 -1
  380. package/index348.mjs +7 -7
  381. package/index349.js +1 -1
  382. package/index349.mjs +7 -7
  383. package/index350.js +1 -1
  384. package/index350.mjs +7 -7
  385. package/index351.js +1 -1
  386. package/index351.mjs +4 -4
  387. package/index352.js +1 -1
  388. package/index352.mjs +4 -4
  389. package/index353.js +1 -1
  390. package/index353.mjs +7 -7
  391. package/index354.js +1 -1
  392. package/index354.mjs +4 -4
  393. package/index355.js +1 -1
  394. package/index355.mjs +4 -4
  395. package/index356.js +1 -1
  396. package/index356.mjs +7 -7
  397. package/index357.js +1 -1
  398. package/index357.mjs +7 -7
  399. package/index358.js +1 -1
  400. package/index358.mjs +4 -4
  401. package/index359.js +1 -1
  402. package/index359.mjs +7 -7
  403. package/index360.js +1 -1
  404. package/index360.mjs +4 -4
  405. package/index361.js +1 -1
  406. package/index361.mjs +7 -7
  407. package/index362.js +1 -1
  408. package/index362.mjs +7 -7
  409. package/index363.js +1 -1
  410. package/index363.mjs +7 -7
  411. package/index364.js +1 -1
  412. package/index364.mjs +7 -7
  413. package/index365.js +1 -1
  414. package/index365.mjs +7 -7
  415. package/index366.js +1 -1
  416. package/index366.mjs +4 -4
  417. package/index367.js +1 -1
  418. package/index367.mjs +4 -4
  419. package/index368.js +1 -1
  420. package/index368.mjs +4 -4
  421. package/index369.js +1 -1
  422. package/index369.mjs +7 -7
  423. package/index370.js +1 -1
  424. package/index370.mjs +7 -7
  425. package/index371.js +1 -1
  426. package/index371.mjs +4 -4
  427. package/index372.js +1 -1
  428. package/index372.mjs +7 -7
  429. package/index373.js +1 -1
  430. package/index373.mjs +7 -7
  431. package/index374.js +1 -1
  432. package/index374.mjs +4 -4
  433. package/index375.js +1 -1
  434. package/index375.mjs +7 -7
  435. package/index376.js +1 -1
  436. package/index376.mjs +7 -7
  437. package/index377.js +1 -1
  438. package/index377.mjs +7 -7
  439. package/index378.js +1 -1
  440. package/index378.mjs +7 -7
  441. package/index379.js +1 -1
  442. package/index379.mjs +117 -7
  443. package/index380.js +1 -1
  444. package/index380.mjs +71 -7
  445. package/index381.js +1 -1
  446. package/index381.mjs +6 -8
  447. package/package.json +1 -1
package/index148.mjs CHANGED
@@ -1,109 +1,28 @@
1
- import R from "./index163.mjs";
2
- import { useDatePickerGroup as k } from "./index164.mjs";
3
- import { createFocusManager as E } from "@react-aria/focus";
4
- import { mergeProps as P } from "./index156.mjs";
5
- import { filterDOMProps as V } from "./index165.mjs";
6
- import { useDescription as C } from "./index166.mjs";
7
- import { useFormReset as I } from "./index179.mjs";
8
- import { useRef as g, useMemo as S, useEffect as G } from "react";
9
- import { useField as L } from "./index167.mjs";
10
- import { useFocusWithin as O } from "./index161.mjs";
11
- import { useFormValidation as U } from "./index158.mjs";
12
- import { useLocalizedStringFormatter as j } from "@react-aria/i18n";
13
- function q(e) {
14
- return e && e.__esModule ? e.default : e;
15
- }
16
- const T = /* @__PURE__ */ new WeakMap(), u = "__role_" + Date.now(), z = "__focusManager_" + Date.now();
17
- function re(e, a, l) {
18
- var n;
19
- let { isInvalid: c, validationErrors: f, validationDetails: y } = a.displayValidation, { labelProps: b, fieldProps: d, descriptionProps: D, errorMessageProps: F } = L({
20
- ...e,
21
- labelElementType: "span",
22
- isInvalid: c,
23
- errorMessage: e.errorMessage || f
24
- }), m = g(null), { focusWithinProps: h } = O({
25
- ...e,
26
- onFocusWithin(o) {
27
- var i;
28
- m.current = a.value, (i = e.onFocus) === null || i === void 0 || i.call(e, o);
29
- },
30
- onBlurWithin: (o) => {
31
- var i;
32
- a.confirmPlaceholder(), a.value !== m.current && a.commitValidation(), (i = e.onBlur) === null || i === void 0 || i.call(e, o);
33
- },
34
- onFocusWithinChange: e.onFocusChange
35
- }), x = j(q(R), "@react-aria/datepicker"), M = a.maxGranularity === "hour" ? "selectedTimeDescription" : "selectedDateDescription", _ = a.maxGranularity === "hour" ? "time" : "date", B = a.value ? x.format(M, {
36
- [_]: a.formatValue({
37
- month: "long"
38
- })
39
- }) : "", W = C(B), $ = e[u] === "presentation" ? d["aria-describedby"] : [
40
- W["aria-describedby"],
41
- d["aria-describedby"]
42
- ].filter(Boolean).join(" ") || void 0, p = e[z], r = S(() => p || E(l), [
43
- p,
44
- l
45
- ]), w = k(a, l, e[u] === "presentation");
46
- T.set(a, {
47
- ariaLabel: e["aria-label"],
48
- ariaLabelledBy: [
49
- b.id,
50
- e["aria-labelledby"]
51
- ].filter(Boolean).join(" ") || void 0,
52
- ariaDescribedBy: $,
53
- focusManager: r
54
- });
55
- let v = g(e.autoFocus), s;
56
- e[u] === "presentation" ? s = {
57
- role: "presentation"
58
- } : s = P(d, {
59
- role: "group",
60
- "aria-disabled": e.isDisabled || void 0,
61
- "aria-describedby": $
62
- }), G(() => {
63
- v.current && r.focusFirst(), v.current = !1;
64
- }, [
65
- r
66
- ]), I(e.inputRef, a.value, a.setValue), U({
67
- ...e,
68
- focus() {
69
- r.focusFirst();
70
- }
71
- }, a, e.inputRef);
72
- let t = {
73
- type: "hidden",
74
- name: e.name,
75
- value: ((n = a.value) === null || n === void 0 ? void 0 : n.toString()) || "",
76
- disabled: e.isDisabled
77
- };
78
- e.validationBehavior === "native" && (t.type = "text", t.hidden = !0, t.required = e.isRequired, t.onChange = () => {
79
- });
80
- let K = V(e);
81
- return {
82
- labelProps: {
83
- ...b,
84
- onClick: () => {
85
- r.focusFirst();
86
- }
87
- },
88
- fieldProps: P(K, s, w, h, {
89
- onKeyDown(o) {
90
- e.onKeyDown && e.onKeyDown(o);
91
- },
92
- onKeyUp(o) {
93
- e.onKeyUp && e.onKeyUp(o);
94
- }
95
- }),
96
- inputProps: t,
97
- descriptionProps: D,
98
- errorMessageProps: F,
99
- isInvalid: c,
100
- validationErrors: f,
101
- validationDetails: y
102
- };
1
+ import { useUNSTABLE_PortalContext as f } from "./index336.mjs";
2
+ import { ClearPressResponder as m } from "./index337.mjs";
3
+ import { FocusScope as u } from "@react-aria/focus";
4
+ import o, { useState as $, useMemo as b } from "react";
5
+ import d from "react-dom";
6
+ import { useIsSSR as x } from "./index271.mjs";
7
+ const p = /* @__PURE__ */ o.createContext(null);
8
+ function P(t) {
9
+ let i = x(), { portalContainer: a = i ? null : document.body, isExiting: c } = t, [r, n] = $(!1), s = b(() => ({
10
+ contain: r,
11
+ setContain: n
12
+ }), [
13
+ r,
14
+ n
15
+ ]), { getContainer: l } = f();
16
+ if (!t.portalContainer && l && (a = l()), !a) return null;
17
+ let e = t.children;
18
+ return t.disableFocusManagement || (e = /* @__PURE__ */ o.createElement(u, {
19
+ restoreFocus: !0,
20
+ contain: r && !c
21
+ }, e)), e = /* @__PURE__ */ o.createElement(p.Provider, {
22
+ value: s
23
+ }, /* @__PURE__ */ o.createElement(m, null, e)), /* @__PURE__ */ d.createPortal(e, a);
103
24
  }
104
25
  export {
105
- z as focusManagerSymbol,
106
- T as hookData,
107
- u as roleSymbol,
108
- re as useDateField
26
+ P as Overlay,
27
+ p as OverlayContext
109
28
  };
package/index149.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index180.js"),te=require("./index183.js"),le=require("./index184.js"),J=require("./index170.js"),Q=require("./index152.js"),E=require("./index181.js"),re=require("./index157.js"),ne=require("./index162.js"),s=require("react"),k={year:!0,month:!0,day:!0,hour:!0,minute:!0,second:!0,dayPeriod:!0,era:!0},W={year:5,month:2,day:7,hour:2,minute:15,second:15},ie={dayperiod:"dayPeriod"};function ue(a){let{locale:l,createCalendar:i,hideTimeZone:d,isDisabled:y=!1,isReadOnly:v=!1,isRequired:I=!1,minValue:R,maxValue:T,isDateUnavailable:_}=a,V=a.value||a.defaultValue||a.placeholderValue||null,[h,g]=m.useDefaultProps(V,a.granularity),Z=g||"UTC";if(V&&!(h in V))throw new Error("Invalid granularity "+h+" for value "+V.toString());let K=s.useMemo(()=>new E.DateFormatter(l),[l]),u=s.useMemo(()=>i(K.resolvedOptions().calendar),[i,K]);var C;let[O,j]=ne.useControlledState(a.value,(C=a.defaultValue)!==null&&C!==void 0?C:null,a.onChange),S=s.useMemo(()=>{var e;return(e=m.convertValue(O,u))!==null&&e!==void 0?e:null},[O,u]),[L,w]=s.useState(()=>m.createPlaceholderDate(a.placeholderValue,h,u,g)),X=S||L,U=u.identifier==="gregory"&&X.era==="BC",M=s.useMemo(()=>{var e;return{granularity:h,maxGranularity:(e=a.maxGranularity)!==null&&e!==void 0?e:"year",timeZone:g,hideTimeZone:d,hourCycle:a.hourCycle,showEra:U,shouldForceLeadingZeros:a.shouldForceLeadingZeros}},[a.maxGranularity,h,a.hourCycle,a.shouldForceLeadingZeros,g,d,U]),Y=s.useMemo(()=>m.getFormatOptions({},M),[M]),D=s.useMemo(()=>new E.DateFormatter(l,Y),[l,Y]),x=s.useMemo(()=>D.resolvedOptions(),[D]),c=s.useMemo(()=>D.formatToParts(new Date).filter(e=>k[e.type]).reduce((e,r)=>(e[r.type]=!0,e),{}),[D]),[t,P]=s.useState(()=>a.value||a.defaultValue?{...c}:{}),q=s.useRef(null),A=s.useRef(u.identifier);s.useEffect(()=>{u.identifier!==A.current&&(A.current=u.identifier,w(e=>Object.keys(t).length>0?J.toCalendar(e,u):m.createPlaceholderDate(a.placeholderValue,h,u,g)))},[u,h,t,g,a.placeholderValue]),O&&Object.keys(t).length<Object.keys(c).length&&(t={...c},P(t)),O==null&&Object.keys(t).length===Object.keys(c).length&&(t={},P(t),w(m.createPlaceholderDate(a.placeholderValue,h,u,g)));let n=S&&Object.keys(t).length>=Object.keys(c).length?S:L,b=e=>{if(a.isDisabled||a.isReadOnly)return;let r=Object.keys(t),o=Object.keys(c);e==null?(j(null),w(m.createPlaceholderDate(a.placeholderValue,h,u,g)),P({})):r.length>=o.length||r.length===o.length-1&&c.dayPeriod&&!t.dayPeriod&&q.current!=="dayPeriod"?(e=J.toCalendar(e,(V==null?void 0:V.calendar)||new le.GregorianCalendar),j(e)):w(e),q.current=null},$=s.useMemo(()=>n.toDate(Z),[n,Z]),p=s.useMemo(()=>D.formatToParts($).map(e=>{let r=k[e.type];e.type==="era"&&u.getEras().length===1&&(r=!1);let o=k[e.type]&&!t[e.type],f=k[e.type]?te.getPlaceholder(e.type,e.value,l):null;return{type:ie[e.type]||e.type,text:o?f:e.value,...oe(n,e.type,x),isPlaceholder:o,placeholder:f,isEditable:r}}),[$,t,D,x,n,u,l]);c.era&&t.year&&!t.era?(t.era=!0,P({...t})):!c.era&&t.era&&(delete t.era,P({...t}));let B=e=>{t[e]=!0,e==="year"&&c.era&&(t.era=!0),P({...t})},F=(e,r)=>{if(t[e])b(se(n,e,r,x));else{B(e);let o=Object.keys(t),f=Object.keys(c);(o.length>=f.length||o.length===f.length-1&&c.dayPeriod&&!t.dayPeriod)&&b(n)}},ee=s.useMemo(()=>m.getValidationResult(O,R,T,_,M),[O,R,T,_,M]),N=re.useFormValidationState({...a,value:O,builtinValidation:ee}),z=N.displayValidation.isInvalid,ae=a.validationState||(z?"invalid":null);var G;return{...N,value:S,dateValue:$,calendar:u,setValue:b,segments:p,dateFormatter:D,validationState:ae,isInvalid:z,granularity:h,maxGranularity:(G=a.maxGranularity)!==null&&G!==void 0?G:"year",isDisabled:y,isReadOnly:v,isRequired:I,increment(e){F(e,1)},decrement(e){F(e,-1)},incrementPage(e){F(e,W[e]||1)},decrementPage(e){F(e,-(W[e]||1))},setSegment(e,r){B(e),b(ce(n,e,r,x))},confirmPlaceholder(){if(a.isDisabled||a.isReadOnly)return;let e=Object.keys(t),r=Object.keys(c);e.length===r.length-1&&c.dayPeriod&&!t.dayPeriod&&(t={...c},P(t),b(n.copy()))},clearSegment(e){delete t[e],q.current=e,P({...t});let r=m.createPlaceholderDate(a.placeholderValue,h,u,g),o=n;if(e==="dayPeriod"&&"hour"in n&&"hour"in r){let f=n.hour>=12,H=r.hour>=12;f&&!H?o=n.set({hour:n.hour-12}):!f&&H&&(o=n.set({hour:n.hour+12}))}else e in n&&(o=n.set({[e]:r[e]}));j(null),b(o)},formatValue(e){if(!S)return"";let r=m.getFormatOptions(e,M);return new E.DateFormatter(l,r).format($)},getDateFormatter(e,r){let o={...M,...r},f=m.getFormatOptions({},o);return new E.DateFormatter(e,f)}}}function oe(a,l,i){switch(l){case"era":{let d=a.calendar.getEras();return{value:d.indexOf(a.era),minValue:0,maxValue:d.length-1}}case"year":return{value:a.year,minValue:1,maxValue:a.calendar.getYearsInEra(a)};case"month":return{value:a.month,minValue:Q.getMinimumMonthInYear(a),maxValue:a.calendar.getMonthsInYear(a)};case"day":return{value:a.day,minValue:Q.getMinimumDayInMonth(a),maxValue:a.calendar.getDaysInMonth(a)}}if("hour"in a)switch(l){case"dayPeriod":return{value:a.hour>=12?12:0,minValue:0,maxValue:12};case"hour":if(i.hour12){let d=a.hour>=12;return{value:a.hour,minValue:d?12:0,maxValue:d?23:11}}return{value:a.hour,minValue:0,maxValue:23};case"minute":return{value:a.minute,minValue:0,maxValue:59};case"second":return{value:a.second,minValue:0,maxValue:59}}return{}}function se(a,l,i,d){switch(l){case"era":case"year":case"month":case"day":return a.cycle(l,i,{round:l==="year"})}if("hour"in a)switch(l){case"dayPeriod":{let y=a.hour,v=y>=12;return a.set({hour:v?y-12:y+12})}case"hour":case"minute":case"second":return a.cycle(l,i,{round:l!=="hour",hourCycle:d.hour12?12:24})}throw new Error("Unknown segment: "+l)}function ce(a,l,i,d){switch(l){case"day":case"month":case"year":case"era":return a.set({[l]:i})}if("hour"in a&&typeof i=="number")switch(l){case"dayPeriod":{let y=a.hour,v=y>=12;return i>=12===v?a:a.set({hour:v?y-12:y+12})}case"hour":if(d.hour12){let v=a.hour>=12;!v&&i===12&&(i=0),v&&i<12&&(i+=12)}case"minute":case"second":return a.set({[l]:i})}throw new Error("Unknown segment: "+l)}exports.useDateFieldState=ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./index150.js"),A=require("./index174.js"),G=require("./index175.js"),J=require("./index164.js"),Q=require("./index139.js"),X=require("./index156.js"),Y=require("./index176.js"),g=require("./index177.js"),ee=require("./index178.js"),R=require("./index179.js"),P=require("./index180.js"),re=require("./index181.js"),te=require("./index182.js"),u=require("react"),p=require("@react-aria/i18n"),ae=require("./index183.js");function ie(r,t,n){let l=u.useRef(""),{locale:x}=p.useLocale(),M=A.useDisplayNames(),{ariaLabel:D,ariaLabelledBy:V,ariaDescribedBy:w,focusManager:c}=z.hookData.get(t),f=r.isPlaceholder?"":r.text,h=u.useMemo(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),T=p.useDateFormatter({month:"long",timeZone:h.timeZone}),k=p.useDateFormatter({hour:"numeric",hour12:h.hour12,timeZone:h.timeZone});if(r.type==="month"&&!r.isPlaceholder){let e=T.format(t.dateValue);f=e!==f?`${f} ${e}`:e}else r.type==="hour"&&!r.isPlaceholder&&(f=k.format(t.dateValue));let{spinButtonProps:I}=ae.useSpinButton({value:r.value,textValue:f,minValue:r.minValue,maxValue:r.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!r.isEditable,isRequired:t.isRequired,onIncrement:()=>{l.current="",t.increment(r.type)},onDecrement:()=>{l.current="",t.decrement(r.type)},onIncrementPage:()=>{l.current="",t.incrementPage(r.type)},onDecrementPage:()=>{l.current="",t.decrementPage(r.type)},onIncrementToMax:()=>{l.current="",r.maxValue!==void 0&&t.setSegment(r.type,r.maxValue)},onDecrementToMin:()=>{l.current="",r.minValue!==void 0&&t.setSegment(r.type,r.minValue)}}),d=u.useMemo(()=>new te.NumberParser(x,{maximumFractionDigits:0}),[x]),S=()=>{if(r.text===r.placeholder&&c.focusPrevious(),d.isValidPartialNumber(r.text)&&!t.isReadOnly&&!r.isPlaceholder){let e=r.text.slice(0,-1),a=d.parse(e);e=a===0?"":e,e.length===0||a===0?t.clearSegment(r.type):t.setSegment(r.type,a),l.current=e}else r.type==="dayPeriod"&&t.clearSegment(r.type)},O=e=>{if(e.key==="a"&&(R.isMac()?e.metaKey:e.ctrlKey)&&e.preventDefault(),!(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey))switch(e.key){case"Backspace":case"Delete":e.preventDefault(),e.stopPropagation(),S();break}},{startsWith:m}=p.useFilter({sensitivity:"base"}),y=p.useDateFormatter({hour:"numeric",hour12:!0}),q=u.useMemo(()=>{let e=new Date;return e.setHours(0),y.formatToParts(e).find(a=>a.type==="dayPeriod").value},[y]),C=u.useMemo(()=>{let e=new Date;return e.setHours(12),y.formatToParts(e).find(a=>a.type==="dayPeriod").value},[y]),F=p.useDateFormatter({year:"numeric",era:"narrow",timeZone:"UTC"}),$=u.useMemo(()=>{if(r.type!=="era")return[];let e=J.toCalendar(new G.CalendarDate(1,1,1),t.calendar),a=t.calendar.getEras().map(o=>{let b=e.set({year:1,month:1,day:1,era:o}).toDate("UTC"),_=F.formatToParts(b).find(j=>j.type==="era").value;return{era:o,formatted:_}}),i=ne(a.map(o=>o.formatted));if(i)for(let o of a)o.formatted=o.formatted.slice(i);return a},[F,t.calendar,r.type]),N=e=>{if(t.isDisabled||t.isReadOnly)return;let a=l.current+e;switch(r.type){case"dayPeriod":if(m(q,e))t.setSegment("dayPeriod",0);else if(m(C,e))t.setSegment("dayPeriod",12);else break;c.focusNext();break;case"era":{let i=$.find(o=>m(o.formatted,e));i&&(t.setSegment("era",i.era),c.focusNext());break}case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!d.isValidPartialNumber(a))return;let i=d.parse(a),o=i,b=r.minValue===0;if(r.type==="hour"&&t.dateFormatter.resolvedOptions().hour12){switch(t.dateFormatter.resolvedOptions().hourCycle){case"h11":i>11&&(o=d.parse(e));break;case"h12":b=!1,i>12&&(o=d.parse(e));break}r.value!==void 0&&r.value>=12&&i>1&&(i+=12)}else r.maxValue!==void 0&&i>r.maxValue&&(o=d.parse(e));if(isNaN(i))return;let v=o!==0||b;v&&t.setSegment(r.type,o),r.maxValue!==void 0&&(+(i+"0")>r.maxValue||a.length>=String(r.maxValue).length)?(l.current="",v&&c.focusNext()):l.current=a;break}}},L=()=>{l.current="",n.current&&re.scrollIntoViewport(n.current,{containingElement:ee.getScrollParent(n.current)});let e=window.getSelection();e==null||e.collapse(n.current)},B=u.useRef(typeof document<"u"?document:null);P.useEvent(B,"selectionchange",()=>{var e;let a=window.getSelection();a!=null&&a.anchorNode&&(!((e=n.current)===null||e===void 0)&&e.contains(a==null?void 0:a.anchorNode))&&a.collapse(n.current)});let E=u.useRef("");P.useEvent(n,"beforeinput",e=>{if(n.current)switch(e.preventDefault(),e.inputType){case"deleteContentBackward":case"deleteContentForward":d.isValidPartialNumber(r.text)&&!t.isReadOnly&&S();break;case"insertCompositionText":E.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:e.data!=null&&N(e.data);break}}),P.useEvent(n,"input",e=>{let{inputType:a,data:i}=e;switch(a){case"insertCompositionText":n.current&&(n.current.textContent=E.current),i!=null&&(m(q,i)||m(C,i))&&N(i);break}}),g.useLayoutEffect(()=>{let e=n.current;return()=>{document.activeElement===e&&(c.focusPrevious()||c.focusNext())}},[n,c]);let K=R.isIOS()||r.type==="timeZoneName"?{role:"textbox","aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{},Z=u.useMemo(()=>t.segments.find(e=>e.isEditable),[t.segments]);r!==Z&&!t.isInvalid&&(w=void 0);let H=Q.useId(),s=!t.isDisabled&&!t.isReadOnly&&r.isEditable,W=r.type==="literal"?"":M.of(r.type),U=Y.useLabels({"aria-label":`${W}${D?`, ${D}`:""}${V?", ":""}`,"aria-labelledby":V});return r.type==="literal"?{segmentProps:{"aria-hidden":!0}}:{segmentProps:X.mergeProps(I,U,{id:H,...K,"aria-invalid":t.isInvalid?"true":void 0,"aria-describedby":w,"aria-readonly":t.isReadOnly||!r.isEditable?"true":void 0,"data-placeholder":r.isPlaceholder||void 0,contentEditable:s,suppressContentEditableWarning:s,spellCheck:s?"false":void 0,autoCorrect:s?"off":void 0,[parseInt(u.version,10)>=17?"enterKeyHint":"enterkeyhint"]:s?"next":void 0,inputMode:t.isDisabled||r.type==="dayPeriod"||r.type==="era"||!s?void 0:"numeric",tabIndex:t.isDisabled?void 0:0,onKeyDown:O,onFocus:L,style:{caretColor:"transparent"},onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}function ne(r){r.sort();let t=r[0],n=r[r.length-1];for(let l=0;l<t.length;l++)if(t[l]!==n[l])return l;return 0}exports.useDateSegment=ie;