@cdx-ui/components 0.3.5 → 0.3.7

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 (416) hide show
  1. package/README.md +1 -1
  2. package/coverage.svg +1 -1
  3. package/docs/components/bar-chart/content.md +703 -0
  4. package/docs/components/content.md +10 -1
  5. package/docs/components/country-flag/content.md +232 -0
  6. package/docs/components/data-grid/content.md +3 -1
  7. package/docs/components/icon/content.md +1 -1
  8. package/docs/components/input/content.md +1 -0
  9. package/docs/components/line-chart/content.md +567 -0
  10. package/docs/components/pie-chart/content.md +493 -0
  11. package/docs/components/progress-bar/content.md +164 -3
  12. package/docs/components/progress-segmented/content.md +1 -1
  13. package/docs/components/select/content.md +1 -0
  14. package/docs/components/stepper/content.md +599 -0
  15. package/docs/components/system-alert/content.md +533 -0
  16. package/docs/foundations/expressions/icons/content.md +2 -1
  17. package/docs/foundations/styles/tokens/all-tokens/content.md +2 -1
  18. package/docs/getting-started/developers/content.md +1 -1
  19. package/docs/llms.txt +12 -0
  20. package/docs/patterns/content.md +1 -0
  21. package/docs/patterns/dashboard/content.md +423 -19
  22. package/docs/patterns/insights/content.md +659 -0
  23. package/docs/resources/content.md +1 -0
  24. package/docs/resources/release-notes/0.3.5/content.md +7 -0
  25. package/docs/resources/release-notes/0.3.6/content.md +29 -0
  26. package/docs/resources/release-notes/content.md +2 -0
  27. package/docs/resources/skills/content.md +66 -0
  28. package/lib/commonjs/components/BarChart/geometry.js +1130 -0
  29. package/lib/commonjs/components/BarChart/geometry.js.map +1 -0
  30. package/lib/commonjs/components/BarChart/index.js +935 -0
  31. package/lib/commonjs/components/BarChart/index.js.map +1 -0
  32. package/lib/commonjs/components/BarChart/styles.js +26 -0
  33. package/lib/commonjs/components/BarChart/styles.js.map +1 -0
  34. package/lib/commonjs/components/Button/index.js +2 -2
  35. package/lib/commonjs/components/Button/index.js.map +1 -1
  36. package/lib/commonjs/components/CountryFlag/index.js +56 -0
  37. package/lib/commonjs/components/CountryFlag/index.js.map +1 -0
  38. package/lib/commonjs/components/Input/index.js.map +1 -1
  39. package/lib/commonjs/components/LineChart/geometry.js +698 -0
  40. package/lib/commonjs/components/LineChart/geometry.js.map +1 -0
  41. package/lib/commonjs/components/LineChart/index.js +744 -0
  42. package/lib/commonjs/components/LineChart/index.js.map +1 -0
  43. package/lib/commonjs/components/LineChart/styles.js +25 -0
  44. package/lib/commonjs/components/LineChart/styles.js.map +1 -0
  45. package/lib/commonjs/components/PieChart/geometry.js +216 -0
  46. package/lib/commonjs/components/PieChart/geometry.js.map +1 -0
  47. package/lib/commonjs/components/PieChart/index.js +476 -0
  48. package/lib/commonjs/components/PieChart/index.js.map +1 -0
  49. package/lib/commonjs/components/PieChart/styles.js +88 -0
  50. package/lib/commonjs/components/PieChart/styles.js.map +1 -0
  51. package/lib/commonjs/components/ProgressBar/index.js +44 -12
  52. package/lib/commonjs/components/ProgressBar/index.js.map +1 -1
  53. package/lib/commonjs/components/ProgressBar/styles.js +31 -2
  54. package/lib/commonjs/components/ProgressBar/styles.js.map +1 -1
  55. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js +9 -31
  56. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  57. package/lib/commonjs/components/ProgressCircle/ProgressRing.js +52 -0
  58. package/lib/commonjs/components/ProgressCircle/ProgressRing.js.map +1 -0
  59. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +8 -7
  60. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
  61. package/lib/commonjs/components/Select/index.js.map +1 -1
  62. package/lib/commonjs/components/Stepper/index.js +369 -0
  63. package/lib/commonjs/components/Stepper/index.js.map +1 -0
  64. package/lib/commonjs/components/Stepper/styles.js +211 -0
  65. package/lib/commonjs/components/Stepper/styles.js.map +1 -0
  66. package/lib/commonjs/components/Stepper/useStepperLabelFit.js +22 -0
  67. package/lib/commonjs/components/Stepper/useStepperLabelFit.js.map +1 -0
  68. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js +52 -0
  69. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  70. package/lib/commonjs/components/Stepper/useStepperRingColors.js +31 -0
  71. package/lib/commonjs/components/Stepper/useStepperRingColors.js.map +1 -0
  72. package/lib/commonjs/components/SystemAlert/animation.js +218 -0
  73. package/lib/commonjs/components/SystemAlert/animation.js.map +1 -0
  74. package/lib/commonjs/components/SystemAlert/index.js +525 -0
  75. package/lib/commonjs/components/SystemAlert/index.js.map +1 -0
  76. package/lib/commonjs/components/SystemAlert/styles.js +178 -0
  77. package/lib/commonjs/components/SystemAlert/styles.js.map +1 -0
  78. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js +53 -0
  79. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  80. package/lib/commonjs/components/Tabs/index.js +4 -0
  81. package/lib/commonjs/components/Tabs/index.js.map +1 -1
  82. package/lib/commonjs/components/Tabs/styles.js +1 -1
  83. package/lib/commonjs/components/Tabs/styles.js.map +1 -1
  84. package/lib/commonjs/components/chart/ChartInspector.js +610 -0
  85. package/lib/commonjs/components/chart/ChartInspector.js.map +1 -0
  86. package/lib/commonjs/components/chart/format.js +93 -0
  87. package/lib/commonjs/components/chart/format.js.map +1 -0
  88. package/lib/commonjs/components/chart/hiddenSvgProps.js +23 -0
  89. package/lib/commonjs/components/chart/hiddenSvgProps.js.map +1 -0
  90. package/lib/commonjs/components/chart/index.js +2 -0
  91. package/lib/commonjs/components/chart/index.js.map +1 -0
  92. package/lib/commonjs/components/chart/motion.js +97 -0
  93. package/lib/commonjs/components/chart/motion.js.map +1 -0
  94. package/lib/commonjs/components/chart/palette.js +178 -0
  95. package/lib/commonjs/components/chart/palette.js.map +1 -0
  96. package/lib/commonjs/components/chart/size.js +34 -0
  97. package/lib/commonjs/components/chart/size.js.map +1 -0
  98. package/lib/commonjs/components/chart/ticks.js +59 -0
  99. package/lib/commonjs/components/chart/ticks.js.map +1 -0
  100. package/lib/commonjs/components/chart/types.js +6 -0
  101. package/lib/commonjs/components/chart/types.js.map +1 -0
  102. package/lib/commonjs/components/chart/useChartHostWidth.js +27 -0
  103. package/lib/commonjs/components/chart/useChartHostWidth.js.map +1 -0
  104. package/lib/commonjs/components/index.js +72 -0
  105. package/lib/commonjs/components/index.js.map +1 -1
  106. package/lib/commonjs/figma/Accordion.figma.js +2 -2
  107. package/lib/commonjs/figma/Accordion.figma.js.map +1 -1
  108. package/lib/commonjs/figma/Alert.figma.js +7 -7
  109. package/lib/commonjs/figma/Alert.figma.js.map +1 -1
  110. package/lib/commonjs/figma/Badge.Indicator.figma.js +6 -5
  111. package/lib/commonjs/figma/Badge.Indicator.figma.js.map +1 -1
  112. package/lib/commonjs/figma/Badge.figma.js +22 -22
  113. package/lib/commonjs/figma/Badge.figma.js.map +1 -1
  114. package/lib/commonjs/figma/Button.figma.js +5 -2
  115. package/lib/commonjs/figma/Button.figma.js.map +1 -1
  116. package/lib/commonjs/figma/CLAUDE.md +1 -0
  117. package/lib/commonjs/figma/Card.Header.figma.js +8 -4
  118. package/lib/commonjs/figma/Card.Header.figma.js.map +1 -1
  119. package/lib/commonjs/figma/Card.figma.js +2 -1
  120. package/lib/commonjs/figma/Card.figma.js.map +1 -1
  121. package/lib/commonjs/figma/Chip.figma.js +2 -2
  122. package/lib/commonjs/figma/Chip.figma.js.map +1 -1
  123. package/lib/commonjs/figma/CurrencyInput.figma.js +1 -1
  124. package/lib/commonjs/figma/CurrencyInput.figma.js.map +1 -1
  125. package/lib/commonjs/figma/Dialog.figma.js +5 -2
  126. package/lib/commonjs/figma/Dialog.figma.js.map +1 -1
  127. package/lib/commonjs/figma/Divider.figma.js +1 -1
  128. package/lib/commonjs/figma/Divider.figma.js.map +1 -1
  129. package/lib/commonjs/figma/Drawer.figma.js +3 -3
  130. package/lib/commonjs/figma/Drawer.figma.js.map +1 -1
  131. package/lib/commonjs/figma/IconButton.figma.js +10 -4
  132. package/lib/commonjs/figma/IconButton.figma.js.map +1 -1
  133. package/lib/commonjs/figma/Input.figma.js +2 -1
  134. package/lib/commonjs/figma/Input.figma.js.map +1 -1
  135. package/lib/commonjs/figma/Insight.figma.js +3 -3
  136. package/lib/commonjs/figma/Insight.figma.js.map +1 -1
  137. package/lib/commonjs/figma/ProgressBar.figma.js +11 -2
  138. package/lib/commonjs/figma/ProgressBar.figma.js.map +1 -1
  139. package/lib/commonjs/figma/ProgressSegmented.figma.js +9 -1
  140. package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -1
  141. package/lib/commonjs/figma/Select.figma.js +2 -1
  142. package/lib/commonjs/figma/Select.figma.js.map +1 -1
  143. package/lib/commonjs/figma/SystemAlert.Button.figma.js +28 -0
  144. package/lib/commonjs/figma/SystemAlert.Button.figma.js.map +1 -0
  145. package/lib/commonjs/figma/SystemAlert.Close.figma.js +22 -0
  146. package/lib/commonjs/figma/SystemAlert.Close.figma.js.map +1 -0
  147. package/lib/commonjs/figma/SystemAlert.Description.figma.js +20 -0
  148. package/lib/commonjs/figma/SystemAlert.Description.figma.js.map +1 -0
  149. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js +31 -0
  150. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js.map +1 -0
  151. package/lib/commonjs/figma/SystemAlert.figma.js +47 -0
  152. package/lib/commonjs/figma/SystemAlert.figma.js.map +1 -0
  153. package/lib/commonjs/styles.css +0 -1
  154. package/lib/module/components/BarChart/geometry.js +1110 -0
  155. package/lib/module/components/BarChart/geometry.js.map +1 -0
  156. package/lib/module/components/BarChart/index.js +929 -0
  157. package/lib/module/components/BarChart/index.js.map +1 -0
  158. package/lib/module/components/BarChart/styles.js +22 -0
  159. package/lib/module/components/BarChart/styles.js.map +1 -0
  160. package/lib/module/components/Button/index.js +2 -2
  161. package/lib/module/components/Button/index.js.map +1 -1
  162. package/lib/module/components/CountryFlag/index.js +52 -0
  163. package/lib/module/components/CountryFlag/index.js.map +1 -0
  164. package/lib/module/components/Input/index.js.map +1 -1
  165. package/lib/module/components/LineChart/geometry.js +685 -0
  166. package/lib/module/components/LineChart/geometry.js.map +1 -0
  167. package/lib/module/components/LineChart/index.js +738 -0
  168. package/lib/module/components/LineChart/index.js.map +1 -0
  169. package/lib/module/components/LineChart/styles.js +21 -0
  170. package/lib/module/components/LineChart/styles.js.map +1 -0
  171. package/lib/module/components/PieChart/geometry.js +209 -0
  172. package/lib/module/components/PieChart/geometry.js.map +1 -0
  173. package/lib/module/components/PieChart/index.js +471 -0
  174. package/lib/module/components/PieChart/index.js.map +1 -0
  175. package/lib/module/components/PieChart/styles.js +84 -0
  176. package/lib/module/components/PieChart/styles.js.map +1 -0
  177. package/lib/module/components/ProgressBar/index.js +47 -15
  178. package/lib/module/components/ProgressBar/index.js.map +1 -1
  179. package/lib/module/components/ProgressBar/styles.js +31 -2
  180. package/lib/module/components/ProgressBar/styles.js.map +1 -1
  181. package/lib/module/components/ProgressCircle/ProgressCircleRing.js +10 -32
  182. package/lib/module/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  183. package/lib/module/components/ProgressCircle/ProgressRing.js +48 -0
  184. package/lib/module/components/ProgressCircle/ProgressRing.js.map +1 -0
  185. package/lib/module/components/ScrollShadow/useScrollShadow.js +8 -7
  186. package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
  187. package/lib/module/components/Select/index.js.map +1 -1
  188. package/lib/module/components/Stepper/index.js +360 -0
  189. package/lib/module/components/Stepper/index.js.map +1 -0
  190. package/lib/module/components/Stepper/styles.js +206 -0
  191. package/lib/module/components/Stepper/styles.js.map +1 -0
  192. package/lib/module/components/Stepper/useStepperLabelFit.js +18 -0
  193. package/lib/module/components/Stepper/useStepperLabelFit.js.map +1 -0
  194. package/lib/module/components/Stepper/useStepperLabelFit.web.js +48 -0
  195. package/lib/module/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  196. package/lib/module/components/Stepper/useStepperRingColors.js +28 -0
  197. package/lib/module/components/Stepper/useStepperRingColors.js.map +1 -0
  198. package/lib/module/components/SystemAlert/animation.js +213 -0
  199. package/lib/module/components/SystemAlert/animation.js.map +1 -0
  200. package/lib/module/components/SystemAlert/index.js +515 -0
  201. package/lib/module/components/SystemAlert/index.js.map +1 -0
  202. package/lib/module/components/SystemAlert/styles.js +174 -0
  203. package/lib/module/components/SystemAlert/styles.js.map +1 -0
  204. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js +49 -0
  205. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  206. package/lib/module/components/Tabs/index.js +4 -0
  207. package/lib/module/components/Tabs/index.js.map +1 -1
  208. package/lib/module/components/Tabs/styles.js +1 -1
  209. package/lib/module/components/Tabs/styles.js.map +1 -1
  210. package/lib/module/components/chart/ChartInspector.js +600 -0
  211. package/lib/module/components/chart/ChartInspector.js.map +1 -0
  212. package/lib/module/components/chart/format.js +84 -0
  213. package/lib/module/components/chart/format.js.map +1 -0
  214. package/lib/module/components/chart/hiddenSvgProps.js +20 -0
  215. package/lib/module/components/chart/hiddenSvgProps.js.map +1 -0
  216. package/lib/module/components/chart/index.js +2 -0
  217. package/lib/module/components/chart/index.js.map +1 -0
  218. package/lib/module/components/chart/motion.js +89 -0
  219. package/lib/module/components/chart/motion.js.map +1 -0
  220. package/lib/module/components/chart/palette.js +168 -0
  221. package/lib/module/components/chart/palette.js.map +1 -0
  222. package/lib/module/components/chart/size.js +29 -0
  223. package/lib/module/components/chart/size.js.map +1 -0
  224. package/lib/module/components/chart/ticks.js +55 -0
  225. package/lib/module/components/chart/ticks.js.map +1 -0
  226. package/lib/module/components/chart/types.js +4 -0
  227. package/lib/module/components/chart/types.js.map +1 -0
  228. package/lib/module/components/chart/useChartHostWidth.js +23 -0
  229. package/lib/module/components/chart/useChartHostWidth.js.map +1 -0
  230. package/lib/module/components/index.js +6 -0
  231. package/lib/module/components/index.js.map +1 -1
  232. package/lib/module/figma/Accordion.figma.js +2 -2
  233. package/lib/module/figma/Accordion.figma.js.map +1 -1
  234. package/lib/module/figma/Alert.figma.js +7 -7
  235. package/lib/module/figma/Alert.figma.js.map +1 -1
  236. package/lib/module/figma/Badge.Indicator.figma.js +6 -5
  237. package/lib/module/figma/Badge.Indicator.figma.js.map +1 -1
  238. package/lib/module/figma/Badge.figma.js +22 -22
  239. package/lib/module/figma/Badge.figma.js.map +1 -1
  240. package/lib/module/figma/Button.figma.js +5 -2
  241. package/lib/module/figma/Button.figma.js.map +1 -1
  242. package/lib/module/figma/CLAUDE.md +1 -0
  243. package/lib/module/figma/Card.Header.figma.js +8 -4
  244. package/lib/module/figma/Card.Header.figma.js.map +1 -1
  245. package/lib/module/figma/Card.figma.js +2 -1
  246. package/lib/module/figma/Card.figma.js.map +1 -1
  247. package/lib/module/figma/Chip.figma.js +2 -2
  248. package/lib/module/figma/Chip.figma.js.map +1 -1
  249. package/lib/module/figma/CurrencyInput.figma.js +1 -1
  250. package/lib/module/figma/CurrencyInput.figma.js.map +1 -1
  251. package/lib/module/figma/Dialog.figma.js +5 -2
  252. package/lib/module/figma/Dialog.figma.js.map +1 -1
  253. package/lib/module/figma/Divider.figma.js +1 -1
  254. package/lib/module/figma/Divider.figma.js.map +1 -1
  255. package/lib/module/figma/Drawer.figma.js +3 -3
  256. package/lib/module/figma/Drawer.figma.js.map +1 -1
  257. package/lib/module/figma/IconButton.figma.js +10 -4
  258. package/lib/module/figma/IconButton.figma.js.map +1 -1
  259. package/lib/module/figma/Input.figma.js +2 -1
  260. package/lib/module/figma/Input.figma.js.map +1 -1
  261. package/lib/module/figma/Insight.figma.js +3 -3
  262. package/lib/module/figma/Insight.figma.js.map +1 -1
  263. package/lib/module/figma/ProgressBar.figma.js +12 -2
  264. package/lib/module/figma/ProgressBar.figma.js.map +1 -1
  265. package/lib/module/figma/ProgressSegmented.figma.js +9 -1
  266. package/lib/module/figma/ProgressSegmented.figma.js.map +1 -1
  267. package/lib/module/figma/Select.figma.js +2 -1
  268. package/lib/module/figma/Select.figma.js.map +1 -1
  269. package/lib/module/figma/SystemAlert.Button.figma.js +22 -0
  270. package/lib/module/figma/SystemAlert.Button.figma.js.map +1 -0
  271. package/lib/module/figma/SystemAlert.Close.figma.js +18 -0
  272. package/lib/module/figma/SystemAlert.Close.figma.js.map +1 -0
  273. package/lib/module/figma/SystemAlert.Description.figma.js +14 -0
  274. package/lib/module/figma/SystemAlert.Description.figma.js.map +1 -0
  275. package/lib/module/figma/SystemAlert.IconButton.figma.js +25 -0
  276. package/lib/module/figma/SystemAlert.IconButton.figma.js.map +1 -0
  277. package/lib/module/figma/SystemAlert.figma.js +41 -0
  278. package/lib/module/figma/SystemAlert.figma.js.map +1 -0
  279. package/lib/module/styles.css +0 -1
  280. package/lib/typescript/components/BarChart/geometry.d.ts +236 -0
  281. package/lib/typescript/components/BarChart/geometry.d.ts.map +1 -0
  282. package/lib/typescript/components/BarChart/index.d.ts +193 -0
  283. package/lib/typescript/components/BarChart/index.d.ts.map +1 -0
  284. package/lib/typescript/components/BarChart/styles.d.ts +32 -0
  285. package/lib/typescript/components/BarChart/styles.d.ts.map +1 -0
  286. package/lib/typescript/components/CountryFlag/index.d.ts +35 -0
  287. package/lib/typescript/components/CountryFlag/index.d.ts.map +1 -0
  288. package/lib/typescript/components/Input/index.d.ts +2 -0
  289. package/lib/typescript/components/Input/index.d.ts.map +1 -1
  290. package/lib/typescript/components/LineChart/geometry.d.ts +248 -0
  291. package/lib/typescript/components/LineChart/geometry.d.ts.map +1 -0
  292. package/lib/typescript/components/LineChart/index.d.ts +105 -0
  293. package/lib/typescript/components/LineChart/index.d.ts.map +1 -0
  294. package/lib/typescript/components/LineChart/styles.d.ts +12 -0
  295. package/lib/typescript/components/LineChart/styles.d.ts.map +1 -0
  296. package/lib/typescript/components/PieChart/geometry.d.ts +43 -0
  297. package/lib/typescript/components/PieChart/geometry.d.ts.map +1 -0
  298. package/lib/typescript/components/PieChart/index.d.ts +147 -0
  299. package/lib/typescript/components/PieChart/index.d.ts.map +1 -0
  300. package/lib/typescript/components/PieChart/styles.d.ts +27 -0
  301. package/lib/typescript/components/PieChart/styles.d.ts.map +1 -0
  302. package/lib/typescript/components/ProgressBar/index.d.ts +16 -1
  303. package/lib/typescript/components/ProgressBar/index.d.ts.map +1 -1
  304. package/lib/typescript/components/ProgressBar/styles.d.ts +7 -2
  305. package/lib/typescript/components/ProgressBar/styles.d.ts.map +1 -1
  306. package/lib/typescript/components/ProgressCircle/ProgressCircleRing.d.ts.map +1 -1
  307. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts +17 -0
  308. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts.map +1 -0
  309. package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
  310. package/lib/typescript/components/Select/index.d.ts +2 -0
  311. package/lib/typescript/components/Select/index.d.ts.map +1 -1
  312. package/lib/typescript/components/Stepper/index.d.ts +68 -0
  313. package/lib/typescript/components/Stepper/index.d.ts.map +1 -0
  314. package/lib/typescript/components/Stepper/styles.d.ts +46 -0
  315. package/lib/typescript/components/Stepper/styles.d.ts.map +1 -0
  316. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts +15 -0
  317. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts.map +1 -0
  318. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts +10 -0
  319. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts.map +1 -0
  320. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts +6 -0
  321. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts.map +1 -0
  322. package/lib/typescript/components/SystemAlert/animation.d.ts +56 -0
  323. package/lib/typescript/components/SystemAlert/animation.d.ts.map +1 -0
  324. package/lib/typescript/components/SystemAlert/index.d.ts +110 -0
  325. package/lib/typescript/components/SystemAlert/index.d.ts.map +1 -0
  326. package/lib/typescript/components/SystemAlert/styles.d.ts +38 -0
  327. package/lib/typescript/components/SystemAlert/styles.d.ts.map +1 -0
  328. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts +14 -0
  329. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts.map +1 -0
  330. package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
  331. package/lib/typescript/components/chart/ChartInspector.d.ts +101 -0
  332. package/lib/typescript/components/chart/ChartInspector.d.ts.map +1 -0
  333. package/lib/typescript/components/chart/format.d.ts +16 -0
  334. package/lib/typescript/components/chart/format.d.ts.map +1 -0
  335. package/lib/typescript/components/chart/hiddenSvgProps.d.ts +17 -0
  336. package/lib/typescript/components/chart/hiddenSvgProps.d.ts.map +1 -0
  337. package/lib/typescript/components/chart/index.d.ts +3 -0
  338. package/lib/typescript/components/chart/index.d.ts.map +1 -0
  339. package/lib/typescript/components/chart/motion.d.ts +27 -0
  340. package/lib/typescript/components/chart/motion.d.ts.map +1 -0
  341. package/lib/typescript/components/chart/palette.d.ts +44 -0
  342. package/lib/typescript/components/chart/palette.d.ts.map +1 -0
  343. package/lib/typescript/components/chart/size.d.ts +25 -0
  344. package/lib/typescript/components/chart/size.d.ts.map +1 -0
  345. package/lib/typescript/components/chart/ticks.d.ts +3 -0
  346. package/lib/typescript/components/chart/ticks.d.ts.map +1 -0
  347. package/lib/typescript/components/chart/types.d.ts +163 -0
  348. package/lib/typescript/components/chart/types.d.ts.map +1 -0
  349. package/lib/typescript/components/chart/useChartHostWidth.d.ts +9 -0
  350. package/lib/typescript/components/chart/useChartHostWidth.d.ts.map +1 -0
  351. package/lib/typescript/components/index.d.ts +6 -0
  352. package/lib/typescript/components/index.d.ts.map +1 -1
  353. package/lib/typescript/figma/Alert.figma.d.ts.map +1 -1
  354. package/lib/typescript/figma/Badge.Indicator.figma.d.ts.map +1 -1
  355. package/lib/typescript/figma/Badge.figma.d.ts.map +1 -1
  356. package/lib/typescript/figma/Button.figma.d.ts.map +1 -1
  357. package/lib/typescript/figma/Card.Header.figma.d.ts.map +1 -1
  358. package/lib/typescript/figma/Card.figma.d.ts.map +1 -1
  359. package/lib/typescript/figma/Dialog.figma.d.ts.map +1 -1
  360. package/lib/typescript/figma/IconButton.figma.d.ts.map +1 -1
  361. package/lib/typescript/figma/Input.figma.d.ts.map +1 -1
  362. package/lib/typescript/figma/ProgressBar.figma.d.ts.map +1 -1
  363. package/lib/typescript/figma/ProgressSegmented.figma.d.ts.map +1 -1
  364. package/lib/typescript/figma/Select.figma.d.ts.map +1 -1
  365. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts +11 -0
  366. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts.map +1 -0
  367. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts +11 -0
  368. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts.map +1 -0
  369. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts +8 -0
  370. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts.map +1 -0
  371. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts +11 -0
  372. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts.map +1 -0
  373. package/lib/typescript/figma/SystemAlert.figma.d.ts +8 -0
  374. package/lib/typescript/figma/SystemAlert.figma.d.ts.map +1 -0
  375. package/package.json +5 -5
  376. package/src/components/BarChart/geometry.ts +1469 -0
  377. package/src/components/BarChart/index.tsx +1417 -0
  378. package/src/components/BarChart/styles.ts +31 -0
  379. package/src/components/Button/index.tsx +1 -1
  380. package/src/components/CountryFlag/index.tsx +53 -0
  381. package/src/components/Input/index.tsx +2 -0
  382. package/src/components/LineChart/geometry.ts +957 -0
  383. package/src/components/LineChart/index.tsx +1106 -0
  384. package/src/components/LineChart/styles.ts +26 -0
  385. package/src/components/PieChart/geometry.ts +295 -0
  386. package/src/components/PieChart/index.tsx +715 -0
  387. package/src/components/PieChart/styles.ts +101 -0
  388. package/src/components/ProgressBar/index.tsx +66 -14
  389. package/src/components/ProgressBar/styles.ts +35 -4
  390. package/src/components/ProgressCircle/ProgressCircleRing.tsx +10 -39
  391. package/src/components/ProgressCircle/ProgressRing.tsx +60 -0
  392. package/src/components/ScrollShadow/useScrollShadow.ts +12 -11
  393. package/src/components/Select/index.tsx +2 -0
  394. package/src/components/Stepper/index.tsx +452 -0
  395. package/src/components/Stepper/styles.ts +234 -0
  396. package/src/components/Stepper/useStepperLabelFit.ts +21 -0
  397. package/src/components/Stepper/useStepperLabelFit.web.ts +53 -0
  398. package/src/components/Stepper/useStepperRingColors.ts +29 -0
  399. package/src/components/SystemAlert/animation.ts +252 -0
  400. package/src/components/SystemAlert/index.tsx +684 -0
  401. package/src/components/SystemAlert/styles.ts +212 -0
  402. package/src/components/SystemAlert/useSystemAlertStatusBarStyle.ts +57 -0
  403. package/src/components/Tabs/index.tsx +4 -0
  404. package/src/components/Tabs/styles.ts +1 -1
  405. package/src/components/chart/ChartInspector.tsx +726 -0
  406. package/src/components/chart/format.ts +95 -0
  407. package/src/components/chart/hiddenSvgProps.ts +15 -0
  408. package/src/components/chart/index.ts +24 -0
  409. package/src/components/chart/motion.ts +98 -0
  410. package/src/components/chart/palette.tsx +247 -0
  411. package/src/components/chart/size.ts +21 -0
  412. package/src/components/chart/ticks.ts +53 -0
  413. package/src/components/chart/types.ts +183 -0
  414. package/src/components/chart/useChartHostWidth.ts +26 -0
  415. package/src/components/index.ts +6 -0
  416. package/src/styles.css +0 -1
