@42-central/ui-react 0.18.1 → 0.19.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 (438) hide show
  1. package/dist/{chunk-YXE4B6X3.js → chunk-2NNZHVKD.js} +3 -3
  2. package/dist/{chunk-YXE4B6X3.js.map → chunk-2NNZHVKD.js.map} +1 -1
  3. package/dist/{chunk-5JHDSVEZ.js → chunk-4NNGTNPV.js} +10 -8
  4. package/dist/chunk-4NNGTNPV.js.map +1 -0
  5. package/dist/{chunk-7NZSTCJO.js → chunk-57BTVRRB.js} +4 -9
  6. package/dist/chunk-57BTVRRB.js.map +1 -0
  7. package/dist/{chunk-S2HWWR2H.js → chunk-64T6Z7BA.js} +3 -3
  8. package/dist/{chunk-S2HWWR2H.js.map → chunk-64T6Z7BA.js.map} +1 -1
  9. package/dist/{chunk-MI2WZRK3.js → chunk-A6MYJTJI.js} +4 -4
  10. package/dist/{chunk-MI2WZRK3.js.map → chunk-A6MYJTJI.js.map} +1 -1
  11. package/dist/{chunk-RQL7FVCS.js → chunk-BTFBBNRW.js} +11 -6
  12. package/dist/chunk-BTFBBNRW.js.map +1 -0
  13. package/dist/{chunk-OWG4BCQR.js → chunk-CYWMES5P.js} +4 -4
  14. package/dist/{chunk-OWG4BCQR.js.map → chunk-CYWMES5P.js.map} +1 -1
  15. package/dist/{chunk-YBJB7FGE.js → chunk-CZEKZ5HR.js} +6 -6
  16. package/dist/chunk-CZEKZ5HR.js.map +1 -0
  17. package/dist/{chunk-HAQJQFE6.js → chunk-DBTJEBMO.js} +11 -4
  18. package/dist/{chunk-HAQJQFE6.js.map → chunk-DBTJEBMO.js.map} +1 -1
  19. package/dist/{chunk-AE7QTLJ5.js → chunk-FAOBC4IS.js} +4 -4
  20. package/dist/{chunk-AE7QTLJ5.js.map → chunk-FAOBC4IS.js.map} +1 -1
  21. package/dist/{chunk-NF5JM2YO.js → chunk-FOMR74VE.js} +3 -3
  22. package/dist/{chunk-NF5JM2YO.js.map → chunk-FOMR74VE.js.map} +1 -1
  23. package/dist/{chunk-FZIHZT5R.js → chunk-GCGX4FEF.js} +16 -10
  24. package/dist/chunk-GCGX4FEF.js.map +1 -0
  25. package/dist/{chunk-B2YJKRNQ.js → chunk-HCYULRWT.js} +13 -9
  26. package/dist/chunk-HCYULRWT.js.map +1 -0
  27. package/dist/{chunk-B2LCHXUB.js → chunk-INJUILCN.js} +9 -4
  28. package/dist/chunk-INJUILCN.js.map +1 -0
  29. package/dist/{chunk-ZDXQ64A7.js → chunk-K5UWVH6P.js} +5 -5
  30. package/dist/{chunk-ZDXQ64A7.js.map → chunk-K5UWVH6P.js.map} +1 -1
  31. package/dist/{chunk-6GDMSENK.js → chunk-LM6F6DLR.js} +3 -24
  32. package/dist/chunk-LM6F6DLR.js.map +1 -0
  33. package/dist/{chunk-KHMFNH3X.js → chunk-MQO42HZL.js} +7 -7
  34. package/dist/chunk-MQO42HZL.js.map +1 -0
  35. package/dist/chunk-OC7I2CTA.js +8 -0
  36. package/dist/chunk-OC7I2CTA.js.map +1 -0
  37. package/dist/{chunk-O23Y5ML4.js → chunk-OGJFDNIS.js} +249 -231
  38. package/dist/chunk-OGJFDNIS.js.map +1 -0
  39. package/dist/{chunk-6OLTJYSX.js → chunk-PINENGML.js} +12 -5
  40. package/dist/chunk-PINENGML.js.map +1 -0
  41. package/dist/{chunk-NSDM3FEB.js → chunk-PS2PZFXH.js} +5 -3
  42. package/dist/chunk-PS2PZFXH.js.map +1 -0
  43. package/dist/{chunk-RAUOFTUH.js → chunk-QIDAXFKK.js} +4 -4
  44. package/dist/{chunk-RAUOFTUH.js.map → chunk-QIDAXFKK.js.map} +1 -1
  45. package/dist/{chunk-S7N4LGLZ.js → chunk-RIP5G47F.js} +4 -4
  46. package/dist/{chunk-S7N4LGLZ.js.map → chunk-RIP5G47F.js.map} +1 -1
  47. package/dist/{chunk-Z2Z5EXVT.js → chunk-RKYXG6X7.js} +3 -3
  48. package/dist/{chunk-Z2Z5EXVT.js.map → chunk-RKYXG6X7.js.map} +1 -1
  49. package/dist/{chunk-WQN64ZHG.js → chunk-SVKU3GUN.js} +10 -6
  50. package/dist/chunk-SVKU3GUN.js.map +1 -0
  51. package/dist/{chunk-FHG54IT5.js → chunk-TBTSEPGP.js} +13 -4
  52. package/dist/chunk-TBTSEPGP.js.map +1 -0
  53. package/dist/{chunk-HT5JAHR3.js → chunk-UJZIF2BA.js} +20 -9
  54. package/dist/chunk-UJZIF2BA.js.map +1 -0
  55. package/dist/{chunk-UHNRAI6V.js → chunk-VZBUQNLX.js} +68 -29
  56. package/dist/chunk-VZBUQNLX.js.map +1 -0
  57. package/dist/{chunk-JITF6I7N.js → chunk-WJOHNCYY.js} +11 -4
  58. package/dist/{chunk-JITF6I7N.js.map → chunk-WJOHNCYY.js.map} +1 -1
  59. package/dist/{chunk-EBREIC3L.js → chunk-YQHOKMSV.js} +26 -8
  60. package/dist/chunk-YQHOKMSV.js.map +1 -0
  61. package/dist/{chunk-WHKKN3ZK.js → chunk-YW6Q6ERX.js} +10 -8
  62. package/dist/chunk-YW6Q6ERX.js.map +1 -0
  63. package/dist/{chunk-PH354ECN.js → chunk-Z43YWH4R.js} +13 -4
  64. package/dist/chunk-Z43YWH4R.js.map +1 -0
  65. package/dist/{chunk-5OQLFX47.js → chunk-Z6RPMRFH.js} +3 -3
  66. package/dist/{chunk-5OQLFX47.js.map → chunk-Z6RPMRFH.js.map} +1 -1
  67. package/dist/{chunk-TCWYBVIL.js → chunk-ZB5VMGKB.js} +10 -7
  68. package/dist/chunk-ZB5VMGKB.js.map +1 -0
  69. package/dist/components/accordion/index.js +1 -1
  70. package/dist/components/action-icon/index.js +3 -3
  71. package/dist/components/alert/index.js +3 -3
  72. package/dist/components/app-shell/index.js +4 -4
  73. package/dist/components/autocomplete/autocomplete.d.ts +8 -1
  74. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  75. package/dist/components/autocomplete/index.d.ts +1 -1
  76. package/dist/components/autocomplete/index.d.ts.map +1 -1
  77. package/dist/components/autocomplete/index.js +10 -7
  78. package/dist/components/autocomplete/index.js.map +1 -1
  79. package/dist/components/badge/index.js +1 -1
  80. package/dist/components/button/index.js +3 -3
  81. package/dist/components/button-multi-select/index.js +5 -5
  82. package/dist/components/button-select/index.js +5 -5
  83. package/dist/components/calendar/calendar-zone-sync.d.ts +41 -0
  84. package/dist/components/calendar/calendar-zone-sync.d.ts.map +1 -0
  85. package/dist/components/calendar/calendar.d.ts +6 -5
  86. package/dist/components/calendar/calendar.d.ts.map +1 -1
  87. package/dist/components/calendar/index.js +8 -5
  88. package/dist/components/chart/chart.d.ts +17 -10
  89. package/dist/components/chart/chart.d.ts.map +1 -1
  90. package/dist/components/chart/index.js +50 -7
  91. package/dist/components/chart/index.js.map +1 -1
  92. package/dist/components/chart/styles.css +100 -0
  93. package/dist/components/checkbox/index.js +4 -4
  94. package/dist/components/choice-card-group/index.d.ts.map +1 -1
  95. package/dist/components/choice-card-group/index.js +4 -3
  96. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  97. package/dist/components/circular-progress/index.js.map +1 -1
  98. package/dist/components/clipboard/clipboard.d.ts.map +1 -1
  99. package/dist/components/clipboard/copy.d.ts.map +1 -1
  100. package/dist/components/clipboard/index.js +5 -5
  101. package/dist/components/clipboard/index.js.map +1 -1
  102. package/dist/components/code-block/chrome.js +4 -4
  103. package/dist/components/code-block/index.js +5 -5
  104. package/dist/components/combobox/combobox.d.ts +20 -1
  105. package/dist/components/combobox/combobox.d.ts.map +1 -1
  106. package/dist/components/combobox/index.d.ts +1 -1
  107. package/dist/components/combobox/index.d.ts.map +1 -1
  108. package/dist/components/combobox/index.js +4 -4
  109. package/dist/components/combobox-list/combobox-list.d.ts +8 -1
  110. package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
  111. package/dist/components/combobox-list/index.d.ts +1 -1
  112. package/dist/components/combobox-list/index.d.ts.map +1 -1
  113. package/dist/components/combobox-list/index.js +5 -5
  114. package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts.map +1 -1
  115. package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts +4 -1
  116. package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts.map +1 -1
  117. package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts +4 -1
  118. package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts.map +1 -1
  119. package/dist/components/data-table/data-table-filter/index.d.ts +5 -1
  120. package/dist/components/data-table/data-table-filter/index.d.ts.map +1 -1
  121. package/dist/components/data-table/data-table-header-cell.d.ts +11 -15
  122. package/dist/components/data-table/data-table-header-cell.d.ts.map +1 -1
  123. package/dist/components/data-table/data-table-meta.d.ts +2 -2
  124. package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
  125. package/dist/components/data-table/data-table-pagination.d.ts +3 -0
  126. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
  127. package/dist/components/data-table/data-table-stack.d.ts +6 -3
  128. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  129. package/dist/components/data-table/data-table-toolbar.d.ts +3 -1
  130. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
  131. package/dist/components/data-table/data-table-translations.d.ts +68 -0
  132. package/dist/components/data-table/data-table-translations.d.ts.map +1 -0
  133. package/dist/components/data-table/data-table.d.ts +5 -8
  134. package/dist/components/data-table/data-table.d.ts.map +1 -1
  135. package/dist/components/data-table/index.d.ts +2 -1
  136. package/dist/components/data-table/index.d.ts.map +1 -1
  137. package/dist/components/data-table/index.js +206 -84
  138. package/dist/components/data-table/index.js.map +1 -1
  139. package/dist/components/date-picker/date-picker.d.ts +13 -9
  140. package/dist/components/date-picker/date-picker.d.ts.map +1 -1
  141. package/dist/components/date-picker/index.js +16 -15
  142. package/dist/components/date-picker/index.js.map +1 -1
  143. package/dist/components/drawer/drawer.d.ts +9 -1
  144. package/dist/components/drawer/drawer.d.ts.map +1 -1
  145. package/dist/components/drawer/index.d.ts +1 -1
  146. package/dist/components/drawer/index.d.ts.map +1 -1
  147. package/dist/components/drawer/index.js +4 -4
  148. package/dist/components/field/field.d.ts +9 -2
  149. package/dist/components/field/field.d.ts.map +1 -1
  150. package/dist/components/field/index.js +1 -1
  151. package/dist/components/file-upload/file-upload.d.ts +13 -2
  152. package/dist/components/file-upload/file-upload.d.ts.map +1 -1
  153. package/dist/components/file-upload/index.d.ts +1 -1
  154. package/dist/components/file-upload/index.d.ts.map +1 -1
  155. package/dist/components/file-upload/index.js +16 -7
  156. package/dist/components/file-upload/index.js.map +1 -1
  157. package/dist/components/hover-card/index.js +1 -1
  158. package/dist/components/input/index.js +2 -2
  159. package/dist/components/kbd/index.js +30 -15
  160. package/dist/components/kbd/index.js.map +1 -1
  161. package/dist/components/kbd/kbd.d.ts.map +1 -1
  162. package/dist/components/menu/index.js +2 -2
  163. package/dist/components/modal/index.d.ts +1 -1
  164. package/dist/components/modal/index.d.ts.map +1 -1
  165. package/dist/components/modal/index.js +4 -4
  166. package/dist/components/modal/modal.d.ts +9 -1
  167. package/dist/components/modal/modal.d.ts.map +1 -1
  168. package/dist/components/multi-combobox-list/index.d.ts +1 -1
  169. package/dist/components/multi-combobox-list/index.d.ts.map +1 -1
  170. package/dist/components/multi-combobox-list/index.js +7 -5
  171. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +8 -1
  172. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
  173. package/dist/components/multi-select/index.d.ts +1 -1
  174. package/dist/components/multi-select/index.d.ts.map +1 -1
  175. package/dist/components/multi-select/index.js +20 -9
  176. package/dist/components/multi-select/index.js.map +1 -1
  177. package/dist/components/multi-select/multi-select.d.ts +11 -1
  178. package/dist/components/multi-select/multi-select.d.ts.map +1 -1
  179. package/dist/components/nav-link/index.d.ts +1 -1
  180. package/dist/components/nav-link/index.d.ts.map +1 -1
  181. package/dist/components/nav-link/index.js +2 -2
  182. package/dist/components/nav-link/nav-link.d.ts +12 -0
  183. package/dist/components/nav-link/nav-link.d.ts.map +1 -1
  184. package/dist/components/nav-link/navigation.d.ts +3 -1
  185. package/dist/components/nav-link/navigation.d.ts.map +1 -1
  186. package/dist/components/nav-link/tanstack.js +2 -2
  187. package/dist/components/notification/create-notifier.d.ts +12 -1
  188. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  189. package/dist/components/notification/index.d.ts +2 -2
  190. package/dist/components/notification/index.d.ts.map +1 -1
  191. package/dist/components/notification/index.js +9 -6
  192. package/dist/components/notification/index.js.map +1 -1
  193. package/dist/components/notification/notification.d.ts +14 -1
  194. package/dist/components/notification/notification.d.ts.map +1 -1
  195. package/dist/components/number-input/index.d.ts +1 -1
  196. package/dist/components/number-input/index.d.ts.map +1 -1
  197. package/dist/components/number-input/index.js +4 -4
  198. package/dist/components/number-input/number-input.d.ts +20 -2
  199. package/dist/components/number-input/number-input.d.ts.map +1 -1
  200. package/dist/components/overlays/index.js +6 -6
  201. package/dist/components/password-input/index.d.ts +1 -1
  202. package/dist/components/password-input/index.d.ts.map +1 -1
  203. package/dist/components/password-input/index.js +68 -7
  204. package/dist/components/password-input/index.js.map +1 -1
  205. package/dist/components/password-input/password-input.d.ts +45 -6
  206. package/dist/components/password-input/password-input.d.ts.map +1 -1
  207. package/dist/components/pill/index.js +2 -2
  208. package/dist/components/pills-input/index.js +5 -5
  209. package/dist/components/pin-input/index.js +2 -2
  210. package/dist/components/popover/index.js +1 -1
  211. package/dist/components/popover/popover.d.ts +0 -10
  212. package/dist/components/popover/popover.d.ts.map +1 -1
  213. package/dist/components/progress/index.js.map +1 -1
  214. package/dist/components/progress/progress.d.ts.map +1 -1
  215. package/dist/components/radio-group/index.js +3 -3
  216. package/dist/components/rating/index.js +2 -2
  217. package/dist/components/rating/index.js.map +1 -1
  218. package/dist/components/rating/rating.d.ts.map +1 -1
  219. package/dist/components/schedule/index.js +62 -49
  220. package/dist/components/schedule/index.js.map +1 -1
  221. package/dist/components/schedule/now-cursor-line.d.ts +10 -5
  222. package/dist/components/schedule/now-cursor-line.d.ts.map +1 -1
  223. package/dist/components/schedule/schedule-dates.d.ts +11 -26
  224. package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
  225. package/dist/components/schedule/schedule-event-chip.d.ts +4 -1
  226. package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
  227. package/dist/components/schedule/schedule-event-details.d.ts +3 -2
  228. package/dist/components/schedule/schedule-event-details.d.ts.map +1 -1
  229. package/dist/components/schedule/schedule-geometry.d.ts +20 -21
  230. package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
  231. package/dist/components/schedule/schedule-grid-gesture.d.ts +5 -9
  232. package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
  233. package/dist/components/schedule/schedule-segments.d.ts +2 -3
  234. package/dist/components/schedule/schedule-segments.d.ts.map +1 -1
  235. package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
  236. package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
  237. package/dist/components/segment-group/index.js +4 -3
  238. package/dist/components/segment-group/segment-group.d.ts +3 -2
  239. package/dist/components/segment-group/segment-group.d.ts.map +1 -1
  240. package/dist/components/select/index.d.ts +1 -1
  241. package/dist/components/select/index.d.ts.map +1 -1
  242. package/dist/components/select/index.js +6 -4
  243. package/dist/components/select/select.d.ts +12 -2
  244. package/dist/components/select/select.d.ts.map +1 -1
  245. package/dist/components/slider/index.js +2 -2
  246. package/dist/components/spinner/index.js +1 -1
  247. package/dist/components/spinner/spinner.d.ts.map +1 -1
  248. package/dist/components/switch/index.js +3 -3
  249. package/dist/components/switch/index.js.map +1 -1
  250. package/dist/components/switch/switch.d.ts +2 -0
  251. package/dist/components/switch/switch.d.ts.map +1 -1
  252. package/dist/components/table/index.js +1 -1
  253. package/dist/components/table/table.d.ts.map +1 -1
  254. package/dist/components/tabs/index.js +4 -3
  255. package/dist/components/tabs/tabs.d.ts +3 -1
  256. package/dist/components/tabs/tabs.d.ts.map +1 -1
  257. package/dist/components/tags-input/index.d.ts +1 -1
  258. package/dist/components/tags-input/index.d.ts.map +1 -1
  259. package/dist/components/tags-input/index.js +9 -7
  260. package/dist/components/tags-input/index.js.map +1 -1
  261. package/dist/components/tags-input/tags-input.d.ts +9 -2
  262. package/dist/components/tags-input/tags-input.d.ts.map +1 -1
  263. package/dist/components/text-input/index.js +2 -2
  264. package/dist/components/textarea/index.js +2 -2
  265. package/dist/components/theme-icon/index.js +2 -2
  266. package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
  267. package/dist/components/time-input/index.js +24 -8
  268. package/dist/components/time-input/index.js.map +1 -1
  269. package/dist/components/time-input/time-input.d.ts.map +1 -1
  270. package/dist/components/time-input/time-row.d.ts +16 -3
  271. package/dist/components/time-input/time-row.d.ts.map +1 -1
  272. package/dist/components/timeline/index.js +6 -3
  273. package/dist/components/timeline/index.js.map +1 -1
  274. package/dist/components/timeline/timeline.d.ts.map +1 -1
  275. package/dist/components/tooltip/index.js +2 -2
  276. package/dist/components/tree-multi-select/index.d.ts +1 -1
  277. package/dist/components/tree-multi-select/index.d.ts.map +1 -1
  278. package/dist/components/tree-multi-select/index.js +62 -44
  279. package/dist/components/tree-multi-select/index.js.map +1 -1
  280. package/dist/components/tree-multi-select/tree-multi-select.d.ts +10 -1
  281. package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
  282. package/dist/components/tree-select/index.d.ts +1 -1
  283. package/dist/components/tree-select/index.d.ts.map +1 -1
  284. package/dist/components/tree-select/index.js +45 -15
  285. package/dist/components/tree-select/index.js.map +1 -1
  286. package/dist/components/tree-select/tree-select.d.ts +10 -1
  287. package/dist/components/tree-select/tree-select.d.ts.map +1 -1
  288. package/dist/index.js +3 -2
  289. package/dist/index.js.map +1 -1
  290. package/dist/lib/date-value.d.ts +14 -1
  291. package/dist/lib/date-value.d.ts.map +1 -1
  292. package/dist/lib/focus-styles.d.ts +13 -5
  293. package/dist/lib/focus-styles.d.ts.map +1 -1
  294. package/dist/theme.css +1 -2
  295. package/package.json +1 -1
  296. package/src/components/autocomplete/autocomplete.test.tsx +32 -0
  297. package/src/components/autocomplete/autocomplete.tsx +17 -5
  298. package/src/components/autocomplete/index.ts +5 -1
  299. package/src/components/button/button.test.tsx +6 -0
  300. package/src/components/calendar/calendar-zone-sync.tsx +79 -0
  301. package/src/components/calendar/calendar.test.tsx +134 -14
  302. package/src/components/calendar/calendar.tsx +36 -22
  303. package/src/components/chart/chart.test.tsx +115 -8
  304. package/src/components/chart/chart.tsx +115 -25
  305. package/src/components/chart/styles.css +100 -0
  306. package/src/components/choice-card-group/index.ts +2 -0
  307. package/src/components/circular-progress/circular-progress.tsx +2 -0
  308. package/src/components/clipboard/clipboard.test.tsx +54 -22
  309. package/src/components/clipboard/clipboard.tsx +2 -0
  310. package/src/components/clipboard/copy.tsx +2 -0
  311. package/src/components/clipboard/index.ts +3 -3
  312. package/src/components/combobox/combobox.test.tsx +22 -0
  313. package/src/components/combobox/combobox.tsx +20 -0
  314. package/src/components/combobox/index.ts +1 -0
  315. package/src/components/combobox-list/combobox-list.test.tsx +19 -0
  316. package/src/components/combobox-list/combobox-list.tsx +16 -2
  317. package/src/components/combobox-list/index.ts +5 -1
  318. package/src/components/data-table/data-table-filter/data-table-date-filter.tsx +5 -4
  319. package/src/components/data-table/data-table-filter/data-table-number-filter.tsx +16 -2
  320. package/src/components/data-table/data-table-filter/data-table-select-filter.tsx +9 -1
  321. package/src/components/data-table/data-table-filter/index.tsx +15 -1
  322. package/src/components/data-table/data-table-filter.test.tsx +33 -0
  323. package/src/components/data-table/data-table-header-cell.tsx +37 -22
  324. package/src/components/data-table/data-table-meta.ts +2 -2
  325. package/src/components/data-table/data-table-pagination.tsx +6 -0
  326. package/src/components/data-table/data-table-stack.tsx +31 -17
  327. package/src/components/data-table/data-table-toolbar.tsx +4 -1
  328. package/src/components/data-table/data-table-translations.ts +105 -0
  329. package/src/components/data-table/data-table.test.tsx +212 -0
  330. package/src/components/data-table/data-table.tsx +92 -23
  331. package/src/components/data-table/index.ts +9 -1
  332. package/src/components/date-picker/date-picker.test.tsx +197 -5
  333. package/src/components/date-picker/date-picker.tsx +42 -16
  334. package/src/components/drawer/drawer.tsx +14 -1
  335. package/src/components/drawer/index.ts +1 -0
  336. package/src/components/field/field.tsx +29 -3
  337. package/src/components/file-upload/file-upload.test.tsx +21 -0
  338. package/src/components/file-upload/file-upload.tsx +26 -3
  339. package/src/components/file-upload/index.ts +1 -1
  340. package/src/components/kbd/kbd.test.tsx +31 -0
  341. package/src/components/kbd/kbd.tsx +29 -14
  342. package/src/components/modal/index.ts +1 -0
  343. package/src/components/modal/modal-translations.test.tsx +27 -0
  344. package/src/components/modal/modal.tsx +14 -1
  345. package/src/components/multi-combobox-list/index.ts +5 -1
  346. package/src/components/multi-combobox-list/multi-combobox-list.test.tsx +19 -0
  347. package/src/components/multi-combobox-list/multi-combobox-list.tsx +26 -4
  348. package/src/components/multi-select/index.ts +1 -1
  349. package/src/components/multi-select/multi-select.test.tsx +38 -0
  350. package/src/components/multi-select/multi-select.tsx +28 -4
  351. package/src/components/nav-link/index.ts +6 -1
  352. package/src/components/nav-link/nav-link.test.tsx +16 -0
  353. package/src/components/nav-link/nav-link.tsx +19 -1
  354. package/src/components/nav-link/navigation.test.tsx +18 -0
  355. package/src/components/nav-link/navigation.tsx +8 -4
  356. package/src/components/notification/create-notifier.tsx +20 -4
  357. package/src/components/notification/index.ts +7 -1
  358. package/src/components/notification/notification.test.tsx +49 -0
  359. package/src/components/notification/notification.tsx +39 -5
  360. package/src/components/number-input/index.ts +1 -1
  361. package/src/components/number-input/number-input.test.tsx +37 -0
  362. package/src/components/number-input/number-input.tsx +33 -4
  363. package/src/components/password-input/index.ts +5 -1
  364. package/src/components/password-input/password-input.test.tsx +201 -4
  365. package/src/components/password-input/password-input.tsx +162 -13
  366. package/src/components/popover/popover.tsx +0 -29
  367. package/src/components/progress/index.ts +3 -3
  368. package/src/components/progress/progress.tsx +2 -0
  369. package/src/components/rating/rating.tsx +2 -0
  370. package/src/components/schedule/now-cursor-line.test.tsx +74 -27
  371. package/src/components/schedule/now-cursor-line.tsx +40 -17
  372. package/src/components/schedule/schedule-agenda-view.test.tsx +1 -1
  373. package/src/components/schedule/schedule-dates.test.ts +19 -0
  374. package/src/components/schedule/schedule-dates.ts +16 -30
  375. package/src/components/schedule/schedule-details-popover.test.tsx +77 -6
  376. package/src/components/schedule/schedule-event-chip.tsx +17 -6
  377. package/src/components/schedule/schedule-event-details.test.tsx +38 -0
  378. package/src/components/schedule/schedule-event-details.tsx +7 -5
  379. package/src/components/schedule/schedule-geometry.test.ts +21 -18
  380. package/src/components/schedule/schedule-geometry.ts +37 -24
  381. package/src/components/schedule/schedule-grid-gesture.ts +5 -9
  382. package/src/components/schedule/schedule-segments.ts +2 -3
  383. package/src/components/schedule/schedule-timed-grid.tsx +43 -20
  384. package/src/components/schedule/schedule.test.tsx +34 -11
  385. package/src/components/schedule/use-event-resize.ts +6 -13
  386. package/src/components/segment-group/segment-group.test.tsx +23 -0
  387. package/src/components/segment-group/segment-group.tsx +13 -7
  388. package/src/components/select/index.ts +1 -1
  389. package/src/components/select/select.test.tsx +32 -0
  390. package/src/components/select/select.tsx +15 -1
  391. package/src/components/spinner/spinner.test.tsx +26 -0
  392. package/src/components/spinner/spinner.tsx +4 -1
  393. package/src/components/switch/switch.test.tsx +12 -0
  394. package/src/components/switch/switch.tsx +3 -1
  395. package/src/components/table/table.test.tsx +13 -0
  396. package/src/components/table/table.tsx +9 -5
  397. package/src/components/tabs/tabs.test.tsx +11 -0
  398. package/src/components/tabs/tabs.tsx +6 -4
  399. package/src/components/tags-input/index.ts +1 -1
  400. package/src/components/tags-input/tags-input.test.tsx +28 -0
  401. package/src/components/tags-input/tags-input.tsx +17 -1
  402. package/src/components/theme-icon/theme-icon.tsx +8 -3
  403. package/src/components/time-input/time-input.test.tsx +75 -0
  404. package/src/components/time-input/time-input.tsx +27 -3
  405. package/src/components/time-input/time-row.tsx +27 -3
  406. package/src/components/timeline/timeline.tsx +6 -3
  407. package/src/components/tree-multi-select/index.ts +5 -1
  408. package/src/components/tree-multi-select/tree-multi-select.test.tsx +72 -0
  409. package/src/components/tree-multi-select/tree-multi-select.tsx +156 -115
  410. package/src/components/tree-select/index.ts +1 -1
  411. package/src/components/tree-select/tree-select.test.tsx +69 -0
  412. package/src/components/tree-select/tree-select.tsx +128 -74
  413. package/src/lib/date-value.test.ts +19 -0
  414. package/src/lib/date-value.ts +21 -5
  415. package/src/lib/focus-styles.test.ts +21 -2
  416. package/src/lib/focus-styles.ts +24 -5
  417. package/src/theme.css +1 -2
  418. package/src/use-client-barrels.test.ts +80 -0
  419. package/dist/chunk-5JHDSVEZ.js.map +0 -1
  420. package/dist/chunk-6GDMSENK.js.map +0 -1
  421. package/dist/chunk-6OLTJYSX.js.map +0 -1
  422. package/dist/chunk-7NZSTCJO.js.map +0 -1
  423. package/dist/chunk-B2LCHXUB.js.map +0 -1
  424. package/dist/chunk-B2YJKRNQ.js.map +0 -1
  425. package/dist/chunk-EBREIC3L.js.map +0 -1
  426. package/dist/chunk-FHG54IT5.js.map +0 -1
  427. package/dist/chunk-FZIHZT5R.js.map +0 -1
  428. package/dist/chunk-HT5JAHR3.js.map +0 -1
  429. package/dist/chunk-KHMFNH3X.js.map +0 -1
  430. package/dist/chunk-NSDM3FEB.js.map +0 -1
  431. package/dist/chunk-O23Y5ML4.js.map +0 -1
  432. package/dist/chunk-PH354ECN.js.map +0 -1
  433. package/dist/chunk-RQL7FVCS.js.map +0 -1
  434. package/dist/chunk-TCWYBVIL.js.map +0 -1
  435. package/dist/chunk-UHNRAI6V.js.map +0 -1
  436. package/dist/chunk-WHKKN3ZK.js.map +0 -1
  437. package/dist/chunk-WQN64ZHG.js.map +0 -1
  438. package/dist/chunk-YBJB7FGE.js.map +0 -1
