@nocoo/basalt 2.2.0 → 3.0.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 (319) hide show
  1. package/README.md +2 -0
  2. package/ai/COMPATIBILITY.md +11 -1
  3. package/ai/DESIGN.md +342 -0
  4. package/ai/INTEGRATION.md +179 -128
  5. package/ai/RECIPES.md +51 -26
  6. package/ai/USAGE.md +4 -4
  7. package/ai/registry.json +2836 -270
  8. package/dist/charts/config.d.ts +11 -11
  9. package/dist/charts/config.js +4 -4
  10. package/dist/charts/config.js.map +1 -1
  11. package/dist/charts/date-navigation.js +10 -10
  12. package/dist/charts/date-navigation.js.map +1 -1
  13. package/dist/charts/donut.js +1 -1
  14. package/dist/charts/donut.js.map +1 -1
  15. package/dist/charts/frame.d.ts +1 -1
  16. package/dist/charts/frame.js +4 -4
  17. package/dist/charts/frame.js.map +1 -1
  18. package/dist/charts/gauge.js +5 -5
  19. package/dist/charts/gauge.js.map +1 -1
  20. package/dist/charts/heatmap-calendar.js +11 -11
  21. package/dist/charts/heatmap-calendar.js.map +1 -1
  22. package/dist/charts/heatmap-matrix.js +8 -8
  23. package/dist/charts/heatmap-matrix.js.map +1 -1
  24. package/dist/charts/item-list.js +1 -1
  25. package/dist/charts/item-list.js.map +1 -1
  26. package/dist/charts/legend.js +19 -19
  27. package/dist/charts/legend.js.map +1 -1
  28. package/dist/charts/palette.js +2 -2
  29. package/dist/charts/palette.js.map +1 -1
  30. package/dist/charts/slot-bar.js +2 -2
  31. package/dist/charts/slot-bar.js.map +1 -1
  32. package/dist/charts/sparkline.js +38 -23
  33. package/dist/charts/sparkline.js.map +1 -1
  34. package/dist/charts/stat-card.d.ts +2 -2
  35. package/dist/charts/stat-card.js +61 -58
  36. package/dist/charts/stat-card.js.map +1 -1
  37. package/dist/charts/timeline.js +18 -9
  38. package/dist/charts/timeline.js.map +1 -1
  39. package/dist/charts/tooltip.js +16 -16
  40. package/dist/charts/tooltip.js.map +1 -1
  41. package/dist/components/accordion.js +1 -1
  42. package/dist/components/accordion.js.map +1 -1
  43. package/dist/components/alert-dialog.js +4 -4
  44. package/dist/components/alert-dialog.js.map +1 -1
  45. package/dist/components/app-header.js +8 -8
  46. package/dist/components/app-header.js.map +1 -1
  47. package/dist/components/app-shell.js +1 -1
  48. package/dist/components/app-shell.js.map +1 -1
  49. package/dist/components/approval-card.d.ts +13 -0
  50. package/dist/components/approval-card.js +161 -0
  51. package/dist/components/approval-card.js.map +1 -0
  52. package/dist/components/avatar.d.ts +12 -0
  53. package/dist/components/avatar.js +39 -18
  54. package/dist/components/avatar.js.map +1 -1
  55. package/dist/components/badge.js +8 -8
  56. package/dist/components/badge.js.map +1 -1
  57. package/dist/components/banner.d.ts +2 -2
  58. package/dist/components/banner.js +9 -8
  59. package/dist/components/banner.js.map +1 -1
  60. package/dist/components/basalt-mark.js +1 -1
  61. package/dist/components/basalt-mark.js.map +1 -1
  62. package/dist/components/battery-meter.js +5 -5
  63. package/dist/components/battery-meter.js.map +1 -1
  64. package/dist/components/breadcrumbs.js +6 -6
  65. package/dist/components/breadcrumbs.js.map +1 -1
  66. package/dist/components/button.js +10 -10
  67. package/dist/components/button.js.map +1 -1
  68. package/dist/components/chat-bubble.js +4 -3
  69. package/dist/components/chat-bubble.js.map +1 -1
  70. package/dist/components/chat-composer.d.ts +21 -3
  71. package/dist/components/chat-composer.js +126 -60
  72. package/dist/components/chat-composer.js.map +1 -1
  73. package/dist/components/chat-header.js +6 -6
  74. package/dist/components/chat-header.js.map +1 -1
  75. package/dist/components/chat-inbox.js +34 -30
  76. package/dist/components/chat-inbox.js.map +1 -1
  77. package/dist/components/chat-markdown.d.ts +8 -0
  78. package/dist/components/chat-markdown.js +122 -0
  79. package/dist/components/chat-markdown.js.map +1 -0
  80. package/dist/components/chat-message.d.ts +26 -0
  81. package/dist/components/chat-message.js +145 -0
  82. package/dist/components/chat-message.js.map +1 -0
  83. package/dist/components/checkbox.js +11 -11
  84. package/dist/components/checkbox.js.map +1 -1
  85. package/dist/components/clipboard-text.js +3 -3
  86. package/dist/components/clipboard-text.js.map +1 -1
  87. package/dist/components/code.d.ts +22 -20
  88. package/dist/components/code.js +94 -32
  89. package/dist/components/code.js.map +1 -1
  90. package/dist/components/collapsible.js +8 -4
  91. package/dist/components/collapsible.js.map +1 -1
  92. package/dist/components/command-palette.js +73 -47
  93. package/dist/components/command-palette.js.map +1 -1
  94. package/dist/components/context-cards.d.ts +15 -0
  95. package/dist/components/context-cards.js +148 -0
  96. package/dist/components/context-cards.js.map +1 -0
  97. package/dist/components/context-menu.d.ts +1 -1
  98. package/dist/components/context-menu.js +18 -14
  99. package/dist/components/context-menu.js.map +1 -1
  100. package/dist/components/data-table.d.ts +8 -2
  101. package/dist/components/data-table.js +161 -106
  102. package/dist/components/data-table.js.map +1 -1
  103. package/dist/components/date-picker.js +13 -13
  104. package/dist/components/date-picker.js.map +1 -1
  105. package/dist/components/delete-resource.js +1 -1
  106. package/dist/components/delete-resource.js.map +1 -1
  107. package/dist/components/description-list.js +3 -3
  108. package/dist/components/description-list.js.map +1 -1
  109. package/dist/components/dialog.d.ts +2 -2
  110. package/dist/components/dialog.js +8 -8
  111. package/dist/components/dialog.js.map +1 -1
  112. package/dist/components/diff-table.d.ts +15 -0
  113. package/dist/components/diff-table.js +146 -0
  114. package/dist/components/diff-table.js.map +1 -0
  115. package/dist/components/dock.js +2 -2
  116. package/dist/components/dock.js.map +1 -1
  117. package/dist/components/dropdown-menu.js +23 -18
  118. package/dist/components/dropdown-menu.js.map +1 -1
  119. package/dist/components/editable-nav-item.js +63 -58
  120. package/dist/components/editable-nav-item.js.map +1 -1
  121. package/dist/components/empty.js +6 -6
  122. package/dist/components/empty.js.map +1 -1
  123. package/dist/components/fab.js +1 -1
  124. package/dist/components/fab.js.map +1 -1
  125. package/dist/components/field.js +3 -3
  126. package/dist/components/field.js.map +1 -1
  127. package/dist/components/file-dropzone.js +7 -7
  128. package/dist/components/file-dropzone.js.map +1 -1
  129. package/dist/components/filter-bar.js +6 -6
  130. package/dist/components/filter-bar.js.map +1 -1
  131. package/dist/components/flow.js +4 -3
  132. package/dist/components/flow.js.map +1 -1
  133. package/dist/components/grid.d.ts +3 -1
  134. package/dist/components/grid.js +15 -8
  135. package/dist/components/grid.js.map +1 -1
  136. package/dist/components/hover-card.js +1 -1
  137. package/dist/components/hover-card.js.map +1 -1
  138. package/dist/components/icon-picker.d.ts +8 -2
  139. package/dist/components/icon-picker.js +75 -47
  140. package/dist/components/icon-picker.js.map +1 -1
  141. package/dist/components/inline-editable.js +6 -6
  142. package/dist/components/inline-editable.js.map +1 -1
  143. package/dist/components/input-area.js +3 -3
  144. package/dist/components/input-area.js.map +1 -1
  145. package/dist/components/input-group.js +5 -5
  146. package/dist/components/input-group.js.map +1 -1
  147. package/dist/components/input.js +4 -4
  148. package/dist/components/input.js.map +1 -1
  149. package/dist/components/label.js +3 -3
  150. package/dist/components/label.js.map +1 -1
  151. package/dist/components/layer-card.d.ts +9 -4
  152. package/dist/components/layer-card.js +72 -67
  153. package/dist/components/layer-card.js.map +1 -1
  154. package/dist/components/loader.d.ts +16 -10
  155. package/dist/components/loader.js +46 -53
  156. package/dist/components/loader.js.map +1 -1
  157. package/dist/components/loading-screen.js +3 -3
  158. package/dist/components/loading-screen.js.map +1 -1
  159. package/dist/components/menu-bar.js +32 -27
  160. package/dist/components/menu-bar.js.map +1 -1
  161. package/dist/components/meter.d.ts +5 -5
  162. package/dist/components/meter.js +25 -12
  163. package/dist/components/meter.js.map +1 -1
  164. package/dist/components/multi-select.js +66 -62
  165. package/dist/components/multi-select.js.map +1 -1
  166. package/dist/components/navigation-menu.d.ts +2 -2
  167. package/dist/components/navigation-menu.js +22 -8
  168. package/dist/components/navigation-menu.js.map +1 -1
  169. package/dist/components/overlay.js +2 -2
  170. package/dist/components/overlay.js.map +1 -1
  171. package/dist/components/page-header.d.ts +3 -1
  172. package/dist/components/page-header.js +12 -12
  173. package/dist/components/page-header.js.map +1 -1
  174. package/dist/components/pagination.js +3 -3
  175. package/dist/components/pagination.js.map +1 -1
  176. package/dist/components/popover.js +18 -23
  177. package/dist/components/popover.js.map +1 -1
  178. package/dist/components/prompt-bar.d.ts +16 -0
  179. package/dist/components/prompt-bar.js +49 -0
  180. package/dist/components/prompt-bar.js.map +1 -0
  181. package/dist/components/radio.js +9 -9
  182. package/dist/components/radio.js.map +1 -1
  183. package/dist/components/recommendation-card.d.ts +13 -0
  184. package/dist/components/recommendation-card.js +123 -0
  185. package/dist/components/recommendation-card.js.map +1 -0
  186. package/dist/components/resource-list.js +1 -1
  187. package/dist/components/resource-list.js.map +1 -1
  188. package/dist/components/responsive-master-detail.js +4 -4
  189. package/dist/components/responsive-master-detail.js.map +1 -1
  190. package/dist/components/scroll-area.js +3 -3
  191. package/dist/components/scroll-area.js.map +1 -1
  192. package/dist/components/section-rule.d.ts +5 -3
  193. package/dist/components/section-rule.js +12 -12
  194. package/dist/components/section-rule.js.map +1 -1
  195. package/dist/components/segment-control.js +3 -3
  196. package/dist/components/segment-control.js.map +1 -1
  197. package/dist/components/select.js +47 -32
  198. package/dist/components/select.js.map +1 -1
  199. package/dist/components/sensitive-input.js +17 -19
  200. package/dist/components/sensitive-input.js.map +1 -1
  201. package/dist/components/sheet.d.ts +4 -4
  202. package/dist/components/sheet.js +11 -10
  203. package/dist/components/sheet.js.map +1 -1
  204. package/dist/components/sidebar.js +146 -137
  205. package/dist/components/sidebar.js.map +1 -1
  206. package/dist/components/skeleton-line.d.ts +1 -1
  207. package/dist/components/skeleton-line.js +2 -2
  208. package/dist/components/skeleton-line.js.map +1 -1
  209. package/dist/components/slider.js +2 -2
  210. package/dist/components/slider.js.map +1 -1
  211. package/dist/components/stat-strip.js +5 -4
  212. package/dist/components/stat-strip.js.map +1 -1
  213. package/dist/components/switch.js +6 -6
  214. package/dist/components/switch.js.map +1 -1
  215. package/dist/components/table-of-contents.js +5 -5
  216. package/dist/components/table-of-contents.js.map +1 -1
  217. package/dist/components/table-pager.js +2 -2
  218. package/dist/components/table-pager.js.map +1 -1
  219. package/dist/components/table.js +4 -4
  220. package/dist/components/table.js.map +1 -1
  221. package/dist/components/tabs.js +7 -6
  222. package/dist/components/tabs.js.map +1 -1
  223. package/dist/components/tag-badge.d.ts +10 -10
  224. package/dist/components/tag-badge.js +11 -11
  225. package/dist/components/tag-badge.js.map +1 -1
  226. package/dist/components/tag-color-picker.d.ts +8 -1
  227. package/dist/components/tag-color-picker.js +33 -25
  228. package/dist/components/tag-color-picker.js.map +1 -1
  229. package/dist/components/text.js +5 -5
  230. package/dist/components/text.js.map +1 -1
  231. package/dist/components/theme-toggle.js +1 -1
  232. package/dist/components/theme-toggle.js.map +1 -1
  233. package/dist/components/thinking.d.ts +16 -0
  234. package/dist/components/thinking.js +85 -0
  235. package/dist/components/thinking.js.map +1 -0
  236. package/dist/components/toast.js +25 -20
  237. package/dist/components/toast.js.map +1 -1
  238. package/dist/components/toggle-group.js +6 -5
  239. package/dist/components/toggle-group.js.map +1 -1
  240. package/dist/components/toggle.js +6 -6
  241. package/dist/components/toggle.js.map +1 -1
  242. package/dist/components/tool-chips.d.ts +12 -0
  243. package/dist/components/tool-chips.js +138 -0
  244. package/dist/components/tool-chips.js.map +1 -0
  245. package/dist/components/toolbar.js +3 -3
  246. package/dist/components/toolbar.js.map +1 -1
  247. package/dist/components/tooltip.js +1 -1
  248. package/dist/components/tooltip.js.map +1 -1
  249. package/dist/components/typeahead-field.js +59 -56
  250. package/dist/components/typeahead-field.js.map +1 -1
  251. package/dist/components/upload-queue.js +15 -14
  252. package/dist/components/upload-queue.js.map +1 -1
  253. package/dist/models/agent-feedback.d.ts +44 -0
  254. package/dist/models/agent-feedback.js +28 -0
  255. package/dist/models/agent-feedback.js.map +1 -0
  256. package/dist/models/avatar.d.ts +2 -0
  257. package/dist/models/avatar.js +15 -0
  258. package/dist/models/avatar.js.map +1 -0
  259. package/dist/models/code.d.ts +6 -0
  260. package/dist/models/code.js +24 -0
  261. package/dist/models/code.js.map +1 -0
  262. package/dist/models/context-cards.d.ts +13 -0
  263. package/dist/models/context-cards.js +17 -0
  264. package/dist/models/context-cards.js.map +1 -0
  265. package/dist/models/diff-table.d.ts +12 -0
  266. package/dist/models/diff-table.js +9 -0
  267. package/dist/models/diff-table.js.map +1 -0
  268. package/dist/models/recommendation.d.ts +26 -0
  269. package/dist/models/recommendation.js +23 -0
  270. package/dist/models/recommendation.js.map +1 -0
  271. package/dist/styles/base.css +14 -2
  272. package/dist/styles/standalone.css +1865 -929
  273. package/dist/styles/tailwind.css +179 -13
  274. package/dist/styles/tokens.css +679 -20
  275. package/dist/utils/cn.js +25 -4
  276. package/dist/utils/cn.js.map +1 -1
  277. package/dist/utils/control-surface.d.ts +1 -1
  278. package/dist/utils/control-surface.js +1 -1
  279. package/dist/utils/control-surface.js.map +1 -1
  280. package/dist/utils/navigation.d.ts +3 -0
  281. package/dist/utils/navigation.js +8 -0
  282. package/dist/utils/navigation.js.map +1 -0
  283. package/dist/utils/selection-indicator.d.ts +1 -1
  284. package/dist/utils/selection-indicator.js +49 -72
  285. package/dist/utils/selection-indicator.js.map +1 -1
  286. package/dist/utils/use-hover-highlight.d.ts +4 -0
  287. package/dist/utils/use-hover-highlight.js +80 -0
  288. package/dist/utils/use-hover-highlight.js.map +1 -0
  289. package/dist/viewmodels/use-approval-card.d.ts +20 -0
  290. package/dist/viewmodels/use-approval-card.js +83 -0
  291. package/dist/viewmodels/use-approval-card.js.map +1 -0
  292. package/dist/viewmodels/use-chat-composer.d.ts +16 -0
  293. package/dist/viewmodels/use-chat-composer.js +34 -0
  294. package/dist/viewmodels/use-chat-composer.js.map +1 -0
  295. package/dist/viewmodels/use-chat-message.d.ts +16 -0
  296. package/dist/viewmodels/use-chat-message.js +26 -0
  297. package/dist/viewmodels/use-chat-message.js.map +1 -0
  298. package/dist/viewmodels/use-code-block.d.ts +8 -0
  299. package/dist/viewmodels/use-code-block.js +38 -0
  300. package/dist/viewmodels/use-code-block.js.map +1 -0
  301. package/dist/viewmodels/use-context-cards.d.ts +17 -0
  302. package/dist/viewmodels/use-context-cards.js +18 -0
  303. package/dist/viewmodels/use-context-cards.js.map +1 -0
  304. package/dist/viewmodels/use-diff-table.d.ts +16 -0
  305. package/dist/viewmodels/use-diff-table.js +42 -0
  306. package/dist/viewmodels/use-diff-table.js.map +1 -0
  307. package/dist/viewmodels/use-loader.d.ts +4 -0
  308. package/dist/viewmodels/use-loader.js +22 -0
  309. package/dist/viewmodels/use-loader.js.map +1 -0
  310. package/dist/viewmodels/use-recommendation-card.d.ts +17 -0
  311. package/dist/viewmodels/use-recommendation-card.js +41 -0
  312. package/dist/viewmodels/use-recommendation-card.js.map +1 -0
  313. package/dist/viewmodels/use-thinking.d.ts +13 -0
  314. package/dist/viewmodels/use-thinking.js +18 -0
  315. package/dist/viewmodels/use-thinking.js.map +1 -0
  316. package/dist/viewmodels/use-tool-chips.d.ts +10 -0
  317. package/dist/viewmodels/use-tool-chips.js +20 -0
  318. package/dist/viewmodels/use-tool-chips.js.map +1 -0
  319. package/package.json +3 -1
