@semcore/d3-chart 3.47.1 → 3.48.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 (69) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/cjs/Area.js +11 -11
  3. package/lib/cjs/Axis.js +14 -14
  4. package/lib/cjs/Bar.js +11 -11
  5. package/lib/cjs/Bar.js.map +1 -1
  6. package/lib/cjs/Bubble.js +12 -12
  7. package/lib/cjs/Donut.js +9 -9
  8. package/lib/cjs/Dots.js +8 -8
  9. package/lib/cjs/HorizontalBar.js +17 -12
  10. package/lib/cjs/HorizontalBar.js.map +1 -1
  11. package/lib/cjs/Hover.js +3 -3
  12. package/lib/cjs/Line.js +9 -9
  13. package/lib/cjs/Plot.js +3 -3
  14. package/lib/cjs/Radar.js +19 -19
  15. package/lib/cjs/RadialTree.js +11 -11
  16. package/lib/cjs/Reference.js +12 -12
  17. package/lib/cjs/ScatterPlot.js +9 -9
  18. package/lib/cjs/Tooltip.js +21 -11
  19. package/lib/cjs/Tooltip.js.map +1 -1
  20. package/lib/cjs/Venn.js +9 -9
  21. package/lib/cjs/a11y/PlotA11yModule.js +2 -2
  22. package/lib/cjs/a11y/PlotA11yView.js +2 -2
  23. package/lib/cjs/component/Chart/BarChart.js +29 -12
  24. package/lib/cjs/component/Chart/BarChart.js.map +1 -1
  25. package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
  26. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  27. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  28. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  29. package/lib/cjs/types/Bar.d.js.map +1 -1
  30. package/lib/cjs/types/HorizontalBar.d.js.map +1 -1
  31. package/lib/cjs/types/Hover.d.js.map +1 -1
  32. package/lib/cjs/types/Tooltip.d.js.map +1 -1
  33. package/lib/es6/Area.js +11 -11
  34. package/lib/es6/Axis.js +14 -14
  35. package/lib/es6/Bar.js +11 -11
  36. package/lib/es6/Bar.js.map +1 -1
  37. package/lib/es6/Bubble.js +12 -12
  38. package/lib/es6/Donut.js +9 -9
  39. package/lib/es6/Dots.js +8 -8
  40. package/lib/es6/HorizontalBar.js +17 -12
  41. package/lib/es6/HorizontalBar.js.map +1 -1
  42. package/lib/es6/Hover.js +3 -3
  43. package/lib/es6/Line.js +9 -9
  44. package/lib/es6/Plot.js +3 -3
  45. package/lib/es6/Radar.js +19 -19
  46. package/lib/es6/RadialTree.js +11 -11
  47. package/lib/es6/Reference.js +12 -12
  48. package/lib/es6/ScatterPlot.js +9 -9
  49. package/lib/es6/Tooltip.js +21 -11
  50. package/lib/es6/Tooltip.js.map +1 -1
  51. package/lib/es6/Venn.js +9 -9
  52. package/lib/es6/a11y/PlotA11yModule.js +2 -2
  53. package/lib/es6/a11y/PlotA11yView.js +2 -2
  54. package/lib/es6/component/Chart/BarChart.js +29 -12
  55. package/lib/es6/component/Chart/BarChart.js.map +1 -1
  56. package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
  57. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  58. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  59. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  60. package/lib/es6/types/Bar.d.js.map +1 -1
  61. package/lib/es6/types/HorizontalBar.d.js.map +1 -1
  62. package/lib/es6/types/Hover.d.js.map +1 -1
  63. package/lib/es6/types/Tooltip.d.js.map +1 -1
  64. package/lib/types/Bar.d.ts +7 -1
  65. package/lib/types/HorizontalBar.d.ts +10 -0
  66. package/lib/types/Hover.d.ts +3 -0
  67. package/lib/types/Tooltip.d.ts +3 -0
  68. package/lib/types/component/Chart/BarChart.type.d.ts +7 -1
  69. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.js","names":["React","createComponent","scaleBand","scaleLinear","scaleTime","minMax","GroupBar","HoverRect","StackBar","Line","AbstractChart","Box","Flex","Text","BarChartComponent","_AbstractChart","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","_this$asProps","asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","_this$asProps3$type","type","state","trendItem","createElement","data","concat","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this","_this$asProps4","_this$asProps4$type","_this$state","dataDefinitions","highlightedLine","length","item","BarComponent","HorizontalBar","Bar","Fragment","id","map","index","commonBarComponentProps","transparent","checked","_extends","renderTooltip","_this2","_this$asProps5","showTotalInTooltip","showTooltip","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Title","toString","justifyContent","Dot","mr","label","bold","tooltipValueFormatter","mt","_this$asProps6","_this$asProps6$margin","marginY","_this$asProps6$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","_this$asProps7","_this$asProps7$margin","_this$asProps7$margin2","max","_get","_getPrototypeOf","prototype","Math","_toConsumableArray","_defineProperty","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent from '@semcore/core';\nimport { BaseLegendProps } from './AbstractChart.type';\nimport { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { BarProps } from '../../types';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<BarChartData, BarChartProps> {\n static displayName = 'Chart.Bar';\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, type = 'group', 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, highlightedLine } = 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 <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n />\n {this.renderTrend(item.id)}\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: highlightedLine !== -1 && highlightedLine !== index,\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: highlightedLine !== -1 && highlightedLine !== index,\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, showTotalInTooltip, showTooltip, invertAxis } = this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\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 = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\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\nexport const BarChart: BarChartType = createComponent(BarChartComponent);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,eAAe;AAG3C,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC5D;AACA,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AAC7C,SAASC,IAAI,QAAQ,qBAAqB;AAAC,IAGrCC,iBAAiB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,iBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,iBAAA;EAAA,SAAAA,kBAAA;IAAAK,eAAA,OAAAL,iBAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,iBAAA;IAAAS,GAAA;IAAAC,GAAA,EAGrB,SAAAA,IAAA,EAAa;MACX,IAAAC,aAAA,GAA+B,IAAI,CAACC,OAAO;QAAnCC,MAAM,GAAAF,aAAA,CAANE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G9E,IAAI,KAAK,OAAO,GAAA+E,IAAA,CAAAC,eAAA,CAAA7G,iBAAA,CAAA8G,SAAA,8BAA2BC,IAAI,CAACJ,GAAG,CAAArG,KAAA,CAARyG,IAAI,EAAAC,kBAAA,CAAAJ,IAAA,CAAAC,eAAA,CAAA7G,iBAAA,CAAA8G,SAAA,wBAAyB;MAEpF,OAAOzH,WAAW,EAAE,CACjB0G,KAAK,CACJjF,UAAU,GACN,CAAC2E,OAAO,EAAEG,SAAS,GAAG,IAAI,CAACI,WAAW,CAAC,GACvC,CAACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAAC,CAC7C,CACAK,MAAM,CAAC,CAAC,CAAC,EAAEM,GAAG,CAAC,CAAC;IACrB;EAAC;EAAA,OAAA3G,iBAAA;AAAA,EA5N6BJ,aAAa;AAAAqH,eAAA,CAAvCjH,iBAAiB,iBACA,WAAW;AA8NlC,OAAO,IAAMkH,QAAsB,GAAG/H,eAAe,CAACa,iBAAiB,CAAC"}
