@eifi1/ui-kit 0.4.0 → 0.5.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 (410) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +498 -57
  3. package/dist/chart.d.ts +10 -0
  4. package/dist/chart.js +10 -0
  5. package/dist/chart.js.map +1 -0
  6. package/dist/components/account-settings.d.ts +11 -0
  7. package/dist/components/account-settings.js +19 -12
  8. package/dist/components/account-settings.js.map +1 -1
  9. package/dist/components/alert-banner.d.ts +10 -6
  10. package/dist/components/alert-banner.js +20 -16
  11. package/dist/components/alert-banner.js.map +1 -1
  12. package/dist/components/amount-input.d.ts +30 -4
  13. package/dist/components/amount-input.js +36 -14
  14. package/dist/components/amount-input.js.map +1 -1
  15. package/dist/components/calculator.d.ts +24 -7
  16. package/dist/components/calculator.js +37 -20
  17. package/dist/components/calculator.js.map +1 -1
  18. package/dist/components/chart-zoom.d.ts +156 -0
  19. package/dist/components/chart-zoom.js +262 -0
  20. package/dist/components/chart-zoom.js.map +1 -0
  21. package/dist/components/chart.d.ts +28 -3
  22. package/dist/components/chart.js +71 -32
  23. package/dist/components/chart.js.map +1 -1
  24. package/dist/components/checkbox.d.ts +51 -0
  25. package/dist/components/checkbox.js +123 -0
  26. package/dist/components/checkbox.js.map +1 -0
  27. package/dist/components/chip.d.ts +128 -0
  28. package/dist/components/chip.js +357 -0
  29. package/dist/components/chip.js.map +1 -0
  30. package/dist/components/choice-parts.d.ts +24 -0
  31. package/dist/components/choice-parts.js +18 -0
  32. package/dist/components/choice-parts.js.map +1 -0
  33. package/dist/components/combobox-core.d.ts +52 -9
  34. package/dist/components/combobox-core.js +91 -20
  35. package/dist/components/combobox-core.js.map +1 -1
  36. package/dist/components/combobox.d.ts +43 -33
  37. package/dist/components/combobox.js +409 -340
  38. package/dist/components/combobox.js.map +1 -1
  39. package/dist/components/currency-select.d.ts +48 -8
  40. package/dist/components/currency-select.js +107 -65
  41. package/dist/components/currency-select.js.map +1 -1
  42. package/dist/components/data-table-filter-popover.d.ts +15 -3
  43. package/dist/components/data-table-filter-popover.js +23 -17
  44. package/dist/components/data-table-filter-popover.js.map +1 -1
  45. package/dist/components/data-table-filters.d.ts +1 -1
  46. package/dist/components/data-table-filters.js +3 -2
  47. package/dist/components/data-table-filters.js.map +1 -1
  48. package/dist/components/data-table-labels.d.ts +53 -2
  49. package/dist/components/data-table-labels.js +31 -2
  50. package/dist/components/data-table-labels.js.map +1 -1
  51. package/dist/components/data-table-pagination.d.ts +3 -1
  52. package/dist/components/data-table-pagination.js +16 -10
  53. package/dist/components/data-table-pagination.js.map +1 -1
  54. package/dist/components/data-table-sort.js +1 -0
  55. package/dist/components/data-table-sort.js.map +1 -1
  56. package/dist/components/data-table.d.ts +1 -1
  57. package/dist/components/data-table.js +201 -85
  58. package/dist/components/data-table.js.map +1 -1
  59. package/dist/components/date-picker.d.ts +25 -9
  60. package/dist/components/date-picker.js +232 -94
  61. package/dist/components/date-picker.js.map +1 -1
  62. package/dist/components/dropdown.d.ts +96 -20
  63. package/dist/components/dropdown.js +77 -33
  64. package/dist/components/dropdown.js.map +1 -1
  65. package/dist/components/entity-combobox.d.ts +5 -4
  66. package/dist/components/entity-combobox.js +107 -76
  67. package/dist/components/entity-combobox.js.map +1 -1
  68. package/dist/components/facing-pair.d.ts +36 -0
  69. package/dist/components/facing-pair.js +40 -0
  70. package/dist/components/facing-pair.js.map +1 -0
  71. package/dist/components/field-sync.d.ts +164 -0
  72. package/dist/components/field-sync.js +264 -0
  73. package/dist/components/field-sync.js.map +1 -0
  74. package/dist/components/file-dropzone.d.ts +38 -6
  75. package/dist/components/file-dropzone.js +34 -9
  76. package/dist/components/file-dropzone.js.map +1 -1
  77. package/dist/components/full-bleed-dialog.d.ts +37 -26
  78. package/dist/components/full-bleed-dialog.js +20 -5
  79. package/dist/components/full-bleed-dialog.js.map +1 -1
  80. package/dist/components/grouped-picker.d.ts +21 -10
  81. package/dist/components/grouped-picker.js +66 -52
  82. package/dist/components/grouped-picker.js.map +1 -1
  83. package/dist/components/hover-menu.d.ts +20 -4
  84. package/dist/components/hover-menu.js +15 -4
  85. package/dist/components/hover-menu.js.map +1 -1
  86. package/dist/components/mini-calendar.d.ts +102 -14
  87. package/dist/components/mini-calendar.js +256 -70
  88. package/dist/components/mini-calendar.js.map +1 -1
  89. package/dist/components/modal.d.ts +9 -3
  90. package/dist/components/modal.js +34 -45
  91. package/dist/components/modal.js.map +1 -1
  92. package/dist/components/month-picker.d.ts +79 -0
  93. package/dist/components/month-picker.js +342 -0
  94. package/dist/components/month-picker.js.map +1 -0
  95. package/dist/components/multi-entity-combobox.d.ts +7 -6
  96. package/dist/components/multi-entity-combobox.js +112 -72
  97. package/dist/components/multi-entity-combobox.js.map +1 -1
  98. package/dist/components/multi-select.d.ts +13 -11
  99. package/dist/components/multi-select.js +161 -84
  100. package/dist/components/multi-select.js.map +1 -1
  101. package/dist/components/number-field.d.ts +92 -0
  102. package/dist/components/number-field.js +111 -0
  103. package/dist/components/number-field.js.map +1 -0
  104. package/dist/components/number-input.d.ts +28 -2
  105. package/dist/components/number-input.js +12 -2
  106. package/dist/components/number-input.js.map +1 -1
  107. package/dist/components/numpad-sheet.d.ts +32 -4
  108. package/dist/components/numpad-sheet.js +30 -13
  109. package/dist/components/numpad-sheet.js.map +1 -1
  110. package/dist/components/page-contents.d.ts +90 -0
  111. package/dist/components/page-contents.js +170 -0
  112. package/dist/components/page-contents.js.map +1 -0
  113. package/dist/components/password-strength.d.ts +106 -0
  114. package/dist/components/password-strength.js +132 -0
  115. package/dist/components/password-strength.js.map +1 -0
  116. package/dist/components/picker-sheet.d.ts +23 -15
  117. package/dist/components/picker-sheet.js +34 -14
  118. package/dist/components/picker-sheet.js.map +1 -1
  119. package/dist/components/popover.d.ts +62 -4
  120. package/dist/components/popover.js +52 -2
  121. package/dist/components/popover.js.map +1 -1
  122. package/dist/components/search-field.d.ts +25 -7
  123. package/dist/components/search-field.js +7 -5
  124. package/dist/components/search-field.js.map +1 -1
  125. package/dist/components/series-chart-labels.d.ts +14 -0
  126. package/dist/components/series-chart-labels.js +11 -0
  127. package/dist/components/series-chart-labels.js.map +1 -0
  128. package/dist/components/series-chart.d.ts +207 -0
  129. package/dist/components/series-chart.js +223 -0
  130. package/dist/components/series-chart.js.map +1 -0
  131. package/dist/components/settings-fields.d.ts +14 -4
  132. package/dist/components/settings-fields.js +19 -8
  133. package/dist/components/settings-fields.js.map +1 -1
  134. package/dist/components/signature-pad.d.ts +119 -0
  135. package/dist/components/signature-pad.js +405 -0
  136. package/dist/components/signature-pad.js.map +1 -0
  137. package/dist/components/slider.d.ts +80 -0
  138. package/dist/components/slider.js +155 -0
  139. package/dist/components/slider.js.map +1 -0
  140. package/dist/components/sparkline.d.ts +93 -0
  141. package/dist/components/sparkline.js +205 -0
  142. package/dist/components/sparkline.js.map +1 -0
  143. package/dist/components/stat-tile.d.ts +151 -0
  144. package/dist/components/stat-tile.js +236 -0
  145. package/dist/components/stat-tile.js.map +1 -0
  146. package/dist/components/swipeable-row.d.ts +25 -2
  147. package/dist/components/swipeable-row.js +31 -0
  148. package/dist/components/swipeable-row.js.map +1 -1
  149. package/dist/components/switch.d.ts +60 -0
  150. package/dist/components/switch.js +81 -0
  151. package/dist/components/switch.js.map +1 -0
  152. package/dist/components/time-input.d.ts +58 -0
  153. package/dist/components/time-input.js +50 -0
  154. package/dist/components/time-input.js.map +1 -0
  155. package/dist/components/toggle-group.d.ts +18 -3
  156. package/dist/components/toggle-group.js +10 -6
  157. package/dist/components/toggle-group.js.map +1 -1
  158. package/dist/components/toggle-legend.d.ts +115 -0
  159. package/dist/components/toggle-legend.js +114 -0
  160. package/dist/components/toggle-legend.js.map +1 -0
  161. package/dist/components/tooltip.d.ts +40 -11
  162. package/dist/components/tooltip.js +77 -20
  163. package/dist/components/tooltip.js.map +1 -1
  164. package/dist/components/treemap.d.ts +132 -0
  165. package/dist/components/treemap.js +179 -0
  166. package/dist/components/treemap.js.map +1 -0
  167. package/dist/components/ui.d.ts +159 -46
  168. package/dist/components/ui.js +220 -115
  169. package/dist/components/ui.js.map +1 -1
  170. package/dist/components/use-mobile-reveal.js +1 -0
  171. package/dist/components/use-mobile-reveal.js.map +1 -1
  172. package/dist/components/use-table-state.d.ts +1 -1
  173. package/dist/components/use-table-state.js +38 -17
  174. package/dist/components/use-table-state.js.map +1 -1
  175. package/dist/components/user-avatar.d.ts +15 -4
  176. package/dist/components/user-avatar.js +5 -4
  177. package/dist/components/user-avatar.js.map +1 -1
  178. package/dist/components/wizard-stepper.js +3 -2
  179. package/dist/components/wizard-stepper.js.map +1 -1
  180. package/dist/{data-table-filters-aXyf0Xub.d.ts → data-table-filters-DM1auUfH.d.ts} +27 -5
  181. package/dist/data-table.d.ts +7 -0
  182. package/dist/data-table.js +12 -0
  183. package/dist/data-table.js.map +1 -0
  184. package/dist/feedback/feedback-attachment.js +12 -11
  185. package/dist/feedback/feedback-attachment.js.map +1 -1
  186. package/dist/feedback/feedback-dialog.js +2 -1
  187. package/dist/feedback/feedback-dialog.js.map +1 -1
  188. package/dist/feedback/feedback-inbox.d.ts +33 -7
  189. package/dist/feedback/feedback-inbox.js +49 -37
  190. package/dist/feedback/feedback-inbox.js.map +1 -1
  191. package/dist/feedback.d.ts +5 -0
  192. package/dist/feedback.js +5 -0
  193. package/dist/feedback.js.map +1 -0
  194. package/dist/hooks/use-anchored-panel.js +1 -0
  195. package/dist/hooks/use-anchored-panel.js.map +1 -1
  196. package/dist/hooks/use-anchored-rect.js +1 -0
  197. package/dist/hooks/use-anchored-rect.js.map +1 -1
  198. package/dist/hooks/use-announce.d.ts +46 -0
  199. package/dist/hooks/use-announce.js +37 -0
  200. package/dist/hooks/use-announce.js.map +1 -0
  201. package/dist/hooks/use-body-scroll-lock.js +1 -0
  202. package/dist/hooks/use-body-scroll-lock.js.map +1 -1
  203. package/dist/hooks/use-close-transition.js +1 -0
  204. package/dist/hooks/use-close-transition.js.map +1 -1
  205. package/dist/hooks/use-dismiss.js +1 -0
  206. package/dist/hooks/use-dismiss.js.map +1 -1
  207. package/dist/hooks/use-focus-trap.d.ts +16 -0
  208. package/dist/hooks/use-focus-trap.js +67 -0
  209. package/dist/hooks/use-focus-trap.js.map +1 -0
  210. package/dist/hooks/use-media-query.js +1 -0
  211. package/dist/hooks/use-media-query.js.map +1 -1
  212. package/dist/hooks/use-overlay-history.js +27 -1
  213. package/dist/hooks/use-overlay-history.js.map +1 -1
  214. package/dist/hooks/use-row-swipe.js +1 -0
  215. package/dist/hooks/use-row-swipe.js.map +1 -1
  216. package/dist/i18n/defaults.d.ts +31 -0
  217. package/dist/i18n/defaults.js +63 -0
  218. package/dist/i18n/defaults.js.map +1 -0
  219. package/dist/i18n/kit-labels.d.ts +250 -0
  220. package/dist/i18n/kit-labels.js +184 -0
  221. package/dist/i18n/kit-labels.js.map +1 -0
  222. package/dist/index.d.ts +47 -22
  223. package/dist/index.js +28 -0
  224. package/dist/index.js.map +1 -1
  225. package/dist/lib/calc.js +1 -0
  226. package/dist/lib/calc.js.map +1 -1
  227. package/dist/lib/cn.js +1 -0
  228. package/dist/lib/cn.js.map +1 -1
  229. package/dist/lib/dates.js +1 -0
  230. package/dist/lib/dates.js.map +1 -1
  231. package/dist/lib/logger.js +1 -0
  232. package/dist/lib/logger.js.map +1 -1
  233. package/dist/lib/safe-storage.js +1 -0
  234. package/dist/lib/safe-storage.js.map +1 -1
  235. package/dist/search/command-palette.d.ts +11 -1
  236. package/dist/search/command-palette.js +21 -15
  237. package/dist/search/command-palette.js.map +1 -1
  238. package/dist/search.d.ts +2 -0
  239. package/dist/search.js +3 -0
  240. package/dist/search.js.map +1 -0
  241. package/dist/shell/app-shell.d.ts +33 -4
  242. package/dist/shell/app-shell.js +275 -78
  243. package/dist/shell/app-shell.js.map +1 -1
  244. package/dist/shell/option-switcher-menu.js +3 -2
  245. package/dist/shell/option-switcher-menu.js.map +1 -1
  246. package/dist/shell/role-switcher.d.ts +6 -0
  247. package/dist/shell/role-switcher.js +7 -4
  248. package/dist/shell/role-switcher.js.map +1 -1
  249. package/dist/shell/top-bar.d.ts +15 -7
  250. package/dist/shell/top-bar.js +3 -5
  251. package/dist/shell/top-bar.js.map +1 -1
  252. package/dist/shell/topbar-action-menu.js +3 -2
  253. package/dist/shell/topbar-action-menu.js.map +1 -1
  254. package/dist/shell/topbar-controls.d.ts +5 -2
  255. package/dist/shell/topbar-controls.js +20 -15
  256. package/dist/shell/topbar-controls.js.map +1 -1
  257. package/dist/shell.d.ts +13 -0
  258. package/dist/shell.js +8 -0
  259. package/dist/shell.js.map +1 -0
  260. package/dist/theme/chart-palette.d.ts +19 -12
  261. package/dist/theme/chart-palette.js +24 -30
  262. package/dist/theme/chart-palette.js.map +1 -1
  263. package/dist/theme/color.d.ts +78 -0
  264. package/dist/theme/color.js +148 -0
  265. package/dist/theme/color.js.map +1 -0
  266. package/dist/theme/palette-derive.d.ts +140 -0
  267. package/dist/theme/palette-derive.js +376 -0
  268. package/dist/theme/palette-derive.js.map +1 -0
  269. package/dist/theme/palette-presets.d.ts +27 -5
  270. package/dist/theme/palette-presets.js +231 -33
  271. package/dist/theme/palette-presets.js.map +1 -1
  272. package/dist/theme/palette-store.js +1 -0
  273. package/dist/theme/palette-store.js.map +1 -1
  274. package/dist/theme/theme-store.js +1 -0
  275. package/dist/theme/theme-store.js.map +1 -1
  276. package/dist/tour/tour.d.ts +2 -1
  277. package/dist/tour/tour.js +15 -9
  278. package/dist/tour/tour.js.map +1 -1
  279. package/dist/tour.d.ts +2 -0
  280. package/dist/tour.js +3 -0
  281. package/dist/tour.js.map +1 -0
  282. package/dist/wizard/stepper-nav.js +10 -8
  283. package/dist/wizard/stepper-nav.js.map +1 -1
  284. package/dist/wizard/types.d.ts +18 -2
  285. package/dist/wizard/types.js +4 -1
  286. package/dist/wizard/types.js.map +1 -1
  287. package/dist/wizard/use-wizard.js +12 -4
  288. package/dist/wizard/use-wizard.js.map +1 -1
  289. package/dist/wizard/validation.js +1 -0
  290. package/dist/wizard/validation.js.map +1 -1
  291. package/dist/wizard/wizard-context.js +1 -0
  292. package/dist/wizard/wizard-context.js.map +1 -1
  293. package/dist/wizard/wizard-step.js +1 -0
  294. package/dist/wizard/wizard-step.js.map +1 -1
  295. package/dist/wizard/wizard-summary.js +5 -3
  296. package/dist/wizard/wizard-summary.js.map +1 -1
  297. package/dist/wizard.d.ts +8 -0
  298. package/dist/wizard.js +9 -0
  299. package/dist/wizard.js.map +1 -0
  300. package/package.json +67 -14
  301. package/src/chart.ts +22 -0
  302. package/src/components/account-settings.tsx +275 -0
  303. package/src/components/alert-banner.tsx +75 -0
  304. package/src/components/amount-input.tsx +471 -0
  305. package/src/components/calculator.tsx +252 -0
  306. package/src/components/chart-zoom.tsx +499 -0
  307. package/src/components/chart.tsx +363 -0
  308. package/src/components/checkbox.tsx +222 -0
  309. package/src/components/chip.tsx +570 -0
  310. package/src/components/choice-parts.ts +33 -0
  311. package/src/components/combobox-core.tsx +540 -0
  312. package/src/components/combobox.tsx +1026 -0
  313. package/src/components/currency-select.tsx +269 -0
  314. package/src/components/data-table-filter-popover.tsx +252 -0
  315. package/src/components/data-table-filters.ts +176 -0
  316. package/src/components/data-table-labels.ts +190 -0
  317. package/src/components/data-table-pagination.tsx +126 -0
  318. package/src/components/data-table-sort.ts +70 -0
  319. package/src/components/data-table.tsx +1740 -0
  320. package/src/components/date-picker.tsx +631 -0
  321. package/src/components/dropdown.tsx +341 -0
  322. package/src/components/entity-combobox.tsx +215 -0
  323. package/src/components/facing-pair.ts +86 -0
  324. package/src/components/field-sync.tsx +472 -0
  325. package/src/components/file-dropzone.tsx +181 -0
  326. package/src/components/full-bleed-dialog.tsx +179 -0
  327. package/src/components/grouped-picker.tsx +157 -0
  328. package/src/components/hover-menu.tsx +183 -0
  329. package/src/components/mini-calendar.tsx +554 -0
  330. package/src/components/modal.tsx +287 -0
  331. package/src/components/month-picker.tsx +549 -0
  332. package/src/components/multi-entity-combobox.tsx +226 -0
  333. package/src/components/multi-select.tsx +303 -0
  334. package/src/components/number-field.tsx +225 -0
  335. package/src/components/number-input.tsx +211 -0
  336. package/src/components/numpad-sheet.tsx +264 -0
  337. package/src/components/page-contents.tsx +289 -0
  338. package/src/components/password-strength.tsx +258 -0
  339. package/src/components/picker-sheet.tsx +251 -0
  340. package/src/components/popover.tsx +195 -0
  341. package/src/components/search-field.tsx +146 -0
  342. package/src/components/series-chart-labels.ts +26 -0
  343. package/src/components/series-chart.tsx +481 -0
  344. package/src/components/settings-fields.tsx +68 -0
  345. package/src/components/signature-pad.tsx +630 -0
  346. package/src/components/slider.tsx +313 -0
  347. package/src/components/sparkline.tsx +329 -0
  348. package/src/components/stat-tile.tsx +448 -0
  349. package/src/components/swipeable-row.tsx +271 -0
  350. package/src/components/switch.tsx +170 -0
  351. package/src/components/time-input.tsx +107 -0
  352. package/src/components/toggle-group.tsx +153 -0
  353. package/src/components/toggle-legend.tsx +229 -0
  354. package/src/components/tooltip.tsx +477 -0
  355. package/src/components/treemap.tsx +390 -0
  356. package/src/components/ui.tsx +1284 -0
  357. package/src/components/use-mobile-reveal.ts +54 -0
  358. package/src/components/use-table-state.ts +295 -0
  359. package/src/components/user-avatar.tsx +61 -0
  360. package/src/components/wizard-stepper.tsx +37 -0
  361. package/src/data-table.ts +19 -0
  362. package/src/feedback/feedback-attachment.tsx +246 -0
  363. package/src/feedback/feedback-dialog.tsx +209 -0
  364. package/src/feedback/feedback-inbox.tsx +615 -0
  365. package/src/feedback.ts +8 -0
  366. package/src/hooks/use-anchored-panel.ts +169 -0
  367. package/src/hooks/use-anchored-rect.ts +78 -0
  368. package/src/hooks/use-announce.ts +85 -0
  369. package/src/hooks/use-body-scroll-lock.ts +94 -0
  370. package/src/hooks/use-close-transition.ts +99 -0
  371. package/src/hooks/use-dismiss.ts +77 -0
  372. package/src/hooks/use-focus-trap.ts +160 -0
  373. package/src/hooks/use-media-query.ts +23 -0
  374. package/src/hooks/use-overlay-history.ts +345 -0
  375. package/src/hooks/use-row-swipe.ts +212 -0
  376. package/src/i18n/defaults.ts +68 -0
  377. package/src/i18n/kit-labels.tsx +447 -0
  378. package/src/index.ts +169 -0
  379. package/src/lib/calc.ts +309 -0
  380. package/src/lib/cn.ts +5 -0
  381. package/src/lib/dates.ts +187 -0
  382. package/src/lib/logger.ts +73 -0
  383. package/src/lib/safe-storage.ts +37 -0
  384. package/src/search/command-palette.tsx +342 -0
  385. package/src/search.ts +3 -0
  386. package/src/shell/app-shell.tsx +772 -0
  387. package/src/shell/option-switcher-menu.tsx +72 -0
  388. package/src/shell/role-switcher.tsx +46 -0
  389. package/src/shell/top-bar.tsx +39 -0
  390. package/src/shell/topbar-action-menu.tsx +91 -0
  391. package/src/shell/topbar-controls.tsx +229 -0
  392. package/src/shell.ts +10 -0
  393. package/src/theme/chart-palette.ts +145 -0
  394. package/src/theme/color.ts +266 -0
  395. package/src/theme/palette-derive.ts +681 -0
  396. package/src/theme/palette-presets.ts +760 -0
  397. package/src/theme/palette-store.ts +94 -0
  398. package/src/theme/theme-store.ts +145 -0
  399. package/src/tour/tour.tsx +586 -0
  400. package/src/tour.ts +3 -0
  401. package/src/vite-env.d.ts +26 -0
  402. package/src/wizard/stepper-nav.tsx +221 -0
  403. package/src/wizard/types.ts +178 -0
  404. package/src/wizard/use-wizard.ts +345 -0
  405. package/src/wizard/validation.ts +37 -0
  406. package/src/wizard/wizard-context.tsx +29 -0
  407. package/src/wizard/wizard-step.tsx +14 -0
  408. package/src/wizard/wizard-summary.tsx +69 -0
  409. package/src/wizard.ts +14 -0
  410. package/tokens.css +222 -20
