@gravity-ui/charts 1.22.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/dist/cjs/components/AxisX/AxisX.d.ts +3 -3
  2. package/dist/cjs/components/ChartInner/index.js +94 -27
  3. package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
  4. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +41 -20
  5. package/dist/cjs/components/ChartInner/useChartInnerProps.js +21 -9
  6. package/dist/cjs/components/ChartInner/useChartInnerState.d.ts +6 -1
  7. package/dist/cjs/components/ChartInner/useChartInnerState.js +17 -1
  8. package/dist/cjs/components/ChartInner/utils.d.ts +5 -2
  9. package/dist/cjs/components/ChartInner/utils.js +13 -0
  10. package/dist/cjs/components/RangeSlider/index.d.ts +6 -0
  11. package/dist/cjs/components/RangeSlider/index.js +41 -0
  12. package/dist/cjs/components/RangeSlider/styles.css +6 -0
  13. package/dist/cjs/components/RangeSlider/utils.d.ts +5 -0
  14. package/dist/cjs/components/RangeSlider/utils.js +18 -0
  15. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.js +2 -1
  16. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.d.ts +2 -2
  17. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.js +3 -2
  18. package/dist/cjs/components/Tooltip/index.d.ts +3 -3
  19. package/dist/cjs/constants/chart-types.d.ts +3 -1
  20. package/dist/cjs/constants/chart-types.js +2 -1
  21. package/dist/cjs/constants/defaults/brush.d.ts +2 -0
  22. package/dist/cjs/constants/defaults/brush.js +15 -0
  23. package/dist/cjs/constants/defaults/index.d.ts +1 -0
  24. package/dist/cjs/constants/defaults/index.js +1 -0
  25. package/dist/cjs/constants/defaults/series-options.d.ts +2 -1
  26. package/dist/cjs/constants/defaults/series-options.js +11 -0
  27. package/dist/cjs/constants/index.d.ts +1 -0
  28. package/dist/cjs/constants/index.js +1 -0
  29. package/dist/cjs/constants/zoom.d.ts +6 -0
  30. package/dist/cjs/constants/zoom.js +5 -0
  31. package/dist/cjs/hooks/index.d.ts +5 -0
  32. package/dist/cjs/hooks/index.js +5 -0
  33. package/dist/cjs/hooks/useAxis/index.d.ts +4 -3
  34. package/dist/cjs/hooks/useAxis/index.js +2 -2
  35. package/dist/cjs/hooks/useAxis/range-slider.d.ts +5 -0
  36. package/dist/cjs/hooks/useAxis/range-slider.js +16 -0
  37. package/dist/cjs/hooks/useAxis/types.d.ts +66 -0
  38. package/dist/cjs/hooks/useAxis/types.js +1 -0
  39. package/dist/cjs/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  40. package/dist/cjs/hooks/useAxis/utils.js +9 -0
  41. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.d.ts +2 -2
  42. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.js +5 -3
  43. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  44. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  45. package/dist/cjs/hooks/useAxisScales/index.d.ts +3 -3
  46. package/dist/cjs/hooks/useAxisScales/index.js +41 -15
  47. package/dist/cjs/hooks/useBrush/index.js +87 -24
  48. package/dist/cjs/hooks/useBrush/styles.css +1 -0
  49. package/dist/cjs/hooks/useBrush/types.d.ts +8 -7
  50. package/dist/cjs/hooks/useBrush/utils.d.ts +19 -0
  51. package/dist/cjs/hooks/useBrush/utils.js +172 -0
  52. package/dist/cjs/hooks/useChartDimensions/index.d.ts +4 -4
  53. package/dist/cjs/hooks/useChartDimensions/index.js +14 -4
  54. package/dist/cjs/hooks/useChartDimensions/utils.d.ts +4 -4
  55. package/dist/cjs/hooks/useChartOptions/chart.js +1 -82
  56. package/dist/cjs/hooks/useChartOptions/index.d.ts +9 -3
  57. package/dist/cjs/hooks/useChartOptions/tooltip.js +1 -1
  58. package/dist/cjs/hooks/useChartOptions/types.d.ts +4 -64
  59. package/dist/cjs/hooks/useChartOptions/zoom.d.ts +11 -0
  60. package/dist/cjs/hooks/useChartOptions/zoom.js +91 -0
  61. package/dist/cjs/hooks/useCrosshair/index.d.ts +3 -3
  62. package/dist/cjs/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  63. package/dist/cjs/hooks/useNormalizedOriginalData/index.js +1 -2
  64. package/dist/cjs/hooks/useRangeSlider/index.d.ts +4 -0
  65. package/dist/cjs/hooks/useRangeSlider/index.js +129 -0
  66. package/dist/cjs/hooks/useRangeSlider/types.d.ts +42 -0
  67. package/dist/cjs/hooks/useRangeSlider/types.js +1 -0
  68. package/dist/cjs/hooks/useRangeSlider/utils.d.ts +16 -0
  69. package/dist/cjs/hooks/useRangeSlider/utils.js +19 -0
  70. package/dist/cjs/hooks/useSeries/prepare-area.js +17 -2
  71. package/dist/cjs/hooks/useSeries/prepare-bar-x.js +21 -9
  72. package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +3 -2
  73. package/dist/cjs/hooks/useSeries/prepare-bar-y.js +20 -7
  74. package/dist/cjs/hooks/useSeries/prepare-funnel.d.ts +10 -0
  75. package/dist/cjs/hooks/useSeries/prepare-funnel.js +50 -0
  76. package/dist/cjs/hooks/useSeries/prepare-heatmap.js +13 -1
  77. package/dist/cjs/hooks/useSeries/prepare-legend.js +5 -2
  78. package/dist/cjs/hooks/useSeries/prepare-line.js +17 -2
  79. package/dist/cjs/hooks/useSeries/prepare-pie.js +17 -3
  80. package/dist/cjs/hooks/useSeries/prepare-scatter.js +18 -1
  81. package/dist/cjs/hooks/useSeries/prepare-waterfall.js +18 -2
  82. package/dist/cjs/hooks/useSeries/prepareSeries.js +9 -0
  83. package/dist/cjs/hooks/useSeries/types.d.ts +22 -6
  84. package/dist/cjs/hooks/useShapes/area/index.d.ts +3 -3
  85. package/dist/cjs/hooks/useShapes/area/index.js +4 -2
  86. package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +3 -3
  87. package/dist/cjs/hooks/useShapes/area/prepare-data.js +37 -22
  88. package/dist/cjs/hooks/useShapes/area/types.d.ts +5 -2
  89. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +3 -3
  90. package/dist/cjs/hooks/useShapes/bar-x/index.js +2 -2
  91. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +3 -3
  92. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +26 -15
  93. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +4 -4
  94. package/dist/cjs/hooks/useShapes/bar-y/index.js +21 -24
  95. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  96. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +26 -8
  97. package/dist/cjs/hooks/useShapes/bar-y/types.d.ts +2 -2
  98. package/dist/cjs/hooks/useShapes/bar-y/utils.d.ts +3 -0
  99. package/dist/cjs/hooks/useShapes/bar-y/utils.js +44 -0
  100. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +13 -0
  101. package/dist/cjs/hooks/useShapes/funnel/index.js +95 -0
  102. package/dist/cjs/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  103. package/dist/cjs/hooks/useShapes/funnel/prepare-data.js +120 -0
  104. package/dist/cjs/hooks/useShapes/funnel/types.d.ts +32 -0
  105. package/dist/cjs/hooks/useShapes/funnel/types.js +1 -0
  106. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +2 -2
  107. package/dist/cjs/hooks/useShapes/heatmap/index.js +2 -2
  108. package/dist/cjs/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  109. package/dist/cjs/hooks/useShapes/heatmap/prepare-data.js +7 -3
  110. package/dist/cjs/hooks/useShapes/index.d.ts +15 -10
  111. package/dist/cjs/hooks/useShapes/index.js +47 -25
  112. package/dist/cjs/hooks/useShapes/line/index.d.ts +3 -3
  113. package/dist/cjs/hooks/useShapes/line/index.js +3 -2
  114. package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +3 -3
  115. package/dist/cjs/hooks/useShapes/line/prepare-data.js +58 -44
  116. package/dist/cjs/hooks/useShapes/line/types.d.ts +7 -3
  117. package/dist/cjs/hooks/useShapes/pie/index.d.ts +2 -2
  118. package/dist/cjs/hooks/useShapes/pie/index.js +2 -2
  119. package/dist/cjs/hooks/useShapes/pie/prepare-data.js +8 -4
  120. package/dist/cjs/hooks/useShapes/radar/index.d.ts +2 -2
  121. package/dist/cjs/hooks/useShapes/radar/index.js +2 -2
  122. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +2 -2
  123. package/dist/cjs/hooks/useShapes/sankey/index.js +2 -2
  124. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +3 -2
  125. package/dist/cjs/hooks/useShapes/scatter/index.js +4 -4
  126. package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  127. package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +1 -1
  128. package/dist/cjs/hooks/useShapes/styles.css +8 -0
  129. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +2 -2
  130. package/dist/cjs/hooks/useShapes/treemap/index.js +2 -2
  131. package/dist/cjs/hooks/useShapes/utils.d.ts +17 -9
  132. package/dist/cjs/hooks/useShapes/utils.js +66 -18
  133. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +3 -3
  134. package/dist/cjs/hooks/useShapes/waterfall/index.js +2 -2
  135. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  136. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +18 -8
  137. package/dist/cjs/hooks/useTooltip/index.js +8 -4
  138. package/dist/cjs/hooks/useZoom/index.d.ts +4 -3
  139. package/dist/cjs/hooks/useZoom/index.js +2 -0
  140. package/dist/cjs/hooks/useZoom/utils.d.ts +5 -4
  141. package/dist/cjs/hooks/useZoom/utils.js +4 -3
  142. package/dist/cjs/hooks/utils/bar-x.d.ts +2 -2
  143. package/dist/cjs/hooks/utils/bar-y.d.ts +10 -3
  144. package/dist/cjs/hooks/utils/bar-y.js +4 -0
  145. package/dist/cjs/i18n/keysets/en.json +2 -2
  146. package/dist/cjs/i18n/keysets/ru.json +2 -2
  147. package/dist/cjs/types/chart/area.d.ts +18 -3
  148. package/dist/cjs/types/chart/axis.d.ts +45 -0
  149. package/dist/cjs/types/chart/bar-x.d.ts +17 -4
  150. package/dist/cjs/types/chart/bar-y.d.ts +12 -3
  151. package/dist/cjs/types/chart/base.d.ts +26 -25
  152. package/dist/cjs/types/chart/brush.d.ts +22 -0
  153. package/dist/cjs/types/chart/brush.js +1 -0
  154. package/dist/cjs/types/chart/funnel.d.ts +46 -0
  155. package/dist/cjs/types/chart/funnel.js +1 -0
  156. package/dist/cjs/types/chart/heatmap.d.ts +12 -3
  157. package/dist/cjs/types/chart/legend.d.ts +6 -0
  158. package/dist/cjs/types/chart/line.d.ts +18 -3
  159. package/dist/cjs/types/chart/pie.d.ts +12 -3
  160. package/dist/cjs/types/chart/radar.d.ts +2 -2
  161. package/dist/cjs/types/chart/sankey.d.ts +2 -2
  162. package/dist/cjs/types/chart/scatter.d.ts +18 -4
  163. package/dist/cjs/types/chart/series.d.ts +17 -2
  164. package/dist/cjs/types/chart/tooltip.d.ts +10 -2
  165. package/dist/cjs/types/chart/treemap.d.ts +2 -2
  166. package/dist/cjs/types/chart/waterfall.d.ts +12 -3
  167. package/dist/cjs/types/chart/zoom.d.ts +4 -6
  168. package/dist/cjs/types/index.d.ts +2 -0
  169. package/dist/cjs/types/index.js +2 -0
  170. package/dist/cjs/types/misc.d.ts +6 -0
  171. package/dist/cjs/utils/chart/axis.d.ts +5 -2
  172. package/dist/cjs/utils/chart/axis.js +47 -1
  173. package/dist/cjs/utils/chart/color.js +2 -1
  174. package/dist/cjs/utils/chart/get-closest-data.js +30 -8
  175. package/dist/cjs/utils/chart/index.js +3 -3
  176. package/dist/cjs/utils/chart/series/sorting.js +20 -7
  177. package/dist/cjs/utils/chart/zoom.d.ts +3 -3
  178. package/dist/cjs/utils/chart/zoom.js +6 -4
  179. package/dist/cjs/validation/index.js +6 -6
  180. package/dist/esm/components/AxisX/AxisX.d.ts +3 -3
  181. package/dist/esm/components/ChartInner/index.js +94 -27
  182. package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
  183. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +41 -20
  184. package/dist/esm/components/ChartInner/useChartInnerProps.js +21 -9
  185. package/dist/esm/components/ChartInner/useChartInnerState.d.ts +6 -1
  186. package/dist/esm/components/ChartInner/useChartInnerState.js +17 -1
  187. package/dist/esm/components/ChartInner/utils.d.ts +5 -2
  188. package/dist/esm/components/ChartInner/utils.js +13 -0
  189. package/dist/esm/components/RangeSlider/index.d.ts +6 -0
  190. package/dist/esm/components/RangeSlider/index.js +41 -0
  191. package/dist/esm/components/RangeSlider/styles.css +6 -0
  192. package/dist/esm/components/RangeSlider/utils.d.ts +5 -0
  193. package/dist/esm/components/RangeSlider/utils.js +18 -0
  194. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +2 -1
  195. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.d.ts +2 -2
  196. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.js +3 -2
  197. package/dist/esm/components/Tooltip/index.d.ts +3 -3
  198. package/dist/esm/constants/chart-types.d.ts +3 -1
  199. package/dist/esm/constants/chart-types.js +2 -1
  200. package/dist/esm/constants/defaults/brush.d.ts +2 -0
  201. package/dist/esm/constants/defaults/brush.js +15 -0
  202. package/dist/esm/constants/defaults/index.d.ts +1 -0
  203. package/dist/esm/constants/defaults/index.js +1 -0
  204. package/dist/esm/constants/defaults/series-options.d.ts +2 -1
  205. package/dist/esm/constants/defaults/series-options.js +11 -0
  206. package/dist/esm/constants/index.d.ts +1 -0
  207. package/dist/esm/constants/index.js +1 -0
  208. package/dist/esm/constants/zoom.d.ts +6 -0
  209. package/dist/esm/constants/zoom.js +5 -0
  210. package/dist/esm/hooks/index.d.ts +5 -0
  211. package/dist/esm/hooks/index.js +5 -0
  212. package/dist/esm/hooks/useAxis/index.d.ts +4 -3
  213. package/dist/esm/hooks/useAxis/index.js +2 -2
  214. package/dist/esm/hooks/useAxis/range-slider.d.ts +5 -0
  215. package/dist/esm/hooks/useAxis/range-slider.js +16 -0
  216. package/dist/esm/hooks/useAxis/types.d.ts +66 -0
  217. package/dist/esm/hooks/useAxis/types.js +1 -0
  218. package/dist/esm/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  219. package/dist/esm/hooks/useAxis/utils.js +9 -0
  220. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.d.ts +2 -2
  221. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.js +5 -3
  222. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  223. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  224. package/dist/esm/hooks/useAxisScales/index.d.ts +3 -3
  225. package/dist/esm/hooks/useAxisScales/index.js +41 -15
  226. package/dist/esm/hooks/useBrush/index.js +87 -24
  227. package/dist/esm/hooks/useBrush/styles.css +1 -0
  228. package/dist/esm/hooks/useBrush/types.d.ts +8 -7
  229. package/dist/esm/hooks/useBrush/utils.d.ts +19 -0
  230. package/dist/esm/hooks/useBrush/utils.js +172 -0
  231. package/dist/esm/hooks/useChartDimensions/index.d.ts +4 -4
  232. package/dist/esm/hooks/useChartDimensions/index.js +14 -4
  233. package/dist/esm/hooks/useChartDimensions/utils.d.ts +4 -4
  234. package/dist/esm/hooks/useChartOptions/chart.js +1 -82
  235. package/dist/esm/hooks/useChartOptions/index.d.ts +9 -3
  236. package/dist/esm/hooks/useChartOptions/tooltip.js +1 -1
  237. package/dist/esm/hooks/useChartOptions/types.d.ts +4 -64
  238. package/dist/esm/hooks/useChartOptions/zoom.d.ts +11 -0
  239. package/dist/esm/hooks/useChartOptions/zoom.js +91 -0
  240. package/dist/esm/hooks/useCrosshair/index.d.ts +3 -3
  241. package/dist/esm/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  242. package/dist/esm/hooks/useNormalizedOriginalData/index.js +1 -2
  243. package/dist/esm/hooks/useRangeSlider/index.d.ts +4 -0
  244. package/dist/esm/hooks/useRangeSlider/index.js +129 -0
  245. package/dist/esm/hooks/useRangeSlider/types.d.ts +42 -0
  246. package/dist/esm/hooks/useRangeSlider/types.js +1 -0
  247. package/dist/esm/hooks/useRangeSlider/utils.d.ts +16 -0
  248. package/dist/esm/hooks/useRangeSlider/utils.js +19 -0
  249. package/dist/esm/hooks/useSeries/prepare-area.js +17 -2
  250. package/dist/esm/hooks/useSeries/prepare-bar-x.js +21 -9
  251. package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +3 -2
  252. package/dist/esm/hooks/useSeries/prepare-bar-y.js +20 -7
  253. package/dist/esm/hooks/useSeries/prepare-funnel.d.ts +10 -0
  254. package/dist/esm/hooks/useSeries/prepare-funnel.js +50 -0
  255. package/dist/esm/hooks/useSeries/prepare-heatmap.js +13 -1
  256. package/dist/esm/hooks/useSeries/prepare-legend.js +5 -2
  257. package/dist/esm/hooks/useSeries/prepare-line.js +17 -2
  258. package/dist/esm/hooks/useSeries/prepare-pie.js +17 -3
  259. package/dist/esm/hooks/useSeries/prepare-scatter.js +18 -1
  260. package/dist/esm/hooks/useSeries/prepare-waterfall.js +18 -2
  261. package/dist/esm/hooks/useSeries/prepareSeries.js +9 -0
  262. package/dist/esm/hooks/useSeries/types.d.ts +22 -6
  263. package/dist/esm/hooks/useShapes/area/index.d.ts +3 -3
  264. package/dist/esm/hooks/useShapes/area/index.js +4 -2
  265. package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +3 -3
  266. package/dist/esm/hooks/useShapes/area/prepare-data.js +37 -22
  267. package/dist/esm/hooks/useShapes/area/types.d.ts +5 -2
  268. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +3 -3
  269. package/dist/esm/hooks/useShapes/bar-x/index.js +2 -2
  270. package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +3 -3
  271. package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +26 -15
  272. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +4 -4
  273. package/dist/esm/hooks/useShapes/bar-y/index.js +21 -24
  274. package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  275. package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +26 -8
  276. package/dist/esm/hooks/useShapes/bar-y/types.d.ts +2 -2
  277. package/dist/esm/hooks/useShapes/bar-y/utils.d.ts +3 -0
  278. package/dist/esm/hooks/useShapes/bar-y/utils.js +44 -0
  279. package/dist/esm/hooks/useShapes/funnel/index.d.ts +13 -0
  280. package/dist/esm/hooks/useShapes/funnel/index.js +95 -0
  281. package/dist/esm/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  282. package/dist/esm/hooks/useShapes/funnel/prepare-data.js +120 -0
  283. package/dist/esm/hooks/useShapes/funnel/types.d.ts +32 -0
  284. package/dist/esm/hooks/useShapes/funnel/types.js +1 -0
  285. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +2 -2
  286. package/dist/esm/hooks/useShapes/heatmap/index.js +2 -2
  287. package/dist/esm/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  288. package/dist/esm/hooks/useShapes/heatmap/prepare-data.js +7 -3
  289. package/dist/esm/hooks/useShapes/index.d.ts +15 -10
  290. package/dist/esm/hooks/useShapes/index.js +47 -25
  291. package/dist/esm/hooks/useShapes/line/index.d.ts +3 -3
  292. package/dist/esm/hooks/useShapes/line/index.js +3 -2
  293. package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +3 -3
  294. package/dist/esm/hooks/useShapes/line/prepare-data.js +58 -44
  295. package/dist/esm/hooks/useShapes/line/types.d.ts +7 -3
  296. package/dist/esm/hooks/useShapes/pie/index.d.ts +2 -2
  297. package/dist/esm/hooks/useShapes/pie/index.js +2 -2
  298. package/dist/esm/hooks/useShapes/pie/prepare-data.js +8 -4
  299. package/dist/esm/hooks/useShapes/radar/index.d.ts +2 -2
  300. package/dist/esm/hooks/useShapes/radar/index.js +2 -2
  301. package/dist/esm/hooks/useShapes/sankey/index.d.ts +2 -2
  302. package/dist/esm/hooks/useShapes/sankey/index.js +2 -2
  303. package/dist/esm/hooks/useShapes/scatter/index.d.ts +3 -2
  304. package/dist/esm/hooks/useShapes/scatter/index.js +4 -4
  305. package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  306. package/dist/esm/hooks/useShapes/scatter/prepare-data.js +1 -1
  307. package/dist/esm/hooks/useShapes/styles.css +8 -0
  308. package/dist/esm/hooks/useShapes/treemap/index.d.ts +2 -2
  309. package/dist/esm/hooks/useShapes/treemap/index.js +2 -2
  310. package/dist/esm/hooks/useShapes/utils.d.ts +17 -9
  311. package/dist/esm/hooks/useShapes/utils.js +66 -18
  312. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +3 -3
  313. package/dist/esm/hooks/useShapes/waterfall/index.js +2 -2
  314. package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  315. package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +18 -8
  316. package/dist/esm/hooks/useTooltip/index.js +8 -4
  317. package/dist/esm/hooks/useZoom/index.d.ts +4 -3
  318. package/dist/esm/hooks/useZoom/index.js +2 -0
  319. package/dist/esm/hooks/useZoom/utils.d.ts +5 -4
  320. package/dist/esm/hooks/useZoom/utils.js +4 -3
  321. package/dist/esm/hooks/utils/bar-x.d.ts +2 -2
  322. package/dist/esm/hooks/utils/bar-y.d.ts +10 -3
  323. package/dist/esm/hooks/utils/bar-y.js +4 -0
  324. package/dist/esm/i18n/keysets/en.json +2 -2
  325. package/dist/esm/i18n/keysets/ru.json +2 -2
  326. package/dist/esm/types/chart/area.d.ts +18 -3
  327. package/dist/esm/types/chart/axis.d.ts +45 -0
  328. package/dist/esm/types/chart/bar-x.d.ts +17 -4
  329. package/dist/esm/types/chart/bar-y.d.ts +12 -3
  330. package/dist/esm/types/chart/base.d.ts +26 -25
  331. package/dist/esm/types/chart/brush.d.ts +22 -0
  332. package/dist/esm/types/chart/brush.js +1 -0
  333. package/dist/esm/types/chart/funnel.d.ts +46 -0
  334. package/dist/esm/types/chart/funnel.js +1 -0
  335. package/dist/esm/types/chart/heatmap.d.ts +12 -3
  336. package/dist/esm/types/chart/legend.d.ts +6 -0
  337. package/dist/esm/types/chart/line.d.ts +18 -3
  338. package/dist/esm/types/chart/pie.d.ts +12 -3
  339. package/dist/esm/types/chart/radar.d.ts +2 -2
  340. package/dist/esm/types/chart/sankey.d.ts +2 -2
  341. package/dist/esm/types/chart/scatter.d.ts +18 -4
  342. package/dist/esm/types/chart/series.d.ts +17 -2
  343. package/dist/esm/types/chart/tooltip.d.ts +10 -2
  344. package/dist/esm/types/chart/treemap.d.ts +2 -2
  345. package/dist/esm/types/chart/waterfall.d.ts +12 -3
  346. package/dist/esm/types/chart/zoom.d.ts +4 -6
  347. package/dist/esm/types/index.d.ts +2 -0
  348. package/dist/esm/types/index.js +2 -0
  349. package/dist/esm/types/misc.d.ts +6 -0
  350. package/dist/esm/utils/chart/axis.d.ts +5 -2
  351. package/dist/esm/utils/chart/axis.js +47 -1
  352. package/dist/esm/utils/chart/color.js +2 -1
  353. package/dist/esm/utils/chart/get-closest-data.js +30 -8
  354. package/dist/esm/utils/chart/index.js +3 -3
  355. package/dist/esm/utils/chart/series/sorting.js +20 -7
  356. package/dist/esm/utils/chart/zoom.d.ts +3 -3
  357. package/dist/esm/utils/chart/zoom.js +6 -4
  358. package/dist/esm/validation/index.js +6 -6
  359. package/package.json +1 -1
  360. package/dist/cjs/hooks/useChartOptions/utils.js +0 -49
  361. package/dist/esm/hooks/useChartOptions/utils.js +0 -49
