@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,698 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MIN_LINE_POINT_BAND = exports.LINE_POINT_HIT_PX = exports.LINE_POINTER_HIT_PX = exports.LINE_MARKER_PADDING_TOP = exports.LINE_MARKER_PADDING_RIGHT = exports.DEFAULT_LINE_TICK_NUMBER = void 0;
7
+ exports.layoutLineChart = layoutLineChart;
8
+ exports.layoutLineChartMarkers = layoutLineChartMarkers;
9
+ exports.lineChartGutters = lineChartGutters;
10
+ exports.lineChartMarkerGutters = lineChartMarkerGutters;
11
+ exports.lineSeriesPaths = lineSeriesPaths;
12
+ exports.lineValueDomain = lineValueDomain;
13
+ exports.nearestCategoryInPlot = nearestCategoryInPlot;
14
+ exports.nearestCategoryOnLines = nearestCategoryOnLines;
15
+ exports.resolveLineChartContentSize = resolveLineChartContentSize;
16
+ exports.resolveLineChartData = resolveLineChartData;
17
+ var _ticks = require("../chart/ticks");
18
+ /** How points connect. Names match MUI X `curve`. */
19
+
20
+ const MIN_LINE_POINT_BAND = exports.MIN_LINE_POINT_BAND = 32;
21
+ /** Max distance from a series stroke (overlay px) that still counts as hovering the line. */
22
+ const LINE_POINTER_HIT_PX = exports.LINE_POINTER_HIT_PX = 20;
23
+ /** Extra radius around a plotted point (dots / markers) so a valley like Lowest is easy to hit. */
24
+ const LINE_POINT_HIT_PX = exports.LINE_POINT_HIT_PX = 28;
25
+ /** Extra plot padding when a marker draws a caption or value. */
26
+ const LINE_MARKER_PADDING_TOP = exports.LINE_MARKER_PADDING_TOP = 28;
27
+ const LINE_MARKER_PADDING_RIGHT = exports.LINE_MARKER_PADDING_RIGHT = 36;
28
+ const DEFAULT_LINE_TICK_NUMBER = exports.DEFAULT_LINE_TICK_NUMBER = 4;
29
+ const VALUE_TICK_LEFT = 40;
30
+ const VALUE_TICK_END = 28;
31
+ const TIGHT_GUTTER = 8;
32
+ const PLOT_END_GUTTER = 20;
33
+ const CATEGORY_GUTTER = 28;
34
+ function round2(value) {
35
+ 'worklet';
36
+
37
+ const rounded = Math.round(value * 100) / 100;
38
+ return Object.is(rounded, -0) ? 0 : rounded;
39
+ }
40
+ function readNumber(row, key) {
41
+ const raw = row[key];
42
+ if (typeof raw !== 'number' || !Number.isFinite(raw)) {
43
+ return null;
44
+ }
45
+ return raw;
46
+ }
47
+ function rawCategory(row, key, index) {
48
+ if (key === undefined || row === undefined) {
49
+ return index;
50
+ }
51
+ return row[key];
52
+ }
53
+ function categoryText(raw, index, location, axis) {
54
+ if (typeof raw === 'string') {
55
+ return raw;
56
+ }
57
+ if (typeof raw === 'number') {
58
+ return axis?.valueFormatter?.(raw, {
59
+ location,
60
+ dataIndex: index
61
+ }) ?? String(raw);
62
+ }
63
+ if (raw === null || raw === undefined) {
64
+ return '';
65
+ }
66
+ return String(raw);
67
+ }
68
+
69
+ /**
70
+ * Maps the public `dataset` + `series` + `xAxis` props onto geometry inputs. Row keys are read
71
+ * only through `dataKey`, so no key is reserved.
72
+ */
73
+ function resolveLineChartData({
74
+ dataset,
75
+ series,
76
+ xAxis
77
+ }) {
78
+ const axis = xAxis;
79
+ const interval = axis?.tickLabelInterval;
80
+ const hidden = axis?.position === 'none';
81
+ const categories = dataset.map((row, index) => {
82
+ const raw = rawCategory(row, axis?.dataKey, index);
83
+ const label = categoryText(raw, index, 'tick', axis);
84
+ const shown = typeof interval === 'function' ? interval(raw, index) : true;
85
+ return {
86
+ label,
87
+ title: categoryText(raw, index, 'tooltip', axis),
88
+ tick: !hidden && shown && label.length > 0
89
+ };
90
+ });
91
+ const inputs = series.map(item => {
92
+ const dashed = item.dashed === true;
93
+ const dashAt = dashed || item.dashedFrom === undefined || !Number.isInteger(item.dashedFrom) ? -1 : item.dashedFrom;
94
+ return {
95
+ id: item.id,
96
+ label: item.label ?? '',
97
+ curve: item.curve ?? 'monotoneX',
98
+ area: item.area === true,
99
+ dashed,
100
+ dashAt,
101
+ values: dataset.map(row => readNumber(row, item.dataKey))
102
+ };
103
+ });
104
+ return {
105
+ categories,
106
+ series: inputs
107
+ };
108
+ }
109
+ function lineChartGutters({
110
+ showValueTicks = true,
111
+ showCategoryLabels = true
112
+ } = {}) {
113
+ return {
114
+ paddingLeft: showValueTicks ? VALUE_TICK_LEFT : TIGHT_GUTTER,
115
+ paddingRight: showValueTicks ? VALUE_TICK_END : PLOT_END_GUTTER,
116
+ paddingTop: TIGHT_GUTTER,
117
+ paddingBottom: showCategoryLabels ? CATEGORY_GUTTER : TIGHT_GUTTER
118
+ };
119
+ }
120
+ function resolveLineChartContentSize({
121
+ viewportWidth,
122
+ viewportHeight,
123
+ categoryCount,
124
+ gutters,
125
+ scrollable,
126
+ visiblePoints
127
+ }) {
128
+ if (!scrollable || categoryCount <= 0) {
129
+ return {
130
+ width: viewportWidth,
131
+ height: viewportHeight
132
+ };
133
+ }
134
+ const plotWidth = Math.max(viewportWidth - gutters.paddingLeft - gutters.paddingRight, 0);
135
+ const band = visiblePoints !== undefined && visiblePoints > 0 ? plotWidth / Math.max(visiblePoints - 1, 1) : MIN_LINE_POINT_BAND;
136
+ const contentPlot = Math.max(plotWidth, Math.max(categoryCount - 1, 1) * band);
137
+ return {
138
+ width: contentPlot + gutters.paddingLeft + gutters.paddingRight,
139
+ height: viewportHeight
140
+ };
141
+ }
142
+
143
+ /**
144
+ * Value domain and ticks. `min` / `max` pin that end exactly; an open end rounds to a readable
145
+ * tick. `tickNumber` is approximate.
146
+ */
147
+ function lineValueDomain(values, {
148
+ min: minOption,
149
+ max: maxOption,
150
+ tickNumber = DEFAULT_LINE_TICK_NUMBER
151
+ } = {}) {
152
+ const min = minOption !== undefined && Number.isFinite(minOption) ? minOption : undefined;
153
+ const max = maxOption !== undefined && Number.isFinite(maxOption) ? maxOption : undefined;
154
+ let low = min ?? (values.length > 0 ? Math.min(...values) : 0);
155
+ let high = max ?? (values.length > 0 ? Math.max(...values) : 1);
156
+ if (low > high) {
157
+ [low, high] = [high, low];
158
+ }
159
+ if (low === high) {
160
+ if (min === undefined) {
161
+ low -= 1;
162
+ }
163
+ if (max === undefined || min !== undefined) {
164
+ high += 1;
165
+ }
166
+ }
167
+ const nice = (0, _ticks.niceTicks)(low, high, tickNumber);
168
+ const domainMin = min ?? nice[0] ?? low;
169
+ const domainMax = max ?? nice[nice.length - 1] ?? high;
170
+ const epsilon = (domainMax - domainMin) * 1e-9;
171
+ const ticks = nice.filter(tick => tick >= domainMin - epsilon && tick <= domainMax + epsilon);
172
+ return {
173
+ min: domainMin,
174
+ max: domainMax,
175
+ ticks
176
+ };
177
+ }
178
+ function coord(x, y) {
179
+ 'worklet';
180
+
181
+ return `${String(round2(x))} ${String(round2(y))}`;
182
+ }
183
+ function linearPath(points) {
184
+ 'worklet';
185
+
186
+ return points.map((point, index) => `${index === 0 ? 'M' : 'L'} ${coord(point.x, point.y)}`).join(' ');
187
+ }
188
+ function stepPath(points) {
189
+ 'worklet';
190
+
191
+ if (points.length === 0) {
192
+ return '';
193
+ }
194
+ const parts = [`M ${coord(points[0].x, points[0].y)}`];
195
+ for (let index = 1; index < points.length; index += 1) {
196
+ const prev = points[index - 1];
197
+ const point = points[index];
198
+ parts.push(`L ${coord(point.x, prev.y)}`, `L ${coord(point.x, point.y)}`);
199
+ }
200
+ return parts.join(' ');
201
+ }
202
+ function monotoneControls(points) {
203
+ 'worklet';
204
+
205
+ const count = points.length;
206
+ const dx = [];
207
+ const slope = [];
208
+ for (let index = 0; index < count - 1; index += 1) {
209
+ const deltaX = points[index + 1].x - points[index].x;
210
+ dx.push(deltaX);
211
+ slope.push(deltaX === 0 ? 0 : (points[index + 1].y - points[index].y) / deltaX);
212
+ }
213
+ const tangent = [slope[0]];
214
+ for (let index = 1; index < count - 1; index += 1) {
215
+ tangent.push(slope[index - 1] * slope[index] <= 0 ? 0 : (slope[index - 1] + slope[index]) / 2);
216
+ }
217
+ tangent.push(slope[count - 2]);
218
+ for (let index = 0; index < count - 1; index += 1) {
219
+ if (Math.abs(slope[index]) < 1e-8) {
220
+ tangent[index] = 0;
221
+ tangent[index + 1] = 0;
222
+ continue;
223
+ }
224
+ const alpha = tangent[index] / slope[index];
225
+ const beta = tangent[index + 1] / slope[index];
226
+ const magnitude = alpha * alpha + beta * beta;
227
+ if (magnitude > 9) {
228
+ const scale = 3 / Math.sqrt(magnitude);
229
+ tangent[index] = scale * alpha * slope[index];
230
+ tangent[index + 1] = scale * beta * slope[index];
231
+ }
232
+ }
233
+ return {
234
+ dx,
235
+ tangent
236
+ };
237
+ }
238
+ function monotonePathSlice(points, from, to) {
239
+ 'worklet';
240
+
241
+ const count = points.length;
242
+ if (count === 0 || to < from || from < 0 || to > count - 1) {
243
+ return '';
244
+ }
245
+ if (from === to) {
246
+ return `M ${coord(points[from].x, points[from].y)}`;
247
+ }
248
+ if (count === 2) {
249
+ return linearPath(points.slice(from, to + 1));
250
+ }
251
+ const {
252
+ dx,
253
+ tangent
254
+ } = monotoneControls(points);
255
+ const parts = [`M ${coord(points[from].x, points[from].y)}`];
256
+ for (let index = from; index < to; index += 1) {
257
+ const start = points[index];
258
+ const end = points[index + 1];
259
+ const handle = dx[index] / 3;
260
+ parts.push(`C ${coord(start.x + handle, start.y + tangent[index] * handle)} ${coord(end.x - handle, end.y - tangent[index + 1] * handle)} ${coord(end.x, end.y)}`);
261
+ }
262
+ return parts.join(' ');
263
+ }
264
+ function monotonePath(points) {
265
+ 'worklet';
266
+
267
+ if (points.length === 0) {
268
+ return '';
269
+ }
270
+ return monotonePathSlice(points, 0, points.length - 1);
271
+ }
272
+ function pathForCurve(points, curve) {
273
+ 'worklet';
274
+
275
+ if (curve === 'stepAfter') {
276
+ return stepPath(points);
277
+ }
278
+ if (curve === 'monotoneX') {
279
+ return monotonePath(points);
280
+ }
281
+ return linearPath(points);
282
+ }
283
+ function pathSlice(points, curve, from, to) {
284
+ 'worklet';
285
+
286
+ if (to <= from) {
287
+ return '';
288
+ }
289
+ if (curve === 'monotoneX') {
290
+ return monotonePathSlice(points, from, to);
291
+ }
292
+ return pathForCurve(points.slice(from, to + 1), curve);
293
+ }
294
+ function areaFromLine(linePath, run, baselineY) {
295
+ 'worklet';
296
+
297
+ if (linePath.length === 0 || run.length === 0) {
298
+ return '';
299
+ }
300
+ const first = run[0];
301
+ const last = run[run.length - 1];
302
+ return `${linePath} L ${coord(last.x, baselineY)} L ${coord(first.x, baselineY)} Z`;
303
+ }
304
+
305
+ /**
306
+ * Line and area paths for one series. `ys` uses `NaN` for missing values, which
307
+ * open a gap. Runs on the UI thread while a chart animates.
308
+ * `dashAt` is a category index; cubics before it stay solid, after it dashed,
309
+ * using the same monotone tangents so the join stays round.
310
+ */
311
+ function lineSeriesPaths(xs, ys, curve, baselineY, dashAt = -1) {
312
+ 'worklet';
313
+
314
+ const runs = [];
315
+ let current = [];
316
+ for (let index = 0; index < ys.length; index += 1) {
317
+ const y = ys[index];
318
+ if (!Number.isFinite(y)) {
319
+ if (current.length > 0) {
320
+ runs.push(current);
321
+ current = [];
322
+ }
323
+ continue;
324
+ }
325
+ current.push({
326
+ x: xs[index] ?? 0,
327
+ y,
328
+ index
329
+ });
330
+ }
331
+ if (current.length > 0) {
332
+ runs.push(current);
333
+ }
334
+ const solids = [];
335
+ const dashes = [];
336
+ const areas = [];
337
+ for (const run of runs) {
338
+ const line = pathForCurve(run, curve);
339
+ areas.push(areaFromLine(line, run, baselineY));
340
+ const first = run[0]?.index ?? -1;
341
+ const last = run[run.length - 1]?.index ?? -1;
342
+ if (dashAt < 0 || dashAt <= first || dashAt >= last) {
343
+ if (dashAt >= 0 && dashAt <= first) {
344
+ dashes.push(line);
345
+ } else {
346
+ solids.push(line);
347
+ }
348
+ continue;
349
+ }
350
+ const split = run.findIndex(point => point.index === dashAt);
351
+ if (split <= 0) {
352
+ solids.push(line);
353
+ continue;
354
+ }
355
+ solids.push(pathSlice(run, curve, 0, split));
356
+ dashes.push(pathSlice(run, curve, split, run.length - 1));
357
+ }
358
+ return {
359
+ path: solids.join(' '),
360
+ dashedPath: dashes.join(' '),
361
+ areaPath: areas.join(' ')
362
+ };
363
+ }
364
+
365
+ /** Pins each marker to its `dataIndex` row; markers that cannot resolve are dropped. */
366
+ function layoutLineChartMarkers(markers, series) {
367
+ return markers.flatMap((marker, markerIndex) => {
368
+ const index = marker.dataIndex;
369
+ if (!Number.isInteger(index)) {
370
+ return [];
371
+ }
372
+ const seriesItem = marker.seriesId !== undefined ? series.find(item => item.key === marker.seriesId) : series.find(item => item.points[index]?.y != null);
373
+ const point = seriesItem?.points[index];
374
+ if (seriesItem === undefined || point?.y == null || point.value == null) {
375
+ return [];
376
+ }
377
+ return [{
378
+ key: `${seriesItem.key}-${String(index)}-${String(markerIndex)}`,
379
+ index,
380
+ seriesIndex: series.indexOf(seriesItem),
381
+ seriesId: seriesItem.key,
382
+ x: point.x,
383
+ y: point.y,
384
+ value: point.value,
385
+ label: marker.label,
386
+ showValue: marker.showValue === true,
387
+ color: marker.color,
388
+ legend: marker.legend,
389
+ guide: marker.guide !== false,
390
+ dot: marker.dot !== false
391
+ }];
392
+ });
393
+ }
394
+ function distanceToSegment(px, py, ax, ay, bx, by) {
395
+ const dx = bx - ax;
396
+ const dy = by - ay;
397
+ const length = dx * dx + dy * dy;
398
+ if (length === 0) {
399
+ return Math.hypot(px - ax, py - ay);
400
+ }
401
+ const t = Math.max(0, Math.min(1, ((px - ax) * dx + (py - ay) * dy) / length));
402
+ return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));
403
+ }
404
+ function cubicPoint(t, p0, p1, p2, p3) {
405
+ const u = 1 - t;
406
+ const a = u * u * u;
407
+ const b = 3 * u * u * t;
408
+ const c = 3 * u * t * t;
409
+ const d = t * t * t;
410
+ return {
411
+ x: a * p0.x + b * p1.x + c * p2.x + d * p3.x,
412
+ y: a * p0.y + b * p1.y + c * p2.y + d * p3.y
413
+ };
414
+ }
415
+ function sampleMonotoneRun(points) {
416
+ if (points.length < 3) {
417
+ return [...points];
418
+ }
419
+ const count = points.length;
420
+ const dx = [];
421
+ const slope = [];
422
+ for (let index = 0; index < count - 1; index += 1) {
423
+ const from = points[index];
424
+ const to = points[index + 1];
425
+ if (from === undefined || to === undefined) {
426
+ continue;
427
+ }
428
+ const deltaX = to.x - from.x;
429
+ dx.push(deltaX);
430
+ slope.push(deltaX === 0 ? 0 : (to.y - from.y) / deltaX);
431
+ }
432
+ const tangent = [slope[0] ?? 0];
433
+ for (let index = 1; index < count - 1; index += 1) {
434
+ tangent.push((slope[index - 1] ?? 0) * (slope[index] ?? 0) <= 0 ? 0 : ((slope[index - 1] ?? 0) + (slope[index] ?? 0)) / 2);
435
+ }
436
+ tangent.push(slope[count - 2] ?? 0);
437
+ for (let index = 0; index < count - 1; index += 1) {
438
+ if (Math.abs(slope[index] ?? 0) < 1e-8) {
439
+ tangent[index] = 0;
440
+ tangent[index + 1] = 0;
441
+ }
442
+ }
443
+ const sampled = [];
444
+ const steps = 8;
445
+ for (let index = 0; index < count - 1; index += 1) {
446
+ const start = points[index];
447
+ const end = points[index + 1];
448
+ if (start === undefined || end === undefined) {
449
+ continue;
450
+ }
451
+ const handle = (dx[index] ?? 0) / 3;
452
+ const c1 = {
453
+ x: start.x + handle,
454
+ y: start.y + (tangent[index] ?? 0) * handle
455
+ };
456
+ const c2 = {
457
+ x: end.x - handle,
458
+ y: end.y - (tangent[index + 1] ?? 0) * handle
459
+ };
460
+ for (let step = 0; step < steps; step += 1) {
461
+ const t = step / steps;
462
+ const point = cubicPoint(t, start, c1, c2, end);
463
+ sampled.push({
464
+ x: point.x,
465
+ y: point.y,
466
+ index: t < 0.5 ? start.index : end.index
467
+ });
468
+ }
469
+ }
470
+ const last = points[count - 1];
471
+ if (last !== undefined) {
472
+ sampled.push(last);
473
+ }
474
+ return sampled;
475
+ }
476
+ function strokeSamples(points, curve) {
477
+ if (curve === 'monotoneX') {
478
+ return sampleMonotoneRun(points);
479
+ }
480
+ if (curve === 'stepAfter') {
481
+ const sampled = [];
482
+ for (let index = 0; index < points.length; index += 1) {
483
+ const from = points[index];
484
+ const to = points[index + 1];
485
+ if (from === undefined) {
486
+ continue;
487
+ }
488
+ sampled.push(from);
489
+ if (to !== undefined) {
490
+ sampled.push({
491
+ x: to.x,
492
+ y: from.y,
493
+ index: from.index
494
+ });
495
+ }
496
+ }
497
+ return sampled;
498
+ }
499
+ return [...points];
500
+ }
501
+
502
+ /**
503
+ * Category index of the closest point on any series stroke, or `null` when the pointer is
504
+ * farther than `maxDistance` from every line. Overlay coordinates (`plot.x` already subtracted).
505
+ * Uses the same monotone cubics as the painted path so a valley (Lowest) still hits.
506
+ */
507
+ function nearestCategoryOnLines(series, overlayX, overlayY, plotOffsetX, maxDistance, pointDistance = maxDistance) {
508
+ let bestDistance = Math.max(maxDistance, pointDistance);
509
+ let bestIndex = null;
510
+ for (const item of series) {
511
+ const points = item.points.flatMap(point => point.y == null ? [] : [{
512
+ x: point.x - plotOffsetX,
513
+ y: point.y,
514
+ index: point.index
515
+ }]);
516
+ for (const point of points) {
517
+ const distance = Math.hypot(overlayX - point.x, overlayY - point.y);
518
+ if (distance <= pointDistance && distance <= bestDistance) {
519
+ bestDistance = distance;
520
+ bestIndex = point.index;
521
+ }
522
+ }
523
+ const sampled = strokeSamples(points, item.curve);
524
+ for (let i = 0; i < sampled.length; i += 1) {
525
+ const from = sampled[i];
526
+ const to = sampled[i + 1];
527
+ if (from === undefined) {
528
+ continue;
529
+ }
530
+ const distance = to === undefined ? Math.hypot(overlayX - from.x, overlayY - from.y) : distanceToSegment(overlayX, overlayY, from.x, from.y, to.x, to.y);
531
+ if (distance > maxDistance || distance > bestDistance) {
532
+ continue;
533
+ }
534
+ bestDistance = distance;
535
+ if (to === undefined) {
536
+ bestIndex = from.index;
537
+ } else {
538
+ const closerToStart = Math.hypot(overlayX - from.x, overlayY - from.y) <= Math.hypot(overlayX - to.x, overlayY - to.y);
539
+ bestIndex = closerToStart ? from.index : to.index;
540
+ }
541
+ }
542
+ }
543
+ return bestIndex;
544
+ }
545
+
546
+ /**
547
+ * Category under the pointer when it is inside the plot box. Snaps to the nearest category on X.
548
+ * Overlay coordinates (`plot.x` already subtracted).
549
+ */
550
+ function nearestCategoryInPlot(labels, plot, overlayX, overlayY, plotOffsetX) {
551
+ if (labels.length === 0) {
552
+ return null;
553
+ }
554
+ if (overlayY < plot.y || overlayY > plot.y + plot.height) {
555
+ return null;
556
+ }
557
+ if (overlayX < 0 || overlayX > plot.width) {
558
+ return null;
559
+ }
560
+ let bestIndex = 0;
561
+ let bestDist = Number.POSITIVE_INFINITY;
562
+ labels.forEach((item, index) => {
563
+ const dist = Math.abs(item.x - plotOffsetX - overlayX);
564
+ if (dist < bestDist) {
565
+ bestDist = dist;
566
+ bestIndex = index;
567
+ }
568
+ });
569
+ return bestIndex;
570
+ }
571
+ function lineChartMarkerGutters(categoryCount, markers, base = lineChartGutters()) {
572
+ if (markers === undefined || markers.length === 0) {
573
+ return base;
574
+ }
575
+ const hasCaption = markers.some(marker => marker.label !== undefined && marker.label.length > 0 || marker.showValue === true);
576
+ const hasEndValue = markers.some(marker => marker.showValue === true && marker.dataIndex === categoryCount - 1);
577
+ return {
578
+ ...base,
579
+ paddingTop: hasCaption ? LINE_MARKER_PADDING_TOP : base.paddingTop,
580
+ paddingRight: hasEndValue ? LINE_MARKER_PADDING_RIGHT : base.paddingRight
581
+ };
582
+ }
583
+ function layoutLineChart({
584
+ categories,
585
+ series,
586
+ width,
587
+ height,
588
+ referenceLines = [],
589
+ yAxis,
590
+ formatTick = String,
591
+ gutters: guttersProp
592
+ }) {
593
+ const empty = {
594
+ series: [],
595
+ categoryLabels: [],
596
+ valueTicks: [],
597
+ gridLines: [],
598
+ referenceLines: [],
599
+ baselineY: 0,
600
+ plot: {
601
+ x: 0,
602
+ y: 0,
603
+ width: 0,
604
+ height: 0
605
+ }
606
+ };
607
+ if (width <= 0 || height <= 0 || categories.length === 0 || series.length === 0) {
608
+ return empty;
609
+ }
610
+ const gutters = guttersProp ?? lineChartGutters();
611
+ const plot = {
612
+ x: gutters.paddingLeft,
613
+ y: gutters.paddingTop,
614
+ width: Math.max(width - gutters.paddingLeft - gutters.paddingRight, 0),
615
+ height: Math.max(height - gutters.paddingTop - gutters.paddingBottom, 0)
616
+ };
617
+ const values = [...series.flatMap(item => item.values.filter(value => value !== null)), ...referenceLines.flatMap(line => Number.isFinite(line.value) ? [line.value] : [])];
618
+ const domain = lineValueDomain(values, yAxis);
619
+ const span = domain.max - domain.min || 1;
620
+ const lastIndex = Math.max(categories.length - 1, 1);
621
+ const valueToY = value => plot.y + plot.height * (1 - (value - domain.min) / span);
622
+ const indexToX = index => categories.length === 1 ? plot.x + plot.width / 2 : plot.x + index / lastIndex * plot.width;
623
+ const baselineY = valueToY(Math.min(Math.max(0, domain.min), domain.max));
624
+ const categoryLabels = categories.map((category, index) => ({
625
+ label: category.label,
626
+ title: category.title,
627
+ x: round2(indexToX(index)),
628
+ y: round2(height - 8),
629
+ tick: category.tick
630
+ }));
631
+ const seriesLayouts = series.map(item => {
632
+ const points = categories.map((_, index) => {
633
+ const value = item.values[index] ?? null;
634
+ return {
635
+ index,
636
+ value,
637
+ x: round2(indexToX(index)),
638
+ y: value === null ? null : round2(valueToY(value))
639
+ };
640
+ });
641
+ const dashAt = item.dashAt < categories.length ? item.dashAt : -1;
642
+ const {
643
+ path,
644
+ dashedPath,
645
+ areaPath
646
+ } = lineSeriesPaths(points.map(point => point.x), points.map(point => point.y ?? Number.NaN), item.curve, baselineY, dashAt);
647
+ return {
648
+ key: item.id,
649
+ label: item.label,
650
+ curve: item.curve,
651
+ area: item.area,
652
+ dashed: item.dashed,
653
+ path,
654
+ dashedPath,
655
+ dashAt,
656
+ areaPath,
657
+ points
658
+ };
659
+ });
660
+ const valueTicks = domain.ticks.map(value => ({
661
+ value,
662
+ x: round2(plot.x - 8),
663
+ y: round2(valueToY(value)),
664
+ text: formatTick(value)
665
+ }));
666
+ const gridLines = domain.ticks.map(value => {
667
+ const y = round2(valueToY(value));
668
+ return {
669
+ x1: round2(plot.x),
670
+ y1: y,
671
+ x2: round2(plot.x + plot.width),
672
+ y2: y
673
+ };
674
+ });
675
+ const laidReference = referenceLines.flatMap(line => {
676
+ if (!Number.isFinite(line.value)) {
677
+ return [];
678
+ }
679
+ const y = round2(valueToY(line.value));
680
+ return [{
681
+ x1: round2(plot.x),
682
+ y1: y,
683
+ x2: round2(plot.x + plot.width),
684
+ y2: y,
685
+ label: line.label
686
+ }];
687
+ });
688
+ return {
689
+ series: seriesLayouts,
690
+ categoryLabels,
691
+ valueTicks,
692
+ gridLines,
693
+ referenceLines: laidReference,
694
+ baselineY: round2(baselineY),
695
+ plot
696
+ };
697
+ }
698
+ //# sourceMappingURL=geometry.js.map