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