1
+ {"version":3,"file":"BarChart.js","names":["React","createComponent","scaleBand","scaleLinear","scaleTime","minMax","GroupBar","HoverRect","StackBar","Line","AbstractChart","Box","Flex","Text","BarChartComponent","_AbstractChart","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","_data","e","barIndex","barKey","onClickBar","asProps","_createClass","key","get","_this$asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","_this$asProps3$type","type","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this2","_this$asProps4","_this$asProps4$type","_this$state","dataDefinitions","highlightedLine","item","BarComponent","HorizontalBar","Bar","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","checked","_extends","renderTooltip","_this3","_this$asProps5","showTotalInTooltip","showTooltip","onClickHoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Title","toString","justifyContent","Dot","mr","label","bold","tooltipValueFormatter","mt","_this$asProps6","_this$asProps6$margin","marginY","_this$asProps6$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","_this$asProps7","_this$asProps7$margin","_this$asProps7$margin2","max","_get","_getPrototypeOf","prototype","Math","_toConsumableArray","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent from '@semcore/core';\nimport { BaseLegendProps } from './AbstractChart.type';\nimport { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { BarProps } from '../../types';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<BarChartData, BarChartProps> {\n static displayName = 'Chart.Bar';\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, type = 'group', 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, highlightedLine } = 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 <>\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 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: highlightedLine !== -1 && highlightedLine !== 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: highlightedLine !== -1 && highlightedLine !== 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, showTotalInTooltip, showTooltip, invertAxis, onClickHoverRect } =\n this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\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 const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverRect.Tooltip>\n );\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 = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\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 = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\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\nexport const BarChart: BarChartType = createComponent(BarChartComponent);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,eAAe;AAG3C,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC5D;AACA,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AAC7C,SAASC,IAAI,QAAQ,qBAAqB;AAAC,IAGrCC,iBAAiB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,iBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,iBAAA;EAAA,SAAAA,kBAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,iBAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,qBA0LI,UACvBa,KAAsB,EACtBC,CAAuB,EACvBC,QAAgB,EAChBC,MAAc,EAC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art.type.ts"],"sourcesContent":["import { Intergalactic } from '@semcore/core';\nimport { Flex } from '@semcore/flex-box';\nimport { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport { BaseChartProps } from './AbstractChart.type';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number;\n y: number;\n};\n\nexport type BarChartData = Array<Record<string, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\n groupKey: string;\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n yScale?: ScaleLinear<any, any>;\n type?: 'stack' | 'group';\n trend?: Record<LegendItemKey, TrendItem[]>;\n};\n\nexport type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps>;\n"],"mappings":""}
1
+ {"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import React from 'react';\nimport { Intergalactic } from '@semcore/core';\nimport { Flex } from '@semcore/flex-box';\nimport { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport { BaseChartProps } from './AbstractChart.type';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number;\n y: number;\n};\n\ntype BarKey = string;\n\nexport type BarChartData = Array<Record<BarKey, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\n groupKey: string;\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n yScale?: ScaleLinear<any, any>;\n type?: 'stack' | 'group';\n trend?: Record<LegendItemKey, TrendItem[]>;\n\n /** Handle click by `HoverRect`. `index` is an index of the data array. */\n onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;\n\n /** Handle click by Bar. */\n onClickBar?: (barItem: number, barKey: BarKey, e: React.SyntheticEvent) => void;\n};\n\nexport type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps>;\n"],"mappings":""}
@@ -10,10 +10,10 @@ import React from 'react';
10
10
  import createComponent, { sstyled, Root } from '@semcore/core';