@@ -1,14 +1,17 @@
1
1
  import React from 'react';
2
- import { useAxis, useAxisScales, useChartDimensions, useChartOptions, useNormalizedOriginalData, usePrevious, useSeries, useShapes, useSplit, } from '../../hooks';
2
+ import { SERIES_TYPE } from '../../constants';
3
+ import { useAxis, useAxisScales, useChartDimensions, useChartOptions, useNormalizedOriginalData, usePrevious, useSeries, useShapes, useSplit, useZoom, } from '../../hooks';
3
4
  import { getYAxisWidth } from '../../hooks/useChartDimensions/utils';
4
5
  import { getLegendComponents } from '../../hooks/useSeries/prepare-legend';
5
6
  import { getPreparedOptions } from '../../hooks/useSeries/prepare-options';
6
- import { useZoom } from '../../hooks/useZoom';
7
7
  import { getZoomedSeriesData } from '../../utils';
8
8
  import { hasAtLeastOneSeriesDataPerPlot } from './utils';
9
+ const CLIP_PATH_BY_SERIES_TYPE = {
10
+ [SERIES_TYPE.Scatter]: false,
11
+ };
9
12
  export function useChartInnerProps(props) {
10
13
  var _a;
11
- const { clipPathId, data, dispatcher, height, htmlLayout, plotNode, svgContainer, width, updateZoomState, zoomState, } = props;
14
+ const { clipPathId, data, dispatcher, height, htmlLayout, plotNode, rangeSliderState, svgContainer, width, updateZoomState, zoomState, } = props;
12
15
  const prevWidth = usePrevious(width);
13
16
  const prevHeight = usePrevious(height);
14
17
  const { normalizedSeriesData, normalizedXAxis, normalizedYAxis } = useNormalizedOriginalData({
@@ -16,16 +19,17 @@ export function useChartInnerProps(props) {
16
19
  xAxis: data.xAxis,
17
20
  yAxis: data.yAxis,
18
21
  });
19
- const { chart, title, colors } = useChartOptions({
22
+ const { chart, colors, title } = useChartOptions({
20
23
  chart: data.chart,
21
24
  colors: data.colors,
22
25
  seriesData: normalizedSeriesData,
23
26
  title: data.title,
27
+ xAxis: data.xAxis,
24
28
  });
25
29
  const preparedSeriesOptions = React.useMemo(() => {
26
30
  return getPreparedOptions(data.series.options);
27
31
  }, [data.series.options]);
28
- const { preparedSeries: basePreparedSeries, preparedLegend, handleLegendItemClick, } = useSeries({
32
+ const { preparedSeries: allPreparedSeries, preparedLegend, handleLegendItemClick, } = useSeries({
29
33
  colors,
30
34
  legend: data.legend,
31
35
  originalSeriesData: normalizedSeriesData,
@@ -34,12 +38,12 @@ export function useChartInnerProps(props) {
34
38
  });
35
39
  const { preparedSeries, preparedShapesSeries } = React.useMemo(() => {
36
40
  return getZoomedSeriesData({
37
- seriesData: basePreparedSeries,
41
+ seriesData: allPreparedSeries,
38
42
  xAxis: normalizedXAxis,
39
43
  yAxis: normalizedYAxis,
40
44
  zoomState,
41
45
  });
42
- }, [basePreparedSeries, normalizedXAxis, normalizedYAxis, zoomState]);
46
+ }, [allPreparedSeries, normalizedXAxis, normalizedYAxis, zoomState]);
43
47
  const { legendConfig, legendItems } = React.useMemo(() => {
44
48
  if (!preparedLegend) {
45
49
  return { legendConfig: undefined, legendItems: [] };
@@ -77,6 +81,7 @@ export function useChartInnerProps(props) {
77
81
  boundsHeight,
78
82
  hasZoomX: Boolean(zoomState.x),
79
83
  hasZoomY: Boolean(zoomState.y),
84
+ rangeSliderState,
80
85
  series: preparedSeries,
81
86
  seriesOptions: preparedSeriesOptions,
82
87
  split: preparedSplit,
@@ -89,6 +94,7 @@ export function useChartInnerProps(props) {
89
94
  const { shapes, shapesData } = useShapes({
90
95
  boundsWidth,
91
96
  boundsHeight,
97
+ clipPathBySeriesType: CLIP_PATH_BY_SERIES_TYPE,
92
98
  dispatcher,
93
99
  series: preparedShapesSeries,
94
100
  seriesOptions: preparedSeriesOptions,
@@ -125,7 +131,10 @@ export function useChartInnerProps(props) {
125
131
  yAxis,
126
132
  yScale,
127
133
  });
128
- const boundsOffsetTop = chart.margin.top;
134
+ const boundsOffsetTop = chart.margin.top +
135
+ ((preparedLegend === null || preparedLegend === void 0 ? void 0 : preparedLegend.enabled) && preparedLegend.position === 'top'
136
+ ? preparedLegend.height + preparedLegend.margin
137
+ : 0);
129
138
  // We need to calculate the width of each left axis because the first axis can be hidden
130
139
  const boundsOffsetLeft = chart.margin.left +
131
140
  yAxis.reduce((acc, axis) => {
@@ -140,7 +149,7 @@ export function useChartInnerProps(props) {
140
149
  }, 0);
141
150
  const { x } = (_a = svgContainer === null || svgContainer === void 0 ? void 0 : svgContainer.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {};
142
151
  return {
143
- svgXPos: x,
152
+ allPreparedSeries,
144
153
  boundsHeight,
145
154
  boundsOffsetLeft,
146
155
  boundsOffsetTop,
@@ -149,14 +158,17 @@ export function useChartInnerProps(props) {
149
158
  isOutsideBounds,
150
159
  legendConfig,
151
160
  legendItems,
161
+ preparedChart: chart,
152
162
  preparedLegend,
153
163
  preparedSeries,
164
+ preparedSeriesOptions,
154
165
  preparedSplit,
155
166
  preparedZoom: chart.zoom,
156
167
  prevHeight,
157
168
  prevWidth,
158
169
  shapes,
159
170
  shapesData,
171
+ svgXPos: x,
160
172
  title,
161
173
  xAxis,
162
174
  xScale,
@@ -1,14 +1,19 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3';
3
- import type { PreparedTooltip, ZoomState } from '../../hooks';
3
+ import type { PreparedRangeSlider, PreparedTooltip, RangeSliderState, ZoomState } from '../../hooks';
4
4
  type Props = {
5
5
  dispatcher: Dispatch<object>;
6
+ preparedRangeSlider: PreparedRangeSlider;
6
7
  tooltip?: PreparedTooltip;
7
8
  };
8
9
  export declare function useChartInnerState(props: Props): {
10
+ initialized: boolean;
11
+ rangeSliderState: RangeSliderState | undefined;
12
+ setInitialized: React.Dispatch<React.SetStateAction<boolean>>;
9
13
  tooltipPinned: boolean;
10
14
  togglePinTooltip: ((value: boolean, event: React.MouseEvent) => void) | undefined;
11
15
  unpinTooltip: (() => void) | undefined;
16
+ updateRangeSliderState: (nextRangeSliderState?: RangeSliderState) => void;
12
17
  updateZoomState: (nextZoomState: Partial<ZoomState>) => void;
13
18
  zoomState: Partial<ZoomState>;
14
19
  };
@@ -3,9 +3,11 @@ import isEqual from 'lodash/isEqual';
3
3
  import { EventType, isMacintosh } from '../../utils';
4
4
  export function useChartInnerState(props) {
5
5
  var _a, _b;
6
- const { dispatcher, tooltip } = props;
6
+ const { dispatcher, preparedRangeSlider, tooltip } = props;
7
7
  const [tooltipPinned, setTooltipPinned] = React.useState(false);
8
8
  const [zoomState, setZoomState] = React.useState({});
9
+ const [rangeSliderState, setRangeSliderState] = React.useState();
10
+ const [initialized, setInitialized] = React.useState(!preparedRangeSlider.enabled);
9
11
  const tooltipEnabled = tooltip === null || tooltip === void 0 ? void 0 : tooltip.enabled;
10
12
  const tooltipPinEnabled = (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.pin) === null || _a === void 0 ? void 0 : _a.enabled;
11
13
  const modifierKey = (_b = tooltip === null || tooltip === void 0 ? void 0 : tooltip.pin) === null || _b === void 0 ? void 0 : _b.modifierKey;
@@ -33,10 +35,24 @@ export function useChartInnerState(props) {
33
35
  setZoomState(nextZoomState);
34
36
  }
35
37
  }, [zoomState]);
38
+ const updateRangeSliderState = React.useCallback((nextRangeSliderState) => {
39
+ if (!isEqual(rangeSliderState, nextRangeSliderState)) {
40
+ setRangeSliderState(nextRangeSliderState
41
+ ? {
42
+ max: nextRangeSliderState.max,
43
+ min: nextRangeSliderState.min,
44
+ }
45
+ : undefined);
46
+ }
47
+ }, [rangeSliderState]);
36
48
  return {
49
+ initialized,
50
+ rangeSliderState,
51
+ setInitialized,
37
52
  tooltipPinned,
38
53
  togglePinTooltip: tooltipEnabled && tooltipPinEnabled ? togglePinTooltip : undefined,
39
54
  unpinTooltip: tooltipEnabled && tooltipPinEnabled ? unpinTooltip : undefined,
55
+ updateRangeSliderState,
40
56
  updateZoomState,
41
57
  zoomState,
42
58
  };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import type { PreparedSeries } from '../../hooks';
3
- import type { PreparedAxis, PreparedZoom } from '../../hooks/useChartOptions/types';
2
+ import type { PreparedAxis, PreparedSeries, PreparedZoom } from '../../hooks';
4
3
  export declare function hasAtLeastOneSeriesDataPerPlot(seriesData: PreparedSeries[], yAxes?: PreparedAxis[]): boolean;
5
4
  export declare function useAsyncState<T>(value: T, setState: () => Promise<T>): T;
6
5
  export declare function getResetZoomButtonStyle(args: {
@@ -11,3 +10,7 @@ export declare function getResetZoomButtonStyle(args: {
11
10
  node: HTMLElement | null;
12
11
  titleHeight?: number;
13
12
  } & PreparedZoom['resetButton']): React.CSSProperties;
13
+ export declare function useDebouncedValue<T>(props: {
14
+ value: T;
15
+ delay?: number;
16
+ }): T;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import debounce from 'lodash/debounce';
2
3
  import isEqual from 'lodash/isEqual';
3
4
  export function hasAtLeastOneSeriesDataPerPlot(seriesData, yAxes = []) {
4
5
  const hasDataMap = new Map();
@@ -107,3 +108,15 @@ export function getResetZoomButtonStyle(args) {
107
108
  }
108
109
  return style;
109
110
  }
111
+ export function useDebouncedValue(props) {
112
+ const { value: propsValue, delay = 0 } = props;
113
+ const [value, setValue] = React.useState(propsValue);
114
+ React.useEffect(() => {
115
+ const debouncedSetValue = debounce(setValue, delay);
116
+ debouncedSetValue(propsValue);
117
+ return () => {
118
+ debouncedSetValue.cancel();
119
+ };
120
+ }, [propsValue, delay]);
121
+ return value;
122
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { RangeSliderProps } from '../../hooks';
3
+ import './styles.css';
4
+ declare function RangeSliderComponent(props: RangeSliderProps): React.JSX.Element;
5
+ export declare const RangeSlider: React.MemoExoticComponent<typeof RangeSliderComponent>;
6
+ export {};
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { useUniqId } from '@gravity-ui/uikit';
3
+ import { useBrush, useRangeSlider } from '../../hooks';
4
+ import { block } from '../../utils';
5
+ import { getFramedPath } from './utils';
6
+ import './styles.css';
7
+ const b = block('range-slider');
8
+ function RangeSliderComponent(props) {
9
+ const clipPathId = useUniqId();
10
+ const { brush, height, onBrushEnd, onOverlayClick, offsetLeft, offsetTop, preparedXAxis, preparedYAxis, selection, shapes, width, } = useRangeSlider(Object.assign(Object.assign({}, props), { clipPathId }));
11
+ const ref = React.useRef(null);
12
+ const areas = React.useMemo(() => {
13
+ if (!preparedXAxis || !(preparedYAxis === null || preparedYAxis === void 0 ? void 0 : preparedYAxis.length)) {
14
+ return [];
15
+ }
16
+ return [
17
+ {
18
+ extent: [
19
+ [0, 0],
20
+ [width, height],
21
+ ],
22
+ },
23
+ ];
24
+ }, [height, preparedXAxis, preparedYAxis, width]);
25
+ useBrush({
26
+ areas,
27
+ brushOptions: brush,
28
+ node: ref.current,
29
+ onBrushEnd,
30
+ selection,
31
+ type: 'x',
32
+ });
33
+ return (React.createElement("g", { className: b(), transform: `translate(${offsetLeft}, ${offsetTop})`, width: width, height: height, ref: ref },
34
+ React.createElement("defs", null,
35
+ React.createElement("clipPath", { id: clipPathId },
36
+ React.createElement("rect", { x: 0, y: 0, width: width, height: height }))),
37
+ React.createElement("path", { d: getFramedPath({ height, strokeWidth: 1, width }), fill: "var(--g-color-line-generic)" }),
38
+ React.createElement("g", { className: b('shapes') }, shapes),
39
+ React.createElement("rect", { height: height, className: b('clickable-overlay'), onClick: onOverlayClick, width: width, x: 0, y: 0 })));
40
+ }
41
+ export const RangeSlider = React.memo(RangeSliderComponent);
@@ -0,0 +1,6 @@
1
+ .gcharts-range-slider__shapes {
2
+ opacity: 0.5;
3
+ }
4
+ .gcharts-range-slider__clickable-overlay {
5
+ opacity: 0;
6
+ }
@@ -0,0 +1,5 @@
1
+ export declare function getFramedPath(args: {
2
+ height: number;
3
+ strokeWidth: number;
4
+ width: number;
5
+ }): string;
@@ -0,0 +1,18 @@
1
+ import { path } from 'd3';
2
+ export function getFramedPath(args) {
3
+ const { height, strokeWidth, width } = args;
4
+ const p = path();
5
+ // Outer rectangle
6
+ p.moveTo(0, 0);
7
+ p.lineTo(width, 0);
8
+ p.lineTo(width, height);
9
+ p.lineTo(0, height);
10
+ p.closePath();
11
+ // Inner rectangle (cutout)
12
+ p.moveTo(strokeWidth, strokeWidth);
13
+ p.lineTo(strokeWidth, height - strokeWidth);
14
+ p.lineTo(width - strokeWidth, height - strokeWidth);
15
+ p.lineTo(width - strokeWidth, strokeWidth);
16
+ p.closePath();
17
+ return p.toString();
18
+ }
@@ -151,7 +151,8 @@ export const DefaultTooltipContent = ({ hovered, pinned, rowRenderer, totals, va
151
151
  }
152
152
  case 'pie':
153
153
  case 'heatmap':
154
- case 'treemap': {
154
+ case 'treemap':
155
+ case 'funnel': {
155
156
  const seriesData = data;
156
157
  const formattedValue = getFormattedValue({
157
158
  value: hoveredValues[i],
@@ -1,6 +1,6 @@
1
1
  import type { ChartSeriesData, ChartTooltip, ChartTooltipTotalsAggregationValue, ChartTooltipTotalsBuiltInAggregation, ChartXAxis, ChartYAxis, TooltipDataChunk, ValueFormat } from '../../../types';
2
2
  export type HoveredValue = string | number | null | undefined;
3
- export declare function getXRowData(data: ChartSeriesData, xAxis?: ChartXAxis | null): string | number | undefined;
3
+ export declare function getXRowData(data: ChartSeriesData, xAxis?: ChartXAxis | null): string | number | null | undefined;
4
4
  export declare function getDefaultValueFormat({ axis, closestPointsRange, }: {
5
5
  axis?: ChartXAxis | ChartYAxis | null;
6
6
  closestPointsRange?: number;
@@ -14,7 +14,7 @@ export declare const getMeasureValue: ({ data, xAxis, yAxis, headerFormat, }: {
14
14
  value: string | null;
15
15
  formattedValue?: undefined;
16
16
  } | {
17
- value: string | number | undefined;
17
+ value: string | number | null | undefined;
18
18
  formattedValue: string;
19
19
  } | null;
20
20
  export declare function getHoveredValues(args: {
@@ -39,7 +39,7 @@ export function getDefaultValueFormat({ axis, closestPointsRange, }) {
39
39
  }
40
40
  export const getMeasureValue = ({ data, xAxis, yAxis, headerFormat, }) => {
41
41
  var _a, _b, _c, _d, _e, _f;
42
- if (data.every((item) => ['pie', 'treemap', 'waterfall', 'sankey', 'heatmap'].includes(item.series.type))) {
42
+ if (data.every((item) => ['pie', 'treemap', 'waterfall', 'sankey', 'heatmap', 'funnel'].includes(item.series.type))) {
43
43
  return null;
44
44
  }
45
45
  if (data.some((item) => item.series.type === 'radar')) {
@@ -79,7 +79,8 @@ export function getHoveredValues(args) {
79
79
  case 'pie':
80
80
  case 'radar':
81
81
  case 'heatmap':
82
- case 'treemap': {
82
+ case 'treemap':
83
+ case 'funnel': {
83
84
  const seriesData = data;
84
85
  return seriesData.value;
85
86
  }
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3';
3
- import type { PreparedAxis, PreparedTooltip } from '../../hooks';
3
+ import type { PreparedTooltip, PreparedXAxis, PreparedYAxis } from '../../hooks';
4
4
  import './styles.css';
5
5
  type TooltipProps = {
6
6
  dispatcher: Dispatch<object>;
7
7
  tooltip: PreparedTooltip;
8
8
  svgContainer: SVGSVGElement | null;
9
- xAxis: PreparedAxis | null;
10
- yAxis: PreparedAxis;
9
+ xAxis: PreparedXAxis | null;
10
+ yAxis: PreparedYAxis;
11
11
  tooltipPinned: boolean;
12
12
  onOutsideClick?: () => void;
13
13
  };
@@ -1,4 +1,4 @@
1
- export declare const SeriesType: {
1
+ export declare const SERIES_TYPE: {
2
2
  readonly Area: "area";
3
3
  readonly BarX: "bar-x";
4
4
  readonly BarY: "bar-y";
@@ -10,4 +10,6 @@ export declare const SeriesType: {
10
10
  readonly Sankey: "sankey";
11
11
  readonly Radar: "radar";
12
12
  readonly Heatmap: "heatmap";
13
+ readonly Funnel: "funnel";
13
14
  };
15
+ export type SeriesType = (typeof SERIES_TYPE)[keyof typeof SERIES_TYPE];
@@ -1,4 +1,4 @@
1
- export const SeriesType = {
1
+ export const SERIES_TYPE = {
2
2
  Area: 'area',
3
3
  BarX: 'bar-x',
4
4
  BarY: 'bar-y',
@@ -10,4 +10,5 @@ export const SeriesType = {
10
10
  Sankey: 'sankey',
11
11
  Radar: 'radar',
12
12
  Heatmap: 'heatmap',
13
+ Funnel: 'funnel',
13
14
  };
@@ -0,0 +1,2 @@
1
+ import type { ChartBrush, DeepRequired } from '../../types';
2
+ export declare const brushDefaults: DeepRequired<ChartBrush>;
@@ -0,0 +1,15 @@
1
+ const DEFAULT_BORDER_COLOR = 'var(--gcharts-brush-border-color)';
2
+ export const brushDefaults = {
3
+ borderColor: DEFAULT_BORDER_COLOR,
4
+ borderWidth: 1,
5
+ handles: {
6
+ borderColor: DEFAULT_BORDER_COLOR,
7
+ borderWidth: 1,
8
+ enabled: true,
9
+ height: 15,
10
+ width: 8,
11
+ },
12
+ style: {
13
+ fillOpacity: 1,
14
+ },
15
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './axis';
2
+ export * from './brush';
2
3
  export * from './data-labels';
3
4
  export * from './legend';
4
5
  export * from './series-options';
@@ -1,4 +1,5 @@
1
1
  export * from './axis';
2
+ export * from './brush';
2
3
  export * from './data-labels';
3
4
  export * from './legend';
4
5
  export * from './series-options';
@@ -1,4 +1,4 @@
1
- import type { ChartSeriesOptions } from '../../types';
1
+ import type { ChartSeriesOptions, ChartSeriesRangeSliderOptions } from '../../types';
2
2
  type DefaultBarXSeriesOptions = Partial<ChartSeriesOptions['bar-x']> & {
3
3
  'bar-x': {
4
4
  barMaxWidth: number;
@@ -23,4 +23,5 @@ type DefaultWaterfallSeriesOptions = Partial<ChartSeriesOptions['waterfall']> &
23
23
  };
24
24
  export type SeriesOptionsDefaults = Partial<ChartSeriesOptions> & DefaultBarXSeriesOptions & DefaultBarYSeriesOptions & DefaultWaterfallSeriesOptions;
25
25
  export declare const seriesOptionsDefaults: SeriesOptionsDefaults;
26
+ export declare const seriesRangeSliderOptionsDefaults: Required<ChartSeriesRangeSliderOptions>;
26
27
  export {};
@@ -125,4 +125,15 @@ export const seriesOptionsDefaults = {
125
125
  },
126
126
  },
127
127
  },
128
+ funnel: {
129
+ states: {
130
+ hover: {
131
+ enabled: true,
132
+ brightness: 0.3,
133
+ },
134
+ },
135
+ },
136
+ };
137
+ export const seriesRangeSliderOptionsDefaults = {
138
+ visible: true,
128
139
  };
@@ -9,3 +9,4 @@ export * from './palette';
9
9
  export * from './symbol-types';
10
10
  export * from './tooltip';
11
11
  export * from './typography';
12
+ export * from './zoom';
@@ -9,3 +9,4 @@ export * from './palette';
9
9
  export * from './symbol-types';
10
10
  export * from './tooltip';
11
11
  export * from './typography';
12
+ export * from './zoom';
@@ -0,0 +1,6 @@
1
+ export declare const ZOOM_TYPE: {
2
+ readonly X: "x";
3
+ readonly XY: "xy";
4
+ readonly Y: "y";
5
+ };
6
+ export type ZoomType = (typeof ZOOM_TYPE)[keyof typeof ZOOM_TYPE];
@@ -0,0 +1,5 @@
1
+ export const ZOOM_TYPE = {
2
+ X: 'x',
3
+ XY: 'xy',
4
+ Y: 'y',
5
+ };
@@ -1,11 +1,16 @@
1
1
  export * from './useAxis';
2
+ export * from './useAxis/types';
2
3
  export * from './useAxisScales';
4
+ export * from './useBrush';
5
+ export * from './useBrush/types';
3
6
  export * from './useChartDimensions';
4
7
  export * from './useChartOptions';
5
8
  export * from './useChartOptions/types';
6
9
  export * from './useCrosshair';
7
10
  export * from './useNormalizedOriginalData';
8
11
  export * from './usePrevious';
12
+ export * from './useRangeSlider';
13
+ export * from './useRangeSlider/types';
9
14
  export * from './useSeries';
10
15
  export * from './useSeries/types';
11
16
  export * from './useShapes';
@@ -1,11 +1,16 @@
1
1
  export * from './useAxis';
2
+ export * from './useAxis/types';
2
3
  export * from './useAxisScales';
4
+ export * from './useBrush';
5
+ export * from './useBrush/types';
3
6
  export * from './useChartDimensions';
4
7
  export * from './useChartOptions';
5
8
  export * from './useChartOptions/types';
6
9
  export * from './useCrosshair';
7
10
  export * from './useNormalizedOriginalData';
8
11
  export * from './usePrevious';
12
+ export * from './useRangeSlider';
13
+ export * from './useRangeSlider/types';
9
14
  export * from './useSeries';
10
15
  export * from './useSeries/types';
11
16
  export * from './useShapes';
@@ -1,6 +1,7 @@
1
1
  import type { ChartXAxis, ChartYAxis } from '../../types';
2
- import type { PreparedAxis, PreparedChart } from '../useChartOptions/types';
2
+ import type { PreparedChart } from '../useChartOptions/types';
3
3
  import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
4
+ import type { PreparedXAxis, PreparedYAxis } from './types';
4
5
  interface UseAxesProps {
5
6
  height: number;
6
7
  preparedChart: PreparedChart;
@@ -13,7 +14,7 @@ interface UseAxesProps {
13
14
  yAxis?: ChartYAxis[];
14
15
  }
15
16
  export declare function useAxis(props: UseAxesProps): {
16
- xAxis: PreparedAxis | null;
17
- yAxis: PreparedAxis[];
17
+ xAxis: PreparedXAxis | null;
18
+ yAxis: PreparedYAxis[];
18
19
  };
19
20
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import isEqual from 'lodash/isEqual';
3
- import { getPreparedXAxis } from '../useChartOptions/x-axis';
4
- import { getPreparedYAxis } from '../useChartOptions/y-axis';
3
+ import { getPreparedXAxis } from './x-axis';
4
+ import { getPreparedYAxis } from './y-axis';
5
5
  export function useAxis(props) {
6
6
  const { boundsHeight, height, preparedChart, preparedLegend, preparedSeries, preparedSeriesOptions, width, xAxis, yAxis, } = props;
7
7
  const [axesState, setValue] = React.useState({ xAxis: null, yAxis: [] });
@@ -0,0 +1,5 @@
1
+ import type { ChartXAxis } from '../../types';
2
+ import type { PreparedRangeSlider } from './types';
3
+ export declare function getPreparedRangeSlider({ xAxis }: {
4
+ xAxis?: ChartXAxis;
5
+ }): PreparedRangeSlider;
@@ -0,0 +1,16 @@
1
+ import merge from 'lodash/merge';
2
+ import { brushDefaults } from '../../constants';
3
+ const DEFAULT_RANGE_SLIDER_HEIGHT = 40;
4
+ const DEFAULT_RANGE_SLIDER_MARGIN = 10;
5
+ export function getPreparedRangeSlider({ xAxis }) {
6
+ var _a, _b, _c;
7
+ const rangeSlider = xAxis === null || xAxis === void 0 ? void 0 : xAxis.rangeSlider;
8
+ const enabled = (xAxis === null || xAxis === void 0 ? void 0 : xAxis.type) === 'category' ? false : ((_a = rangeSlider === null || rangeSlider === void 0 ? void 0 : rangeSlider.enabled) !== null && _a !== void 0 ? _a : false);
9
+ return {
10
+ brush: merge({}, brushDefaults, rangeSlider === null || rangeSlider === void 0 ? void 0 : rangeSlider.brush),
11
+ defaultRange: rangeSlider === null || rangeSlider === void 0 ? void 0 : rangeSlider.defaultRange,
12
+ enabled,
13
+ height: (_b = rangeSlider === null || rangeSlider === void 0 ? void 0 : rangeSlider.height) !== null && _b !== void 0 ? _b : DEFAULT_RANGE_SLIDER_HEIGHT,
14
+ margin: (_c = rangeSlider === null || rangeSlider === void 0 ? void 0 : rangeSlider.margin) !== null && _c !== void 0 ? _c : DEFAULT_RANGE_SLIDER_MARGIN,
15
+ };
16
+ }
@@ -0,0 +1,66 @@
1
+ import type { DashStyle } from '../../constants';
2
+ import type { AxisCrosshair, AxisPlotBand, BaseTextStyle, ChartAxis, ChartAxisLabels, ChartAxisRangeSlider, ChartAxisTitleAlignment, ChartAxisType, DeepRequired, PlotLayerPlacement } from '../../types';
3
+ type PreparedAxisLabels = Omit<ChartAxisLabels, 'enabled' | 'padding' | 'style' | 'autoRotation'> & Required<Pick<ChartAxisLabels, 'enabled' | 'padding' | 'margin' | 'rotation' | 'html'>> & {
4
+ style: BaseTextStyle;
5
+ rotation: number;
6
+ height: number;
7
+ width: number;
8
+ lineHeight: number;
9
+ maxWidth: number;
10
+ };
11
+ export type PreparedAxisPlotBand = Required<AxisPlotBand> & {
12
+ label: {
13
+ text: string;
14
+ style: BaseTextStyle;
15
+ padding: number;
16
+ };
17
+ };
18
+ type PreparedAxisCrosshair = Required<AxisCrosshair>;
19
+ export type PreparedAxisPlotLine = {
20
+ value: number;
21
+ color: string;
22
+ width: number;
23
+ dashStyle: DashStyle;
24
+ opacity: number;
25
+ layerPlacement: PlotLayerPlacement;
26
+ label: {
27
+ text: string;
28
+ style: BaseTextStyle;
29
+ padding: number;
30
+ };
31
+ };
32
+ export type PreparedRangeSlider = DeepRequired<Omit<ChartAxisRangeSlider, 'defaultRange'>> & {
33
+ defaultRange?: ChartAxisRangeSlider['defaultRange'];
34
+ };
35
+ type PreparedBaseAxis = Omit<ChartAxis, 'type' | 'labels' | 'plotLines' | 'plotBands'> & {
36
+ type: ChartAxisType;
37
+ labels: PreparedAxisLabels;
38
+ title: {
39
+ height: number;
40
+ width: number;
41
+ text: string;
42
+ margin: number;
43
+ style: BaseTextStyle;
44
+ align: ChartAxisTitleAlignment;
45
+ maxRowCount: number;
46
+ };
47
+ min?: number;
48
+ grid: {
49
+ enabled: boolean;
50
+ };
51
+ maxPadding: number;
52
+ ticks: {
53
+ pixelInterval?: number;
54
+ };
55
+ position: 'left' | 'right' | 'top' | 'bottom';
56
+ plotIndex: number;
57
+ plotLines: PreparedAxisPlotLine[];
58
+ plotBands: PreparedAxisPlotBand[];
59
+ crosshair: PreparedAxisCrosshair;
60
+ };
61
+ export type PreparedXAxis = PreparedBaseAxis & {
62
+ rangeSlider: PreparedRangeSlider;
63
+ };
64
+ export type PreparedYAxis = PreparedBaseAxis;
65
+ export type PreparedAxis = PreparedXAxis | PreparedYAxis;
66
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { AxisPlot, ChartAxis } from '../../types';
1
+ import type { AxisPlot } from '../../types';
2
2
  export declare function prepareAxisPlotLabel(d: AxisPlot): {
3
3
  text: string;
4
4
  style: {
@@ -8,4 +8,3 @@ export declare function prepareAxisPlotLabel(d: AxisPlot): {
8
8
  };
9
9
  padding: number;
10
10
  };
11
- export declare function getAxisCategories({ categories: originalCategories, max, min, order, }?: Partial<ChartAxis>): string[] | undefined;