@@ -2,6 +2,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/re
2
2
  import { describe, expect, it, vi } from "vitest"
3
3
  import { disableWeekends } from "../../lib/date-predicates"
4
4
  import { type DateRangeValue, dateToCalendarValue } from "../../lib/date-value"
5
+ import { IntlProvider } from "../../lib/intl"
5
6
  import { Calendar } from "./calendar"
6
7
 
7
8
  // Ark binds trigger/cell handlers after the machine reaches its ready state; flush that
@@ -9,27 +10,23 @@ import { Calendar } from "./calendar"
9
10
  // time-input.test.tsx).
10
11
  const flush = () => new Promise((resolve) => setTimeout(resolve, 0))
11
12
 
12
- // UTC has a fixed (never-DST) offset, so a day-grid cell's own calendar arithmetic serializes
13
- // identically to constructing the same instant directly here — the one time-zone choice that
14
- // makes `data-value` selectors exact without reverse-engineering zag's internal string format.
13
+ // The zone the fixtures below are written in: `utc(…)` builds midnight UTC, which this zone reads
14
+ // as that same calendar day wherever the suite runs.
15
15
  const TZ = "UTC"
16
16
 
17
17
  const utc = (year: number, month: number, day: number) => new Date(Date.UTC(year, month, day))
18
18
 