@@ -0,0 +1,929 @@
1
+ "use strict";
2
+
3
+ /* SVG `x`/`y` are paint coordinates. RN View `x`/`y` layout props are deprecated and share the name. */
4
+ /* eslint-disable @typescript-eslint/no-deprecated */
5
+ import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { ScrollView, Text, View } from 'react-native';
7
+ import Animated, { useAnimatedProps } from 'react-native-reanimated';
8
+ import { G, Line, Path, Svg, Text as SvgText } from 'react-native-svg';
9
+ import { dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
10
+ import { cn, useControllableState } from '@cdx-ui/utils';
11
+ import { ChartInspector, ChartTooltipLayer, expandHitBox } from '../chart/ChartInspector';
12
+ import { defaultChartValueFormatter, formatChartPercent, resolveChartLocaleText, resolveValueFormatter } from '../chart/format';
13
+ import { HIDDEN_SVG_PROPS } from '../chart/hiddenSvgProps';
14
+ import { useChartHostWidth } from '../chart/useChartHostWidth';
15
+ import { CHART_MOTION_DURATION, useChartMorph, useChartMotionEnabled, lerpVector } from '../chart/motion';
16
+ import { ChartLinearFills, chartFillUrl, chartSeriesColor, resolveChartColor, useChartChrome, useChartColorPaints, useChartGradientId, useChartPalette, useChartSimpleColor } from '../chart/palette';
17
+ import { BAR_GAP_RATIO, CATEGORY_GAP_RATIO, barKeyboardNeighbor, barPath, barValueAnchor, DEFAULT_STACK_GAP, formatWaterfallBarValue, isExpandAxis, layoutBarChart, overlayDelta, readBarValue, resolveBarChartContentSize, resolveBarChartGutters, resolveBarGroups, stackedTotalAnchors, waterfallValueAnchor } from './geometry';
18
+ import { BAR_RADIUS, barChartLegendItemVariants, barChartLegendLabelVariants, barChartLegendVariants, barChartRootVariants, resolveBarChartBox } from './styles';
19
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
+ const INACTIVE_OPACITY = 0.4;
21
+ const DASH = '6 4';
22
+ const SVG_OVERFLOW_VISIBLE = {
23
+ overflow: 'visible'
24
+ };
25
+ const LABEL_FADE_DURATION = 220;
26
+ const AnimatedPath = Animated.createAnimatedComponent(Path);
27
+
28
+ /** Keys of `TRow` whose value is a boolean. */
29
+
30
+ /** Running-total series. Each row is a change, except rows flagged as totals. */
31
+
32
+ /** Draws this series as a thinner comparison bar beside another series' bar. */
33
+
34
+ function resolveBarPlan(series) {
35
+ const toGeometry = item => ({
36
+ id: item.id,
37
+ dataKey: item.dataKey,
38
+ label: item.label ?? '',
39
+ stack: item.stack,
40
+ stackOffset: item.stackOffset
41
+ });
42
+ const waterfall = series.find(item => item.waterfall !== undefined);
43
+ if (waterfall !== undefined) {
44
+ return {
45
+ kind: 'waterfall',
46
+ series: [waterfall],
47
+ geometry: [toGeometry(waterfall)],
48
+ totalKey: waterfall.waterfall?.totalKey
49
+ };
50
+ }
51
+ for (const comparison of series) {
52
+ const primary = comparison.overlay === undefined ? undefined : series.find(item => item.id === comparison.overlay?.seriesId && item !== comparison);
53
+ if (primary !== undefined) {
54
+ const pair = [primary, comparison];
55
+ return {
56
+ kind: 'overlay',
57
+ series: pair,
58
+ geometry: pair.map(item => ({
59
+ ...toGeometry(item),
60
+ stack: undefined
61
+ })),
62
+ totalKey: undefined
63
+ };
64
+ }
65
+ }
66
+ return {
67
+ kind: 'bars',
68
+ series,
69
+ geometry: series.map(toGeometry),
70
+ totalKey: undefined
71
+ };
72
+ }
73
+ function sameItem(a, b) {
74
+ return a?.seriesId === b.seriesId && a.dataIndex === b.dataIndex;
75
+ }
76
+ function barSelection(bar) {
77
+ return {
78
+ seriesId: bar.seriesId,
79
+ dataIndex: bar.index
80
+ };
81
+ }
82
+ function barAccessibilityName(label, seriesLabel, formatted, change = null) {
83
+ const base = seriesLabel.length > 0 ? `${label}, ${seriesLabel}, ${formatted}` : `${label}, ${formatted}`;
84
+ return change === null ? base : `${base}, ${change}`;
85
+ }
86
+ function BarChartInner({
87
+ dataset,
88
+ series: seriesProp,
89
+ xAxis,
90
+ yAxis,
91
+ size = 'lg',
92
+ width: widthProp,
93
+ height: heightProp,
94
+ layout: orientation = 'vertical',
95
+ hideLegend = false,
96
+ grid,
97
+ palette: paletteProp = 'auto',
98
+ barLabel = false,
99
+ borderRadius = BAR_RADIUS,
100
+ stackGap = DEFAULT_STACK_GAP,
101
+ categoryGapRatio = CATEGORY_GAP_RATIO,
102
+ barGapRatio = BAR_GAP_RATIO,
103
+ referenceLines,
104
+ emphasizedIndex,
105
+ scrollable = true,
106
+ visiblePoints,
107
+ selectedItem,
108
+ defaultSelectedItem,
109
+ onSelectedItemChange,
110
+ tooltip: tooltipProp,
111
+ locale,
112
+ localeText: localeTextProp,
113
+ animation,
114
+ accessibilityLabel,
115
+ className,
116
+ style,
117
+ onLayout,
118
+ ...props
119
+ }, ref) {
120
+ const animated = useChartMotionEnabled(animation);
121
+ const simpleColor = useChartSimpleColor();
122
+ const gradientId = useChartGradientId('bar-fill');
123
+ const chrome = useChartChrome();
124
+ const palette = useChartPalette();
125
+ const paints = useChartColorPaints();
126
+ const localeText = useMemo(() => resolveChartLocaleText(localeTextProp), [localeTextProp]);
127
+ const plan = useMemo(() => resolveBarPlan(seriesProp), [seriesProp]);
128
+ const {
129
+ kind,
130
+ geometry
131
+ } = plan;
132
+ const overlay = kind === 'overlay';
133
+ const waterfall = kind === 'waterfall';
134
+ const expandAxis = useMemo(() => isExpandAxis(kind, resolveBarGroups(geometry)), [kind, geometry]);
135
+ const categoryAxis = (orientation === 'vertical' ? xAxis : yAxis)?.[0];
136
+ const valueAxis = (orientation === 'vertical' ? yAxis : xAxis)?.[0];
137
+ const categoryKey = categoryAxis?.dataKey;
138
+ const categoryLabelPosition = categoryAxis?.position;
139
+ const showTicks = valueAxis?.position !== 'none';
140
+ const showGrid = grid === undefined ? true : (orientation === 'vertical' ? grid.horizontal : grid.vertical) === true;
141
+ const tickLabelInterval = categoryAxis?.tickLabelInterval;
142
+ const categories = useMemo(() => dataset.map((row, index) => {
143
+ if (categoryKey === undefined) {
144
+ return String(index);
145
+ }
146
+ const raw = row[categoryKey];
147
+ return raw === null || raw === undefined ? '' : String(raw);
148
+ }), [dataset, categoryKey]);
149
+ const hasNegative = useMemo(() => dataset.some(row => geometry.some(item => (readBarValue(row, item.dataKey) ?? 0) < 0)), [dataset, geometry]);
150
+ const sourceById = useMemo(() => new Map(plan.series.map(item => [item.id, item])), [plan.series]);
151
+ const valueAxisMin = valueAxis?.min;
152
+ const valueAxisMax = valueAxis?.max;
153
+ const valueAxisTicks = valueAxis?.tickNumber;
154
+ const valueAxisFormatter = valueAxis?.valueFormatter;
155
+ const valueAxisConfig = useMemo(() => ({
156
+ min: valueAxisMin,
157
+ max: valueAxisMax,
158
+ tickNumber: valueAxisTicks
159
+ }), [valueAxisMin, valueAxisMax, valueAxisTicks]);
160
+ const percentFormatter = useMemo(() => value => value === null ? '' : formatChartPercent(value, locale), [locale]);
161
+ const formatTick = useMemo(() => {
162
+ const formatter = valueAxisFormatter ?? (expandAxis ? percentFormatter : defaultChartValueFormatter(locale));
163
+ return value => formatter(value, {
164
+ location: 'tick'
165
+ });
166
+ }, [valueAxisFormatter, expandAxis, percentFormatter, locale]);
167
+ const formatBar = (bar, location) => {
168
+ const source = sourceById.get(bar.seriesId);
169
+ const context = {
170
+ location,
171
+ seriesId: bar.seriesId,
172
+ dataIndex: bar.index
173
+ };
174
+ if (bar.expand === true && source?.valueFormatter === undefined) {
175
+ return (valueAxisFormatter ?? percentFormatter)(bar.plotValue / 100, context);
176
+ }
177
+ const formatter = resolveValueFormatter(source, valueAxis, locale);
178
+ const format = value => formatter(value, context);
179
+ return bar.waterfallRole === undefined ? format(bar.value) : formatWaterfallBarValue(bar, format);
180
+ };
181
+ const seriesLabelOf = bar => {
182
+ if (bar.waterfallRole === 'increase') {
183
+ return localeText.waterfallIncrease;
184
+ }
185
+ if (bar.waterfallRole === 'decrease') {
186
+ return localeText.waterfallDecrease;
187
+ }
188
+ return bar.seriesLabel;
189
+ };
190
+ const box = resolveBarChartBox(size, widthProp, heightProp);
191
+ const [hostWidth, handleHostLayout] = useChartHostWidth(onLayout);
192
+ const viewportWidth = hostWidth > 0 ? Math.min(hostWidth, box.width) : box.width;
193
+ const viewportHeight = box.height;
194
+ const gutters = useMemo(() => resolveBarChartGutters({
195
+ categories,
196
+ hasNegative,
197
+ orientation,
198
+ barLabel,
199
+ categoryLabelPosition,
200
+ showTicks,
201
+ overlay
202
+ }), [categories, hasNegative, orientation, barLabel, categoryLabelPosition, showTicks, overlay]);
203
+ const content = useMemo(() => resolveBarChartContentSize({
204
+ viewportWidth,
205
+ viewportHeight,
206
+ categoryCount: dataset.length,
207
+ orientation,
208
+ gutters,
209
+ scrollable,
210
+ visiblePoints
211
+ }), [viewportWidth, viewportHeight, dataset.length, orientation, gutters, scrollable, visiblePoints]);
212
+ const showCategoryLabel = useMemo(() => {
213
+ if (typeof tickLabelInterval !== 'function') {
214
+ return undefined;
215
+ }
216
+ return index => {
217
+ const row = dataset.at(index);
218
+ const value = row === undefined || categoryKey === undefined ? index : row[categoryKey];
219
+ return tickLabelInterval(value, index);
220
+ };
221
+ }, [tickLabelInterval, dataset, categoryKey]);
222
+ const layout = useMemo(() => layoutBarChart({
223
+ dataset,
224
+ categories,
225
+ series: geometry,
226
+ kind,
227
+ waterfallTotalKey: plan.totalKey,
228
+ width: content.width,
229
+ height: content.height,
230
+ orientation,
231
+ barLabel,
232
+ categoryLabelPosition,
233
+ showTicks,
234
+ referenceLines,
235
+ valueAxis: valueAxisConfig,
236
+ formatTick,
237
+ stackGap,
238
+ categoryGapRatio,
239
+ barGapRatio,
240
+ showCategoryLabel
241
+ }), [dataset, categories, geometry, kind, plan.totalKey, content.width, content.height, orientation, barLabel, categoryLabelPosition, showTicks, referenceLines, valueAxisConfig, formatTick, stackGap, categoryGapRatio, barGapRatio, showCategoryLabel]);
242
+ const overflowsX = content.width > viewportWidth + 0.5;
243
+ const overflowsY = content.height > viewportHeight + 0.5;
244
+ const fills = waterfall ? dataset.map((_, index) => palette[index % palette.length] ?? simpleColor) : plan.series.map((item, seriesIndex) => {
245
+ const custom = resolveChartColor(item.color, paints);
246
+ if (custom !== undefined) {
247
+ return custom;
248
+ }
249
+ if (overlay) {
250
+ return seriesIndex === 0 ? simpleColor : chrome.grid;
251
+ }
252
+ return paints[chartSeriesColor(seriesIndex, plan.series.length, paletteProp, 'bar')];
253
+ });
254
+ const summaryCategories = dataset.map((row, dataIndex) => ({
255
+ label: categories[dataIndex] ?? '',
256
+ values: plan.series.flatMap(item => {
257
+ const value = readBarValue(row, item.dataKey);
258
+ if (value === null) {
259
+ return [];
260
+ }
261
+ // An expand axis formats 0–1 shares; the summary reads raw values.
262
+ const formatter = resolveValueFormatter(item, expandAxis ? null : valueAxis, locale);
263
+ return [{
264
+ label: item.label ?? '',
265
+ formattedValue: formatter(value, {
266
+ location: 'a11y',
267
+ seriesId: item.id,
268
+ dataIndex
269
+ })
270
+ }];
271
+ })
272
+ }));
273
+ const summary = accessibilityLabel ?? localeText.barChartSummary(summaryCategories);
274
+ const trigger = tooltipProp?.trigger ?? 'axis';
275
+ const tooltip = trigger !== 'none';
276
+ const interactive = onSelectedItemChange !== undefined || selectedItem !== undefined || defaultSelectedItem !== undefined;
277
+ const [selectedState, setSelectedItem] = useControllableState({
278
+ prop: selectedItem,
279
+ defaultProp: defaultSelectedItem ?? null,
280
+ onChange: onSelectedItemChange
281
+ });
282
+ const selected = selectedState ?? null;
283
+ const visibleBars = layout.bars.filter(bar => bar.stackId !== undefined ? bar.width > 0 && bar.height > 0 : orientation === 'vertical' ? bar.width > 0 : bar.height > 0);
284
+ const inspectable = (interactive || tooltip) && visibleBars.length > 0;
285
+ const [activeIndex, setActiveIndex] = useState(null);
286
+ const [dismissed, setDismissed] = useState(false);
287
+ const [scrubbing, setScrubbing] = useState(false);
288
+ const scrollOffset = useRef({
289
+ x: 0,
290
+ y: 0
291
+ });
292
+ const selectedIndex = selected ? visibleBars.findIndex(bar => sameItem(selected, barSelection(bar))) : -1;
293
+ const activeBar = activeIndex === null ? undefined : visibleBars.at(activeIndex);
294
+ const highlightBar = activeBar ? barSelection(activeBar) : selectedIndex >= 0 && selected !== null ? selected : null;
295
+ const tooltipIndex = tooltip && !dismissed && activeIndex !== null ? activeIndex : null;
296
+ const activate = index => {
297
+ setDismissed(false);
298
+ setActiveIndex(prev => prev === index ? prev : index);
299
+ };
300
+ const deactivate = index => {
301
+ setActiveIndex(prev => prev === index ? null : prev);
302
+ };
303
+ const showLegend = !waterfall && plan.series.length > 0 && !hideLegend;
304
+ const plot = /*#__PURE__*/_jsx(BarPlot, {
305
+ layout: layout,
306
+ orientation: orientation,
307
+ overlay: overlay,
308
+ waterfall: waterfall,
309
+ showGrid: showGrid,
310
+ barLabel: barLabel,
311
+ formatBar: formatBar,
312
+ formatStackTotal: anchor => {
313
+ const context = {
314
+ location: 'label',
315
+ dataIndex: anchor.index
316
+ };
317
+ if (anchor.expand) {
318
+ return (valueAxisFormatter ?? percentFormatter)(anchor.total / 100, context);
319
+ }
320
+ return resolveValueFormatter(sourceById.get(anchor.seriesId), valueAxis, locale)(anchor.total, context);
321
+ },
322
+ fills: fills,
323
+ gradientId: gradientId,
324
+ chrome: chrome,
325
+ accent: simpleColor,
326
+ borderRadius: Math.max(borderRadius, 0),
327
+ animated: animated,
328
+ highlightBar: highlightBar,
329
+ emphasizedIndex: emphasizedIndex
330
+ });
331
+ const vertical = orientation === 'vertical';
332
+ const targets = inspectable ? barInspectorTargets({
333
+ bars: visibleBars,
334
+ layout,
335
+ orientation,
336
+ overlay,
337
+ waterfall,
338
+ trigger,
339
+ offsetX: vertical ? layout.plot.x : 0,
340
+ fills,
341
+ fallbackFill: chrome.grid,
342
+ formatBar,
343
+ seriesLabelOf,
344
+ localeText,
345
+ selectedIndex: selectedIndex >= 0 ? selectedIndex : null
346
+ }) : [];
347
+ const tip = tooltipIndex === null ? undefined : targets.at(tooltipIndex);
348
+ const dismissOnScroll = event => {
349
+ scrollOffset.current = event.nativeEvent.contentOffset;
350
+ if (tooltipIndex !== null) {
351
+ setDismissed(true);
352
+ }
353
+ };
354
+ const inspector = inspectable ? /*#__PURE__*/_jsx(BarInspector, {
355
+ bars: visibleBars,
356
+ targets: targets,
357
+ orientation: orientation,
358
+ summary: summary,
359
+ selectable: interactive,
360
+ activeIndex: activeIndex,
361
+ selectedIndex: selectedIndex >= 0 ? selectedIndex : null,
362
+ holdToScrub: overflowsX || overflowsY,
363
+ onScrubLockChange: setScrubbing,
364
+ onActivate: activate,
365
+ onDeactivate: deactivate,
366
+ onDismiss: () => {
367
+ setDismissed(true);
368
+ },
369
+ onSelectIndex: index => {
370
+ const bar = visibleBars.at(index);
371
+ if (bar) {
372
+ setDismissed(false);
373
+ const next = barSelection(bar);
374
+ setSelectedItem(sameItem(selected, next) ? null : next);
375
+ }
376
+ }
377
+ }) : null;
378
+ const tooltipLayer = tip !== undefined ? /*#__PURE__*/_jsx(ChartTooltipLayer, {
379
+ content: tip.tooltip,
380
+ noValueText: localeText.noValue,
381
+ slot: "bar-chart",
382
+ anchorX: vertical ? layout.plot.x + tip.anchorX - scrollOffset.current.x : tip.anchorX,
383
+ anchorY: vertical ? tip.anchorY : tip.anchorY - scrollOffset.current.y,
384
+ anchorRadius: tip.anchorRadius,
385
+ width: viewportWidth,
386
+ height: viewportHeight
387
+ }) : null;
388
+ const ticks = showTicks ? /*#__PURE__*/_jsx(_Fragment, {
389
+ children: layout.valueTicks.map(tick => /*#__PURE__*/_jsx(SvgText, {
390
+ x: tick.x,
391
+ y: tick.y,
392
+ fill: chrome.label,
393
+ fontFamily: chrome.fontFamily,
394
+ fontSize: chrome.labelSize,
395
+ textAnchor: orientation === 'vertical' ? 'end' : 'middle',
396
+ alignmentBaseline: "middle",
397
+ children: tick.text
398
+ }, `tick-${String(tick.value)}`))
399
+ }) : null;
400
+ const chart = /*#__PURE__*/_jsxs(View, {
401
+ style: {
402
+ width: '100%',
403
+ maxWidth: viewportWidth,
404
+ height: viewportHeight
405
+ },
406
+ ...dataAttributes({
407
+ slot: 'bar-chart-plot'
408
+ }),
409
+ children: [orientation === 'vertical' ? /*#__PURE__*/_jsxs(View, {
410
+ className: "w-full flex-row",
411
+ style: {
412
+ height: viewportHeight
413
+ },
414
+ children: [/*#__PURE__*/_jsx(Svg, {
415
+ width: layout.plot.x,
416
+ height: viewportHeight,
417
+ viewBox: `0 0 ${String(layout.plot.x)} ${String(content.height)}`,
418
+ ...HIDDEN_SVG_PROPS,
419
+ children: ticks
420
+ }), /*#__PURE__*/_jsx(ScrollView, {
421
+ horizontal: true,
422
+ nestedScrollEnabled: true,
423
+ scrollEnabled: overflowsX && !scrubbing,
424
+ showsHorizontalScrollIndicator: overflowsX,
425
+ scrollEventThrottle: 16,
426
+ onScroll: dismissOnScroll,
427
+ className: "flex-1",
428
+ style: {
429
+ height: viewportHeight
430
+ },
431
+ children: /*#__PURE__*/_jsxs(View, {
432
+ style: {
433
+ width: content.width - layout.plot.x,
434
+ height: viewportHeight
435
+ },
436
+ children: [/*#__PURE__*/_jsx(Svg, {
437
+ width: content.width - layout.plot.x,
438
+ height: viewportHeight,
439
+ viewBox: `0 0 ${String(content.width - layout.plot.x)} ${String(content.height)}`,
440
+ style: SVG_OVERFLOW_VISIBLE,
441
+ pointerEvents: "none",
442
+ ...HIDDEN_SVG_PROPS,
443
+ children: /*#__PURE__*/_jsx(G, {
444
+ transform: `translate(${String(-layout.plot.x)}, 0)`,
445
+ children: plot
446
+ })
447
+ }), inspector]
448
+ })
449
+ })]
450
+ }) : /*#__PURE__*/_jsxs(View, {
451
+ style: {
452
+ width: viewportWidth,
453
+ height: viewportHeight
454
+ },
455
+ children: [/*#__PURE__*/_jsx(ScrollView, {
456
+ nestedScrollEnabled: true,
457
+ scrollEnabled: overflowsY && !scrubbing,
458
+ showsVerticalScrollIndicator: overflowsY,
459
+ scrollEventThrottle: 16,
460
+ onScroll: dismissOnScroll,
461
+ style: {
462
+ height: viewportHeight - gutters.paddingBottom
463
+ },
464
+ children: /*#__PURE__*/_jsxs(View, {
465
+ style: {
466
+ width: viewportWidth,
467
+ height: content.height - gutters.paddingBottom
468
+ },
469
+ children: [/*#__PURE__*/_jsx(Svg, {
470
+ width: viewportWidth,
471
+ height: content.height - gutters.paddingBottom,
472
+ viewBox: `0 0 ${String(content.width)} ${String(content.height - gutters.paddingBottom)}`,
473
+ pointerEvents: "none",
474
+ ...HIDDEN_SVG_PROPS,
475
+ children: plot
476
+ }), inspector]
477
+ })
478
+ }), /*#__PURE__*/_jsx(Svg, {
479
+ width: viewportWidth,
480
+ height: gutters.paddingBottom,
481
+ viewBox: `0 0 ${String(content.width)} ${String(gutters.paddingBottom)}`,
482
+ ...HIDDEN_SVG_PROPS,
483
+ children: /*#__PURE__*/_jsx(G, {
484
+ transform: `translate(0, ${String(-(content.height - gutters.paddingBottom))})`,
485
+ children: ticks
486
+ })
487
+ })]
488
+ }), tooltipLayer]
489
+ });
490
+ return /*#__PURE__*/_jsxs(View, {
491
+ ref: ref,
492
+ className: cn(barChartRootVariants(), className),
493
+ style: style,
494
+ accessible: !inspectable && !showLegend,
495
+ accessibilityRole: !inspectable && !showLegend ? 'image' : undefined,
496
+ accessibilityLabel: !inspectable && !showLegend ? summary : undefined,
497
+ ...props,
498
+ onLayout: handleHostLayout,
499
+ ...mergeDataAttributes(props, dataAttributes({
500
+ slot: 'bar-chart'
501
+ })),
502
+ children: [chart, showLegend ? /*#__PURE__*/_jsx(View, {
503
+ className: barChartLegendVariants(),
504
+ ...dataAttributes({
505
+ slot: 'bar-chart-legend'
506
+ }),
507
+ children: plan.series.map((item, seriesIndex) => {
508
+ const isSelected = highlightBar?.seriesId === item.id;
509
+ return /*#__PURE__*/_jsxs(View, {
510
+ className: barChartLegendItemVariants(),
511
+ ...dataAttributes({
512
+ slot: 'bar-chart-legend-item'
513
+ }),
514
+ children: [/*#__PURE__*/_jsx(View, {
515
+ className: "h-2 w-3 rounded-sm",
516
+ style: {
517
+ backgroundColor: fills[seriesIndex]
518
+ }
519
+ }), /*#__PURE__*/_jsx(Text, {
520
+ className: barChartLegendLabelVariants({
521
+ selected: isSelected
522
+ }),
523
+ children: item.label !== undefined && item.label.length > 0 ? item.label : localeText.defaultSeriesLabel
524
+ })]
525
+ }, item.id);
526
+ })
527
+ }) : null]
528
+ });
529
+ }
530
+
531
+ /**
532
+ * Category bars from `dataset` rows. MUI X Charts–shaped: `series[].dataKey`, axis arrays,
533
+ * `layout`, `stack` groups, and `selectedItem`.
534
+ */
535
+ export const BarChart = /*#__PURE__*/forwardRef(BarChartInner);
536
+ BarChart.displayName = 'BarChart';
537
+ function BarPlot({
538
+ layout,
539
+ orientation,
540
+ overlay,
541
+ waterfall,
542
+ showGrid,
543
+ barLabel,
544
+ formatBar,
545
+ formatStackTotal,
546
+ fills,
547
+ gradientId,
548
+ chrome,
549
+ accent,
550
+ borderRadius,
551
+ animated,
552
+ highlightBar,
553
+ emphasizedIndex
554
+ }) {
555
+ const labeledBars = layout.bars.filter(bar => {
556
+ if (bar.stackId !== undefined) {
557
+ return false;
558
+ }
559
+ if (emphasizedIndex !== undefined && bar.index !== emphasizedIndex) {
560
+ return false;
561
+ }
562
+ return !overlay || bar.seriesIndex === 0;
563
+ });
564
+ const stackLabels = stackedTotalAnchors(layout.bars, orientation).filter(anchor => emphasizedIndex === undefined || anchor.index === emphasizedIndex);
565
+ const paintedBars = overlay ? [...layout.bars].sort((a, b) => b.seriesIndex - a.seriesIndex) : layout.bars;
566
+ return /*#__PURE__*/_jsxs(_Fragment, {
567
+ children: [/*#__PURE__*/_jsx(ChartLinearFills, {
568
+ idPrefix: gradientId,
569
+ colors: fills,
570
+ x2: orientation === 'vertical' ? '0%' : '100%',
571
+ y2: orientation === 'vertical' ? '100%' : '0%'
572
+ }), showGrid ? layout.gridLines.map(line => /*#__PURE__*/_jsx(Line, {
573
+ x1: line.x1,
574
+ y1: line.y1,
575
+ x2: line.x2,
576
+ y2: line.y2,
577
+ stroke: chrome.grid,
578
+ strokeWidth: 1
579
+ }, `grid-${String(line.x1)}-${String(line.y1)}`)) : /*#__PURE__*/_jsx(Line, {
580
+ x1: orientation === 'vertical' ? layout.plot.x : layout.baseline,
581
+ y1: orientation === 'vertical' ? layout.baseline : layout.plot.y,
582
+ x2: orientation === 'vertical' ? layout.plot.x + layout.plot.width : layout.baseline,
583
+ y2: orientation === 'vertical' ? layout.baseline : layout.plot.y + layout.plot.height,
584
+ stroke: chrome.grid,
585
+ strokeWidth: 1
586
+ }), layout.referenceLines.map((line, index) => /*#__PURE__*/_jsxs(G, {
587
+ children: [/*#__PURE__*/_jsx(Line, {
588
+ x1: line.x1,
589
+ y1: line.y1,
590
+ x2: line.x2,
591
+ y2: line.y2,
592
+ stroke: accent,
593
+ strokeWidth: 1,
594
+ strokeDasharray: DASH
595
+ }), line.label !== undefined && line.label.length > 0 ? /*#__PURE__*/_jsx(SvgText, {
596
+ x: line.x1 + 4,
597
+ y: orientation === 'vertical' ? line.y1 - 4 : line.y1 + 12,
598
+ fill: accent,
599
+ fontFamily: chrome.fontFamily,
600
+ fontSize: chrome.captionSize,
601
+ textAnchor: "start",
602
+ children: line.label
603
+ }) : null]
604
+ }, `ref-${String(line.x1)}-${String(line.y1)}-${String(index)}`)), layout.connectors.map((line, index) => /*#__PURE__*/_jsx(Line, {
605
+ x1: line.x1,
606
+ y1: line.y1,
607
+ x2: line.x2,
608
+ y2: line.y2,
609
+ stroke: chrome.grid,
610
+ strokeWidth: 1,
611
+ strokeDasharray: DASH
612
+ }, `wf-${String(line.x1)}-${String(line.y1)}-${String(index)}`)), paintedBars.map(bar => {
613
+ if (bar.width <= 0 || bar.height <= 0) {
614
+ return null;
615
+ }
616
+ const dimmed = highlightBar !== null && (bar.stackId !== undefined ? !sameItem(highlightBar, barSelection(bar)) : highlightBar.dataIndex !== bar.index);
617
+ const muted = emphasizedIndex !== undefined && bar.index !== emphasizedIndex;
618
+ const comparison = overlay && bar.seriesIndex > 0;
619
+ return /*#__PURE__*/_jsx(AnimatedBar, {
620
+ bar: bar,
621
+ orientation: orientation,
622
+ baseline: layout.baseline,
623
+ animated: animated,
624
+ fill: muted || waterfall && dimmed ? chrome.grid : comparison || waterfall ? fills[bar.seriesIndex] ?? chrome.grid : chartFillUrl(gradientId, bar.seriesIndex),
625
+ opacity: waterfall ? 1 : dimmed ? INACTIVE_OPACITY : 1,
626
+ radius: borderRadius
627
+ }, `${String(bar.index)}-${bar.seriesId}`);
628
+ }), layout.categoryLabels.map((item, index) => /*#__PURE__*/_jsx(SvgText, {
629
+ x: item.x,
630
+ y: item.y,
631
+ fill: chrome.label,
632
+ fontFamily: chrome.fontFamily,
633
+ fontSize: chrome.labelSize,
634
+ textAnchor: item.textAnchor,
635
+ alignmentBaseline: "middle",
636
+ children: item.label
637
+ }, `cat-${String(index)}-${item.label}`)), barLabel ? /*#__PURE__*/_jsx(ValueLabels, {
638
+ animated: animated,
639
+ motionKey: `${orientation}-${overlay ? '1' : '0'}-${layout.bars.map(bar => [bar.x, bar.y, bar.width, bar.height].join(',')).join(';')}`,
640
+ children: labelOpacity => /*#__PURE__*/_jsxs(_Fragment, {
641
+ children: [stackLabels.map(label => /*#__PURE__*/_jsx(SvgText, {
642
+ x: label.x,
643
+ y: label.y,
644
+ fill: chrome.label,
645
+ fillOpacity: labelOpacity,
646
+ fontFamily: chrome.fontFamily,
647
+ fontSize: chrome.captionSize,
648
+ textAnchor: label.textAnchor,
649
+ alignmentBaseline: "middle",
650
+ children: formatStackTotal(label)
651
+ }, `stack-val-${label.key}`)), labeledBars.map(bar => {
652
+ const anchor = waterfall ? waterfallValueAnchor(bar, orientation) : barValueAnchor(bar, orientation);
653
+ return /*#__PURE__*/_jsx(G, {
654
+ children: /*#__PURE__*/_jsx(SvgText, {
655
+ x: anchor.x,
656
+ y: anchor.y,
657
+ fill: chrome.label,
658
+ fillOpacity: labelOpacity,
659
+ fontFamily: chrome.fontFamily,
660
+ fontSize: chrome.captionSize,
661
+ textAnchor: anchor.textAnchor,
662
+ alignmentBaseline: "middle",
663
+ children: formatBar(bar, 'label')
664
+ })
665
+ }, `val-${String(bar.index)}-${bar.seriesId}`);
666
+ })]
667
+ })
668
+ }) : null]
669
+ });
670
+ }
671
+ function barTooltipContent(group, bar, trigger, fills, fallbackFill, formatBar, seriesLabelOf) {
672
+ const shown = trigger === 'axis' ? group : [bar];
673
+ return {
674
+ title: bar.label,
675
+ items: shown.map(item => ({
676
+ seriesId: item.seriesId,
677
+ label: seriesLabelOf(item),
678
+ color: fills[item.seriesIndex] ?? fallbackFill,
679
+ formattedValue: formatBar(item, 'tooltip')
680
+ }))
681
+ };
682
+ }
683
+
684
+ /**
685
+ * One hit target per drawn bar. Grouped bars get the full value-axis span of their slot so short
686
+ * bars stay easy to hover. Stacked segments keep their own rect, expanded to a 44px minimum
687
+ * (WCAG 2.5.8 / HIG) so a 9px-tall bar is still a usable touch target.
688
+ */
689
+ /** Targets in scroll-content coordinates, shifted left by `offsetX`. */
690
+ function barInspectorTargets({
691
+ bars,
692
+ layout,
693
+ orientation,
694
+ overlay,
695
+ waterfall,
696
+ trigger,
697
+ offsetX,
698
+ fills,
699
+ fallbackFill,
700
+ formatBar,
701
+ seriesLabelOf,
702
+ localeText,
703
+ selectedIndex
704
+ }) {
705
+ const {
706
+ plot
707
+ } = layout;
708
+ const vertical = orientation === 'vertical';
709
+ const groups = new Map();
710
+ bars.forEach(bar => {
711
+ const group = groups.get(bar.index);
712
+ if (group === undefined) {
713
+ groups.set(bar.index, [bar]);
714
+ } else {
715
+ group.push(bar);
716
+ }
717
+ });
718
+ const outlines = new Map([...groups].map(([categoryIndex, group]) => {
719
+ const start = Math.min(...group.map(item => vertical ? item.x : item.y));
720
+ const end = Math.max(...group.map(item => vertical ? item.x + item.width : item.y + item.height));
721
+ const outline = vertical ? {
722
+ left: start - offsetX - 4,
723
+ top: plot.y,
724
+ width: end - start + 8,
725
+ height: plot.height
726
+ } : {
727
+ left: plot.x - offsetX,
728
+ top: start - 4,
729
+ width: plot.width,
730
+ height: end - start + 8
731
+ };
732
+ return [categoryIndex, outline];
733
+ }));
734
+ const trendText = bar => {
735
+ if (!overlay || bar.seriesIndex !== 0) {
736
+ return null;
737
+ }
738
+ const group = groups.get(bar.index) ?? [];
739
+ const delta = overlayDelta(group, bar.index);
740
+ if (delta === null) {
741
+ return null;
742
+ }
743
+ const comparison = group.find(item => item.seriesIndex === 1);
744
+ return localeText.trend({
745
+ direction: delta > 0 ? 'up' : delta < 0 ? 'down' : 'none',
746
+ formattedDelta: formatBar({
747
+ ...bar,
748
+ value: Math.abs(delta)
749
+ }, 'a11y'),
750
+ comparisonLabel: comparison?.seriesLabel ?? ''
751
+ });
752
+ };
753
+ return bars.map((bar, index) => {
754
+ const x = bar.x - offsetX;
755
+ const raw = bar.stackId !== undefined || waterfall || !vertical ? {
756
+ left: x,
757
+ top: bar.y,
758
+ width: bar.width,
759
+ height: bar.height
760
+ } : {
761
+ left: x,
762
+ top: plot.y,
763
+ width: bar.width,
764
+ height: plot.height
765
+ };
766
+ const box = expandHitBox(raw.left, raw.top, raw.width, raw.height);
767
+ const group = groups.get(bar.index) ?? [bar];
768
+ const outline = outlines.get(bar.index);
769
+ return {
770
+ key: `hit-${String(bar.index)}-${bar.seriesId}`,
771
+ ...box,
772
+ outline,
773
+ anchorX: vertical ? x + bar.width / 2 : x + bar.width,
774
+ anchorY: bar.y,
775
+ anchorRadius: vertical ? bar.width / 2 : 0,
776
+ tooltip: barTooltipContent(group, bar, trigger === 'item' ? 'item' : 'axis', fills, fallbackFill, formatBar, seriesLabelOf),
777
+ accessibilityLabel: barAccessibilityName(bar.label, seriesLabelOf(bar), formatBar(bar, 'a11y'), trendText(bar)),
778
+ selected: selectedIndex === index
779
+ };
780
+ });
781
+ }
782
+ function BarInspector({
783
+ bars,
784
+ targets,
785
+ orientation,
786
+ summary,
787
+ selectable,
788
+ activeIndex,
789
+ selectedIndex,
790
+ onActivate,
791
+ onDeactivate,
792
+ onDismiss,
793
+ onSelectIndex,
794
+ holdToScrub,
795
+ onScrubLockChange
796
+ }) {
797
+ return /*#__PURE__*/_jsx(ChartInspector, {
798
+ targets: targets,
799
+ summary: summary,
800
+ selectable: selectable,
801
+ activeIndex: activeIndex,
802
+ selectedIndex: selectedIndex,
803
+ slot: "bar-chart",
804
+ holdToScrub: holdToScrub,
805
+ onScrubLockChange: onScrubLockChange,
806
+ hitTest: (x, y) => {
807
+ let best = null;
808
+ let bestDist = Number.POSITIVE_INFINITY;
809
+ targets.forEach((target, index) => {
810
+ if (x < target.left || x > target.left + target.width || y < target.top || y > target.top + target.height) {
811
+ return;
812
+ }
813
+ const dist = Math.hypot(x - (target.left + target.width / 2), y - (target.top + target.height / 2));
814
+ if (dist < bestDist) {
815
+ bestDist = dist;
816
+ best = index;
817
+ }
818
+ });
819
+ return best;
820
+ },
821
+ onActivate: onActivate,
822
+ onDeactivate: onDeactivate,
823
+ onDismiss: onDismiss,
824
+ onSelectIndex: onSelectIndex,
825
+ neighborIndex: (index, key) => barKeyboardNeighbor(bars, index, key, orientation)
826
+ });
827
+ }
828
+ function collapsedBar(bar, orientation, baseline) {
829
+ if (orientation === 'vertical') {
830
+ const onBaseline = Math.abs((bar.plotValue >= 0 ? bar.y + bar.height : bar.y) - baseline) < 1;
831
+ return onBaseline ? [bar.x, baseline, bar.width, 0] : [bar.x, bar.y + bar.height, bar.width, 0];
832
+ }
833
+ const onBaseline = Math.abs((bar.plotValue >= 0 ? bar.x : bar.x + bar.width) - baseline) < 1;
834
+ return onBaseline ? [baseline, bar.y, 0, bar.height] : [bar.x, bar.y, 0, bar.height];
835
+ }
836
+ function AnimatedBar({
837
+ bar,
838
+ orientation,
839
+ baseline,
840
+ animated,
841
+ fill,
842
+ opacity,
843
+ radius
844
+ }) {
845
+ const {
846
+ rounded,
847
+ roundAll,
848
+ value
849
+ } = bar;
850
+ const morph = useChartMorph([bar.x, bar.y, bar.width, bar.height], collapsedBar(bar, orientation, baseline), animated);
851
+ const {
852
+ from,
853
+ to,
854
+ progress
855
+ } = morph;
856
+ const animatedProps = useAnimatedProps(() => {
857
+ const [x = 0, y = 0, width = 0, height = 0] = lerpVector(from.get(), to.get(), progress.get());
858
+ return {
859
+ d: barPath({
860
+ x,
861
+ y,
862
+ width,
863
+ height,
864
+ rounded,
865
+ roundAll,
866
+ value
867
+ }, orientation, radius)
868
+ };
869
+ }, [from, to, progress, rounded, roundAll, value, orientation, radius]);
870
+ return /*#__PURE__*/_jsx(AnimatedPath, {
871
+ animatedProps: animatedProps,
872
+ fill: fill,
873
+ opacity: opacity
874
+ });
875
+ }
876
+ function ValueLabels({
877
+ animated,
878
+ motionKey,
879
+ children
880
+ }) {
881
+ const [shownKey, setShownKey] = useState(animated ? null : motionKey);
882
+ useEffect(() => {
883
+ if (!animated) {
884
+ setShownKey(motionKey);
885
+ return;
886
+ }
887
+ const id = setTimeout(() => setShownKey(motionKey), CHART_MOTION_DURATION);
888
+ return () => {
889
+ clearTimeout(id);
890
+ };
891
+ }, [animated, motionKey]);
892
+ if (!animated) {
893
+ return /*#__PURE__*/_jsx(_Fragment, {
894
+ children: children(1)
895
+ });
896
+ }
897
+ if (shownKey !== motionKey) {
898
+ return null;
899
+ }
900
+ return /*#__PURE__*/_jsx(FadeInLabels, {
901
+ children: children
902
+ }, motionKey);
903
+ }
904
+
905
+ /** Group opacity on native SVG flashes a full-opacity frame; fade each text's fill instead. */
906
+ function FadeInLabels({
907
+ children
908
+ }) {
909
+ const [opacity, setOpacity] = useState(0);
910
+ useEffect(() => {
911
+ let frame = 0;
912
+ const started = Date.now();
913
+ const tick = () => {
914
+ const t = Math.min(1, (Date.now() - started) / LABEL_FADE_DURATION);
915
+ setOpacity(1 - (1 - t) ** 3);
916
+ if (t < 1) {
917
+ frame = requestAnimationFrame(tick);
918
+ }
919
+ };
920
+ frame = requestAnimationFrame(tick);
921
+ return () => {
922
+ cancelAnimationFrame(frame);
923
+ };
924
+ }, []);
925
+ return /*#__PURE__*/_jsx(_Fragment, {
926
+ children: children(opacity)
927
+ });
928
+ }
929
+ //# sourceMappingURL=index.js.map