11
11
  import { Flex } from '@semcore/flex-box';
12
12
  /*__reshadow-styles__:"./legend-flex.shadow.css"*/
13
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendFlex_dlyyj_gg_._direction_row_dlyyj_gg_{align-items:flex-start;align-content:flex-start;flex-wrap:wrap;gap:8px 16px}.___SLegendFlex_dlyyj_gg_._direction_column_dlyyj_gg_{align-items:flex-start;flex-wrap:wrap;gap:8px}" /*__inner_css_end__*/, "dlyyj_gg_") /*__reshadow_css_end__*/, {
14
- "__SLegendFlex": "___SLegendFlex_dlyyj_gg_",
15
- "_direction_row": "_direction_row_dlyyj_gg_",
16
- "_direction_column": "_direction_column_dlyyj_gg_"
13
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendFlex_17hbc_gg_._direction_row_17hbc_gg_{align-items:flex-start;align-content:flex-start;flex-wrap:wrap;gap:8px 16px}.___SLegendFlex_17hbc_gg_._direction_column_17hbc_gg_{align-items:flex-start;flex-wrap:wrap;gap:8px}" /*__inner_css_end__*/, "17hbc_gg_") /*__reshadow_css_end__*/, {
14
+ "__SLegendFlex": "___SLegendFlex_17hbc_gg_",
15
+ "_direction_row": "_direction_row_17hbc_gg_",
16
+ "_direction_column": "_direction_column_17hbc_gg_"
17
17
  });
18
18
  import { LegendItemComponent } from '../LegendItem/LegendItem';
19
19
  import Divider from '@semcore/divider';
@@ -19,23 +19,23 @@ import { Flex, Box } from '@semcore/flex-box';
19
19
  import Checkbox from '@semcore/checkbox';
20
20
  import { Text as TypographyText } from '@semcore/typography';
21
21
  /*__reshadow-styles__:"./legend-item.shadow.css"*/