@@ -399,7 +399,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
399
399
  readOnly: L,
400
400
  min: b === "range" ? void 0 : A,
401
401
  max: b === "range" ? void 0 : j,
402
- className: "sr-only mb-2 h-7",
402
+ className: "sr-only mb-basalt-space-lg min-h-basalt-control-inset",
403
403
  style: {
404
404
  position: "absolute",
405
405
  width: 1,
@@ -438,12 +438,12 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
438
438
  Pe && Ie ? /* @__PURE__ */ f("span", {
439
439
  id: He,
440
440
  role: "alert",
441
- className: "mt-1 block text-xs text-basalt-destructive",
441
+ className: "mt-basalt-space-sm block text-basalt-sm text-basalt-destructive",
442
442
  children: Ie
443
443
  }) : null,
444
444
  /* @__PURE__ */ p(r, {
445
445
  arrow: !1,
446
- className: "w-64 p-3",
446
+ className: "w-basalt-64 p-basalt-space-lg",
447
447
  "aria-label": ct,
448
448
  "aria-describedby": Ke,
449
449
  onOpenAutoFocus: (e) => {
@@ -459,18 +459,18 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
459
459
  },
460
460
  children: [
461
461
  he && he.length > 0 ? /* @__PURE__ */ f("div", {
462
- className: "mb-2 flex flex-wrap gap-1",
462
+ className: "mb-basalt-space-lg flex flex-wrap gap-basalt-space-sm",
463
463
  children: he.map((e) => /* @__PURE__ */ f(t, {
464
464
  type: "button",
465
465
  variant: "ghost",
466
- className: "h-7 px-2 text-xs",
466
+ className: "min-h-basalt-control-inset px-basalt-space-lg text-basalt-sm",
467
467
  disabled: M || L,
468
468
  onClick: () => pt(e),
469
469
  children: e.label
470
470
  }, e.label))
471
471
  }) : null,
472
472
  /* @__PURE__ */ p("div", {
473
- className: "mb-2 flex items-center justify-between gap-2",
473
+ className: "mb-basalt-space-lg flex items-center justify-between gap-basalt-space-lg",
474
474
  children: [
475
475
  /* @__PURE__ */ f(t, {
476
476
  type: "button",
@@ -478,7 +478,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
478
478
  size: "icon",
479
479
  icon: /* @__PURE__ */ f(ee, {}),
480
480
  "aria-label": lt,
481
- className: "size-8",
481
+ className: "size-basalt-8",
482
482
  disabled: M || !Y || Y.y < 1,
483
483
  onClick: () => {
484
484
  !Y || Y.y < 1 || (V.current = null, H.current = !1, et(Y));
@@ -488,7 +488,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
488
488
  id: We,
489
489
  "aria-live": "polite",
490
490
  "aria-atomic": "true",
491
- className: "text-sm font-medium",
491
+ className: "text-basalt-base font-medium",
492
492
  children: ie(q, ge, {
493
493
  month: "long",
494
494
  year: "numeric"
@@ -500,7 +500,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
500
500
  size: "icon",
501
501
  icon: /* @__PURE__ */ f(d, {}),
502
502
  "aria-label": ut,
503
- className: "size-8",
503
+ className: "size-basalt-8",
504
504
  disabled: M || !ot,
505
505
  onClick: () => {
506
506
  ot && (V.current = null, H.current = !1, et(ot));
@@ -567,13 +567,13 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
567
567
  },
568
568
  children: [/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ f("tr", { children: at.map((e, t) => /* @__PURE__ */ f("th", {
569
569
  scope: "col",
570
- className: "h-8 text-center text-xs font-medium text-basalt-muted-foreground",
570
+ className: "min-h-basalt-control text-center text-basalt-sm font-medium text-basalt-muted-foreground",
571
571
  children: e
572
572
  }, `${e}-${t}`)) }) }), /* @__PURE__ */ f("tbody", { children: Array.from({ length: 6 }, (t, n) => /* @__PURE__ */ f("tr", { children: J.slice(n * 7, n * 7 + 7).map((t, r) => {
573
573
  let i = n * 7 + r;
574
574
  if (!t) return /* @__PURE__ */ f("td", {
575
575
  role: "gridcell",
576
- className: "h-8 p-0 text-center",
576
+ className: "min-h-basalt-control p-0 text-center",
577
577
  ref: () => {
578
578
  B.current[i] = null;
579
579
  }
@@ -582,7 +582,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
582
582
  return /* @__PURE__ */ f("td", {
583
583
  role: "gridcell",
584
584
  "aria-selected": p ? "true" : void 0,
585
- className: "h-8 p-0 text-center",
585
+ className: "min-h-basalt-control p-0 text-center",
586
586
  children: /* @__PURE__ */ f("button", {
587
587
  type: "button",
588
588
  ref: (e) => {
@@ -593,7 +593,7 @@ function E({ value: m, defaultValue: _ = "", onChange: ae, mode: b = "single", m
593
593
  "aria-label": a,
594
594
  "aria-pressed": b === "range" ? d : p,
595
595
  disabled: M || L || !s,
596
- className: e(re, "mx-auto flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm", o ? "text-basalt-foreground" : "text-basalt-muted-foreground", s && "hover:bg-basalt-accent", ee && !d && "bg-basalt-accent", s && (b === "range" ? d : p) && "bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90"),
596
+ className: e(re, "mx-auto flex min-h-basalt-control w-basalt-control items-center justify-center rounded-basalt-md text-basalt-base", o ? "text-basalt-foreground" : "text-basalt-muted-foreground", s && "hover:bg-basalt-hover", ee && !d && "bg-basalt-selected", s && (b === "range" ? d : p) && "bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary-hover"),
597
597
  onClick: () => s && ft(a),
598
598
  children: t.d
599
599
  })
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","names":["React","pad","value","formatIso","date","utcDate","next","civilDate","parseIso","match","year","month","day","utc","parseIsoMonth","civil","isValidCivil","formatIsoMonth","CALENDAR_BUTTON","todayCivil","parts","read","part","type","formatCivil","locale","options","isLeapYear","y","daysInCivilMonth","m","shiftCivilMonthClamped","total","current","deltaMonths","targetY","targetM","maxD","target","formatTriggerLabel","one","iso","formatDate","mode","rangeFrom","rangeTo","placeholder","selectedDate","compareCivil","left","right","withinBounds","minDate","min","maxDate","max","dateSelectable","isDisabledDate","clampCivil","isoOf","addDays","days","shiftMonth","delta","DatePicker","controlledMonthProp","defaultMonthProp","ariaLabel","ariaDescribedBy","ariaInvalid","inputRest","externalRef","externalOnInvalid","ariaLabelledBy","formRest","uncontrolled","setUncontrolled","useState","defaultValue","uncontrolledRange","setUncontrolledRange","defaultRangeValue","open","setOpen","isInvalid","setIsInvalid","validationMessage","setValidationMessage","focusIndex","setFocusIndex","dayRefs","useRef","pendingFocus","focusDay","hiddenRef","triggerRef","generatedErrorId","errorId","id","generatedMonthLiveId","monthLiveId","generatedKeyboardInstructionsId","keyboardInstructionsId","selected","selectedRange","rangeValue","cursorIso","submitted","controlledParsed","useMemo","isMonthControlled","uncontrolledMonth","setUncontrolledMonth","parsedDef","clampedInitial","timeZone","activeMonth","activeMonthKey","requestMonth","monthKey","onMonthChange","prevSelected","hasExplicitMonthConfig","useEffect","disabled","autoFocus","latestConfigRef","formAttr","form","disposed","timers","onReset","timer","event","cfg","weekdayLabels","formatter","index","weekStartsOn","first","startOffset","start","pending","focused","focusedIso","node","focusedIndex","selectedIndex","firstInMonth","enabled","inMonth","any","previousMonth","followingMonth","label","labels","calendarLabel","prevMonthLabel","nextMonthLabel","selectable","focusCalendarDay","commit","readOnly","nextRange","onRangeChange","onChange","applyPreset","preset","handleHiddenRef","cleanup","invalidState","hasDestructiveStyle","describedBy","Popover","synced","PopoverTrigger","Button","cn","className","PopoverContent","presets","ChevronLeft","ChevronRight","step","col","stepDir","weekIndex","colIndex","inRange","fromDate","toDate","thisDate","inSelectedRange","isRangeEdge","isSelected"],"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\nimport { type ComponentProps, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\ntype Civil = { y: number; m: number; d: number };\n\nfunction pad(value: number) {\n\treturn String(value).padStart(2, \"0\");\n}\n\nfunction formatIso(date: Civil) {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}-${pad(date.d)}`;\n}\n\nfunction utcDate(date: Civil) {\n\tconst next = new Date(Date.UTC(date.y, date.m - 1, date.d));\n\tnext.setUTCFullYear(date.y);\n\treturn next;\n}\n\nfunction civilDate(date: Civil) {\n\tconst next = new Date(date.y, date.m - 1, date.d);\n\tnext.setFullYear(date.y);\n\treturn next;\n}\n\nfunction parseIso(value: string): Civil | null {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tconst day = Number(match[3]);\n\tif (year < 1) {\n\t\treturn null;\n\t}\n\tconst utc = utcDate({ y: year, m: month, d: day });\n\tif (\n\t\tutc.getUTCFullYear() !== year ||\n\t\tutc.getUTCMonth() + 1 !== month ||\n\t\tutc.getUTCDate() !== day\n\t) {\n\t\treturn null;\n\t}\n\treturn { y: year, m: month, d: day };\n}\n\nfunction parseIsoMonth(value: string | undefined): Civil | null {\n\tif (!value) {\n\t\treturn null;\n\t}\n\tconst match = /^(\\d{4,})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tif (year < 1 || month < 1 || month > 12) {\n\t\treturn null;\n\t}\n\tconst civil = { y: year, m: month, d: 1 };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction formatIsoMonth(date: Civil): string {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}`;\n}\n\nconst CALENDAR_BUTTON =\n\t\"appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer\";\n\nfunction todayCivil(timeZone?: string): Civil {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(new Date());\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction formatCivil(date: Civil, locale: string, options: Intl.DateTimeFormatOptions) {\n\treturn new Intl.DateTimeFormat(locale, {\n\t\t...options,\n\t\ttimeZone: \"UTC\",\n\t\tcalendar: \"gregory\",\n\t}).format(utcDate(date));\n}\n\nfunction isLeapYear(y: number): boolean {\n\treturn (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;\n}\n\nfunction daysInCivilMonth(y: number, m: number): number {\n\tif (m === 2) {\n\t\treturn isLeapYear(y) ? 29 : 28;\n\t}\n\tif (m === 4 || m === 6 || m === 9 || m === 11) {\n\t\treturn 30;\n\t}\n\treturn 31;\n}\n\nfunction shiftCivilMonthClamped(current: Civil, deltaMonths: number): Civil | null {\n\tconst total = current.y * 12 + (current.m - 1) + deltaMonths;\n\tconst targetY = Math.floor(total / 12);\n\tif (targetY < 1) {\n\t\treturn null;\n\t}\n\tconst targetM = (((total % 12) + 12) % 12) + 1;\n\tconst maxD = daysInCivilMonth(targetY, targetM);\n\tconst target = { y: targetY, m: targetM, d: Math.min(current.d, maxD) };\n\treturn isValidCivil(target) ? target : null;\n}\n\nfunction formatTriggerLabel({\n\tmode,\n\tselectedDate,\n\trangeFrom,\n\trangeTo,\n\tlocale,\n\tformatDate,\n\tplaceholder = \"Pick a date\",\n}: {\n\tmode: \"single\" | \"range\";\n\tselectedDate: Civil | null;\n\trangeFrom: string;\n\trangeTo?: string;\n\tlocale: string;\n\tformatDate?: (date: Date) => string;\n\tplaceholder?: string;\n}) {\n\tfunction one(iso: string) {\n\t\tconst date = parseIso(iso);\n\t\tif (!date) {\n\t\t\treturn iso;\n\t\t}\n\t\treturn formatDate?.(civilDate(date)) ?? formatCivil(date, locale, { dateStyle: \"medium\" });\n\t}\n\tif (mode === \"range\") {\n\t\tif (!rangeFrom) {\n\t\t\treturn placeholder;\n\t\t}\n\t\tif (!rangeTo) {\n\t\t\treturn `${one(rangeFrom)} – …`;\n\t\t}\n\t\treturn `${one(rangeFrom)} – ${one(rangeTo)}`;\n\t}\n\treturn selectedDate\n\t\t? (formatDate?.(civilDate(selectedDate)) ??\n\t\t\t\tformatCivil(selectedDate, locale, { dateStyle: \"medium\" }))\n\t\t: placeholder;\n}\n\nfunction compareCivil(left: Civil, right: Civil) {\n\tif (left.y !== right.y) {\n\t\treturn left.y - right.y;\n\t}\n\tif (left.m !== right.m) {\n\t\treturn left.m - right.m;\n\t}\n\treturn left.d - right.d;\n}\n\nfunction withinBounds(iso: string, min?: string, max?: string) {\n\tconst date = parseIso(iso);\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (!date) {\n\t\treturn false;\n\t}\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn false;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction dateSelectable(\n\tiso: string,\n\tmin?: string,\n\tmax?: string,\n\tisDisabledDate?: (iso: string) => boolean,\n) {\n\treturn withinBounds(iso, min, max) && !isDisabledDate?.(iso);\n}\n\nexport type DatePickerRange = { from: string; to?: string };\n\nexport type DatePickerPreset = {\n\tlabel: string;\n\tvalue: string | { from: string; to: string };\n};\n\nexport type DatePickerLabels = {\n\t/**\n\t * Accessible label for the calendar popup container.\n\t * @default \"Date calendar\" (or derived from `aria-label`)\n\t */\n\tcalendar?: string;\n\t/**\n\t * Accessible label for previous month button.\n\t * @default \"Prev\"\n\t */\n\tpreviousMonth?: string;\n\t/**\n\t * Accessible label for next month button.\n\t * @default \"Next\"\n\t */\n\tnextMonth?: string;\n\t/**\n\t * Fallback label for the trigger when no date is chosen.\n\t * @default \"Pick a date\"\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Custom validation error message displayed when form validation fails.\n\t */\n\tvalidationMessage?: string;\n\t/**\n\t * Accessible keyboard navigation instructions announced for the calendar grid.\n\t */\n\tkeyboardInstructions?: string;\n};\n\nexport type DatePickerProps = Omit<\n\tComponentProps<\"input\">,\n\t| \"value\"\n\t| \"defaultValue\"\n\t| \"onChange\"\n\t| \"type\"\n\t| \"children\"\n\t| \"disabled\"\n\t| \"name\"\n\t| \"required\"\n\t| \"min\"\n\t| \"max\"\n> & {\n\t/**\n\t * The controlled ISO date in single mode.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial ISO date in single mode.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called with the ISO date in single mode.\n\t */\n\tonChange?: (value: string) => void;\n\t/**\n\t * Selection mode.\n\t * @default single\n\t */\n\tmode?: \"single\" | \"range\";\n\t/**\n\t * The controlled displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to `defaultMonth`, selected date, or today.\n\t */\n\tmonth?: string;\n\t/**\n\t * The uncontrolled initial displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to selected date or today.\n\t */\n\tdefaultMonth?: string;\n\t/**\n\t * Called only when calendar navigation requests a month change (`YYYY-MM`).\n\t * Not invoked during component render or synchronous prop synchronization.\n\t */\n\tonMonthChange?: (month: string) => void;\n\t/**\n\t * The controlled range in range mode.\n\t */\n\trangeValue?: DatePickerRange;\n\t/**\n\t * The uncontrolled initial range in range mode.\n\t */\n\tdefaultRangeValue?: DatePickerRange;\n\t/**\n\t * Called when the range changes.\n\t */\n\tonRangeChange?: (value: DatePickerRange) => void;\n\t/**\n\t * Additional dates that cannot be selected.\n\t */\n\tisDisabledDate?: (iso: string) => boolean;\n\t/**\n\t * Shortcut values shown above the calendar.\n\t */\n\tpresets?: DatePickerPreset[];\n\t/**\n\t * Locale used to format the trigger and weekday labels.\n\t * @default en-US\n\t */\n\tlocale?: string;\n\t/**\n\t * First day of the week. 0 is Sunday.\n\t * @default 0\n\t */\n\tweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\t/**\n\t * IANA time zone used to resolve today.\n\t */\n\ttimeZone?: string;\n\t/**\n\t * Custom formatter for the trigger label.\n\t */\n\tformatDate?: (date: Date) => string;\n\t/**\n\t * Optional localized labels for calendar dialog, navigation, and trigger placeholder.\n\t */\n\tlabels?: DatePickerLabels;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Native required constraint. When readOnly is set, native required validation is disabled.\n\t * When an empty required DatePicker submits, the visible trigger receives focus and invalid state.\n\t */\n\trequired?: boolean;\n\t/**\n\t * Inclusive lower ISO bound.\n\t */\n\tmin?: string;\n\t/**\n\t * Inclusive upper ISO bound.\n\t */\n\tmax?: string;\n\t/**\n\t * Disable the trigger and calendar.\n\t */\n\tdisabled?: boolean;\n};\n\nfunction clampCivil(date: Civil, min?: string, max?: string) {\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn minDate;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn maxDate;\n\t}\n\treturn date;\n}\n\nfunction isValidCivil(date: Civil): boolean {\n\tif (!Number.isFinite(date.y) || date.m < 1 || date.m > 12 || date.d < 1 || date.d > 31) {\n\t\treturn false;\n\t}\n\tconst utc = utcDate(date);\n\treturn (\n\t\t!Number.isNaN(utc.getTime()) &&\n\t\tutc.getUTCFullYear() === date.y &&\n\t\tutc.getUTCMonth() + 1 === date.m &&\n\t\tutc.getUTCDate() === date.d\n\t);\n}\n\nfunction isoOf(date: Civil | null) {\n\treturn date ? formatIso(date) : \"\";\n}\n\nfunction addDays(date: Civil, days: number): Civil | null {\n\tconst next = utcDate(date);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tnext.setUTCDate(next.getUTCDate() + days);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tconst civil = { y: next.getUTCFullYear(), m: next.getUTCMonth() + 1, d: next.getUTCDate() };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction shiftMonth(month: Civil, delta: number): Civil | null {\n\tconst total = month.y * 12 + (month.m - 1) + delta;\n\tconst next = { y: Math.floor(total / 12), m: (total % 12) + 1, d: 1 };\n\treturn isValidCivil(next) ? next : null;\n}\n\nexport function DatePicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tmode = \"single\",\n\tmonth: controlledMonthProp,\n\tdefaultMonth: defaultMonthProp,\n\tonMonthChange,\n\trangeValue,\n\tdefaultRangeValue,\n\tonRangeChange,\n\tisDisabledDate,\n\tpresets,\n\tlocale = \"en-US\",\n\tweekStartsOn = 0,\n\ttimeZone,\n\tformatDate,\n\tname,\n\trequired,\n\tmin,\n\tmax,\n\tdisabled,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\tlabels,\n\t...inputRest\n}: DatePickerProps) {\n\tconst {\n\t\tref: externalRef,\n\t\treadOnly,\n\t\tautoFocus,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonInvalid: externalOnInvalid,\n\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t...formRest\n\t} = inputRest;\n\tconst [uncontrolled, setUncontrolled] = useState(defaultValue);\n\tconst [uncontrolledRange, setUncontrolledRange] = useState<DatePickerRange>(\n\t\tdefaultRangeValue ?? { from: \"\", to: undefined },\n\t);\n\tconst [open, setOpen] = useState(false);\n\tconst [isInvalid, setIsInvalid] = useState(false);\n\tconst [validationMessage, setValidationMessage] = useState(\"\");\n\tconst [focusIndex, setFocusIndex] = useState(0);\n\tconst dayRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\tconst pendingFocus = useRef<{ targetMonthKey: string; iso: string } | null>(null);\n\tconst focusDay = useRef(false);\n\tconst hiddenRef = useRef<HTMLInputElement>(null);\n\tconst triggerRef = useRef<HTMLButtonElement>(null);\n\tconst generatedErrorId = React.useId();\n\tconst errorId = id ? `${id}-error` : generatedErrorId;\n\tconst generatedMonthLiveId = React.useId();\n\tconst monthLiveId = id ? `${id}-month-live` : generatedMonthLiveId;\n\tconst generatedKeyboardInstructionsId = React.useId();\n\tconst keyboardInstructionsId = id\n\t\t? `${id}-keyboard-instructions`\n\t\t: generatedKeyboardInstructionsId;\n\n\tconst selected = value ?? uncontrolled;\n\tconst selectedRange = rangeValue ?? uncontrolledRange;\n\tconst selectedDate = parseIso(\n\t\tmode === \"range\" ? selectedRange.to || selectedRange.from || \"\" : selected,\n\t);\n\tconst cursorIso = selectedDate ? formatIso(selectedDate) : \"\";\n\n\tuseEffect(() => {\n\t\tif (cursorIso) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t}, [cursorIso]);\n\tconst submitted = mode === \"range\" ? \"\" : cursorIso;\n\n\tconst controlledParsed = useMemo(() => parseIsoMonth(controlledMonthProp), [controlledMonthProp]);\n\tconst isMonthControlled = controlledParsed !== null;\n\n\tconst [uncontrolledMonth, setUncontrolledMonth] = useState<Civil>(() => {\n\t\tconst parsedDef = parseIsoMonth(defaultMonthProp);\n\t\tif (parsedDef) {\n\t\t\treturn parsedDef;\n\t\t}\n\t\tconst initialCursor = selectedDate ?? todayCivil(timeZone);\n\t\tconst clampedInitial = clampCivil(initialCursor, min, max);\n\t\treturn { y: clampedInitial.y, m: clampedInitial.m, d: 1 };\n\t});\n\n\tconst activeMonth = controlledParsed ?? uncontrolledMonth;\n\tconst activeMonthKey = formatIsoMonth(activeMonth);\n\n\tconst requestMonth = (target: Civil) => {\n\t\tconst monthKey = formatIsoMonth(target);\n\t\tif (!isMonthControlled) {\n\t\t\tsetUncontrolledMonth(target);\n\t\t}\n\t\tonMonthChange?.(monthKey);\n\t};\n\n\tconst prevSelected = useRef(cursorIso);\n\tif (open && prevSelected.current !== cursorIso) {\n\t\tfocusDay.current = true;\n\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\tconst next = selectedDate ?? todayCivil(timeZone);\n\t\t\tif (activeMonth.y !== next.y || activeMonth.m !== next.m) {\n\t\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t}\n\t\t}\n\t}\n\tprevSelected.current = cursorIso;\n\n\tconst hasExplicitMonthConfig =\n\t\tcontrolledMonthProp !== undefined || defaultMonthProp !== undefined;\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hasExplicitMonthConfig) {\n\t\t\tconst next = clampCivil(\n\t\t\t\t(cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone),\n\t\t\t\tmin,\n\t\t\t\tmax,\n\t\t\t);\n\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\tif (!cursorIso) {\n\t\t\t\tfocusDay.current = true;\n\t\t\t}\n\t\t}\n\t}, [open, cursorIso, timeZone, min, max, hasExplicitMonthConfig]);\n\n\tuseEffect(() => {\n\t\tif (disabled) {\n\t\t\tsetOpen(false);\n\t\t}\n\t}, [disabled]);\n\n\tuseEffect(() => {\n\t\tif (autoFocus) {\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t}, [autoFocus]);\n\n\tconst latestConfigRef = useRef({\n\t\tdefaultValue,\n\t\tdefaultRangeValue,\n\t\tmode,\n\t\trangeValue,\n\t\tvalue,\n\t});\n\tuseEffect(() => {\n\t\tlatestConfigRef.current = {\n\t\t\tdefaultValue,\n\t\t\tdefaultRangeValue,\n\t\t\tmode,\n\t\t\trangeValue,\n\t\t\tvalue,\n\t\t};\n\t});\n\n\tconst formAttr = formRest.form;\n\tuseEffect(() => {\n\t\tconst form = hiddenRef.current?.form;\n\t\tif (!form || (formAttr && form.id !== formAttr)) {\n\t\t\treturn;\n\t\t}\n\t\tlet disposed = false;\n\t\tconst timers = new Set<ReturnType<typeof setTimeout>>();\n\t\tconst onReset = (event: Event) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\ttimers.delete(timer);\n\t\t\t\tif (disposed || event.defaultPrevented) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst cfg = latestConfigRef.current;\n\t\t\t\tif (cfg.mode === \"range\" ? cfg.rangeValue === undefined : cfg.value === undefined) {\n\t\t\t\t\tsetUncontrolled(cfg.defaultValue);\n\t\t\t\t\tsetUncontrolledRange(cfg.defaultRangeValue ?? { from: \"\", to: undefined });\n\t\t\t\t}\n\t\t\t\tsetIsInvalid(false);\n\t\t\t\tsetValidationMessage(\"\");\n\t\t\t\tsetOpen(false);\n\t\t\t}, 0);\n\t\t\ttimers.add(timer);\n\t\t};\n\t\tform.addEventListener(\"reset\", onReset);\n\t\treturn () => {\n\t\t\tdisposed = true;\n\t\t\tfor (const timer of timers) {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\t\t\ttimers.clear();\n\t\t\tform.removeEventListener(\"reset\", onReset);\n\t\t};\n\t}, [formAttr]);\n\n\tconst weekdayLabels = useMemo(() => {\n\t\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n\t\treturn Array.from({ length: 7 }, (_, index) => {\n\t\t\tconst day = new Date(Date.UTC(2024, 0, 7 + ((index + weekStartsOn) % 7)));\n\t\t\treturn formatter.format(day);\n\t\t});\n\t}, [locale, weekStartsOn]);\n\n\tconst days = useMemo(() => {\n\t\tconst first = { y: activeMonth.y, m: activeMonth.m, d: 1 };\n\t\tif (!isValidCivil(first)) {\n\t\t\treturn Array.from({ length: 42 }, () => null);\n\t\t}\n\t\tconst startOffset = (utcDate(first).getUTCDay() - weekStartsOn + 7) % 7;\n\t\tconst start = addDays(first, -startOffset);\n\t\tif (!start) {\n\t\t\treturn Array.from({ length: 42 }, (_, index) => addDays(first, index - startOffset));\n\t\t}\n\t\treturn Array.from({ length: 42 }, (_, index) => addDays(start, index));\n\t}, [activeMonth, weekStartsOn]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst pending = pendingFocus.current;\n\t\tlet index = 0;\n\t\tif (pending) {\n\t\t\tif (pending.targetMonthKey === activeMonthKey) {\n\t\t\t\tpendingFocus.current = null;\n\t\t\t\tindex = days.findIndex((date) => isoOf(date) === pending.iso);\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tindex = 0;\n\t\t\t\t}\n\t\t\t\tfocusDay.current = true;\n\t\t\t} else {\n\t\t\t\tconst focused = document.activeElement;\n\t\t\t\tconst focusedIso =\n\t\t\t\t\tfocused instanceof HTMLElement && dayRefs.current.some((node) => node === focused)\n\t\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t\t: null;\n\t\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\t\tif (focusedIndex >= 0) {\n\t\t\t\t\tindex = focusedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tindex = focusIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst focused = document.activeElement;\n\t\t\tconst focusedIso =\n\t\t\t\t!focusDay.current &&\n\t\t\t\tfocused instanceof HTMLElement &&\n\t\t\t\tdayRefs.current.some((node) => node === focused)\n\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t: null;\n\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\tif (focusedIndex >= 0) {\n\t\t\t\tindex = focusedIndex;\n\t\t\t} else {\n\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\tif (selectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m) {\n\t\t\t\t\tindex = selectedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tconst firstInMonth = days.findIndex((date) => date?.m === activeMonth.m);\n\t\t\t\t\tindex = firstInMonth >= 0 ? firstInMonth : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst enabled = (date: Civil | null) =>\n\t\t\tBoolean(date && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate));\n\t\tif (!enabled(days[index] ?? null)) {\n\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t}\n\t\tsetFocusIndex(index);\n\t\tif (focusDay.current) {\n\t\t\tfocusDay.current = false;\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}, [\n\t\topen,\n\t\tcursorIso,\n\t\tsubmitted,\n\t\ttimeZone,\n\t\tdays,\n\t\tactiveMonth.m,\n\t\tactiveMonthKey,\n\t\tfocusIndex,\n\t\tmin,\n\t\tmax,\n\t\tisDisabledDate,\n\t]);\n\n\tconst previousMonth = shiftMonth(activeMonth, -1);\n\tconst followingMonth = shiftMonth(activeMonth, 1);\n\tconst rangeFrom = mode === \"range\" ? selectedRange.from : \"\";\n\tconst rangeTo = mode === \"range\" ? selectedRange.to : undefined;\n\tconst label = formatTriggerLabel({\n\t\tmode,\n\t\tselectedDate,\n\t\trangeFrom,\n\t\trangeTo,\n\t\tlocale,\n\t\tformatDate,\n\t\tplaceholder: labels?.placeholder,\n\t});\n\tconst calendarLabel = labels?.calendar ?? (ariaLabel ? `${ariaLabel} calendar` : \"Date calendar\");\n\tconst prevMonthLabel = labels?.previousMonth ?? \"Prev\";\n\tconst nextMonthLabel = labels?.nextMonth ?? \"Next\";\n\n\tfunction selectable(iso: string) {\n\t\treturn dateSelectable(iso, min, max, isDisabledDate);\n\t}\n\n\tfunction focusCalendarDay(next: Civil) {\n\t\tif (next.y !== activeMonth.y || next.m !== activeMonth.m) {\n\t\t\tpendingFocus.current = {\n\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\tiso: formatIso(next),\n\t\t\t};\n\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\treturn;\n\t\t}\n\t\tconst index = days.findIndex((date) => isoOf(date) === formatIso(next));\n\t\tif (index >= 0) {\n\t\t\tsetFocusIndex(index);\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}\n\n\tfunction commit(next: string) {\n\t\tif (disabled || readOnly || !selectable(next)) {\n\t\t\treturn;\n\t\t}\n\t\tif (next) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tconst current = rangeValue ?? uncontrolledRange;\n\t\t\tconst nextRange =\n\t\t\t\t!current.from || current.to\n\t\t\t\t\t? { from: next }\n\t\t\t\t\t: compareCivil(\n\t\t\t\t\t\t\t\tparseIso(next) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t\tparseIso(current.from) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t) < 0\n\t\t\t\t\t\t? { from: next, to: current.from }\n\t\t\t\t\t\t: { from: current.from, to: next };\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t}\n\t\t\tonRangeChange?.(nextRange);\n\t\t\tif (nextRange.to) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tsetOpen(false);\n\t\tonChange?.(next);\n\t}\n\n\tfunction applyPreset(preset: DatePickerPreset) {\n\t\tif (disabled || readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof preset.value === \"string\") {\n\t\t\tif (mode === \"range\") {\n\t\t\t\tif (!selectable(preset.value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst nextRange = { from: preset.value, to: preset.value };\n\t\t\t\tif (rangeValue === undefined) {\n\t\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t\t}\n\t\t\t\tonRangeChange?.(nextRange);\n\t\t\t\tsetOpen(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(preset.value);\n\t\t\treturn;\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tif (!selectable(preset.value.from) || !selectable(preset.value.to)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(preset.value);\n\t\t\t}\n\t\t\tonRangeChange?.(preset.value);\n\t\t\tsetOpen(false);\n\t\t}\n\t}\n\n\tconst handleHiddenRef = React.useCallback(\n\t\t(node: HTMLInputElement | null) => {\n\t\t\thiddenRef.current = node;\n\t\t\tif (!externalRef) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (typeof externalRef === \"function\") {\n\t\t\t\tconst cleanup = externalRef(node);\n\t\t\t\tif (typeof cleanup === \"function\") {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\texternalRef(null);\n\t\t\t\t};\n\t\t\t}\n\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = node;\n\t\t\treturn () => {\n\t\t\t\thiddenRef.current = null;\n\t\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = null;\n\t\t\t};\n\t\t},\n\t\t[externalRef],\n\t);\n\n\tconst invalidState = ariaInvalid ?? (isInvalid || undefined);\n\tconst hasDestructiveStyle =\n\t\tinvalidState === true ||\n\t\tinvalidState === \"true\" ||\n\t\tinvalidState === \"grammar\" ||\n\t\tinvalidState === \"spelling\";\n\n\tconst describedBy =\n\t\t[ariaDescribedBy, isInvalid && errorId ? errorId : undefined].filter(Boolean).join(\" \") ||\n\t\tundefined;\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (next && disabled) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (next) {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\t\t\t\tconst synced = (cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone);\n\t\t\t\t\t\tsetUncontrolledMonth({ y: synced.y, m: synced.m, d: 1 });\n\t\t\t\t\t}\n\t\t\t\t\tfocusDay.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t}}\n\t\t>\n\t\t\t<input\n\t\t\t\tref={handleHiddenRef}\n\t\t\t\ttype={mode === \"range\" ? \"text\" : \"date\"}\n\t\t\t\tname={name}\n\t\t\t\trequired={required}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tmin={mode === \"range\" ? undefined : min}\n\t\t\t\tmax={mode === \"range\" ? undefined : max}\n\t\t\t\tclassName=\"sr-only mb-2 h-7\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: 1,\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\tclip: \"rect(0, 0, 0, 0)\",\n\t\t\t\t}}\n\t\t\t\tvalue={\n\t\t\t\t\tmode === \"range\" ? (rangeFrom && rangeTo ? `${rangeFrom}/${rangeTo}` : \"\") : submitted\n\t\t\t\t}\n\t\t\t\tonChange={() => undefined}\n\t\t\t\tonInvalid={(event) => {\n\t\t\t\t\texternalOnInvalid?.(event);\n\t\t\t\t\tif (!event.defaultPrevented) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tsetIsInvalid(true);\n\t\t\t\t\t\tsetValidationMessage(\n\t\t\t\t\t\t\tlabels?.validationMessage ||\n\t\t\t\t\t\t\t\t(event.target as HTMLInputElement).validationMessage ||\n\t\t\t\t\t\t\t\t\"Please fill out this field.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\ttriggerRef.current?.focus();\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\t{...formRest}\n\t\t\t/>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tref={triggerRef}\n\t\t\t\t\tid={id}\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonFocus={onFocus as ComponentProps<\"button\">[\"onFocus\"]}\n\t\t\t\t\tonBlur={onBlur as ComponentProps<\"button\">[\"onBlur\"]}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tariaLabel ? (label === \"Pick a date\" ? ariaLabel : `${ariaLabel}: ${label}`) : undefined\n\t\t\t\t\t}\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\taria-invalid={invalidState}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"justify-start font-normal\",\n\t\t\t\t\t\thasDestructiveStyle && \"border-basalt-destructive text-basalt-destructive\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t{isInvalid && validationMessage ? (\n\t\t\t\t<span id={errorId} role=\"alert\" className=\"mt-1 block text-xs text-basalt-destructive\">\n\t\t\t\t\t{validationMessage}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<PopoverContent\n\t\t\t\tarrow={false}\n\t\t\t\tclassName=\"w-64 p-3\"\n\t\t\t\taria-label={calendarLabel}\n\t\t\t\taria-describedby={keyboardInstructionsId}\n\t\t\t\tonOpenAutoFocus={(event) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\t\tconst enabled = (date: Civil | null) =>\n\t\t\t\t\t\tBoolean(\n\t\t\t\t\t\t\tdate && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate),\n\t\t\t\t\t\t);\n\t\t\t\t\tlet index =\n\t\t\t\t\t\tselectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m\n\t\t\t\t\t\t\t? selectedIndex\n\t\t\t\t\t\t\t: Math.max(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tdays.findIndex((date) => date?.m === activeMonth.m),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (!enabled(days[index] ?? null)) {\n\t\t\t\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\t\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\t\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t\t\t\t}\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{presets && presets.length > 0 ? (\n\t\t\t\t\t<div className=\"mb-2 flex flex-wrap gap-1\">\n\t\t\t\t\t\t{presets.map((preset) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={preset.label}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"h-7 px-2 text-xs\"\n\t\t\t\t\t\t\t\tdisabled={disabled || readOnly}\n\t\t\t\t\t\t\t\tonClick={() => applyPreset(preset)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{preset.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"mb-2 flex items-center justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronLeft />}\n\t\t\t\t\t\taria-label={prevMonthLabel}\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !previousMonth || previousMonth.y < 1}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!previousMonth || previousMonth.y < 1) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(previousMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={monthLiveId}\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName=\"text-sm font-medium\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{formatCivil(activeMonth, locale, { month: \"long\", year: \"numeric\" })}\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronRight />}\n\t\t\t\t\t\taria-label={nextMonthLabel}\n\t\t\t\t\t\tclassName=\"size-8\"\n\t\t\t\t\t\tdisabled={disabled || !followingMonth}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!followingMonth) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(followingMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<p id={keyboardInstructionsId} className=\"sr-only\">\n\t\t\t\t\t{labels?.keyboardInstructions ??\n\t\t\t\t\t\t\"Use arrow keys to navigate dates, PageUp and PageDown to change months, and Enter or Space to select.\"}\n\t\t\t\t</p>\n\t\t\t\t{/* Biome override: WAI-ARIA APG Date Picker pattern uses a semantic table with role=\"grid\" and role=\"gridcell\" on cells while roving tabindex focuses the child button */}\n\t\t\t\t<table\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\taria-labelledby={monthLiveId}\n\t\t\t\t\taria-multiselectable={mode === \"range\" ? \"true\" : undefined}\n\t\t\t\t\tclassName=\"w-full border-collapse text-center\"\n\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\tconst current = days[focusIndex];\n\t\t\t\t\t\tif (!current) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.key === \"ArrowRight\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowLeft\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowDown\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowUp\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst delta =\n\t\t\t\t\t\t\t\tevent.key === \"ArrowRight\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: event.key === \"ArrowLeft\"\n\t\t\t\t\t\t\t\t\t\t? -1\n\t\t\t\t\t\t\t\t\t\t: event.key === \"ArrowDown\"\n\t\t\t\t\t\t\t\t\t\t\t? 7\n\t\t\t\t\t\t\t\t\t\t\t: -7;\n\t\t\t\t\t\t\tlet next = addDays(current, delta);\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, delta);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusCalendarDay(next);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Home\" || event.key === \"End\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst dayOfWeek = utcDate(current).getUTCDay();\n\t\t\t\t\t\t\tconst col = (dayOfWeek - weekStartsOn + 7) % 7;\n\t\t\t\t\t\t\tconst deltaToEdge = event.key === \"Home\" ? -col : 6 - col;\n\t\t\t\t\t\t\tlet next: Civil | null = addDays(current, deltaToEdge);\n\t\t\t\t\t\t\tconst stepDir = event.key === \"Home\" ? 1 : -1;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 7;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, stepDir);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusCalendarDay(next);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"PageDown\" || event.key === \"PageUp\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst deltaMonths = event.shiftKey\n\t\t\t\t\t\t\t\t? event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 12\n\t\t\t\t\t\t\t\t\t: -12\n\t\t\t\t\t\t\t\t: event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: -1;\n\t\t\t\t\t\t\tconst target = shiftCivilMonthClamped(current, deltaMonths);\n\t\t\t\t\t\t\tif (!target) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet next: Civil | null = target;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\tnext = target;\n\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnext = addDays(next, -1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = {\n\t\t\t\t\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\t\t\t\t\tiso: formatIso(next),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst iso = formatIso(current);\n\t\t\t\t\t\t\tif (current.y >= 1 && selectable(iso)) {\n\t\t\t\t\t\t\t\tcommit(iso);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t{weekdayLabels.map((day, index) => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={`${day}-${index}`}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t\tclassName=\"h-8 text-center text-xs font-medium text-basalt-muted-foreground\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{day}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{Array.from({ length: 6 }, (_, weekIndex) => (\n\t\t\t\t\t\t\t<tr key={`week-${weekIndex}`}>\n\t\t\t\t\t\t\t\t{days.slice(weekIndex * 7, weekIndex * 7 + 7).map((date, colIndex) => {\n\t\t\t\t\t\t\t\t\tconst index = weekIndex * 7 + colIndex;\n\t\t\t\t\t\t\t\t\tif (!date) {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\t\tkey={`empty-${index}`}\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-8 p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = null;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst iso = formatIso(date);\n\t\t\t\t\t\t\t\t\tconst inMonth = date.m === activeMonth.m;\n\t\t\t\t\t\t\t\t\tconst inRange = date.y >= 1 && selectable(iso);\n\t\t\t\t\t\t\t\t\tconst fromDate = rangeFrom ? parseIso(rangeFrom) : null;\n\t\t\t\t\t\t\t\t\tconst toDate = rangeTo ? parseIso(rangeTo) : null;\n\t\t\t\t\t\t\t\t\tconst thisDate = parseIso(iso);\n\t\t\t\t\t\t\t\t\tconst inSelectedRange = Boolean(\n\t\t\t\t\t\t\t\t\t\tfromDate &&\n\t\t\t\t\t\t\t\t\t\t\ttoDate &&\n\t\t\t\t\t\t\t\t\t\t\tthisDate &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, fromDate) >= 0 &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, toDate) <= 0,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst isRangeEdge = iso === rangeFrom || iso === rangeTo;\n\t\t\t\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\t\t\t\tmode === \"range\"\n\t\t\t\t\t\t\t\t\t\t\t? inSelectedRange || isRangeEdge\n\t\t\t\t\t\t\t\t\t\t\t: Boolean(submitted) && iso === submitted;\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\tkey={iso}\n\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\taria-selected={isSelected ? \"true\" : undefined}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"h-8 p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = node;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={index === focusIndex ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\t\t\tdata-date={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={mode === \"range\" ? isRangeEdge : isSelected}\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={disabled || readOnly || !inRange}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\tCALENDAR_BUTTON,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"mx-auto flex h-8 w-8 items-center justify-center rounded-basalt-md text-sm\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinMonth ? \"text-basalt-foreground\" : \"text-basalt-muted-foreground\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange && \"hover:bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinSelectedRange && !isRangeEdge && \"bg-basalt-accent\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(mode === \"range\" ? isRangeEdge : isSelected) &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"bg-basalt-primary text-basalt-primary-foreground hover:bg-basalt-primary/90\",\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => inRange && commit(iso)}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{date.d}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n}\n"],"mappings":";;;;;;;;;AASA,SAASC,EAAI,GAAe;CAC3B,OAAO,OAAOC,CAAK,CAAC,CAAC,SAAS,GAAG,GAAG;AACrC;AAEA,SAASC,EAAU,GAAa;CAC/B,OAAO,GAAG,OAAOC,EAAK,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAGH,EAAIG,EAAK,CAAC,EAAE,GAAGH,EAAIG,EAAK,CAAC;AACvE;AAEA,SAASC,EAAQ,GAAa;CAC7B,IAAMC,IAAO,IAAI,KAAK,KAAK,IAAIF,EAAK,GAAGA,EAAK,IAAI,GAAGA,EAAK,CAAC,CAAC;CAE1D,OADAE,EAAK,eAAeF,EAAK,CAAC,GACnBE;AACR;AAEA,SAASC,EAAU,GAAa;CAC/B,IAAMD,IAAO,IAAI,KAAKF,EAAK,GAAGA,EAAK,IAAI,GAAGA,EAAK,CAAC;CAEhD,OADAE,EAAK,YAAYF,EAAK,CAAC,GAChBE;AACR;AAEA,SAASE,EAAS,GAA6B;CAC9C,IAAMC,IAAQ,6BAA6B,KAAKP,CAAK;CACrD,IAAI,CAACO,GACJ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V,WAAW;SACV,EAAQ,QAAQqI,KAAS;QAC1B;OACA,GANK,SAASA,GAMd;OAGH,IAAMhG,IAAMtC,EAAUC,CAAI,GACpBkJ,IAAUlJ,EAAK,MAAMgH,EAAY,GACjCwE,IAAUxL,EAAK,KAAK,KAAK2J,EAAWtH,CAAG,GACvCoJ,IAAWjJ,IAAYpC,EAASoC,CAAS,IAAI,MAC7CkJ,IAASjJ,IAAUrC,EAASqC,CAAO,IAAI,MACvCkJ,IAAWvL,EAASiC,CAAG,GACvBuJ,KAAkB,GACvBH,KACCC,KACAC,KACA/I,EAAa+I,GAAUF,CAAQ,KAAK,KACpC7I,EAAa+I,GAAUD,CAAM,KAAK,IAE9BG,IAAcxJ,MAAQG,KAAaH,MAAQI,GAC3CqJ,IACLvJ,MAAS,UACNqJ,MAAmBC,IACnB,EAAQtF,KAAclE,MAAQkE;OAElC,OACC,kBAAC,MAAD;QAEC,MAAK;QACL,iBAAeuF,IAAa,SAAS,KAAA;QACrC,WAAU;QAEV,UAAA,kBAAC,UAAD;SACC,MAAK;SACL,MAAM,MAAS;UACd,EAAQ,QAAQzD,KAASQ;SAC1B;SACA,UAAUR,MAAUjD,KAAa,IAAI;SACrC,aAAW/C;SACX,cAAYA;SACZ,gBAAcE,MAAS,UAAUsJ,IAAcC;SAC/C,UAAUtE,KAAYsC,KAAY,CAAC0B;SACnC,WAAWX,EACV/J,IACA,8EACAoI,IAAU,2BAA2B,gCACrCsC,KAAW,0BACXI,MAAmB,CAACC,KAAe,oBACnCL,MACEjJ,MAAS,UAAUsJ,IAAcC,MAClC,6EACF;SACA,eAAeN,KAAW3B,GAAOxH,CAAG;SAEnC,UAAArC,EAAK;QACC,CAAA;OACL,GA7BEqC,CA6BF;MAEN,CAAC,EACE,GApEK,QAAQiJ,GAoEb,CACJ,EACK,CAAA,CACD;;IACQ;;EACR;;AAEX"}
1
+ {"version":3,"file":"date-picker.js","names":["React","pad","value","formatIso","date","utcDate","next","civilDate","parseIso","match","year","month","day","utc","parseIsoMonth","civil","isValidCivil","formatIsoMonth","CALENDAR_BUTTON","todayCivil","parts","read","part","type","formatCivil","locale","options","isLeapYear","y","daysInCivilMonth","m","shiftCivilMonthClamped","total","current","deltaMonths","targetY","targetM","maxD","target","formatTriggerLabel","one","iso","formatDate","mode","rangeFrom","rangeTo","placeholder","selectedDate","compareCivil","left","right","withinBounds","minDate","min","maxDate","max","dateSelectable","isDisabledDate","clampCivil","isoOf","addDays","days","shiftMonth","delta","DatePicker","controlledMonthProp","defaultMonthProp","ariaLabel","ariaDescribedBy","ariaInvalid","inputRest","externalRef","externalOnInvalid","ariaLabelledBy","formRest","uncontrolled","setUncontrolled","useState","defaultValue","uncontrolledRange","setUncontrolledRange","defaultRangeValue","open","setOpen","isInvalid","setIsInvalid","validationMessage","setValidationMessage","focusIndex","setFocusIndex","dayRefs","useRef","pendingFocus","focusDay","hiddenRef","triggerRef","generatedErrorId","errorId","id","generatedMonthLiveId","monthLiveId","generatedKeyboardInstructionsId","keyboardInstructionsId","selected","selectedRange","rangeValue","cursorIso","submitted","controlledParsed","useMemo","isMonthControlled","uncontrolledMonth","setUncontrolledMonth","parsedDef","clampedInitial","timeZone","activeMonth","activeMonthKey","requestMonth","monthKey","onMonthChange","prevSelected","hasExplicitMonthConfig","useEffect","disabled","autoFocus","latestConfigRef","formAttr","form","disposed","timers","onReset","timer","event","cfg","weekdayLabels","formatter","index","weekStartsOn","first","startOffset","start","pending","focused","focusedIso","node","focusedIndex","selectedIndex","firstInMonth","enabled","inMonth","any","previousMonth","followingMonth","label","labels","calendarLabel","prevMonthLabel","nextMonthLabel","selectable","focusCalendarDay","commit","readOnly","nextRange","onRangeChange","onChange","applyPreset","preset","handleHiddenRef","cleanup","invalidState","hasDestructiveStyle","describedBy","Popover","synced","PopoverTrigger","Button","cn","className","PopoverContent","presets","ChevronLeft","ChevronRight","step","col","stepDir","weekIndex","colIndex","inRange","fromDate","toDate","thisDate","inSelectedRange","isRangeEdge","isSelected"],"sources":["../../src/components/date-picker.tsx"],"sourcesContent":["import { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\nimport { type ComponentProps, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\ntype Civil = { y: number; m: number; d: number };\n\nfunction pad(value: number) {\n\treturn String(value).padStart(2, \"0\");\n}\n\nfunction formatIso(date: Civil) {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}-${pad(date.d)}`;\n}\n\nfunction utcDate(date: Civil) {\n\tconst next = new Date(Date.UTC(date.y, date.m - 1, date.d));\n\tnext.setUTCFullYear(date.y);\n\treturn next;\n}\n\nfunction civilDate(date: Civil) {\n\tconst next = new Date(date.y, date.m - 1, date.d);\n\tnext.setFullYear(date.y);\n\treturn next;\n}\n\nfunction parseIso(value: string): Civil | null {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tconst day = Number(match[3]);\n\tif (year < 1) {\n\t\treturn null;\n\t}\n\tconst utc = utcDate({ y: year, m: month, d: day });\n\tif (\n\t\tutc.getUTCFullYear() !== year ||\n\t\tutc.getUTCMonth() + 1 !== month ||\n\t\tutc.getUTCDate() !== day\n\t) {\n\t\treturn null;\n\t}\n\treturn { y: year, m: month, d: day };\n}\n\nfunction parseIsoMonth(value: string | undefined): Civil | null {\n\tif (!value) {\n\t\treturn null;\n\t}\n\tconst match = /^(\\d{4,})-(\\d{2})$/.exec(value);\n\tif (!match) {\n\t\treturn null;\n\t}\n\tconst year = Number(match[1]);\n\tconst month = Number(match[2]);\n\tif (year < 1 || month < 1 || month > 12) {\n\t\treturn null;\n\t}\n\tconst civil = { y: year, m: month, d: 1 };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction formatIsoMonth(date: Civil): string {\n\treturn `${String(date.y).padStart(4, \"0\")}-${pad(date.m)}`;\n}\n\nconst CALENDAR_BUTTON =\n\t\"appearance-none border-0 bg-transparent p-0 font-inherit text-inherit cursor-pointer\";\n\nfunction todayCivil(timeZone?: string): Civil {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(new Date());\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction formatCivil(date: Civil, locale: string, options: Intl.DateTimeFormatOptions) {\n\treturn new Intl.DateTimeFormat(locale, {\n\t\t...options,\n\t\ttimeZone: \"UTC\",\n\t\tcalendar: \"gregory\",\n\t}).format(utcDate(date));\n}\n\nfunction isLeapYear(y: number): boolean {\n\treturn (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0;\n}\n\nfunction daysInCivilMonth(y: number, m: number): number {\n\tif (m === 2) {\n\t\treturn isLeapYear(y) ? 29 : 28;\n\t}\n\tif (m === 4 || m === 6 || m === 9 || m === 11) {\n\t\treturn 30;\n\t}\n\treturn 31;\n}\n\nfunction shiftCivilMonthClamped(current: Civil, deltaMonths: number): Civil | null {\n\tconst total = current.y * 12 + (current.m - 1) + deltaMonths;\n\tconst targetY = Math.floor(total / 12);\n\tif (targetY < 1) {\n\t\treturn null;\n\t}\n\tconst targetM = (((total % 12) + 12) % 12) + 1;\n\tconst maxD = daysInCivilMonth(targetY, targetM);\n\tconst target = { y: targetY, m: targetM, d: Math.min(current.d, maxD) };\n\treturn isValidCivil(target) ? target : null;\n}\n\nfunction formatTriggerLabel({\n\tmode,\n\tselectedDate,\n\trangeFrom,\n\trangeTo,\n\tlocale,\n\tformatDate,\n\tplaceholder = \"Pick a date\",\n}: {\n\tmode: \"single\" | \"range\";\n\tselectedDate: Civil | null;\n\trangeFrom: string;\n\trangeTo?: string;\n\tlocale: string;\n\tformatDate?: (date: Date) => string;\n\tplaceholder?: string;\n}) {\n\tfunction one(iso: string) {\n\t\tconst date = parseIso(iso);\n\t\tif (!date) {\n\t\t\treturn iso;\n\t\t}\n\t\treturn formatDate?.(civilDate(date)) ?? formatCivil(date, locale, { dateStyle: \"medium\" });\n\t}\n\tif (mode === \"range\") {\n\t\tif (!rangeFrom) {\n\t\t\treturn placeholder;\n\t\t}\n\t\tif (!rangeTo) {\n\t\t\treturn `${one(rangeFrom)} – …`;\n\t\t}\n\t\treturn `${one(rangeFrom)} – ${one(rangeTo)}`;\n\t}\n\treturn selectedDate\n\t\t? (formatDate?.(civilDate(selectedDate)) ??\n\t\t\t\tformatCivil(selectedDate, locale, { dateStyle: \"medium\" }))\n\t\t: placeholder;\n}\n\nfunction compareCivil(left: Civil, right: Civil) {\n\tif (left.y !== right.y) {\n\t\treturn left.y - right.y;\n\t}\n\tif (left.m !== right.m) {\n\t\treturn left.m - right.m;\n\t}\n\treturn left.d - right.d;\n}\n\nfunction withinBounds(iso: string, min?: string, max?: string) {\n\tconst date = parseIso(iso);\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (!date) {\n\t\treturn false;\n\t}\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn false;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nfunction dateSelectable(\n\tiso: string,\n\tmin?: string,\n\tmax?: string,\n\tisDisabledDate?: (iso: string) => boolean,\n) {\n\treturn withinBounds(iso, min, max) && !isDisabledDate?.(iso);\n}\n\nexport type DatePickerRange = { from: string; to?: string };\n\nexport type DatePickerPreset = {\n\tlabel: string;\n\tvalue: string | { from: string; to: string };\n};\n\nexport type DatePickerLabels = {\n\t/**\n\t * Accessible label for the calendar popup container.\n\t * @default \"Date calendar\" (or derived from `aria-label`)\n\t */\n\tcalendar?: string;\n\t/**\n\t * Accessible label for previous month button.\n\t * @default \"Prev\"\n\t */\n\tpreviousMonth?: string;\n\t/**\n\t * Accessible label for next month button.\n\t * @default \"Next\"\n\t */\n\tnextMonth?: string;\n\t/**\n\t * Fallback label for the trigger when no date is chosen.\n\t * @default \"Pick a date\"\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Custom validation error message displayed when form validation fails.\n\t */\n\tvalidationMessage?: string;\n\t/**\n\t * Accessible keyboard navigation instructions announced for the calendar grid.\n\t */\n\tkeyboardInstructions?: string;\n};\n\nexport type DatePickerProps = Omit<\n\tComponentProps<\"input\">,\n\t| \"value\"\n\t| \"defaultValue\"\n\t| \"onChange\"\n\t| \"type\"\n\t| \"children\"\n\t| \"disabled\"\n\t| \"name\"\n\t| \"required\"\n\t| \"min\"\n\t| \"max\"\n> & {\n\t/**\n\t * The controlled ISO date in single mode.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial ISO date in single mode.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called with the ISO date in single mode.\n\t */\n\tonChange?: (value: string) => void;\n\t/**\n\t * Selection mode.\n\t * @default single\n\t */\n\tmode?: \"single\" | \"range\";\n\t/**\n\t * The controlled displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to `defaultMonth`, selected date, or today.\n\t */\n\tmonth?: string;\n\t/**\n\t * The uncontrolled initial displayed month in `YYYY-MM` format (at least 4-digit positive year).\n\t * If omitted or invalid, falls back smoothly to selected date or today.\n\t */\n\tdefaultMonth?: string;\n\t/**\n\t * Called only when calendar navigation requests a month change (`YYYY-MM`).\n\t * Not invoked during component render or synchronous prop synchronization.\n\t */\n\tonMonthChange?: (month: string) => void;\n\t/**\n\t * The controlled range in range mode.\n\t */\n\trangeValue?: DatePickerRange;\n\t/**\n\t * The uncontrolled initial range in range mode.\n\t */\n\tdefaultRangeValue?: DatePickerRange;\n\t/**\n\t * Called when the range changes.\n\t */\n\tonRangeChange?: (value: DatePickerRange) => void;\n\t/**\n\t * Additional dates that cannot be selected.\n\t */\n\tisDisabledDate?: (iso: string) => boolean;\n\t/**\n\t * Shortcut values shown above the calendar.\n\t */\n\tpresets?: DatePickerPreset[];\n\t/**\n\t * Locale used to format the trigger and weekday labels.\n\t * @default en-US\n\t */\n\tlocale?: string;\n\t/**\n\t * First day of the week. 0 is Sunday.\n\t * @default 0\n\t */\n\tweekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\t/**\n\t * IANA time zone used to resolve today.\n\t */\n\ttimeZone?: string;\n\t/**\n\t * Custom formatter for the trigger label.\n\t */\n\tformatDate?: (date: Date) => string;\n\t/**\n\t * Optional localized labels for calendar dialog, navigation, and trigger placeholder.\n\t */\n\tlabels?: DatePickerLabels;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Native required constraint. When readOnly is set, native required validation is disabled.\n\t * When an empty required DatePicker submits, the visible trigger receives focus and invalid state.\n\t */\n\trequired?: boolean;\n\t/**\n\t * Inclusive lower ISO bound.\n\t */\n\tmin?: string;\n\t/**\n\t * Inclusive upper ISO bound.\n\t */\n\tmax?: string;\n\t/**\n\t * Disable the trigger and calendar.\n\t */\n\tdisabled?: boolean;\n};\n\nfunction clampCivil(date: Civil, min?: string, max?: string) {\n\tconst minDate = min ? parseIso(min) : null;\n\tconst maxDate = max ? parseIso(max) : null;\n\tif (minDate && compareCivil(date, minDate) < 0) {\n\t\treturn minDate;\n\t}\n\tif (maxDate && compareCivil(date, maxDate) > 0) {\n\t\treturn maxDate;\n\t}\n\treturn date;\n}\n\nfunction isValidCivil(date: Civil): boolean {\n\tif (!Number.isFinite(date.y) || date.m < 1 || date.m > 12 || date.d < 1 || date.d > 31) {\n\t\treturn false;\n\t}\n\tconst utc = utcDate(date);\n\treturn (\n\t\t!Number.isNaN(utc.getTime()) &&\n\t\tutc.getUTCFullYear() === date.y &&\n\t\tutc.getUTCMonth() + 1 === date.m &&\n\t\tutc.getUTCDate() === date.d\n\t);\n}\n\nfunction isoOf(date: Civil | null) {\n\treturn date ? formatIso(date) : \"\";\n}\n\nfunction addDays(date: Civil, days: number): Civil | null {\n\tconst next = utcDate(date);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tnext.setUTCDate(next.getUTCDate() + days);\n\tif (Number.isNaN(next.getTime())) {\n\t\treturn null;\n\t}\n\tconst civil = { y: next.getUTCFullYear(), m: next.getUTCMonth() + 1, d: next.getUTCDate() };\n\treturn isValidCivil(civil) ? civil : null;\n}\n\nfunction shiftMonth(month: Civil, delta: number): Civil | null {\n\tconst total = month.y * 12 + (month.m - 1) + delta;\n\tconst next = { y: Math.floor(total / 12), m: (total % 12) + 1, d: 1 };\n\treturn isValidCivil(next) ? next : null;\n}\n\nexport function DatePicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tmode = \"single\",\n\tmonth: controlledMonthProp,\n\tdefaultMonth: defaultMonthProp,\n\tonMonthChange,\n\trangeValue,\n\tdefaultRangeValue,\n\tonRangeChange,\n\tisDisabledDate,\n\tpresets,\n\tlocale = \"en-US\",\n\tweekStartsOn = 0,\n\ttimeZone,\n\tformatDate,\n\tname,\n\trequired,\n\tmin,\n\tmax,\n\tdisabled,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\tlabels,\n\t...inputRest\n}: DatePickerProps) {\n\tconst {\n\t\tref: externalRef,\n\t\treadOnly,\n\t\tautoFocus,\n\t\tonFocus,\n\t\tonBlur,\n\t\tonInvalid: externalOnInvalid,\n\t\t\"aria-labelledby\": ariaLabelledBy,\n\t\t...formRest\n\t} = inputRest;\n\tconst [uncontrolled, setUncontrolled] = useState(defaultValue);\n\tconst [uncontrolledRange, setUncontrolledRange] = useState<DatePickerRange>(\n\t\tdefaultRangeValue ?? { from: \"\", to: undefined },\n\t);\n\tconst [open, setOpen] = useState(false);\n\tconst [isInvalid, setIsInvalid] = useState(false);\n\tconst [validationMessage, setValidationMessage] = useState(\"\");\n\tconst [focusIndex, setFocusIndex] = useState(0);\n\tconst dayRefs = useRef<Array<HTMLButtonElement | null>>([]);\n\tconst pendingFocus = useRef<{ targetMonthKey: string; iso: string } | null>(null);\n\tconst focusDay = useRef(false);\n\tconst hiddenRef = useRef<HTMLInputElement>(null);\n\tconst triggerRef = useRef<HTMLButtonElement>(null);\n\tconst generatedErrorId = React.useId();\n\tconst errorId = id ? `${id}-error` : generatedErrorId;\n\tconst generatedMonthLiveId = React.useId();\n\tconst monthLiveId = id ? `${id}-month-live` : generatedMonthLiveId;\n\tconst generatedKeyboardInstructionsId = React.useId();\n\tconst keyboardInstructionsId = id\n\t\t? `${id}-keyboard-instructions`\n\t\t: generatedKeyboardInstructionsId;\n\n\tconst selected = value ?? uncontrolled;\n\tconst selectedRange = rangeValue ?? uncontrolledRange;\n\tconst selectedDate = parseIso(\n\t\tmode === \"range\" ? selectedRange.to || selectedRange.from || \"\" : selected,\n\t);\n\tconst cursorIso = selectedDate ? formatIso(selectedDate) : \"\";\n\n\tuseEffect(() => {\n\t\tif (cursorIso) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t}, [cursorIso]);\n\tconst submitted = mode === \"range\" ? \"\" : cursorIso;\n\n\tconst controlledParsed = useMemo(() => parseIsoMonth(controlledMonthProp), [controlledMonthProp]);\n\tconst isMonthControlled = controlledParsed !== null;\n\n\tconst [uncontrolledMonth, setUncontrolledMonth] = useState<Civil>(() => {\n\t\tconst parsedDef = parseIsoMonth(defaultMonthProp);\n\t\tif (parsedDef) {\n\t\t\treturn parsedDef;\n\t\t}\n\t\tconst initialCursor = selectedDate ?? todayCivil(timeZone);\n\t\tconst clampedInitial = clampCivil(initialCursor, min, max);\n\t\treturn { y: clampedInitial.y, m: clampedInitial.m, d: 1 };\n\t});\n\n\tconst activeMonth = controlledParsed ?? uncontrolledMonth;\n\tconst activeMonthKey = formatIsoMonth(activeMonth);\n\n\tconst requestMonth = (target: Civil) => {\n\t\tconst monthKey = formatIsoMonth(target);\n\t\tif (!isMonthControlled) {\n\t\t\tsetUncontrolledMonth(target);\n\t\t}\n\t\tonMonthChange?.(monthKey);\n\t};\n\n\tconst prevSelected = useRef(cursorIso);\n\tif (open && prevSelected.current !== cursorIso) {\n\t\tfocusDay.current = true;\n\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\tconst next = selectedDate ?? todayCivil(timeZone);\n\t\t\tif (activeMonth.y !== next.y || activeMonth.m !== next.m) {\n\t\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t}\n\t\t}\n\t}\n\tprevSelected.current = cursorIso;\n\n\tconst hasExplicitMonthConfig =\n\t\tcontrolledMonthProp !== undefined || defaultMonthProp !== undefined;\n\n\tuseEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tif (!hasExplicitMonthConfig) {\n\t\t\tconst next = clampCivil(\n\t\t\t\t(cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone),\n\t\t\t\tmin,\n\t\t\t\tmax,\n\t\t\t);\n\t\t\tsetUncontrolledMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\tif (!cursorIso) {\n\t\t\t\tfocusDay.current = true;\n\t\t\t}\n\t\t}\n\t}, [open, cursorIso, timeZone, min, max, hasExplicitMonthConfig]);\n\n\tuseEffect(() => {\n\t\tif (disabled) {\n\t\t\tsetOpen(false);\n\t\t}\n\t}, [disabled]);\n\n\tuseEffect(() => {\n\t\tif (autoFocus) {\n\t\t\ttriggerRef.current?.focus();\n\t\t}\n\t}, [autoFocus]);\n\n\tconst latestConfigRef = useRef({\n\t\tdefaultValue,\n\t\tdefaultRangeValue,\n\t\tmode,\n\t\trangeValue,\n\t\tvalue,\n\t});\n\tuseEffect(() => {\n\t\tlatestConfigRef.current = {\n\t\t\tdefaultValue,\n\t\t\tdefaultRangeValue,\n\t\t\tmode,\n\t\t\trangeValue,\n\t\t\tvalue,\n\t\t};\n\t});\n\n\tconst formAttr = formRest.form;\n\tuseEffect(() => {\n\t\tconst form = hiddenRef.current?.form;\n\t\tif (!form || (formAttr && form.id !== formAttr)) {\n\t\t\treturn;\n\t\t}\n\t\tlet disposed = false;\n\t\tconst timers = new Set<ReturnType<typeof setTimeout>>();\n\t\tconst onReset = (event: Event) => {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\ttimers.delete(timer);\n\t\t\t\tif (disposed || event.defaultPrevented) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst cfg = latestConfigRef.current;\n\t\t\t\tif (cfg.mode === \"range\" ? cfg.rangeValue === undefined : cfg.value === undefined) {\n\t\t\t\t\tsetUncontrolled(cfg.defaultValue);\n\t\t\t\t\tsetUncontrolledRange(cfg.defaultRangeValue ?? { from: \"\", to: undefined });\n\t\t\t\t}\n\t\t\t\tsetIsInvalid(false);\n\t\t\t\tsetValidationMessage(\"\");\n\t\t\t\tsetOpen(false);\n\t\t\t}, 0);\n\t\t\ttimers.add(timer);\n\t\t};\n\t\tform.addEventListener(\"reset\", onReset);\n\t\treturn () => {\n\t\t\tdisposed = true;\n\t\t\tfor (const timer of timers) {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\t\t\ttimers.clear();\n\t\t\tform.removeEventListener(\"reset\", onReset);\n\t\t};\n\t}, [formAttr]);\n\n\tconst weekdayLabels = useMemo(() => {\n\t\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone: \"UTC\" });\n\t\treturn Array.from({ length: 7 }, (_, index) => {\n\t\t\tconst day = new Date(Date.UTC(2024, 0, 7 + ((index + weekStartsOn) % 7)));\n\t\t\treturn formatter.format(day);\n\t\t});\n\t}, [locale, weekStartsOn]);\n\n\tconst days = useMemo(() => {\n\t\tconst first = { y: activeMonth.y, m: activeMonth.m, d: 1 };\n\t\tif (!isValidCivil(first)) {\n\t\t\treturn Array.from({ length: 42 }, () => null);\n\t\t}\n\t\tconst startOffset = (utcDate(first).getUTCDay() - weekStartsOn + 7) % 7;\n\t\tconst start = addDays(first, -startOffset);\n\t\tif (!start) {\n\t\t\treturn Array.from({ length: 42 }, (_, index) => addDays(first, index - startOffset));\n\t\t}\n\t\treturn Array.from({ length: 42 }, (_, index) => addDays(start, index));\n\t}, [activeMonth, weekStartsOn]);\n\n\tuseLayoutEffect(() => {\n\t\tif (!open) {\n\t\t\treturn;\n\t\t}\n\t\tconst pending = pendingFocus.current;\n\t\tlet index = 0;\n\t\tif (pending) {\n\t\t\tif (pending.targetMonthKey === activeMonthKey) {\n\t\t\t\tpendingFocus.current = null;\n\t\t\t\tindex = days.findIndex((date) => isoOf(date) === pending.iso);\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tindex = 0;\n\t\t\t\t}\n\t\t\t\tfocusDay.current = true;\n\t\t\t} else {\n\t\t\t\tconst focused = document.activeElement;\n\t\t\t\tconst focusedIso =\n\t\t\t\t\tfocused instanceof HTMLElement && dayRefs.current.some((node) => node === focused)\n\t\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t\t: null;\n\t\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\t\tif (focusedIndex >= 0) {\n\t\t\t\t\tindex = focusedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tindex = focusIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst focused = document.activeElement;\n\t\t\tconst focusedIso =\n\t\t\t\t!focusDay.current &&\n\t\t\t\tfocused instanceof HTMLElement &&\n\t\t\t\tdayRefs.current.some((node) => node === focused)\n\t\t\t\t\t? focused.getAttribute(\"aria-label\")\n\t\t\t\t\t: null;\n\t\t\tconst focusedIndex = focusedIso ? days.findIndex((date) => isoOf(date) === focusedIso) : -1;\n\t\t\tif (focusedIndex >= 0) {\n\t\t\t\tindex = focusedIndex;\n\t\t\t} else {\n\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\tif (selectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m) {\n\t\t\t\t\tindex = selectedIndex;\n\t\t\t\t} else {\n\t\t\t\t\tconst firstInMonth = days.findIndex((date) => date?.m === activeMonth.m);\n\t\t\t\t\tindex = firstInMonth >= 0 ? firstInMonth : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst enabled = (date: Civil | null) =>\n\t\t\tBoolean(date && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate));\n\t\tif (!enabled(days[index] ?? null)) {\n\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t}\n\t\tsetFocusIndex(index);\n\t\tif (focusDay.current) {\n\t\t\tfocusDay.current = false;\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}, [\n\t\topen,\n\t\tcursorIso,\n\t\tsubmitted,\n\t\ttimeZone,\n\t\tdays,\n\t\tactiveMonth.m,\n\t\tactiveMonthKey,\n\t\tfocusIndex,\n\t\tmin,\n\t\tmax,\n\t\tisDisabledDate,\n\t]);\n\n\tconst previousMonth = shiftMonth(activeMonth, -1);\n\tconst followingMonth = shiftMonth(activeMonth, 1);\n\tconst rangeFrom = mode === \"range\" ? selectedRange.from : \"\";\n\tconst rangeTo = mode === \"range\" ? selectedRange.to : undefined;\n\tconst label = formatTriggerLabel({\n\t\tmode,\n\t\tselectedDate,\n\t\trangeFrom,\n\t\trangeTo,\n\t\tlocale,\n\t\tformatDate,\n\t\tplaceholder: labels?.placeholder,\n\t});\n\tconst calendarLabel = labels?.calendar ?? (ariaLabel ? `${ariaLabel} calendar` : \"Date calendar\");\n\tconst prevMonthLabel = labels?.previousMonth ?? \"Prev\";\n\tconst nextMonthLabel = labels?.nextMonth ?? \"Next\";\n\n\tfunction selectable(iso: string) {\n\t\treturn dateSelectable(iso, min, max, isDisabledDate);\n\t}\n\n\tfunction focusCalendarDay(next: Civil) {\n\t\tif (next.y !== activeMonth.y || next.m !== activeMonth.m) {\n\t\t\tpendingFocus.current = {\n\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\tiso: formatIso(next),\n\t\t\t};\n\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\treturn;\n\t\t}\n\t\tconst index = days.findIndex((date) => isoOf(date) === formatIso(next));\n\t\tif (index >= 0) {\n\t\t\tsetFocusIndex(index);\n\t\t\tdayRefs.current[index]?.focus();\n\t\t}\n\t}\n\n\tfunction commit(next: string) {\n\t\tif (disabled || readOnly || !selectable(next)) {\n\t\t\treturn;\n\t\t}\n\t\tif (next) {\n\t\t\tsetIsInvalid(false);\n\t\t\tsetValidationMessage(\"\");\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tconst current = rangeValue ?? uncontrolledRange;\n\t\t\tconst nextRange =\n\t\t\t\t!current.from || current.to\n\t\t\t\t\t? { from: next }\n\t\t\t\t\t: compareCivil(\n\t\t\t\t\t\t\t\tparseIso(next) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t\tparseIso(current.from) ?? { y: 1, m: 1, d: 1 },\n\t\t\t\t\t\t\t) < 0\n\t\t\t\t\t\t? { from: next, to: current.from }\n\t\t\t\t\t\t: { from: current.from, to: next };\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t}\n\t\t\tonRangeChange?.(nextRange);\n\t\t\tif (nextRange.to) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tsetOpen(false);\n\t\tonChange?.(next);\n\t}\n\n\tfunction applyPreset(preset: DatePickerPreset) {\n\t\tif (disabled || readOnly) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof preset.value === \"string\") {\n\t\t\tif (mode === \"range\") {\n\t\t\t\tif (!selectable(preset.value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst nextRange = { from: preset.value, to: preset.value };\n\t\t\t\tif (rangeValue === undefined) {\n\t\t\t\t\tsetUncontrolledRange(nextRange);\n\t\t\t\t}\n\t\t\t\tonRangeChange?.(nextRange);\n\t\t\t\tsetOpen(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcommit(preset.value);\n\t\t\treturn;\n\t\t}\n\t\tif (mode === \"range\") {\n\t\t\tif (!selectable(preset.value.from) || !selectable(preset.value.to)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (rangeValue === undefined) {\n\t\t\t\tsetUncontrolledRange(preset.value);\n\t\t\t}\n\t\t\tonRangeChange?.(preset.value);\n\t\t\tsetOpen(false);\n\t\t}\n\t}\n\n\tconst handleHiddenRef = React.useCallback(\n\t\t(node: HTMLInputElement | null) => {\n\t\t\thiddenRef.current = node;\n\t\t\tif (!externalRef) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (typeof externalRef === \"function\") {\n\t\t\t\tconst cleanup = externalRef(node);\n\t\t\t\tif (typeof cleanup === \"function\") {\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn () => {\n\t\t\t\t\thiddenRef.current = null;\n\t\t\t\t\texternalRef(null);\n\t\t\t\t};\n\t\t\t}\n\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = node;\n\t\t\treturn () => {\n\t\t\t\thiddenRef.current = null;\n\t\t\t\t(externalRef as React.RefObject<HTMLInputElement | null>).current = null;\n\t\t\t};\n\t\t},\n\t\t[externalRef],\n\t);\n\n\tconst invalidState = ariaInvalid ?? (isInvalid || undefined);\n\tconst hasDestructiveStyle =\n\t\tinvalidState === true ||\n\t\tinvalidState === \"true\" ||\n\t\tinvalidState === \"grammar\" ||\n\t\tinvalidState === \"spelling\";\n\n\tconst describedBy =\n\t\t[ariaDescribedBy, isInvalid && errorId ? errorId : undefined].filter(Boolean).join(\" \") ||\n\t\tundefined;\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (next && disabled) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (next) {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\tif (controlledMonthProp === undefined && defaultMonthProp === undefined) {\n\t\t\t\t\t\tconst synced = (cursorIso ? parseIso(cursorIso) : null) ?? todayCivil(timeZone);\n\t\t\t\t\t\tsetUncontrolledMonth({ y: synced.y, m: synced.m, d: 1 });\n\t\t\t\t\t}\n\t\t\t\t\tfocusDay.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t}}\n\t\t>\n\t\t\t<input\n\t\t\t\tref={handleHiddenRef}\n\t\t\t\ttype={mode === \"range\" ? \"text\" : \"date\"}\n\t\t\t\tname={name}\n\t\t\t\trequired={required}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tmin={mode === \"range\" ? undefined : min}\n\t\t\t\tmax={mode === \"range\" ? undefined : max}\n\t\t\t\tclassName=\"sr-only mb-basalt-space-lg min-h-basalt-control-inset\"\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: 1,\n\t\t\t\t\theight: 1,\n\t\t\t\t\toverflow: \"hidden\",\n\t\t\t\t\tclip: \"rect(0, 0, 0, 0)\",\n\t\t\t\t}}\n\t\t\t\tvalue={\n\t\t\t\t\tmode === \"range\" ? (rangeFrom && rangeTo ? `${rangeFrom}/${rangeTo}` : \"\") : submitted\n\t\t\t\t}\n\t\t\t\tonChange={() => undefined}\n\t\t\t\tonInvalid={(event) => {\n\t\t\t\t\texternalOnInvalid?.(event);\n\t\t\t\t\tif (!event.defaultPrevented) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tsetIsInvalid(true);\n\t\t\t\t\t\tsetValidationMessage(\n\t\t\t\t\t\t\tlabels?.validationMessage ||\n\t\t\t\t\t\t\t\t(event.target as HTMLInputElement).validationMessage ||\n\t\t\t\t\t\t\t\t\"Please fill out this field.\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\ttriggerRef.current?.focus();\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\t{...formRest}\n\t\t\t/>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tref={triggerRef}\n\t\t\t\t\tid={id}\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\tonFocus={onFocus as ComponentProps<\"button\">[\"onFocus\"]}\n\t\t\t\t\tonBlur={onBlur as ComponentProps<\"button\">[\"onBlur\"]}\n\t\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tariaLabel ? (label === \"Pick a date\" ? ariaLabel : `${ariaLabel}: ${label}`) : undefined\n\t\t\t\t\t}\n\t\t\t\t\taria-describedby={describedBy}\n\t\t\t\t\taria-invalid={invalidState}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"justify-start font-normal\",\n\t\t\t\t\t\thasDestructiveStyle && \"border-basalt-destructive text-basalt-destructive\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t{isInvalid && validationMessage ? (\n\t\t\t\t<span\n\t\t\t\t\tid={errorId}\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t\tclassName=\"mt-basalt-space-sm block text-basalt-sm text-basalt-destructive\"\n\t\t\t\t>\n\t\t\t\t\t{validationMessage}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<PopoverContent\n\t\t\t\tarrow={false}\n\t\t\t\tclassName=\"w-basalt-64 p-basalt-space-lg\"\n\t\t\t\taria-label={calendarLabel}\n\t\t\t\taria-describedby={keyboardInstructionsId}\n\t\t\t\tonOpenAutoFocus={(event) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tconst iso = cursorIso || submitted || formatIso(todayCivil(timeZone));\n\t\t\t\t\tconst selectedIndex = days.findIndex((date) => isoOf(date) === iso);\n\t\t\t\t\tconst enabled = (date: Civil | null) =>\n\t\t\t\t\t\tBoolean(\n\t\t\t\t\t\t\tdate && date.y >= 1 && dateSelectable(formatIso(date), min, max, isDisabledDate),\n\t\t\t\t\t\t);\n\t\t\t\t\tlet index =\n\t\t\t\t\t\tselectedIndex >= 0 && days[selectedIndex]?.m === activeMonth.m\n\t\t\t\t\t\t\t? selectedIndex\n\t\t\t\t\t\t\t: Math.max(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tdays.findIndex((date) => date?.m === activeMonth.m),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (!enabled(days[index] ?? null)) {\n\t\t\t\t\t\tconst inMonth = days.findIndex((date) => date?.m === activeMonth.m && enabled(date));\n\t\t\t\t\t\tconst any = days.findIndex((date) => enabled(date));\n\t\t\t\t\t\tindex = inMonth >= 0 ? inMonth : any >= 0 ? any : index;\n\t\t\t\t\t}\n\t\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t\tdayRefs.current[index]?.focus();\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{presets && presets.length > 0 ? (\n\t\t\t\t\t<div className=\"mb-basalt-space-lg flex flex-wrap gap-basalt-space-sm\">\n\t\t\t\t\t\t{presets.map((preset) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={preset.label}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"min-h-basalt-control-inset px-basalt-space-lg text-basalt-sm\"\n\t\t\t\t\t\t\t\tdisabled={disabled || readOnly}\n\t\t\t\t\t\t\t\tonClick={() => applyPreset(preset)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{preset.label}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"mb-basalt-space-lg flex items-center justify-between gap-basalt-space-lg\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronLeft />}\n\t\t\t\t\t\taria-label={prevMonthLabel}\n\t\t\t\t\t\tclassName=\"size-basalt-8\"\n\t\t\t\t\t\tdisabled={disabled || !previousMonth || previousMonth.y < 1}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!previousMonth || previousMonth.y < 1) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(previousMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid={monthLiveId}\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\tclassName=\"text-basalt-base font-medium\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{formatCivil(activeMonth, locale, { month: \"long\", year: \"numeric\" })}\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ticon={<ChevronRight />}\n\t\t\t\t\t\taria-label={nextMonthLabel}\n\t\t\t\t\t\tclassName=\"size-basalt-8\"\n\t\t\t\t\t\tdisabled={disabled || !followingMonth}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!followingMonth) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = null;\n\t\t\t\t\t\t\tfocusDay.current = false;\n\t\t\t\t\t\t\trequestMonth(followingMonth);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<p id={keyboardInstructionsId} className=\"sr-only\">\n\t\t\t\t\t{labels?.keyboardInstructions ??\n\t\t\t\t\t\t\"Use arrow keys to navigate dates, PageUp and PageDown to change months, and Enter or Space to select.\"}\n\t\t\t\t</p>\n\t\t\t\t{/* Biome override: WAI-ARIA APG Date Picker pattern uses a semantic table with role=\"grid\" and role=\"gridcell\" on cells while roving tabindex focuses the child button */}\n\t\t\t\t<table\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\taria-labelledby={monthLiveId}\n\t\t\t\t\taria-multiselectable={mode === \"range\" ? \"true\" : undefined}\n\t\t\t\t\tclassName=\"w-full border-collapse text-center\"\n\t\t\t\t\tonKeyDown={(event) => {\n\t\t\t\t\t\tconst current = days[focusIndex];\n\t\t\t\t\t\tif (!current) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.key === \"ArrowRight\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowLeft\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowDown\" ||\n\t\t\t\t\t\t\tevent.key === \"ArrowUp\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst delta =\n\t\t\t\t\t\t\t\tevent.key === \"ArrowRight\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: event.key === \"ArrowLeft\"\n\t\t\t\t\t\t\t\t\t\t? -1\n\t\t\t\t\t\t\t\t\t\t: event.key === \"ArrowDown\"\n\t\t\t\t\t\t\t\t\t\t\t? 7\n\t\t\t\t\t\t\t\t\t\t\t: -7;\n\t\t\t\t\t\t\tlet next = addDays(current, delta);\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, delta);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusCalendarDay(next);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Home\" || event.key === \"End\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst dayOfWeek = utcDate(current).getUTCDay();\n\t\t\t\t\t\t\tconst col = (dayOfWeek - weekStartsOn + 7) % 7;\n\t\t\t\t\t\t\tconst deltaToEdge = event.key === \"Home\" ? -col : 6 - col;\n\t\t\t\t\t\t\tlet next: Civil | null = addDays(current, deltaToEdge);\n\t\t\t\t\t\t\tconst stepDir = event.key === \"Home\" ? 1 : -1;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 7;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, stepDir);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfocusCalendarDay(next);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"PageDown\" || event.key === \"PageUp\") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst deltaMonths = event.shiftKey\n\t\t\t\t\t\t\t\t? event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 12\n\t\t\t\t\t\t\t\t\t: -12\n\t\t\t\t\t\t\t\t: event.key === \"PageDown\"\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: -1;\n\t\t\t\t\t\t\tconst target = shiftCivilMonthClamped(current, deltaMonths);\n\t\t\t\t\t\t\tif (!target) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet next: Civil | null = target;\n\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnext = addDays(next, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\tnext = target;\n\t\t\t\t\t\t\t\tfor (\n\t\t\t\t\t\t\t\t\tlet step = 0;\n\t\t\t\t\t\t\t\t\tnext && next.y >= 1 && !selectable(formatIso(next)) && step < 42;\n\t\t\t\t\t\t\t\t\tstep += 1\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tnext = addDays(next, -1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!next || next.y < 1 || !selectable(formatIso(next))) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpendingFocus.current = {\n\t\t\t\t\t\t\t\ttargetMonthKey: formatIsoMonth(next),\n\t\t\t\t\t\t\t\tiso: formatIso(next),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\trequestMonth({ y: next.y, m: next.m, d: 1 });\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tconst iso = formatIso(current);\n\t\t\t\t\t\t\tif (current.y >= 1 && selectable(iso)) {\n\t\t\t\t\t\t\t\tcommit(iso);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t{weekdayLabels.map((day, index) => (\n\t\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\t\tkey={`${day}-${index}`}\n\t\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\t\tclassName=\"min-h-basalt-control text-center text-basalt-sm font-medium text-basalt-muted-foreground\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{day}\n\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t{Array.from({ length: 6 }, (_, weekIndex) => (\n\t\t\t\t\t\t\t<tr key={`week-${weekIndex}`}>\n\t\t\t\t\t\t\t\t{days.slice(weekIndex * 7, weekIndex * 7 + 7).map((date, colIndex) => {\n\t\t\t\t\t\t\t\t\tconst index = weekIndex * 7 + colIndex;\n\t\t\t\t\t\t\t\t\tif (!date) {\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\t\tkey={`empty-${index}`}\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"min-h-basalt-control p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = null;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst iso = formatIso(date);\n\t\t\t\t\t\t\t\t\tconst inMonth = date.m === activeMonth.m;\n\t\t\t\t\t\t\t\t\tconst inRange = date.y >= 1 && selectable(iso);\n\t\t\t\t\t\t\t\t\tconst fromDate = rangeFrom ? parseIso(rangeFrom) : null;\n\t\t\t\t\t\t\t\t\tconst toDate = rangeTo ? parseIso(rangeTo) : null;\n\t\t\t\t\t\t\t\t\tconst thisDate = parseIso(iso);\n\t\t\t\t\t\t\t\t\tconst inSelectedRange = Boolean(\n\t\t\t\t\t\t\t\t\t\tfromDate &&\n\t\t\t\t\t\t\t\t\t\t\ttoDate &&\n\t\t\t\t\t\t\t\t\t\t\tthisDate &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, fromDate) >= 0 &&\n\t\t\t\t\t\t\t\t\t\t\tcompareCivil(thisDate, toDate) <= 0,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst isRangeEdge = iso === rangeFrom || iso === rangeTo;\n\t\t\t\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\t\t\t\tmode === \"range\"\n\t\t\t\t\t\t\t\t\t\t\t? inSelectedRange || isRangeEdge\n\t\t\t\t\t\t\t\t\t\t\t: Boolean(submitted) && iso === submitted;\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\t\t\t\tkey={iso}\n\t\t\t\t\t\t\t\t\t\t\trole=\"gridcell\"\n\t\t\t\t\t\t\t\t\t\t\taria-selected={isSelected ? \"true\" : undefined}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"min-h-basalt-control p-0 text-center\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdayRefs.current[index] = node;\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\ttabIndex={index === focusIndex ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\t\t\tdata-date={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={iso}\n\t\t\t\t\t\t\t\t\t\t\t\taria-pressed={mode === \"range\" ? isRangeEdge : isSelected}\n\t\t\t\t\t\t\t\t\t\t\t\tdisabled={disabled || readOnly || !inRange}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\tCALENDAR_BUTTON,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"mx-auto flex min-h-basalt-control w-basalt-control items-center justify-center rounded-basalt-md text-basalt-base\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinMonth ? \"text-basalt-foreground\" : \"text-basalt-muted-foreground\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange && \"hover:bg-basalt-hover\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinSelectedRange && !isRangeEdge && \"bg-basalt-selected\",\n\t\t\t\t\t\t\t\t\t\t\t\t\tinRange &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(mode === \"range\" ? isRangeEdge : isSelected) &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"bg-basalt-primary text-basalt-primary-foreground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CwE,IAAUxL,EAAK,KAAK,KAAK2J,EAAWtH,CAAG,GACvCoJ,IAAWjJ,IAAYpC,EAASoC,CAAS,IAAI,MAC7CkJ,IAASjJ,IAAUrC,EAASqC,CAAO,IAAI,MACvCkJ,IAAWvL,EAASiC,CAAG,GACvBuJ,KAAkB,GACvBH,KACCC,KACAC,KACA/I,EAAa+I,GAAUF,CAAQ,KAAK,KACpC7I,EAAa+I,GAAUD,CAAM,KAAK,IAE9BG,IAAcxJ,MAAQG,KAAaH,MAAQI,GAC3CqJ,IACLvJ,MAAS,UACNqJ,MAAmBC,IACnB,EAAQtF,KAAclE,MAAQkE;OAElC,OACC,kBAAC,MAAD;QAEC,MAAK;QACL,iBAAeuF,IAAa,SAAS,KAAA;QACrC,WAAU;QAEV,UAAA,kBAAC,UAAD;SACC,MAAK;SACL,MAAM,MAAS;UACd,EAAQ,QAAQzD,KAASQ;SAC1B;SACA,UAAUR,MAAUjD,KAAa,IAAI;SACrC,aAAW/C;SACX,cAAYA;SACZ,gBAAcE,MAAS,UAAUsJ,IAAcC;SAC/C,UAAUtE,KAAYsC,KAAY,CAAC0B;SACnC,WAAWX,EACV/J,IACA,qHACAoI,IAAU,2BAA2B,gCACrCsC,KAAW,yBACXI,MAAmB,CAACC,KAAe,sBACnCL,MACEjJ,MAAS,UAAUsJ,IAAcC,MAClC,gFACF;SACA,eAAeN,KAAW3B,GAAOxH,CAAG;SAEnC,UAAArC,EAAK;QACC,CAAA;OACL,GA7BEqC,CA6BF;MAEN,CAAC,EACE,GApEK,QAAQiJ,GAoEb,CACJ,EACK,CAAA,CACD;;IACQ;;EACR;;AAEX"}
@@ -17,7 +17,7 @@ function o({ name: o, onDelete: s, errorMessage: c }) {
17
17
  title: `Delete ${o}?`,
18
18
  description: /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", { children: "This cannot be undone." }), p ? /* @__PURE__ */ i("span", {
19
19
  role: "alert",
20
- className: "mt-2 block text-xs text-basalt-destructive",
20
+ className: "mt-basalt-space-lg block text-basalt-sm text-basalt-destructive",
21
21
  children: p
22
22
  }) : null] }),
23
23
  confirmLabel: "Delete",
@@ -1 +1 @@
1
- {"version":3,"file":"delete-resource.js","names":["_Fragment","React","Fragment$1","DeleteResource","open","setOpen","loading","setLoading","error","setError","resolveErrorMessage","errorMessage","err","ConfirmDialog","Button","name","next","onDelete"],"sources":["../../src/components/delete-resource.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button } from \"./button\";\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\nexport type DeleteResourceErrorFormatter = (error: unknown) => React.ReactNode;\n\nexport type DeleteResourceProps = {\n\t/** Name of the resource being deleted, interpolated into dialog title and trigger label. */\n\tname: string;\n\t/** Called when deletion is confirmed. When this throws or rejects, an error alert is shown and the dialog remains open for retry. */\n\tonDelete: () => void | Promise<void>;\n\t/** Custom error message or renderer when onDelete fails. Accepts a ReactNode or an (error: unknown) => ReactNode formatter. Defaults to the caught Error message or 'Failed to delete resource. Please try again.' */\n\terrorMessage?: React.ReactNode | DeleteResourceErrorFormatter;\n};\n\nexport function DeleteResource({ name, onDelete, errorMessage }: DeleteResourceProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [loading, setLoading] = React.useState(false);\n\tconst [error, setError] = React.useState<React.ReactNode | null>(null);\n\n\tconst resolveErrorMessage = (err: unknown): React.ReactNode => {\n\t\tif (typeof errorMessage === \"function\") {\n\t\t\treturn errorMessage(err);\n\t\t}\n\t\tif (errorMessage != null) {\n\t\t\treturn errorMessage;\n\t\t}\n\t\tif (err instanceof Error && err.message) {\n\t\t\treturn err.message;\n\t\t}\n\t\treturn \"Failed to delete resource. Please try again.\";\n\t};\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\ttrigger={<Button variant=\"destructive\">Delete {name}</Button>}\n\t\t\topen={open}\n\t\t\tloading={loading}\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={`Delete ${name}?`}\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<span>This cannot be undone.</span>\n\t\t\t\t\t{error ? (\n\t\t\t\t\t\t<span role=\"alert\" className=\"mt-2 block text-xs text-basalt-destructive\">\n\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (loading && !next) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t\tif (!next) {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tsetError(null);\n\t\t\t\t}\n\t\t\t}}\n\t\t\tonConfirm={async () => {\n\t\t\t\tsetLoading(true);\n\t\t\t\tsetError(null);\n\t\t\t\ttry {\n\t\t\t\t\tawait onDelete();\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tsetError(resolveErrorMessage(err));\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAeA,SAAgBG,EAAe,EAAE,SAAM,aAAU,mBAAqC;CACrF,IAAM,CAACC,GAAMC,KAAWJ,EAAM,SAAS,EAAK,GACtC,CAACK,GAASC,KAAcN,EAAM,SAAS,EAAK,GAC5C,CAACO,GAAOC,KAAYR,EAAM,SAAiC,IAAI,GAE/DS,KAAuB,MACxB,OAAOC,KAAiB,aACpBA,EAAaC,CAAG,IAEpBD,MAGAC,aAAe,SAASA,EAAI,UACxBA,EAAI,UAEL;CAGR,OACC,kBAACC,GAAD;EACC,SAAS,kBAACC,GAAD;GAAQ,SAAQ;GAAhB,UAAA,CAA8B,WAAQC,CAAa;;EACtD;EACG;EACT,SAAQ;EACR,OAAO,UAAUA,EAAK;EACtB,aACC,kBAAAf,GAAA,EAAA,UAAA,CACC,kBAAC,QAAD,EAAA,UAAM,yBAA4B,CAAA,GACjCQ,IACA,kBAAC,QAAD;GAAM,MAAK;GAAQ,WAAU;GAC3B,UAAAA;EACI,CAAA,IACH,IACH,EAAA,CAAA;EAEH,cAAa;EACb,eAAe,MAAS;GACvB,CAAI,MAAYQ,OAGhBX,EAAQW,CAAI,GACPA,MACJT,EAAW,EAAK,GAChBE,EAAS,IAAI;EAEf;EACA,WAAW,YAAY;GAEtB,AADAF,EAAW,EAAI,GACfE,EAAS,IAAI;GACb,IAAI;IAEH,AADA,MAAMQ,EAAS,GACfZ,EAAQ,EAAK;GACd,SAASO,GAAK;IAEb,AADAH,EAASC,EAAoBE,CAAG,CAAC,GACjCP,EAAQ,EAAI;GACb,UAAU;IACT,EAAW,EAAK;GACjB;EACD;CACA,CAAA;AAEH"}
1
+ {"version":3,"file":"delete-resource.js","names":["_Fragment","React","Fragment$1","DeleteResource","open","setOpen","loading","setLoading","error","setError","resolveErrorMessage","errorMessage","err","ConfirmDialog","Button","name","next","onDelete"],"sources":["../../src/components/delete-resource.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button } from \"./button\";\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\nexport type DeleteResourceErrorFormatter = (error: unknown) => React.ReactNode;\n\nexport type DeleteResourceProps = {\n\t/** Name of the resource being deleted, interpolated into dialog title and trigger label. */\n\tname: string;\n\t/** Called when deletion is confirmed. When this throws or rejects, an error alert is shown and the dialog remains open for retry. */\n\tonDelete: () => void | Promise<void>;\n\t/** Custom error message or renderer when onDelete fails. Accepts a ReactNode or an (error: unknown) => ReactNode formatter. Defaults to the caught Error message or 'Failed to delete resource. Please try again.' */\n\terrorMessage?: React.ReactNode | DeleteResourceErrorFormatter;\n};\n\nexport function DeleteResource({ name, onDelete, errorMessage }: DeleteResourceProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [loading, setLoading] = React.useState(false);\n\tconst [error, setError] = React.useState<React.ReactNode | null>(null);\n\n\tconst resolveErrorMessage = (err: unknown): React.ReactNode => {\n\t\tif (typeof errorMessage === \"function\") {\n\t\t\treturn errorMessage(err);\n\t\t}\n\t\tif (errorMessage != null) {\n\t\t\treturn errorMessage;\n\t\t}\n\t\tif (err instanceof Error && err.message) {\n\t\t\treturn err.message;\n\t\t}\n\t\treturn \"Failed to delete resource. Please try again.\";\n\t};\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\ttrigger={<Button variant=\"destructive\">Delete {name}</Button>}\n\t\t\topen={open}\n\t\t\tloading={loading}\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={`Delete ${name}?`}\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<span>This cannot be undone.</span>\n\t\t\t\t\t{error ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\trole=\"alert\"\n\t\t\t\t\t\t\tclassName=\"mt-basalt-space-lg block text-basalt-sm text-basalt-destructive\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (loading && !next) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetOpen(next);\n\t\t\t\tif (!next) {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tsetError(null);\n\t\t\t\t}\n\t\t\t}}\n\t\t\tonConfirm={async () => {\n\t\t\t\tsetLoading(true);\n\t\t\t\tsetError(null);\n\t\t\t\ttry {\n\t\t\t\t\tawait onDelete();\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tsetError(resolveErrorMessage(err));\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t} finally {\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAeA,SAAgBG,EAAe,EAAE,SAAM,aAAU,mBAAqC;CACrF,IAAM,CAACC,GAAMC,KAAWJ,EAAM,SAAS,EAAK,GACtC,CAACK,GAASC,KAAcN,EAAM,SAAS,EAAK,GAC5C,CAACO,GAAOC,KAAYR,EAAM,SAAiC,IAAI,GAE/DS,KAAuB,MACxB,OAAOC,KAAiB,aACpBA,EAAaC,CAAG,IAEpBD,MAGAC,aAAe,SAASA,EAAI,UACxBA,EAAI,UAEL;CAGR,OACC,kBAACC,GAAD;EACC,SAAS,kBAACC,GAAD;GAAQ,SAAQ;GAAhB,UAAA,CAA8B,WAAQC,CAAa;;EACtD;EACG;EACT,SAAQ;EACR,OAAO,UAAUA,EAAK;EACtB,aACC,kBAAAf,GAAA,EAAA,UAAA,CACC,kBAAC,QAAD,EAAA,UAAM,yBAA4B,CAAA,GACjCQ,IACA,kBAAC,QAAD;GACC,MAAK;GACL,WAAU;GAET,UAAAA;EACI,CAAA,IACH,IACH,EAAA,CAAA;EAEH,cAAa;EACb,eAAe,MAAS;GACvB,CAAI,MAAYQ,OAGhBX,EAAQW,CAAI,GACPA,MACJT,EAAW,EAAK,GAChBE,EAAS,IAAI;EAEf;EACA,WAAW,YAAY;GAEtB,AADAF,EAAW,EAAI,GACfE,EAAS,IAAI;GACb,IAAI;IAEH,AADA,MAAMQ,EAAS,GACfZ,EAAQ,EAAK;GACd,SAASO,GAAK;IAEb,AADAH,EAASC,EAAoBE,CAAG,CAAC,GACjCP,EAAQ,EAAI;GACb,UAAU;IACT,EAAW,EAAK;GACjB;EACD;CACA,CAAA;AAEH"}
@@ -10,7 +10,7 @@ var i = {
10
10
  };
11
11
  function a({ className: r, columns: a = 2, ...o }) {
12
12
  return /* @__PURE__ */ n("dl", {
13
- className: e(t, "grid gap-x-8 gap-y-3 text-sm", i[a], r),
13
+ className: e(t, "grid gap-x-basalt-layout gap-y-basalt-layout-sm text-basalt-base", i[a], r),
14
14
  ...o
15
15
  });
16
16
  }
@@ -20,10 +20,10 @@ function o({ term: t, className: i, children: a, ...o }) {
20
20
  className: e("min-w-0", i),
21
21
  ...o,
22
22
  children: [/* @__PURE__ */ n("dt", {
23
- className: "text-xs text-basalt-muted-foreground",
23
+ className: "text-basalt-sm text-basalt-muted-foreground",
24
24
  children: t
25
25
  }), /* @__PURE__ */ n("dd", {
26
- className: "mt-0.5 wrap-break-word text-basalt-foreground",
26
+ className: "mt-basalt-space-xs wrap-break-word text-basalt-foreground",
27
27
  children: a
28
28
  })]
29
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"description-list.js","names":["COLUMN_CLASS","DescriptionListRoot","props","cn","BASALT_UI_CLASS","columns","className","DescriptionListItem","term","DescriptionList"],"sources":["../../src/components/description-list.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport type DescriptionListColumns = 1 | 2 | 3;\n\nexport type DescriptionListProps = HTMLAttributes<HTMLDListElement> & {\n\t/**\n\t * Number of term/value columns from the small breakpoint up.\n\t * @default 2\n\t */\n\tcolumns?: DescriptionListColumns;\n};\n\nconst COLUMN_CLASS: Record<DescriptionListColumns, string> = {\n\t1: \"sm:grid-cols-1\",\n\t2: \"sm:grid-cols-2\",\n\t3: \"sm:grid-cols-3\",\n};\n\nfunction DescriptionListRoot({ className, columns = 2, ...props }: DescriptionListProps) {\n\treturn (\n\t\t<dl\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"grid gap-x-8 gap-y-3 text-sm\",\n\t\t\t\tCOLUMN_CLASS[columns],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\nDescriptionListRoot.displayName = \"DescriptionList\";\n\nexport type DescriptionListItemProps = HTMLAttributes<HTMLDivElement> & {\n\t/**\n\t * Term shown above the value.\n\t */\n\tterm: ReactNode;\n};\n\nfunction DescriptionListItem({ term, className, children, ...props }: DescriptionListItemProps) {\n\treturn (\n\t\t<div className={cn(\"min-w-0\", className)} {...props}>\n\t\t\t<dt className=\"text-xs text-basalt-muted-foreground\">{term}</dt>\n\t\t\t<dd className=\"mt-0.5 wrap-break-word text-basalt-foreground\">{children}</dd>\n\t\t</div>\n\t);\n}\nDescriptionListItem.displayName = \"DescriptionList.Item\";\n\nexport const DescriptionList = Object.assign(DescriptionListRoot, {\n\tItem: DescriptionListItem,\n});\n"],"mappings":";;;;;AAcA,IAAMA,IAAuD;CAC5D,GAAG;CACH,GAAG;CACH,GAAG;AACJ;AAEA,SAASC,EAAoB,EAAE,cAAW,aAAU,GAAG,GAAGC,KAA+B;CACxF,OACC,kBAAC,MAAD;EACC,WAAWC,EACVC,GACA,gCACAJ,EAAaK,IACbC,CACD;EACA,GAAIJ;CACJ,CAAA;AAEH;AACA,EAAoB,cAAc;AASlC,SAASK,EAAoB,EAAE,SAAM,cAAW,aAAU,GAAGL,KAAmC;CAC/F,OACC,kBAAC,OAAD;EAAK,WAAWC,EAAG,WAAWG,CAAS;EAAG,GAAIJ;EAA9C,UAAA,CACC,kBAAC,MAAD;GAAI,WAAU;GAAwC,UAAAM;EAAS,CAAA,GAC/D,kBAAC,MAAD;GAAI,WAAU;GAAiD;EAAa,CAAA,CACxE;;AAEP;AACA,EAAoB,cAAc;AAElC,IAAaC,IAAkB,OAAO,OAAOR,GAAqB,EACjE,MAAMM,EACP,CAAC"}
1
+ {"version":3,"file":"description-list.js","names":["COLUMN_CLASS","DescriptionListRoot","props","cn","BASALT_UI_CLASS","columns","className","DescriptionListItem","term","DescriptionList"],"sources":["../../src/components/description-list.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport type DescriptionListColumns = 1 | 2 | 3;\n\nexport type DescriptionListProps = HTMLAttributes<HTMLDListElement> & {\n\t/**\n\t * Number of term/value columns from the small breakpoint up.\n\t * @default 2\n\t */\n\tcolumns?: DescriptionListColumns;\n};\n\nconst COLUMN_CLASS: Record<DescriptionListColumns, string> = {\n\t1: \"sm:grid-cols-1\",\n\t2: \"sm:grid-cols-2\",\n\t3: \"sm:grid-cols-3\",\n};\n\nfunction DescriptionListRoot({ className, columns = 2, ...props }: DescriptionListProps) {\n\treturn (\n\t\t<dl\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"grid gap-x-basalt-layout gap-y-basalt-layout-sm text-basalt-base\",\n\t\t\t\tCOLUMN_CLASS[columns],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\nDescriptionListRoot.displayName = \"DescriptionList\";\n\nexport type DescriptionListItemProps = HTMLAttributes<HTMLDivElement> & {\n\t/**\n\t * Term shown above the value.\n\t */\n\tterm: ReactNode;\n};\n\nfunction DescriptionListItem({ term, className, children, ...props }: DescriptionListItemProps) {\n\treturn (\n\t\t<div className={cn(\"min-w-0\", className)} {...props}>\n\t\t\t<dt className=\"text-basalt-sm text-basalt-muted-foreground\">{term}</dt>\n\t\t\t<dd className=\"mt-basalt-space-xs wrap-break-word text-basalt-foreground\">{children}</dd>\n\t\t</div>\n\t);\n}\nDescriptionListItem.displayName = \"DescriptionList.Item\";\n\nexport const DescriptionList = Object.assign(DescriptionListRoot, {\n\tItem: DescriptionListItem,\n});\n"],"mappings":";;;;;AAcA,IAAMA,IAAuD;CAC5D,GAAG;CACH,GAAG;CACH,GAAG;AACJ;AAEA,SAASC,EAAoB,EAAE,cAAW,aAAU,GAAG,GAAGC,KAA+B;CACxF,OACC,kBAAC,MAAD;EACC,WAAWC,EACVC,GACA,oEACAJ,EAAaK,IACbC,CACD;EACA,GAAIJ;CACJ,CAAA;AAEH;AACA,EAAoB,cAAc;AASlC,SAASK,EAAoB,EAAE,SAAM,cAAW,aAAU,GAAGL,KAAmC;CAC/F,OACC,kBAAC,OAAD;EAAK,WAAWC,EAAG,WAAWG,CAAS;EAAG,GAAIJ;EAA9C,UAAA,CACC,kBAAC,MAAD;GAAI,WAAU;GAA+C,UAAAM;EAAS,CAAA,GACtE,kBAAC,MAAD;GAAI,WAAU;GAA6D;EAAa,CAAA,CACpF;;AAEP;AACA,EAAoB,cAAc;AAElC,IAAaC,IAAkB,OAAO,OAAOR,GAAqB,EACjE,MAAMM,EACP,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import * as DialogPrimitive from "@radix-ui/react-dialog";
2
2
  import * as React from "react";
3
3
  export declare const DIALOG_SIZES: {
4
- readonly sm: "sm:w-72";
5
- readonly base: "sm:w-96";
4
+ readonly sm: "sm:w-basalt-72";
5
+ readonly base: "sm:w-basalt-96";
6
6
  readonly lg: "sm:w-[32rem]";
7
7
  readonly xl: "sm:w-[48rem]";
8
8
  };
@@ -7,16 +7,16 @@ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  import * as s from "@radix-ui/react-dialog";
8
8
  //#region src/components/dialog.tsx
9
9
  var c = {
10
- sm: "sm:w-72",
11
- base: "sm:w-96",
10
+ sm: "sm:w-basalt-72",
11
+ base: "sm:w-basalt-96",
12
12
  lg: "sm:w-[32rem]",
13
13
  xl: "sm:w-[48rem]"
14
14
  };
15
15
  function l(t) {
16
- return e("fixed inset-0 bg-black/40 backdrop-blur-md", n, "data-[state=open]:animate-basalt-overlay-in data-[state=closed]:animate-basalt-overlay-out", r, t);
16
+ return e("fixed inset-0 bg-basalt-backdrop/40 backdrop-blur-md", n, "data-[state=open]:animate-basalt-overlay-in data-[state=closed]:animate-basalt-overlay-out", r, t);
17
17
  }
18
18
  function u({ size: i = "base", className: a } = {}) {
19
- return e(t, "fixed top-1/2 left-1/2 w-full max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] origin-center -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-basalt-lg p-6 text-basalt-foreground shadow-lg ring-1 ring-basalt-border", n, "data-[state=open]:animate-basalt-dialog-in data-[state=closed]:animate-basalt-dialog-out", r, c[i], a);
19
+ return e(t, "fixed top-1/2 left-1/2 w-full max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] origin-center -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-basalt-lg p-basalt-card sm:p-basalt-card-lg text-basalt-foreground shadow-lg ring-1 ring-basalt-border", n, "data-[state=open]:animate-basalt-dialog-in data-[state=closed]:animate-basalt-dialog-out", r, c[i], a);
20
20
  }
21
21
  var d = s.Root, f = s.Trigger, p = s.Close, m = s.Portal, h = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ a(s.Overlay, {
22
22
  ref: n,
@@ -46,23 +46,23 @@ var g = i.forwardRef(({ className: e, children: t, size: n = "base", disablePoin
46
46
  g.displayName = s.Content.displayName;
47
47
  var _ = i.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a(s.Title, {
48
48
  ref: r,
49
- className: e("text-2xl font-semibold tracking-tight", t),
49
+ className: e("text-basalt-3xl font-semibold tracking-tight", t),
50
50
  ...n
51
51
  }));
52
52
  _.displayName = s.Title.displayName;
53
53
  var v = i.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a(s.Description, {
54
54
  ref: r,
55
- className: e("text-base text-basalt-muted-foreground", t),
55
+ className: e("text-basalt-lg text-basalt-muted-foreground", t),
56
56
  ...n
57
57
  }));
58
58
  v.displayName = s.Description.displayName;
59
59
  var y = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
60
- className: e("flex flex-col space-y-1.5 text-left", t),
60
+ className: e("flex flex-col space-y-basalt-space-md text-left", t),
61
61
  ...n
62
62
  });
63
63
  y.displayName = "DialogHeader";
64
64
  var b = ({ className: t, ...n }) => /* @__PURE__ */ a("div", {
65
- className: e("mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", t),
65
+ className: e("mt-basalt-space-lg flex flex-col-reverse gap-basalt-space-lg sm:flex-row sm:justify-end", t),
66
66
  ...n
67
67
  });
68
68
  b.displayName = "DialogFooter";