@@ -1,9 +1,75 @@
1
1
  import * as react from 'react';
2
+ import { ComponentPropsWithoutRef } from 'react';
2
3
 
3
- interface MiniCalendarProps {
4
+ /**
5
+ * Every string this calendar can speak — the `miniCalendar` namespace of
6
+ * `<UiKitProvider labels>`, overridable per instance through the `labels` prop. The
7
+ * package carries no translation catalog (see the README), so the English defaults
8
+ * below are a starting point and not a commitment. `previousMonth`/`nextMonth` were already props for the
9
+ * reason the audit records: a German app reached this component through a bare
10
+ * re-export and announced its two icon-only arrows in English on a page whose
11
+ * `<html lang>` says `de`.
12
+ *
13
+ * The month caption is deliberately NOT here. It is produced by `Intl` from the
14
+ * `locale` prop, so it is already in the user's language, and the grid takes its
15
+ * accessible name from that element rather than from a string someone has to
16
+ * translate a second time.
17
+ *
18
+ * The ones that interpolate a date are FUNCTIONS taking the formatted date, for the
19
+ * reason `DataTableLabels` gives for its counted strings: a value glued into an
20
+ * English template literal is untranslatable, and the grammar around a date moves
21
+ * with it in most languages.
22
+ */
23
+ interface MiniCalendarLabels {
24
+ previousMonth: string;
25
+ nextMonth: string;
26
+ /**
27
+ * Accessible name of one day cell, given that day formatted in `locale`
28
+ * ("Monday, 14 September 2026").
29
+ *
30
+ * The name has to carry the WHOLE date. The visible text of a cell is the day
31
+ * number alone, and "14" on its own tells a screen-reader user nothing — not the
32
+ * month they have arrowed into, not the year, not the weekday they are picking.
33
+ */
34
+ day: (date: string) => string;
35
+ /** Range mode: what the NEXT click will set. Spoken after every click, and the
36
+ * grid's description while the panel is open. */
37
+ chooseStart: string;
38
+ chooseEnd: string;
39
+ /** Range mode: spoken after the click that set the start. */
40
+ startSelected: (date: string) => string;
41
+ /** Range mode: spoken after the click that completed the range. */
42
+ rangeSelected: (from: string, to: string) => string;
43
+ }
44
+ /** English defaults. Exported as the `miniCalendar` namespace of `UiKitLabels`
45
+ * (src/i18n), the complete reference a translation is written against. */
46
+ declare const DEFAULT_MINI_CALENDAR_LABELS: MiniCalendarLabels;
47
+ /**
48
+ * `onSelect` is omitted from the `<div>` attributes and kept as this component's own:
49
+ * the DOM event of that name is a text-selection event taking one argument, and this one
50
+ * answers with the two ISO dates a range is made of. Everything else a `<div>` takes
51
+ * passes through to the root, so a tour anchor or a test id can find the calendar —
52
+ * before this, a closed prop list dropped both (audit §api-design).
53
+ */
54
+ interface MiniCalendarProps extends Omit<ComponentPropsWithoutRef<"div">, "onSelect"> {
4
55
  from: string;
5
56
  to: string;
6
- locale: string;
57
+ /**
58
+ * BCP 47 tag for the month caption, the weekday heads, the day numbers and the
59
+ * spoken dates. Optional since the kit grew `<UiKitProvider locale>`: a calendar
60
+ * NESTED in another kit component (the data table's date filter) has no call site
61
+ * of its own to pass one at, so it reads the provider's. Without either, `Intl`
62
+ * uses the runtime's default.
63
+ */
64
+ locale?: string;
65
+ /**
66
+ * The weekday the grid starts on, `0` = Sunday … `6` = Saturday (as `Date#getDay`).
67
+ * Defaults to the LOCALE's first day — Monday in most of Europe, Sunday in the US,
68
+ * Saturday in much of the Arab world — which is what the user's own wall calendar
69
+ * does. It was hard-wired to Monday before, which is wrong for most of the people
70
+ * who use a Sunday-first calendar and invisible to the people who wrote this one.
71
+ */
72
+ weekStartsOn?: WeekDay;
7
73
  onSelect: (from: string, to: string) => void;
8
74
  /** `"range"` (default) = two-click from→to; `"single"` = one click selects a
9
75
  * single day (emitted as `onSelect(iso, iso)`). */
@@ -11,23 +77,45 @@ interface MiniCalendarProps {
11
77
  /** Optional inclusive ISO bounds; days outside `[min, max]` are disabled. */
12
78
  min?: string;
13
79
  max?: string;
14
- /** Screen-reader names for the two month arrows. The package carries no
15
- * translation catalog (see the README), so every user-facing string is a prop
16
- * with an English default — these two were the exception, and a German app
17
- * reached this component through a bare re-export and announced them in
18
- * English on a page whose `<html lang>` says `de`. */
19
- labels?: {
20
- previousMonth?: string;
21
- nextMonth?: string;
22
- };
80
+ /** User-facing strings; see {@link MiniCalendarLabels}. */
81
+ labels?: Partial<MiniCalendarLabels>;
82
+ /**
83
+ * Take focus to the day the grid opens on — the selected one, or today — when this
84
+ * calendar mounts. For a panel that opened BECAUSE the user asked to pick a date:
85
+ * landing them on the day they are editing is the difference between one arrow key
86
+ * and a hunt through 42 cells.
87
+ *
88
+ * Off by default, and not called `autoFocus`, because it is not the same promise as
89
+ * the DOM attribute of that name: a calendar rendered INLINE (the data-table's
90
+ * column filter draws one above its from/to inputs) must not take the page's focus
91
+ * merely by existing.
92
+ */
93
+ focusOnOpen?: boolean;
94
+ /** Extra classes for the calendar's root. */
95
+ className?: string;
23
96
  }
97
+ type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
24
98
  /**
25
99
  * Month-grid range picker used by the data-table date filter. Click once to set
26
100
  * the start (and clear the end), click again to set the end; clicking with a
27
- * full range already selected starts over. Monday-first, locale-aware labels.
101
+ * full range already selected starts over. The week starts where the locale's does
102
+ * (or at `weekStartsOn`), and every label comes from `Intl` in that locale.
28
103
  * In `single` mode each click selects one day. Days outside `min`/`max` (when
29
104
  * given) are disabled.
105
+ *
106
+ * **It is a grid, in the APG sense** (audit §a11y, "MiniCalendar is unusable with a
107
+ * keyboard or screen reader"). Before this it was 42 buttons in a `grid-cols-7` div:
108
+ * every one of them in the tab order, none of them saying which date it was, and no
109
+ * way to reach next month without a mouse. Now the month is a `role="grid"` of rows
110
+ * and `gridcell`s, exactly one day is tabbable (the roving tabindex), and the arrows
111
+ * walk the calendar the way the pattern says — day, week, month — crossing into the
112
+ * neighbouring month by MOVING the grid rather than stopping at its edge.
113
+ *
114
+ * Out-of-range days are `aria-disabled` rather than `disabled`, which is the APG
115
+ * guidance and not a shortcut: a `disabled` button cannot be focused, so a bounded
116
+ * month would have holes that the roving tabindex falls into. They stay reachable and
117
+ * readable, and the click handler is what refuses them.
30
118
  */
31
- declare function MiniCalendar({ from, to, locale, onSelect, mode, min, max, labels, }: MiniCalendarProps): react.JSX.Element;
119
+ declare function MiniCalendar({ from, to, locale: localeProp, weekStartsOn, onSelect, mode, min, max, labels: labelsProp, focusOnOpen, className, ...rest }: MiniCalendarProps): react.JSX.Element;
32
120
 
33
- export { MiniCalendar, type MiniCalendarProps };
121
+ export { DEFAULT_MINI_CALENDAR_LABELS, MiniCalendar, type MiniCalendarLabels, type MiniCalendarProps, type WeekDay };
@@ -1,61 +1,171 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from "react";
3
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
3
4
  import { ChevronLeft, ChevronRight } from "lucide-react";
4
5
  import { cn } from "../lib/cn.js";
6
+ import { useAnnounce } from "../hooks/use-announce.js";
5
7
  import { parseIsoDate, sameYmd, toLocalIso } from "../lib/dates.js";
8
+ import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
9
+ const DEFAULT_MINI_CALENDAR_LABELS = {
10
+ previousMonth: "Previous month",
11
+ nextMonth: "Next month",
12
+ day: (date) => date,
13
+ chooseStart: "Choose a start date",
14
+ chooseEnd: "Choose an end date",
15
+ startSelected: (date) => `${date} selected as the start. Choose an end date.`,
16
+ rangeSelected: (from, to) => `${from} to ${to} selected. Choose a start date to begin again.`
17
+ };
18
+ const DAY_NAME_FORMAT = {
19
+ weekday: "long",
20
+ day: "numeric",
21
+ month: "long",
22
+ year: "numeric"
23
+ };
24
+ function localeWeekStart(locale) {
25
+ try {
26
+ const tag = locale ?? new Intl.DateTimeFormat().resolvedOptions().locale;
27
+ const loc = new Intl.Locale(tag);
28
+ const firstDay = (loc.getWeekInfo?.() ?? loc.weekInfo)?.firstDay;
29
+ if (typeof firstDay === "number") return firstDay % 7;
30
+ } catch {
31
+ }
32
+ return 1;
33
+ }
34
+ const weekdayIndex = (d, weekStart) => (d.getDay() - weekStart + 7) % 7;
35
+ function stepMonths(d, months) {
36
+ const day = d.getDate();
37
+ const out = new Date(d.getFullYear(), d.getMonth() + months, 1);
38
+ const lastOfTarget = new Date(out.getFullYear(), out.getMonth() + 1, 0).getDate();
39
+ out.setDate(Math.min(day, lastOfTarget));
40
+ return out;
41
+ }
6
42
  function MiniCalendar({
7
43
  from,
8
44
  to,
9
- locale,
45
+ locale: localeProp,
46
+ weekStartsOn,
10
47
  onSelect,
11
48
  mode = "range",
12
49
  min,
13
50
  max,
14
- labels
51
+ labels: labelsProp,
52
+ focusOnOpen,
53
+ className,
54
+ ...rest
15
55
  }) {
56
+ const labels = useKitLabels("miniCalendar", DEFAULT_MINI_CALENDAR_LABELS, labelsProp);
57
+ const locale = useKitLocale(localeProp);
58
+ const weekStart = useMemo(
59
+ () => weekStartsOn ?? localeWeekStart(locale),
60
+ [weekStartsOn, locale]
61
+ );
62
+ const dayNumber = useMemo(() => new Intl.NumberFormat(locale), [locale]);
16
63
  const fromDate = parseIsoDate(from);
17
64
  const toDate = parseIsoDate(to);
18
65
  const minDate = min ? parseIsoDate(min) : null;
19
66
  const maxDate = max ? parseIsoDate(max) : null;
20
67
  const isDisabled = (d) => Boolean(minDate && d < minDate || maxDate && d > maxDate);
21
- const initial = fromDate ?? toDate ?? /* @__PURE__ */ new Date();
22
- const [view, setView] = useState({
23
- year: initial.getFullYear(),
24
- month: initial.getMonth()
68
+ const gridRef = useRef(null);
69
+ const id = useId();
70
+ const monthId = `${id}-month`;
71
+ const hintId = `${id}-hint`;
72
+ const { announce, regionProps } = useAnnounce();
73
+ const [activeIso, setActiveIso] = useState(() => {
74
+ const start = fromDate ?? toDate ?? /* @__PURE__ */ new Date();
75
+ if (minDate && start < minDate) return toLocalIso(minDate);
76
+ if (maxDate && start > maxDate) return toLocalIso(maxDate);
77
+ return toLocalIso(start);
25
78
  });
26
- const [lastKey, setLastKey] = useState(`${from}|${to}`);
27
- const currentKey = `${from}|${to}`;
28
- if (currentKey !== lastKey) {
29
- setLastKey(currentKey);
30
- const next = parseIsoDate(from) ?? parseIsoDate(to);
31
- if (next && (next.getFullYear() !== view.year || next.getMonth() !== view.month)) {
32
- setView({ year: next.getFullYear(), month: next.getMonth() });
33
- }
79
+ const [lastValue, setLastValue] = useState({ from, to });
80
+ if (lastValue.from !== from || lastValue.to !== to) {
81
+ const changed = lastValue.from !== from ? from : to;
82
+ setLastValue({ from, to });
83
+ const next = parseIsoDate(changed) ?? fromDate ?? toDate;
84
+ if (next && toLocalIso(next) !== activeIso) setActiveIso(toLocalIso(next));
34
85
  }
86
+ const activeDate = parseIsoDate(activeIso) ?? /* @__PURE__ */ new Date();
87
+ const view = { year: activeDate.getFullYear(), month: activeDate.getMonth() };
35
88
  const firstOfMonth = new Date(view.year, view.month, 1);
36
89
  const lastOfMonth = new Date(view.year, view.month + 1, 0);
37
- const startWeekday = (firstOfMonth.getDay() + 6) % 7;
90
+ const startWeekday = weekdayIndex(firstOfMonth, weekStart);
38
91
  const cells = [];
39
92
  for (let i = 0; i < startWeekday; i++) cells.push(null);
40
93
  for (let d = 1; d <= lastOfMonth.getDate(); d++) cells.push(new Date(view.year, view.month, d));
41
94
  while (cells.length % 7 !== 0) cells.push(null);
95
+ const weeks = [];
96
+ for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));
42
97
  const monthLabel = firstOfMonth.toLocaleDateString(locale, { month: "long", year: "numeric" });
98
+ const formatDay = (d) => d.toLocaleDateString(locale, DAY_NAME_FORMAT);
43
99
  const weekdayLabels = useMemo(() => {
44
- const ref = new Date(2024, 0, 1);
100
+ const ref = new Date(2024, 0, 7 + weekStart);
45
101
  return Array.from({ length: 7 }, (_, i) => {
46
102
  const d = new Date(ref);
47
103
  d.setDate(ref.getDate() + i);
48
- return d.toLocaleDateString(locale, { weekday: "narrow" });
49
- });
50
- }, [locale]);
51
- const move = (delta) => {
52
- setView((v) => {
53
- const d = new Date(v.year, v.month + delta, 1);
54
- return { year: d.getFullYear(), month: d.getMonth() };
104
+ return {
105
+ narrow: d.toLocaleDateString(locale, { weekday: "narrow" }),
106
+ long: d.toLocaleDateString(locale, { weekday: "long" })
107
+ };
55
108
  });
109
+ }, [locale, weekStart]);
110
+ const pendingFocus = useRef(null);
111
+ useEffect(() => {
112
+ const iso = pendingFocus.current;
113
+ if (!iso) return;
114
+ pendingFocus.current = null;
115
+ gridRef.current?.querySelector(`[data-iso="${iso}"]`)?.focus();
116
+ });
117
+ useEffect(() => {
118
+ if (!focusOnOpen) return;
119
+ gridRef.current?.querySelector('[tabindex="0"]')?.focus();
120
+ }, [focusOnOpen]);
121
+ const moveTo = (d, focus) => {
122
+ const iso = toLocalIso(d);
123
+ if (iso === activeIso) return;
124
+ if (focus) pendingFocus.current = iso;
125
+ setActiveIso(iso);
126
+ };
127
+ const onDayKeyDown = (e) => {
128
+ const next = new Date(activeDate);
129
+ switch (e.key) {
130
+ case "ArrowLeft":
131
+ next.setDate(next.getDate() - 1);
132
+ break;
133
+ case "ArrowRight":
134
+ next.setDate(next.getDate() + 1);
135
+ break;
136
+ case "ArrowUp":
137
+ next.setDate(next.getDate() - 7);
138
+ break;
139
+ case "ArrowDown":
140
+ next.setDate(next.getDate() + 7);
141
+ break;
142
+ case "Home":
143
+ next.setDate(next.getDate() - weekdayIndex(next, weekStart));
144
+ break;
145
+ case "End":
146
+ next.setDate(next.getDate() + (6 - weekdayIndex(next, weekStart)));
147
+ break;
148
+ // Shift+Page is the year step, as in the APG example. It is the only way to
149
+ // reach a birth year without holding PageUp for four hundred keystrokes.
150
+ case "PageUp":
151
+ next.setTime(stepMonths(next, e.shiftKey ? -12 : -1).getTime());
152
+ break;
153
+ case "PageDown":
154
+ next.setTime(stepMonths(next, e.shiftKey ? 12 : 1).getTime());
155
+ break;
156
+ default:
157
+ return;
158
+ }
159
+ e.preventDefault();
160
+ moveTo(next, true);
161
+ };
162
+ const moveMonth = (delta) => {
163
+ moveTo(stepMonths(activeDate, delta), false);
56
164
  };
57
165
  const handleClick = (d) => {
166
+ if (isDisabled(d)) return;
58
167
  const iso = toLocalIso(d);
168
+ moveTo(d, false);
59
169
  if (mode === "single") {
60
170
  onSelect(iso, iso);
61
171
  return;
@@ -64,70 +174,146 @@ function MiniCalendar({
64
174
  const tt = parseIsoDate(to);
65
175
  if (!f || f && tt) {
66
176
  onSelect(iso, "");
177
+ announce(labels.startSelected(formatDay(d)));
67
178
  return;
68
179
  }
69
180
  if (d < f) {
70
181
  onSelect(iso, toLocalIso(f));
182
+ announce(labels.rangeSelected(formatDay(d), formatDay(f)));
71
183
  } else {
72
184
  onSelect(toLocalIso(f), iso);
185
+ announce(labels.rangeSelected(formatDay(f), formatDay(d)));
73
186
  }
74
187
  };
75
188
  const today = /* @__PURE__ */ new Date();
189
+ const hasBand = Boolean(fromDate && toDate && !sameYmd(fromDate, toDate));
190
+ const daysInMonth = (d) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
76
191
  const inRange = (d) => {
77
192
  if (!fromDate || !toDate) return false;
78
193
  return d >= fromDate && d <= toDate;
79
194
  };
80
- return /* @__PURE__ */ jsxs("div", { className: "select-none", children: [
81
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pb-1", children: [
82
- /* @__PURE__ */ jsx(
83
- "button",
195
+ const awaitingEnd = Boolean(fromDate) && !toDate;
196
+ const rangeHint = awaitingEnd ? labels.chooseEnd : labels.chooseStart;
197
+ return (
198
+ // The caller's classes come last, so tailwind-merge lets them win the way
199
+ // `className` does everywhere else in the kit; `...rest` first, as in the rest of
200
+ // this wave, so nothing from outside can take the grid's own wiring away.
201
+ /* @__PURE__ */ jsxs("div", { ...rest, className: cn("select-none", className), children: [
202
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pb-1", children: [
203
+ /* @__PURE__ */ jsx(
204
+ "button",
205
+ {
206
+ type: "button",
207
+ onClick: () => moveMonth(-1),
208
+ "aria-label": labels.previousMonth,
209
+ className: "rounded p-1 text-[var(--text-muted)] hover:bg-[var(--bg-hover)]",
210
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
211
+ }
212
+ ),
213
+ /* @__PURE__ */ jsx(
214
+ "div",
215
+ {
216
+ id: monthId,
217
+ "aria-live": "polite",
218
+ className: "text-xs font-medium capitalize text-[var(--text-secondary)]",
219
+ children: monthLabel
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx(
223
+ "button",
224
+ {
225
+ type: "button",
226
+ onClick: () => moveMonth(1),
227
+ "aria-label": labels.nextMonth,
228
+ className: "rounded p-1 text-[var(--text-muted)] hover:bg-[var(--bg-hover)]",
229
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
230
+ }
231
+ )
232
+ ] }),
233
+ /* @__PURE__ */ jsxs(
234
+ "div",
84
235
  {
85
- type: "button",
86
- onClick: () => move(-1),
87
- "aria-label": labels?.previousMonth ?? "Previous month",
88
- className: "rounded p-1 text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",
89
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
236
+ ref: gridRef,
237
+ role: "grid",
238
+ "aria-labelledby": monthId,
239
+ "aria-describedby": mode === "range" ? hintId : void 0,
240
+ className: "grid gap-y-0.5",
241
+ children: [
242
+ /* @__PURE__ */ jsx(
243
+ "div",
244
+ {
245
+ role: "row",
246
+ className: "grid grid-cols-7 text-center text-[10px] font-medium uppercase text-[var(--text-placeholder)]",
247
+ children: weekdayLabels.map((w, i) => /* @__PURE__ */ jsx("div", { role: "columnheader", "aria-label": w.long, className: "py-0.5", children: w.narrow }, i))
248
+ }
249
+ ),
250
+ weeks.map((week, wi) => (
251
+ // No column gap: the days of a range join into ONE band. With a gap each day
252
+ // was its own tinted box, and a selected fortnight read as fourteen chips.
253
+ /* @__PURE__ */ jsx("div", { role: "row", className: "grid grid-cols-7", children: week.map((d, di) => {
254
+ if (!d) return /* @__PURE__ */ jsx("div", { role: "gridcell", className: "h-8" }, di);
255
+ const iso = toLocalIso(d);
256
+ const disabled = isDisabled(d);
257
+ const isStart = !disabled && fromDate && sameYmd(d, fromDate);
258
+ const isEnd = !disabled && toDate && sameYmd(d, toDate);
259
+ const isToday = sameYmd(d, today);
260
+ const isInRange = !disabled && inRange(d) && !isStart && !isEnd;
261
+ const isActive = iso === activeIso;
262
+ const banded = hasBand && !disabled && (isStart || isEnd || isInRange);
263
+ const lastOfMonth2 = d.getDate() === daysInMonth(d);
264
+ const band = banded ? cn(
265
+ "pointer-events-none absolute inset-y-0 bg-[var(--brand-bg)]",
266
+ isStart ? "start-1/2 end-0" : isEnd ? "start-0 end-1/2" : "inset-x-0",
267
+ isInRange && (di === 0 || d.getDate() === 1) && "rounded-s-full",
268
+ isInRange && (di === 6 || lastOfMonth2) && "rounded-e-full",
269
+ isStart && (di === 6 || lastOfMonth2) && "hidden",
270
+ isEnd && (di === 0 || d.getDate() === 1) && "hidden"
271
+ ) : null;
272
+ return /* @__PURE__ */ jsxs("div", { role: "none", className: "relative flex h-8 items-center justify-center", children: [
273
+ band && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: band }),
274
+ /* @__PURE__ */ jsx(
275
+ "button",
276
+ {
277
+ type: "button",
278
+ role: "gridcell",
279
+ "data-iso": iso,
280
+ tabIndex: isActive ? 0 : -1,
281
+ "aria-label": labels.day(formatDay(d)),
282
+ "aria-selected": Boolean(isStart || isEnd || isInRange),
283
+ "aria-disabled": disabled || void 0,
284
+ "aria-current": isToday ? "date" : void 0,
285
+ onClick: () => handleClick(d),
286
+ onKeyDown: onDayKeyDown,
287
+ className: cn(
288
+ "relative size-8 rounded-full text-xs tabular-nums transition-colors",
289
+ // A grid you can walk with the keyboard needs to show where the
290
+ // keyboard IS. Inset because the cells sit half a pixel apart and
291
+ // an outset ring would be drawn over by its neighbours; the
292
+ // colour flips on the selected days for the reason the numpad's
293
+ // "Done" key does — a --brand ring on a --brand fill is a ring
294
+ // that exists only in the DOM.
295
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset",
296
+ isStart || isEnd ? "focus-visible:ring-[var(--brand-contrast)]" : "focus-visible:ring-[var(--brand)]",
297
+ disabled ? "cursor-not-allowed text-[var(--text-placeholder)]" : isStart || isEnd ? "bg-[var(--brand)] text-[var(--brand-contrast)] hover:bg-[var(--brand-hover)]" : isInRange ? "font-medium text-[var(--brand-muted)] hover:bg-[var(--brand-bg-hover)]" : "text-[var(--text-primary)] hover:bg-[var(--bg-hover)]",
298
+ isToday && !isStart && !isEnd && !isInRange && !disabled && "ring-1 ring-inset ring-[var(--border-strong)]"
299
+ ),
300
+ children: dayNumber.format(d.getDate())
301
+ },
302
+ di
303
+ )
304
+ ] }, di);
305
+ }) }, wi)
306
+ ))
307
+ ]
90
308
  }
91
309
  ),
92
- /* @__PURE__ */ jsx("div", { className: "text-xs font-medium capitalize text-slate-700 dark:text-slate-200", children: monthLabel }),
93
- /* @__PURE__ */ jsx(
94
- "button",
95
- {
96
- type: "button",
97
- onClick: () => move(1),
98
- "aria-label": labels?.nextMonth ?? "Next month",
99
- className: "rounded p-1 text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",
100
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
101
- }
102
- )
103
- ] }),
104
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[10px] font-medium uppercase text-slate-400 dark:text-slate-500", children: weekdayLabels.map((w, i) => /* @__PURE__ */ jsx("div", { className: "py-0.5", children: w }, i)) }),
105
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-0.5", children: cells.map((d, i) => {
106
- if (!d) return /* @__PURE__ */ jsx("div", { className: "h-7" }, i);
107
- const disabled = isDisabled(d);
108
- const isStart = !disabled && fromDate && sameYmd(d, fromDate);
109
- const isEnd = !disabled && toDate && sameYmd(d, toDate);
110
- const isToday = sameYmd(d, today);
111
- const isInRange = !disabled && inRange(d) && !isStart && !isEnd;
112
- return /* @__PURE__ */ jsx(
113
- "button",
114
- {
115
- type: "button",
116
- disabled,
117
- onClick: () => handleClick(d),
118
- className: cn(
119
- "h-7 text-xs rounded transition-colors",
120
- disabled ? "cursor-not-allowed text-slate-300 dark:text-slate-600" : isStart || isEnd ? "bg-sky-600 text-white hover:bg-sky-700 dark:bg-sky-500 dark:hover:bg-sky-400" : isInRange ? "bg-sky-100 text-sky-800 hover:bg-sky-200 dark:bg-sky-500/20 dark:text-sky-200" : "text-slate-700 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",
121
- isToday && !isStart && !isEnd && !isInRange && !disabled && "ring-1 ring-inset ring-slate-300 dark:ring-slate-600"
122
- ),
123
- children: d.getDate()
124
- },
125
- i
126
- );
127
- }) })
128
- ] });
310
+ mode === "range" && /* @__PURE__ */ jsx("span", { id: hintId, className: "sr-only-fixed", children: rangeHint }),
311
+ /* @__PURE__ */ jsx("span", { ...regionProps })
312
+ ] })
313
+ );
129
314
  }
