@senvenli/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/action/button-group.d.ts +26 -0
  4. package/dist/action/button-group.js +12 -0
  5. package/dist/action/button-group.js.map +1 -0
  6. package/dist/action/button.d.ts +42 -0
  7. package/dist/action/button.js +58 -0
  8. package/dist/action/button.js.map +1 -0
  9. package/dist/action/close-button.d.ts +12 -0
  10. package/dist/action/close-button.js +13 -0
  11. package/dist/action/close-button.js.map +1 -0
  12. package/dist/action/copy-button.d.ts +21 -0
  13. package/dist/action/copy-button.js +38 -0
  14. package/dist/action/copy-button.js.map +1 -0
  15. package/dist/action/fab.d.ts +29 -0
  16. package/dist/action/fab.js +57 -0
  17. package/dist/action/fab.js.map +1 -0
  18. package/dist/action/files.d.ts +70 -0
  19. package/dist/action/files.js +156 -0
  20. package/dist/action/files.js.map +1 -0
  21. package/dist/action/index.d.ts +23 -0
  22. package/dist/action/index.js +16 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/language-names.d.ts +19 -0
  25. package/dist/action/language-names.js +79 -0
  26. package/dist/action/language-names.js.map +1 -0
  27. package/dist/action/language-switcher.d.ts +57 -0
  28. package/dist/action/language-switcher.js +53 -0
  29. package/dist/action/language-switcher.js.map +1 -0
  30. package/dist/action/link-button.d.ts +57 -0
  31. package/dist/action/link-button.js +48 -0
  32. package/dist/action/link-button.js.map +1 -0
  33. package/dist/action/link.d.ts +24 -0
  34. package/dist/action/link.js +18 -0
  35. package/dist/action/link.js.map +1 -0
  36. package/dist/action/pressable.d.ts +40 -0
  37. package/dist/action/pressable.js +65 -0
  38. package/dist/action/pressable.js.map +1 -0
  39. package/dist/action/styles.d.ts +60 -0
  40. package/dist/action/styles.js +109 -0
  41. package/dist/action/styles.js.map +1 -0
  42. package/dist/action/theme-script.d.ts +12 -0
  43. package/dist/action/theme-script.js +23 -0
  44. package/dist/action/theme-script.js.map +1 -0
  45. package/dist/action/theme-switcher.d.ts +43 -0
  46. package/dist/action/theme-switcher.js +260 -0
  47. package/dist/action/theme-switcher.js.map +1 -0
  48. package/dist/action/theme-toggle.d.ts +43 -0
  49. package/dist/action/theme-toggle.js +259 -0
  50. package/dist/action/theme-toggle.js.map +1 -0
  51. package/dist/action/toggle.d.ts +44 -0
  52. package/dist/action/toggle.js +28 -0
  53. package/dist/action/toggle.js.map +1 -0
  54. package/dist/action/touch-target.d.ts +9 -0
  55. package/dist/action/touch-target.js +14 -0
  56. package/dist/action/touch-target.js.map +1 -0
  57. package/dist/charts/axis-width.d.ts +186 -0
  58. package/dist/charts/axis-width.js +1262 -0
  59. package/dist/charts/axis-width.js.map +1 -0
  60. package/dist/charts/bar-public.d.ts +16 -0
  61. package/dist/charts/bar-public.js +16 -0
  62. package/dist/charts/bar-public.js.map +1 -0
  63. package/dist/charts/chart-parts.d.ts +136 -0
  64. package/dist/charts/chart-parts.js +160 -0
  65. package/dist/charts/chart-parts.js.map +1 -0
  66. package/dist/charts/core-charts.d.ts +157 -0
  67. package/dist/charts/core-charts.js +505 -0
  68. package/dist/charts/core-charts.js.map +1 -0
  69. package/dist/charts/index.d.ts +12 -0
  70. package/dist/charts/index.js +8 -0
  71. package/dist/charts/index.js.map +1 -0
  72. package/dist/charts/list-charts.d.ts +124 -0
  73. package/dist/charts/list-charts.js +308 -0
  74. package/dist/charts/list-charts.js.map +1 -0
  75. package/dist/charts/more-charts.d.ts +138 -0
  76. package/dist/charts/more-charts.js +284 -0
  77. package/dist/charts/more-charts.js.map +1 -0
  78. package/dist/charts/report-charts.d.ts +138 -0
  79. package/dist/charts/report-charts.js +370 -0
  80. package/dist/charts/report-charts.js.map +1 -0
  81. package/dist/charts/value-tick.d.ts +178 -0
  82. package/dist/charts/value-tick.js +240 -0
  83. package/dist/charts/value-tick.js.map +1 -0
  84. package/dist/collection/data-table-url-hook.d.ts +34 -0
  85. package/dist/collection/data-table-url-hook.js +70 -0
  86. package/dist/collection/data-table-url-hook.js.map +1 -0
  87. package/dist/collection/data-table-url.d.ts +30 -0
  88. package/dist/collection/data-table-url.js +48 -0
  89. package/dist/collection/data-table-url.js.map +1 -0
  90. package/dist/collection/data-table.d.ts +112 -0
  91. package/dist/collection/data-table.js +188 -0
  92. package/dist/collection/data-table.js.map +1 -0
  93. package/dist/collection/grid-list-public.d.ts +18 -0
  94. package/dist/collection/grid-list-public.js +19 -0
  95. package/dist/collection/grid-list-public.js.map +1 -0
  96. package/dist/collection/grid-list.d.ts +73 -0
  97. package/dist/collection/grid-list.js +46 -0
  98. package/dist/collection/grid-list.js.map +1 -0
  99. package/dist/collection/index.d.ts +14 -0
  100. package/dist/collection/index.js +8 -0
  101. package/dist/collection/index.js.map +1 -0
  102. package/dist/collection/list.d.ts +61 -0
  103. package/dist/collection/list.js +38 -0
  104. package/dist/collection/list.js.map +1 -0
  105. package/dist/collection/selection-checkbox.d.ts +5 -0
  106. package/dist/collection/selection-checkbox.js +13 -0
  107. package/dist/collection/selection-checkbox.js.map +1 -0
  108. package/dist/collection/table.d.ts +91 -0
  109. package/dist/collection/table.js +183 -0
  110. package/dist/collection/table.js.map +1 -0
  111. package/dist/collection/tree.d.ts +31 -0
  112. package/dist/collection/tree.js +22 -0
  113. package/dist/collection/tree.js.map +1 -0
  114. package/dist/color/color.d.ts +87 -0
  115. package/dist/color/color.js +200 -0
  116. package/dist/color/color.js.map +1 -0
  117. package/dist/color/contrast.d.ts +34 -0
  118. package/dist/color/contrast.js +44 -0
  119. package/dist/color/contrast.js.map +1 -0
  120. package/dist/color/index.d.ts +4 -0
  121. package/dist/color/index.js +5 -0
  122. package/dist/color/index.js.map +1 -0
  123. package/dist/date/calendar.d.ts +71 -0
  124. package/dist/date/calendar.js +291 -0
  125. package/dist/date/calendar.js.map +1 -0
  126. package/dist/date/fields.d.ts +174 -0
  127. package/dist/date/fields.js +250 -0
  128. package/dist/date/fields.js.map +1 -0
  129. package/dist/date/index.d.ts +7 -0
  130. package/dist/date/index.js +6 -0
  131. package/dist/date/index.js.map +1 -0
  132. package/dist/date/month-grid.d.ts +31 -0
  133. package/dist/date/month-grid.js +115 -0
  134. package/dist/date/month-grid.js.map +1 -0
  135. package/dist/date/pickers.d.ts +118 -0
  136. package/dist/date/pickers.js +176 -0
  137. package/dist/date/pickers.js.map +1 -0
  138. package/dist/date/public.d.ts +25 -0
  139. package/dist/date/public.js +24 -0
  140. package/dist/date/public.js.map +1 -0
  141. package/dist/date/segments.d.ts +153 -0
  142. package/dist/date/segments.js +433 -0
  143. package/dist/date/segments.js.map +1 -0
  144. package/dist/defaults.d.ts +74 -0
  145. package/dist/defaults.js +100 -0
  146. package/dist/defaults.js.map +1 -0
  147. package/dist/density.d.ts +2 -0
  148. package/dist/density.js +2 -0
  149. package/dist/density.js.map +1 -0
  150. package/dist/display/avatar.d.ts +29 -0
  151. package/dist/display/avatar.js +71 -0
  152. package/dist/display/avatar.js.map +1 -0
  153. package/dist/display/badge.d.ts +65 -0
  154. package/dist/display/badge.js +99 -0
  155. package/dist/display/badge.js.map +1 -0
  156. package/dist/display/card.d.ts +72 -0
  157. package/dist/display/card.js +91 -0
  158. package/dist/display/card.js.map +1 -0
  159. package/dist/display/carousel.d.ts +47 -0
  160. package/dist/display/carousel.js +214 -0
  161. package/dist/display/carousel.js.map +1 -0
  162. package/dist/display/description-list.d.ts +25 -0
  163. package/dist/display/description-list.js +36 -0
  164. package/dist/display/description-list.js.map +1 -0
  165. package/dist/display/icon-aliases.d.ts +1 -0
  166. package/dist/display/icon-aliases.js +259 -0
  167. package/dist/display/icon-aliases.js.map +1 -0
  168. package/dist/display/icon-names.d.ts +4 -0
  169. package/dist/display/icon-names.js +2 -0
  170. package/dist/display/icon-names.js.map +1 -0
  171. package/dist/display/icon.d.ts +51 -0
  172. package/dist/display/icon.js +96 -0
  173. package/dist/display/icon.js.map +1 -0
  174. package/dist/display/image-crop.d.ts +106 -0
  175. package/dist/display/image-crop.js +117 -0
  176. package/dist/display/image-crop.js.map +1 -0
  177. package/dist/display/image-cropper.d.ts +68 -0
  178. package/dist/display/image-cropper.js +284 -0
  179. package/dist/display/image-cropper.js.map +1 -0
  180. package/dist/display/image-viewer.d.ts +54 -0
  181. package/dist/display/image-viewer.js +84 -0
  182. package/dist/display/image-viewer.js.map +1 -0
  183. package/dist/display/image.d.ts +26 -0
  184. package/dist/display/image.js +17 -0
  185. package/dist/display/image.js.map +1 -0
  186. package/dist/display/index.d.ts +29 -0
  187. package/dist/display/index.js +16 -0
  188. package/dist/display/index.js.map +1 -0
  189. package/dist/display/iso-chip.d.ts +19 -0
  190. package/dist/display/iso-chip.js +21 -0
  191. package/dist/display/iso-chip.js.map +1 -0
  192. package/dist/display/kbd.d.ts +11 -0
  193. package/dist/display/kbd.js +33 -0
  194. package/dist/display/kbd.js.map +1 -0
  195. package/dist/display/lozenge.d.ts +30 -0
  196. package/dist/display/lozenge.js +55 -0
  197. package/dist/display/lozenge.js.map +1 -0
  198. package/dist/display/scroll-area.d.ts +29 -0
  199. package/dist/display/scroll-area.js +95 -0
  200. package/dist/display/scroll-area.js.map +1 -0
  201. package/dist/display/separator.d.ts +13 -0
  202. package/dist/display/separator.js +24 -0
  203. package/dist/display/separator.js.map +1 -0
  204. package/dist/display/stat.d.ts +35 -0
  205. package/dist/display/stat.js +41 -0
  206. package/dist/display/stat.js.map +1 -0
  207. package/dist/display/timeline.d.ts +44 -0
  208. package/dist/display/timeline.js +111 -0
  209. package/dist/display/timeline.js.map +1 -0
  210. package/dist/display/typography.d.ts +37 -0
  211. package/dist/display/typography.js +53 -0
  212. package/dist/display/typography.js.map +1 -0
  213. package/dist/display/visually-hidden.d.ts +14 -0
  214. package/dist/display/visually-hidden.js +10 -0
  215. package/dist/display/visually-hidden.js.map +1 -0
  216. package/dist/feedback/banner.d.ts +46 -0
  217. package/dist/feedback/banner.js +157 -0
  218. package/dist/feedback/banner.js.map +1 -0
  219. package/dist/feedback/cooldown.d.ts +17 -0
  220. package/dist/feedback/cooldown.js +59 -0
  221. package/dist/feedback/cooldown.js.map +1 -0
  222. package/dist/feedback/empty-state.d.ts +35 -0
  223. package/dist/feedback/empty-state.js +39 -0
  224. package/dist/feedback/empty-state.js.map +1 -0
  225. package/dist/feedback/index.d.ts +12 -0
  226. package/dist/feedback/index.js +11 -0
  227. package/dist/feedback/index.js.map +1 -0
  228. package/dist/feedback/meter.d.ts +33 -0
  229. package/dist/feedback/meter.js +42 -0
  230. package/dist/feedback/meter.js.map +1 -0
  231. package/dist/feedback/motion.d.ts +9 -0
  232. package/dist/feedback/motion.js +57 -0
  233. package/dist/feedback/motion.js.map +1 -0
  234. package/dist/feedback/progress.d.ts +39 -0
  235. package/dist/feedback/progress.js +68 -0
  236. package/dist/feedback/progress.js.map +1 -0
  237. package/dist/feedback/skeleton.d.ts +48 -0
  238. package/dist/feedback/skeleton.js +61 -0
  239. package/dist/feedback/skeleton.js.map +1 -0
  240. package/dist/feedback/spinner.d.ts +19 -0
  241. package/dist/feedback/spinner.js +29 -0
  242. package/dist/feedback/spinner.js.map +1 -0
  243. package/dist/feedback/status-dot.d.ts +23 -0
  244. package/dist/feedback/status-dot.js +37 -0
  245. package/dist/feedback/status-dot.js.map +1 -0
  246. package/dist/form/countries.d.ts +34 -0
  247. package/dist/form/countries.js +273 -0
  248. package/dist/form/countries.js.map +1 -0
  249. package/dist/form/data-attributes.d.ts +11 -0
  250. package/dist/form/data-attributes.js +22 -0
  251. package/dist/form/data-attributes.js.map +1 -0
  252. package/dist/form/field-parts.d.ts +113 -0
  253. package/dist/form/field-parts.js +178 -0
  254. package/dist/form/field-parts.js.map +1 -0
  255. package/dist/form/field.d.ts +36 -0
  256. package/dist/form/field.js +65 -0
  257. package/dist/form/field.js.map +1 -0
  258. package/dist/form/files.d.ts +70 -0
  259. package/dist/form/files.js +156 -0
  260. package/dist/form/files.js.map +1 -0
  261. package/dist/form/form.d.ts +40 -0
  262. package/dist/form/form.js +74 -0
  263. package/dist/form/form.js.map +1 -0
  264. package/dist/form/image-crop.d.ts +106 -0
  265. package/dist/form/image-crop.js +117 -0
  266. package/dist/form/image-crop.js.map +1 -0
  267. package/dist/form/image-cropper.d.ts +68 -0
  268. package/dist/form/image-cropper.js +284 -0
  269. package/dist/form/image-cropper.js.map +1 -0
  270. package/dist/form/index.d.ts +24 -0
  271. package/dist/form/index.js +15 -0
  272. package/dist/form/index.js.map +1 -0
  273. package/dist/form/input-group.d.ts +63 -0
  274. package/dist/form/input-group.js +63 -0
  275. package/dist/form/input-group.js.map +1 -0
  276. package/dist/form/input-otp.d.ts +35 -0
  277. package/dist/form/input-otp.js +83 -0
  278. package/dist/form/input-otp.js.map +1 -0
  279. package/dist/form/input.d.ts +36 -0
  280. package/dist/form/input.js +41 -0
  281. package/dist/form/input.js.map +1 -0
  282. package/dist/form/number-field.d.ts +84 -0
  283. package/dist/form/number-field.js +81 -0
  284. package/dist/form/number-field.js.map +1 -0
  285. package/dist/form/otp-field.d.ts +37 -0
  286. package/dist/form/otp-field.js +116 -0
  287. package/dist/form/otp-field.js.map +1 -0
  288. package/dist/form/password-field.d.ts +61 -0
  289. package/dist/form/password-field.js +61 -0
  290. package/dist/form/password-field.js.map +1 -0
  291. package/dist/form/phone-field.d.ts +104 -0
  292. package/dist/form/phone-field.js +275 -0
  293. package/dist/form/phone-field.js.map +1 -0
  294. package/dist/form/phone-paste.d.ts +24 -0
  295. package/dist/form/phone-paste.js +40 -0
  296. package/dist/form/phone-paste.js.map +1 -0
  297. package/dist/form/phone.d.ts +159 -0
  298. package/dist/form/phone.js +309 -0
  299. package/dist/form/phone.js.map +1 -0
  300. package/dist/form/search-field.d.ts +29 -0
  301. package/dist/form/search-field.js +23 -0
  302. package/dist/form/search-field.js.map +1 -0
  303. package/dist/form/styles.d.ts +31 -0
  304. package/dist/form/styles.js +43 -0
  305. package/dist/form/styles.js.map +1 -0
  306. package/dist/form/text-area.d.ts +70 -0
  307. package/dist/form/text-area.js +93 -0
  308. package/dist/form/text-area.js.map +1 -0
  309. package/dist/form/text-field.d.ts +131 -0
  310. package/dist/form/text-field.js +59 -0
  311. package/dist/form/text-field.js.map +1 -0
  312. package/dist/form/validation.d.ts +145 -0
  313. package/dist/form/validation.js +136 -0
  314. package/dist/form/validation.js.map +1 -0
  315. package/dist/i18n.d.ts +438 -0
  316. package/dist/i18n.js +948 -0
  317. package/dist/i18n.js.map +1 -0
  318. package/dist/index.d.ts +9 -0
  319. package/dist/index.js +7 -0
  320. package/dist/index.js.map +1 -0
  321. package/dist/intl-locale.d.ts +30 -0
  322. package/dist/intl-locale.js +83 -0
  323. package/dist/intl-locale.js.map +1 -0
  324. package/dist/layers.d.ts +32 -0
  325. package/dist/layers.js +33 -0
  326. package/dist/layers.js.map +1 -0
  327. package/dist/layout/auth-form-layout.d.ts +71 -0
  328. package/dist/layout/auth-form-layout.js +61 -0
  329. package/dist/layout/auth-form-layout.js.map +1 -0
  330. package/dist/layout/auth-layout.d.ts +59 -0
  331. package/dist/layout/auth-layout.js +26 -0
  332. package/dist/layout/auth-layout.js.map +1 -0
  333. package/dist/layout/box.d.ts +26 -0
  334. package/dist/layout/box.js +16 -0
  335. package/dist/layout/box.js.map +1 -0
  336. package/dist/layout/grid.d.ts +27 -0
  337. package/dist/layout/grid.js +26 -0
  338. package/dist/layout/grid.js.map +1 -0
  339. package/dist/layout/index.d.ts +16 -0
  340. package/dist/layout/index.js +12 -0
  341. package/dist/layout/index.js.map +1 -0
  342. package/dist/layout/pressable.d.ts +40 -0
  343. package/dist/layout/pressable.js +65 -0
  344. package/dist/layout/pressable.js.map +1 -0
  345. package/dist/layout/reset-sent-card.d.ts +39 -0
  346. package/dist/layout/reset-sent-card.js +22 -0
  347. package/dist/layout/reset-sent-card.js.map +1 -0
  348. package/dist/layout/scroll-area.d.ts +29 -0
  349. package/dist/layout/scroll-area.js +95 -0
  350. package/dist/layout/scroll-area.js.map +1 -0
  351. package/dist/layout/section.d.ts +41 -0
  352. package/dist/layout/section.js +22 -0
  353. package/dist/layout/section.js.map +1 -0
  354. package/dist/layout/split.d.ts +50 -0
  355. package/dist/layout/split.js +35 -0
  356. package/dist/layout/split.js.map +1 -0
  357. package/dist/layout/stack.d.ts +44 -0
  358. package/dist/layout/stack.js +36 -0
  359. package/dist/layout/stack.js.map +1 -0
  360. package/dist/layout/tokens.d.ts +33 -0
  361. package/dist/layout/tokens.js +85 -0
  362. package/dist/layout/tokens.js.map +1 -0
  363. package/dist/layout/toolbar.d.ts +37 -0
  364. package/dist/layout/toolbar.js +334 -0
  365. package/dist/layout/toolbar.js.map +1 -0
  366. package/dist/navigate-context.d.ts +12 -0
  367. package/dist/navigate-context.js +13 -0
  368. package/dist/navigate-context.js.map +1 -0
  369. package/dist/navigation/accordion.d.ts +40 -0
  370. package/dist/navigation/accordion.js +33 -0
  371. package/dist/navigation/accordion.js.map +1 -0
  372. package/dist/navigation/bottom-nav.d.ts +29 -0
  373. package/dist/navigation/bottom-nav.js +48 -0
  374. package/dist/navigation/bottom-nav.js.map +1 -0
  375. package/dist/navigation/brand-link-context.d.ts +8 -0
  376. package/dist/navigation/brand-link-context.js +9 -0
  377. package/dist/navigation/brand-link-context.js.map +1 -0
  378. package/dist/navigation/breadcrumbs.d.ts +36 -0
  379. package/dist/navigation/breadcrumbs.js +51 -0
  380. package/dist/navigation/breadcrumbs.js.map +1 -0
  381. package/dist/navigation/dock.d.ts +27 -0
  382. package/dist/navigation/dock.js +47 -0
  383. package/dist/navigation/dock.js.map +1 -0
  384. package/dist/navigation/footer.d.ts +43 -0
  385. package/dist/navigation/footer.js +43 -0
  386. package/dist/navigation/footer.js.map +1 -0
  387. package/dist/navigation/index.d.ts +22 -0
  388. package/dist/navigation/index.js +17 -0
  389. package/dist/navigation/index.js.map +1 -0
  390. package/dist/navigation/language-names.d.ts +19 -0
  391. package/dist/navigation/language-names.js +79 -0
  392. package/dist/navigation/language-names.js.map +1 -0
  393. package/dist/navigation/language-switcher.d.ts +55 -0
  394. package/dist/navigation/language-switcher.js +53 -0
  395. package/dist/navigation/language-switcher.js.map +1 -0
  396. package/dist/navigation/nav-panel.d.ts +18 -0
  397. package/dist/navigation/nav-panel.js +51 -0
  398. package/dist/navigation/nav-panel.js.map +1 -0
  399. package/dist/navigation/navbar.d.ts +73 -0
  400. package/dist/navigation/navbar.js +64 -0
  401. package/dist/navigation/navbar.js.map +1 -0
  402. package/dist/navigation/page-header.d.ts +37 -0
  403. package/dist/navigation/page-header.js +50 -0
  404. package/dist/navigation/page-header.js.map +1 -0
  405. package/dist/navigation/pagination.d.ts +25 -0
  406. package/dist/navigation/pagination.js +51 -0
  407. package/dist/navigation/pagination.js.map +1 -0
  408. package/dist/navigation/panel-header.d.ts +37 -0
  409. package/dist/navigation/panel-header.js +50 -0
  410. package/dist/navigation/panel-header.js.map +1 -0
  411. package/dist/navigation/sidebar-script.d.ts +12 -0
  412. package/dist/navigation/sidebar-script.js +20 -0
  413. package/dist/navigation/sidebar-script.js.map +1 -0
  414. package/dist/navigation/sidebar.d.ts +149 -0
  415. package/dist/navigation/sidebar.js +332 -0
  416. package/dist/navigation/sidebar.js.map +1 -0
  417. package/dist/navigation/skip-link.d.ts +12 -0
  418. package/dist/navigation/skip-link.js +30 -0
  419. package/dist/navigation/skip-link.js.map +1 -0
  420. package/dist/navigation/stepper.d.ts +50 -0
  421. package/dist/navigation/stepper.js +96 -0
  422. package/dist/navigation/stepper.js.map +1 -0
  423. package/dist/navigation/tabs.d.ts +84 -0
  424. package/dist/navigation/tabs.js +118 -0
  425. package/dist/navigation/tabs.js.map +1 -0
  426. package/dist/navigation/toolbar.d.ts +37 -0
  427. package/dist/navigation/toolbar.js +334 -0
  428. package/dist/navigation/toolbar.js.map +1 -0
  429. package/dist/overlay/alert-dialog.d.ts +63 -0
  430. package/dist/overlay/alert-dialog.js +76 -0
  431. package/dist/overlay/alert-dialog.js.map +1 -0
  432. package/dist/overlay/command-palette.d.ts +53 -0
  433. package/dist/overlay/command-palette.js +130 -0
  434. package/dist/overlay/command-palette.js.map +1 -0
  435. package/dist/overlay/command.d.ts +53 -0
  436. package/dist/overlay/command.js +129 -0
  437. package/dist/overlay/command.js.map +1 -0
  438. package/dist/overlay/context-menu.d.ts +29 -0
  439. package/dist/overlay/context-menu.js +58 -0
  440. package/dist/overlay/context-menu.js.map +1 -0
  441. package/dist/overlay/dialog.d.ts +162 -0
  442. package/dist/overlay/dialog.js +174 -0
  443. package/dist/overlay/dialog.js.map +1 -0
  444. package/dist/overlay/drawer.d.ts +41 -0
  445. package/dist/overlay/drawer.js +114 -0
  446. package/dist/overlay/drawer.js.map +1 -0
  447. package/dist/overlay/floating.d.ts +142 -0
  448. package/dist/overlay/floating.js +226 -0
  449. package/dist/overlay/floating.js.map +1 -0
  450. package/dist/overlay/hover-card.d.ts +19 -0
  451. package/dist/overlay/hover-card.js +31 -0
  452. package/dist/overlay/hover-card.js.map +1 -0
  453. package/dist/overlay/index.d.ts +18 -0
  454. package/dist/overlay/index.js +12 -0
  455. package/dist/overlay/index.js.map +1 -0
  456. package/dist/overlay/overlay-base.d.ts +105 -0
  457. package/dist/overlay/overlay-base.js +250 -0
  458. package/dist/overlay/overlay-base.js.map +1 -0
  459. package/dist/overlay/overlay.d.ts +299 -0
  460. package/dist/overlay/overlay.js +558 -0
  461. package/dist/overlay/overlay.js.map +1 -0
  462. package/dist/overlay/toast.d.ts +58 -0
  463. package/dist/overlay/toast.js +145 -0
  464. package/dist/overlay/toast.js.map +1 -0
  465. package/dist/provider.d.ts +26 -0
  466. package/dist/provider.js +30 -0
  467. package/dist/provider.js.map +1 -0
  468. package/dist/selection/autocomplete.d.ts +54 -0
  469. package/dist/selection/autocomplete.js +122 -0
  470. package/dist/selection/autocomplete.js.map +1 -0
  471. package/dist/selection/checkbox.d.ts +56 -0
  472. package/dist/selection/checkbox.js +49 -0
  473. package/dist/selection/checkbox.js.map +1 -0
  474. package/dist/selection/choice-size.d.ts +26 -0
  475. package/dist/selection/choice-size.js +50 -0
  476. package/dist/selection/choice-size.js.map +1 -0
  477. package/dist/selection/choice-text.d.ts +21 -0
  478. package/dist/selection/choice-text.js +33 -0
  479. package/dist/selection/choice-text.js.map +1 -0
  480. package/dist/selection/combobox.d.ts +173 -0
  481. package/dist/selection/combobox.js +410 -0
  482. package/dist/selection/combobox.js.map +1 -0
  483. package/dist/selection/index.d.ts +20 -0
  484. package/dist/selection/index.js +13 -0
  485. package/dist/selection/index.js.map +1 -0
  486. package/dist/selection/list-box.d.ts +30 -0
  487. package/dist/selection/list-box.js +16 -0
  488. package/dist/selection/list-box.js.map +1 -0
  489. package/dist/selection/listbox.d.ts +44 -0
  490. package/dist/selection/listbox.js +49 -0
  491. package/dist/selection/listbox.js.map +1 -0
  492. package/dist/selection/match.d.ts +20 -0
  493. package/dist/selection/match.js +57 -0
  494. package/dist/selection/match.js.map +1 -0
  495. package/dist/selection/multi-select.d.ts +72 -0
  496. package/dist/selection/multi-select.js +138 -0
  497. package/dist/selection/multi-select.js.map +1 -0
  498. package/dist/selection/radio-card.d.ts +31 -0
  499. package/dist/selection/radio-card.js +29 -0
  500. package/dist/selection/radio-card.js.map +1 -0
  501. package/dist/selection/radio.d.ts +72 -0
  502. package/dist/selection/radio.js +64 -0
  503. package/dist/selection/radio.js.map +1 -0
  504. package/dist/selection/select-public.d.ts +19 -0
  505. package/dist/selection/select-public.js +24 -0
  506. package/dist/selection/select-public.js.map +1 -0
  507. package/dist/selection/select.d.ts +72 -0
  508. package/dist/selection/select.js +69 -0
  509. package/dist/selection/select.js.map +1 -0
  510. package/dist/selection/slider.d.ts +16 -0
  511. package/dist/selection/slider.js +44 -0
  512. package/dist/selection/slider.js.map +1 -0
  513. package/dist/selection/styles.d.ts +26 -0
  514. package/dist/selection/styles.js +78 -0
  515. package/dist/selection/styles.js.map +1 -0
  516. package/dist/selection/switch.d.ts +24 -0
  517. package/dist/selection/switch.js +27 -0
  518. package/dist/selection/switch.js.map +1 -0
  519. package/dist/selection/tag-group.d.ts +38 -0
  520. package/dist/selection/tag-group.js +45 -0
  521. package/dist/selection/tag-group.js.map +1 -0
  522. package/dist/tone.d.ts +6 -0
  523. package/dist/tone.js +2 -0
  524. package/dist/tone.js.map +1 -0
  525. package/dist/utils.d.ts +9 -0
  526. package/dist/utils.js +42 -0
  527. package/dist/utils.js.map +1 -0
  528. package/manifest/component.full.schema.json +391 -0
  529. package/manifest/component.schema.json +279 -0
  530. package/manifests/accordion.json +299 -0
  531. package/manifests/alert-dialog.json +261 -0
  532. package/manifests/area-chart.json +338 -0
  533. package/manifests/autocomplete.json +299 -0
  534. package/manifests/avatar.json +253 -0
  535. package/manifests/badge.json +288 -0
  536. package/manifests/banner.json +185 -0
  537. package/manifests/bar-chart.json +454 -0
  538. package/manifests/bar-list.json +262 -0
  539. package/manifests/bottom-nav.json +139 -0
  540. package/manifests/box.json +3450 -0
  541. package/manifests/breadcrumbs.json +199 -0
  542. package/manifests/button-group.json +2294 -0
  543. package/manifests/button.json +1211 -0
  544. package/manifests/calendar-heatmap.json +218 -0
  545. package/manifests/calendar.json +299 -0
  546. package/manifests/card.json +308 -0
  547. package/manifests/carousel.json +263 -0
  548. package/manifests/chart-parts.json +309 -0
  549. package/manifests/checkbox.json +998 -0
  550. package/manifests/close-button.json +1000 -0
  551. package/manifests/color-field.json +276 -0
  552. package/manifests/color-picker.json +161 -0
  553. package/manifests/color-swatch-picker.json +220 -0
  554. package/manifests/color-swatch.json +140 -0
  555. package/manifests/combobox.json +581 -0
  556. package/manifests/command.json +275 -0
  557. package/manifests/composed-chart.json +287 -0
  558. package/manifests/context-menu.json +148 -0
  559. package/manifests/copy-button.json +192 -0
  560. package/manifests/data-table.json +334 -0
  561. package/manifests/date-field.json +302 -0
  562. package/manifests/date-picker.json +472 -0
  563. package/manifests/description-list.json +201 -0
  564. package/manifests/dialog.json +322 -0
  565. package/manifests/donut-chart.json +264 -0
  566. package/manifests/drawer.json +211 -0
  567. package/manifests/empty-state.json +185 -0
  568. package/manifests/fab.json +172 -0
  569. package/manifests/field.json +209 -0
  570. package/manifests/file-upload.json +791 -0
  571. package/manifests/form.json +829 -0
  572. package/manifests/funnel-chart.json +223 -0
  573. package/manifests/gauge-chart.json +252 -0
  574. package/manifests/grid-list.json +335 -0
  575. package/manifests/grid.json +3482 -0
  576. package/manifests/heading.json +183 -0
  577. package/manifests/heatmap.json +265 -0
  578. package/manifests/hover-card.json +172 -0
  579. package/manifests/icon.json +201 -0
  580. package/manifests/image-cropper.json +295 -0
  581. package/manifests/image-viewer.json +198 -0
  582. package/manifests/image.json +193 -0
  583. package/manifests/index.json +2035 -0
  584. package/manifests/input-group.json +3571 -0
  585. package/manifests/input.json +1557 -0
  586. package/manifests/kbd.json +98 -0
  587. package/manifests/language-switcher.json +274 -0
  588. package/manifests/line-chart.json +342 -0
  589. package/manifests/link.json +867 -0
  590. package/manifests/list-box.json +213 -0
  591. package/manifests/menu.json +453 -0
  592. package/manifests/meter.json +145 -0
  593. package/manifests/navbar.json +281 -0
  594. package/manifests/otp-field.json +1029 -0
  595. package/manifests/page-header.json +164 -0
  596. package/manifests/pagination.json +181 -0
  597. package/manifests/popover.json +205 -0
  598. package/manifests/pressable.json +367 -0
  599. package/manifests/progress.json +282 -0
  600. package/manifests/radar-chart.json +229 -0
  601. package/manifests/radial-chart.json +195 -0
  602. package/manifests/radio.json +975 -0
  603. package/manifests/scatter-chart.json +277 -0
  604. package/manifests/scroll-area.json +127 -0
  605. package/manifests/section.json +169 -0
  606. package/manifests/select.json +474 -0
  607. package/manifests/separator.json +119 -0
  608. package/manifests/sidebar.json +584 -0
  609. package/manifests/skeleton.json +235 -0
  610. package/manifests/skip-link.json +89 -0
  611. package/manifests/slider.json +706 -0
  612. package/manifests/sparkline.json +208 -0
  613. package/manifests/spinner.json +105 -0
  614. package/manifests/split.json +6618 -0
  615. package/manifests/stack.json +3541 -0
  616. package/manifests/stat.json +192 -0
  617. package/manifests/stepper.json +279 -0
  618. package/manifests/switch.json +205 -0
  619. package/manifests/table.json +375 -0
  620. package/manifests/tabs.json +438 -0
  621. package/manifests/tag-group.json +264 -0
  622. package/manifests/text-area.json +1136 -0
  623. package/manifests/text.json +244 -0
  624. package/manifests/theme-switcher.json +152 -0
  625. package/manifests/time-field.json +284 -0
  626. package/manifests/timeline.json +196 -0
  627. package/manifests/toast.json +87 -0
  628. package/manifests/toggle-button.json +1489 -0
  629. package/manifests/toolbar.json +145 -0
  630. package/manifests/tooltip.json +181 -0
  631. package/manifests/tracker.json +192 -0
  632. package/manifests/tree.json +245 -0
  633. package/manifests/visually-hidden.json +114 -0
  634. package/package.json +117 -3
  635. package/styles/base.css +56 -0
  636. package/styles/theme.css +154 -0
