@semcore/d3-chart 18.0.0-prerelease.1 → 18.0.0-prerelease.5

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 (339) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/README.md +0 -1
  3. package/lib/cjs/Area.js +123 -23
  4. package/lib/cjs/Area.js.map +1 -1
  5. package/lib/cjs/Axis.js +109 -97
  6. package/lib/cjs/Axis.js.map +1 -1
  7. package/lib/cjs/Bar.js +16 -16
  8. package/lib/cjs/Bubble.js +14 -14
  9. package/lib/cjs/ChartMetaData.js +44 -0
  10. package/lib/cjs/ChartMetaData.js.map +1 -0
  11. package/lib/cjs/CompactHorizontalBar.js +17 -17
  12. package/lib/cjs/CompactHorizontalBar.js.map +1 -1
  13. package/lib/cjs/Donut.js +18 -19
  14. package/lib/cjs/Donut.js.map +1 -1
  15. package/lib/cjs/Dots.js +67 -13
  16. package/lib/cjs/Dots.js.map +1 -1
  17. package/lib/cjs/GroupBar.js +5 -2
  18. package/lib/cjs/GroupBar.js.map +1 -1
  19. package/lib/cjs/HorizontalBar.js +16 -16
  20. package/lib/cjs/Hover.js +55 -52
  21. package/lib/cjs/Hover.js.map +1 -1
  22. package/lib/cjs/Line.js +82 -17
  23. package/lib/cjs/Line.js.map +1 -1
  24. package/lib/cjs/Pattern.js +113 -2
  25. package/lib/cjs/Pattern.js.map +1 -1
  26. package/lib/cjs/Plot.js +5 -2
  27. package/lib/cjs/Plot.js.map +1 -1
  28. package/lib/cjs/Radar.js +19 -19
  29. package/lib/cjs/RadialTree.js +12 -12
  30. package/lib/cjs/Reference.js +55 -18
  31. package/lib/cjs/Reference.js.map +1 -1
  32. package/lib/cjs/ScatterPlot.js +9 -9
  33. package/lib/cjs/Tooltip.js +16 -14
  34. package/lib/cjs/Tooltip.js.map +1 -1
  35. package/lib/cjs/Venn.js +9 -9
  36. package/lib/cjs/a11y/PlotA11yView.js +2 -2
  37. package/lib/cjs/component/Chart/AbstractChart.js +29 -23
  38. package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
  39. package/lib/cjs/component/Chart/AbstractChart.type.js +19 -0
  40. package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
  41. package/lib/cjs/component/Chart/AreaChart.js +21 -7
  42. package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
  43. package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
  44. package/lib/cjs/component/Chart/BarChart.js +17 -8
  45. package/lib/cjs/component/Chart/BarChart.js.map +1 -1
  46. package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
  47. package/lib/cjs/component/Chart/BubbleChart.js +4 -0
  48. package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
  49. package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
  50. package/lib/cjs/component/Chart/CigaretteChart.js +5 -1
  51. package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
  52. package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
  53. package/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  54. package/lib/cjs/component/Chart/DonutChart.js +0 -1
  55. package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
  56. package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
  57. package/lib/cjs/component/Chart/HistogramChart.js +6 -3
  58. package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
  59. package/lib/cjs/component/Chart/HistogramChart.type.js.map +1 -1
  60. package/lib/cjs/component/Chart/LineChart.js +16 -6
  61. package/lib/cjs/component/Chart/LineChart.js.map +1 -1
  62. package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
  63. package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
  64. package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
  65. package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
  66. package/lib/cjs/component/Chart/index.js +43 -0
  67. package/lib/cjs/component/Chart/index.js.map +1 -1
  68. package/lib/cjs/component/ChartLegend/BaseLegend.js +0 -4
  69. package/lib/cjs/component/ChartLegend/BaseLegend.js.map +1 -1
  70. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  71. package/lib/cjs/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  72. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +19 -17
  73. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  74. package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  75. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +28 -21
  76. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  77. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
  78. package/lib/cjs/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
  79. package/lib/cjs/component/Cigarette/Cigarette.js +0 -1
  80. package/lib/cjs/component/Cigarette/Cigarette.js.map +1 -1
  81. package/lib/cjs/component/Metric/Metric.js +78 -0
  82. package/lib/cjs/component/Metric/Metric.js.map +1 -0
  83. package/lib/cjs/component/Metric/Metric.type.js +2 -0
  84. package/lib/cjs/component/Metric/Metric.type.js.map +1 -0
  85. package/lib/cjs/index.js +62 -8
  86. package/lib/cjs/index.js.map +1 -1
  87. package/lib/cjs/style/abstract-chart.shadow.css +13 -3
  88. package/lib/cjs/style/area.shadow.css +8 -7
  89. package/lib/cjs/style/axis.shadow.css +51 -60
  90. package/lib/cjs/style/bar.shadow.css +7 -9
  91. package/lib/cjs/style/bubble.shadow.css +4 -6
  92. package/lib/cjs/style/donut.shadow.css +3 -5
  93. package/lib/cjs/style/dot.shadow.css +37 -4
  94. package/lib/cjs/style/hover.shadow.css +30 -13
  95. package/lib/cjs/style/line.shadow.css +3 -5
  96. package/lib/cjs/style/pattern.shadow.css +10 -0
  97. package/lib/cjs/style/plotA11yView.shadow.css +3 -3
  98. package/lib/cjs/style/radar.shadow.css +7 -7
  99. package/lib/cjs/style/radial-tree.shadow.css +3 -5
  100. package/lib/cjs/style/reference.shadow.css +5 -5
  101. package/lib/cjs/style/scatterplot.shadow.css +2 -4
  102. package/lib/cjs/style/tooltip.shadow.css +12 -14
  103. package/lib/cjs/style/venn.shadow.css +0 -2
  104. package/lib/cjs/types/Axis.d.js.map +1 -1
  105. package/lib/cjs/types/Donut.d.js.map +1 -1
  106. package/lib/cjs/types/Hover.d.js.map +1 -1
  107. package/lib/cjs/types/index.d.js +20 -0
  108. package/lib/cjs/types/index.d.js.map +1 -1
  109. package/lib/cjs/utils.js +21 -1
  110. package/lib/cjs/utils.js.map +1 -1
  111. package/lib/es6/Area.js +125 -25
  112. package/lib/es6/Area.js.map +1 -1
  113. package/lib/es6/Axis.js +109 -97
  114. package/lib/es6/Axis.js.map +1 -1
  115. package/lib/es6/Bar.js +16 -16
  116. package/lib/es6/Bubble.js +14 -14
  117. package/lib/es6/ChartMetaData.js +36 -0
  118. package/lib/es6/ChartMetaData.js.map +1 -0
  119. package/lib/es6/CompactHorizontalBar.js +17 -17
  120. package/lib/es6/CompactHorizontalBar.js.map +1 -1
  121. package/lib/es6/Donut.js +18 -19
  122. package/lib/es6/Donut.js.map +1 -1
  123. package/lib/es6/Dots.js +68 -14
  124. package/lib/es6/Dots.js.map +1 -1
  125. package/lib/es6/GroupBar.js +5 -2
  126. package/lib/es6/GroupBar.js.map +1 -1
  127. package/lib/es6/HorizontalBar.js +16 -16
  128. package/lib/es6/Hover.js +55 -52
  129. package/lib/es6/Hover.js.map +1 -1
  130. package/lib/es6/Line.js +84 -19
  131. package/lib/es6/Line.js.map +1 -1
  132. package/lib/es6/Pattern.js +108 -2
  133. package/lib/es6/Pattern.js.map +1 -1
  134. package/lib/es6/Plot.js +5 -2
  135. package/lib/es6/Plot.js.map +1 -1
  136. package/lib/es6/Radar.js +19 -19
  137. package/lib/es6/RadialTree.js +12 -12
  138. package/lib/es6/Reference.js +55 -18
  139. package/lib/es6/Reference.js.map +1 -1
  140. package/lib/es6/ScatterPlot.js +9 -9
  141. package/lib/es6/Tooltip.js +16 -14
  142. package/lib/es6/Tooltip.js.map +1 -1
  143. package/lib/es6/Venn.js +9 -9
  144. package/lib/es6/a11y/PlotA11yView.js +2 -2
  145. package/lib/es6/component/Chart/AbstractChart.js +29 -23
  146. package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
  147. package/lib/es6/component/Chart/AbstractChart.type.js +14 -1
  148. package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
  149. package/lib/es6/component/Chart/AreaChart.js +21 -7
  150. package/lib/es6/component/Chart/AreaChart.js.map +1 -1
  151. package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
  152. package/lib/es6/component/Chart/BarChart.js +17 -8
  153. package/lib/es6/component/Chart/BarChart.js.map +1 -1
  154. package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
  155. package/lib/es6/component/Chart/BubbleChart.js +4 -0
  156. package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
  157. package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
  158. package/lib/es6/component/Chart/CigaretteChart.js +5 -1
  159. package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
  160. package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
  161. package/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  162. package/lib/es6/component/Chart/DonutChart.js +0 -1
  163. package/lib/es6/component/Chart/DonutChart.js.map +1 -1
  164. package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
  165. package/lib/es6/component/Chart/HistogramChart.js +6 -3
  166. package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
  167. package/lib/es6/component/Chart/HistogramChart.type.js.map +1 -1
  168. package/lib/es6/component/Chart/LineChart.js +14 -4
  169. package/lib/es6/component/Chart/LineChart.js.map +1 -1
  170. package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
  171. package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
  172. package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
  173. package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
  174. package/lib/es6/component/Chart/index.js +2 -0
  175. package/lib/es6/component/Chart/index.js.map +1 -1
  176. package/lib/es6/component/ChartLegend/BaseLegend.js +0 -4
  177. package/lib/es6/component/ChartLegend/BaseLegend.js.map +1 -1
  178. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  179. package/lib/es6/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  180. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +19 -17
  181. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  182. package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  183. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +28 -21
  184. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  185. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
  186. package/lib/es6/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
  187. package/lib/es6/component/Cigarette/Cigarette.js +0 -1
  188. package/lib/es6/component/Cigarette/Cigarette.js.map +1 -1
  189. package/lib/es6/component/Metric/Metric.js +72 -0
  190. package/lib/es6/component/Metric/Metric.js.map +1 -0
  191. package/lib/es6/component/Metric/Metric.type.js +2 -0
  192. package/lib/es6/component/Metric/Metric.type.js.map +1 -0
  193. package/lib/es6/index.js +2 -1
  194. package/lib/es6/index.js.map +1 -1
  195. package/lib/es6/style/abstract-chart.shadow.css +13 -3
  196. package/lib/es6/style/area.shadow.css +8 -7
  197. package/lib/es6/style/axis.shadow.css +51 -60
  198. package/lib/es6/style/bar.shadow.css +7 -9
  199. package/lib/es6/style/bubble.shadow.css +4 -6
  200. package/lib/es6/style/donut.shadow.css +3 -5
  201. package/lib/es6/style/dot.shadow.css +37 -4
  202. package/lib/es6/style/hover.shadow.css +30 -13
  203. package/lib/es6/style/line.shadow.css +3 -5
  204. package/lib/es6/style/pattern.shadow.css +10 -0
  205. package/lib/es6/style/plotA11yView.shadow.css +3 -3
  206. package/lib/es6/style/radar.shadow.css +7 -7
  207. package/lib/es6/style/radial-tree.shadow.css +3 -5
  208. package/lib/es6/style/reference.shadow.css +5 -5
  209. package/lib/es6/style/scatterplot.shadow.css +2 -4
  210. package/lib/es6/style/tooltip.shadow.css +12 -14
  211. package/lib/es6/style/venn.shadow.css +0 -2
  212. package/lib/es6/types/Axis.d.js.map +1 -1
  213. package/lib/es6/types/Donut.d.js.map +1 -1
  214. package/lib/es6/types/Hover.d.js.map +1 -1
  215. package/lib/es6/types/index.d.js +5 -7
  216. package/lib/es6/types/index.d.js.map +1 -1
  217. package/lib/es6/utils.js +18 -0
  218. package/lib/es6/utils.js.map +1 -1
  219. package/lib/esm/Area.mjs +127 -26
  220. package/lib/esm/Axis.mjs +110 -98
  221. package/lib/esm/Bar.mjs +17 -17
  222. package/lib/esm/Bubble.mjs +15 -15
  223. package/lib/esm/ChartMetaData.mjs +38 -0
  224. package/lib/esm/CompactHorizontalBar.mjs +18 -18
  225. package/lib/esm/Donut.mjs +19 -20
  226. package/lib/esm/Dots.mjs +66 -15
  227. package/lib/esm/GroupBar.mjs +5 -2
  228. package/lib/esm/HorizontalBar.mjs +17 -17
  229. package/lib/esm/Hover.mjs +56 -53
  230. package/lib/esm/Line.mjs +86 -20
  231. package/lib/esm/Pattern.mjs +119 -0
  232. package/lib/esm/Plot.mjs +6 -3
  233. package/lib/esm/Radar.mjs +20 -20
  234. package/lib/esm/RadialTree.mjs +13 -13
  235. package/lib/esm/Reference.mjs +56 -19
  236. package/lib/esm/ScatterPlot.mjs +10 -10
  237. package/lib/esm/Tooltip.mjs +17 -15
  238. package/lib/esm/Venn.mjs +10 -10
  239. package/lib/esm/a11y/PlotA11yView.mjs +3 -3
  240. package/lib/esm/component/Chart/AbstractChart.mjs +28 -24
  241. package/lib/esm/component/Chart/AbstractChart.type.mjs +16 -0
  242. package/lib/esm/component/Chart/AreaChart.mjs +21 -7
  243. package/lib/esm/component/Chart/BarChart.mjs +17 -8
  244. package/lib/esm/component/Chart/BubbleChart.mjs +4 -0
  245. package/lib/esm/component/Chart/CigaretteChart.mjs +5 -1
  246. package/lib/esm/component/Chart/DonutChart.mjs +0 -1
  247. package/lib/esm/component/Chart/HistogramChart.mjs +6 -3
  248. package/lib/esm/component/Chart/LineChart.mjs +14 -4
  249. package/lib/esm/component/Chart/index.mjs +8 -0
  250. package/lib/esm/component/ChartLegend/BaseLegend.mjs +0 -4
  251. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
  252. package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  253. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +20 -18
  254. package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  255. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +29 -22
  256. package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +31 -15
  257. package/lib/esm/component/Cigarette/Cigarette.mjs +0 -1
  258. package/lib/esm/component/Metric/Metric.mjs +62 -0
  259. package/lib/esm/index.mjs +42 -34
  260. package/lib/esm/style/abstract-chart.shadow.css +13 -3
  261. package/lib/esm/style/area.shadow.css +8 -7
  262. package/lib/esm/style/axis.shadow.css +51 -60
  263. package/lib/esm/style/bar.shadow.css +7 -9
  264. package/lib/esm/style/bubble.shadow.css +4 -6
  265. package/lib/esm/style/donut.shadow.css +3 -5
  266. package/lib/esm/style/dot.shadow.css +37 -4
  267. package/lib/esm/style/hover.shadow.css +30 -13
  268. package/lib/esm/style/line.shadow.css +3 -5
  269. package/lib/esm/style/pattern.shadow.css +10 -0
  270. package/lib/esm/style/plotA11yView.shadow.css +3 -3
  271. package/lib/esm/style/radar.shadow.css +7 -7
  272. package/lib/esm/style/radial-tree.shadow.css +3 -5
  273. package/lib/esm/style/reference.shadow.css +5 -5
  274. package/lib/esm/style/scatterplot.shadow.css +2 -4
  275. package/lib/esm/style/tooltip.shadow.css +12 -14
  276. package/lib/esm/style/venn.shadow.css +0 -2
  277. package/lib/esm/utils.mjs +20 -0
  278. package/lib/types/Axis.d.ts +3 -2
  279. package/lib/types/ChartMetaData.d.ts +17 -0
  280. package/lib/types/ChartMetaData.d.ts.map +1 -0
  281. package/lib/types/Donut.d.ts +1 -1
  282. package/lib/types/Hover.d.ts +2 -0
  283. package/lib/types/Pattern.d.ts +18 -0
  284. package/lib/types/Pattern.d.ts.map +1 -1
  285. package/lib/types/component/Chart/AbstractChart.d.ts +8 -4
  286. package/lib/types/component/Chart/AbstractChart.d.ts.map +1 -1
  287. package/lib/types/component/Chart/AbstractChart.type.d.ts +28 -8
  288. package/lib/types/component/Chart/AbstractChart.type.d.ts.map +1 -1
  289. package/lib/types/component/Chart/AreaChart.d.ts.map +1 -1
  290. package/lib/types/component/Chart/AreaChart.type.d.ts +8 -4
  291. package/lib/types/component/Chart/AreaChart.type.d.ts.map +1 -1
  292. package/lib/types/component/Chart/BarChart.d.ts.map +1 -1
  293. package/lib/types/component/Chart/BarChart.type.d.ts +3 -0
  294. package/lib/types/component/Chart/BarChart.type.d.ts.map +1 -1
  295. package/lib/types/component/Chart/BubbleChart.d.ts.map +1 -1
  296. package/lib/types/component/Chart/BubbleChart.type.d.ts +1 -1
  297. package/lib/types/component/Chart/BubbleChart.type.d.ts.map +1 -1
  298. package/lib/types/component/Chart/CigaretteChart.d.ts.map +1 -1
  299. package/lib/types/component/Chart/CigaretteChart.type.d.ts +1 -1
  300. package/lib/types/component/Chart/CigaretteChart.type.d.ts.map +1 -1
  301. package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +1 -1
  302. package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts.map +1 -1
  303. package/lib/types/component/Chart/DonutChart.d.ts.map +1 -1
  304. package/lib/types/component/Chart/DonutChart.type.d.ts +1 -2
  305. package/lib/types/component/Chart/DonutChart.type.d.ts.map +1 -1
  306. package/lib/types/component/Chart/HistogramChart.d.ts.map +1 -1
  307. package/lib/types/component/Chart/HistogramChart.type.d.ts +1 -0
  308. package/lib/types/component/Chart/HistogramChart.type.d.ts.map +1 -1
  309. package/lib/types/component/Chart/LineChart.d.ts.map +1 -1
  310. package/lib/types/component/Chart/LineChart.type.d.ts +1 -0
  311. package/lib/types/component/Chart/LineChart.type.d.ts.map +1 -1
  312. package/lib/types/component/Chart/RadarChart.type.d.ts +1 -1
  313. package/lib/types/component/Chart/RadarChart.type.d.ts.map +1 -1
  314. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +1 -1
  315. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts.map +1 -1
  316. package/lib/types/component/Chart/VennChart.type.d.ts +1 -1
  317. package/lib/types/component/Chart/VennChart.type.d.ts.map +1 -1
  318. package/lib/types/component/Chart/index.d.ts +2 -0
  319. package/lib/types/component/Chart/index.d.ts.map +1 -1
  320. package/lib/types/component/ChartLegend/BaseLegend.d.ts.map +1 -1
  321. package/lib/types/component/ChartLegend/LegendTable/LegendTable.d.ts.map +1 -1
  322. package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +5 -3
  323. package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts.map +1 -1
  324. package/lib/types/component/Metric/Metric.d.ts +9 -0
  325. package/lib/types/component/Metric/Metric.d.ts.map +1 -0
  326. package/lib/types/component/Metric/Metric.type.d.ts +33 -0
  327. package/lib/types/component/Metric/Metric.type.d.ts.map +1 -0
  328. package/lib/types/index.d.ts +5 -7
  329. package/lib/types/utils.d.ts +4 -1
  330. package/lib/types/utils.d.ts.map +1 -1
  331. package/package.json +16 -15
  332. package/lib/cjs/color.js +0 -132
  333. package/lib/cjs/color.js.map +0 -1
  334. package/lib/cjs/style/var.css +0 -125
  335. package/lib/es6/color.js +0 -127
  336. package/lib/es6/color.js.map +0 -1
  337. package/lib/es6/style/var.css +0 -125
  338. package/lib/esm/color.mjs +0 -127
  339. package/lib/esm/utils/TextMeasurer.mjs +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractChart.type.js","names":[],"sources":["../../../../src/component/Chart/AbstractChart.type.ts"],"sourcesContent":["import type { NSFlex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type Icon from '@semcore/icon';\nimport type React from 'react';\n\nimport type { PatternsConfig } from '../../Pattern';\n// @ts-ignore\nimport type { PlotSummarizerConfig } from '../../Plot';\nimport type { PlotEventEmitter } from '../../utils';\nimport type { BaseChartLegendProps } from '../ChartLegend/BaseLegend.type';\nimport type { TrendProps } from '../ChartLegend/LegendFlex/LegendFlex.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nexport type BaseLegendProps = BaseChartLegendProps & {\n /**\n * Disable hover (for transition items legend of each not hovered)\n */\n disableHoverItems?: boolean;\n /**\n * Disable selectable of data items by checkboxes in Legend\n */\n disableSelectItems?: boolean;\n} & (\n | (TrendProps & {\n /**\n * How to render Legend - Flex view. Just list of legend items\n */\n legendType?: never | 'Flex';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Flex'>;\n })\n | {\n /**\n * How to render Legend - Table view. Table of legend items with some additional information in columns\n */\n legendType: 'Table';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Table'>;\n }\n );\n\nexport type ObjectDataKey = string;\nexport type ObjectData = Record<ObjectDataKey, unknown>;\nexport type ListData = ObjectData[];\n\n/**\n * Chart, Legend must have an accessible names (aria-name).\n * It should describe chart or legend content.\n */\nexport type AriaNameProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type BaseChartProps<T extends ListData | ObjectData> = NSFlex.Props & {\n /**\n * Chart data. For all charts except Donut(Pie), Radar and Venn should be an Array\n */\n data: T;\n /**\n * Width of plot\n * @default width is 100% of the parent element.\n */\n plotWidth?: number;\n /**\n * Height of plot\n * @default height is 100% of the parent element.\n */\n plotHeight?: number;\n\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n /**\n * Margin (for Y axis points) from left side of chart container to Y axis\n */\n marginY?: number;\n /**\n * Margin (for X axis points) from bottom of chart container to X axis\n */\n marginX?: number;\n /**\n * invert axis and show horizontal charts (only for Bars!)\n */\n invertAxis?: boolean;\n\n /**\n * Show X axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showXAxis?: boolean;\n /**\n * Show Y axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showYAxis?: boolean;\n /**\n * Map with colors for data items\n */\n colorMap?: Record<string, string>;\n /**\n * Show tooltip's.\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Show sum of values for selected point in tooltip\n */\n showTotalInTooltip?: boolean;\n /**\n * Show the percentage change from the previous point in the tooltip\n */\n showDeltaPercentInTooltip?: boolean;\n /**\n * Overrides the default percentage delta calculation.\n */\n getPercentDelta?: (key: ObjectDataKey, index: number, data: T) => number | null;\n /**\n * Scale for xAxis (see more in d3-scale)\n */\n xScale?: unknown;\n /**\n * Scale for yAxis (see more in d3-scale)\n */\n yScale?: unknown;\n /**\n * Count of ticks for X axis\n */\n xTicksCount?: number;\n /**\n * Count of ticks for Y axis\n */\n yTicksCount?: number;\n /** Enables multiline tick labels for X axis, applicable only for band scales */\n multilineXTicks?: boolean;\n /** Enables multiline tick labels for Y axis, applicable only for band scales */\n multilineYTicks?: boolean;\n /**\n * Group key for all array-based charts (for get keys of items for legend except that group key)\n */\n groupKey?: string;\n /**\n * function for format axis item text\n */\n axisXValueFormatter?: (value: unknown) => string;\n axisYValueFormatter?: (value: unknown) => string;\n /**\n * Function to format values in tooltip\n */\n tooltipValueFormatter?: (value?: unknown) => string;\n /**\n * Function to format tooltip's title\n */\n tooltipTitleFormatter?: (title?: unknown) => string;\n /**\n * Custom event emitter. Could be useful to handle event on few charts at the same time.\n */\n eventEmitter?: InstanceType<typeof PlotEventEmitter>;\n /**\n * Config for a11y summary\n */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /**\n * Animations duration, set 0 to disable animations\n */\n duration?: number;\n /**\n * Flag to show/hide legend\n */\n showLegend?: boolean;\n /**\n * Relation between height and width dimensions block.\n * height = width / aspect, so an aspect could be set as `16 / 9` for example.\n */\n aspect?: number;\n /** Callback which will be called after changing the block size */\n onResize?: (size: [number, number], entries: ResizeObserverEntry[]) => void;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n} & (\n | {\n /**\n * Don't show legend\n */\n showLegend?: false;\n legendProps?: never;\n }\n | {\n /**\n * By default (if showLegend don't set), for one data item on chart,\n * Legend component will be hide, and show for more then 1 data item.\n * If set `true` - Legend component will show always.\n */\n showLegend?: true;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n }\n );\n\ntype LegendDataMap<T extends 'Flex' | 'Table'> = Record<\n LegendItemKey,\n {\n /**\n * Custom label for legend item (by default use keys from data item object)\n */\n label?: string;\n /**\n * Additional text after label\n */\n additionalInfo?: string;\n /**\n * Count after label\n */\n count?: number;\n /**\n * Custom Icon\n */\n icon?: typeof Icon;\n /**\n * Flag for uncheck some items by default\n */\n defaultChecked?: boolean;\n } & (T extends 'Table' ? { columns?: React.ReactNode[] } : { columns?: never })\n>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"AbstractChart.type.js","names":["GOOD","Symbol","BAD","INSIGHTFUL","HIGHLIGHT_DOT","DATA_TYPE","FORECAST","POTENTIAL"],"sources":["../../../../src/component/Chart/AbstractChart.type.ts"],"sourcesContent":["import type { NSFlex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type Icon from '@semcore/icon';\nimport type React from 'react';\n\nimport type { PatternsConfig } from '../../Pattern';\n// @ts-ignore\nimport type { PlotSummarizerConfig } from '../../Plot';\nimport type { interpolateValue, PlotEventEmitter } from '../../utils';\nimport type { BaseChartLegendProps } from '../ChartLegend/BaseLegend.type';\nimport type { TrendProps } from '../ChartLegend/LegendFlex/LegendFlex.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nexport const GOOD = Symbol('GOOD');\nexport const BAD = Symbol('BAD');\nexport const INSIGHTFUL = Symbol('INSIGHTFUL');\nexport const HIGHLIGHT_DOT = Symbol('HIGHLIGHT_DOT');\n\nexport const DATA_TYPE = Symbol('DATA_TYPE');\nexport const FORECAST = Symbol('FORECAST_DATA');\nexport const POTENTIAL = Symbol('POTENTIAL_DATA');\n\nexport type BaseLegendProps = BaseChartLegendProps & {\n /**\n * Disable hover (for transition items legend of each not hovered)\n */\n disableHoverItems?: boolean;\n /**\n * Disable selectable of data items by checkboxes in Legend\n */\n disableSelectItems?: boolean;\n} & (\n | (TrendProps & {\n /**\n * How to render Legend - Flex view. Just list of legend items\n */\n legendType?: never | 'Flex';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Flex'>;\n })\n | {\n /**\n * How to render Legend - Table view. Table of legend items with some additional information in columns\n */\n legendType: 'Table';\n /**\n * Config for Legend items\n */\n legendMap?: LegendDataMap<'Table'>;\n }\n );\n\nexport type ObjectDataKey = string;\nexport type ObjectData = Record<ObjectDataKey, number | typeof interpolateValue | Date | string | string[] | number[]> & {\n [HIGHLIGHT_DOT]?: typeof GOOD | typeof BAD | typeof INSIGHTFUL;\n [DATA_TYPE]?: typeof POTENTIAL | typeof FORECAST;\n};\nexport type ListData = ObjectData[];\n\n/**\n * Chart, Legend must have an accessible names (aria-name).\n * It should describe chart or legend content.\n */\nexport type AriaNameProps = Intergalactic.RequireAtLeastOne<{\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'title'?: string;\n}>;\n\nexport type BaseChartProps<T extends ListData | ObjectData> = NSFlex.Props & {\n /**\n * Chart data. For all charts except Donut(Pie), Radar and Venn should be an Array\n */\n data: T;\n /**\n * Width of plot\n * @default width is 100% of the parent element.\n */\n plotWidth?: number;\n /**\n * Height of plot\n * @default height is 100% of the parent element.\n */\n plotHeight?: number;\n\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n /**\n * Margin (for Y axis points) from left side of chart container to Y axis\n */\n marginY?: number;\n /**\n * Margin (for X axis points) from bottom of chart container to X axis\n */\n marginX?: number;\n /**\n * invert axis and show horizontal charts (only for Bars!)\n */\n invertAxis?: boolean;\n\n /**\n * Show X axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showXAxis?: boolean;\n /**\n * Show Y axis\n * @default true (for charts with axis: Area, Line, Bar, ScatterPlot, ...)\n */\n showYAxis?: boolean;\n /**\n * Map with colors for data items\n */\n colorMap?: Record<string, string>;\n /**\n * Show tooltip's.\n * @default true\n */\n showTooltip?: boolean;\n /**\n * Show sum of values for selected point in tooltip\n */\n showTotalInTooltip?: boolean;\n /**\n * Show the percentage change from the previous point in the tooltip\n */\n showDeltaPercentInTooltip?: boolean;\n /**\n * Overrides the default percentage delta calculation.\n */\n getPercentDelta?: (key: ObjectDataKey, index: number, data: T) => number | null;\n /**\n * Defines a color of the growing percentage delta in the tooltip.\n * Use `bad` when an increase isn't a positive change.\n * @default good\n */\n deltaPercentGrowthColor?: 'good' | 'bad';\n /**\n * Scale for xAxis (see more in d3-scale)\n */\n xScale?: unknown;\n /**\n * Scale for yAxis (see more in d3-scale)\n */\n yScale?: unknown;\n /**\n * Count of ticks for X axis\n */\n xTicksCount?: number;\n /**\n * Count of ticks for Y axis\n */\n yTicksCount?: number;\n /** Enables multiline tick labels for X axis, applicable only for band scales */\n /** @deprecated has no effect since v.18 */\n multilineXTicks?: boolean;\n /** Enables multiline tick labels for Y axis, applicable only for band scales */\n /** @deprecated has no effect since v.18 */\n multilineYTicks?: boolean;\n /**\n * Group key for all array-based charts (for get keys of items for legend except that group key)\n */\n groupKey?: string;\n /**\n * function for format axis item text\n */\n axisXValueFormatter?: (value: unknown) => React.ReactNode;\n axisYValueFormatter?: (value: unknown) => React.ReactNode;\n /**\n * Function to format values in tooltip\n */\n tooltipValueFormatter?: (value?: unknown) => string;\n /**\n * Function to format tooltip's title\n */\n tooltipTitleFormatter?: (title?: unknown) => string;\n /**\n * Custom event emitter. Could be useful to handle event on few charts at the same time.\n */\n eventEmitter?: InstanceType<typeof PlotEventEmitter>;\n /**\n * Config for a11y summary\n */\n a11yAltTextConfig?: PlotSummarizerConfig;\n\n /**\n * Animations duration, set 0 to disable animations\n */\n duration?: number;\n /**\n * Flag to show/hide legend\n */\n showLegend?: boolean;\n /**\n * Relation between height and width dimensions block.\n * height = width / aspect, so an aspect could be set as `16 / 9` for example.\n */\n aspect?: number;\n /** Callback which will be called after changing the block size */\n onResize?: (size: [number, number], entries: ResizeObserverEntry[]) => void;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n /**\n * Locale for displaying the days of a week and months, to be transferred to `Intl`\n * @default en\n * */\n locale?: NavigatorLanguage['language'];\n} & (\n | {\n /**\n * Don't show legend\n */\n showLegend?: false;\n legendProps?: never;\n }\n | {\n /**\n * By default (if showLegend don't set), for one data item on chart,\n * Legend component will be hide, and show for more then 1 data item.\n * If set `true` - Legend component will show always.\n */\n showLegend?: true;\n /**\n * Props for Legend\n */\n legendProps?: Partial<BaseLegendProps>;\n }\n );\n\nexport type LegendDataMap<T extends 'Flex' | 'Table'> = Record<\n LegendItemKey,\n {\n /**\n * Custom label for legend item (by default use keys from data item object)\n */\n label?: string;\n /**\n * Additional text after label\n */\n additionalInfo?: string;\n /**\n * Count after label\n */\n count?: number;\n /**\n * Custom Icon\n */\n icon?: typeof Icon;\n /**\n * Flag for uncheck some items by default\n */\n defaultChecked?: boolean;\n } & (T extends 'Table' ? ({ columns?: React.ReactNode[] } | { rows?: React.ReactNode[] }) : { columns?: never; rows?: never })\n>;\n"],"mappings":"AAMA;;AAOA,OAAO,MAAMA,IAAI,GAAGC,MAAM,CAAC,MAAM,CAAC;AAClC,OAAO,MAAMC,GAAG,GAAGD,MAAM,CAAC,KAAK,CAAC;AAChC,OAAO,MAAME,UAAU,GAAGF,MAAM,CAAC,YAAY,CAAC;AAC9C,OAAO,MAAMG,aAAa,GAAGH,MAAM,CAAC,eAAe,CAAC;AAEpD,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAC,WAAW,CAAC;AAC5C,OAAO,MAAMK,QAAQ,GAAGL,MAAM,CAAC,eAAe,CAAC;AAC/C,OAAO,MAAMM,SAAS,GAAGN,MAAM,CAAC,gBAAgB,CAAC;;AAyCjD;AACA;AACA;AACA","ignoreList":[]}
@@ -7,8 +7,15 @@ import React from 'react';
7
7
  // @ts-ignore
8
8
  import { Area, minMax, HoverLine, StackedArea } from '../..';
9
9
  import { AbstractChart } from './AbstractChart';
10
+ import { HIGHLIGHT_DOT } from './AbstractChart.type';
10
11
  import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
11
12
  class AreaChartComponent extends AbstractChart {
13
+ constructor(...args) {
14
+ super(...args);
15
+ _defineProperty(this, "displayDots", (i, isActive, noAround, data) => {
16
+ return isActive || noAround || Boolean(data[HIGHLIGHT_DOT]);
17
+ });
18
+ }
12
19
  get xScale() {
13
20
  const {
14
21
  xScale,
@@ -70,12 +77,14 @@ class AreaChartComponent extends AbstractChart {
70
77
  color: item.color,
71
78
  transparent: highlightedItem !== -1 && highlightedItem !== index,
72
79
  curve: curve,
73
- onClick: onClickArea
80
+ onClick: onClickArea,
81
+ withGradient: true
74
82
  }, /*#__PURE__*/React.createElement(StackedArea.Area.Dots, {
75
- display: showDots
83
+ display: showDots ? true : this.displayDots
76
84
  }));
77
85
  }));