130
315
  export {
316
+ DEFAULT_MINI_CALENDAR_LABELS,
131
317
  MiniCalendar
132
318
  };
133
319
  //# sourceMappingURL=mini-calendar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/mini-calendar.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { parseIsoDate, sameYmd, toLocalIso } from \"../lib/dates\";\n\nexport interface MiniCalendarProps {\n from: string;\n to: string;\n locale: string;\n onSelect: (from: string, to: string) => void;\n /** `\"range\"` (default) = two-click from→to; `\"single\"` = one click selects a\n * single day (emitted as `onSelect(iso, iso)`). */\n mode?: \"single\" | \"range\";\n /** Optional inclusive ISO bounds; days outside `[min, max]` are disabled. */\n min?: string;\n max?: string;\n /** Screen-reader names for the two month arrows. The package carries no\n * translation catalog (see the README), so every user-facing string is a prop\n * with an English default — these two were the exception, and a German app\n * reached this component through a bare re-export and announced them in\n * English on a page whose `<html lang>` says `de`. */\n labels?: { previousMonth?: string; nextMonth?: string };\n}\n\n/**\n * Month-grid range picker used by the data-table date filter. Click once to set\n * the start (and clear the end), click again to set the end; clicking with a\n * full range already selected starts over. Monday-first, locale-aware labels.\n * In `single` mode each click selects one day. Days outside `min`/`max` (when\n * given) are disabled.\n */\nexport function MiniCalendar({\n from,\n to,\n locale,\n onSelect,\n mode = \"range\",\n min,\n max,\n labels,\n}: MiniCalendarProps) {\n const fromDate = parseIsoDate(from);\n const toDate = parseIsoDate(to);\n const minDate = min ? parseIsoDate(min) : null;\n const maxDate = max ? parseIsoDate(max) : null;\n const isDisabled = (d: Date) => Boolean((minDate && d < minDate) || (maxDate && d > maxDate));\n const initial = fromDate ?? toDate ?? new Date();\n const [view, setView] = useState<{ year: number; month: number }>({\n year: initial.getFullYear(),\n month: initial.getMonth(),\n });\n const [lastKey, setLastKey] = useState(`${from}|${to}`);\n const currentKey = `${from}|${to}`;\n if (currentKey !== lastKey) {\n setLastKey(currentKey);\n const next = parseIsoDate(from) ?? parseIsoDate(to);\n if (next && (next.getFullYear() !== view.year || next.getMonth() !== view.month)) {\n setView({ year: next.getFullYear(), month: next.getMonth() });\n }\n }\n\n const firstOfMonth = new Date(view.year, view.month, 1);\n const lastOfMonth = new Date(view.year, view.month + 1, 0);\n // Monday-first grid\n const startWeekday = (firstOfMonth.getDay() + 6) % 7;\n const cells: (Date | null)[] = [];\n for (let i = 0; i < startWeekday; i++) cells.push(null);\n for (let d = 1; d <= lastOfMonth.getDate(); d++) cells.push(new Date(view.year, view.month, d));\n while (cells.length % 7 !== 0) cells.push(null);\n\n const monthLabel = firstOfMonth.toLocaleDateString(locale, { month: \"long\", year: \"numeric\" });\n\n // Monday..Sunday short weekday labels via locale\n const weekdayLabels = useMemo(() => {\n const ref = new Date(2024, 0, 1); // a Monday\n return Array.from({ length: 7 }, (_, i) => {\n const d = new Date(ref);\n d.setDate(ref.getDate() + i);\n return d.toLocaleDateString(locale, { weekday: \"narrow\" });\n });\n }, [locale]);\n\n const move = (delta: number) => {\n setView((v) => {\n const d = new Date(v.year, v.month + delta, 1);\n return { year: d.getFullYear(), month: d.getMonth() };\n });\n };\n\n const handleClick = (d: Date) => {\n const iso = toLocalIso(d);\n if (mode === \"single\") {\n onSelect(iso, iso);\n return;\n }\n const f = parseIsoDate(from);\n const tt = parseIsoDate(to);\n if (!f || (f && tt)) {\n // start a new selection\n onSelect(iso, \"\");\n return;\n }\n // f set, tt empty\n if (d < f) {\n onSelect(iso, toLocalIso(f));\n } else {\n onSelect(toLocalIso(f), iso);\n }\n };\n\n const today = new Date();\n const inRange = (d: Date) => {\n if (!fromDate || !toDate) return false;\n return d >= fromDate && d <= toDate;\n };\n\n return (\n <div className=\"select-none\">\n <div className=\"flex items-center justify-between pb-1\">\n <button\n type=\"button\"\n onClick={() => move(-1)}\n aria-label={labels?.previousMonth ?? \"Previous month\"}\n className=\"rounded p-1 text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800\"\n >\n <ChevronLeft className=\"size-4\" />\n </button>\n <div className=\"text-xs font-medium capitalize text-slate-700 dark:text-slate-200\">{monthLabel}</div>\n <button\n type=\"button\"\n onClick={() => move(1)}\n aria-label={labels?.nextMonth ?? \"Next month\"}\n className=\"rounded p-1 text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800\"\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n <div className=\"grid grid-cols-7 gap-0.5 text-center text-[10px] font-medium uppercase text-slate-400 dark:text-slate-500\">\n {weekdayLabels.map((w, i) => (\n <div key={i} className=\"py-0.5\">{w}</div>\n ))}\n </div>\n <div className=\"grid grid-cols-7 gap-0.5\">\n {cells.map((d, i) => {\n if (!d) return <div key={i} className=\"h-7\" />;\n const disabled = isDisabled(d);\n const isStart = !disabled && fromDate && sameYmd(d, fromDate);\n const isEnd = !disabled && toDate && sameYmd(d, toDate);\n const isToday = sameYmd(d, today);\n const isInRange = !disabled && inRange(d) && !isStart && !isEnd;\n return (\n <button\n key={i}\n type=\"button\"\n disabled={disabled}\n onClick={() => handleClick(d)}\n className={cn(\n \"h-7 text-xs rounded transition-colors\",\n disabled\n ? \"cursor-not-allowed text-slate-300 dark:text-slate-600\"\n : isStart || isEnd\n ? \"bg-sky-600 text-white hover:bg-sky-700 dark:bg-sky-500 dark:hover:bg-sky-400\"\n : isInRange\n ? \"bg-sky-100 text-sky-800 hover:bg-sky-200 dark:bg-sky-500/20 dark:text-sky-200\"\n : \"text-slate-700 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800\",\n isToday && !isStart && !isEnd && !isInRange && !disabled && \"ring-1 ring-inset ring-slate-300 dark:ring-slate-600\",\n )}\n >\n {d.getDate()}\n </button>\n );\n })}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AAAA,QAAC;AAAA;AAAA,UAEC,MAAK;AAAA,UACL;AAAA,UACA,SAAS,MAAM,YAAY,CAAC;AAAA,UAC5B,WAAW;AAAA,YACT;AAAA,YACA,WACI,0DACA,WAAW,QACT,iFACA,YACE,kFACA;AAAA,YACR,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY;AAAA,UAC9D;AAAA,UAEC,YAAE,QAAQ;AAAA;AAAA,QAhBN;AAAA,MAiBP;AAAA,IAEJ,CAAC,GACH;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/mini-calendar.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, KeyboardEvent } from \"react\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useAnnounce } from \"../hooks/use-announce\";\nimport { parseIsoDate, sameYmd, toLocalIso } from \"../lib/dates\";\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\n\n/**\n * Every string this calendar can speak — the `miniCalendar` namespace of\n * `<UiKitProvider labels>`, overridable per instance through the `labels` prop. The\n * package carries no translation catalog (see the README), so the English defaults\n * below are a starting point and not a commitment. `previousMonth`/`nextMonth` were already props for the\n * reason the audit records: a German app reached this component through a bare\n * re-export and announced its two icon-only arrows in English on a page whose\n * `<html lang>` says `de`.\n *\n * The month caption is deliberately NOT here. It is produced by `Intl` from the\n * `locale` prop, so it is already in the user's language, and the grid takes its\n * accessible name from that element rather than from a string someone has to\n * translate a second time.\n *\n * The ones that interpolate a date are FUNCTIONS taking the formatted date, for the\n * reason `DataTableLabels` gives for its counted strings: a value glued into an\n * English template literal is untranslatable, and the grammar around a date moves\n * with it in most languages.\n */\nexport interface MiniCalendarLabels {\n previousMonth: string;\n nextMonth: string;\n /**\n * Accessible name of one day cell, given that day formatted in `locale`\n * (\"Monday, 14 September 2026\").\n *\n * The name has to carry the WHOLE date. The visible text of a cell is the day\n * number alone, and \"14\" on its own tells a screen-reader user nothing — not the\n * month they have arrowed into, not the year, not the weekday they are picking.\n */\n day: (date: string) => string;\n /** Range mode: what the NEXT click will set. Spoken after every click, and the\n * grid's description while the panel is open. */\n chooseStart: string;\n chooseEnd: string;\n /** Range mode: spoken after the click that set the start. */\n startSelected: (date: string) => string;\n /** Range mode: spoken after the click that completed the range. */\n rangeSelected: (from: string, to: string) => string;\n}\n\n/** English defaults. Exported as the `miniCalendar` namespace of `UiKitLabels`\n * (src/i18n), the complete reference a translation is written against. */\nexport const DEFAULT_MINI_CALENDAR_LABELS: MiniCalendarLabels = {\n previousMonth: \"Previous month\",\n nextMonth: \"Next month\",\n day: (date) => date,\n chooseStart: \"Choose a start date\",\n chooseEnd: \"Choose an end date\",\n startSelected: (date) => `${date} selected as the start. Choose an end date.`,\n rangeSelected: (from, to) => `${from} to ${to} selected. Choose a start date to begin again.`,\n};\n\n/**\n * How a day is spoken. The weekday is in there on purpose: picking a date is very\n * often picking a *day of the week* (\"the first Monday\"), and a grid that makes you\n * count columns to find one is a grid you cannot use without sight.\n */\nconst DAY_NAME_FORMAT: Intl.DateTimeFormatOptions = {\n weekday: \"long\",\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n};\n\n/**\n * `onSelect` is omitted from the `<div>` attributes and kept as this component's own:\n * the DOM event of that name is a text-selection event taking one argument, and this one\n * answers with the two ISO dates a range is made of. Everything else a `<div>` takes\n * passes through to the root, so a tour anchor or a test id can find the calendar —\n * before this, a closed prop list dropped both (audit §api-design).\n */\nexport interface MiniCalendarProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onSelect\"> {\n from: string;\n to: string;\n /**\n * BCP 47 tag for the month caption, the weekday heads, the day numbers and the\n * spoken dates. Optional since the kit grew `<UiKitProvider locale>`: a calendar\n * NESTED in another kit component (the data table's date filter) has no call site\n * of its own to pass one at, so it reads the provider's. Without either, `Intl`\n * uses the runtime's default.\n */\n locale?: string;\n /**\n * The weekday the grid starts on, `0` = Sunday … `6` = Saturday (as `Date#getDay`).\n * Defaults to the LOCALE's first day — Monday in most of Europe, Sunday in the US,\n * Saturday in much of the Arab world — which is what the user's own wall calendar\n * does. It was hard-wired to Monday before, which is wrong for most of the people\n * who use a Sunday-first calendar and invisible to the people who wrote this one.\n */\n weekStartsOn?: WeekDay;\n onSelect: (from: string, to: string) => void;\n /** `\"range\"` (default) = two-click from→to; `\"single\"` = one click selects a\n * single day (emitted as `onSelect(iso, iso)`). */\n mode?: \"single\" | \"range\";\n /** Optional inclusive ISO bounds; days outside `[min, max]` are disabled. */\n min?: string;\n max?: string;\n /** User-facing strings; see {@link MiniCalendarLabels}. */\n labels?: Partial<MiniCalendarLabels>;\n /**\n * Take focus to the day the grid opens on — the selected one, or today — when this\n * calendar mounts. For a panel that opened BECAUSE the user asked to pick a date:\n * landing them on the day they are editing is the difference between one arrow key\n * and a hunt through 42 cells.\n *\n * Off by default, and not called `autoFocus`, because it is not the same promise as\n * the DOM attribute of that name: a calendar rendered INLINE (the data-table's\n * column filter draws one above its from/to inputs) must not take the page's focus\n * merely by existing.\n */\n focusOnOpen?: boolean;\n /** Extra classes for the calendar's root. */\n className?: string;\n}\n\nexport type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * The first day of the week in `locale`, as a `Date#getDay` index.\n *\n * `Intl.Locale#getWeekInfo()` is the standard spelling; V8 shipped it first as the\n * `weekInfo` accessor, and Firefox has neither yet — hence both reads and a Monday\n * fallback, which is ISO 8601 and what this grid did unconditionally before. Its\n * `firstDay` counts 1 = Monday … 7 = Sunday, so `% 7` maps it onto `getDay`.\n */\nfunction localeWeekStart(locale: string | undefined): WeekDay {\n try {\n const tag = locale ?? new Intl.DateTimeFormat().resolvedOptions().locale;\n const loc = new Intl.Locale(tag) as Intl.Locale & {\n getWeekInfo?: () => { firstDay: number };\n weekInfo?: { firstDay: number };\n };\n const firstDay = (loc.getWeekInfo?.() ?? loc.weekInfo)?.firstDay;\n if (typeof firstDay === \"number\") return (firstDay % 7) as WeekDay;\n } catch {\n // A malformed tag throws from `Intl.Locale`; the calendar still has to render.\n }\n return 1;\n}\n\n/** Where `d` sits in a week that starts on `weekStart` (the first column = 0). */\nconst weekdayIndex = (d: Date, weekStart: WeekDay) => (d.getDay() - weekStart + 7) % 7;\n\n/** Move `d` by whole months, keeping the day of the month where the target has one.\n * `setMonth` alone ROLLS OVER — 31 January + 1 month is 3 March — which would skip\n * February entirely for anyone paging through the year with PageDown. */\nfunction stepMonths(d: Date, months: number): Date {\n const day = d.getDate();\n const out = new Date(d.getFullYear(), d.getMonth() + months, 1);\n const lastOfTarget = new Date(out.getFullYear(), out.getMonth() + 1, 0).getDate();\n out.setDate(Math.min(day, lastOfTarget));\n return out;\n}\n\n/**\n * Month-grid range picker used by the data-table date filter. Click once to set\n * the start (and clear the end), click again to set the end; clicking with a\n * full range already selected starts over. The week starts where the locale's does\n * (or at `weekStartsOn`), and every label comes from `Intl` in that locale.\n * In `single` mode each click selects one day. Days outside `min`/`max` (when\n * given) are disabled.\n *\n * **It is a grid, in the APG sense** (audit §a11y, \"MiniCalendar is unusable with a\n * keyboard or screen reader\"). Before this it was 42 buttons in a `grid-cols-7` div:\n * every one of them in the tab order, none of them saying which date it was, and no\n * way to reach next month without a mouse. Now the month is a `role=\"grid\"` of rows\n * and `gridcell`s, exactly one day is tabbable (the roving tabindex), and the arrows\n * walk the calendar the way the pattern says — day, week, month — crossing into the\n * neighbouring month by MOVING the grid rather than stopping at its edge.\n *\n * Out-of-range days are `aria-disabled` rather than `disabled`, which is the APG\n * guidance and not a shortcut: a `disabled` button cannot be focused, so a bounded\n * month would have holes that the roving tabindex falls into. They stay reachable and\n * readable, and the click handler is what refuses them.\n */\nexport function MiniCalendar({\n from,\n to,\n locale: localeProp,\n weekStartsOn,\n onSelect,\n mode = \"range\",\n min,\n max,\n labels: labelsProp,\n focusOnOpen,\n className,\n ...rest\n}: MiniCalendarProps) {\n const labels = useKitLabels(\"miniCalendar\", DEFAULT_MINI_CALENDAR_LABELS, labelsProp);\n const locale = useKitLocale(localeProp);\n const weekStart = useMemo(\n () => weekStartsOn ?? localeWeekStart(locale),\n [weekStartsOn, locale],\n );\n // Day numbers through `Intl` too: `getDate()` is always ASCII digits, and a locale\n // that writes its own (Arabic, Persian, Bengali …) would get a grid of foreign\n // numerals under a caption in its own script.\n const dayNumber = useMemo(() => new Intl.NumberFormat(locale), [locale]);\n const fromDate = parseIsoDate(from);\n const toDate = parseIsoDate(to);\n const minDate = min ? parseIsoDate(min) : null;\n const maxDate = max ? parseIsoDate(max) : null;\n const isDisabled = (d: Date) => Boolean((minDate && d < minDate) || (maxDate && d > maxDate));\n\n const gridRef = useRef<HTMLDivElement>(null);\n const id = useId();\n const monthId = `${id}-month`;\n const hintId = `${id}-hint`;\n const { announce, regionProps } = useAnnounce();\n\n /**\n * The day that holds the tab order, and with it the visible month — one piece of\n * state, not two, because they cannot be allowed to disagree: a tabbable cell in a\n * month that is not on screen is a tab stop that focuses nothing.\n *\n * Starts on the selection, or on today when there is none, pulled inside `[min, max]`\n * so a bounded calendar opens on a day it will actually let you pick.\n */\n const [activeIso, setActiveIso] = useState(() => {\n const start = fromDate ?? toDate ?? new Date();\n if (minDate && start < minDate) return toLocalIso(minDate);\n if (maxDate && start > maxDate) return toLocalIso(maxDate);\n return toLocalIso(start);\n });\n\n // Follow the caller's value when it changes from outside (a preset, a cleared\n // filter, a form reset). Written as a render-phase adjustment rather than an effect\n // so the grid never paints one frame on the old month.\n const [lastValue, setLastValue] = useState({ from, to });\n if (lastValue.from !== from || lastValue.to !== to) {\n // Follow the end that actually CHANGED, not `from` unconditionally. Picking the\n // end of a range that spans months used to send the grid back to the start's\n // month — which with a roving tabindex means the cell the user just activated is\n // no longer rendered, and their focus goes with it to `<body>`.\n const changed = lastValue.from !== from ? from : to;\n setLastValue({ from, to });\n const next = parseIsoDate(changed) ?? fromDate ?? toDate;\n if (next && toLocalIso(next) !== activeIso) setActiveIso(toLocalIso(next));\n }\n\n const activeDate = parseIsoDate(activeIso) ?? new Date();\n const view = { year: activeDate.getFullYear(), month: activeDate.getMonth() };\n\n const firstOfMonth = new Date(view.year, view.month, 1);\n const lastOfMonth = new Date(view.year, view.month + 1, 0);\n // Leading blanks up to the first of the month, counted from the week's first day.\n const startWeekday = weekdayIndex(firstOfMonth, weekStart);\n const cells: (Date | null)[] = [];\n for (let i = 0; i < startWeekday; i++) cells.push(null);\n for (let d = 1; d <= lastOfMonth.getDate(); d++) cells.push(new Date(view.year, view.month, d));\n while (cells.length % 7 !== 0) cells.push(null);\n const weeks: (Date | null)[][] = [];\n for (let i = 0; i < cells.length; i += 7) weeks.push(cells.slice(i, i + 7));\n\n const monthLabel = firstOfMonth.toLocaleDateString(locale, { month: \"long\", year: \"numeric\" });\n const formatDay = (d: Date) => d.toLocaleDateString(locale, DAY_NAME_FORMAT);\n\n // Weekday labels via locale, from the week's first day: the narrow one for the\n // column head, the long one as its accessible name — \"M\" is the same letter for\n // Monday, March and May, and a column header is the one place a screen reader\n // reads it on its own.\n const weekdayLabels = useMemo(() => {\n const ref = new Date(2024, 0, 7 + weekStart); // 7 January 2024 was a Sunday\n return Array.from({ length: 7 }, (_, i) => {\n const d = new Date(ref);\n d.setDate(ref.getDate() + i);\n return {\n narrow: d.toLocaleDateString(locale, { weekday: \"narrow\" }),\n long: d.toLocaleDateString(locale, { weekday: \"long\" }),\n };\n });\n }, [locale, weekStart]);\n\n /**\n * A day whose cell has to take focus once it exists. Arrowing off the edge of the\n * month renders a different month, so the element to focus is not in the DOM at the\n * time the key is handled — it is one commit away.\n */\n const pendingFocus = useRef<string | null>(null);\n useEffect(() => {\n const iso = pendingFocus.current;\n if (!iso) return;\n pendingFocus.current = null;\n gridRef.current?.querySelector<HTMLElement>(`[data-iso=\"${iso}\"]`)?.focus();\n });\n\n // The roving tab stop is the day to open on, so there is nothing else to work out\n // here — it is already the selection, or today, pulled inside the bounds.\n useEffect(() => {\n if (!focusOnOpen) return;\n gridRef.current?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus();\n }, [focusOnOpen]);\n\n /** Move the roving tabindex, and the month with it when the day lands outside. */\n const moveTo = (d: Date, focus: boolean) => {\n const iso = toLocalIso(d);\n if (iso === activeIso) return;\n if (focus) pendingFocus.current = iso;\n setActiveIso(iso);\n };\n\n /**\n * On each day rather than once on the grid: the cell is where focus is, and a\n * container listening for keys it cannot itself receive is the shape\n * `jsx-a11y/interactive-supports-focus` objects to. One shared function, not a\n * closure per cell — it reads the active day from state, which is always the\n * focused one.\n */\n const onDayKeyDown = (e: KeyboardEvent<HTMLButtonElement>) => {\n const next = new Date(activeDate);\n switch (e.key) {\n case \"ArrowLeft\":\n next.setDate(next.getDate() - 1);\n break;\n case \"ArrowRight\":\n next.setDate(next.getDate() + 1);\n break;\n case \"ArrowUp\":\n next.setDate(next.getDate() - 7);\n break;\n case \"ArrowDown\":\n next.setDate(next.getDate() + 7);\n break;\n case \"Home\":\n next.setDate(next.getDate() - weekdayIndex(next, weekStart));\n break;\n case \"End\":\n next.setDate(next.getDate() + (6 - weekdayIndex(next, weekStart)));\n break;\n // Shift+Page is the year step, as in the APG example. It is the only way to\n // reach a birth year without holding PageUp for four hundred keystrokes.\n case \"PageUp\":\n next.setTime(stepMonths(next, e.shiftKey ? -12 : -1).getTime());\n break;\n case \"PageDown\":\n next.setTime(stepMonths(next, e.shiftKey ? 12 : 1).getTime());\n break;\n default:\n return;\n }\n // Before the no-op check: every key above also scrolls the panel this calendar\n // usually sits in, and a day that cannot move still must not move the page.\n e.preventDefault();\n moveTo(next, true);\n };\n\n const moveMonth = (delta: number) => {\n // Focus stays on the arrow button the user is pressing — only the grid moves.\n moveTo(stepMonths(activeDate, delta), false);\n };\n\n const handleClick = (d: Date) => {\n // The guard that `disabled` used to be. Out-of-range days are focusable on\n // purpose (see the component note), so refusing the click is this function's job.\n if (isDisabled(d)) return;\n const iso = toLocalIso(d);\n // Keep the tab order on the day that was just activated even if the caller\n // ignores the selection — a controlled component may reject it, and the roving\n // tabindex is this component's own state, not an echo of the value.\n moveTo(d, false);\n if (mode === \"single\") {\n onSelect(iso, iso);\n return;\n }\n const f = parseIsoDate(from);\n const tt = parseIsoDate(to);\n if (!f || (f && tt)) {\n // start a new selection\n onSelect(iso, \"\");\n announce(labels.startSelected(formatDay(d)));\n return;\n }\n // f set, tt empty\n if (d < f) {\n onSelect(iso, toLocalIso(f));\n announce(labels.rangeSelected(formatDay(d), formatDay(f)));\n } else {\n onSelect(toLocalIso(f), iso);\n announce(labels.rangeSelected(formatDay(f), formatDay(d)));\n }\n };\n\n const today = new Date();\n const hasBand = Boolean(fromDate && toDate && !sameYmd(fromDate, toDate));\n const daysInMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();\n const inRange = (d: Date) => {\n if (!fromDate || !toDate) return false;\n return d >= fromDate && d <= toDate;\n };\n\n // What the next click does. A range is two clicks and nothing on screen says which\n // one you are on — sighted users read it off the highlighted start.\n const awaitingEnd = Boolean(fromDate) && !toDate;\n const rangeHint = awaitingEnd ? labels.chooseEnd : labels.chooseStart;\n\n return (\n // The caller's classes come last, so tailwind-merge lets them win the way\n // `className` does everywhere else in the kit; `...rest` first, as in the rest of\n // this wave, so nothing from outside can take the grid's own wiring away.\n <div {...rest} className={cn(\"select-none\", className)}>\n <div className=\"flex items-center justify-between pb-1\">\n <button\n type=\"button\"\n onClick={() => moveMonth(-1)}\n aria-label={labels.previousMonth}\n className=\"rounded p-1 text-[var(--text-muted)] hover:bg-[var(--bg-hover)]\"\n >\n <ChevronLeft className=\"size-4\" />\n </button>\n {/* Named by this element rather than by a string of its own, and `aria-live`\n so paging months says which month you have landed on — the caption is the\n only thing on screen that changes when the grid moves, and the user\n pressing the arrow is not inside the grid to hear the cells change. */}\n <div\n id={monthId}\n aria-live=\"polite\"\n className=\"text-xs font-medium capitalize text-[var(--text-secondary)]\"\n >\n {monthLabel}\n </div>\n <button\n type=\"button\"\n onClick={() => moveMonth(1)}\n aria-label={labels.nextMonth}\n className=\"rounded p-1 text-[var(--text-muted)] hover:bg-[var(--bg-hover)]\"\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n <div\n ref={gridRef}\n role=\"grid\"\n aria-labelledby={monthId}\n aria-describedby={mode === \"range\" ? hintId : undefined}\n className=\"grid gap-y-0.5\"\n >\n <div\n role=\"row\"\n className=\"grid grid-cols-7 text-center text-[10px] font-medium uppercase text-[var(--text-placeholder)]\"\n >\n {weekdayLabels.map((w, i) => (\n <div key={i} role=\"columnheader\" aria-label={w.long} className=\"py-0.5\">\n {w.narrow}\n </div>\n ))}\n </div>\n {weeks.map((week, wi) => (\n // No column gap: the days of a range join into ONE band. With a gap each day\n // was its own tinted box, and a selected fortnight read as fourteen chips.\n <div key={wi} role=\"row\" className=\"grid grid-cols-7\">\n {week.map((d, di) => {\n // The padding cells still have to BE cells, or the rows are ragged and\n // a screen reader's \"column 3\" stops meaning Wednesday.\n if (!d) return <div key={di} role=\"gridcell\" className=\"h-8\" />;\n const iso = toLocalIso(d);\n const disabled = isDisabled(d);\n const isStart = !disabled && fromDate && sameYmd(d, fromDate);\n const isEnd = !disabled && toDate && sameYmd(d, toDate);\n const isToday = sameYmd(d, today);\n const isInRange = !disabled && inRange(d) && !isStart && !isEnd;\n const isActive = iso === activeIso;\n // The band behind the day: full width between the ends, half width at an\n // end (so the round endpoint sits ON the band's tip), rounded where a row\n // or the month breaks it. Only when both ends exist and differ — a lone\n // start is a dot, not a band of one.\n const banded =\n hasBand && !disabled && (isStart || isEnd || isInRange);\n const lastOfMonth = d.getDate() === daysInMonth(d);\n const band = banded\n ? cn(\n \"pointer-events-none absolute inset-y-0 bg-[var(--brand-bg)]\",\n isStart ? \"start-1/2 end-0\" : isEnd ? \"start-0 end-1/2\" : \"inset-x-0\",\n isInRange && (di === 0 || d.getDate() === 1) && \"rounded-s-full\",\n isInRange && (di === 6 || lastOfMonth) && \"rounded-e-full\",\n isStart && (di === 6 || lastOfMonth) && \"hidden\",\n isEnd && (di === 0 || d.getDate() === 1) && \"hidden\",\n )\n : null;\n return (\n <div key={di} role=\"none\" className=\"relative flex h-8 items-center justify-center\">\n {band && <span aria-hidden className={band} />}\n <button\n key={di}\n type=\"button\"\n role=\"gridcell\"\n data-iso={iso}\n // The roving tabindex: ONE tab stop for the whole month. Every day\n // being tabbable meant 31 stops between a date field and the next\n // control, which is the same reason the pattern exists.\n tabIndex={isActive ? 0 : -1}\n aria-label={labels.day(formatDay(d))}\n aria-selected={Boolean(isStart || isEnd || isInRange)}\n aria-disabled={disabled || undefined}\n aria-current={isToday ? \"date\" : undefined}\n onClick={() => handleClick(d)}\n onKeyDown={onDayKeyDown}\n className={cn(\n \"relative size-8 rounded-full text-xs tabular-nums transition-colors\",\n // A grid you can walk with the keyboard needs to show where the\n // keyboard IS. Inset because the cells sit half a pixel apart and\n // an outset ring would be drawn over by its neighbours; the\n // colour flips on the selected days for the reason the numpad's\n // \"Done\" key does — a --brand ring on a --brand fill is a ring\n // that exists only in the DOM.\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset\",\n isStart || isEnd\n ? \"focus-visible:ring-[var(--brand-contrast)]\"\n : \"focus-visible:ring-[var(--brand)]\",\n disabled\n ? \"cursor-not-allowed text-[var(--text-placeholder)]\"\n // The two selected states are the BRAND, not a fixed sky: the endpoints\n // are the solid fill and the days between them its soft tint. Hardcoding\n // them left an app that changed `--brand` with a calendar in the old\n // colour (docs/module-audit-2026-09-22.md §theming). Both token pairs\n // flip light/dark themselves, so there is no `dark:` partner to carry —\n // one would override the token and bring the hardcoded hue back.\n : isStart || isEnd\n ? \"bg-[var(--brand)] text-[var(--brand-contrast)] hover:bg-[var(--brand-hover)]\"\n : isInRange\n ? \"font-medium text-[var(--brand-muted)] hover:bg-[var(--brand-bg-hover)]\"\n : \"text-[var(--text-primary)] hover:bg-[var(--bg-hover)]\",\n isToday && !isStart && !isEnd && !isInRange && !disabled && \"ring-1 ring-inset ring-[var(--border-strong)]\",\n )}\n >\n {dayNumber.format(d.getDate())}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n {/* `sr-only-fixed`, not `sr-only`: this renders inside whatever panel a consumer\n opens it in, and there is no wrapper we can require to be `relative` — see\n the note on the class in tokens.css. */}\n {mode === \"range\" && (\n <span id={hintId} className=\"sr-only-fixed\">\n {rangeHint}\n </span>\n )}\n <span {...regionProps} />\n </div>\n );\n}\n"],"mappings":";AA0ZM,SAOI,KAPJ;AA1ZN,SAAS,WAAW,OAAO,SAAS,QAAQ,gBAAgB;AAE5D,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc,SAAS,kBAAkB;AAClD,SAAS,cAAc,oBAAoB;AA6CpC,MAAM,+BAAmD;AAAA,EAC9D,eAAe;AAAA,EACf,WAAW;AAAA,EACX,KAAK,CAAC,SAAS;AAAA,EACf,aAAa;AAAA,EACb,WAAW;AAAA,EACX,eAAe,CAAC,SAAS,GAAG,IAAI;AAAA,EAChC,eAAe,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;AAC/C;AAOA,MAAM,kBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AACR;AA+DA,SAAS,gBAAgB,QAAqC;AAC5D,MAAI;AACF,UAAM,MAAM,UAAU,IAAI,KAAK,eAAe,EAAE,gBAAgB,EAAE;AAClE,UAAM,MAAM,IAAI,KAAK,OAAO,GAAG;AAI/B,UAAM,YAAY,IAAI,cAAc,KAAK,IAAI,WAAW;AACxD,QAAI,OAAO,aAAa,SAAU,QAAQ,WAAW;AAAA,EACvD,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAGA,MAAM,eAAe,CAAC,GAAS,eAAwB,EAAE,OAAO,IAAI,YAAY,KAAK;AAKrF,SAAS,WAAW,GAAS,QAAsB;AACjD,QAAM,MAAM,EAAE,QAAQ;AACtB,QAAM,MAAM,IAAI,K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