19
- /** The clickable day-cell trigger for a given date (not the ancestor `<td>`, which carries the
20
- * same `data-value` but has no click handler). */
21
- const dayTrigger = (container: HTMLElement, date: Date): HTMLElement | null =>
22
- container.querySelector(
23
- `[role="button"][data-value="${dateToCalendarValue(date, TZ).toString()}"]`,
24
- )
25
-
26
- /** The same trigger, addressed by the calendar day it renders *in the grid's own zone* rather
27
- * than by an instant — `data-value` is the cell's `ZonedDateTime`, which always starts with that
28
- * day (`2026-07-18T00:00:00+14:00[Pacific/Kiritimati]`), so a prefix match works for any zone
29
- * without reconstructing zag's offset/zone suffix. */
19
+ /** The clickable day-cell trigger for a calendar day (not the ancestor `<td>`, which carries the
20
+ * same `data-value` but has no click handler). A cell's `data-value` is a zone-free
21
+ * `CalendarDate` or `CalendarDateTime` (`2026-07-18`, `2026-07-18T00:00:00`), so a prefix match
22
+ * on the day finds it whichever shape the grid derived it from. */
30
23
  const dayTriggerOn = (container: HTMLElement, isoDay: string): HTMLElement | null =>
31
24
  container.querySelector(`[role="button"][data-value^="${isoDay}"]`)