@@ -0,0 +1,505 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Area, Bar, CartesianGrid, ComposedChart as RechartsComposedChart, LabelList, Line, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis, usePlotArea, } from "recharts";
5
+ import { useLocale } from "react-aria-components";
6
+ import { chartCategoryLabel, chartNoDataLabel, chartPeriodLabel } from "../i18n.js";
7
+ import { CHART_NEUTRAL, ChartFrame, ChartLegend, ChartTooltip, chartColor, chartSeries, useChartAnimation, useChartDirection, useChartSeries, } from "./chart-parts.js";
8
+ import { chartNumber, formattedValues, labelText, textLines, textWidth, tickAxisWidth, tickOverhang, tickWrapWidth, valueAxisTicks, valueAxisWidth } from "./axis-width.js";
9
+ import { CategoryTick, LineSpan, NameTick, ValueTick, clippedLine, firstLineDy, isolatedLabel, placedLine } from "./value-tick.js";
10
+ import { EmptyState } from "../feedback/empty-state.js";
11
+ /**
12
+ * The size is in `style` as well, with its unit: Recharts measures a tick for wrapping in a hidden span that
13
+ * takes only the tick's `style` (assigned as is, so a bare 11 is dropped). Without it the span kept the page's
14
+ * body size (14–16px) and a tick that fits at 11px broke over two lines ("€" above "1.500.000").
15
+ */
16
+ const AXIS_TICK = { fill: "var(--ds-text-subtlest)", fontSize: 11, style: { fontVariantNumeric: "tabular-nums", fontSize: "11px" } };
17
+ /** A label's 11px (bar totals, reference lines), in `style` too: Recharts measures labels for wrapping the same way. */
18
+ const LABEL_SIZE = { fontSize: 11, style: { fontSize: "11px" } };
19
+ const plainNumber = (value) => String(value);
20
+ function useShell(props, seriesKeys, kinds, options = {}) {
21
+ const { comparison, indexKind = "period", dashes } = options;
22
+ const { data, index, labels, valueFormatter = plainNumber, indexFormatter = String } = props;
23
+ const { locale } = useLocale();
24
+ const series = useChartSeries();
25
+ const animate = useChartAnimation();
26
+ const direction = useChartDirection();
27
+ const label = (key) => labels?.[key] ?? key;
28
+ let colorIndex = 0;
29
+ const styles = Object.fromEntries(seriesKeys.map((key) => {
30
+ const isComparison = key === comparison;
31
+ const style = chartSeries(isComparison ? 0 : colorIndex, { kind: kinds[key], isComparison });
32
+ if (!isComparison)
33
+ colorIndex += 1;
34
+ return [key, dashes?.[key] ? { ...style, strokeDasharray: dashes[key] } : style];
35
+ }));
36
+ const legend = seriesKeys.map((key) => ({ key, label: label(key), kind: kinds[key], ...styles[key] }));
37
+ // A value as the chart plots it (a numeric string too, as Recharts draws it); "—" for a gap.
38
+ const shown = (row, key, format) => {
39
+ const value = chartNumber(row[key]);
40
+ return value === undefined ? "—" : format(value);
41
+ };
42
+ const columns = [
43
+ {
44
+ key: index,
45
+ header: props.indexLabel ?? (indexKind === "category" ? chartCategoryLabel(locale) : chartPeriodLabel(locale)),
46
+ isRowHeader: true,
47
+ render: (row) => indexFormatter(row[index]),
48
+ },
49
+ ...seriesKeys.map((key) => ({
50
+ key,
51
+ header: label(key),
52
+ align: "end",
53
+ render: (row) => shown(row, key, valueFormatter),
54
+ })),
55
+ ];
56
+ const tooltip = (_jsx(Tooltip, { cursor: { stroke: "var(--ds-border-bold)", strokeWidth: 1 }, isAnimationActive: animate, content: _jsx(PlottedTooltip, { valueFormatter: valueFormatter, labelFormatter: indexFormatter, labels: Object.fromEntries(seriesKeys.map((key) => [key, label(key)])) }) }));
57
+ return { series, animate, direction, styles, legend, columns, tooltip, label, valueFormatter, indexFormatter, locale, shown };
58
+ }
59
+ /**
60
+ * @internal The tooltip over a chart's own rows (Recharts hands it the raw values): a value shown as the chart
61
+ * plots it, a numeric string ("1450000") formatted as the number it is drawn at, as the data table shows it.
62
+ * Shared with RadarChart.
63
+ */
64
+ export function PlottedTooltip({ payload, ...props }) {
65
+ return _jsx(ChartTooltip, { ...props, payload: payload?.map((entry) => ({ ...entry, value: chartNumber(entry.value) ?? entry.value })) });
66
+ }
67
+ /** Title, period and the headline figure over the chart. */
68
+ /** @internal Shared with the other chart modules; not exported from the package. */
69
+ export function ChartHeader({ title, period, total }) {
70
+ return (_jsxs("div", { "data-slot": "chart-header", className: "flex flex-wrap items-end justify-between gap-x-ds-300 gap-y-ds-050", children: [_jsxs("div", { className: "flex min-w-0 flex-col items-start", children: [title && _jsx("bdi", { className: "text-body-strong text-ds-text", children: title }), period && _jsx("bdi", { className: "text-body-small text-ds-text-subtle", children: period })] }), total != null && (_jsx("bdi", { "data-slot": "chart-total", className: "text-metric-medium text-ds-text", children: total }))] }));
71
+ }
72
+ function Shell({ props, shell, legendPlacement, showLegend, onResize, children, }) {
73
+ const height = props.height ?? 240;
74
+ // Rows keyed by position: two rows may share a category value.
75
+ const positions = React.useMemo(() => new Map(props.data.map((row, position) => [row, position])), [props.data]);
76
+ return (_jsxs("section", { "data-slot": "chart", "aria-label": props.title ?? props["aria-label"], className: "flex min-w-0 flex-col gap-ds-200", children: [(props.title || props.period || props.total != null) && _jsx(ChartHeader, { title: props.title, period: props.period, total: props.total }), _jsx(ChartFrame, { height: height, isLoading: props.isLoading, emptyState: props.data.length === 0 ? props.emptyState ?? _jsx(EmptyState, { size: "small", icon: "chart-column", title: chartNoDataLabel(shell.locale) }) : null, legendPlacement: legendPlacement, legend: showLegend ? _jsx(ChartLegend, { items: shell.legend, hidden: shell.series.hidden, onToggle: shell.series.toggle }) : undefined, dataTable: { caption: [props.title ?? props["aria-label"], props.period].filter(Boolean).join(" · "), columns: shell.columns, rows: props.data, rowKey: (row) => positions.get(row) ?? String(row[props.index]) }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", onResize: onResize ? (width) => onResize(Math.round(width)) : undefined, children: children }) })] }));
77
+ }
78
+ const VALUE_TICKS = 4;
79
+ /** A value axis is never narrower than this, so short figures ("€ 54", "120") keep the axis they always had. */
80
+ const VALUE_AXIS_MIN = 48;
81
+ /**
82
+ * A value axis wide enough for its longest tick: the ticks Recharts draws for these values, formatted, at their
83
+ * estimated width (axis-width's textWidth) plus the 8px Recharts draws them in from the plot, 48–128px. A fixed
84
+ * 48px kept "€ 20.000" (48px at 11px) over two lines, since Recharts wraps a tick unless it is narrower than the
85
+ * axis. Ticks too long for the 128px axis are shown with compact figures in the chart's locale, and the axis is
86
+ * sized for those (axis-width's tickAxisWidth).
87
+ */
88
+ const valueWidth = (values, format, locale, allowDecimals = true) => valueAxisWidth(values, format, { tickCount: VALUE_TICKS, min: VALUE_AXIS_MIN, locale, allowDecimals });
89
+ /** The values of these keys in every row: what a `[0, "auto"]` value axis spans. */
90
+ function valuesOf(data, keys) {
91
+ return data.flatMap((row) => keys.map((key) => row[key]));
92
+ }
93
+ /**
94
+ * A value axis. Its ticks are the DS's ({@link ValueTick}: a figure with its sign and currency never parts, and
95
+ * a tick too long for its room shows its figures compact), given `ticks`, the values the axis draws, so an axis
96
+ * that needs a compact figure shows every tick compact. `beside` for an axis beside the plot, whether the chart
97
+ * sized it from its ticks or an app gave its width (AreaChart's `yAxisWidth`): each tick is given the room it has,
98
+ * the axis less the 8px inset (axis-width's tickWrapWidth), so a tick clipped to it never passes the axis's outer
99
+ * edge, the chart's (given the whole axis, the clip began 8px past it). A horizontal axis under the
100
+ * plot gives each tick Recharts' room.
101
+ */
102
+ const yAxisProps = (shell, width, beside, ticks, allowDecimals = true) => ({
103
+ orientation: shell.direction.valueAxis,
104
+ tickLine: false,
105
+ axisLine: false,
106
+ tick: _jsx(ValueTick, { ...AXIS_TICK, ...(beside ? { width: tickWrapWidth(width) } : {}), axisTicks: ticks }),
107
+ tickCount: VALUE_TICKS,
108
+ // The steps Recharts draws must be the ones the axis was sized and formatted for (`ticks`).
109
+ allowDecimals,
110
+ width,
111
+ tickFormatter: (value) => shell.valueFormatter(value),
112
+ });
113
+ /**
114
+ * How far a vertical value axis's top tick stands above the chart's 8px top margin (axis-width's tickOverhang): the
115
+ * room a top tick of several lines takes above its gridline, in the room {@link yAxisProps} gives it, so the chart's
116
+ * top margin holds it ("€ 1.500.000 net | this month" passed the svg's top by 4px). 0 for a one-line top tick.
117
+ */
118
+ const valueAxisOverhang = (format, width, ticks, locale) => {
119
+ if (!ticks || ticks.length === 0)
120
+ return 0;
121
+ const texts = ticks.map((value) => format(value));
122
+ // Recharts' ticks rise from the axis's start: the last is the top one.
123
+ return tickOverhang(texts.at(-1), tickWrapWidth(width), locale, texts, formattedValues(ticks, format));
124
+ };
125
+ /** The chart's top margin: 8px, and the room the top value tick takes past one line. */
126
+ const CHART_TOP = 8;
127
+ /** The time or category axis under the plot: Recharts' ticks, kept inside the chart ({@link CategoryTick}). */
128
+ const xAxisProps = (index, shell) => ({
129
+ dataKey: index,
130
+ reversed: shell.direction.reversed,
131
+ tickLine: false,
132
+ axisLine: { stroke: "var(--ds-border-bold)" },
133
+ tick: _jsx(CategoryTick, { ...AXIS_TICK }),
134
+ });
135
+ /**
136
+ * The chart's margins around a time axis whose periods sit on the plot's edges (AreaChart, LineChart, a
137
+ * ComposedChart without bars): Recharts centers the last period's tick on the plot's end, so half of it stands past
138
+ * the plot. The end side (the right, the left in RTL, where the axis is reversed) is at least half that tick's
139
+ * estimated width (axis-width's textWidth, as drawn in tabular figures), so "Sep" no longer passes the chart's edge;
140
+ * 4px as before where it is narrower. The start side is the value axis's, which holds the first tick's other half.
141
+ */
142
+ function edgeMargin(data, index, isRtl, overhang = 0) {
143
+ const last = data.at(-1);
144
+ const end = Math.max(CHART_EDGE, Math.ceil(textWidth(last === undefined ? "" : String(last[index] ?? ""), "tabular") / 2));
145
+ return { top: CHART_TOP + overhang, right: isRtl ? CHART_EDGE : end, bottom: 0, left: isRtl ? end : CHART_EDGE };
146
+ }
147
+ const GRID = _jsx(CartesianGrid, { vertical: false, stroke: "var(--ds-border)" });
148
+ /** The hover point: ringed in the surface color so it reads on the line. */
149
+ const ACTIVE_DOT = { r: 4, strokeWidth: 2, stroke: "var(--ds-surface-raised)" };
150
+ /**
151
+ * How one quantity changes over time, optionally against the previous period: a 2px `ds-chart-1` line
152
+ * over a 16% fill, the comparison dashed in `ds-chart-neutral` without fill. The value axis starts at
153
+ * zero; a vertical guide and a ringed point follow the pointer and the arrow keys.
154
+ */
155
+ export function AreaChart(props) {
156
+ const { data, index, categories, comparison, yAxisWidth, onValueChange, allowDecimals = true } = props;
157
+ const keys = comparison ? [...categories, comparison] : [...categories];
158
+ const shell = useShell(props, keys, Object.fromEntries(keys.map((key) => [key, key === comparison ? "line" : "area"])), {
159
+ comparison,
160
+ dashes: comparison ? { [comparison]: "6 4" } : undefined,
161
+ });
162
+ const values = valuesOf(data, keys.filter((key) => !shell.series.isHidden(key)));
163
+ const axisWidth = yAxisWidth ?? valueWidth(values, shell.valueFormatter, shell.locale, allowDecimals);
164
+ const ticks = valueAxisTicks(values, VALUE_TICKS, allowDecimals);
165
+ return (_jsx(Shell, { props: props, shell: shell, showLegend: keys.length > 1, children: _jsxs(RechartsComposedChart, { data: data, accessibilityLayer: true,
166
+ // Recharts 3 reports the active index as a string.
167
+ onClick: (state) => {
168
+ const position = state?.activeIndex == null ? NaN : Number(state.activeIndex);
169
+ onValueChange?.(Number.isInteger(position) ? (data[position] ?? null) : null);
170
+ }, margin: edgeMargin(data, index, shell.direction.isRtl, valueAxisOverhang(shell.valueFormatter, axisWidth, ticks, shell.locale)), children: [GRID, _jsx(XAxis, { ...xAxisProps(index, shell) }), _jsx(YAxis, { ...yAxisProps(shell, axisWidth, true, ticks, allowDecimals), domain: [0, "auto"] }), categories
171
+ .filter((key) => !shell.series.isHidden(key))
172
+ .map((key) => (_jsx(Area, { dataKey: key, name: key, type: "monotone", stroke: shell.styles[key].color, strokeWidth: 2, fill: shell.styles[key].color, fillOpacity: 0.16, activeDot: ACTIVE_DOT, isAnimationActive: shell.animate }, key))), comparison && !shell.series.isHidden(comparison) && (_jsx(Line, { dataKey: comparison, name: comparison, type: "monotone", stroke: CHART_NEUTRAL, strokeWidth: 2, strokeDasharray: "6 4", dot: false, activeDot: ACTIVE_DOT, isAnimationActive: shell.animate })), shell.tooltip] }) }));
173
+ }
174
+ /**
175
+ * A few series over time where the shape matters: 2px lines with round joins (dashed after the second,
176
+ * so they part by pattern as well as hue), optional reference lines, and the legend below with line keys.
177
+ * Up to five lines; more needs filtering, not more colors.
178
+ */
179
+ export function LineChart(props) {
180
+ const { data, index, categories, referenceLines, connectNulls, allowDecimals = true } = props;
181
+ const shell = useShell(props, categories, Object.fromEntries(categories.map((key) => [key, "line"])));
182
+ useOnce(categories.length > 5, "LineChart: at most five lines; filter (pick regions) instead of adding colors.");
183
+ const values = valuesOf(data, categories.filter((key) => !shell.series.isHidden(key)));
184
+ const axisWidth = valueWidth(values, shell.valueFormatter, shell.locale, allowDecimals);
185
+ const ticks = valueAxisTicks(values, VALUE_TICKS, allowDecimals);
186
+ return (_jsx(Shell, { props: props, shell: shell, showLegend: true, legendPlacement: "bottom", children: _jsxs(RechartsComposedChart, { data: data, accessibilityLayer: true, margin: edgeMargin(data, index, shell.direction.isRtl, valueAxisOverhang(shell.valueFormatter, axisWidth, ticks, shell.locale)), children: [GRID, _jsx(XAxis, { ...xAxisProps(index, shell) }), _jsx(YAxis, { ...yAxisProps(shell, axisWidth, true, ticks, allowDecimals) }), referenceLines?.map((line) => (_jsx(ReferenceLine, { y: line.value, stroke: "var(--ds-border-bold)", strokeDasharray: "4 4",
187
+ // At the line's end, just above it.
188
+ label: { value: line.label, position: shell.direction.isRtl ? "insideBottomLeft" : "insideBottomRight", fill: "var(--ds-text-subtle)", ...LABEL_SIZE, ...isolatedLabel(line.label, shell.direction.isRtl ? "insideBottomLeft" : "insideBottomRight") } }, line.label))), categories
189
+ .filter((key) => !shell.series.isHidden(key))
190
+ .map((key) => (_jsx(Line, { dataKey: key, name: key, type: "monotone", stroke: shell.styles[key].color, strokeDasharray: shell.styles[key].strokeDasharray, strokeWidth: 2, strokeLinejoin: "round", strokeLinecap: "round", dot: false, activeDot: ACTIVE_DOT, connectNulls: connectNulls, isAnimationActive: shell.animate }, key))), shell.tooltip] }) }));
191
+ }
192
+ /* ── BarChart ────────────────────────────────────────────────────────────── */
193
+ /**
194
+ * The room for a horizontal bar's total, from its formatted text: its {@link textWidth} (each character at the
195
+ * widest Geist or a fallback draws it at 11px: a figure 7px, "." and the space 3.5px, "€" 8px; format and bidi
196
+ * marks, as the U+200F ar-EG puts before a currency figure, take none), plus the label's 5px gap. An estimate,
197
+ * not a measurement, yet never under the drawn total: it is the same on the server, in tests and before the web
198
+ * font loads, so the margin never moves between the first render and the next. Never under 48px (the room every
199
+ * total had) and never over 96px, so a 390px phone keeps about 150px of bars. A longer total is not shortened:
200
+ * the bar-end label ({@link BarEndLabel}) wraps it between its words within the room it has, in both directions,
201
+ * or keeps a unit too wide for it on one line ending at the room's edge, so no figure is cut at the chart's edge. The tooltip and the data table have
202
+ * the whole figure.
203
+ */
204
+ const BAR_LABEL_GAP = 5;
205
+ const BAR_END_MIN = 48;
206
+ const BAR_END_MAX = 96;
207
+ /** How far a label that ends at its room's edge (the chart's edge, or the plot's start) stands in from it. */
208
+ const BAR_LABEL_INSET = 2;
209
+ /** The category names' column beside horizontal bars. */
210
+ const CATEGORY_AXIS = 112;
211
+ /** The chart's 4px edge on the side without totals. */
212
+ const CHART_EDGE = 4;
213
+ /** @internal A bar-end label's estimated width in px, as {@link barLabelRoom} counts it (no gap). */
214
+ export function barLabelWidth(text) {
215
+ return textWidth(text);
216
+ }
217
+ /** @internal The room for the widest of these bar-end totals, in px; 0 when there are none. */
218
+ export function barLabelRoom(texts) {
219
+ if (texts.length === 0)
220
+ return 0;
221
+ const width = Math.max(...texts.map(barLabelWidth));
222
+ return Math.min(BAR_END_MAX, Math.max(BAR_END_MIN, width + BAR_LABEL_GAP));
223
+ }
224
+ /**
225
+ * @internal A bar-end label's lines for the room it has: whole when it fits, otherwise broken between its units
226
+ * (axis-width's textLines and textUnits, the value ticks' rule too: only between two words with letters or after a
227
+ * separator ending a word, "12 orders, | 3 canceled", never beside a figure, so a figure keeps its sign, currency,
228
+ * unit and magnitude words), each line as long as fits, by the same estimate as the room. When a unit is wider
229
+ * than the room the label stays one line, which ends at the room's edge.
230
+ */
231
+ export function barLabelLines(text, room) {
232
+ return textLines(text, room);
233
+ }
234
+ /** A Cartesian box (a bar, the chart) as Recharts hands it to a label; a polar one has no `width`. */
235
+ const cartesian = (box) => (box && "width" in box ? { x: box.x ?? 0, y: box.y ?? 0, width: box.width ?? 0, height: box.height ?? 0 } : undefined);
236
+ /**
237
+ * @internal The total at a horizontal bar's end, in place of Recharts' own label: Recharts sized a
238
+ * label that runs left (every bar in RTL, a negative one in LTR) by the room on its right, so in RTL a total
239
+ * wider than its room stayed on one line and was cut at the chart's edge, and a negative bar's total ran over
240
+ * the category names. This one stands 5px past the end the bar runs to, as Recharts' did, and is sized by the
241
+ * room on that side:
242
+ * - running forward (to the end room): up to the chart's edge;
243
+ * - running back (a negative value): up to the plot's start, never over the category names; the value axis
244
+ * starts that much later where the chart's width allows it (see BarChart).
245
+ * A label wider than that wraps between its units ({@link barLabelLines}: between words with letters, and after a
246
+ * "," or "/" between figures); one that still does not fit (a unit wider than the room, kept on one line) ends 2px
247
+ * short of the room's edge (the chart's edge, or the plot's start), over its own bar's tip, and reaches back no
248
+ * further than 2px short of the plot's start on the category names' side (the chart's edge on the other): never
249
+ * over the names. A unit wider than even that is shortened by the value ticks' own chain
250
+ * (axis-width's labelText: compact and exact figures, then scientific notation, then its qualifiers dropped), and
251
+ * what still passes is clipped there, each line's reading start in view (value-tick's clippedLine); such a label
252
+ * carries the whole total as its accessible name and hover title. `totals` are the chart's labels with the totals
253
+ * they were formatted from, which prove how the formatter writes its marks. The same estimate as the end room, so
254
+ * the server and the first render draw it the same. Drawn as Recharts draws a label (a `recharts-label` text,
255
+ * centered on the bar), each line in its own reading direction where the label is anchored (value-tick's LineSpan),
256
+ * so a total that reads from the left and fits looks as before, and one that reads from the right
257
+ * ("\u200f١٥٠٬٠٠٠ €") reads so.
258
+ */
259
+ export function BarEndLabel({ viewBox, parentViewBox, value, fill, fontSize, style, totals }) {
260
+ const direction = useChartDirection();
261
+ const plot = usePlotArea();
262
+ const { locale } = useLocale();
263
+ const clipId = `ds-bar-end-${React.useId().replace(/[^\w-]/g, "")}`;
264
+ const bar = cartesian(viewBox);
265
+ if (typeof value !== "string" || value === "" || !bar)
266
+ return null;
267
+ const { x, y, width, height } = bar;
268
+ // The side the bar runs to on screen, and the side the values grow to (left in RTL: the axis is reversed).
269
+ const runs = width < 0 ? -1 : 1;
270
+ const forward = direction.reversed ? -1 : 1;
271
+ const anchor = x + width + runs * BAR_LABEL_GAP;
272
+ const chart = cartesian(parentViewBox);
273
+ const chartWidth = chart?.width ?? 0;
274
+ const edge = runs > 0 ? chartWidth : 0;
275
+ const limit = runs === forward || !plot ? edge : runs > 0 ? plot.x + plot.width : plot.x;
276
+ const room = Math.max(0, (limit - anchor) * runs);
277
+ // Lines that still pass the room (a figure wider than it, by the estimate) end at the room's edge instead, 2px
278
+ // in from it so they never touch the chart's edge: anchored there on their far side, so the browser's own width
279
+ // places them, and a label narrower than its estimate covers no more of its bar than it must.
280
+ const flushAt = limit - runs * BAR_LABEL_INSET;
281
+ // Such a label runs back over the plot as far as `reach`: the plot's start where the category names stand (left in
282
+ // LTR, right in RTL), the chart's edge on the other side; never over the names.
283
+ const namesAhead = direction.isRtl ? runs < 0 : runs > 0;
284
+ const reach = (plot && namesAhead ? (runs > 0 ? plot.x : plot.x + plot.width) : runs > 0 ? 0 : chartWidth) + runs * BAR_LABEL_INSET;
285
+ const span = Math.max(0, (flushAt - reach) * runs);
286
+ const widest = (lines) => Math.max(...lines.map(barLabelWidth));
287
+ // Wider than all of that (a figure of many digits in a narrow chart): shortened by the value ticks' chain; what
288
+ // still passes `reach` is clipped there. Either way the whole total is its accessible name and hover title, and the
289
+ // data table and the tooltip have it.
290
+ const { lines, shortened } = labelText(value, room, span, locale, totals);
291
+ const flush = widest(lines) > room;
292
+ const clipped = flush && widest(lines) > span;
293
+ // A clipped label's lines are each drawn from the clip's edge where they start to read, in their own direction, so
294
+ // what stays in view is their reading start, the currency and figure a formatter writes first, never only their
295
+ // tail ("▯xxxx" of "€ 1.450.000xxxx", and of "\u200f١٥٠ ترليون €xxxx"); the value ticks clip the same way.
296
+ const clipStart = Math.min(reach, flushAt);
297
+ const toward = clipped ? 1 : flush ? -runs : runs;
298
+ const textAnchor = toward > 0 ? "start" : "end";
299
+ // Every line in its own direction (value-tick's LineSpan), where the label is anchored: its left edge at the bar's end
300
+ // when it runs right, its right edge when it runs left or ends at the room's edge.
301
+ const lineAt = (line) => (clipped ? clippedLine(line, clipStart, span, "proportional") : placedLine(line, flush ? flushAt : anchor, textAnchor));
302
+ const at = lineAt(lines[0] ?? "").x;
303
+ // Recharts' Text centers lines on the bar: the first line's dy is (n − 1) / 2 lines up, plus half a cap height.
304
+ const firstDy = firstLineDy(lines.length);
305
+ return (_jsxs("g", { children: [clipped && (_jsx("clipPath", { id: clipId, children: _jsx("rect", { x: clipStart, y: chart?.y ?? 0, width: span, height: chart?.height ?? 0 }) })), _jsxs("text", { x: at, y: y + height / 2, className: "recharts-text recharts-label", "data-slot": "chart-bar-end-label", "data-shortened": shortened || clipped || undefined, "aria-label": shortened || clipped ? value : undefined, clipPath: clipped ? `url(#${clipId})` : undefined, textAnchor: textAnchor, fill: fill, fontSize: fontSize, style: style, children: [(shortened || clipped) && _jsx("title", { children: value }), lines.map((line, index) => (_jsx(LineSpan, { ...lineAt(line), inherited: textAnchor, dy: index === 0 ? firstDy : "1em", children: line }, index)))] })] }));
306
+ }
307
+ /**
308
+ * A stack as Recharts draws it (`stackOffset` "none"): its parts in series order, each from where the last one
309
+ * ended, whatever their signs. A part counts as Recharts counts it (`Number(value)`: null is 0, `"1500000"` is
310
+ * 1,500,000); one that is not a number (NaN) is skipped, the next one starting where it would have. `ends` are
311
+ * the edges the parts reach (the value axis spans them); `last` the last part Recharts draws (one with a
312
+ * non-zero length), which carries the stack's total.
313
+ */
314
+ function walkStack(row, parts) {
315
+ let reached = 0;
316
+ const ends = [0];
317
+ let last;
318
+ for (const key of parts) {
319
+ const raw = row[key];
320
+ const value = raw === undefined || raw === null ? 0 : Number(raw);
321
+ const end = reached + value;
322
+ if (!Number.isFinite(end))
323
+ continue;
324
+ ends.push(end);
325
+ if (value !== 0)
326
+ last = { key, value };
327
+ reached = end;
328
+ }
329
+ return { total: reached, ends, last };
330
+ }
331
+ /** Every percent a 0–100% share axis can print: its ticks are shares rounded to whole percents. */
332
+ const PERCENT_STEPS = Array.from({ length: 101 }, (_, step) => step / 100);
333
+ /**
334
+ * Values across categories or periods: grouped, stacked (at most five parts) or percent, in columns or
335
+ * horizontal bars (labels at the start, totals at the bar end). Bars have a 2px corner radius and a 20%
336
+ * gap in the band; the current series is `ds-chart-1`, a comparison `ds-chart-neutral`.
337
+ */
338
+ export function BarChart(props) {
339
+ const { index, categories, type = "grouped", layout = "vertical", sortBy, referenceLines } = props;
340
+ // A comparison has no meaning on a share axis: percent bars leave it out.
341
+ const comparison = type === "percent" ? undefined : props.comparison;
342
+ useOnce(type === "percent" && props.comparison !== undefined, "BarChart: a comparison is left out of percent bars; show it in a grouped chart.");
343
+ const keys = comparison ? [...categories, comparison] : [...categories];
344
+ const shell = useShell(props, keys, Object.fromEntries(keys.map((key) => [key, "bar"])), { comparison, indexKind: "category" });
345
+ const horizontal = layout === "horizontal";
346
+ const stacked = type !== "grouped";
347
+ // The chart's measured width (horizontal bars only): none on the server and in the first render.
348
+ const [chartWidth, setChartWidth] = React.useState(null);
349
+ useOnce(stacked && categories.length > 5, "BarChart: a stack holds at most five parts; put the rest in \"Other\".");
350
+ // Totals count what is shown (visible series, never the comparison). The ranking counts every current
351
+ // series, so the bars keep their order while the legend hides and shows parts.
352
+ const sum = (row, of) => of.reduce((acc, key) => acc + (chartNumber(row[key]) ?? 0), 0);
353
+ const data = horizontal && (sortBy ?? "value") === "value" ? [...props.data].sort((a, b) => sum(b, categories) - sum(a, categories)) : [...props.data];
354
+ const percent = type === "percent";
355
+ // Decimal value steps unless whole ones are asked for; a share axis keeps its 0–100% steps.
356
+ const axisDecimals = percent || props.allowDecimals !== false;
357
+ const percentFormat = new Intl.NumberFormat(shell.locale, { style: "percent", maximumFractionDigits: 0 });
358
+ const formatter = percent ? (value) => percentFormat.format(value) : shell.valueFormatter;
359
+ const visible = keys.filter((key) => !shell.series.isHidden(key));
360
+ // The stack's parts: what is shown, never the comparison (it sits beside the stack).
361
+ const parts = visible.filter((key) => key !== comparison);
362
+ const stacks = new Map(stacked ? data.map((row) => [row, walkStack(row, parts)]) : []);
363
+ // The value axis spans what is drawn: each stack's edges as Recharts stacks it, a comparison on its own.
364
+ const spans = stacked
365
+ ? data.flatMap((row) => [...stacks.get(row).ends, ...valuesOf([row], visible.filter((key) => key === comparison))])
366
+ : valuesOf(data, visible);
367
+ /**
368
+ * The total a bar carries past its end, if any: a stack's total on the last part Recharts draws (a part left
369
+ * empty or at zero passes it on to the one before, so every stack with a part shows its total); a grouped bar's
370
+ * and a comparison's own value. Percent bars carry none, and Recharts draws no bar for a gap or a zero.
371
+ */
372
+ const endLabel = (row, key) => {
373
+ if (!horizontal || percent)
374
+ return undefined;
375
+ if (stacked && key !== comparison) {
376
+ const stack = stacks.get(row);
377
+ if (!stack?.last || stack.last.key !== key)
378
+ return undefined;
379
+ return { text: shell.valueFormatter(stack.total), forward: stack.last.value > 0, at: stack.total };
380
+ }
381
+ const value = chartNumber(row[key]);
382
+ if (value === undefined || value === 0)
383
+ return undefined;
384
+ return { text: shell.valueFormatter(value), forward: value > 0, at: value };
385
+ };
386
+ const labels = data.flatMap((row) => visible.map((key) => endLabel(row, key)).filter((label) => label !== undefined));
387
+ // Each total by its text: what proves how the formatter writes its marks (axis-width's labelText).
388
+ const labelValues = new Map(labels.map((label) => [label.text, label.at]));
389
+ // The totals drawn in the end room: a bar running forward from zero or past it. One that runs forward but ends
390
+ // below zero (a stack's negative total on a forward last part) stands inside the plot, and one that runs back
391
+ // stands at the start side, so neither takes end room.
392
+ const endTotals = labels.filter((label) => label.forward && label.at >= 0).map((label) => label.text);
393
+ // Horizontal bars put the values on the x axis, whose ticks have the plot's width (the 48px is unused there);
394
+ // percent bars span 0–100%, sized from every percent a tick can print.
395
+ const valueAxisWidth = horizontal ? VALUE_AXIS_MIN : percent ? tickAxisWidth(PERCENT_STEPS.map(formatter), VALUE_AXIS_MIN, 0, shell.locale, formattedValues(PERCENT_STEPS, formatter)) : valueWidth(spans, formatter, shell.locale, axisDecimals);
396
+ // A share axis's ticks are its percents, short in every locale.
397
+ const valueTicks = percent ? undefined : valueAxisTicks(spans, VALUE_TICKS, axisDecimals);
398
+ const valueAxis = yAxisProps({ ...shell, valueFormatter: formatter }, valueAxisWidth, !horizontal, valueTicks, axisDecimals);
399
+ // Columns: the top value tick's lines past one stand above the plot (horizontal bars have their values below).
400
+ const overhang = horizontal ? 0 : valueAxisOverhang(formatter, valueAxisWidth, valueTicks, shell.locale);
401
+ const domain = percent ? [0, 1] : [0, "auto"];
402
+ const categoryAxis = xAxisProps(index, shell);
403
+ // Room for the totals at the bar end: on the right, or on the left in RTL; never under 48px, so the value
404
+ // axis' last tick keeps the room it always had where no total is drawn (percent bars).
405
+ const endRoom = horizontal ? Math.max(BAR_END_MIN, barLabelRoom(endTotals)) : 4;
406
+ /*
407
+ * A total that runs back (a negative bar, or a stack whose last part runs back) from zero or below stands
408
+ * toward the category names. The value axis starts later by the room it needs, so it ends clear of them: per
409
+ * label, its width plus the gap (at most the end room's 96px; a longer one wraps) less the room the plot already
410
+ * leaves it before the axis' start, on Recharts' own ticks. Only once the chart's width is measured (none on the
411
+ * server or in the first render, so both draw the same), and never more than half the plot: the bars keep the
412
+ * other half however narrow the chart is, and a label that then has too little room wraps or ends at the plot's
413
+ * start.
414
+ */
415
+ const startPadding = (() => {
416
+ const back = labels.filter((label) => !label.forward && label.at <= 0);
417
+ if (!horizontal || chartWidth === null || back.length === 0)
418
+ return 0;
419
+ const plotWidth = chartWidth - CHART_EDGE - endRoom - CATEGORY_AXIS;
420
+ if (plotWidth <= 0)
421
+ return 0;
422
+ const ticks = valueAxisTicks(spans, VALUE_TICKS, axisDecimals);
423
+ const low = ticks[0];
424
+ const high = ticks.at(-1);
425
+ let needed = 0;
426
+ for (const label of back) {
427
+ const room = Math.min(BAR_END_MAX, barLabelWidth(label.text) + BAR_LABEL_GAP);
428
+ // How far along the axis the label's bar ends (0 at its start), and the padding that leaves it its room.
429
+ const along = high > low ? (label.at - low) / (high - low) : 0;
430
+ if (along < 1)
431
+ needed = Math.max(needed, (room - along * plotWidth) / (1 - along));
432
+ }
433
+ return Math.min(Math.ceil(needed), Math.floor(plotWidth / 2));
434
+ })();
435
+ return (_jsx(Shell, { props: { ...props, data }, shell: shell, showLegend: keys.length > 1, onResize: horizontal ? setChartWidth : undefined, children: _jsxs(RechartsComposedChart, { data: data, layout: horizontal ? "vertical" : "horizontal", stackOffset: percent ? "expand" : undefined, barCategoryGap: "20%", accessibilityLayer: true,
436
+ // Room for totals at the bar ends, and above the plot for a reference line's label.
437
+ margin: {
438
+ top: horizontal && referenceLines?.length ? 20 : CHART_TOP + overhang,
439
+ right: shell.direction.isRtl ? CHART_EDGE : endRoom,
440
+ bottom: 0,
441
+ left: shell.direction.isRtl ? endRoom : CHART_EDGE,
442
+ }, children: [_jsx(CartesianGrid, { vertical: horizontal, horizontal: !horizontal, stroke: "var(--ds-border)" }), horizontal ? (_jsxs(_Fragment, { children: [_jsx(XAxis, { type: "number", ...valueAxis, domain: domain, orientation: undefined, reversed: shell.direction.reversed, ...(startPadding > 0 ? { padding: shell.direction.reversed ? { right: startPadding } : { left: startPadding } } : {}) }), _jsx(YAxis, { type: "category", dataKey: index, orientation: shell.direction.valueAxis, tickLine: false, axisLine: false, width: CATEGORY_AXIS,
443
+ // Recharts' own tick (its Text, its wrapping), each name in its own reading direction (value-tick's NameTick).
444
+ tick: _jsx(NameTick, { ...AXIS_TICK, fill: "var(--ds-text-subtle)" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(XAxis, { ...categoryAxis }), _jsx(YAxis, { ...valueAxis, domain: domain })] })), referenceLines?.map((line) => (_jsx(ReferenceLine, { ...(horizontal ? { x: line.value } : { y: line.value }), stroke: "var(--ds-border-bold)", strokeDasharray: "4 4", label: { value: line.label, position: horizontal ? "top" : shell.direction.isRtl ? "insideBottomLeft" : "insideBottomRight", fill: "var(--ds-text-subtle)", ...LABEL_SIZE, ...isolatedLabel(line.label, horizontal ? "top" : shell.direction.isRtl ? "insideBottomLeft" : "insideBottomRight") } }, line.label))), visible.map((key) => (_jsx(Bar, { dataKey: key, name: key,
445
+ // A comparison (last year) sits beside the stack, never on it.
446
+ stackId: stacked && key !== comparison ? "stack" : undefined, fill: shell.styles[key].color, radius: 2, isAnimationActive: shell.animate, children: horizontal && !percent && (_jsx(LabelList, { valueAccessor: (entry) => (entry.payload ? endLabel(entry.payload, key)?.text : undefined), content: (label) => _jsx(BarEndLabel, { ...label, totals: labelValues }), fill: "var(--ds-text-subtle)", ...LABEL_SIZE })) }, key))), shell.tooltip] }) }));
447
+ }
448
+ /**
449
+ * Two related measures with different units on one time axis: volume as `ds-chart-2` bars on the left
450
+ * axis, a rate as a `ds-chart-1` line with ringed points on the right (mirrored in RTL). Only when their
451
+ * relation is the point; otherwise use two charts.
452
+ */
453
+ export function ComposedChart(props) {
454
+ const { data, index, bars, lines, valueFormatters } = props;
455
+ const keys = [...lines.map((line) => line.key), ...bars.map((bar) => bar.key)];
456
+ const axisOf = Object.fromEntries([...bars, ...lines].map((series) => [series.key, series.axis]));
457
+ const shell = useShell({ ...props, categories: keys, valueFormatter: valueFormatters.left }, keys, Object.fromEntries([...bars.map((bar) => [bar.key, "bar"]), ...lines.map((line) => [line.key, "line"])]));
458
+ // One sequence across both kinds, the line first (ds-chart-1) and the bar next (ds-chart-2), as the design
459
+ // draws them; further lines are dashed, so no two series share a hue and a pattern.
460
+ const order = Array.from({ length: Math.max(lines.length, bars.length) }, (_, position) => [lines[position]?.key, bars[position]?.key]).flat().filter(Boolean);
461
+ const color = (key) => chartColor(order.indexOf(key));
462
+ const lineDash = (key) => (lines.findIndex((line) => line.key === key) >= 1 ? "6 4" : undefined);
463
+ const format = (key) => (axisOf[key] === "right" ? valueFormatters.right : valueFormatters.left);
464
+ const columns = [
465
+ shell.columns[0],
466
+ ...keys.map((key) => ({ key, header: shell.label(key), align: "end", render: (row) => shell.shown(row, key, format(key)) })),
467
+ ];
468
+ const legend = shell.legend.map((item) => ({ ...item, color: color(item.key), strokeDasharray: item.kind === "line" ? lineDash(item.key) : undefined }));
469
+ const usesRight = [...bars, ...lines].some((series) => series.axis === "right");
470
+ const usesLeft = [...bars, ...lines].some((series) => series.axis === "left");
471
+ // Each value axis spans the series drawn on it, in its own format.
472
+ const axisValues = (axis) => valuesOf(data, keys.filter((key) => axisOf[key] === axis && !shell.series.isHidden(key)));
473
+ const axisWidth = (axis) => valueWidth(axisValues(axis), valueFormatters[axis], shell.locale);
474
+ const axisTicks = (axis) => valueAxisTicks(axisValues(axis), VALUE_TICKS);
475
+ const valueAxis = (axis) => yAxisProps({ ...shell, valueFormatter: valueFormatters[axis] }, axisWidth(axis), true, axisTicks(axis));
476
+ // The top margin holds either axis's top tick.
477
+ const overhang = Math.max(...["left", "right"].filter((axis) => (axis === "left" ? usesLeft : usesRight)).map((axis) => valueAxisOverhang(valueFormatters[axis], axisWidth(axis), axisTicks(axis), shell.locale)), 0);
478
+ const side = (axis) => (shell.direction.isRtl ? (axis === "left" ? "right" : "left") : axis);
479
+ return (_jsx(Shell, { props: props, shell: { ...shell, columns, legend }, showLegend: true, children: _jsxs(RechartsComposedChart, { data: data, accessibilityLayer: true, margin: usesRight || bars.some((bar) => !shell.series.isHidden(bar.key))
480
+ ? { top: CHART_TOP + overhang, right: CHART_EDGE, bottom: 0, left: CHART_EDGE }
481
+ : edgeMargin(data, index, shell.direction.isRtl, overhang), children: [GRID, _jsx(XAxis, { ...xAxisProps(index, shell) }), usesLeft && _jsx(YAxis, { yAxisId: "left", ...valueAxis("left"), orientation: side("left"), domain: [0, "auto"] }), usesRight && _jsx(YAxis, { yAxisId: "right", ...valueAxis("right"), orientation: side("right"), domain: [0, "auto"] }), bars
482
+ .filter((bar) => !shell.series.isHidden(bar.key))
483
+ .map((bar) => (_jsx(Bar, { yAxisId: bar.axis, dataKey: bar.key, name: bar.key, fill: color(bar.key), radius: 2, isAnimationActive: shell.animate }, bar.key))), lines
484
+ .filter((line) => !shell.series.isHidden(line.key))
485
+ .map((line) => (_jsx(Line, { yAxisId: line.axis, dataKey: line.key, name: line.key, type: "monotone", stroke: color(line.key), strokeDasharray: lineDash(line.key), strokeWidth: 2, dot: { r: 3, strokeWidth: 2, fill: "var(--ds-surface-raised)" }, activeDot: ACTIVE_DOT, isAnimationActive: shell.animate }, line.key))), _jsx(Tooltip, { cursor: { fill: "var(--ds-background-neutral)", opacity: 0.5 }, isAnimationActive: shell.animate, content: (tooltip) => (_jsx(ChartTooltip, { ...tooltip, labelFormatter: shell.indexFormatter, labels: Object.fromEntries(keys.map((key) => [key, shell.label(key)])), valueFormatter: (value) => String(value), payload: tooltip.payload?.map((entry) => {
486
+ const value = chartNumber(entry.value);
487
+ return {
488
+ dataKey: String(entry.dataKey),
489
+ name: String(entry.name ?? entry.dataKey),
490
+ color: entry.color,
491
+ value: value === undefined ? entry.value : format(String(entry.dataKey))(value),
492
+ };
493
+ }) })) })] }) }));
494
+ }
495
+ /** A dev warning, once per mount, when a design limit is passed. */
496
+ function useOnce(condition, message) {
497
+ const warned = React.useRef(false);
498
+ React.useEffect(() => {
499
+ if (!condition || warned.current)
500
+ return;
501
+ warned.current = true;
502
+ console.warn(message);
503
+ }, [condition, message]);
504
+ }
505
+ //# sourceMappingURL=core-charts.js.map