@hitachivantara/uikit-react-viz 3.1.2-next.4 → 3.1.3
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.
- package/README.md +11 -11
- package/dist/Barchart/Barchart.js +3 -1
- package/dist/Barchart/Barchart.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/legacy/Barchart/Barchart.js +3 -1
- package/dist/legacy/Barchart/Barchart.js.map +1 -1
- package/dist/legacy/index.d.ts +1 -1
- package/dist/modern/Barchart/Barchart.js +3 -1
- package/dist/modern/Barchart/Barchart.js.map +1 -1
- package/dist/modern/index.d.ts +1 -1
- package/package.json +19 -27
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @hitachivantara/uikit-react-viz
|
|
2
|
-
|
|
3
|
-
A collection of React visualizations for the Hitachi Vantara Design System.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Install the package in your project directory with:
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install @hitachivantara/uikit-react-viz
|
|
11
|
-
```
|
|
1
|
+
# @hitachivantara/uikit-react-viz
|
|
2
|
+
|
|
3
|
+
A collection of React visualizations for the Hitachi Vantara Design System.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the package in your project directory with:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @hitachivantara/uikit-react-viz
|
|
11
|
+
```
|
|
@@ -66,6 +66,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
66
66
|
var MARGIN = 50;
|
|
67
67
|
var MAX_BAR_WIDTH = 90;
|
|
68
68
|
var MIN_BAR_WIDTH = 3;
|
|
69
|
+
var MIN_WIDTH = 75;
|
|
69
70
|
/**
|
|
70
71
|
* A Bar chart is a chart or graph that presents categorical data with rectangular bars.
|
|
71
72
|
*
|
|
@@ -135,8 +136,9 @@ var Barchart = function Barchart(_ref) {
|
|
|
135
136
|
var numberOfGroup = plotData[0].x.length;
|
|
136
137
|
|
|
137
138
|
var _ref$current$el$getBo = ref.current.el.getBoundingClientRect(),
|
|
138
|
-
|
|
139
|
+
boundingRect = _ref$current$el$getBo.width;
|
|
139
140
|
|
|
141
|
+
var width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;
|
|
140
142
|
var plotWidth = width - MARGIN;
|
|
141
143
|
var groupWidth = plotWidth / numberOfGroup;
|
|
142
144
|
var colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Barchart.js","names":["MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","el","getBoundingClientRect","width","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","PropTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","styles","name"],"sources":["../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width } = ref.current.el.getBoundingClientRect();\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,EAAf;AACA,IAAMC,aAAa,GAAG,EAAtB;AACA,IAAMC,aAAa,GAAG,CAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,OAUX;EAAA,IATJC,EASI,QATJA,EASI;EAAA,IARJC,OAQI,QARJA,OAQI;EAAA,IAPJC,IAOI,QAPJA,IAOI;EAAA,IANJC,MAMI,QANJA,MAMI;EAAA,IALJC,MAKI,Q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jB;MAAA,IAAyBC,WAAzB,GAAyCJ,UAAzC,CAAyBI,WAAzB;MAEA,IAAMC,OAAO,GAAGH,OAAO,KAAK,OAA5B;MACA,IAAMI,mBAAmB,GAAGD,OAAO,GAAG,CAAH,GAAOP,QAAQ,CAACG,MAAnD;MACA,IAAMM,aAAa,GAAGT,QAAQ,CAAC,CAAD,CAAR,CAAYU,CAAZ,CAAcP,MAApC;;MAEA,
|
|
1
|
+
{"version":3,"file":"Barchart.js","names":["MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","MIN_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","el","getBoundingClientRect","boundingRect","width","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","PropTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","styles","name"],"sources":["../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\nconst MIN_WIDTH = 75;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width: boundingRect } = ref.current.el.getBoundingClientRect();\n const width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,EAAf;AACA,IAAMC,aAAa,GAAG,EAAtB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,SAAS,GAAG,EAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,OAUX;EAAA,IATJC,EASI,QATJA,EASI;EAAA,IARJC,OAQI,QARJA,OAQI;EAAA,IAPJC,IAOI,QAPJA,IAOI;EAAA,IANJC,MAMI,QANJA,MAMI;EAAA,IALJC,MAKI,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,KAAV,CAAgB,CAAC,QAAD,EAAW,UAAX,CAAhB,CAxBM;;EAyBnB;AACF;AACA;EACE7C,KAAK,EAAEuC,mBAAUO,IA5BE;;EA6BnB;AACF;AACA;EACE7C,UAAU,EAAEsC,mBAAUO;AAhCH,CAArB;;eAmCe,sBAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAA2CvD,QAA3C,C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import styles from "./styles";
|
|
|
25
25
|
var MARGIN = 50;
|
|
26
26
|
var MAX_BAR_WIDTH = 90;
|
|
27
27
|
var MIN_BAR_WIDTH = 3;
|
|
28
|
+
var MIN_WIDTH = 75;
|
|
28
29
|
/**
|
|
29
30
|
* A Bar chart is a chart or graph that presents categorical data with rectangular bars.
|
|
30
31
|
*
|
|
@@ -94,8 +95,9 @@ var Barchart = function Barchart(_ref) {
|
|
|
94
95
|
var numberOfGroup = plotData[0].x.length;
|
|
95
96
|
|
|
96
97
|
var _ref$current$el$getBo = ref.current.el.getBoundingClientRect(),
|
|
97
|
-
|
|
98
|
+
boundingRect = _ref$current$el$getBo.width;
|
|
98
99
|
|
|
100
|
+
var width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;
|
|
99
101
|
var plotWidth = width - MARGIN;
|
|
100
102
|
var groupWidth = plotWidth / numberOfGroup;
|
|
101
103
|
var colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Barchart.js","names":["React","useMemo","useEffect","useState","useCallback","useRef","PropTypes","withStyles","Chart","applyLayoutDefaults","applyDataDefaults","styles","MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","el","getBoundingClientRect","width","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width } = ref.current.el.getBoundingClientRect();\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,SAAzB,EAAoCC,QAApC,EAA8CC,WAA9C,EAA2DC,MAA3D,QAAyE,OAAzE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,2BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,IAAMC,MAAM,GAAG,EAAf;AACA,IAAMC,aAAa,GAAG,EAAtB;AACA,IAAMC,aAAa,GAAG,CAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,OAUX;EAAA,IATJC,EASI,QATJA,EASI;EAAA,IARJC,OAQI,QARJA,OAQI;EAAA,IAPJC,IAOI,QAPJA,IAOI;EAAA,IANJC,MAMI,QANJA,MAMI;EAAA,IALJC,MAKI,QALJA,MAKI;EAAA,4BAJJC,WAII;EAAA,IAJJA,WAII,iCAJU,UAIV;EAAA,sBAHJC,KAGI;EAAA,IAHJA,KAGI,2BAHI,KAGJ;EAAA,2BAFJC,UAEI;EAAA,IAFJA,UAEI,gCAFS,KAET;EAAA,IADDC,MACC;;EACJ;EAEA,IAAMC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Barchart.js","names":["React","useMemo","useEffect","useState","useCallback","useRef","PropTypes","withStyles","Chart","applyLayoutDefaults","applyDataDefaults","styles","MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","MIN_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","el","getBoundingClientRect","boundingRect","width","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\nconst MIN_WIDTH = 75;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width: boundingRect } = ref.current.el.getBoundingClientRect();\n const width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,SAAzB,EAAoCC,QAApC,EAA8CC,WAA9C,EAA2DC,MAA3D,QAAyE,OAAzE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,2BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,IAAMC,MAAM,GAAG,EAAf;AACA,IAAMC,aAAa,GAAG,EAAtB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,SAAS,GAAG,EAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,OAUX;EAAA,IATJC,EASI,QATJA,EASI;EAAA,IARJC,OAQI,QARJA,OAQI;EAAA,IAPJC,IAOI,QAPJA,IAOI;EAAA,IANJC,MAMI,QANJA,MAMI;EAAA,IALJC,MAKI,QALJA,MAKI;EAAA,4BAJJC,WAII;EAAA,IAJJA,WAII,iCAJU,UAIV;EAAA,sBAHJC,KAGI;EAAA,IAHJA,KAGI,2BAHI,KAGJ;EAAA,2BAFJC,UAEI;EAAA,IAFJA,UAEI,gCAFS,KAET;EAAA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E5C,KAAK,EAAEjB,SAAS,CAAC8D,IA5BE;;EA6BnB;AACF;AACA;EACE5C,UAAU,EAAElB,SAAS,CAAC8D;AAhCH,CAArB;AAmCA,eAAe7D,UAAU,CAACI,MAAD,EAAS;EAAE0D,IAAI,EAAE;AAAR,CAAT,CAAV,CAA2CrD,QAA3C,CAAf"}
|
package/dist/legacy/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import styles from "./styles";
|
|
|
17
17
|
const MARGIN = 50;
|
|
18
18
|
const MAX_BAR_WIDTH = 90;
|
|
19
19
|
const MIN_BAR_WIDTH = 3;
|
|
20
|
+
const MIN_WIDTH = 75;
|
|
20
21
|
/**
|
|
21
22
|
* A Bar chart is a chart or graph that presents categorical data with rectangular bars.
|
|
22
23
|
*
|
|
@@ -78,8 +79,9 @@ const Barchart = _ref => {
|
|
|
78
79
|
const numberOfBarsByGroup = isStack ? 1 : plotData.length;
|
|
79
80
|
const numberOfGroup = plotData[0].x.length;
|
|
80
81
|
const {
|
|
81
|
-
width
|
|
82
|
+
width: boundingRect
|
|
82
83
|
} = ref.current.el.getBoundingClientRect();
|
|
84
|
+
const width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;
|
|
83
85
|
const plotWidth = width - MARGIN;
|
|
84
86
|
const groupWidth = plotWidth / numberOfGroup;
|
|
85
87
|
const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Barchart.js","names":["React","useMemo","useEffect","useState","useCallback","useRef","PropTypes","withStyles","Chart","applyLayoutDefaults","applyDataDefaults","styles","MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","width","el","getBoundingClientRect","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width } = ref.current.el.getBoundingClientRect();\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,SAAzB,EAAoCC,QAApC,EAA8CC,WAA9C,EAA2DC,MAA3D,QAAyE,OAAzE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,2BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,aAAa,GAAG,EAAtB;AACA,MAAMC,aAAa,GAAG,CAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,QAAQ,GAAG,QAUX;EAAA,IAVY;IAChBC,EADgB;IAEhBC,OAFgB;IAGhBC,IAHgB;IAIhBC,MAJgB;IAKhBC,MALgB;IAMhBC,WAAW,GAAG,UANE;IAOhBC,KAAK,GAAG,KAPQ;IAQhBC,UAAU,GAAG;EARG,CAUZ;EAAA,IADDC,MACC;;EACJ;EAEA,MAAMC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Barchart.js","names":["React","useMemo","useEffect","useState","useCallback","useRef","PropTypes","withStyles","Chart","applyLayoutDefaults","applyDataDefaults","styles","MARGIN","MAX_BAR_WIDTH","MIN_BAR_WIDTH","MIN_WIDTH","Barchart","id","classes","data","layout","config","tooltipType","stack","horizontal","others","dataWithDefaults","chartLayout","chartData","setChartData","firstRender","current","recalculateBarWidth","ref","plotData","props","plotLayout","length","barmode","bargap","bargroupgap","isStack","numberOfBarsByGroup","numberOfGroup","x","width","boundingRect","el","getBoundingClientRect","plotWidth","groupWidth","colWidth","calculatedBarWidth","greaterThan90","lessThan3","isAlreadyGreaterThan90","undefined","newWidth","newData","map","subData","propTypes","string","instanceOf","Object","arrayOf","isRequired","oneOf","bool","name"],"sources":["../../../src/Barchart/Barchart.js"],"sourcesContent":["import React, { useMemo, useEffect, useState, useCallback, useRef } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport Chart from \"../Chart\";\nimport { applyLayoutDefaults, applyDataDefaults } from \"./barchartPlotlyOverrides\";\nimport styles from \"./styles\";\n\nconst MARGIN = 50;\nconst MAX_BAR_WIDTH = 90;\nconst MIN_BAR_WIDTH = 3;\nconst MIN_WIDTH = 75;\n\n/**\n * A Bar chart is a chart or graph that presents categorical data with rectangular bars.\n *\n * Our implementation leverages the Plotly charting library. If you have a specific case\n * that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.\n */\nconst Barchart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n stack = false,\n horizontal = false,\n ...others\n}) => {\n /* Values derived from props */\n\n const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, stack, horizontal),\n [layout, stack, horizontal]\n );\n\n /* State */\n\n const [chartData, setChartData] = useState(dataWithDefaults);\n\n /* Effects */\n\n const firstRender = useRef(true);\n useEffect(() => {\n // only setChartData when prop value changes\n // not needed on first render because the\n // initial state is already properly set\n if (!firstRender.current) {\n setChartData(dataWithDefaults);\n }\n\n firstRender.current = false;\n }, [dataWithDefaults]);\n\n /**\n * Used to force the max width of each bar with 90px.\n *\n * (this is effectively more an effect than a callback)\n */\n const recalculateBarWidth = useCallback((ref) => {\n // use the data and layout info directly from the plotly ref\n // as it's always the most uptodate version.\n const plotData = ref.current.props.data;\n const plotLayout = ref.current.props.layout;\n\n if (plotData.length > 0) {\n const { barmode, bargap, bargroupgap } = plotLayout;\n\n const isStack = barmode === \"stack\";\n const numberOfBarsByGroup = isStack ? 1 : plotData.length;\n const numberOfGroup = plotData[0].x.length;\n\n const { width: boundingRect } = ref.current.el.getBoundingClientRect();\n const width = boundingRect < MIN_WIDTH ? MIN_WIDTH : boundingRect;\n const plotWidth = width - MARGIN;\n const groupWidth = plotWidth / numberOfGroup;\n const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;\n\n const calculatedBarWidth = colWidth / numberOfBarsByGroup;\n const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;\n const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;\n const isAlreadyGreaterThan90 = plotData[0].width !== undefined;\n\n if (greaterThan90 && !isAlreadyGreaterThan90) {\n const newWidth = (MAX_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (lessThan3 && !isAlreadyGreaterThan90) {\n const newWidth = (MIN_BAR_WIDTH / plotWidth) * numberOfGroup;\n\n const newData = plotData.map((subData) => {\n return { ...subData, width: newWidth };\n });\n\n setChartData(newData);\n }\n\n if (!greaterThan90 && isAlreadyGreaterThan90) {\n const newData = plotData.map((subData) => {\n return { ...subData, width: undefined };\n });\n\n setChartData(newData);\n }\n }\n }, []);\n\n return (\n <Chart\n id={id}\n classes={classes}\n data={chartData}\n layout={chartLayout}\n config={config}\n tooltipType={tooltipType}\n afterPlot={recalculateBarWidth}\n {...others}\n />\n );\n};\nBarchart.propTypes = {\n /**\n * An Id passed on to the component\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Plotly data object (see https://plot.ly/javascript/reference/).\n */\n data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,\n /**\n * Plotly layout object (see https://plot.ly/javascript/reference/#layout).\n */\n layout: PropTypes.instanceOf(Object),\n /**\n * Plotly config object (see https://plot.ly/javascript/configuration-options/).\n */\n config: PropTypes.instanceOf(Object),\n /**\n * Defines if should use a single or multiline tooltip.\n */\n tooltipType: PropTypes.oneOf([\"single\", \"multiple\"]),\n /**\n * Sets is the chart is stack.\n */\n stack: PropTypes.bool,\n /**\n * Sets is the chart is horizontal.\n */\n horizontal: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvBarchart\" })(Barchart);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,SAAzB,EAAoCC,QAApC,EAA8CC,WAA9C,EAA2DC,MAA3D,QAAyE,OAAzE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,mBAAT,EAA8BC,iBAA9B,QAAuD,2BAAvD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,aAAa,GAAG,EAAtB;AACA,MAAMC,aAAa,GAAG,CAAtB;AACA,MAAMC,SAAS,GAAG,EAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,QAAQ,GAAG,QAUX;EAAA,IAVY;IAChBC,EADgB;IAEhBC,OAFgB;IAGhBC,IAHgB;IAIhBC,MAJgB;IAKhBC,MALgB;IAMhBC,WAAW,GAAG,UANE;IAOhBC,KAAK,GAAG,KAPQ;IAQhBC,UAAU,GAAG;EARG,CAUZ;EAAA,IADDC,MACC;;EACJ;EAEA,MAAMC,gBAAgB,GAAGzB,OAAO,CAAC,MAAMS,iBAAiB,CAACS,IAAD,EAAOK,UAAP,CAAxB,EAA4C,CAACL,IAAD,EAAOK,UAAP,CAA5C,CAAhC;EACA,MAAMG,WAAW,GAAG1B,OAAO,CACzB,MAAMQ,mBAAmB,CAACW,MAAD,EAASG,KAAT,EAAgBC,UAAhB,CADA,EAEzB,CAACJ,MAAD,EAASG,KAAT,EAAgBC,UAAhB,CAFyB,CAA3B;EAKA;;EAEA,MAAM,CAACI,SAAD,E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IE,MAAM,EAAED,WAJV;IAKE,MAAM,EAAEN,MALV;IAME,WAAW,EAAEC,WANf;IAOE,SAAS,EAAEU;EAPb,GAQMP,MARN,EADF;AAYD,CA5GD;;AA6GA,wCAAAT,QAAQ,CAAC6C,SAAT,GAAqB;EACnB;AACF;AACA;EACE5C,EAAE,EAAEX,SAAS,CAACwD,MAJK;;EAKnB;AACF;AACA;EACE5C,OAAO,EAAEZ,SAAS,CAACyD,UAAV,CAAqBC,MAArB,CARU;;EASnB;AACF;AACA;EACE7C,IAAI,EAAEb,SAAS,CAAC2D,OAAV,CAAkB3D,SAAS,CAACyD,UAAV,CAAqBC,MAArB,CAAlB,EAAgDE,UAZnC;;EAanB;AACF;AACA;EACE9C,MAAM,EAAEd,SAAS,CAACyD,UAAV,CAAqBC,MAArB,CAhBW;;EAiBnB;AACF;AACA;EACE3C,MAAM,EAAEf,SAAS,CAACyD,UAAV,CAAqBC,MAArB,CApBW;;EAqBnB;AACF;AACA;EACE1C,WAAW,EAAEhB,SAAS,CAAC6D,KAAV,CAAgB,CAAC,QAAD,EAAW,UAAX,CAAhB,CAxBM;;EAyBnB;AACF;AACA;EACE5C,KAAK,EAAEjB,SAAS,CAAC8D,IA5BE;;EA6BnB;AACF;AACA;EACE5C,UAAU,EAAElB,SAAS,CAAC8D;AAhCH,CAArB;AAmCA,eAAe7D,UAAU,CAACI,MAAD,EAAS;EAAE0D,IAAI,EAAE;AAAR,CAAT,CAAV,CAA2CrD,QAA3C,CAAf"}
|
package/dist/modern/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-viz",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "A collection of React visualizations for the Hitachi Vantara's Design System.",
|
|
5
5
|
"homepage": "https://github.com/lumada-design/hv-uikit-react",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./dist/modern/index.js",
|
|
10
|
-
"./dist/": "./dist/modern/"
|
|
11
|
-
},
|
|
12
7
|
"main": "./dist/index.js",
|
|
13
8
|
"module": "./dist/legacy/index.js",
|
|
14
|
-
"
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
15
11
|
"author": {
|
|
16
12
|
"name": "Hitachi Vantara UI Kit Team"
|
|
17
13
|
},
|
|
@@ -42,15 +38,14 @@
|
|
|
42
38
|
"peerDependencies": {
|
|
43
39
|
"@material-ui/core": "^4.12.3",
|
|
44
40
|
"plotly.js-basic-dist": "^2.11.1",
|
|
45
|
-
"react": "^16.13.1 || ^17.0.
|
|
46
|
-
"react-dom": "^16.13.1 || ^17.0.
|
|
41
|
+
"react": "^16.13.1 || ^17.0.2",
|
|
42
|
+
"react-dom": "^16.13.1 || ^17.0.2"
|
|
47
43
|
},
|
|
48
44
|
"dependencies": {
|
|
49
|
-
"@babel/runtime": "^7.
|
|
50
|
-
"@hitachivantara/uikit-react-core": "^3.
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"core-js": "^3.22.4",
|
|
45
|
+
"@babel/runtime": "^7.18.6",
|
|
46
|
+
"@hitachivantara/uikit-react-core": "^3.68.1",
|
|
47
|
+
"clsx": "^1.2.0",
|
|
48
|
+
"core-js": "^3.23.3",
|
|
54
49
|
"deep-diff": "^1.0.2",
|
|
55
50
|
"lodash": "^4.17.21",
|
|
56
51
|
"prop-types": "^15.8.1",
|
|
@@ -58,31 +53,28 @@
|
|
|
58
53
|
},
|
|
59
54
|
"devDependencies": {
|
|
60
55
|
"@testing-library/jest-dom": "^5.16.4",
|
|
61
|
-
"@testing-library/react": "^
|
|
62
|
-
"@testing-library/react-hooks": "^
|
|
56
|
+
"@testing-library/react": "^12.1.2",
|
|
57
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
63
58
|
"@testing-library/user-event": "^12.8.3",
|
|
64
59
|
"@types/lodash": "^4.14.182",
|
|
65
|
-
"@types/plotly.js": "^1.54.
|
|
60
|
+
"@types/plotly.js": "^1.54.22",
|
|
66
61
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
|
67
62
|
"del-cli": "^4.0.1",
|
|
68
63
|
"enzyme": "^3.11.0",
|
|
69
64
|
"enzyme-to-json": "^3.6.2",
|
|
70
|
-
"jest": "^
|
|
65
|
+
"jest": "^28.1.2",
|
|
71
66
|
"jest-canvas-mock": "^2.4.0",
|
|
72
|
-
"jest-
|
|
73
|
-
"jest-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
67
|
+
"jest-environment-jsdom": "^28.1.2",
|
|
68
|
+
"jest-fail-on-console": "^2.4.2",
|
|
69
|
+
"jest-junit": "^14.0.0",
|
|
70
|
+
"nodemon": "^2.0.18",
|
|
71
|
+
"npm-run-all": "^4.1.5"
|
|
77
72
|
},
|
|
78
73
|
"files": [
|
|
79
74
|
"dist"
|
|
80
75
|
],
|
|
81
|
-
"jest": {
|
|
82
|
-
"testEnvironment": "node"
|
|
83
|
-
},
|
|
84
76
|
"publishConfig": {
|
|
85
77
|
"access": "public"
|
|
86
78
|
},
|
|
87
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "22bebe9cc9c657e7aedbecfb69f47fa6837da6c4"
|
|
88
80
|
}
|