32
25
 
26
+ /** The same trigger for the day a `Date` falls on in `TZ`. */
27
+ const dayTrigger = (container: HTMLElement, date: Date): HTMLElement | null =>
28
+ dayTriggerOn(container, dateToCalendarValue(date, TZ).toString().slice(0, 10))
29
+
33
30
  describe("Calendar", () => {
34
31
  it("renders a day grid with role='grid'", () => {
35
32
  render(<Calendar timeZone={TZ} defaultValue={utc(2026, 6, 15)} />)
@@ -276,3 +273,126 @@ describe("Calendar", () => {
276
273
  expect(cell?.className).not.toContain("focus-visible:ring-(--c-solid)")
277
274
  })
278
275
  })
276
+
277
+ describe("Calendar — IntlProvider time zone", () => {
278
+ // 10:30 UTC is already the 16th in Kiritimati (UTC+14) and still the 14th in Midway (UTC−11),
279
+ // while every host this suite runs on (UTC in CI, Paris locally) reads the 15th — so each
280
+ // assertion names a day only the intended zone can produce.
281
+ const instant = new Date("2026-07-15T10:30:00Z")
282
+ const selectedDay = (container: HTMLElement) =>
283
+ container
284
+ .querySelector('[role="button"][data-selected]')
285
+ ?.getAttribute("data-value")
286
+ ?.slice(0, 10)
287
+
288
+ it("uses the provider's time zone when no prop is set", async () => {
289
+ const { container } = render(
290
+ <IntlProvider timeZone="Pacific/Kiritimati">
291
+ <Calendar defaultValue={instant} />
292
+ </IntlProvider>,
293
+ )
294
+ await flush()
295
+ expect(selectedDay(container)).toBe("2026-07-16")
296
+ })
297
+
298
+ it("re-reads an uncontrolled defaultValue when the zone changes after mount", async () => {
299
+ // What `timeZone="auto"` does under SSR: the hydration render resolves to UTC and the host
300
+ // zone arrives one render later. Ark only reads `defaultValue` at mount, so without the
301
+ // re-seed the selection would stay on the first zone's day.
302
+ const { container, rerender } = render(
303
+ <IntlProvider timeZone="Pacific/Midway">
304
+ <Calendar defaultValue={instant} />
305
+ </IntlProvider>,
306
+ )
307
+ await flush()
308
+ expect(selectedDay(container)).toBe("2026-07-14")
309
+ rerender(
310
+ <IntlProvider timeZone="Pacific/Kiritimati">
311
+ <Calendar defaultValue={instant} />
312
+ </IntlProvider>,
313
+ )
314
+ await flush()
315
+ expect(selectedDay(container)).toBe("2026-07-16")
316
+ })
317
+
318
+ it("keeps a picked date's instant, onChange and focus across a zone change", async () => {
319
+ const onChange = vi.fn()
320
+ const calendar = <Calendar defaultValue={instant} onChange={onChange} />
321
+ const { container, rerender } = render(
322
+ <IntlProvider timeZone="Pacific/Midway">{calendar}</IntlProvider>,
323
+ )
324
+ await flush()
325
+ const picked = dayTriggerOn(container, "2026-07-20") as HTMLElement
326
+ picked.focus()
327
+ fireEvent.click(picked)
328
+ await waitFor(() => expect(onChange).toHaveBeenCalledTimes(1))
329
+ // Ark keeps the selection's time of day on a new pick: the 20th at 23:30 in Midway (UTC−11).
330
+ expect(onChange).toHaveBeenLastCalledWith(new Date("2026-07-21T10:30:00Z"))
331
+ expect(document.activeElement).toBe(picked)
332
+
333
+ // That instant is the 22nd, 00:30 in Kiritimati (UTC+14), so the selection moves a day. Under
334
+ // the old remount it went back to `defaultValue` (the 16th) and focus dropped to <body>.
335
+ rerender(<IntlProvider timeZone="Pacific/Kiritimati">{calendar}</IntlProvider>)
336
+ await waitFor(() => expect(selectedDay(container)).toBe("2026-07-22"))
337
+ expect(onChange).toHaveBeenCalledTimes(1)
338
+ expect(document.activeElement).not.toBe(document.body)
339
+ expect(container.contains(document.activeElement)).toBe(true)
340
+ expect(document.activeElement?.getAttribute("data-value")?.slice(0, 10)).toBe("2026-07-20")
341
+
342
+ // The next pick is a real change, reported in the new zone.
343
+ fireEvent.click(dayTriggerOn(container, "2026-07-23") as HTMLElement)
344
+ await waitFor(() => expect(onChange).toHaveBeenCalledTimes(2))
345
+ expect(onChange).toHaveBeenLastCalledWith(new Date("2026-07-22T10:30:00Z"))
346
+ })
347
+
348
+ it("keeps the month the user navigated to across a zone change", async () => {
349
+ const { container, rerender } = render(
350
+ <IntlProvider timeZone="Pacific/Midway">
351
+ <Calendar defaultValue={instant} />
352
+ </IntlProvider>,
353
+ )
354
+ await flush()
355
+ fireEvent.click(container.querySelector('[data-part="next-trigger"]') as HTMLElement)
356
+ await waitFor(() => expect(dayTriggerOn(container, "2026-08-31")).not.toBeNull())
357
+ rerender(
358
+ <IntlProvider timeZone="Pacific/Kiritimati">
359
+ <Calendar defaultValue={instant} />
360
+ </IntlProvider>,
361
+ )
362
+ await flush()
363
+ await flush()
364
+ expect(dayTriggerOn(container, "2026-08-31")).not.toBeNull()
365
+ })
366
+
367
+ it("re-derives a controlled value in the new zone without calling onChange", async () => {
368
+ const onChange = vi.fn()
369
+ const { container, rerender } = render(
370
+ <IntlProvider timeZone="Pacific/Midway">
371
+ <Calendar value={instant} onChange={onChange} />
372
+ </IntlProvider>,
373
+ )
374
+ await flush()
375
+ expect(selectedDay(container)).toBe("2026-07-14")
376
+ rerender(
377
+ <IntlProvider timeZone="Pacific/Kiritimati">
378
+ <Calendar value={instant} onChange={onChange} />
379
+ </IntlProvider>,
380
+ )
381
+ await waitFor(() => expect(selectedDay(container)).toBe("2026-07-16"))
382
+ // The roving cell follows the selection to its new day.
383
+ expect(
384
+ container.querySelector('[role="button"][data-focus]')?.getAttribute("data-value"),
385
+ ).toMatch(/^2026-07-16/)
386
+ expect(onChange).not.toHaveBeenCalled()
387
+ })
388
+
389
+ it("lets the timeZone prop override the provider", async () => {
390
+ const { container } = render(
391
+ <IntlProvider timeZone="Pacific/Kiritimati">
392
+ <Calendar timeZone="Pacific/Midway" defaultValue={instant} />
393
+ </IntlProvider>,
394
+ )
395
+ await flush()
396
+ expect(selectedDay(container)).toBe("2026-07-14")
397
+ })
398
+ })
@@ -2,22 +2,23 @@
2
2
 
3
3
  import { DatePicker as Ark, type DatePickerDateView as DateView } from "@ark-ui/react/date-picker"
4
4
  import { useLocaleContext } from "@ark-ui/react/locale"
5
- import { getLocalTimeZone } from "@internationalized/date"
6
- import type { ComponentProps, ReactNode } from "react"
5
+ import { type ComponentProps, type ReactNode, useRef } from "react"
7
6
  import { cn } from "../../lib/cn"
8
7
  import type { DatePredicate } from "../../lib/date-predicates"
9
8
  import {
10
9
  calendarValueToDate,
11
10
  type DateRangeValue,
12
- dateToCalendarValue,
11
+ dateToArkValue,
13
12
  fromArkValues,
14
13
  toArkValues,
15
14
  } from "../../lib/date-value"
16
15
  import type { FormControlProps } from "../../lib/form-control"
16
+ import { useTimeZone } from "../../lib/intl"
17
17
  import { props } from "../../lib/props"
18
18
  import type { Size } from "../../lib/sizes"
19
19
  import type { WithTestId } from "../../lib/test-id"
20
20
  import { CalendarBody, type CalendarBodyClassNames } from "./calendar-body"
21
+ import { CalendarZoneSync, hashArkValues } from "./calendar-zone-sync"
21
22
 
22
23
  /**
23
24
  * Calendar — the inline month grid (RFC §9, `docs/rfcs/date-picker.md`): Ark's `date-picker`
@@ -102,10 +103,11 @@ export type CalendarProps<Range extends boolean = false> = FormControlProps<
102
103
  withWeekNumbers?: boolean
103
104
  /** Overrides the active locale context. Drives month/day names and first-day-of-week. */
104
105
  locale?: string
105
- /** Overrides the local time zone for every `Date ↔ DateValue` conversion. Default
106
- * `getLocalTimeZone()` — **not** Ark's own machine default (`"UTC"`), which is why this is
107
- * forwarded to `Ark.Root` explicitly rather than only used in this component's own
108
- * conversions (see `lib/date-value.ts`'s module doc). */
106
+ /** Overrides the time zone for every `Date ↔ DateValue` conversion. Resolves
107
+ * **prop → `IntlProvider` → host zone**, through `useTimeZone` like `Schedule` — **not** Ark's
108
+ * own machine default (`"UTC"`), which is why the resolved zone is forwarded to `Ark.Root`
109
+ * explicitly rather than only used in this component's own conversions (see
110
+ * `lib/date-value.ts`'s module doc). Accepts `"auto"` to follow the host zone. */
109
111
  timeZone?: string
110
112
  /** Overrides Ark's own built-in aria-label/accessible-name strings (day cells, prev/next, the
111
113
  * view-cycling header, week numbers) — English by default. Unlike `locale`, nothing here
@@ -148,8 +150,9 @@ export const Calendar = <Range extends boolean = false>({
148
150
  }: CalendarProps<Range>) => {
149
151
  const { locale: contextLocale } = useLocaleContext()
150
152
  const resolvedLocale = locale ?? contextLocale
151
- const resolvedTimeZone = timeZone ?? getLocalTimeZone()
153
+ const resolvedTimeZone = useTimeZone(timeZone)
152
154
  const isRange = Boolean(range)
155
+ const zoneReseed = useRef<string | null>(null)
153
156
 
154
157
  return (
155
158
  <Ark.Root
@@ -162,18 +165,20 @@ export const Calendar = <Range extends boolean = false>({
162
165
  translations={resolveCalendarTranslations(translations)}
163
166
  value={toArkValues(value, resolvedTimeZone)}
164
167
  defaultValue={toArkValues(defaultValue, resolvedTimeZone)}
165
- onValueChange={
166
- onChange
167
- ? // The machine's value is a plain DateValue[]; `range` is a runtime flag here, so
168
- // narrow the result back to the caller's declared shape.
169
- (details) =>
170
- onChange(
171
- fromArkValues(details.value, isRange, resolvedTimeZone) as Range extends true
172
- ? DateRangeValue
173
- : Date | null,
174
- )
175
- : undefined
176
- }
168
+ onValueChange={(details) => {
169
+ // A zone change re-expresses the selection in the new zone; that echo is not a change.
170
+ if (zoneReseed.current === hashArkValues(details.value)) {
171
+ zoneReseed.current = null
172
+ return
173
+ }
174
+ // The machine's value is a plain DateValue[]; `range` is a runtime flag here, so narrow
175
+ // the result back to the caller's declared shape.
176
+ onChange?.(
177
+ fromArkValues(details.value, isRange, resolvedTimeZone) as Range extends true
178
+ ? DateRangeValue
179
+ : Date | null,
180
+ )
181
+ }}
177
182
  onBlur={onBlur}
178
183
  numOfMonths={numOfMonths}
179
184
  fixedWeeks={fixedWeeks}
@@ -186,8 +191,8 @@ export const Calendar = <Range extends boolean = false>({
186
191
  isDateUnavailable(calendarValueToDate(dateValue, resolvedTimeZone), resolvedTimeZone)
187
192
  : undefined
188
193
  }
189
- min={min ? dateToCalendarValue(min, resolvedTimeZone) : undefined}
190
- max={max ? dateToCalendarValue(max, resolvedTimeZone) : undefined}
194
+ min={min ? dateToArkValue(min, resolvedTimeZone) : undefined}
195
+ max={max ? dateToArkValue(max, resolvedTimeZone) : undefined}
191
196
  minView={minView}
192
197
  maxView={maxView}
193
198
  disabled={disabled}
@@ -205,6 +210,15 @@ export const Calendar = <Range extends boolean = false>({
205
210
  * always finds nothing, so keyboard navigation updates the machine's internal focus state
206
211
  * (visible via `data-focus`) but never moves real DOM focus. `inline` implies `open` (the
207
212
  * machine treats it as permanently open), so `Content`'s `hidden={!open}` never hides this. */}
213
+ {/* Ark reads `defaultValue` once, at mount, so a zone change (`timeZone="auto"` going from
214
+ * the UTC hydration snapshot to the host zone, or the app's provider changing) would leave
215
+ * the selection on the old zone's day. This re-seeds it on the same instant in place;
216
+ * see `calendar-zone-sync.tsx` for why it isn't a remount. */}
217
+ <CalendarZoneSync
218
+ timeZone={resolvedTimeZone}
219
+ controlled={value !== undefined}
220
+ pendingRef={zoneReseed}
221
+ />
208
222
  <Ark.Content>
209
223
  <CalendarBody
210
224
  numOfMonths={numOfMonths}
@@ -19,9 +19,30 @@ const definition = defineChart({
19
19
  },
20
20
  })