22
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendItem_18jig_gg_{min-width:0;align-items:flex-start}@media (hover:hover){.___SLegendItem_18jig_gg_:hover{cursor:pointer}.___SLegendItem_18jig_gg_.__disabled_18jig_gg_:hover{cursor:default}}.___SPointShape_18jig_gg_.__color_18jig_gg_{background-color:var(--color_18jig);margin-right:8px;flex-shrink:0}.___SPointShape_18jig_gg_._shape_Circle_18jig_gg_._size_l_18jig_gg_{width:16px;height:16px;border-radius:8px;margin-top:4px}.___SPointShape_18jig_gg_._shape_Circle_18jig_gg_._size_m_18jig_gg_{width:12px;height:12px;border-radius:6px;margin-top:4px}.___SPointShape_18jig_gg_._shape_Line_18jig_gg_._size_l_18jig_gg_{width:16px;height:4px;border-radius:3px;margin-top:9px}.___SPointShape_18jig_gg_._shape_Line_18jig_gg_._size_m_18jig_gg_{width:12px;height:4px;border-radius:3px;margin-top:8px}.___SPointShape_18jig_gg_._shape_Square_18jig_gg_._size_l_18jig_gg_{width:16px;height:16px;border-radius:2px;margin-top:4px}.___SPointShape_18jig_gg_._shape_Square_18jig_gg_._size_m_18jig_gg_{width:12px;height:12px;border-radius:2px;margin-top:4px}.___SPointShape_18jig_gg_._shape_Pattern_18jig_gg_{background-color:transparent;margin-right:4px}.___SIcon_18jig_gg_{line-height:0;margin-right:4px}.___SIcon_18jig_gg_._size_l_18jig_gg_{margin-top:4px}.___SIcon_18jig_gg_._size_m_18jig_gg_{margin-top:2px}.___SLabel_18jig_gg_{min-width:0}.___SAdditionalLabel_18jig_gg_._size_l_18jig_gg_,.___SCount_18jig_gg_._size_l_18jig_gg_,.___SLabel_18jig_gg_._size_l_18jig_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SAdditionalLabel_18jig_gg_._size_m_18jig_gg_,.___SCount_18jig_gg_._size_m_18jig_gg_,.___SLabel_18jig_gg_._size_m_18jig_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SAdditionalLabel_18jig_gg_,.___SCount_18jig_gg_{margin-left:4px}.___SAdditionalLabel_18jig_gg_{white-space:nowrap;display:flex;align-items:flex-start}.___SAdditionalLabel_18jig_gg_::before{content:\"\";display:inline-block;background-color:var(--intergalactic-text-secondary, #6c6e79);height:4px;width:4px;border-radius:2px;margin-right:4px}.___SAdditionalLabel_18jig_gg_._size_l_18jig_gg_::before{margin-top:10px}.___SAdditionalLabel_18jig_gg_._size_m_18jig_gg_::before{margin-top:8px}.___SPatternSymbol_18jig_gg_{transform:scale(.8)}" /*__inner_css_end__*/, "18jig_gg_") /*__reshadow_css_end__*/, {
23
- "__SLegendItem": "___SLegendItem_18jig_gg_",
24
- "_disabled": "__disabled_18jig_gg_",
25
- "__SPointShape": "___SPointShape_18jig_gg_",
26
- "_color": "__color_18jig_gg_",
27
- "--color": "--color_18jig",
28
- "_shape_Circle": "_shape_Circle_18jig_gg_",
29
- "_size_l": "_size_l_18jig_gg_",
30
- "_size_m": "_size_m_18jig_gg_",
31
- "_shape_Line": "_shape_Line_18jig_gg_",
32
- "_shape_Square": "_shape_Square_18jig_gg_",
33
- "_shape_Pattern": "_shape_Pattern_18jig_gg_",
34
- "__SIcon": "___SIcon_18jig_gg_",
35
- "__SLabel": "___SLabel_18jig_gg_",
36
- "__SAdditionalLabel": "___SAdditionalLabel_18jig_gg_",
37
- "__SCount": "___SCount_18jig_gg_",
38
- "__SPatternSymbol": "___SPatternSymbol_18jig_gg_"
22
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendItem_ai743_gg_{min-width:0;align-items:flex-start}@media (hover:hover){.___SLegendItem_ai743_gg_:hover{cursor:pointer}.___SLegendItem_ai743_gg_.__disabled_ai743_gg_:hover{cursor:default}}.___SPointShape_ai743_gg_.__color_ai743_gg_{background-color:var(--color_ai743);margin-right:8px;flex-shrink:0}.___SPointShape_ai743_gg_._shape_Circle_ai743_gg_._size_l_ai743_gg_{width:16px;height:16px;border-radius:8px;margin-top:4px}.___SPointShape_ai743_gg_._shape_Circle_ai743_gg_._size_m_ai743_gg_{width:12px;height:12px;border-radius:6px;margin-top:4px}.___SPointShape_ai743_gg_._shape_Line_ai743_gg_._size_l_ai743_gg_{width:16px;height:4px;border-radius:3px;margin-top:9px}.___SPointShape_ai743_gg_._shape_Line_ai743_gg_._size_m_ai743_gg_{width:12px;height:4px;border-radius:3px;margin-top:8px}.___SPointShape_ai743_gg_._shape_Square_ai743_gg_._size_l_ai743_gg_{width:16px;height:16px;border-radius:2px;margin-top:4px}.___SPointShape_ai743_gg_._shape_Square_ai743_gg_._size_m_ai743_gg_{width:12px;height:12px;border-radius:2px;margin-top:4px}.___SPointShape_ai743_gg_._shape_Pattern_ai743_gg_{background-color:transparent;margin-right:4px}.___SIcon_ai743_gg_{line-height:0;margin-right:4px}.___SIcon_ai743_gg_._size_l_ai743_gg_{margin-top:4px}.___SIcon_ai743_gg_._size_m_ai743_gg_{margin-top:2px}.___SLabel_ai743_gg_{min-width:0}.___SAdditionalLabel_ai743_gg_._size_l_ai743_gg_,.___SCount_ai743_gg_._size_l_ai743_gg_,.___SLabel_ai743_gg_._size_l_ai743_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SAdditionalLabel_ai743_gg_._size_m_ai743_gg_,.___SCount_ai743_gg_._size_m_ai743_gg_,.___SLabel_ai743_gg_._size_m_ai743_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SAdditionalLabel_ai743_gg_,.___SCount_ai743_gg_{margin-left:4px}.___SAdditionalLabel_ai743_gg_{white-space:nowrap;display:flex;align-items:flex-start}.___SAdditionalLabel_ai743_gg_::before{content:\"\";display:inline-block;background-color:var(--intergalactic-text-secondary, #6c6e79);height:4px;width:4px;border-radius:2px;margin-right:4px}.___SAdditionalLabel_ai743_gg_._size_l_ai743_gg_::before{margin-top:10px}.___SAdditionalLabel_ai743_gg_._size_m_ai743_gg_::before{margin-top:8px}.___SPatternSymbol_ai743_gg_{transform:scale(.8)}" /*__inner_css_end__*/, "ai743_gg_") /*__reshadow_css_end__*/, {
23
+ "__SLegendItem": "___SLegendItem_ai743_gg_",
24
+ "_disabled": "__disabled_ai743_gg_",
25
+ "__SPointShape": "___SPointShape_ai743_gg_",
26
+ "_color": "__color_ai743_gg_",
27
+ "--color": "--color_ai743",
28
+ "_shape_Circle": "_shape_Circle_ai743_gg_",
29
+ "_size_l": "_size_l_ai743_gg_",
30
+ "_size_m": "_size_m_ai743_gg_",
31
+ "_shape_Line": "_shape_Line_ai743_gg_",
32
+ "_shape_Square": "_shape_Square_ai743_gg_",
33
+ "_shape_Pattern": "_shape_Pattern_ai743_gg_",
34
+ "__SIcon": "___SIcon_ai743_gg_",
35
+ "__SLabel": "___SLabel_ai743_gg_",
36
+ "__SAdditionalLabel": "___SAdditionalLabel_ai743_gg_",
37
+ "__SCount": "___SCount_ai743_gg_",
38
+ "__SPatternSymbol": "___SPatternSymbol_ai743_gg_"
39
39
  });
