@senvenli/react 0.0.0-stage → 0.1.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 (636) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/action/button-group.d.ts +26 -0
  4. package/dist/action/button-group.js +12 -0
  5. package/dist/action/button-group.js.map +1 -0
  6. package/dist/action/button.d.ts +42 -0
  7. package/dist/action/button.js +58 -0
  8. package/dist/action/button.js.map +1 -0
  9. package/dist/action/close-button.d.ts +12 -0
  10. package/dist/action/close-button.js +13 -0
  11. package/dist/action/close-button.js.map +1 -0
  12. package/dist/action/copy-button.d.ts +21 -0
  13. package/dist/action/copy-button.js +38 -0
  14. package/dist/action/copy-button.js.map +1 -0
  15. package/dist/action/fab.d.ts +29 -0
  16. package/dist/action/fab.js +57 -0
  17. package/dist/action/fab.js.map +1 -0
  18. package/dist/action/files.d.ts +70 -0
  19. package/dist/action/files.js +156 -0
  20. package/dist/action/files.js.map +1 -0
  21. package/dist/action/index.d.ts +23 -0
  22. package/dist/action/index.js +16 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/language-names.d.ts +19 -0
  25. package/dist/action/language-names.js +79 -0
  26. package/dist/action/language-names.js.map +1 -0
  27. package/dist/action/language-switcher.d.ts +57 -0
  28. package/dist/action/language-switcher.js +53 -0
  29. package/dist/action/language-switcher.js.map +1 -0
  30. package/dist/action/link-button.d.ts +57 -0
  31. package/dist/action/link-button.js +48 -0
  32. package/dist/action/link-button.js.map +1 -0
  33. package/dist/action/link.d.ts +24 -0
  34. package/dist/action/link.js +18 -0
  35. package/dist/action/link.js.map +1 -0
  36. package/dist/action/pressable.d.ts +40 -0
  37. package/dist/action/pressable.js +65 -0
  38. package/dist/action/pressable.js.map +1 -0
  39. package/dist/action/styles.d.ts +60 -0
  40. package/dist/action/styles.js +109 -0
  41. package/dist/action/styles.js.map +1 -0
  42. package/dist/action/theme-script.d.ts +12 -0
  43. package/dist/action/theme-script.js +23 -0
  44. package/dist/action/theme-script.js.map +1 -0
  45. package/dist/action/theme-switcher.d.ts +43 -0
  46. package/dist/action/theme-switcher.js +260 -0
  47. package/dist/action/theme-switcher.js.map +1 -0
  48. package/dist/action/theme-toggle.d.ts +43 -0
  49. package/dist/action/theme-toggle.js +259 -0
  50. package/dist/action/theme-toggle.js.map +1 -0
  51. package/dist/action/toggle.d.ts +44 -0
  52. package/dist/action/toggle.js +28 -0
  53. package/dist/action/toggle.js.map +1 -0
  54. package/dist/action/touch-target.d.ts +9 -0
  55. package/dist/action/touch-target.js +14 -0
  56. package/dist/action/touch-target.js.map +1 -0
  57. package/dist/charts/axis-width.d.ts +186 -0
  58. package/dist/charts/axis-width.js +1262 -0
  59. package/dist/charts/axis-width.js.map +1 -0
  60. package/dist/charts/bar-public.d.ts +16 -0
  61. package/dist/charts/bar-public.js +16 -0
  62. package/dist/charts/bar-public.js.map +1 -0
  63. package/dist/charts/chart-parts.d.ts +136 -0
  64. package/dist/charts/chart-parts.js +160 -0
  65. package/dist/charts/chart-parts.js.map +1 -0
  66. package/dist/charts/core-charts.d.ts +157 -0
  67. package/dist/charts/core-charts.js +505 -0
  68. package/dist/charts/core-charts.js.map +1 -0
  69. package/dist/charts/index.d.ts +12 -0
  70. package/dist/charts/index.js +8 -0
  71. package/dist/charts/index.js.map +1 -0
  72. package/dist/charts/list-charts.d.ts +124 -0
  73. package/dist/charts/list-charts.js +308 -0
  74. package/dist/charts/list-charts.js.map +1 -0
  75. package/dist/charts/more-charts.d.ts +138 -0
  76. package/dist/charts/more-charts.js +284 -0
  77. package/dist/charts/more-charts.js.map +1 -0
  78. package/dist/charts/report-charts.d.ts +138 -0
  79. package/dist/charts/report-charts.js +370 -0
  80. package/dist/charts/report-charts.js.map +1 -0
  81. package/dist/charts/value-tick.d.ts +178 -0
  82. package/dist/charts/value-tick.js +240 -0
  83. package/dist/charts/value-tick.js.map +1 -0
  84. package/dist/collection/data-table-url-hook.d.ts +34 -0
  85. package/dist/collection/data-table-url-hook.js +70 -0
  86. package/dist/collection/data-table-url-hook.js.map +1 -0
  87. package/dist/collection/data-table-url.d.ts +30 -0
  88. package/dist/collection/data-table-url.js +48 -0
  89. package/dist/collection/data-table-url.js.map +1 -0
  90. package/dist/collection/data-table.d.ts +112 -0
  91. package/dist/collection/data-table.js +188 -0
  92. package/dist/collection/data-table.js.map +1 -0
  93. package/dist/collection/grid-list-public.d.ts +18 -0
  94. package/dist/collection/grid-list-public.js +19 -0
  95. package/dist/collection/grid-list-public.js.map +1 -0
  96. package/dist/collection/grid-list.d.ts +73 -0
  97. package/dist/collection/grid-list.js +46 -0
  98. package/dist/collection/grid-list.js.map +1 -0
  99. package/dist/collection/index.d.ts +14 -0
  100. package/dist/collection/index.js +8 -0
  101. package/dist/collection/index.js.map +1 -0
  102. package/dist/collection/list.d.ts +61 -0
  103. package/dist/collection/list.js +38 -0
  104. package/dist/collection/list.js.map +1 -0
  105. package/dist/collection/selection-checkbox.d.ts +5 -0
  106. package/dist/collection/selection-checkbox.js +13 -0
  107. package/dist/collection/selection-checkbox.js.map +1 -0
  108. package/dist/collection/table.d.ts +91 -0
  109. package/dist/collection/table.js +183 -0
  110. package/dist/collection/table.js.map +1 -0
  111. package/dist/collection/tree.d.ts +31 -0
  112. package/dist/collection/tree.js +22 -0
  113. package/dist/collection/tree.js.map +1 -0
  114. package/dist/color/color.d.ts +87 -0
  115. package/dist/color/color.js +200 -0
  116. package/dist/color/color.js.map +1 -0
  117. package/dist/color/contrast.d.ts +34 -0
  118. package/dist/color/contrast.js +44 -0
  119. package/dist/color/contrast.js.map +1 -0
  120. package/dist/color/index.d.ts +4 -0
  121. package/dist/color/index.js +5 -0
  122. package/dist/color/index.js.map +1 -0
  123. package/dist/date/calendar.d.ts +71 -0
  124. package/dist/date/calendar.js +291 -0
  125. package/dist/date/calendar.js.map +1 -0
  126. package/dist/date/fields.d.ts +174 -0
  127. package/dist/date/fields.js +250 -0
  128. package/dist/date/fields.js.map +1 -0
  129. package/dist/date/index.d.ts +7 -0
  130. package/dist/date/index.js +6 -0
  131. package/dist/date/index.js.map +1 -0
  132. package/dist/date/month-grid.d.ts +31 -0
  133. package/dist/date/month-grid.js +115 -0
  134. package/dist/date/month-grid.js.map +1 -0
  135. package/dist/date/pickers.d.ts +118 -0
  136. package/dist/date/pickers.js +176 -0
  137. package/dist/date/pickers.js.map +1 -0
  138. package/dist/date/public.d.ts +25 -0
  139. package/dist/date/public.js +24 -0
  140. package/dist/date/public.js.map +1 -0
  141. package/dist/date/segments.d.ts +153 -0
  142. package/dist/date/segments.js +433 -0
  143. package/dist/date/segments.js.map +1 -0
  144. package/dist/defaults.d.ts +74 -0
  145. package/dist/defaults.js +100 -0
  146. package/dist/defaults.js.map +1 -0
  147. package/dist/density.d.ts +2 -0
  148. package/dist/density.js +2 -0
  149. package/dist/density.js.map +1 -0
  150. package/dist/display/avatar.d.ts +29 -0
  151. package/dist/display/avatar.js +71 -0
  152. package/dist/display/avatar.js.map +1 -0
  153. package/dist/display/badge.d.ts +65 -0
  154. package/dist/display/badge.js +99 -0
  155. package/dist/display/badge.js.map +1 -0
  156. package/dist/display/card.d.ts +72 -0
  157. package/dist/display/card.js +91 -0
  158. package/dist/display/card.js.map +1 -0
  159. package/dist/display/carousel.d.ts +47 -0
  160. package/dist/display/carousel.js +214 -0
  161. package/dist/display/carousel.js.map +1 -0
  162. package/dist/display/description-list.d.ts +25 -0
  163. package/dist/display/description-list.js +36 -0
  164. package/dist/display/description-list.js.map +1 -0
  165. package/dist/display/icon-aliases.d.ts +1 -0
  166. package/dist/display/icon-aliases.js +259 -0
  167. package/dist/display/icon-aliases.js.map +1 -0
  168. package/dist/display/icon-names.d.ts +4 -0
  169. package/dist/display/icon-names.js +2 -0
  170. package/dist/display/icon-names.js.map +1 -0
  171. package/dist/display/icon.d.ts +51 -0
  172. package/dist/display/icon.js +96 -0
  173. package/dist/display/icon.js.map +1 -0
  174. package/dist/display/image-crop.d.ts +106 -0
  175. package/dist/display/image-crop.js +117 -0
  176. package/dist/display/image-crop.js.map +1 -0
  177. package/dist/display/image-cropper.d.ts +68 -0
  178. package/dist/display/image-cropper.js +284 -0
  179. package/dist/display/image-cropper.js.map +1 -0
  180. package/dist/display/image-viewer.d.ts +54 -0
  181. package/dist/display/image-viewer.js +84 -0
  182. package/dist/display/image-viewer.js.map +1 -0
  183. package/dist/display/image.d.ts +26 -0
  184. package/dist/display/image.js +17 -0
  185. package/dist/display/image.js.map +1 -0
  186. package/dist/display/index.d.ts +29 -0
  187. package/dist/display/index.js +16 -0
  188. package/dist/display/index.js.map +1 -0
  189. package/dist/display/iso-chip.d.ts +19 -0
  190. package/dist/display/iso-chip.js +21 -0
  191. package/dist/display/iso-chip.js.map +1 -0
  192. package/dist/display/kbd.d.ts +11 -0
  193. package/dist/display/kbd.js +33 -0
  194. package/dist/display/kbd.js.map +1 -0
  195. package/dist/display/lozenge.d.ts +30 -0
  196. package/dist/display/lozenge.js +55 -0
  197. package/dist/display/lozenge.js.map +1 -0
  198. package/dist/display/scroll-area.d.ts +29 -0
  199. package/dist/display/scroll-area.js +95 -0
  200. package/dist/display/scroll-area.js.map +1 -0
  201. package/dist/display/separator.d.ts +13 -0
  202. package/dist/display/separator.js +24 -0
  203. package/dist/display/separator.js.map +1 -0
  204. package/dist/display/stat.d.ts +35 -0
  205. package/dist/display/stat.js +41 -0
  206. package/dist/display/stat.js.map +1 -0
  207. package/dist/display/timeline.d.ts +44 -0
  208. package/dist/display/timeline.js +111 -0
  209. package/dist/display/timeline.js.map +1 -0
  210. package/dist/display/typography.d.ts +37 -0
  211. package/dist/display/typography.js +53 -0
  212. package/dist/display/typography.js.map +1 -0
  213. package/dist/display/visually-hidden.d.ts +14 -0
  214. package/dist/display/visually-hidden.js +10 -0
  215. package/dist/display/visually-hidden.js.map +1 -0
  216. package/dist/feedback/banner.d.ts +46 -0
  217. package/dist/feedback/banner.js +157 -0
  218. package/dist/feedback/banner.js.map +1 -0
  219. package/dist/feedback/cooldown.d.ts +17 -0
  220. package/dist/feedback/cooldown.js +59 -0
  221. package/dist/feedback/cooldown.js.map +1 -0
  222. package/dist/feedback/empty-state.d.ts +35 -0
  223. package/dist/feedback/empty-state.js +39 -0
  224. package/dist/feedback/empty-state.js.map +1 -0
  225. package/dist/feedback/index.d.ts +12 -0
  226. package/dist/feedback/index.js +11 -0
  227. package/dist/feedback/index.js.map +1 -0
  228. package/dist/feedback/meter.d.ts +33 -0
  229. package/dist/feedback/meter.js +42 -0
  230. package/dist/feedback/meter.js.map +1 -0
  231. package/dist/feedback/motion.d.ts +9 -0
  232. package/dist/feedback/motion.js +57 -0
  233. package/dist/feedback/motion.js.map +1 -0
  234. package/dist/feedback/progress.d.ts +39 -0
  235. package/dist/feedback/progress.js +68 -0
  236. package/dist/feedback/progress.js.map +1 -0
  237. package/dist/feedback/skeleton.d.ts +48 -0
  238. package/dist/feedback/skeleton.js +61 -0
  239. package/dist/feedback/skeleton.js.map +1 -0
  240. package/dist/feedback/spinner.d.ts +19 -0
  241. package/dist/feedback/spinner.js +29 -0
  242. package/dist/feedback/spinner.js.map +1 -0
  243. package/dist/feedback/status-dot.d.ts +23 -0
  244. package/dist/feedback/status-dot.js +37 -0
  245. package/dist/feedback/status-dot.js.map +1 -0
  246. package/dist/form/countries.d.ts +34 -0
  247. package/dist/form/countries.js +273 -0
  248. package/dist/form/countries.js.map +1 -0
  249. package/dist/form/data-attributes.d.ts +11 -0
  250. package/dist/form/data-attributes.js +22 -0
  251. package/dist/form/data-attributes.js.map +1 -0
  252. package/dist/form/field-parts.d.ts +113 -0
  253. package/dist/form/field-parts.js +178 -0
  254. package/dist/form/field-parts.js.map +1 -0
  255. package/dist/form/field.d.ts +36 -0
  256. package/dist/form/field.js +65 -0
  257. package/dist/form/field.js.map +1 -0
  258. package/dist/form/files.d.ts +70 -0
  259. package/dist/form/files.js +156 -0
  260. package/dist/form/files.js.map +1 -0
  261. package/dist/form/form.d.ts +40 -0
  262. package/dist/form/form.js +74 -0
  263. package/dist/form/form.js.map +1 -0
  264. package/dist/form/image-crop.d.ts +106 -0
  265. package/dist/form/image-crop.js +117 -0
  266. package/dist/form/image-crop.js.map +1 -0
  267. package/dist/form/image-cropper.d.ts +68 -0
  268. package/dist/form/image-cropper.js +284 -0
  269. package/dist/form/image-cropper.js.map +1 -0
  270. package/dist/form/index.d.ts +24 -0
  271. package/dist/form/index.js +15 -0
  272. package/dist/form/index.js.map +1 -0
  273. package/dist/form/input-group.d.ts +63 -0
  274. package/dist/form/input-group.js +63 -0
  275. package/dist/form/input-group.js.map +1 -0
  276. package/dist/form/input-otp.d.ts +35 -0
  277. package/dist/form/input-otp.js +83 -0
  278. package/dist/form/input-otp.js.map +1 -0
  279. package/dist/form/input.d.ts +36 -0
  280. package/dist/form/input.js +41 -0
  281. package/dist/form/input.js.map +1 -0
  282. package/dist/form/number-field.d.ts +84 -0
  283. package/dist/form/number-field.js +81 -0
  284. package/dist/form/number-field.js.map +1 -0
  285. package/dist/form/otp-field.d.ts +37 -0
  286. package/dist/form/otp-field.js +116 -0
  287. package/dist/form/otp-field.js.map +1 -0
  288. package/dist/form/password-field.d.ts +61 -0
  289. package/dist/form/password-field.js +61 -0
  290. package/dist/form/password-field.js.map +1 -0
  291. package/dist/form/phone-field.d.ts +104 -0
  292. package/dist/form/phone-field.js +275 -0
  293. package/dist/form/phone-field.js.map +1 -0
  294. package/dist/form/phone-paste.d.ts +24 -0
  295. package/dist/form/phone-paste.js +40 -0
  296. package/dist/form/phone-paste.js.map +1 -0
  297. package/dist/form/phone.d.ts +159 -0
  298. package/dist/form/phone.js +309 -0
  299. package/dist/form/phone.js.map +1 -0
  300. package/dist/form/search-field.d.ts +29 -0
  301. package/dist/form/search-field.js +23 -0
  302. package/dist/form/search-field.js.map +1 -0
  303. package/dist/form/styles.d.ts +31 -0
  304. package/dist/form/styles.js +43 -0
  305. package/dist/form/styles.js.map +1 -0
  306. package/dist/form/text-area.d.ts +70 -0
  307. package/dist/form/text-area.js +93 -0
  308. package/dist/form/text-area.js.map +1 -0
  309. package/dist/form/text-field.d.ts +131 -0
  310. package/dist/form/text-field.js +59 -0
  311. package/dist/form/text-field.js.map +1 -0
  312. package/dist/form/validation.d.ts +145 -0
  313. package/dist/form/validation.js +136 -0
  314. package/dist/form/validation.js.map +1 -0
  315. package/dist/i18n.d.ts +438 -0
  316. package/dist/i18n.js +948 -0
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/index.d.ts +9 -0
  319. package/dist/index.js +7 -0
  320. package/dist/index.js.map +1 -0
  321. package/dist/intl-locale.d.ts +30 -0
  322. package/dist/intl-locale.js +83 -0
  323. package/dist/intl-locale.js.map +1 -0
  324. package/dist/layers.d.ts +32 -0
  325. package/dist/layers.js +33 -0
  326. package/dist/layers.js.map +1 -0
  327. package/dist/layout/auth-form-layout.d.ts +71 -0
  328. package/dist/layout/auth-form-layout.js +61 -0
  329. package/dist/layout/auth-form-layout.js.map +1 -0
  330. package/dist/layout/auth-layout.d.ts +59 -0
  331. package/dist/layout/auth-layout.js +26 -0
  332. package/dist/layout/auth-layout.js.map +1 -0
  333. package/dist/layout/box.d.ts +26 -0
  334. package/dist/layout/box.js +16 -0
  335. package/dist/layout/box.js.map +1 -0
  336. package/dist/layout/grid.d.ts +27 -0
  337. package/dist/layout/grid.js +26 -0
  338. package/dist/layout/grid.js.map +1 -0
  339. package/dist/layout/index.d.ts +16 -0
  340. package/dist/layout/index.js +12 -0
  341. package/dist/layout/index.js.map +1 -0
  342. package/dist/layout/pressable.d.ts +40 -0
  343. package/dist/layout/pressable.js +65 -0
  344. package/dist/layout/pressable.js.map +1 -0
  345. package/dist/layout/reset-sent-card.d.ts +39 -0
  346. package/dist/layout/reset-sent-card.js +22 -0
  347. package/dist/layout/reset-sent-card.js.map +1 -0
  348. package/dist/layout/scroll-area.d.ts +29 -0
  349. package/dist/layout/scroll-area.js +95 -0
  350. package/dist/layout/scroll-area.js.map +1 -0
  351. package/dist/layout/section.d.ts +41 -0
  352. package/dist/layout/section.js +22 -0
  353. package/dist/layout/section.js.map +1 -0
  354. package/dist/layout/split.d.ts +50 -0
  355. package/dist/layout/split.js +35 -0
  356. package/dist/layout/split.js.map +1 -0
  357. package/dist/layout/stack.d.ts +44 -0
  358. package/dist/layout/stack.js +36 -0
  359. package/dist/layout/stack.js.map +1 -0
  360. package/dist/layout/tokens.d.ts +33 -0
  361. package/dist/layout/tokens.js +85 -0
  362. package/dist/layout/tokens.js.map +1 -0
  363. package/dist/layout/toolbar.d.ts +37 -0
  364. package/dist/layout/toolbar.js +334 -0
  365. package/dist/layout/toolbar.js.map +1 -0
  366. package/dist/navigate-context.d.ts +12 -0
  367. package/dist/navigate-context.js +13 -0
  368. package/dist/navigate-context.js.map +1 -0
  369. package/dist/navigation/accordion.d.ts +40 -0
  370. package/dist/navigation/accordion.js +33 -0
  371. package/dist/navigation/accordion.js.map +1 -0
  372. package/dist/navigation/bottom-nav.d.ts +29 -0
  373. package/dist/navigation/bottom-nav.js +48 -0
  374. package/dist/navigation/bottom-nav.js.map +1 -0
  375. package/dist/navigation/brand-link-context.d.ts +8 -0
  376. package/dist/navigation/brand-link-context.js +9 -0
  377. package/dist/navigation/brand-link-context.js.map +1 -0
  378. package/dist/navigation/breadcrumbs.d.ts +36 -0
  379. package/dist/navigation/breadcrumbs.js +51 -0
  380. package/dist/navigation/breadcrumbs.js.map +1 -0
  381. package/dist/navigation/dock.d.ts +27 -0
  382. package/dist/navigation/dock.js +47 -0
  383. package/dist/navigation/dock.js.map +1 -0
  384. package/dist/navigation/footer.d.ts +43 -0
  385. package/dist/navigation/footer.js +43 -0
  386. package/dist/navigation/footer.js.map +1 -0
  387. package/dist/navigation/index.d.ts +22 -0
  388. package/dist/navigation/index.js +17 -0
  389. package/dist/navigation/index.js.map +1 -0
  390. package/dist/navigation/language-names.d.ts +19 -0
  391. package/dist/navigation/language-names.js +79 -0
  392. package/dist/navigation/language-names.js.map +1 -0
  393. package/dist/navigation/language-switcher.d.ts +55 -0
  394. package/dist/navigation/language-switcher.js +53 -0
  395. package/dist/navigation/language-switcher.js.map +1 -0
  396. package/dist/navigation/nav-panel.d.ts +18 -0
  397. package/dist/navigation/nav-panel.js +51 -0
  398. package/dist/navigation/nav-panel.js.map +1 -0
  399. package/dist/navigation/navbar.d.ts +73 -0
  400. package/dist/navigation/navbar.js +64 -0
  401. package/dist/navigation/navbar.js.map +1 -0
  402. package/dist/navigation/page-header.d.ts +37 -0
  403. package/dist/navigation/page-header.js +50 -0
  404. package/dist/navigation/page-header.js.map +1 -0
  405. package/dist/navigation/pagination.d.ts +25 -0
  406. package/dist/navigation/pagination.js +51 -0
  407. package/dist/navigation/pagination.js.map +1 -0
  408. package/dist/navigation/panel-header.d.ts +37 -0
  409. package/dist/navigation/panel-header.js +50 -0
  410. package/dist/navigation/panel-header.js.map +1 -0
  411. package/dist/navigation/sidebar-script.d.ts +12 -0
  412. package/dist/navigation/sidebar-script.js +20 -0
  413. package/dist/navigation/sidebar-script.js.map +1 -0
  414. package/dist/navigation/sidebar.d.ts +149 -0
  415. package/dist/navigation/sidebar.js +332 -0
  416. package/dist/navigation/sidebar.js.map +1 -0
  417. package/dist/navigation/skip-link.d.ts +12 -0
  418. package/dist/navigation/skip-link.js +30 -0
  419. package/dist/navigation/skip-link.js.map +1 -0
  420. package/dist/navigation/stepper.d.ts +50 -0
  421. package/dist/navigation/stepper.js +96 -0
  422. package/dist/navigation/stepper.js.map +1 -0
  423. package/dist/navigation/tabs.d.ts +84 -0
  424. package/dist/navigation/tabs.js +118 -0
  425. package/dist/navigation/tabs.js.map +1 -0
  426. package/dist/navigation/toolbar.d.ts +37 -0
  427. package/dist/navigation/toolbar.js +334 -0
  428. package/dist/navigation/toolbar.js.map +1 -0
  429. package/dist/overlay/alert-dialog.d.ts +63 -0
  430. package/dist/overlay/alert-dialog.js +76 -0
  431. package/dist/overlay/alert-dialog.js.map +1 -0
  432. package/dist/overlay/command-palette.d.ts +53 -0
  433. package/dist/overlay/command-palette.js +130 -0
  434. package/dist/overlay/command-palette.js.map +1 -0
  435. package/dist/overlay/command.d.ts +53 -0
  436. package/dist/overlay/command.js +129 -0
  437. package/dist/overlay/command.js.map +1 -0
  438. package/dist/overlay/context-menu.d.ts +29 -0
  439. package/dist/overlay/context-menu.js +58 -0
  440. package/dist/overlay/context-menu.js.map +1 -0
  441. package/dist/overlay/dialog.d.ts +162 -0
  442. package/dist/overlay/dialog.js +174 -0
  443. package/dist/overlay/dialog.js.map +1 -0
  444. package/dist/overlay/drawer.d.ts +41 -0
  445. package/dist/overlay/drawer.js +114 -0
  446. package/dist/overlay/drawer.js.map +1 -0
  447. package/dist/overlay/floating.d.ts +142 -0
  448. package/dist/overlay/floating.js +226 -0
  449. package/dist/overlay/floating.js.map +1 -0
  450. package/dist/overlay/hover-card.d.ts +19 -0
  451. package/dist/overlay/hover-card.js +31 -0
  452. package/dist/overlay/hover-card.js.map +1 -0
  453. package/dist/overlay/index.d.ts +18 -0
  454. package/dist/overlay/index.js +12 -0
  455. package/dist/overlay/index.js.map +1 -0
  456. package/dist/overlay/overlay-base.d.ts +105 -0
  457. package/dist/overlay/overlay-base.js +250 -0
  458. package/dist/overlay/overlay-base.js.map +1 -0
  459. package/dist/overlay/overlay.d.ts +299 -0
  460. package/dist/overlay/overlay.js +558 -0
  461. package/dist/overlay/overlay.js.map +1 -0
  462. package/dist/overlay/toast.d.ts +58 -0
  463. package/dist/overlay/toast.js +145 -0
  464. package/dist/overlay/toast.js.map +1 -0
  465. package/dist/provider.d.ts +26 -0
  466. package/dist/provider.js +30 -0
  467. package/dist/provider.js.map +1 -0
  468. package/dist/selection/autocomplete.d.ts +54 -0
  469. package/dist/selection/autocomplete.js +122 -0
  470. package/dist/selection/autocomplete.js.map +1 -0
  471. package/dist/selection/checkbox.d.ts +56 -0
  472. package/dist/selection/checkbox.js +49 -0
  473. package/dist/selection/checkbox.js.map +1 -0
  474. package/dist/selection/choice-size.d.ts +26 -0
  475. package/dist/selection/choice-size.js +50 -0
  476. package/dist/selection/choice-size.js.map +1 -0
  477. package/dist/selection/choice-text.d.ts +21 -0
  478. package/dist/selection/choice-text.js +33 -0
  479. package/dist/selection/choice-text.js.map +1 -0
  480. package/dist/selection/combobox.d.ts +173 -0
  481. package/dist/selection/combobox.js +410 -0
  482. package/dist/selection/combobox.js.map +1 -0
  483. package/dist/selection/index.d.ts +20 -0
  484. package/dist/selection/index.js +13 -0
  485. package/dist/selection/index.js.map +1 -0
  486. package/dist/selection/list-box.d.ts +30 -0
  487. package/dist/selection/list-box.js +16 -0
  488. package/dist/selection/list-box.js.map +1 -0
  489. package/dist/selection/listbox.d.ts +44 -0
  490. package/dist/selection/listbox.js +49 -0
  491. package/dist/selection/listbox.js.map +1 -0
  492. package/dist/selection/match.d.ts +20 -0
  493. package/dist/selection/match.js +57 -0
  494. package/dist/selection/match.js.map +1 -0
  495. package/dist/selection/multi-select.d.ts +72 -0
  496. package/dist/selection/multi-select.js +138 -0
  497. package/dist/selection/multi-select.js.map +1 -0
  498. package/dist/selection/radio-card.d.ts +31 -0
  499. package/dist/selection/radio-card.js +29 -0
  500. package/dist/selection/radio-card.js.map +1 -0
  501. package/dist/selection/radio.d.ts +72 -0
  502. package/dist/selection/radio.js +64 -0
  503. package/dist/selection/radio.js.map +1 -0
  504. package/dist/selection/select-public.d.ts +19 -0
  505. package/dist/selection/select-public.js +24 -0
  506. package/dist/selection/select-public.js.map +1 -0
  507. package/dist/selection/select.d.ts +72 -0
  508. package/dist/selection/select.js +69 -0
  509. package/dist/selection/select.js.map +1 -0
  510. package/dist/selection/slider.d.ts +16 -0
  511. package/dist/selection/slider.js +44 -0
  512. package/dist/selection/slider.js.map +1 -0
  513. package/dist/selection/styles.d.ts +26 -0
  514. package/dist/selection/styles.js +78 -0
  515. package/dist/selection/styles.js.map +1 -0
  516. package/dist/selection/switch.d.ts +24 -0
  517. package/dist/selection/switch.js +27 -0
  518. package/dist/selection/switch.js.map +1 -0
  519. package/dist/selection/tag-group.d.ts +38 -0
  520. package/dist/selection/tag-group.js +45 -0
  521. package/dist/selection/tag-group.js.map +1 -0
  522. package/dist/tone.d.ts +6 -0
  523. package/dist/tone.js +2 -0
  524. package/dist/tone.js.map +1 -0
  525. package/dist/utils.d.ts +9 -0
  526. package/dist/utils.js +42 -0
  527. package/dist/utils.js.map +1 -0
  528. package/manifest/component.full.schema.json +391 -0
  529. package/manifest/component.schema.json +279 -0
  530. package/manifests/accordion.json +299 -0
  531. package/manifests/alert-dialog.json +261 -0
  532. package/manifests/area-chart.json +338 -0
  533. package/manifests/autocomplete.json +299 -0
  534. package/manifests/avatar.json +253 -0
  535. package/manifests/badge.json +288 -0
  536. package/manifests/banner.json +185 -0
  537. package/manifests/bar-chart.json +454 -0
  538. package/manifests/bar-list.json +262 -0
  539. package/manifests/bottom-nav.json +139 -0
  540. package/manifests/box.json +3450 -0
  541. package/manifests/breadcrumbs.json +199 -0
  542. package/manifests/button-group.json +2294 -0
  543. package/manifests/button.json +1211 -0
  544. package/manifests/calendar-heatmap.json +218 -0
  545. package/manifests/calendar.json +299 -0
  546. package/manifests/card.json +308 -0
  547. package/manifests/carousel.json +263 -0
  548. package/manifests/chart-parts.json +309 -0
  549. package/manifests/checkbox.json +998 -0
  550. package/manifests/close-button.json +1000 -0
  551. package/manifests/color-field.json +276 -0
  552. package/manifests/color-picker.json +161 -0
  553. package/manifests/color-swatch-picker.json +220 -0
  554. package/manifests/color-swatch.json +140 -0
  555. package/manifests/combobox.json +581 -0
  556. package/manifests/command.json +275 -0
  557. package/manifests/composed-chart.json +287 -0
  558. package/manifests/context-menu.json +148 -0
  559. package/manifests/copy-button.json +192 -0
  560. package/manifests/data-table.json +334 -0
  561. package/manifests/date-field.json +302 -0
  562. package/manifests/date-picker.json +472 -0
  563. package/manifests/description-list.json +201 -0
  564. package/manifests/dialog.json +322 -0
  565. package/manifests/donut-chart.json +264 -0
  566. package/manifests/drawer.json +211 -0
  567. package/manifests/empty-state.json +185 -0
  568. package/manifests/fab.json +172 -0
  569. package/manifests/field.json +209 -0
  570. package/manifests/file-upload.json +791 -0
  571. package/manifests/form.json +829 -0
  572. package/manifests/funnel-chart.json +223 -0
  573. package/manifests/gauge-chart.json +252 -0
  574. package/manifests/grid-list.json +335 -0
  575. package/manifests/grid.json +3482 -0
  576. package/manifests/heading.json +183 -0
  577. package/manifests/heatmap.json +265 -0
  578. package/manifests/hover-card.json +172 -0
  579. package/manifests/icon.json +201 -0
  580. package/manifests/image-cropper.json +295 -0
  581. package/manifests/image-viewer.json +198 -0
  582. package/manifests/image.json +193 -0
  583. package/manifests/index.json +2035 -0
  584. package/manifests/input-group.json +3571 -0
  585. package/manifests/input.json +1557 -0
  586. package/manifests/kbd.json +98 -0
  587. package/manifests/language-switcher.json +274 -0
  588. package/manifests/line-chart.json +342 -0
  589. package/manifests/link.json +867 -0
  590. package/manifests/list-box.json +213 -0
  591. package/manifests/menu.json +453 -0
  592. package/manifests/meter.json +145 -0
  593. package/manifests/navbar.json +281 -0
  594. package/manifests/otp-field.json +1029 -0
  595. package/manifests/page-header.json +164 -0
  596. package/manifests/pagination.json +181 -0
  597. package/manifests/popover.json +205 -0
  598. package/manifests/pressable.json +367 -0
  599. package/manifests/progress.json +282 -0
  600. package/manifests/radar-chart.json +229 -0
  601. package/manifests/radial-chart.json +195 -0
  602. package/manifests/radio.json +975 -0
  603. package/manifests/scatter-chart.json +277 -0
  604. package/manifests/scroll-area.json +127 -0
  605. package/manifests/section.json +169 -0
  606. package/manifests/select.json +474 -0
  607. package/manifests/separator.json +119 -0
  608. package/manifests/sidebar.json +584 -0
  609. package/manifests/skeleton.json +235 -0
  610. package/manifests/skip-link.json +89 -0
  611. package/manifests/slider.json +706 -0
  612. package/manifests/sparkline.json +208 -0
  613. package/manifests/spinner.json +105 -0
  614. package/manifests/split.json +6618 -0
  615. package/manifests/stack.json +3541 -0
  616. package/manifests/stat.json +192 -0
  617. package/manifests/stepper.json +279 -0
  618. package/manifests/switch.json +205 -0
  619. package/manifests/table.json +375 -0
  620. package/manifests/tabs.json +438 -0
  621. package/manifests/tag-group.json +264 -0
  622. package/manifests/text-area.json +1136 -0
  623. package/manifests/text.json +244 -0
  624. package/manifests/theme-switcher.json +152 -0
  625. package/manifests/time-field.json +284 -0
  626. package/manifests/timeline.json +196 -0
  627. package/manifests/toast.json +87 -0
  628. package/manifests/toggle-button.json +1489 -0
  629. package/manifests/toolbar.json +145 -0
  630. package/manifests/tooltip.json +181 -0
  631. package/manifests/tracker.json +192 -0
  632. package/manifests/tree.json +245 -0
  633. package/manifests/visually-hidden.json +114 -0
  634. package/package.json +117 -3
  635. package/styles/base.css +56 -0
  636. package/styles/theme.css +154 -0