21
21
 
22
+ const SERIES = [
23
+ { category: "A", series: "x", value: 4 },
24
+ { category: "A", series: "y", value: 2 },
25
+ { category: "B", series: "x", value: 7 },
26
+ { category: "B", series: "y", value: 3 },
27
+ ]
28
+
29
+ const multiSeries = defineChart({
30
+ marks: [barY(SERIES, { x: "category", y: "value", color: "series" })],
31
+ scales: {
32
+ x: { scale: () => scaleBand().padding(0.18) },
33
+ y: { scale: scaleLinear, nice: true },
34
+ },
35
+ })
36
+
22
37
  const root = (container: HTMLElement) =>
23
38
  container.querySelector('[data-part="root"]') as HTMLElement
24
39
 
40
+ /** The paint of every bar TanStack drew, in document order. */
41
+ const barFills = (container: HTMLElement) =>
42
+ [...container.querySelectorAll(".ts-chart__bar rect")].map(
43
+ (bar) => bar.getAttribute("fill") ?? "",
44
+ )
45
+
25
46
  describe("Chart", () => {
26
47
  it("mounts TanStack's chart, rendering a real svg", () => {
27
48
  const { container } = render(
@@ -42,12 +63,30 @@ describe("Chart", () => {
42
63
  expect(screen.getByTestId("revenue-chart")).toBe(root(document.body))
43
64
  })
44
65
 
45
- it("routes a single color through data-color and --ts-chart-1", () => {
66
+ it("routes a single color through data-color and its --chart-solid", () => {
46
67
  const { container } = render(
47
68
  <Chart definition={definition} ariaLabel="Sample chart" height={200} color="green" />,
48
69
  )
49
70
  expect(root(container).getAttribute("data-color")).toBe("green")
50
- expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--color-green-500)")
71
+ expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-solid)")
72
+ expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
73
+ })
74
+
75
+ it("resolves neutral through data-color too — there is no neutral scale to point at", () => {
76
+ const { container } = render(
77
+ <Chart definition={definition} ariaLabel="Sample chart" height={200} color="neutral" />,
78
+ )
79
+ expect(root(container).getAttribute("data-color")).toBe("neutral")
80
+ expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-solid)")
81
+ expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
82
+ })
83
+
84
+ it("treats a single-entry colors like color", () => {
85
+ const { container } = render(
86
+ <Chart definition={definition} ariaLabel="Sample chart" height={200} colors={["neutral"]} />,
87
+ )
88
+ expect(root(container).getAttribute("data-color")).toBe("neutral")
89
+ expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
51
90
  })
52
91
 
53
92
  it("sets one --ts-chart-N slot per entry in colors, in order", () => {
@@ -59,18 +98,79 @@ describe("Chart", () => {
59
98
  colors={["red", "blue"]}
60
99
  />,
61
100
  )
62
- expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--color-red-500)")
63
- expect(root(container).style.getPropertyValue("--ts-chart-2")).toBe("var(--color-blue-500)")
101
+ expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-red)")
102
+ expect(root(container).style.getPropertyValue("--ts-chart-2")).toBe("var(--chart-blue)")
64
103
  // A multi-entry palette doesn't collapse onto a single data-color.
65
104
  expect(root(container).getAttribute("data-color")).toBeNull()
66
105
  })
67
106
 
68
- it("sets neither data-color nor any palette var when color/colors are both omitted", () => {
107
+ it("resolves neutral inside a multi-entry colors to its chart fill", () => {
69
108
  const { container } = render(
70
- <Chart definition={definition} ariaLabel="Sample chart" height={200} />,
109
+ <Chart
110
+ definition={definition}
111
+ ariaLabel="Sample chart"
112
+ height={200}
113
+ colors={["neutral", "blue"]}
114
+ />,
115
+ )
116
+ expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-neutral)")
117
+ })
118
+
119
+ it("paints a single series with the inherited --chart-solid when color/colors are both omitted", () => {
120
+ const { container } = render(
121
+ <div data-color="green">
122
+ <Chart definition={definition} ariaLabel="Sample chart" height={200} />
123
+ </div>,
71
124
  )
125
+ // No data-color of its own, and no palette slot: --chart-solid comes from
126
+ // the ancestor's data-color through the cascade.
72
127
  expect(root(container).getAttribute("data-color")).toBeNull()
73
128
  expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("")
129
+ expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
130
+ })
131
+
132
+ it("keeps TanStack's palette slots for a multi-series chart with no color props", () => {
133
+ const { container } = render(
134
+ <div data-color="green">
135
+ <Chart definition={multiSeries} ariaLabel="Sample chart" height={200} />
136
+ </div>,
137
+ )
138
+ const fills = barFills(container)
139
+ expect(fills).toHaveLength(4)
140
+ expect(fills.some((fill) => fill.includes("--chart-solid"))).toBe(false)
141
+ expect(new Set(fills)).toEqual(
142
+ new Set(["var(--ts-chart-1, #2563eb)", "var(--ts-chart-2, #f97316)"]),
143
+ )
144
+ })
145
+
146
+ it("leaves a definition with its own color options untouched", () => {
147
+ const ownColor = defineChart({
148
+ marks: [barY(DATA, { x: "category", y: "value" })],
149
+ scales: {
150
+ x: { scale: () => scaleBand().padding(0.18) },
151
+ y: { scale: scaleLinear, nice: true },
152
+ },
153
+ color: { range: ["#ff00aa"] },
154
+ })
155
+ const { container } = render(
156
+ <Chart definition={ownColor} ariaLabel="Sample chart" height={200} />,
157
+ )
158
+ expect(barFills(container)).toEqual(["#ff00aa", "#ff00aa"])
159
+ })
160
+
161
+ it("keeps a multi-entry colors on the palette slots, even for a single series", () => {
162
+ const { container } = render(
163
+ <Chart
164
+ definition={definition}
165
+ ariaLabel="Sample chart"
166
+ height={200}
167
+ colors={["red", "blue"]}
168
+ />,
169
+ )
170
+ expect(barFills(container)).toEqual([
171
+ "var(--ts-chart-1, #2563eb)",
172
+ "var(--ts-chart-1, #2563eb)",
173
+ ])
74
174
  })
75
175
 
76
176
  it("routes through the renderer-accepting Chart (react/core) when a renderer is given", () => {
@@ -82,8 +182,15 @@ describe("Chart", () => {
82
182
  })
83
183
 
84
184
  describe("chartColors", () => {
85
- it("resolves the default CHART_PALETTE to var(--color-<name>-500) entries", () => {
86
- expect(chartColors()).toEqual(CHART_PALETTE.map((color) => `var(--color-${color}-500)`))
185
+ it("resolves the default CHART_PALETTE to var(--chart-<name>) entries", () => {
186
+ expect(chartColors()).toEqual(CHART_PALETTE.map((color) => `var(--chart-${color})`))
187
+ })
188
+
189
+ it("resolves neutral to its own chart fill, not a --color-neutral-500 that doesn't exist", () => {
190
+ expect(chartColors(["neutral", "brand"])).toEqual([
191
+ "var(--chart-neutral)",
192
+ "var(--chart-brand)",
193
+ ])
87
194
  })
88
195
 
89
196
  it("passes an unrecognized color through verbatim", () => {
@@ -1,6 +1,12 @@
1
1
  "use client"
2
2
 
3
- import type { ChartValue } from "@tanstack/charts"
3
+ import type {
4
+ ChartColorScale,
5
+ ChartKey,
6
+ ChartValue,
7
+ DomChartDefinition,
8
+ ResolvedColorScale,
9
+ } from "@tanstack/charts"
4
10
  import {
5
11
  Chart as TanStackChart,
6
12
  type ChartProps as TanStackChartProps,
@@ -9,7 +15,7 @@ import {
9
15
  Chart as TanStackRendererChart,
10
16
  type ChartProps as TanStackRendererChartProps,
11
17
  } from "@tanstack/charts/react/core"
12
- import type { CSSProperties } from "react"
18
+ import { type CSSProperties, useMemo } from "react"
13
19
  import { cn } from "../../lib/cn"
14
20
  import { COLORS, type Color } from "../../lib/colors"
15
21
  import { props } from "../../lib/props"
@@ -18,13 +24,80 @@ import type { WithTestId } from "../../lib/test-id"
18
24
  const KNOWN_COLORS: readonly string[] = COLORS
19
25
 
20
26
  /**
21
- * Resolves a kit `Color` token to its solid CSS value: `var(--color-<name>-500)`
22
- * for a known palette color — the same step `--c-solid` itself resolves to in
23
- * both light and dark (see `colors.css`; the "solid" slot doesn't shift with
24
- * the theme) — or the string verbatim for a custom color.
27
+ * Resolves a kit `Color` token to a literal CSS value for a palette slot:
28
+ * `var(--chart-<name>)` for a known palette color — the theme-aware chart
29
+ * fill `styles.css` maps per color (600 in light, the 500 solid in dark;
30
+ * `neutral` black/white) — or the string verbatim for a custom color. Only
31
+ * multi-entry palettes (`colors`, `chartColors`) go through here — anything
32
+ * with a single accent (`color`, or no color at all) resolves through
33
+ * `INHERITED_SOLID` instead, so it follows the nearest `data-color`.
25
34
  */
26
35
  const resolveChartColor = (color: Color): string =>
27
- KNOWN_COLORS.includes(color) ? `var(--color-${color}-500)` : color
36
+ KNOWN_COLORS.includes(color) ? `var(--chart-${color})` : color
37
+
38
+ /**
39
+ * The chart fill of whichever `data-color` is in scope at the chart root —
40
+ * the chart's own (`color`), an ancestor's, or the `:root` default
41
+ * (`neutral`). `styles.css` sets it on every `data-color` element from the
42
+ * same `--chart-<name>` map the palette slots read, falling back to that
43
+ * element's `--c-solid` for a custom color and in dark mode.
44
+ */
45
+ const INHERITED_SOLID = "var(--chart-solid)"
46
+
47
+ const isChartKey = (value: unknown): value is ChartKey =>
48
+ typeof value === "string" || typeof value === "number"
49
+
50
+ /**
51
+ * TanStack's own categorical color scale, unchanged, except for a chart with
52
+ * no color channel at all — a single series. TanStack paints that with its
53
+ * first palette slot, the same one a multi-series chart's first series gets,
54
+ * so no stylesheet can tell the two apart: this resolver is where they
55
+ * diverge. The single series gets `INHERITED_SOLID`; a chart that maps a
56
+ * field to `color` keeps the default ordinal mapping over `theme.palette`
57
+ * (TanStack's `--ts-chart-N` slots, i.e. `colors`), key for key.
58
+ */
59
+ const inheritedColorScale: ChartColorScale = {
60
+ id: "42ui-inherited-color",
61
+ resolve: ({ values, domain, range, theme }): ResolvedColorScale => {
62
+ const keys = [...new Set((domain ?? values).filter(isChartKey))]
63
+ if (!keys.length) {
64
+ return {
65
+ type: "ordinal",
66
+ kind: "categorical",
67
+ domain: [],
68
+ range: [INHERITED_SOLID],
69
+ map: () => INHERITED_SOLID,
70
+ }
71
+ }
72
+ const slots = range?.length ? range : theme.palette
73
+ return {
74
+ type: "ordinal",
75
+ kind: "categorical",
76
+ domain: keys,
77
+ range: slots,
78
+ map: (value) => {
79
+ if (value == null) return slots[0] ?? "currentColor"
80
+ let index = keys.indexOf(value)
81
+ if (index < 0) index = keys.push(value) - 1
82
+ return slots[index % slots.length] ?? "currentColor"
83
+ },
84
+ }
85
+ },
86
+ }
87
+
88
+ /**
89
+ * Routes `definition`'s color through `inheritedColorScale` — only when the
90
+ * definition leaves color entirely to TanStack's defaults (no `color`
91
+ * options, no `theme.palette`). A definition that configures either keeps
92
+ * its own resolution, and a responsive one (`defineChart(fn)`) is left
93
+ * alone, since its color options only exist once `fn` runs.
94
+ */
95
+ function withInheritedColor<TDatum, TXValue extends ChartValue, TYValue extends ChartValue>(
96
+ definition: DomChartDefinition<TDatum, TXValue, TYValue>,
97
+ ): DomChartDefinition<TDatum, TXValue, TYValue> {
98
+ if ("chart" in definition || definition.color || definition.theme?.palette) return definition
99
+ return { ...definition, color: { resolver: inheritedColorScale } }
100
+ }
28
101
 
29
102
  /**
30
103
  * Ordered categorical palette for multi-series charts, built from `COLORS`
@@ -36,8 +109,9 @@ const resolveChartColor = (color: Color): string =>
36
109
  * of this kit's own hues that clears every check in the dataviz skill's
37
110
  * `validate_palette.js` (lightness band, CVD Delta E, and normal-vision
38
111
  * separation, all-pairs, not just adjacent) without relying on a specific
39
- * order. Every other pairing among the remaining five hues fails outright at
40
- * the "solid" (500) step this palette resolves to — `red`/`orange` and
112
+ * order, as measured at the 500 step (the dark-mode fill; light mode reads
113
+ * one step darker, see `styles.css`). Every other pairing among the
114
+ * remaining five hues fails outright there — `red`/`orange` and
41
115
  * `teal`/`green` read as near-duplicates even to normal color vision, and
42
116
  * `purple`/`blue` and `cyan`/`pink` fail the colorblind-safety floor. Rather
43
117
  * than drop those five hues from a consumer's options entirely, they're
@@ -78,15 +152,17 @@ export type ChartProps<
78
152
  > = Omit<TanStackChartProps<TDatum, TXValue, TYValue>, "renderSvg"> &
79
153
  WithTestId & {
80
154
  /**
81
- * Single accent for a one-series chart: sets `data-color` and TanStack's
82
- * first categorical slot (`--ts-chart-1`) to this color. Ignored for the
83
- * palette slots when `colors` is also given (still sets `data-color`, if
84
- * `colors` isn't a multi-entry array).
155
+ * Single accent for a one-series chart: sets `data-color` on the root,
156
+ * and the series paints with that palette's chart fill — its 600 step in
157
+ * light mode, its `--c-solid` in dark (also mirrored into
158
+ * `--ts-chart-1`). Omitted, a one-series chart inherits the nearest
159
+ * ancestor's `data-color` instead, like every other colored component.
160
+ * Ignored for the palette slots when `colors` has several entries.
85
161
  */
86
162
  color?: Color
87
163
  /**
88
164
  * Ordered palette for a multi-series chart — see `CHART_PALETTE`/
89
- * `chartColors`. Sets `--ts-chart-1` through `--ts-chart-N`, one per
165
+ * `chartColors`. A single entry behaves exactly like `color`. Otherwise sets `--ts-chart-1` through `--ts-chart-N`, one per
90
166
  * entry, for TanStack's own default categorical color scale to pick up
91
167
  * with zero changes to how the chart's `definition` builds its scales.
92
168
  * Beyond `--ts-chart-6`, only a custom `scaleOrdinal().range(...)` (see
@@ -128,8 +204,12 @@ export type ChartProps<
128
204
  * - The DOM tooltip surface/text/shadow/border and its "active row"
129
205
  * highlight theme through `--ts-chart-tooltip-*` / `--ts-chart-tooltip-
130
206
  * active-row-*`, also set in `styles.css`.
131
- * - `color`/`colors` (above) theme the categorical series palette via
132
- * `--ts-chart-N`, TanStack's own default color-scale slots.
207
+ * - A one-series chart paints with `--chart-solid`, so it follows `color`
208
+ * or an inherited `data-color` (see `inheritedColorScale`); `colors`
209
+ * themes a multi-series palette via `--ts-chart-N`, TanStack's own
210
+ * default color-scale slots. Both read `styles.css`'s per-color chart
211
+ * fill: the 600 step in light mode, so a mark clears 3:1 against the
212
+ * page, and the unchanged solid in dark.
133
213
  *
134
214
  * Not routed through Ark's `ark.*` factory (no `asChild`): TanStack's
135
215
  * `<Chart>` owns its entire internal DOM/SVG tree end to end, so there's no
@@ -152,19 +232,28 @@ export function Chart<
152
232
  className,
153
233
  style,
154
234
  testId,
235
+ definition,
155
236
  renderer,
156
237
  renderSvg,
157
238
  onRender,
158
239
  ...rest
159
240
  }: ChartProps<TDatum, TXValue, TYValue>) {
160
- const palette = colors ?? (color ? [color] : undefined)
161
- const paletteStyle: CSSProperties | undefined = palette
162
- ? (Object.fromEntries(
163
- chartColors(palette).map((value, index) => [`--ts-chart-${index + 1}`, value]),
164
- ) as CSSProperties)
165
- : undefined
166
- const dataColor = color ?? (colors?.length === 1 ? colors[0] : undefined)
167
-
241
+ const multiPalette = colors && colors.length > 1 ? colors : undefined
242
+ const dataColor = multiPalette ? color : (color ?? colors?.[0])
243
+ // A multi-entry `colors` fills the slots in order; a single accent fills
244
+ // the first with its own `data-color`'s solid, for a multi-series chart
245
+ // given just `color`.
246
+ const slots = multiPalette ? chartColors(multiPalette) : dataColor ? [INHERITED_SOLID] : []
247
+ const paletteStyle = Object.fromEntries(
248
+ slots.map((value, index) => [`--ts-chart-${index + 1}`, value]),
249
+ ) as CSSProperties
250
+ // A multi-entry `colors` keeps TanStack's own resolution: a single-series
251
+ // chart given one still paints with `colors[0]`, as it always has.
252
+ const keepsOwnPalette = multiPalette !== undefined
253
+ const resolved = useMemo(
254
+ () => (keepsOwnPalette ? definition : withInheritedColor(definition)),
255
+ [definition, keepsOwnPalette],
256
+ )
168
257
  return (
169
258
  <div
170
259
  data-part="root"
@@ -181,11 +270,12 @@ export function Chart<
181
270
  // isn't worth it.
182
271
  <TanStackRendererChart
183
272
  renderer={renderer}
273
+ definition={resolved}
184
274
  onRender={onRender as TanStackRendererChartProps<TDatum, TXValue, TYValue>["onRender"]}
185
275
  {...rest}
186
276
  />
187
277
  ) : (
188
- <TanStackChart renderSvg={renderSvg} onRender={onRender} {...rest} />
278
+ <TanStackChart definition={resolved} renderSvg={renderSvg} onRender={onRender} {...rest} />
189
279
  )}
190
280
  </div>
191
281
  )