40
40
  import { StaticShapes } from './LegendItem.type';
41
41
  import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
@@ -11,12 +11,12 @@ import React from 'react';
11
11
  import createComponent, { sstyled, Root } from '@semcore/core';
12
12
  import { Box } from '@semcore/flex-box';
13
13
  /*__reshadow-styles__:"./legend-table.shadow.css"*/
14
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendTable_q5ake_gg_.__columns-count_q5ake_gg_{font-feature-settings:\"tnum\";font-variant-numeric:tabular-nums;display:grid;grid-template-columns:auto .2fr;align-items:center;height:-moz-fit-content;height:fit-content;grid-column-gap:16px;grid-row-gap:8px}.___SColumnItem_q5ake_gg_._size_l_q5ake_gg_{font-size:var(--intergalactic-fs-300, 16px);text-align:right}.___SColumnItem_q5ake_gg_._size_m_q5ake_gg_{font-size:var(--intergalactic-fs-200, 14px);text-align:right}" /*__inner_css_end__*/, "q5ake_gg_") /*__reshadow_css_end__*/, {
15
- "__SLegendTable": "___SLegendTable_q5ake_gg_",
16
- "_columns-count": "__columns-count_q5ake_gg_",
17
- "__SColumnItem": "___SColumnItem_q5ake_gg_",
18
- "_size_l": "_size_l_q5ake_gg_",
19
- "_size_m": "_size_m_q5ake_gg_"
14
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLegendTable_1ukwf_gg_.__columns-count_1ukwf_gg_{font-feature-settings:\"tnum\";font-variant-numeric:tabular-nums;display:grid;grid-template-columns:auto .2fr;align-items:center;height:-moz-fit-content;height:fit-content;grid-column-gap:16px;grid-row-gap:8px}.___SColumnItem_1ukwf_gg_._size_l_1ukwf_gg_{font-size:var(--intergalactic-fs-300, 16px);text-align:right}.___SColumnItem_1ukwf_gg_._size_m_1ukwf_gg_{font-size:var(--intergalactic-fs-200, 14px);text-align:right}" /*__inner_css_end__*/, "1ukwf_gg_") /*__reshadow_css_end__*/, {
15
+ "__SLegendTable": "___SLegendTable_1ukwf_gg_",
16
+ "_columns-count": "__columns-count_1ukwf_gg_",
17
+ "__SColumnItem": "___SColumnItem_1ukwf_gg_",
18
+ "_size_l": "_size_l_1ukwf_gg_",
19
+ "_size_m": "_size_m_1ukwf_gg_"
20
20
  });
21
21
  import { LegendItemComponent } from '../LegendItem/LegendItem';
22
22
  import { BaseLegend } from '../BaseLegend';