@@ -0,0 +1,250 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { DateField as AriaDateField, FormContext, GroupContext, I18nProvider, TimeField as AriaTimeField, useLocale, } from "react-aria-components";
5
+ import { getLocalTimeZone, toTime } from "@internationalized/date";
6
+ import { IconGlyph } from "../display/icon.js";
7
+ import { FieldDescription, FieldError, FieldLabel } from "../form/field-parts.js";
8
+ import { InputGroup } from "../form/input-group.js";
9
+ import { FIELD_ICON, FIELD_STACK } from "../form/styles.js";
10
+ import { useFieldValidation } from "../form/validation.js";
11
+ import { GREGORIAN_MONTHS, Segments } from "./segments.js";
12
+ import { requiredLabel } from "../i18n.js";
13
+ /**
14
+ * Hidden segments per mode: month–day keeps the year at Gregorian 2000 (29 February exists; held as the field's calendar
15
+ * counts it), month keeps the day at 1.
16
+ */
17
+ export function fixedSegments(granularity, hideYear) {
18
+ if (granularity === "month")
19
+ return { day: 1 };
20
+ if (hideYear)
21
+ return { year: 2000 };
22
+ return undefined;
23
+ }
24
+ /**
25
+ * The locale a month–day field (`hideYear`) types in: the app's, unless its calendar has months of its own
26
+ * (fa-IR's Persian, an `-u-ca-islamic-umalqura` or `-u-ca-hebrew` tag); then the same locale in the Gregorian calendar, as a
27
+ * month–day is a Gregorian one (see `hideYear`). Null when the app's locale is the one. The calendar is found as React
28
+ * Aria finds it.
29
+ */
30
+ export function monthDayLocale(locale) {
31
+ try {
32
+ const calendar = new Intl.DateTimeFormat(locale, { dateStyle: "short", timeStyle: "short" }).resolvedOptions().calendar;
33
+ if (GREGORIAN_MONTHS.has(calendar))
34
+ return null;
35
+ return new Intl.Locale(locale, { calendar: "gregory" }).toString();
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ /**
42
+ * Validation for a typed date or time: the form's timing (errors on blur and submit) plus the ones React Aria leaves
43
+ * silent, a day past the month's end, which keeps the value empty but must still say why, and a value
44
+ * typed in part.
45
+ *
46
+ * A date typed in part is no date, and a time typed in part no time. React Aria keeps its last complete value until
47
+ * every segment is cleared, and a hidden year (`hideYear`) is never cleared, so "mm/1" or "aa/1/2026" would still hold
48
+ * the old month, and "10:––" (a TimeField, a range with hours) the old minutes, and the form would save it. Here, as
49
+ * soon as the visible parts are partly empty (or, with a hidden part, all empty) the field reports `onChange(null)`,
50
+ * the value it holds; partly empty, it is also invalid, with what is missing ("Incomplete date: enter the
51
+ * month, or clear the field.", "Incomplete time: enter the minutes…"), on the form's timing, so a DS Form blocks its submit and
52
+ * `validationBehavior` "native" blocks the browser's. React Aria still holds the old date underneath, so the typed parts stay on screen
53
+ * (a controlled `null` would wipe them) and, if the user types that same date again, `onChange` reports it again. A
54
+ * date whose parts are all typed but name no day (31.11, edited from a saved 31.10) holds none either.
55
+ *
56
+ * The value reported always matches the parts on screen, once per change: the parts tell the field what they amount
57
+ * to from a layout effect (see `Segments`' `onReport`), into a ref read by the field's own layout effect in the same
58
+ * commit, so a value React Aria reports is never followed by a null judged on the parts of the render before.
59
+ */
60
+ export function useDateValidation(props) {
61
+ const { locale } = useLocale();
62
+ // One entry per typed part (the two halves of a range report separately): the latest in a ref, for the report below,
63
+ // and the same in state, so the messages render with it.
64
+ const reports = React.useRef({});
65
+ const [shown, setShown] = React.useState({});
66
+ const reporters = React.useRef(new Map());
67
+ const reporter = React.useCallback((part) => {
68
+ let tell = reporters.current.get(part);
69
+ if (!tell) {
70
+ tell = (report) => {
71
+ reports.current = { ...reports.current, [part]: report };
72
+ setShown(reports.current);
73
+ };
74
+ reporters.current.set(part, tell);
75
+ }
76
+ return tell;
77
+ }, []);
78
+ // The value React Aria holds: every change it reports, and every non-null value the app passes.
79
+ const committed = React.useRef(props.value ?? props.defaultValue ?? null);
80
+ if (props.value != null)
81
+ committed.current = props.value;
82
+ // True from the null reported here (a date typed in part) until React Aria or the app gives a value: meanwhile React
83
+ // Aria is handed the date it holds, as a controlled null would wipe the typed parts.
84
+ const holding = React.useRef(false);
85
+ if (props.value != null)
86
+ holding.current = false;
87
+ const selfReport = React.useRef(false);
88
+ // The value as it stands, controlled or not: an empty one is judged here (see below).
89
+ const [own, setOwn] = React.useState(props.defaultValue ?? null);
90
+ const current = props.value !== undefined ? props.value : own;
91
+ const { partial, allEmpty, halfMessage, message: partMessage } = summarize(shown);
92
+ const form = React.useContext(FormContext);
93
+ const native = form?.validationBehavior === "native";
94
+ // Native validation reads React Aria's (old) value, so a required field emptied around its hidden part says so here.
95
+ const nativeRequired = native && allEmpty && committed.current != null && props.isRequired && props.requiredValidation !== "app" ? requiredLabel(locale) : null;
96
+ const overflow = partMessage ?? halfMessage ?? nativeRequired;
97
+ const timing = useFieldValidation({
98
+ // A typed 31.11 leaves the value empty; the overflow message, not "required", is the one to show.
99
+ validate: (value) => overflow ?? props.validate?.(value),
100
+ value: props.value,
101
+ initialValue: props.value ?? props.defaultValue ?? null,
102
+ isRequired: props.isRequired && !overflow,
103
+ requiredValidation: props.requiredValidation,
104
+ onBlur: props.onBlur,
105
+ onChange: (value) => {
106
+ if (!selfReport.current) {
107
+ committed.current = value;
108
+ holding.current = false;
109
+ }
110
+ setOwn(value);
111
+ props.onChange?.(value);
112
+ },
113
+ });
114
+ // Report what the field holds: nothing while it is typed in part, emptied around a hidden part or names no day, and
115
+ // React Aria's date again once the parts are complete and it did not report it itself (the same date typed again).
116
+ // Through the form's own change handler, so blur and submit judge the value reported. Every commit, on the parts as
117
+ // this commit leaves them (their layout effects ran first); the same report for the same value is made once, so an
118
+ // app that keeps its own value does not hear it again on every render.
119
+ const change = React.useRef(timing.onChange);
120
+ change.current = timing.onChange;
121
+ const last = React.useRef(null);
122
+ React.useLayoutEffect(() => {
123
+ const parts = summarize(reports.current);
124
+ let next = null;
125
+ if ((parts.partial || parts.allEmpty || parts.overflowing) && current != null)
126
+ next = { value: null };
127
+ else if (parts.complete && current == null && holding.current && committed.current != null)
128
+ next = { value: committed.current };
129
+ if (!next) {
130
+ last.current = null;
131
+ return;
132
+ }
133
+ if (last.current && last.current.from === current && last.current.to === next.value)
134
+ return;
135
+ last.current = { from: current, to: next.value };
136
+ holding.current = next.value === null;
137
+ selfReport.current = true;
138
+ try {
139
+ change.current?.(next.value);
140
+ }
141
+ finally {
142
+ selfReport.current = false;
143
+ }
144
+ });
145
+ // While the app's value is the null reported here, React Aria keeps the date it holds, so the typed parts stay.
146
+ const held = props.value === null && holding.current && committed.current != null ? committed.current : props.value;
147
+ // React Aria never validates an empty date value, so "required" and an impossible date (both empty)
148
+ // would stay silent. The same timing decides them here; the field is then marked invalid with that message.
149
+ // Under native validation React Aria judges the date it still holds itself, with the message, so it is left to it.
150
+ const racValue = props.value !== undefined ? held : committed.current;
151
+ const emptyError = current == null && !(native && racValue != null) ? (timing.validate?.(null) ?? null) : null;
152
+ const message = Array.isArray(emptyError) ? emptyError.join(" ") : typeof emptyError === "string" ? emptyError : null;
153
+ // `current` is the value the field reports (the app's, when it controls it): the form input follows it (see Segments'
154
+ // `formValue`).
155
+ return { timing, reporter, emptyError: message, value: held, reported: current };
156
+ }
157
+ /**
158
+ * What the typed parts of a field amount to together. A range with one half empty and the other not is a
159
+ * range typed in part too; a whole half left empty names all its parts (with a time, its hour and minutes too), a part
160
+ * missing inside a half is named by that half.
161
+ */
162
+ function summarize(reports) {
163
+ const list = Object.values(reports);
164
+ const shapes = list.map((entry) => entry.shape);
165
+ const partial = shapes.includes("incomplete") || (shapes.includes("empty") && shapes.includes("complete"));
166
+ const allEmpty = shapes.length > 0 && shapes.every((shape) => shape === "empty");
167
+ const overflowing = list.some((entry) => entry.overflowing);
168
+ const complete = shapes.length > 0 && shapes.every((shape) => shape === "complete") && !overflowing;
169
+ const halfMessage = partial && !shapes.includes("incomplete") ? (list.find((entry) => entry.shape === "empty")?.whole ?? null) : null;
170
+ const message = list.find((entry) => entry.message)?.message ?? null;
171
+ return { partial, allEmpty, complete, overflowing, halfMessage, message };
172
+ }
173
+ /**
174
+ * What a field's form input holds for the value it reports: React Aria's string for that value (an ISO
175
+ * date, or date and time), "" for none. See Segments' `formValue`.
176
+ */
177
+ export function formValue(value) {
178
+ return value == null ? "" : value.toString();
179
+ }
180
+ /** A TimeField's form input: the time alone, as React Aria writes it (a zoned date-time's time of day). */
181
+ function timeFormValue(value) {
182
+ return formValue(value && "day" in value ? toTime(value) : value);
183
+ }
184
+ /** Props that mark a field invalid with the empty-value message, keeping the caller's own `isInvalid`. */
185
+ function invalidProps(emptyError, isInvalid, errorMessage) {
186
+ return { isInvalid: emptyError ? true : isInvalid, errorMessage: emptyError ?? errorMessage };
187
+ }
188
+ export { invalidProps };
189
+ /**
190
+ * The frame of a DateField or TimeField. React Aria hands its field props (role=group, the field's id,
191
+ * aria-labelledby, aria-describedby, the focus, press and arrow-key handlers) to every Group under the field, and both
192
+ * the frame (InputGroup) and the segments' DateInput are Groups: the same id was on two role=group elements (invalid
193
+ * HTML, and the field announced as a group twice). The DateInput stays the field's one named group with React Aria's
194
+ * id, exactly as before; the frame keeps the handlers and the bidi isolation it had (so a press on its padding and the
195
+ * keyboard behave as before) but is presentational, with no id and no name of its own.
196
+ */
197
+ function FieldFrame({ isDisabled, isInvalid, children }) {
198
+ const field = React.useContext(GroupContext);
199
+ const frame = React.useMemo(() => {
200
+ if (!field || "slots" in field)
201
+ return field;
202
+ const { id: _id, "aria-labelledby": _labelledBy, "aria-describedby": _describedBy, "aria-label": _label, "aria-details": _details, "aria-disabled": _disabled, ...handlers } = field;
203
+ return { ...handlers, role: "presentation" };
204
+ }, [field]);
205
+ return (_jsx(GroupContext.Provider, { value: frame, children: _jsx(InputGroup, { isDisabled: isDisabled, isInvalid: isInvalid, children: _jsx(GroupContext.Provider, { value: field, children: children }) }) }));
206
+ }
207
+ /**
208
+ * Types a date in segments (day, month, year) in the locale's order, without a calendar: for dates far
209
+ * from today (birth, licence). Typing moves to the next segment, Backspace clears and moves back, arrows
210
+ * step a segment. An impossible date (31.11) stays as typed with an error; it is never moved to another day.
211
+ */
212
+ export function DateField({ label, description, errorMessage, isOptional, granularity = "day", hideYear, validate, onBlur, onChange, value, defaultValue, requiredValidation, id, ...rest }) {
213
+ const fixed = React.useMemo(() => fixedSegments(granularity, hideYear), [granularity, hideYear]);
214
+ const { timing, reporter, emptyError, value: held, reported } = useDateValidation({ validate, value, defaultValue, isRequired: rest.isRequired, requiredValidation, onBlur, onChange });
215
+ const invalid = invalidProps(emptyError, rest.isInvalid, errorMessage);
216
+ const { locale } = useLocale();
217
+ const typedIn = React.useMemo(() => (fixed?.year !== undefined ? monthDayLocale(locale) : null), [fixed, locale]);
218
+ const field = (_jsx(AriaDateField, { ...rest, isInvalid: invalid.isInvalid, value: held, defaultValue: defaultValue, granularity: "day", validationBehavior: timing.validationBehavior, validate: timing.validate, onBlur: timing.onBlur, onChange: timing.onChange, "data-slot": "date-field", "data-granularity": granularity, "data-hide-year": hideYear || undefined, className: FIELD_STACK, children: ({ isInvalid, isDisabled }) => (_jsxs(_Fragment, { children: [_jsx(FieldLabel, { isRequired: rest.isRequired, isOptional: isOptional, children: label }), _jsx(FieldFrame, { isDisabled: isDisabled, isInvalid: isInvalid, children: _jsx(Segments, { fixed: fixed, onReport: reporter("date"), id: id, formValue: formValue(reported) }) }), description && _jsx(FieldDescription, { children: description }), _jsx(FieldError, { children: invalid.errorMessage })] })) }));
219
+ // A month–day in a calendar with months of its own is typed in the Gregorian one (see `hideYear`).
220
+ return typedIn ? _jsx(I18nProvider, { locale: typedIn, children: field }) : field;
221
+ }
222
+ /** "Podgorica (GMT+2)": the city from the zone id and its offset now, in the locale. */
223
+ function zoneLabel(timeZone, locale) {
224
+ const city = (timeZone.split("/").pop() ?? timeZone).replace(/_/g, " ");
225
+ const offset = new Intl.DateTimeFormat(locale, { timeZone, timeZoneName: "shortOffset" })
226
+ .formatToParts(new Date())
227
+ .find((part) => part.type === "timeZoneName")?.value;
228
+ return offset ? `${city} (${offset})` : city;
229
+ }
230
+ /** The zone label, decided after mount: the server does not know the user's zone. */
231
+ function useZoneLabel(timeZone) {
232
+ const { locale } = useLocale();
233
+ const [label, setLabel] = React.useState(null);
234
+ React.useEffect(() => {
235
+ setLabel(timeZone && timeZone !== getLocalTimeZone() ? zoneLabel(timeZone, locale) : null);
236
+ }, [timeZone, locale]);
237
+ return label;
238
+ }
239
+ /**
240
+ * Types a time in segments in the locale's clock (24-hour in most of Europe). Times are the location's: when the
241
+ * user is in another zone, the zone is named at the end of the field ("Podgorica (GMT+2)"). A time typed in part
242
+ * ("10:––") is no time, as on DateField: `onChange(null)` and, on blur or submit, what is missing.
243
+ */
244
+ export function TimeField({ label, description, errorMessage, isOptional, minuteStep, timeZone, validate, onBlur, onChange, value, defaultValue, requiredValidation, id, ...rest }) {
245
+ const zone = useZoneLabel(timeZone);
246
+ const { timing, reporter, emptyError, value: held, reported } = useDateValidation({ validate, value, defaultValue, isRequired: rest.isRequired, requiredValidation, onBlur, onChange });
247
+ const invalid = invalidProps(emptyError, rest.isInvalid, errorMessage);
248
+ return (_jsx(AriaTimeField, { ...rest, isInvalid: invalid.isInvalid, value: held, defaultValue: defaultValue, hideTimeZone: true, validationBehavior: timing.validationBehavior, validate: timing.validate, onBlur: timing.onBlur, onChange: timing.onChange, "data-slot": "time-field", className: FIELD_STACK, children: ({ isInvalid, isDisabled }) => (_jsxs(_Fragment, { children: [_jsx(FieldLabel, { isRequired: rest.isRequired, isOptional: isOptional, children: label }), _jsxs(FieldFrame, { isDisabled: isDisabled, isInvalid: isInvalid, children: [_jsx(IconGlyph, { name: "clock", className: FIELD_ICON, "data-slot": "field-icon" }), _jsx(Segments, { minuteStep: minuteStep, onReport: reporter("time"), id: id, formValue: timeFormValue(reported) }), zone && (_jsx("span", { "data-slot": "time-field-zone", className: "shrink-0 text-body-small text-ds-text-subtlest", children: zone }))] }), description && _jsx(FieldDescription, { children: description }), _jsx(FieldError, { children: invalid.errorMessage })] })) }));
249
+ }
250
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/date/fields.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,SAAS,IAAI,aAAa,EAC1B,SAAS,GAIV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAqB,MAAM,yBAAyB,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAA2C,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAqExC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,WAA4B,EAAE,QAAkB;IAC5E,IAAI,WAAW,KAAK,OAAO;QAAE,OAAO,EAAE,GAAG,EAAE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Field,\n FormContext,\n GroupContext,\n I18nProvider,\n TimeField as AriaTimeField,\n useLocale,\n type DateValue,\n type GroupProps,\n type TimeValue,\n} from \"react-aria-components\";\nimport { getLocalTimeZone, toTime, type CalendarDate } from \"@internationalized/date\";\n\nimport { IconGlyph } from \"../display/icon\";\nimport { FieldDescription, FieldError, FieldLabel } from \"../form/field-parts\";\nimport { InputGroup } from \"../form/input-group\";\nimport { FIELD_ICON, FIELD_STACK } from \"../form/styles\";\nimport { useFieldValidation, type RequiredValidation } from \"../form/validation\";\nimport { GREGORIAN_MONTHS, Segments, type FixedSegments, type SegmentsReport } from \"./segments\";\nimport { requiredLabel } from \"../i18n\";\n\ntype FieldCommon = {\n /** Always given; the label sits above the field and names its segments. */\n label: React.ReactNode;\n description?: React.ReactNode;\n /** What happened and what to do; shown when the field is invalid. */\n errorMessage?: React.ReactNode;\n isRequired?: boolean;\n /**\n * Who says an empty required field is missing: `field` (default) or `app`. With `app` a DS\n * Form's `onSubmit` runs with the field empty, and the app's own error must clear on change. See\n * {@link RequiredValidation} for the whole contract.\n */\n requiredValidation?: RequiredValidation;\n /** Shows \"(optional)\" when most of the form is required. */\n isOptional?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n /** Marks the field invalid from outside (a server error); `errorMessage` says why. */\n isInvalid?: boolean;\n /**\n * The id of the field's first typed segment (day, or the locale's first part), the element that takes focus\n *: `document.getElementById(id).focus()` puts the user in the field, as a focus-on-error does. The\n * field's group gets an id of its own. Left out, the DOM is as before.\n */\n id?: string;\n /** The form field name; the value is submitted as an ISO string. */\n name?: string;\n autoFocus?: boolean;\n onBlur?: (event: React.FocusEvent) => void;\n};\n\nexport type DateFieldProps = FieldCommon & {\n /**\n * A calendar date, no time zone. With `hideYear` its year is 2000 (a leap year, so 29 February exists; see `hideYear`);\n * with `granularity=\"month\"` it is the month's first day.\n *\n * While the user leaves a date typed in part or impossible (\"31.aa.2026\", \"31.11.2026\"), the field reports\n * `onChange(null)` and keeps the typed parts on screen, so setting `null` changes nothing: the value already is null.\n * To clear the field (an app's own \"Temizle\" or form reset), give it a new `key` along with the value: React remounts\n * it empty, or at the value given.\n */\n value?: CalendarDate | null;\n defaultValue?: CalendarDate | null;\n onChange?: (value: CalendarDate | null) => void;\n /** `day` types day, month and year; `month` types month and year (a card's expiry) and the day is 1. */\n granularity?: \"day\" | \"month\";\n /**\n * Day and month only: a yearly date (a campaign day, a birthday reminder). The value is that day in the Gregorian\n * year 2000, a leap year, so 29 February exists, whatever calendar the locale writes dates in:\n * - A calendar with the Gregorian months (the Buddhist one of th-TH, ROC, Japanese): the day and month are typed as\n * the locale writes them, and the hidden year is 2000 as that calendar counts it (2543, Minguo 89, Heisei 12), its\n * era hidden with it.\n * - A calendar with months of its own (Hebrew, Islamic, Persian, Indian, Ethiopic, Coptic, Chinese): one of its days\n * falls on another Gregorian day every year, so no month–day of it is a yearly date the value can hold. The field\n * types the Gregorian day and month instead, in the locale's language and digits.\n *\n * Give `value` and `defaultValue` in 2000 (`new CalendarDate(2000, month, day)`). The field never changes the year it\n * is given: a value in another year keeps it, an edit reports in it, and the day is judged in it, so 29 February typed\n * over a 2023 value says \"February has 28 days.\" and reports null.\n */\n hideYear?: boolean;\n minValue?: CalendarDate;\n maxValue?: CalendarDate;\n /** Your own check; return the message to show, or nothing when the date is fine. */\n validate?: (value: CalendarDate | null) => string | string[] | true | null | undefined;\n};\n\n/**\n * Hidden segments per mode: month–day keeps the year at Gregorian 2000 (29 February exists; held as the field's calendar\n * counts it), month keeps the day at 1.\n */\nexport function fixedSegments(granularity: \"day\" | \"month\", hideYear?: boolean): FixedSegments | undefined {\n if (granularity === \"month\") return { day: 1 };\n if (hideYear) return { year: 2000 };\n return undefined;\n}\n\n/**\n * The locale a month–day field (`hideYear`) types in: the app's, unless its calendar has months of its own\n * (fa-IR's Persian, an `-u-ca-islamic-umalqura` or `-u-ca-hebrew` tag); then the same locale in the Gregorian calendar, as a\n * month–day is a Gregorian one (see `hideYear`). Null when the app's locale is the one. The calendar is found as React\n * Aria finds it.\n */\nexport function monthDayLocale(locale: string): string | null {\n try {\n const calendar = new Intl.DateTimeFormat(locale, { dateStyle: \"short\", timeStyle: \"short\" }).resolvedOptions().calendar;\n if (GREGORIAN_MONTHS.has(calendar)) return null;\n return new Intl.Locale(locale, { calendar: \"gregory\" }).toString();\n } catch {\n return null;\n }\n}\n\n/**\n * Validation for a typed date or time: the form's timing (errors on blur and submit) plus the ones React Aria leaves\n * silent, a day past the month's end, which keeps the value empty but must still say why, and a value\n * typed in part.\n *\n * A date typed in part is no date, and a time typed in part no time. React Aria keeps its last complete value until\n * every segment is cleared, and a hidden year (`hideYear`) is never cleared, so \"mm/1\" or \"aa/1/2026\" would still hold\n * the old month, and \"10:––\" (a TimeField, a range with hours) the old minutes, and the form would save it. Here, as\n * soon as the visible parts are partly empty (or, with a hidden part, all empty) the field reports `onChange(null)`,\n * the value it holds; partly empty, it is also invalid, with what is missing (\"Incomplete date: enter the\n * month, or clear the field.\", \"Incomplete time: enter the minutes…\"), on the form's timing, so a DS Form blocks its submit and\n * `validationBehavior` \"native\" blocks the browser's. React Aria still holds the old date underneath, so the typed parts stay on screen\n * (a controlled `null` would wipe them) and, if the user types that same date again, `onChange` reports it again. A\n * date whose parts are all typed but name no day (31.11, edited from a saved 31.10) holds none either.\n *\n * The value reported always matches the parts on screen, once per change: the parts tell the field what they amount\n * to from a layout effect (see `Segments`' `onReport`), into a ref read by the field's own layout effect in the same\n * commit, so a value React Aria reports is never followed by a null judged on the parts of the render before.\n */\nexport function useDateValidation<T>(props: {\n validate?: (value: T | null) => string | string[] | true | null | undefined;\n value?: T | null;\n defaultValue?: T | null;\n isRequired?: boolean;\n requiredValidation?: RequiredValidation;\n onBlur?: (event: React.FocusEvent) => void;\n onChange?: (value: T | null) => void;\n}) {\n const { locale } = useLocale();\n // One entry per typed part (the two halves of a range report separately): the latest in a ref, for the report below,\n // and the same in state, so the messages render with it.\n const reports = React.useRef<Record<string, SegmentsReport>>({});\n const [shown, setShown] = React.useState<Record<string, SegmentsReport>>({});\n const reporters = React.useRef(new Map<string, (report: SegmentsReport) => void>());\n const reporter = React.useCallback((part: string) => {\n let tell = reporters.current.get(part);\n if (!tell) {\n tell = (report: SegmentsReport) => {\n reports.current = { ...reports.current, [part]: report };\n setShown(reports.current);\n };\n reporters.current.set(part, tell);\n }\n return tell;\n }, []);\n // The value React Aria holds: every change it reports, and every non-null value the app passes.\n const committed = React.useRef<T | null>(props.value ?? props.defaultValue ?? null);\n if (props.value != null) committed.current = props.value;\n // True from the null reported here (a date typed in part) until React Aria or the app gives a value: meanwhile React\n // Aria is handed the date it holds, as a controlled null would wipe the typed parts.\n const holding = React.useRef(false);\n if (props.value != null) holding.current = false;\n const selfReport = React.useRef(false);\n // The value as it stands, controlled or not: an empty one is judged here (see below).\n const [own, setOwn] = React.useState<T | null>(props.defaultValue ?? null);\n const current = props.value !== undefined ? props.value : own;\n const { partial, allEmpty, halfMessage, message: partMessage } = summarize(shown);\n const form = React.useContext(FormContext) as { validationBehavior?: \"aria\" | \"native\" } | null;\n const native = form?.validationBehavior === \"native\";\n // Native validation reads React Aria's (old) value, so a required field emptied around its hidden part says so here.\n const nativeRequired = native && allEmpty && committed.current != null && props.isRequired && props.requiredValidation !== \"app\" ? requiredLabel(locale) : null;\n const overflow = partMessage ?? halfMessage ?? nativeRequired;\n const timing = useFieldValidation<T | null>({\n // A typed 31.11 leaves the value empty; the overflow message, not \"required\", is the one to show.\n validate: (value) => overflow ?? props.validate?.(value),\n value: props.value,\n initialValue: props.value ?? props.defaultValue ?? null,\n isRequired: props.isRequired && !overflow,\n requiredValidation: props.requiredValidation,\n onBlur: props.onBlur,\n onChange: (value) => {\n if (!selfReport.current) {\n committed.current = value;\n holding.current = false;\n }\n setOwn(value);\n props.onChange?.(value);\n },\n });\n // Report what the field holds: nothing while it is typed in part, emptied around a hidden part or names no day, and\n // React Aria's date again once the parts are complete and it did not report it itself (the same date typed again).\n // Through the form's own change handler, so blur and submit judge the value reported. Every commit, on the parts as\n // this commit leaves them (their layout effects ran first); the same report for the same value is made once, so an\n // app that keeps its own value does not hear it again on every render.\n const change = React.useRef(timing.onChange);\n change.current = timing.onChange;\n const last = React.useRef<{ from: T | null; to: T | null } | null>(null);\n React.useLayoutEffect(() => {\n const parts = summarize(reports.current);\n let next: { value: T | null } | null = null;\n if ((parts.partial || parts.allEmpty || parts.overflowing) && current != null) next = { value: null };\n else if (parts.complete && current == null && holding.current && committed.current != null) next = { value: committed.current };\n if (!next) {\n last.current = null;\n return;\n }\n if (last.current && last.current.from === current && last.current.to === next.value) return;\n last.current = { from: current, to: next.value };\n holding.current = next.value === null;\n selfReport.current = true;\n try {\n change.current?.(next.value);\n } finally {\n selfReport.current = false;\n }\n });\n // While the app's value is the null reported here, React Aria keeps the date it holds, so the typed parts stay.\n const held = props.value === null && holding.current && committed.current != null ? committed.current : props.value;\n // React Aria never validates an empty date value, so \"required\" and an impossible date (both empty)\n // would stay silent. The same timing decides them here; the field is then marked invalid with that message.\n // Under native validation React Aria judges the date it still holds itself, with the message, so it is left to it.\n const racValue = props.value !== undefined ? held : committed.current;\n const emptyError = current == null && !(native && racValue != null) ? (timing.validate?.(null) ?? null) : null;\n const message = Array.isArray(emptyError) ? emptyError.join(\" \") : typeof emptyError === \"string\" ? emptyError : null;\n // `current` is the value the field reports (the app's, when it controls it): the form input follows it (see Segments'\n // `formValue`).\n return { timing, reporter, emptyError: message, value: held, reported: current };\n}\n\n/**\n * What the typed parts of a field amount to together. A range with one half empty and the other not is a\n * range typed in part too; a whole half left empty names all its parts (with a time, its hour and minutes too), a part\n * missing inside a half is named by that half.\n */\nfunction summarize(reports: Record<string, SegmentsReport>) {\n const list = Object.values(reports);\n const shapes = list.map((entry) => entry.shape);\n const partial = shapes.includes(\"incomplete\") || (shapes.includes(\"empty\") && shapes.includes(\"complete\"));\n const allEmpty = shapes.length > 0 && shapes.every((shape) => shape === \"empty\");\n const overflowing = list.some((entry) => entry.overflowing);\n const complete = shapes.length > 0 && shapes.every((shape) => shape === \"complete\") && !overflowing;\n const halfMessage = partial && !shapes.includes(\"incomplete\") ? (list.find((entry) => entry.shape === \"empty\")?.whole ?? null) : null;\n const message = list.find((entry) => entry.message)?.message ?? null;\n return { partial, allEmpty, complete, overflowing, halfMessage, message };\n}\n\n/**\n * What a field's form input holds for the value it reports: React Aria's string for that value (an ISO\n * date, or date and time), \"\" for none. See Segments' `formValue`.\n */\nexport function formValue(value: { toString(): string } | null | undefined): string {\n return value == null ? \"\" : value.toString();\n}\n\n/** A TimeField's form input: the time alone, as React Aria writes it (a zoned date-time's time of day). */\nfunction timeFormValue(value: TimeValue | null | undefined): string {\n return formValue(value && \"day\" in value ? toTime(value) : value);\n}\n\n/** Props that mark a field invalid with the empty-value message, keeping the caller's own `isInvalid`. */\nfunction invalidProps(emptyError: string | null, isInvalid: boolean | undefined, errorMessage: React.ReactNode) {\n return { isInvalid: emptyError ? true : isInvalid, errorMessage: emptyError ?? errorMessage };\n}\nexport { invalidProps };\n\n/**\n * The frame of a DateField or TimeField. React Aria hands its field props (role=group, the field's id,\n * aria-labelledby, aria-describedby, the focus, press and arrow-key handlers) to every Group under the field, and both\n * the frame (InputGroup) and the segments' DateInput are Groups: the same id was on two role=group elements (invalid\n * HTML, and the field announced as a group twice). The DateInput stays the field's one named group with React Aria's\n * id, exactly as before; the frame keeps the handlers and the bidi isolation it had (so a press on its padding and the\n * keyboard behave as before) but is presentational, with no id and no name of its own.\n */\nfunction FieldFrame({ isDisabled, isInvalid, children }: { isDisabled: boolean; isInvalid: boolean; children: React.ReactNode }) {\n const field = React.useContext(GroupContext);\n const frame = React.useMemo(() => {\n if (!field || \"slots\" in field) return field;\n const { id: _id, \"aria-labelledby\": _labelledBy, \"aria-describedby\": _describedBy, \"aria-label\": _label, \"aria-details\": _details, \"aria-disabled\": _disabled, ...handlers } =\n field as GroupProps & { \"aria-disabled\"?: boolean | \"true\" | \"false\" };\n return { ...handlers, role: \"presentation\" } as GroupProps;\n }, [field]);\n return (\n <GroupContext.Provider value={frame}>\n <InputGroup isDisabled={isDisabled} isInvalid={isInvalid}>\n <GroupContext.Provider value={field}>{children}</GroupContext.Provider>\n </InputGroup>\n </GroupContext.Provider>\n );\n}\n\n/**\n * Types a date in segments (day, month, year) in the locale's order, without a calendar: for dates far\n * from today (birth, licence). Typing moves to the next segment, Backspace clears and moves back, arrows\n * step a segment. An impossible date (31.11) stays as typed with an error; it is never moved to another day.\n */\nexport function DateField({\n label, description, errorMessage, isOptional, granularity = \"day\", hideYear, validate, onBlur, onChange, value, defaultValue, requiredValidation, id, ...rest\n}: DateFieldProps) {\n const fixed = React.useMemo(() => fixedSegments(granularity, hideYear), [granularity, hideYear]);\n const { timing, reporter, emptyError, value: held, reported } = useDateValidation<CalendarDate>({ validate, value, defaultValue, isRequired: rest.isRequired, requiredValidation, onBlur, onChange });\n const invalid = invalidProps(emptyError, rest.isInvalid, errorMessage);\n const { locale } = useLocale();\n const typedIn = React.useMemo(() => (fixed?.year !== undefined ? monthDayLocale(locale) : null), [fixed, locale]);\n const field = (\n <AriaDateField<CalendarDate>\n {...rest}\n isInvalid={invalid.isInvalid}\n value={held}\n defaultValue={defaultValue}\n granularity=\"day\"\n validationBehavior={timing.validationBehavior}\n validate={timing.validate as (value: DateValue | null) => string | string[] | true | null | undefined}\n onBlur={timing.onBlur}\n onChange={timing.onChange as (value: CalendarDate | null) => void}\n data-slot=\"date-field\"\n data-granularity={granularity}\n data-hide-year={hideYear || undefined}\n className={FIELD_STACK}\n >\n {({ isInvalid, isDisabled }) => (\n <>\n <FieldLabel isRequired={rest.isRequired} isOptional={isOptional}>{label}</FieldLabel>\n <FieldFrame isDisabled={isDisabled} isInvalid={isInvalid}>\n <Segments fixed={fixed} onReport={reporter(\"date\")} id={id} formValue={formValue(reported)} />\n </FieldFrame>\n {description && <FieldDescription>{description}</FieldDescription>}\n <FieldError>{invalid.errorMessage}</FieldError>\n </>\n )}\n </AriaDateField>\n );\n // A month–day in a calendar with months of its own is typed in the Gregorian one (see `hideYear`).\n return typedIn ? <I18nProvider locale={typedIn}>{field}</I18nProvider> : field;\n}\n\nexport type TimeFieldProps = FieldCommon & {\n /**\n * A time, or a zoned date-time when a location's zone travels with it.\n *\n * While the user leaves a time typed in part (\"10:––\"), the field reports `onChange(null)` and keeps the typed parts\n * on screen, so setting `null` changes nothing: the value already is null. To clear the field (an app's own \"Temizle\"\n * or form reset), give it a new `key` along with the value: React remounts it empty, or at the value given\n *.\n */\n value?: TimeValue | null;\n defaultValue?: TimeValue | null;\n onChange?: (value: TimeValue | null) => void;\n /** 24-hour in tr and me, 12-hour in en-US; from the locale unless set. */\n hourCycle?: 12 | 24;\n granularity?: \"minute\" | \"hour\";\n /** Arrow keys step the minutes by this much (15 or 30). */\n minuteStep?: number;\n /** The location's zone (IANA, \"Europe/Lisbon\"). Named after the time when it differs from the user's. */\n timeZone?: string;\n minValue?: TimeValue;\n maxValue?: TimeValue;\n validate?: (value: TimeValue | null) => string | string[] | true | null | undefined;\n};\n\n/** \"Podgorica (GMT+2)\": the city from the zone id and its offset now, in the locale. */\nfunction zoneLabel(timeZone: string, locale: string) {\n const city = (timeZone.split(\"/\").pop() ?? timeZone).replace(/_/g, \" \");\n const offset = new Intl.DateTimeFormat(locale, { timeZone, timeZoneName: \"shortOffset\" })\n .formatToParts(new Date())\n .find((part) => part.type === \"timeZoneName\")?.value;\n return offset ? `${city} (${offset})` : city;\n}\n\n/** The zone label, decided after mount: the server does not know the user's zone. */\nfunction useZoneLabel(timeZone: string | undefined) {\n const { locale } = useLocale();\n const [label, setLabel] = React.useState<string | null>(null);\n React.useEffect(() => {\n setLabel(timeZone && timeZone !== getLocalTimeZone() ? zoneLabel(timeZone, locale) : null);\n }, [timeZone, locale]);\n return label;\n}\n\n/**\n * Types a time in segments in the locale's clock (24-hour in most of Europe). Times are the location's: when the\n * user is in another zone, the zone is named at the end of the field (\"Podgorica (GMT+2)\"). A time typed in part\n * (\"10:––\") is no time, as on DateField: `onChange(null)` and, on blur or submit, what is missing.\n */\nexport function TimeField({\n label, description, errorMessage, isOptional, minuteStep, timeZone, validate, onBlur, onChange, value, defaultValue, requiredValidation, id, ...rest\n}: TimeFieldProps) {\n const zone = useZoneLabel(timeZone);\n const { timing, reporter, emptyError, value: held, reported } = useDateValidation<TimeValue>({ validate, value, defaultValue, isRequired: rest.isRequired, requiredValidation, onBlur, onChange });\n const invalid = invalidProps(emptyError, rest.isInvalid, errorMessage);\n return (\n <AriaTimeField<TimeValue>\n {...rest}\n isInvalid={invalid.isInvalid}\n value={held}\n defaultValue={defaultValue}\n hideTimeZone\n validationBehavior={timing.validationBehavior}\n validate={timing.validate as (value: TimeValue | null) => string | string[] | true | null | undefined}\n onBlur={timing.onBlur}\n onChange={timing.onChange as (value: TimeValue | null) => void}\n data-slot=\"time-field\"\n className={FIELD_STACK}\n >\n {({ isInvalid, isDisabled }) => (\n <>\n <FieldLabel isRequired={rest.isRequired} isOptional={isOptional}>{label}</FieldLabel>\n <FieldFrame isDisabled={isDisabled} isInvalid={isInvalid}>\n <IconGlyph name=\"clock\" className={FIELD_ICON} data-slot=\"field-icon\" />\n <Segments minuteStep={minuteStep} onReport={reporter(\"time\")} id={id} formValue={timeFormValue(reported)} />\n {zone && (\n <span data-slot=\"time-field-zone\" className=\"shrink-0 text-body-small text-ds-text-subtlest\">{zone}</span>\n )}\n </FieldFrame>\n {description && <FieldDescription>{description}</FieldDescription>}\n <FieldError>{invalid.errorMessage}</FieldError>\n </>\n )}\n </AriaTimeField>\n );\n}\n\n"]}
@@ -0,0 +1,7 @@
1
+ export { Calendar, DatePicker } from "./public.js";
2
+ export type { CalendarProps, CalendarRangeProps, CalendarSingleProps, DatePickerProps, DatePickerRangeProps, DatePickerSingleProps } from "./public.js";
3
+ export type { DateMarker, DateRange, FirstDayOfWeek } from "./calendar.js";
4
+ export { DateField, TimeField } from "./fields.js";
5
+ export type { DateFieldProps, TimeFieldProps } from "./fields.js";
6
+ export type { DateRangePickerValue } from "./pickers.js";
7
+ export { parseDate, parseTime } from "@internationalized/date";
@@ -0,0 +1,6 @@
1
+ // @senvenli/react/date: Calendar and DatePicker (each `selectionMode="single" | "range"`); DateField and TimeField.
2
+ // Apps take parseDate / parseTime from here, not @internationalized/date directly.
3
+ export { Calendar, DatePicker } from "./public.js";
4
+ export { DateField, TimeField } from "./fields.js";
5
+ export { parseDate, parseTime } from "@internationalized/date";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,mFAAmF;AACnF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["// @senvenli/react/date: Calendar and DatePicker (each `selectionMode=\"single\" | \"range\"`); DateField and TimeField.\n// Apps take parseDate / parseTime from here, not @internationalized/date directly.\nexport { Calendar, DatePicker } from \"./public\";\nexport type { CalendarProps, CalendarRangeProps, CalendarSingleProps, DatePickerProps, DatePickerRangeProps, DatePickerSingleProps } from \"./public\";\nexport type { DateMarker, DateRange, FirstDayOfWeek } from \"./calendar\";\nexport { DateField, TimeField } from \"./fields\";\nexport type { DateFieldProps, TimeFieldProps } from \"./fields\";\nexport type { DateRangePickerValue } from \"./pickers\";\nexport { parseDate, parseTime } from \"@internationalized/date\";\n"]}
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ import { CalendarDate } from "@internationalized/date";
3
+ /**
4
+ * A month as one number (year × 12 + month index), so stepping by a month, a row or a year is arithmetic and a
5
+ * step past December lands in the next year's January.
6
+ */
7
+ type MonthIndex = number;
8
+ /** Inclusive month range from the picker's bounds (only their year and month count). */
9
+ export declare function monthRange(minValue?: CalendarDate, maxValue?: CalendarDate): {
10
+ min: number;
11
+ max: number;
12
+ contains: (index: MonthIndex) => boolean;
13
+ };
14
+ export type MonthGridProps = {
15
+ minValue?: CalendarDate;
16
+ maxValue?: CalendarDate;
17
+ /** "This month" in the location's zone; the device's by default. */
18
+ timeZone?: string;
19
+ /** Close the picker once a month is picked (default). */
20
+ shouldCloseOnSelect?: boolean;
21
+ };
22
+ /**
23
+ * DatePicker `granularity="month"`: the popover's year stepper over a grid of the twelve months,
24
+ * in place of the day calendar. Internal to the DS (not exported). A `role="grid"` like the Calendar's: each
25
+ * month a button named "Ocak 2026" that shows "Oca", the chosen one `aria-selected` on its cell, this month
26
+ * underlined, months outside the bounds disabled. Arrows move a month (left and right follow the reading
27
+ * direction) or a row of three, across years; Home and End go to the row's ends, Page Up and Page Down a year.
28
+ * Focus starts on the chosen month, else this month.
29
+ */
30
+ export declare function MonthGrid({ minValue, maxValue, timeZone, shouldCloseOnSelect }: MonthGridProps): React.JSX.Element;
31
+ export {};
@@ -0,0 +1,115 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Button as AriaButton, ButtonContext, DatePickerStateContext, useLocale } from "react-aria-components";
5
+ import { CalendarDate, getLocalTimeZone, today as todayIn } from "@internationalized/date";
6
+ import { cn } from "../utils.js";
7
+ import { IconGlyph } from "../display/icon.js";
8
+ import { formatDateTime, nextYearLabel, previousYearLabel } from "../i18n.js";
9
+ const toIndex = (date) => date.year * 12 + date.month - 1;
10
+ const toDate = (index) => new CalendarDate(Math.floor(index / 12), (index % 12) + 1, 1);
11
+ /** Three months a row, four rows: the quarters. */
12
+ const COLUMNS = 3;
13
+ const NAV = "grid size-ds-control-compact cursor-pointer place-items-center rounded-ds-control-medium text-ds-icon outline-hidden " +
14
+ "data-[hovered]:bg-ds-background-neutral-subtle-hovered data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused " +
15
+ "data-[disabled]:cursor-default data-[disabled]:opacity-40";
16
+ /** A month tile: the Calendar's day cell, as wide as a third of the 252px grid. */
17
+ const MONTH = "grid h-ds-control w-full cursor-pointer place-items-center rounded-ds-control-medium px-ds-050 text-body text-ds-text outline-hidden select-none " +
18
+ "data-[hovered]:bg-ds-background-neutral-subtle-hovered " +
19
+ "data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused " +
20
+ "data-[disabled]:cursor-default data-[disabled]:text-ds-text-disabled";
21
+ const MONTH_SELECTED = "bg-ds-background-brand-bold font-medium text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered";
22
+ /** Inclusive month range from the picker's bounds (only their year and month count). */
23
+ export function monthRange(minValue, maxValue) {
24
+ const min = minValue ? toIndex(minValue) : -Infinity;
25
+ const max = maxValue ? toIndex(maxValue) : Infinity;
26
+ return { min, max, contains: (index) => index >= min && index <= max };
27
+ }
28
+ /**
29
+ * DatePicker `granularity="month"`: the popover's year stepper over a grid of the twelve months,
30
+ * in place of the day calendar. Internal to the DS (not exported). A `role="grid"` like the Calendar's: each
31
+ * month a button named "Ocak 2026" that shows "Oca", the chosen one `aria-selected` on its cell, this month
32
+ * underlined, months outside the bounds disabled. Arrows move a month (left and right follow the reading
33
+ * direction) or a row of three, across years; Home and End go to the row's ends, Page Up and Page Down a year.
34
+ * Focus starts on the chosen month, else this month.
35
+ */
36
+ export function MonthGrid({ minValue, maxValue, timeZone, shouldCloseOnSelect = true }) {
37
+ const state = React.useContext(DatePickerStateContext);
38
+ const { locale, direction } = useLocale();
39
+ const range = monthRange(minValue, maxValue);
40
+ const value = state?.value;
41
+ const chosen = value ? toIndex(value) : null;
42
+ const clamp = (index) => Math.min(Math.max(index, range.min), range.max);
43
+ // The popover only renders in the browser, so "today" is safe to read here for the first focus.
44
+ const [focused, setFocused] = React.useState(() => clamp(chosen ?? toIndex(todayIn(timeZone ?? getLocalTimeZone()))));
45
+ // This month, underlined: known after mount (the server's clock and zone would disagree).
46
+ const [current, setCurrent] = React.useState(null);
47
+ React.useEffect(() => setCurrent(toIndex(todayIn(timeZone ?? getLocalTimeZone()))), [timeZone]);
48
+ const buttons = React.useRef(new Map());
49
+ // Keyboard moves (and opening) take focus to the month; the year buttons keep it where it is (see stepYear).
50
+ const moveFocus = React.useRef(true);
51
+ React.useLayoutEffect(() => {
52
+ if (!moveFocus.current)
53
+ return;
54
+ moveFocus.current = false;
55
+ buttons.current.get(focused)?.focus();
56
+ }, [focused]);
57
+ const year = Math.floor(focused / 12);
58
+ const yearText = new Intl.DateTimeFormat(locale, { year: "numeric", timeZone: "UTC" }).format(Date.UTC(year, 0, 1));
59
+ const short = (when) => formatDateTime(locale, { month: "short", timeZone: "UTC" }, when);
60
+ const long = (when) => formatDateTime(locale, { month: "long", year: "numeric", timeZone: "UTC" }, when);
61
+ const go = (index, focus = true) => {
62
+ moveFocus.current = focus;
63
+ setFocused(clamp(index));
64
+ };
65
+ const previousDisabled = (at) => Math.floor(at / 12) * 12 - 1 < range.min;
66
+ const nextDisabled = (at) => (Math.floor(at / 12) + 1) * 12 > range.max;
67
+ // A year button keeps focus, unless the step takes it to a bound and disables it: then focus goes to the
68
+ // focused month, as the day Calendar does, so it never falls to the page (where Esc no longer closes).
69
+ const stepYear = (by, disables) => {
70
+ const target = clamp(focused + by);
71
+ go(target, disables(target));
72
+ };
73
+ const pick = (index) => {
74
+ state?.setValue(toDate(index));
75
+ if (shouldCloseOnSelect)
76
+ state?.close();
77
+ };
78
+ const onKeyDown = (event) => {
79
+ const forward = direction === "rtl" ? -1 : 1;
80
+ const column = ((focused % 12) + 12) % COLUMNS;
81
+ const steps = {
82
+ ArrowRight: forward,
83
+ ArrowLeft: -forward,
84
+ ArrowDown: COLUMNS,
85
+ ArrowUp: -COLUMNS,
86
+ Home: -column,
87
+ End: COLUMNS - 1 - column,
88
+ PageDown: 12,
89
+ PageUp: -12,
90
+ };
91
+ const step = steps[event.key];
92
+ if (step === undefined)
93
+ return;
94
+ event.preventDefault();
95
+ event.stopPropagation();
96
+ go(focused + step);
97
+ };
98
+ const rows = Array.from({ length: 12 / COLUMNS }, (_, row) => Array.from({ length: COLUMNS }, (_, column) => year * 12 + row * COLUMNS + column));
99
+ return (
100
+ // The picker's own button context (its calendar button) must not reach these buttons.
101
+ _jsx(ButtonContext.Provider, { value: null, children: _jsxs("div", { "data-slot": "month-grid", dir: direction === "ltr" ? "ltr" : undefined, className: "flex w-63 max-w-full flex-col gap-ds-100", children: [_jsxs("div", { "data-slot": "month-grid-header", className: "flex items-center justify-between gap-ds-100", children: [_jsx(AriaButton, { "aria-label": previousYearLabel(locale), "data-slot": "month-grid-previous", isDisabled: previousDisabled(focused), onPress: () => stepYear(-12, previousDisabled), className: NAV, children: _jsx(IconGlyph, { name: "chevron-left" }) }), _jsx("span", { "data-slot": "month-grid-year", "aria-live": "polite", className: "text-heading-xsmall tabular-nums", children: yearText }), _jsx(AriaButton, { "aria-label": nextYearLabel(locale), "data-slot": "month-grid-next", isDisabled: nextDisabled(focused), onPress: () => stepYear(12, nextDisabled), className: NAV, children: _jsx(IconGlyph, { name: "chevron-right" }) })] }), _jsx("div", { role: "grid", "aria-label": yearText, "data-slot": "month-grid-months", className: "flex flex-col gap-ds-050", onKeyDown: onKeyDown, children: rows.map((months, row) => (_jsx("div", { role: "row", className: "grid grid-cols-3 gap-ds-050", children: months.map((index) => {
102
+ const when = Date.UTC(Math.floor(index / 12), index % 12, 1);
103
+ const selected = index === chosen;
104
+ return (_jsx("div", { role: "gridcell", "aria-selected": selected, "data-slot": "month-grid-cell", className: "flex", children: _jsx(AriaButton, { ref: (element) => {
105
+ if (element)
106
+ buttons.current.set(index, element);
107
+ else
108
+ buttons.current.delete(index);
109
+ }, "aria-label": long(when), "aria-current": index === current ? "date" : undefined, "data-slot": "month-grid-month", "data-selected": selected || undefined, excludeFromTabOrder: index !== focused, isDisabled: !range.contains(index), onFocus: () => {
110
+ if (index !== focused)
111
+ go(index, false);
112
+ }, onPress: () => pick(index), className: cn(MONTH, selected && MONTH_SELECTED, index === current && "underline underline-offset-3"), children: short(when) }) }, index));
113
+ }) }, row))) })] }) }));
114
+ }
115
+ //# sourceMappingURL=month-grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month-grid.js","sourceRoot":"","sources":["../../src/date/month-grid.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,aAAa,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAO3E,MAAM,OAAO,GAAG,CAAC,IAAqC,EAAc,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACvG,MAAM,MAAM,GAAG,CAAC,KAAiB,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpG,mDAAmD;AACnD,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,MAAM,GAAG,GACP,uHAAuH;IACvH,6IAA6I;IAC7I,2DAA2D,CAAC;AAE9D,mFAAmF;AACnF,MAAM,KAAK,GACT,mJAAmJ;IACnJ,yDAAyD;IACzD,sFAAsF;IACtF,sEAAsE,CAAC;AACzE,MAAM,cAAc,GAClB,kHAAkH,CAAC;AAErH,wFAAwF;AACxF,MAAM,UAAU,UAAU,CA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AE,EAAE;wCACf,IAAI,OAAO;4CAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;;4CAC5C,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oCACrC,CAAC,gBACW,IAAI,CAAC,IAAI,CAAC,kBACR,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,eAC1C,kBAAkB,mBACb,QAAQ,IAAI,SAAS,EACpC,mBAAmB,EAAE,KAAK,KAAK,OAAO,EACtC,UAAU,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAClC,OAAO,EAAE,GAAG,EAAE;wCACZ,IAAI,KAAK,KAAK,OAAO;4CAAE,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;oCAC1C,CAAC,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAC1B,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,IAAI,cAAc,EAAE,KAAK,KAAK,OAAO,IAAI,8BAA8B,CAAC,YAEpG,KAAK,CAAC,IAAI,CAAC,GACD,IAnBL,KAAK,CAoBT,CACP,CAAC;wBACJ,CAAC,CAAC,IA3BM,GAAG,CA4BP,CACP,CAAC,GACE,IACF,GACiB,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button as AriaButton, ButtonContext, DatePickerStateContext, useLocale } from \"react-aria-components\";\nimport { CalendarDate, getLocalTimeZone, today as todayIn } from \"@internationalized/date\";\n\nimport { cn } from \"../utils\";\nimport { IconGlyph } from \"../display/icon\";\nimport { formatDateTime, nextYearLabel, previousYearLabel } from \"../i18n\";\n\n/**\n * A month as one number (year × 12 + month index), so stepping by a month, a row or a year is arithmetic and a\n * step past December lands in the next year's January.\n */\ntype MonthIndex = number;\nconst toIndex = (date: { year: number; month: number }): MonthIndex => date.year * 12 + date.month - 1;\nconst toDate = (index: MonthIndex) => new CalendarDate(Math.floor(index / 12), (index % 12) + 1, 1);\n\n/** Three months a row, four rows: the quarters. */\nconst COLUMNS = 3;\n\nconst NAV =\n \"grid size-ds-control-compact cursor-pointer place-items-center rounded-ds-control-medium text-ds-icon outline-hidden \" +\n \"data-[hovered]:bg-ds-background-neutral-subtle-hovered data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused \" +\n \"data-[disabled]:cursor-default data-[disabled]:opacity-40\";\n\n/** A month tile: the Calendar's day cell, as wide as a third of the 252px grid. */\nconst MONTH =\n \"grid h-ds-control w-full cursor-pointer place-items-center rounded-ds-control-medium px-ds-050 text-body text-ds-text outline-hidden select-none \" +\n \"data-[hovered]:bg-ds-background-neutral-subtle-hovered \" +\n \"data-[focus-visible]:inset-ring-2 data-[focus-visible]:inset-ring-ds-border-focused \" +\n \"data-[disabled]:cursor-default data-[disabled]:text-ds-text-disabled\";\nconst MONTH_SELECTED =\n \"bg-ds-background-brand-bold font-medium text-ds-text-on-brand data-[hovered]:bg-ds-background-brand-bold-hovered\";\n\n/** Inclusive month range from the picker's bounds (only their year and month count). */\nexport function monthRange(minValue?: CalendarDate, maxValue?: CalendarDate) {\n const min = minValue ? toIndex(minValue) : -Infinity;\n const max = maxValue ? toIndex(maxValue) : Infinity;\n return { min, max, contains: (index: MonthIndex) => index >= min && index <= max };\n}\n\nexport type MonthGridProps = {\n minValue?: CalendarDate;\n maxValue?: CalendarDate;\n /** \"This month\" in the location's zone; the device's by default. */\n timeZone?: string;\n /** Close the picker once a month is picked (default). */\n shouldCloseOnSelect?: boolean;\n};\n\n/**\n * DatePicker `granularity=\"month\"`: the popover's year stepper over a grid of the twelve months,\n * in place of the day calendar. Internal to the DS (not exported). A `role=\"grid\"` like the Calendar's: each\n * month a button named \"Ocak 2026\" that shows \"Oca\", the chosen one `aria-selected` on its cell, this month\n * underlined, months outside the bounds disabled. Arrows move a month (left and right follow the reading\n * direction) or a row of three, across years; Home and End go to the row's ends, Page Up and Page Down a year.\n * Focus starts on the chosen month, else this month.\n */\nexport function MonthGrid({ minValue, maxValue, timeZone, shouldCloseOnSelect = true }: MonthGridProps) {\n const state = React.useContext(DatePickerStateContext);\n const { locale, direction } = useLocale();\n const range = monthRange(minValue, maxValue);\n const value = state?.value as CalendarDate | null | undefined;\n const chosen = value ? toIndex(value) : null;\n const clamp = (index: MonthIndex) => Math.min(Math.max(index, range.min), range.max);\n // The popover only renders in the browser, so \"today\" is safe to read here for the first focus.\n const [focused, setFocused] = React.useState<MonthIndex>(() => clamp(chosen ?? toIndex(todayIn(timeZone ?? getLocalTimeZone()))));\n // This month, underlined: known after mount (the server's clock and zone would disagree).\n const [current, setCurrent] = React.useState<MonthIndex | null>(null);\n React.useEffect(() => setCurrent(toIndex(todayIn(timeZone ?? getLocalTimeZone()))), [timeZone]);\n\n const buttons = React.useRef(new Map<MonthIndex, HTMLButtonElement>());\n // Keyboard moves (and opening) take focus to the month; the year buttons keep it where it is (see stepYear).\n const moveFocus = React.useRef(true);\n React.useLayoutEffect(() => {\n if (!moveFocus.current) return;\n moveFocus.current = false;\n buttons.current.get(focused)?.focus();\n }, [focused]);\n\n const year = Math.floor(focused / 12);\n const yearText = new Intl.DateTimeFormat(locale, { year: \"numeric\", timeZone: \"UTC\" }).format(Date.UTC(year, 0, 1));\n const short = (when: Date | number) => formatDateTime(locale, { month: \"short\", timeZone: \"UTC\" }, when);\n const long = (when: Date | number) => formatDateTime(locale, { month: \"long\", year: \"numeric\", timeZone: \"UTC\" }, when);\n\n const go = (index: MonthIndex, focus = true) => {\n moveFocus.current = focus;\n setFocused(clamp(index));\n };\n const previousDisabled = (at: MonthIndex) => Math.floor(at / 12) * 12 - 1 < range.min;\n const nextDisabled = (at: MonthIndex) => (Math.floor(at / 12) + 1) * 12 > range.max;\n // A year button keeps focus, unless the step takes it to a bound and disables it: then focus goes to the\n // focused month, as the day Calendar does, so it never falls to the page (where Esc no longer closes).\n const stepYear = (by: number, disables: (at: MonthIndex) => boolean) => {\n const target = clamp(focused + by);\n go(target, disables(target));\n };\n const pick = (index: MonthIndex) => {\n state?.setValue(toDate(index));\n if (shouldCloseOnSelect) state?.close();\n };\n const onKeyDown = (event: React.KeyboardEvent) => {\n const forward = direction === \"rtl\" ? -1 : 1;\n const column = ((focused % 12) + 12) % COLUMNS;\n const steps: Record<string, number> = {\n ArrowRight: forward,\n ArrowLeft: -forward,\n ArrowDown: COLUMNS,\n ArrowUp: -COLUMNS,\n Home: -column,\n End: COLUMNS - 1 - column,\n PageDown: 12,\n PageUp: -12,\n };\n const step = steps[event.key];\n if (step === undefined) return;\n event.preventDefault();\n event.stopPropagation();\n go(focused + step);\n };\n\n const rows = Array.from({ length: 12 / COLUMNS }, (_, row) => Array.from({ length: COLUMNS }, (_, column) => year * 12 + row * COLUMNS + column));\n return (\n // The picker's own button context (its calendar button) must not reach these buttons.\n <ButtonContext.Provider value={null}>\n {/* An LTR locale's months read left to right on an RTL page too, as its arrow keys move. */}\n <div data-slot=\"month-grid\" dir={direction === \"ltr\" ? \"ltr\" : undefined} className=\"flex w-63 max-w-full flex-col gap-ds-100\">\n <div data-slot=\"month-grid-header\" className=\"flex items-center justify-between gap-ds-100\">\n <AriaButton\n aria-label={previousYearLabel(locale)}\n data-slot=\"month-grid-previous\"\n isDisabled={previousDisabled(focused)}\n onPress={() => stepYear(-12, previousDisabled)}\n className={NAV}\n >\n <IconGlyph name=\"chevron-left\" />\n </AriaButton>\n <span data-slot=\"month-grid-year\" aria-live=\"polite\" className=\"text-heading-xsmall tabular-nums\">\n {yearText}\n </span>\n <AriaButton\n aria-label={nextYearLabel(locale)}\n data-slot=\"month-grid-next\"\n isDisabled={nextDisabled(focused)}\n onPress={() => stepYear(12, nextDisabled)}\n className={NAV}\n >\n <IconGlyph name=\"chevron-right\" />\n </AriaButton>\n </div>\n <div role=\"grid\" aria-label={yearText} data-slot=\"month-grid-months\" className=\"flex flex-col gap-ds-050\" onKeyDown={onKeyDown}>\n {rows.map((months, row) => (\n <div key={row} role=\"row\" className=\"grid grid-cols-3 gap-ds-050\">\n {months.map((index) => {\n const when = Date.UTC(Math.floor(index / 12), index % 12, 1);\n const selected = index === chosen;\n return (\n <div key={index} role=\"gridcell\" aria-selected={selected} data-slot=\"month-grid-cell\" className=\"flex\">\n <AriaButton\n ref={(element) => {\n if (element) buttons.current.set(index, element);\n else buttons.current.delete(index);\n }}\n aria-label={long(when)}\n aria-current={index === current ? \"date\" : undefined}\n data-slot=\"month-grid-month\"\n data-selected={selected || undefined}\n excludeFromTabOrder={index !== focused}\n isDisabled={!range.contains(index)}\n onFocus={() => {\n if (index !== focused) go(index, false);\n }}\n onPress={() => pick(index)}\n className={cn(MONTH, selected && MONTH_SELECTED, index === current && \"underline underline-offset-3\")}\n >\n {short(when)}\n </AriaButton>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n </ButtonContext.Provider>\n );\n}\n"]}