78
86
  }
87
+ const withGradient = dataDefinitions.filter(item => item.checked).length === 1;
79
88
  return dataDefinitions.map((item, index) => {
80
89
  return item.checked && /*#__PURE__*/React.createElement(Area, {
81
90
  x: groupKey,
@@ -84,20 +93,23 @@ class AreaChartComponent extends AbstractChart {
84
93
  color: item.color,
85
94
  transparent: highlightedItem !== -1 && highlightedItem !== index,
86
95
  curve: curve,
87
- onClick: onClickArea
96
+ onClick: onClickArea,
97
+ withGradient: withGradient
88
98
  }, /*#__PURE__*/React.createElement(Area.Dots, {
89
- display: showDots
99
+ display: showDots ? true : this.displayDots
90
100
  }));
91
101
  });
92
102
  }
93
103
  renderTooltip() {
94
104
  const {
95
105
  data,
96
- groupKey
106
+ groupKey,
107
+ showXAxis
97
108
  } = this.asProps;
98
109
  return /*#__PURE__*/React.createElement(HoverLine.Tooltip, {
99
110
  x: groupKey,
100
- wMin: 100
111
+ wMin: 100,
112
+ hideTickHover: !showXAxis
101
113
  }, ({
102
114
  xIndex
103
115
  }) => {
@@ -130,7 +142,9 @@ _defineProperty(AreaChartComponent, "defaultProps", {
130
142
  showXAxis: true,
131
143
  showYAxis: true,
132
144
  showTooltip: true,
133
- locale: 'en'
145
+ stacked: true,
146
+ locale: 'en',
147
+ deltaPercentGrowthColor: 'good'
134
148
  });
135
149
  export const AreaChart = createComponent(AreaChartComponent);
136
150
  //# sourceMappingURL=AreaChart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AreaChart.js","names":["createComponent","i18nEnhance","scaleLinear","scaleTime","React","Area","minMax","HoverLine","StackedArea","AbstractChart","localizedMessages","AreaChartComponent","xScale","marginY","data","groupKey","asProps","plotWidth","testItem","range","plotPadding","domain","Date","Number","isNaN","getMilliseconds","yScale","marginX","stacked","plotHeight","flatValues","min","Math","max","maxStackedValue","renderChart","curve","showDots","onClickArea","dataDefinitions","highlightedItem","state","createElement","x","map","item","index","checked","y","id","key","color","transparent","onClick","Dots","display","renderTooltip","Tooltip","wMin","xIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","_defineProperty","direction","showXAxis","showYAxis","showTooltip","locale","AreaChart"],"sources":["../../../../src/component/Chart/AreaChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { type ScaleLinear, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Area, minMax, HoverLine, StackedArea } from '../..';\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { AreaChartData, AreaChartProps, AreaChartType, AreaChartDefaultProps } from './AreaChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass AreaChartComponent extends AbstractChart<\n AreaChartData,\n AreaChartProps,\n typeof AreaChartComponent.enhance,\n {},\n ChartState,\n AreaChartDefaultProps\n> {\n static displayName = 'Chart.Area';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n locale: 'en',\n } as const;\n\n get xScale() {\n const { xScale, marginY = 40, data, groupKey } = this.asProps;\n const { plotWidth } = this;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = minMax(data, groupKey);\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n return scaleTime(domain, range);\n }\n\n return scaleLinear(domain, range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 32, stacked } = this.asProps;\n const { plotHeight } = this;\n\n if (yScale) {\n return yScale;\n }\n\n const flatValues = super.flatValues;\n const min = Math.min(...flatValues);\n const max = stacked ? super.maxStackedValue : Math.max(...flatValues);\n\n return scaleLinear()\n .range([plotHeight - marginX, this.plotPadding])\n .domain([min, max]);\n }\n\n renderChart() {\n const { groupKey, curve, showDots, stacked, onClickArea } = this.asProps;\n const { dataDefinitions, highlightedItem } = this.state;\n\n if (stacked) {\n return (\n <StackedArea x={groupKey}>\n {dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <StackedArea.Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedItem !== -1 && highlightedItem !== index}\n curve={curve}\n onClick={onClickArea}\n >\n <StackedArea.Area.Dots display={showDots} />\n </StackedArea.Area>\n )\n );\n })}\n </StackedArea>\n );\n }\n\n return dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedItem !== -1 && highlightedItem !== index}\n curve={curve}\n onClick={onClickArea}\n >\n <Area.Dots display={showDots} />\n </Area>\n )\n );\n });\n }\n\n renderTooltip() {\n const { data, groupKey } = this.asProps;\n\n return (\n <HoverLine.Tooltip x={groupKey} wMin={100}>\n {({ xIndex }: any) => {\n const dataItem = data[xIndex];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverLine.Tooltip,\n dataItem,\n index: xIndex,\n }),\n };\n }}\n </HoverLine.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Area' });\n }\n}\n\n/**\n * AreaChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/area-chart/area-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/area-chart/area-chart-code/|Examples}\n */\nexport const AreaChart = createComponent<\n AreaChartType,\n typeof AreaChartComponent\n>(AreaChartComponent);\n"],"mappings":";AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAA2BC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AACnE,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,SAASC,IAAI,EAAEC,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAE5D,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,oDAAoD;AAEtF,MAAMC,kBAAkB,SAASF,aAAa,CAO5C;EAaA,IAAIG,MAAMA,CAAA,EAAG;IACX,MAAM;MAAEA,MAAM;MAAEC,OAAO,GAAG,EAAE;MAAEC,IAAI;MAAEC;IAAS,CAA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BAErBlC,KAAA,CAAAsC,aAAA,CAACrC,IAAI,CAACiD,IAAI;QAACC,OAAO,EAAElB;MAAS,CAAE,CAC3B,CACP;IAEL,CAAC,CAAC;EACJ;EAEAmB,aAAaA,CAAA,EAAG;IACd,MAAM;MAAE1C,IAAI;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACC,OAAO;IAEvC,oBACEZ,KAAA,CAAAsC,aAAA,CAACnC,SAAS,CAACkD,OAAO;MAACd,CAAC,EAAE5B,QAAS;MAAC2C,IAAI,EAAE;IAAI,GACvC,CAAC;MAAEC;IAAY,CAAC,KAAK;MACpB,MAAMC,QAAQ,GAAG9C,IAAI,CAAC6C,MAAM,CAAC;MAE7B,OAAO;QACLE,QAAQ,EAAE,IAAI,CAACC,kBAAkB,CAAC;UAChCL,OAAO,EAAElD,SAAS,CAACkD,OAAO;UAC1BG,QAAQ;UACRd,KAAK,EAAEa;QACT,CAAC;MACH,CAAC;IACH,CACiB,CAAC;EAExB;EAEUI,kBAAkBA,CAAA,EAAW;IACrC,OAAO,IAAI,CAAC/C,OAAO,CAACgD,WAAW,CAAC,gBAAgB,EAAE;MAAEC,SAAS,EAAE;IAAO,CAAC,CAAC;EAC1E;AACF;;AAEA;AACA;AACA;AACA;AACA;AAJAC,eAAA,CAhIMvD,kBAAkB,iBAQD,YAAY;AAAAuD,eAAA,CAR7BvD,kBAAkB,aAUL,CAACV,WAAW,CAACS,iBAAiB,CAAC,CAAC;AAAAwD,eAAA,CAV7CvD,kBAAkB,kBAYA;EACpBwD,SAAS,EAAE,QAAQ;EACnBC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE;AACV,CAAC;AAmHH,OAAO,MAAMC,SAAS,GAAGxE,eAAe,CAGtCW,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AreaChart.js","names":["createComponent","i18nEnhance","scaleLinear","scaleTime","React","Area","minMax","HoverLine","StackedArea","AbstractChart","HIGHLIGHT_DOT","localizedMessages","AreaChartComponent","constructor","args","_defineProperty","i","isActive","noAround","data","Boolean","xScale","marginY","groupKey","asProps","plotWidth","testItem","range","plotPadding","domain","Date","Number","isNaN","getMilliseconds","yScale","marginX","stacked","plotHeight","flatValues","min","Math","max","maxStackedValue","renderChart","curve","showDots","onClickArea","dataDefinitions","highlightedItem","state","createElement","x","map","item","index","checked","y","id","key","color","transparent","onClick","withGradient","Dots","display","displayDots","filter","length","renderTooltip","showXAxis","Tooltip","wMin","hideTickHover","xIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","direction","showYAxis","showTooltip","locale","deltaPercentGrowthColor","AreaChart"],"sources":["../../../../src/component/Chart/AreaChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { type ScaleLinear, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Area, minMax, HoverLine, StackedArea } from '../..';\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { ObjectData } from './AbstractChart.type';\nimport { HIGHLIGHT_DOT } from './AbstractChart.type';\nimport type {\n AreaChartData,\n AreaChartProps,\n AreaChartType,\n AreaChartDefaultProps,\n} from './AreaChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass AreaChartComponent extends AbstractChart<\n AreaChartData,\n AreaChartProps,\n typeof AreaChartComponent.enhance,\n {},\n ChartState,\n AreaChartDefaultProps\n> {\n static displayName = 'Chart.Area';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n stacked: true,\n locale: 'en',\n deltaPercentGrowthColor: 'good',\n } as const;\n\n get xScale() {\n const { xScale, marginY = 40, data, groupKey } = this.asProps;\n const { plotWidth } = this;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = minMax(data, groupKey);\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n return scaleTime(domain, range);\n }\n\n return scaleLinear(domain, range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 32, stacked } = this.asProps;\n const { plotHeight } = this;\n\n if (yScale) {\n return yScale;\n }\n\n const flatValues = super.flatValues;\n const min = Math.min(...flatValues);\n const max = stacked ? super.maxStackedValue : Math.max(...flatValues);\n\n return scaleLinear()\n .range([plotHeight - marginX, this.plotPadding])\n .domain([min, max]);\n }\n\n renderChart() {\n const { groupKey, curve, showDots, stacked, onClickArea } = this.asProps;\n const { dataDefinitions, highlightedItem } = this.state;\n\n if (stacked) {\n return (\n <StackedArea x={groupKey}>\n {dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <StackedArea.Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedItem !== -1 && highlightedItem !== index}\n curve={curve}\n onClick={onClickArea}\n withGradient\n >\n <StackedArea.Area.Dots display={showDots ? true : this.displayDots} />\n </StackedArea.Area>\n )\n );\n })}\n </StackedArea>\n );\n }\n\n const withGradient = dataDefinitions.filter((item) => item.checked).length === 1;\n\n return dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedItem !== -1 && highlightedItem !== index}\n curve={curve}\n onClick={onClickArea}\n withGradient={withGradient}\n >\n <Area.Dots display={showDots ? true : this.displayDots} />\n </Area>\n )\n );\n });\n }\n\n renderTooltip() {\n const { data, groupKey, showXAxis } = this.asProps;\n\n return (\n <HoverLine.Tooltip x={groupKey} wMin={100} hideTickHover={!showXAxis}>\n {({ xIndex }: any) => {\n const dataItem = data[xIndex];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverLine.Tooltip,\n dataItem,\n index: xIndex,\n }),\n };\n }}\n </HoverLine.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Area' });\n }\n\n protected displayDots = (i: number, isActive: boolean, noAround: boolean, data: ObjectData): boolean => {\n return isActive || noAround || Boolean(data[HIGHLIGHT_DOT]);\n };\n}\n\n/**\n * AreaChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/area-chart/area-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/area-chart/area-chart-code/|Examples}\n */\nexport const AreaChart = createComponent<\n AreaChartType,\n typeof AreaChartComponent\n>(AreaChartComponent);\n"],"mappings":";AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAA2BC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AACnE,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,SAASC,IAAI,EAAEC,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAE5D,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,aAAa,QAAQ,sBAAsB;AAOpD,SAASC,iBAAiB,QAAQ,oDAAoD;AAEtF,MAAMC,kBAAkB,SAASH,aAAa,CAO5C;EAAAI,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,sBA8HwB,CAACC,CAAS,EAAEC,QAAiB,EAAEC,QAAiB,EAAEC,IAAgB,KAAc;MACtG,OAAOF,QAAQ,IAAIC,QAAQ,IAAIE,OAAO,CAACD,IAAI,CAACT,aAAa,CAAC,CAAC;IAC7D,CAAC;EAAA;EAjHD,IAAIW,MAAMA,CAAA,EAAG;IACX,MAAM;MAAEA,MAAM;MAAEC,OAAO,GAAG,EAAE;MAAEH,IAAI;MAAEI;IAAS,CAAC,GAAG,IAAI,CAACC,OAAO;IAC7D,MAAM;MAAEC;IAAU,CAAC,GAAG,IAAI;IAE1B,IAAIJ,MAAM,EAAE;MACV,OAAOA,MAAM;IACf;I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,EAAE,IAAI;EACb+C,MAAM,EAAE,IAAI;EACZC,uBAAuB,EAAE;AAC3B,CAAC;AA2HH,OAAO,MAAMC,SAAS,GAAGrF,eAAe,CAGtCY,kBAAkB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"AreaChart.type.js","names":[],"sources":["../../../../src/component/Chart/AreaChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleLinear, ScaleTime } from 'd3-scale';\nimport type { CurveFactory } from 'd3-shape';\n\nimport type { AriaNameProps, BaseChartProps } from './AbstractChart.type';\nimport type { interpolateValue } from '../../utils';\n\nexport type AreaChartData = Array<Record<string, number | typeof interpolateValue | Date>>;\n\nexport type AreaChartProps = BaseChartProps<AreaChartData> & {\n /** Field name that groups the data points */\n groupKey: string;\n /** Custom x-axis scale */\n xScale?: ScaleLinear<any, any> | ScaleTime<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Controls whether to display dots on the area chart lines */\n showDots?: boolean;\n /** D3 curve factory for line interpolation (e.g., curveLinear, curveCardinal) */\n curve?: CurveFactory;\n /** Enables stacked area chart mode */\n stacked?: boolean;\n /** Callback triggered when a user clicks on a chart at a position corresponding to a data item */\n onClickArea?: (index: number, event: React.SyntheticEvent) => void;\n};\n\nexport type AreaChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n};\n\nexport type AreaChartType = Intergalactic.Component<typeof Flex, Intergalactic.InternalTypings.EfficientOmit<AreaChartProps, 'showLegend'> & { showLegend?: boolean } & AriaNameProps>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"AreaChart.type.js","names":[],"sources":["../../../../src/component/Chart/AreaChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleLinear, ScaleTime } from 'd3-scale';\nimport type { CurveFactory } from 'd3-shape';\n\nimport type { AriaNameProps, BaseChartProps, ObjectData } from './AbstractChart.type';\n\nexport type AreaChartData = Array<ObjectData>;\n\nexport type AreaChartProps = BaseChartProps<AreaChartData> & {\n /** Field name that groups the data points */\n groupKey: string;\n /** Custom x-axis scale */\n xScale?: ScaleLinear<any, any> | ScaleTime<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Controls whether to display dots on the area chart lines */\n showDots?: boolean;\n /** D3 curve factory for line interpolation (e.g., curveLinear, curveCardinal) */\n curve?: CurveFactory;\n /**\n * Enables stacked area chart mode\n * @deprecated True by default. AreaChart should be only stacked.\n * @default true\n */\n stacked?: boolean;\n /** Callback triggered when a user clicks on a chart at a position corresponding to a data item */\n onClickArea?: (index: number, event: React.SyntheticEvent) => void;\n};\n\nexport type AreaChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n deltaPercentGrowthColor: 'good';\n};\n\nexport type AreaChartType = Intergalactic.Component<typeof Flex, Intergalactic.InternalTypings.EfficientOmit<AreaChartProps, 'showLegend'> & { showLegend?: boolean } & AriaNameProps>;\n"],"mappings":"","ignoreList":[]}
@@ -80,7 +80,8 @@ class BarChartComponent extends AbstractChart {
80
80
  const {
81
81
  groupKey,
82
82
  type = 'group',
83
- invertAxis
83
+ invertAxis,
84
+ maxBarSize
84
85
  } = this.asProps;
85
86
  const {
86
87
  dataDefinitions,
@@ -94,19 +95,22 @@ class BarChartComponent extends AbstractChart {
94
95
  y: invertAxis ? groupKey : item.id,
95
96
  key: item.id,
96
97
  color: item.color,
97
- onClick: this.handleClickBar
98
+ onClick: this.handleClickBar,
99
+ maxBarSize: maxBarSize
98
100
  }), this.renderTrend(item.id));
99
101
  }
100
102
  if (type === 'group') {
101
103
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GroupBar, {
102
104
  x: invertAxis ? undefined : groupKey,
103
- y: invertAxis ? groupKey : undefined
105
+ y: invertAxis ? groupKey : undefined,
106
+ maxBarSize: maxBarSize
104
107
  }, dataDefinitions.map((item, index) => {
105
108
  const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;
106
109
  const commonBarComponentProps = {
107
110
  color: item.color,
108
111
  transparent: highlightedItem !== -1 && highlightedItem !== index,
109
- onClick: this.handleClickBar
112
+ onClick: this.handleClickBar,
113
+ maxBarSize
110
114
  };
111
115
  if (invertAxis) {
112
116
  commonBarComponentProps.x = item.id;
@@ -127,7 +131,8 @@ class BarChartComponent extends AbstractChart {
127
131
  const commonBarComponentProps = {
128
132
  color: item.color,
129
133
  transparent: highlightedItem !== -1 && highlightedItem !== index,
130
- onClick: this.handleClickBar
134
+ onClick: this.handleClickBar,
135
+ maxBarSize
131
136
  };
132
137
  if (invertAxis) {
133
138
  commonBarComponentProps.x = item.id;
@@ -146,13 +151,15 @@ class BarChartComponent extends AbstractChart {
146
151
  data,
147
152
  groupKey,
148
153
  invertAxis,
149
- onClickHoverRect
154
+ onClickHoverRect,
155
+ showXAxis
150
156
  } = this.asProps;
151
157
  return /*#__PURE__*/React.createElement(HoverRect.Tooltip, {
152
158
  x: invertAxis ? undefined : groupKey,
153
159
  y: invertAxis ? groupKey : undefined,
154
160
  wMin: 100,
155
- onClick: onClickHoverRect
161
+ onClick: onClickHoverRect,
162
+ hideTickHover: !showXAxis
156
163
  }, ({
157
164
  xIndex,
158
165
  yIndex
@@ -266,7 +273,9 @@ _defineProperty(BarChartComponent, "defaultProps", {
266
273
  showXAxis: true,
267
274
  showYAxis: true,
268
275
  showTooltip: true,
269
- locale: 'en'
276
+ maxBarSize: 12,
277
+ locale: 'en',
278
+ deltaPercentGrowthColor: 'good'
270
279
  });
271
280
  export const BarChart = createComponent(BarChartComponent);
272
281
  //# sourceMappingURL=BarChart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","AbstractChart","minMax","GroupBar","HoverRect","StackBar","Line","YAxis","XAxis","localizedMessages","BarChartComponent","constructor","args","_defineProperty","_data","e","barIndex","barKey","onClickBar","asProps","xScale","invertAxis","valueScale","categoryScale","yScale","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","key","groupKey","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","type","dataDefinitions","highlightedItem","length","item","BarComponent","HorizontalBar","Bar","checked","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","_extends","renderTooltip","onClickHoverRect","Tooltip","wMin","xIndex","yIndex","dataItem","children","getTooltipChildren","renderAxis","showXAxis","showYAxis","axisXValueFormatter","axisYValueFormatter","multilineXTicks","multilineYTicks","Array","isArray","xTicks","yTicks","childrenX","value","childrenY","Ticks","primaryText","multiline","ticks","Grid","getLegendAriaLabel","getI18nText","chartType","marginY","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","max","maxStackedValue","Math","flatValues","direction","showTooltip","locale","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType, BarChartDefaultProps } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line, YAxis, XAxis } from '../..';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance,\n {},\n ChartState,\n BarChartDefaultProps\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n locale: 'en',\n } as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis } = this.asProps;\n const { dataDefinitions, highlightedItem } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n item.checked && (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n />\n {this.renderTrend(item.id)}\n </>\n )\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedItem !== -1 && highlightedItem !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedItem !== -1 && highlightedItem !== index,\n onClick: this.handleClickBar,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis, onClickHoverRect } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverRect.Tooltip,\n dataItem,\n index,\n }),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected override renderAxis(): React.ReactNode {\n const {\n invertAxis,\n showXAxis,\n showYAxis,\n data,\n axisXValueFormatter,\n axisYValueFormatter,\n multilineXTicks,\n multilineYTicks,\n } = this.asProps;\n\n if (!Array.isArray(data)) {\n return null;\n }\n\n const xTicks = this.xTicks;\n const yTicks = this.yTicks;\n\n const childrenX = axisXValueFormatter\n ? ({ value }: any) => ({ children: axisXValueFormatter(value) })\n : undefined;\n const childrenY = axisYValueFormatter\n ? ({ value }: any) => ({ children: axisYValueFormatter(value) })\n : undefined;\n\n return (\n <>\n {showYAxis && (\n <YAxis>\n {yTicks\n ? (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks} ticks={yTicks}>{childrenY}</YAxis.Ticks>\n )\n : (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks}>{childrenY}</YAxis.Ticks>\n )}\n {invertAxis !== true && (yTicks ? <YAxis.Grid ticks={yTicks} /> : <YAxis.Grid />)}\n </YAxis>\n )}\n\n {showXAxis && (\n <XAxis>\n {xTicks\n ? (\n <XAxis.Ticks multiline={multilineXTicks} ticks={xTicks}>{childrenX}</XAxis.Ticks>\n )\n : (\n <XAxis.Ticks multiline={multilineXTicks}>{childrenX}</XAxis.Ticks>\n )}\n {invertAxis === true && (xTicks ? <XAxis.Grid ticks={xTicks} /> : <XAxis.Grid />)}\n </XAxis>\n )}\n </>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 32,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n const { plotWidth, plotHeight } = this;\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 32, invertAxis, type } = this.asProps;\n const { plotWidth, plotHeight } = this;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\n/**\n * BarChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/bar-chart/bar-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/bar-chart/bar-chart-code/|Examples}\n */\nexport const BarChart = createComponent<\n BarChartType,\n typeof BarChartComponent\n>(BarChartComponent);\n"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC5D,OAAOC,KAAK,MAAM,OAAO;AAGzB,SAASC,aAAa,QAAQ,iBAAiB;AAG/C;AACA,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,QAAQ,OAAO;AACjF,SAASC,iBAAiB,QAAQ,oDAAoD;AAItF,MAAMC,iBAAiB,SAAST,aAAa,CAO3C;EAAAU,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,yBAwOyB,CACvBC,KAAsB,EACtBC,CAAuB,EACvBC,QAAgB,EAChBC,MAAc,KACX;MACH,MAAM;QAAEC;MAAW,CAAC,GAAG,IAAI,CAACC,OAAO;MAEnC,IAAID,UAAU,EAAE;QACdA,UAAU,CAACF,QAAQ,EAAEC,MAAM,EAAEF,CAAC,CAAC;MACjC;IACF,CAAC;EAAA;EAtOD,IAAIK,MAAMA,CAAA,EAAG;IACX,MAAM;MAAEA,MAAM;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACF,OAAO;IAE3C,IAAIC,MAAM,EAAE;MACV,OAAOA,MAAM;IACf;IAEA,OAAOC,UAAU,G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nBvC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfuC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE;AACV,CAAC;AAyRH,OAAO,MAAMC,QAAQ,GAAGzH,eAAe,CAGrCe,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"BarChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","AbstractChart","minMax","GroupBar","HoverRect","StackBar","Line","YAxis","XAxis","localizedMessages","BarChartComponent","constructor","args","_defineProperty","_data","e","barIndex","barKey","onClickBar","asProps","xScale","invertAxis","valueScale","categoryScale","yScale","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","key","groupKey","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","type","maxBarSize","dataDefinitions","highlightedItem","length","item","BarComponent","HorizontalBar","Bar","checked","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","_extends","renderTooltip","onClickHoverRect","showXAxis","Tooltip","wMin","hideTickHover","xIndex","yIndex","dataItem","children","getTooltipChildren","renderAxis","showYAxis","axisXValueFormatter","axisYValueFormatter","multilineXTicks","multilineYTicks","Array","isArray","xTicks","yTicks","childrenX","value","childrenY","Ticks","primaryText","multiline","ticks","Grid","getLegendAriaLabel","getI18nText","chartType","marginY","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","max","maxStackedValue","Math","flatValues","direction","showTooltip","locale","deltaPercentGrowthColor","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType, BarChartDefaultProps } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line, YAxis, XAxis } from '../..';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance,\n {},\n ChartState,\n BarChartDefaultProps\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n maxBarSize: 12,\n locale: 'en',\n deltaPercentGrowthColor: 'good',\n } as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis, maxBarSize } = this.asProps;\n const { dataDefinitions, highlightedItem } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n item.checked && (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n maxBarSize={maxBarSize}\n />\n {this.renderTrend(item.id)}\n </>\n )\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined} maxBarSize={maxBarSize}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedItem !== -1 && highlightedItem !== index,\n onClick: this.handleClickBar,\n maxBarSize,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedItem !== -1 && highlightedItem !== index,\n onClick: this.handleClickBar,\n maxBarSize,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis, onClickHoverRect, showXAxis } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\n hideTickHover={!showXAxis}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverRect.Tooltip,\n dataItem,\n index,\n }),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected override renderAxis(): React.ReactNode {\n const {\n invertAxis,\n showXAxis,\n showYAxis,\n data,\n axisXValueFormatter,\n axisYValueFormatter,\n multilineXTicks,\n multilineYTicks,\n } = this.asProps;\n\n if (!Array.isArray(data)) {\n return null;\n }\n\n const xTicks = this.xTicks;\n const yTicks = this.yTicks;\n\n const childrenX = axisXValueFormatter\n ? ({ value }: any) => ({ children: axisXValueFormatter(value) })\n : undefined;\n const childrenY = axisYValueFormatter\n ? ({ value }: any) => ({ children: axisYValueFormatter(value) })\n : undefined;\n\n return (\n <>\n {showYAxis && (\n <YAxis>\n {yTicks\n ? (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks} ticks={yTicks}>{childrenY}</YAxis.Ticks>\n )\n : (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks}>{childrenY}</YAxis.Ticks>\n )}\n {invertAxis !== true && (yTicks ? <YAxis.Grid ticks={yTicks} /> : <YAxis.Grid />)}\n </YAxis>\n )}\n\n {showXAxis && (\n <XAxis>\n {xTicks\n ? (\n <XAxis.Ticks multiline={multilineXTicks} ticks={xTicks}>{childrenX}</XAxis.Ticks>\n )\n : (\n <XAxis.Ticks multiline={multilineXTicks}>{childrenX}</XAxis.Ticks>\n )}\n {invertAxis === true && (xTicks ? <XAxis.Grid ticks={xTicks} /> : <XAxis.Grid />)}\n </XAxis>\n )}\n </>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 32,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n const { plotWidth, plotHeight } = this;\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 32, invertAxis, type } = this.asProps;\n const { plotWidth, plotHeight } = this;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\n/**\n * BarChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/bar-chart/bar-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/bar-chart/bar-chart-code/|Examples}\n */\nexport const BarChart = createComponent<\n BarChartType,\n typeof BarChartComponent\n>(BarChartComponent);\n"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC5D,OAAOC,KAAK,MAAM,OAAO;AAGzB,SAASC,aAAa,QAAQ,iBAAiB;AAG/C;AACA,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,QAAQ,OAAO;AACjF,SAASC,iBAAiB,QAAQ,oDAAoD;AAItF,MAAMC,iBAAiB,SAAST,aAAa,CAO3C;EAAAU,YAAA,GAAAC,IAAA;IAAA,SAA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,OAAO,GAAG,KAAK,CAACkE,eAAe,GAAGC,IAAI,CAACF,GAAG,CAAC,GAAG,KAAK,CAACG,UAAU,CAAC;IAEpF,OAAOpH,WAAW,CAAC,CAAC,CACjBwG,KAAK,CACJjF,UAAU,GACN,CAAC4E,OAAO,EAAEE,SAAS,GAAG,IAAI,CAACI,WAAW,CAAC,GACvC,CAACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAC7C,CAAC,CACAK,MAAM,CAAC,CAAC,CAAC,EAAEG,GAAG,CAAC,CAAC;EACrB;AACF;;AAEA;AACA;AACA;AACA;AACA;AAJAlG,eAAA,CA5SMH,iBAAiB,iBAQA,WAAW;AAAAG,eAAA,CAR5BH,iBAAiB,aAUJ,CAACd,WAAW,CAACa,iBAAiB,CAAC,CAAC;AAAAI,eAAA,CAV7CH,iBAAiB,kBAYC;EACpByG,SAAS,EAAE,QAAQ;EACnBhD,SAAS,EAAE,IAAI;EACfU,SAAS,EAAE,IAAI;EACfuC,WAAW,EAAE,IAAI;EACjBrE,UAAU,EAAE,EAAE;EACdsE,MAAM,EAAE,IAAI;EACZC,uBAAuB,EAAE;AAC3B,CAAC;AA6RH,OAAO,MAAMC,QAAQ,GAAG5H,eAAe,CAGrCe,iBAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport type React from 'react';\n\nimport type { AriaNameProps, BaseChartProps } from './AbstractChart.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number | string;\n y: number | string;\n};\n\ntype BarKey = string;\n\nexport type BarChartData = Array<Record<BarKey, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\n /** Field name that groups the data points */\n groupKey: string;\n /** Custom x-axis scale */\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Controls whether bars are grouped side-by-side or stacked */\n type?: 'stack' | 'group';\n /** Optional trend line data to overlay on the bars */\n trend?: Record<LegendItemKey, TrendItem[]>;\n /** Handle click by `HoverRect`. `index` is an index of the data array. */\n onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;\n /** Handle click by Bar. */\n onClickBar?: (barItem: number, barKey: BarKey, e: React.SyntheticEvent) => void;\n};\n\nexport type BarChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n};\n\nexport type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps & AriaNameProps>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport type React from 'react';\n\nimport type { AriaNameProps, BaseChartProps } from './AbstractChart.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number | string;\n y: number | string;\n};\n\ntype BarKey = string;\n\nexport type BarChartData = Array<Record<BarKey, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\n /** Field name that groups the data points */\n groupKey: string;\n /** Custom x-axis scale */\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Controls whether bars are grouped side-by-side or stacked */\n type?: 'stack' | 'group';\n /** Optional trend line data to overlay on the bars */\n trend?: Record<LegendItemKey, TrendItem[]>;\n /** Handle click by `HoverRect`. `index` is an index of the data array. */\n onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;\n /** Handle click by Bar. */\n onClickBar?: (barItem: number, barKey: BarKey, e: React.SyntheticEvent) => void;\n /** The maximum width of a bar */\n maxBarSize?: number;\n};\n\nexport type BarChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n deltaPercentGrowthColor: 'good';\n};\n\nexport type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps & AriaNameProps>;\n"],"mappings":"","ignoreList":[]}
@@ -11,6 +11,10 @@ import { Bubble, calculateBubbleDomain } from '../..';
11
11
  import { AbstractChart } from './AbstractChart';
12
12
  import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
13
13
  class BubbleChartComponent extends AbstractChart {
14
+ constructor(...args) {
15
+ super(...args);
16
+ _defineProperty(this, "plotPadding", 8);
17
+ }
14
18
  get dataKeys() {
15
19
  const {
16
20
  data
@@ -1 +1 @@
1
- {"version":3,"file":"BubbleChart.js","names":["Box","Flex","createComponent","sstyled","i18nEnhance","Text","scaleLinear","React","Bubble","calculateBubbleDomain","AbstractChart","localizedMessages","BubbleChartComponent","dataKeys","data","props","map","_","index","toString","getDefaultDataDefinitions","legendProps","item","key","legendData","legendMap","color","undefined","resolveColor","dataDefinition","id","label","icon","checked","defaultChecked","columns","additionalInfo","count","xScale","marginY","asProps","plotWidth","range","plotPadding","domain","yScale","marginX","plotHeight","defaultLegendProps","shape","renderChart","onClickBubble","dataDefinitions","state","createElement","onClick","x","y","value","Circle","visible","renderTooltip","Tooltip","_ref","styles","STooltipChildrenWrapper","children","cn","Title","getLegendAriaLabel","getI18nText","chartType","_defineProperty","direction","showXAxis","showYAxis","showTooltip","locale","BubbleChart"],"sources":["../../../../src/component/Chart/BubbleChart.tsx"],"sourcesContent":["import { Box, Flex } from '@semcore/base-components';\nimport { createComponent, sstyled } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Text } from '@semcore/typography';\nimport { scaleLinear, type ScaleLinear } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bubble, calculateBubbleDomain } from '../..';\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { BubbleChartData, BubbleChartProps, BubbleChartType, BubbleChartDefaultProps } from './BubbleChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { LegendItem } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BubbleChartComponent extends AbstractChart<\n BubbleChartData,\n BubbleChartProps,\n typeof BubbleChartComponent.enhance,\n {},\n ChartState,\n BubbleChartDefaultProps\n> {\n static displayName = 'Chart.Bubble';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n locale: 'en',\n } as const;\n\n protected get dataKeys(): string[] {\n const { data } = this.props;\n\n return data.map((_, index) => index.toString());\n }\n\n protected override getDefaultDataDefinitions(): Array<\n LegendItem & { columns: React.ReactNode[] }\n > {\n const { legendProps, data } = this.props;\n\n return data.map((item, index) => {\n const key = index.toString();\n const legendData = legendProps?.legendMap?.[key];\n\n if (item.color === undefined) {\n item.color = this.resolveColor(key, index);\n }\n\n const dataDefinition: LegendItem & { columns: React.ReactNode[] } = {\n id: key,\n label: legendData?.label ?? item.label ?? key,\n icon: legendData?.icon ?? undefined,\n checked: legendData?.defaultChecked ?? true,\n color: item.color,\n columns: [],\n };\n\n if (legendData?.additionalInfo || legendData?.count) {\n dataDefinition.additionalInfo = legendData.additionalInfo\n ? { label: legendData.additionalInfo }\n : legendData.count\n ? { count: legendData.count }\n : undefined;\n }\n\n return dataDefinition;\n });\n }\n\n get xScale() {\n const { xScale, marginY = 30, data } = this.asProps;\n const { plotWidth } = this;\n\n if (xScale) {\n return xScale;\n }\n\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = calculateBubbleDomain(data, 'x', range);\n\n return scaleLinear().domain(domain).range(range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 30, data } = this.asProps;\n const { plotHeight } = this;\n\n if (yScale) {\n return yScale;\n }\n\n const range = [plotHeight - marginX, this.plotPadding];\n const domain = calculateBubbleDomain(data, 'y', range);\n\n return scaleLinear().domain(domain).range(range);\n }\n\n defaultLegendProps() {\n return {\n shape: 'Circle' as const,\n };\n }\n\n renderChart() {\n const { onClickBubble } = this.asProps;\n const { dataDefinitions } = this.state;\n\n return (\n <Bubble onClick={onClickBubble} x='x' y='y' value='value' color='color' label='label'>\n {dataDefinitions.map(({ checked, id }, index) => (\n <Bubble.Circle visible={checked} key={id} index={index} />\n ))}\n </Bubble>\n );\n }\n\n renderTooltip() {\n return (\n <Bubble.Tooltip>\n {({ index, data }: any) => {\n const { styles } = this.asProps;\n const STooltipChildrenWrapper = Box;\n\n return {\n children: sstyled(styles)(\n <Flex direction='column'>\n <Bubble.Tooltip.Title>Data</Bubble.Tooltip.Title>\n <STooltipChildrenWrapper\n // @ts-ignore\n columnsCount={2}\n >\n <Text>X axis</Text>\n <Text textAlign='end'>{data[index].x}</Text>\n <Text>Y axis</Text>\n <Text textAlign='end'>{data[index].y}</Text>\n <Text>Value</Text>\n <Text textAlign='end'>{data[index].value}</Text>\n </STooltipChildrenWrapper>\n </Flex>,\n ),\n };\n }}\n </Bubble.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bubble' });\n }\n}\n\n/**\n * BubbleChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/bubble-chart/bubble-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/bubble-chart/bubble-chart-code/|Examples}\n */\nexport const BubbleChart = createComponent<\n BubbleChartType,\n typeof BubbleChartComponent\n>(BubbleChartComponent);\n"],"mappings":";AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AACpD,SAASC,eAAe,EAAEC,OAAO,QAAQ,eAAe;AACxD,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,IAAI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AC;AAiIH,OAAO,MAAMC,WAAW,GAAG5E,eAAe,CAGxCU,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"BubbleChart.js","names":["Box","Flex","createComponent","sstyled","i18nEnhance","Text","scaleLinear","React","Bubble","calculateBubbleDomain","AbstractChart","localizedMessages","BubbleChartComponent","constructor","args","_defineProperty","dataKeys","data","props","map","_","index","toString","getDefaultDataDefinitions","legendProps","item","key","legendData","legendMap","color","undefined","resolveColor","dataDefinition","id","label","icon","checked","defaultChecked","columns","additionalInfo","count","xScale","marginY","asProps","plotWidth","range","plotPadding","domain","yScale","marginX","plotHeight","defaultLegendProps","shape","renderChart","onClickBubble","dataDefinitions","state","createElement","onClick","x","y","value","Circle","visible","renderTooltip","Tooltip","_ref","styles","STooltipChildrenWrapper","children","cn","Title","getLegendAriaLabel","getI18nText","chartType","direction","showXAxis","showYAxis","showTooltip","locale","BubbleChart"],"sources":["../../../../src/component/Chart/BubbleChart.tsx"],"sourcesContent":["import { Box, Flex } from '@semcore/base-components';\nimport { createComponent, sstyled } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Text } from '@semcore/typography';\nimport { scaleLinear, type ScaleLinear } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bubble, calculateBubbleDomain } from '../..';\nimport type { ChartState } from './AbstractChart';\nimport { AbstractChart } from './AbstractChart';\nimport type { BubbleChartData, BubbleChartProps, BubbleChartType, BubbleChartDefaultProps } from './BubbleChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { LegendItem } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BubbleChartComponent extends AbstractChart<\n BubbleChartData,\n BubbleChartProps,\n typeof BubbleChartComponent.enhance,\n {},\n ChartState,\n BubbleChartDefaultProps\n> {\n static displayName = 'Chart.Bubble';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n static defaultProps = {\n direction: 'column',\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n locale: 'en',\n } as const;\n\n protected plotPadding = 8;\n\n protected get dataKeys(): string[] {\n const { data } = this.props;\n\n return data.map((_, index) => index.toString());\n }\n\n protected override getDefaultDataDefinitions(): Array<\n LegendItem & { columns: React.ReactNode[] }\n > {\n const { legendProps, data } = this.props;\n\n return data.map((item, index) => {\n const key = index.toString();\n const legendData = legendProps?.legendMap?.[key];\n\n if (item.color === undefined) {\n item.color = this.resolveColor(key, index);\n }\n\n const dataDefinition: LegendItem & { columns: React.ReactNode[] } = {\n id: key,\n label: legendData?.label ?? item.label ?? key,\n icon: legendData?.icon ?? undefined,\n checked: legendData?.defaultChecked ?? true,\n color: item.color,\n columns: [],\n };\n\n if (legendData?.additionalInfo || legendData?.count) {\n dataDefinition.additionalInfo = legendData.additionalInfo\n ? { label: legendData.additionalInfo }\n : legendData.count\n ? { count: legendData.count }\n : undefined;\n }\n\n return dataDefinition;\n });\n }\n\n get xScale() {\n const { xScale, marginY = 30, data } = this.asProps;\n const { plotWidth } = this;\n\n if (xScale) {\n return xScale;\n }\n\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = calculateBubbleDomain(data, 'x', range);\n\n return scaleLinear().domain(domain).range(range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 30, data } = this.asProps;\n const { plotHeight } = this;\n\n if (yScale) {\n return yScale;\n }\n\n const range = [plotHeight - marginX, this.plotPadding];\n const domain = calculateBubbleDomain(data, 'y', range);\n\n return scaleLinear().domain(domain).range(range);\n }\n\n defaultLegendProps() {\n return {\n shape: 'Circle' as const,\n };\n }\n\n renderChart() {\n const { onClickBubble } = this.asProps;\n const { dataDefinitions } = this.state;\n\n return (\n <Bubble onClick={onClickBubble} x='x' y='y' value='value' color='color' label='label'>\n {dataDefinitions.map(({ checked, id }, index) => (\n <Bubble.Circle visible={checked} key={id} index={index} />\n ))}\n </Bubble>\n );\n }\n\n renderTooltip() {\n return (\n <Bubble.Tooltip>\n {({ index, data }: any) => {\n const { styles } = this.asProps;\n const STooltipChildrenWrapper = Box;\n\n return {\n children: sstyled(styles)(\n <Flex direction='column'>\n <Bubble.Tooltip.Title>Data</Bubble.Tooltip.Title>\n <STooltipChildrenWrapper\n // @ts-ignore\n columnsCount={2}\n >\n <Text>X axis</Text>\n <Text textAlign='end'>{data[index].x}</Text>\n <Text>Y axis</Text>\n <Text textAlign='end'>{data[index].y}</Text>\n <Text>Value</Text>\n <Text textAlign='end'>{data[index].value}</Text>\n </STooltipChildrenWrapper>\n </Flex>,\n ),\n };\n }}\n </Bubble.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bubble' });\n }\n}\n\n/**\n * BubbleChart\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/bubble-chart/bubble-chart-api/|API} | {@link https://developer.semrush.com/intergalactic/data-display/bubble-chart/bubble-chart-code/|Examples}\n */\nexport const BubbleChart = createComponent<\n BubbleChartType,\n typeof BubbleChartComponent\n>(BubbleChartComponent);\n"],"mappings":";AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AACpD,SAASC,eAAe,EAAEC,OAAO,QAAQ,eAAe;AACxD,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,WAAW,QAA0B,UAAU;AACxD,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,SAASC,MAAM,EAAEC,qBAAqB,QAAQ,OAAO;AAErD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,oDAAoD;AAGtF,MAAMC,oBAAoB,SAASF,aAAa,CAO9C;EAAAG,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,sBAawB,CAAC;EAAA;EAEzB,IAAcC,QAAQA,CAAA,EAAa;IACjC,MAAM;MAAEC;IAAK,CAAC,GAAG,IAAI,CAACC,KAAK;IAE3B,OAAOD,I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AC,eACnB/D,KAAA,CAAAkD,aAAA,CAACpD,IAAI,EAAA6D,IAAA,CAAAI,EAAA;UAAA,aAAW;QAAK,IAAErD,IAAI,CAACI,KAAK,CAAC,CAACuC,CAAQ,CAAC,eAC5CrD,KAAA,CAAAkD,aAAA,CAACpD,IAAI,EAAA6D,IAAA,CAAAI,EAAA,cAAC,OAAW,CAAC,eAClB/D,KAAA,CAAAkD,aAAA,CAACpD,IAAI,EAAA6D,IAAA,CAAAI,EAAA;UAAA,aAAW;QAAK,IAAErD,IAAI,CAACI,KAAK,CAAC,CAACwC,KAAY,CACxB,CACrB,CAAC;MAEX,CAAC;IACH,CACc,CAAC;EAErB;EAEUW,kBAAkBA,CAAA,EAAW;IACrC,OAAO,IAAI,CAAC7B,OAAO,CAAC8B,WAAW,CAAC,gBAAgB,EAAE;MAAEC,SAAS,EAAE;IAAS,CAAC,CAAC;EAC5E;AACF;;AAEA;AACA;AACA;AACA;AACA;AAJA3D,eAAA,CAhJMH,oBAAoB,iBAQH,cAAc;AAAAG,eAAA,CAR/BH,oBAAoB,aAUP,CAACR,WAAW,CAACO,iBAAiB,CAAC,CAAC;AAAAI,eAAA,CAV7CH,oBAAoB,kBAYF;EACpB+D,SAAS,EAAE,QAAQ;EACnBC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,IAAI;EACfC,WAAW,EAAE,IAAI;EACjBC,MAAM,EAAE;AACV,CAAC;AAmIH,OAAO,MAAMC,WAAW,GAAG9E,eAAe,CAGxCU,oBAAoB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"BubbleChart.type.js","names":[],"sources":["../../../../src/component/Chart/BubbleChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleLinear } from 'd3-scale';\n\nimport type { BaseChartProps } from './AbstractChart.type';\n\nexport type ScaledValues = {\n x: number[];\n y: number[];\n};\n\nexport type BubbleChartData = Array<{\n x: number;\n y: number;\n value: number;\n label?: string;\n color?: string;\n}>;\n\nexport type BubbleChartProps = Intergalactic.InternalTypings.EfficientOmit<\n BaseChartProps<BubbleChartData>,\n 'showTotalInTooltip' | 'showDeltaPercentInTooltip' | 'getPercentDelta'\n> & {\n /** Field name that groups the data points */\n groupKey?: never;\n /** Custom x-axis scale */\n xScale?: ScaleLinear<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Callback triggered when a user clicks on a bubble */\n onClickBubble?: (index: number, event: React.SyntheticEvent) => void;\n};\n\nexport type BubbleChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n};\n\nexport type BubbleChartType = Intergalactic.Component<typeof Flex, BubbleChartProps>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"BubbleChart.type.js","names":[],"sources":["../../../../src/component/Chart/BubbleChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleLinear } from 'd3-scale';\n\nimport type { BaseChartProps } from './AbstractChart.type';\n\nexport type ScaledValues = {\n x: number[];\n y: number[];\n};\n\nexport type BubbleChartData = Array<{\n x: number;\n y: number;\n value: number;\n label?: string;\n color?: string;\n}>;\n\nexport type BubbleChartProps = Intergalactic.InternalTypings.EfficientOmit<\n BaseChartProps<BubbleChartData>,\n 'showTotalInTooltip' | 'showDeltaPercentInTooltip' | 'getPercentDelta' | 'deltaPercentGrowthColor'\n> & {\n /** Field name that groups the data points */\n groupKey?: never;\n /** Custom x-axis scale */\n xScale?: ScaleLinear<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Callback triggered when a user clicks on a bubble */\n onClickBubble?: (index: number, event: React.SyntheticEvent) => void;\n};\n\nexport type BubbleChartDefaultProps = {\n direction: 'column';\n showXAxis: true;\n showYAxis: true;\n showTooltip: true;\n locale: 'en';\n};\n\nexport type BubbleChartType = Intergalactic.Component<typeof Flex, BubbleChartProps>;\n"],"mappings":"","ignoreList":[]}
@@ -74,7 +74,11 @@ class CigaretteChartComponent extends AbstractChart {
74
74
  getDefaultDataDefinitions() {
75
75
  const dataDefinitions = super.getDefaultDataDefinitions();
76
76
  return dataDefinitions.map(dataDef => {
77
- dataDef.columns = dataDef.columns.slice(1);
77
+ if ('columns' in dataDef) {
78
+ dataDef.columns = dataDef.columns.slice(1);
79
+ } else if ('rows' in dataDef) {
80
+ dataDef.rows = dataDef.rows.slice(1);
81
+ }
78
82
  return dataDef;
79
83
  });
80
84
  }