@@ -1 +1 @@
1
- {"version":3,"file":"Bar.d.js","names":[],"sources":["../../../src/types/Bar.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\nimport { ScaleBand, ScaleLinear } from 'd3-scale';\nimport { PatternsConfig } from './Pattern';\n\n/** @deprecated */\nexport interface IBarProps extends BarProps, UnknownProperties {}\nexport type BarProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Line color */\n color?: string;\n /** Element hide property */\n hide?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Radius of curvature\n * @default 2\n */\n r?: number | number[];\n /** Minimal height\n * @default 2\n */\n hMin?: number;\n /**\n * Bar click handler\n */\n onClick?: (data: { [key: string]: string | number }, event: Event) => void;\n /** Enables element transparency */\n transparent?: boolean;\n /**\n * The maximum width of each Bar\n */\n maxBarSize?: number;\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n};\n\n/** @deprecated */\nexport interface IBarContext extends BarContext, UnknownProperties {}\nexport type BarContext = {\n scale: [ScaleBand<any>, ScaleLinear<any, any>];\n /** @deprecated */\n value: unknown;\n /** Index in `data` array */\n index: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\n/** @deprecated */\nexport interface IBackgroundProps extends BackgroundProps, UnknownProperties {}\nexport type BackgroundProps = Context & {\n /** Coordinate x */\n x?: number | string;\n /** Coordinate y */\n y?: number | string;\n /** Value element of data */\n /** @deprecated */\n value?: any;\n /** Width rect */\n width?: number | string;\n /** Height rect */\n height?: number | string;\n};\n\ntype BackgroundContext = Context & {\n /** Index in `data` array */\n index: number;\n};\n\ndeclare const Bar: IntergalacticD3Component<'rect', BarProps, BarContext> & {\n Background: IntergalacticD3Component<'rect', BackgroundProps, BackgroundContext>;\n};\n\nexport default Bar;\n"],"mappings":""}
1
+ {"version":3,"file":"Bar.d.js","names":[],"sources":["../../../src/types/Bar.d.ts"],"sourcesContent":["import React from 'react';\nimport { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\nimport { ScaleBand, ScaleLinear } from 'd3-scale';\nimport { PatternsConfig } from './Pattern';\n\n/** @deprecated */\nexport interface IBarProps extends BarProps, UnknownProperties {}\nexport type BarProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Line color */\n color?: string;\n /** Element hide property */\n hide?: boolean;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Radius of curvature\n * @default 2\n */\n r?: number | number[];\n /** Minimal height\n * @default 2\n */\n hMin?: number;\n /**\n * Bar click handler\n */\n onClick?: (\n data: { [key: string]: string | number | Date },\n event: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => void;\n /** Enables element transparency */\n transparent?: boolean;\n /**\n * The maximum width of each Bar\n */\n maxBarSize?: number;\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n};\n\n/** @deprecated */\nexport interface IBarContext extends BarContext, UnknownProperties {}\nexport type BarContext = {\n scale: [ScaleBand<any>, ScaleLinear<any, any>];\n /** @deprecated */\n value: unknown;\n /** Index in `data` array */\n index: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\n/** @deprecated */\nexport interface IBackgroundProps extends BackgroundProps, UnknownProperties {}\nexport type BackgroundProps = Context & {\n /** Coordinate x */\n x?: number | string;\n /** Coordinate y */\n y?: number | string;\n /** Value element of data */\n /** @deprecated */\n value?: any;\n /** Width rect */\n width?: number | string;\n /** Height rect */\n height?: number | string;\n};\n\ntype BackgroundContext = Context & {\n /** Index in `data` array */\n index: number;\n};\n\ndeclare const Bar: IntergalacticD3Component<'rect', BarProps, BarContext> & {\n Background: IntergalacticD3Component<'rect', BackgroundProps, BackgroundContext>;\n};\n\nexport default Bar;\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalBar.d.js","names":[],"sources":["../../../src/types/HorizontalBar.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { BarContext, BackgroundProps } from './Bar';\nimport { IntergalacticD3Component } from './Plot';\nimport { PatternsConfig } from './Pattern';\n\n/** @deprecated */\nexport interface IHorizontalBarProps extends HorizontalBarProps, UnknownProperties {}\nexport type HorizontalBarProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Line color */\n color?: string;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Radius of curvature\n * @default 2\n */\n r?: number | number[];\n /** Enables element transparency */\n transparent?: boolean;\n /**\n * The maximum width of each Bar\n */\n maxBarSize?: number;\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n};\n\ndeclare const HorizontalBar: IntergalacticD3Component<'path', HorizontalBarProps, BarContext> & {\n Background: IntergalacticD3Component<'rect', BackgroundProps, Context>;\n};\n\nexport default HorizontalBar;\n"],"mappings":""}
1
+ {"version":3,"file":"HorizontalBar.d.js","names":[],"sources":["../../../src/types/HorizontalBar.d.ts"],"sourcesContent":["import React from 'react';\nimport { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { BarContext, BackgroundProps } from './Bar';\nimport { IntergalacticD3Component } from './Plot';\nimport { PatternsConfig } from './Pattern';\n\n/** @deprecated */\nexport interface IHorizontalBarProps extends HorizontalBarProps, UnknownProperties {}\nexport type HorizontalBarProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Line color */\n color?: string;\n /** Animation duration in ms\n * @default 500\n */\n duration?: number;\n /** Radius of curvature\n * @default 2\n */\n r?: number | number[];\n /**\n * Bar click handler\n */\n onClick?: (\n data: { [key: string]: string | number | Date },\n event: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => void;\n /** Enables element transparency */\n transparent?: boolean;\n /**\n * The maximum width of each Bar\n */\n maxBarSize?: number;\n /** Enables charts patterns that enhances charts accessibility */\n patterns?: PatternsConfig;\n};\n\ndeclare const HorizontalBar: IntergalacticD3Component<'path', HorizontalBarProps, BarContext> & {\n Background: IntergalacticD3Component<'rect', BackgroundProps, Context>;\n};\n\nexport default HorizontalBar;\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport { BoxProps } from '@semcore/flex-box';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? number : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? number : never;\n }) => { children: ReturnEl };\n } & Omit<BoxProps, 'children'>,\n) => ReturnEl) &\n TooltipTypeBase;\n\ntype HoverContext = {\n /** Index in `data` array of the current item */\n index: number;\n};\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":""}
1
+ {"version":3,"file":"Hover.d.js","names":[],"sources":["../../../src/types/Hover.d.ts"],"sourcesContent":["import React from 'react';\nimport { UnknownProperties } from '@semcore/core';\nimport { Context } from './context';\nimport { ReturnEl } from '@semcore/core';\nimport { TooltipTypeBase } from './Tooltip';\nimport { BoxProps } from '@semcore/flex-box';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface IHoverProps extends HoverProps, UnknownProperties {}\nexport type HoverProps = Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n};\n\ntype HoverTooltip = (<X, Y>(\n props: {\n /** Field name from `data` array item for the XAxis */\n x?: X;\n /** Field name from `data` array item for the YAxis */\n y?: Y;\n /** Handle click by trigger has an index - it is an index of the data array. */\n onClick?: (index: number, e: React.SyntheticEvent) => void;\n children: (props: {\n /** Index in `data` array of the current item */\n xIndex: X extends string ? number : never;\n /** Index in `data` array of the current item */\n yIndex: Y extends string ? number : never;\n }) => { children: ReturnEl };\n } & Omit<BoxProps, 'children'>,\n) => ReturnEl) &\n TooltipTypeBase;\n\ntype HoverContext = {\n /** Index in `data` array of the current item */\n index: number;\n};\n\ndeclare const HoverLine: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\n\ndeclare const HoverRect: IntergalacticD3Component<'g', HoverProps, HoverContext> & {\n Tooltip: HoverTooltip;\n};\nexport { HoverLine, HoverRect };\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.js","names":[],"sources":["../../../src/types/Tooltip.d.ts"],"sourcesContent":["import Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface ITooltipChartProps extends TooltipChartProps, UnknownProperties {}\nexport type TooltipChartProps = PopperProps &\n PopperTriggerProps &\n Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n };\n\n/** @deprecated */\nexport interface ITooltipChartContext extends TooltipChartContext, UnknownProperties {\n /** Index active value for Axis x */\n xIndex: number | null;\n /** Index active value for Axis y */\n yIndex: number | null;\n}\nexport type TooltipChartContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n};\n\nexport type TooltipTypeBase = {\n Trigger: typeof Popper.Trigger;\n Popper: typeof Popper.Popper;\n Title: typeof Box;\n Dot: IntergalacticD3Component<'div', BoxProps & { color?: string }, TooltipChartContext>;\n Footer: typeof Box;\n};\n\nexport type TooltipType<ChildrenRenderProps = {}, TooltipProps = {}> = (<\n Tag extends Intergalactic.Tag = typeof Box,\n>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<\n Tag,\n TooltipProps,\n ChildrenRenderProps & TooltipChartContext\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<\n Intergalactic.Tag,\n Intergalactic.Tag,\n TooltipProps\n > &\n TooltipTypeBase;\n\n/**\n * @deprecated Consider migration to better typed Bubble.Tooltip, HoverLine.Tooltip,\n * HoverRect.Tooltip, Donut.Tooltip, Radar.Tooltip,\n * ScatterPlot.Tooltip or Venn.Tooltip.\n *\n * Migration examples:\n * 1. `<Tooltip tag={HoverLine}>...</Tooltip>` => `<HoverLine.Tooltip>...</HoverLine.Tooltip>`\n * 2. `<Tooltip tag={HoverRect}>...</Tooltip>` => `<HoverRect.Tooltip>...</HoverRect.Tooltip>`\n * 3. `<Tooltip tag={Radar.Hover}>...</Tooltip>` => `<Radar.Tooltip>...</Radar.Tooltip>`\n * 4. `<Tooltip>...</Tooltip>` => `<Bubble.Tooltip>...</Bubble.Tooltip>`\n * 5. `<Tooltip>...</Tooltip>` => `<Donut.Tooltip>...</Donut.Tooltip>`\n * 6. `<Tooltip>...</Tooltip>` => `<ScatterPlot.Tooltip>...</ScatterPlot.Tooltip>`\n * 7. `<Tooltip>...</Tooltip>` => `<Venn.Tooltip>...</Venn.Tooltip>`\n */\ndeclare const Tooltip: TooltipType;\n\nexport default Tooltip;\n"],"mappings":""}
1
+ {"version":3,"file":"Tooltip.d.js","names":[],"sources":["../../../src/types/Tooltip.d.ts"],"sourcesContent":["import React from 'react';\nimport Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { Context } from './context';\nimport { IntergalacticD3Component } from './Plot';\n\n/** @deprecated */\nexport interface ITooltipChartProps extends TooltipChartProps, UnknownProperties {}\nexport type TooltipChartProps = PopperProps &\n PopperTriggerProps &\n Context & {\n /** Field name from `data` array item for the XAxis */\n x?: string;\n /** Field name from `data` array item for the YAxis */\n y?: string;\n /** Handle click by trigger has an index - it is an index of the data array. */\n onClick?: (index: number, e: React.SyntheticEvent) => void;\n };\n\n/** @deprecated */\nexport interface ITooltipChartContext extends TooltipChartContext, UnknownProperties {\n /** Index active value for Axis x */\n xIndex: number | null;\n /** Index active value for Axis y */\n yIndex: number | null;\n}\nexport type TooltipChartContext = {\n getTriggerProps: PropGetterFn;\n getPopperProps: PropGetterFn;\n};\n\nexport type TooltipTypeBase = {\n Trigger: typeof Popper.Trigger;\n Popper: typeof Popper.Popper;\n Title: typeof Box;\n Dot: IntergalacticD3Component<'div', BoxProps & { color?: string }, TooltipChartContext>;\n Footer: typeof Box;\n};\n\nexport type TooltipType<ChildrenRenderProps = {}, TooltipProps = {}> = (<\n Tag extends Intergalactic.Tag = typeof Box,\n>(\n props: Intergalactic.InternalTypings.PropsRenderingResultComponentProps<\n Tag,\n TooltipProps,\n ChildrenRenderProps & TooltipChartContext\n >,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<\n Intergalactic.Tag,\n Intergalactic.Tag,\n TooltipProps\n > &\n TooltipTypeBase;\n\n/**\n * @deprecated Consider migration to better typed Bubble.Tooltip, HoverLine.Tooltip,\n * HoverRect.Tooltip, Donut.Tooltip, Radar.Tooltip,\n * ScatterPlot.Tooltip or Venn.Tooltip.\n *\n * Migration examples:\n * 1. `<Tooltip tag={HoverLine}>...</Tooltip>` => `<HoverLine.Tooltip>...</HoverLine.Tooltip>`\n * 2. `<Tooltip tag={HoverRect}>...</Tooltip>` => `<HoverRect.Tooltip>...</HoverRect.Tooltip>`\n * 3. `<Tooltip tag={Radar.Hover}>...</Tooltip>` => `<Radar.Tooltip>...</Radar.Tooltip>`\n * 4. `<Tooltip>...</Tooltip>` => `<Bubble.Tooltip>...</Bubble.Tooltip>`\n * 5. `<Tooltip>...</Tooltip>` => `<Donut.Tooltip>...</Donut.Tooltip>`\n * 6. `<Tooltip>...</Tooltip>` => `<ScatterPlot.Tooltip>...</ScatterPlot.Tooltip>`\n * 7. `<Tooltip>...</Tooltip>` => `<Venn.Tooltip>...</Venn.Tooltip>`\n */\ndeclare const Tooltip: TooltipType;\n\nexport default Tooltip;\n"],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { UnknownProperties } from '@semcore/core';
2
3
  import { Context } from './context';
3
4
  import { IntergalacticD3Component } from './Plot';
@@ -30,7 +31,12 @@ export type BarProps = Context & {
30
31
  /**
31
32
  * Bar click handler
32
33
  */
33
- onClick?: (data: { [key: string]: string | number }, event: Event) => void;
34
+ onClick?: (
35
+ data: { [key: string]: string | number | Date },
36
+ event: React.SyntheticEvent,
37
+ barIndex: number,
38
+ barKey: string,
39
+ ) => void;
34
40
  /** Enables element transparency */
35
41
  transparent?: boolean;
36
42
  /**
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { UnknownProperties } from '@semcore/core';
2
3
  import { Context } from './context';
3
4
  import { BarContext, BackgroundProps } from './Bar';
@@ -21,6 +22,15 @@ export type HorizontalBarProps = Context & {
21
22
  * @default 2
22
23
  */
23
24
  r?: number | number[];
25
+ /**
26
+ * Bar click handler
27
+ */
28
+ onClick?: (
29
+ data: { [key: string]: string | number | Date },
30
+ event: React.SyntheticEvent,
31
+ barIndex: number,
32
+ barKey: string,
33
+ ) => void;
24
34
  /** Enables element transparency */
25
35
  transparent?: boolean;
26
36
  /**
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { UnknownProperties } from '@semcore/core';
2
3
  import { Context } from './context';
3
4
  import { ReturnEl } from '@semcore/core';
@@ -20,6 +21,8 @@ type HoverTooltip = (<X, Y>(
20
21
  x?: X;
21
22
  /** Field name from `data` array item for the YAxis */
22
23
  y?: Y;
24
+ /** Handle click by trigger has an index - it is an index of the data array. */
25
+ onClick?: (index: number, e: React.SyntheticEvent) => void;
23
26
  children: (props: {
24
27
  /** Index in `data` array of the current item */
25
28
  xIndex: X extends string ? number : never;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import Popper, { PopperProps, PopperTriggerProps } from '@semcore/popper';
2
3
  import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
4
  import { Box, BoxProps } from '@semcore/flex-box';
@@ -13,6 +14,8 @@ export type TooltipChartProps = PopperProps &
13
14
  x?: string;
14
15
  /** Field name from `data` array item for the YAxis */
15
16
  y?: string;
17
+ /** Handle click by trigger has an index - it is an index of the data array. */
18
+ onClick?: (index: number, e: React.SyntheticEvent) => void;
16
19
  };
17
20
 
18
21
  /** @deprecated */
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { Intergalactic } from '@semcore/core';
2
3
  import { Flex } from '@semcore/flex-box';
3
4
  import { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';
@@ -7,13 +8,18 @@ type TrendItem = {
7
8
  x: number;
8
9
  y: number;
9
10
  };
10
- export type BarChartData = Array<Record<string, string | number | Date>>;
11
+ type BarKey = string;
12
+ export type BarChartData = Array<Record<BarKey, string | number | Date>>;
11
13
  export type BarChartProps = BaseChartProps<BarChartData> & {
12
14
  groupKey: string;
13
15
  xScale?: ScaleBand<any> | ScaleTime<any, any>;
14
16
  yScale?: ScaleLinear<any, any>;
15
17
  type?: 'stack' | 'group';
16
18
  trend?: Record<LegendItemKey, TrendItem[]>;
19
+ /** Handle click by `HoverRect`. `index` is an index of the data array. */
20
+ onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;
21
+ /** Handle click by Bar. */
22
+ onClickBar?: (barItem: number, barKey: BarKey, e: React.SyntheticEvent) => void;
17
23
  };
18
24
  export type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps>;
19
25
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/d3-chart",
3
3
  "description": "Semrush D3 Chart Component",
4
- "version": "3.47.1",
4
+ "version": "3.48.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@formatjs/intl": "2.3.0",
18
- "@semcore/animation": "2.28.0",
19
- "@semcore/divider": "4.27.0",
20
- "@semcore/flex-box": "5.28.0",
21
- "@semcore/popper": "5.36.1",
22
- "@semcore/utils": "4.29.0",
18
+ "@semcore/animation": "2.29.0",
19
+ "@semcore/divider": "4.28.0",
20
+ "@semcore/flex-box": "5.29.0",
21
+ "@semcore/popper": "5.37.0",
22
+ "@semcore/utils": "4.30.0",
23
23
  "@types/d3-shape": "^3.1.0",
24
24
  "@upsetjs/venn.js": "1.4.2",
25
25
  "d3-array": "3.1.6",