@hitachivantara/uikit-react-core 3.66.1-next.4 → 3.67.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.
- package/dist/Barchart/Barchart.d.ts +14 -0
- package/dist/Barchart/Barchart.js +239 -0
- package/dist/Barchart/Barchart.js.map +1 -0
- package/dist/Barchart/barchartPlotlyOverrides.js +59 -0
- package/dist/Barchart/barchartPlotlyOverrides.js.map +1 -0
- package/dist/Barchart/index.d.ts +2 -0
- package/dist/Barchart/index.js +16 -0
- package/dist/Barchart/index.js.map +1 -0
- package/dist/Barchart/styles.js +10 -0
- package/dist/Barchart/styles.js.map +1 -0
- package/dist/BaseInput/BaseInput.js +6 -1
- package/dist/BaseInput/BaseInput.js.map +1 -1
- package/dist/BaseInput/styles.js +3 -0
- package/dist/BaseInput/styles.js.map +1 -1
- package/dist/Chart/Chart.d.ts +25 -0
- package/dist/Chart/Chart.js +215 -0
- package/dist/Chart/Chart.js.map +1 -0
- package/dist/Chart/Plot/Plot.d.ts +43 -0
- package/dist/Chart/Plot/Plot.js +131 -0
- package/dist/Chart/Plot/Plot.js.map +1 -0
- package/dist/Chart/Plot/index.d.ts +2 -0
- package/dist/Chart/Plot/index.js +16 -0
- package/dist/Chart/Plot/index.js.map +1 -0
- package/dist/Chart/Plot/styles.js +10 -0
- package/dist/Chart/Plot/styles.js.map +1 -0
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js +162 -0
- package/dist/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -0
- package/dist/Chart/Tooltip/MultiTooltip/index.js +16 -0
- package/dist/Chart/Tooltip/MultiTooltip/index.js.map +1 -0
- package/dist/Chart/Tooltip/MultiTooltip/styles.js +51 -0
- package/dist/Chart/Tooltip/MultiTooltip/styles.js.map +1 -0
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js +87 -0
- package/dist/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -0
- package/dist/Chart/Tooltip/SingleTooltip/index.js +16 -0
- package/dist/Chart/Tooltip/SingleTooltip/index.js.map +1 -0
- package/dist/Chart/Tooltip/SingleTooltip/styles.js +26 -0
- package/dist/Chart/Tooltip/SingleTooltip/styles.js.map +1 -0
- package/dist/Chart/Tooltip/Tooltip.js +165 -0
- package/dist/Chart/Tooltip/Tooltip.js.map +1 -0
- package/dist/Chart/Tooltip/index.js +16 -0
- package/dist/Chart/Tooltip/index.js.map +1 -0
- package/dist/Chart/Tooltip/styles.js +16 -0
- package/dist/Chart/Tooltip/styles.js.map +1 -0
- package/dist/Chart/chartPlotlyOverrides.js +169 -0
- package/dist/Chart/chartPlotlyOverrides.js.map +1 -0
- package/dist/Chart/index.d.ts +5 -0
- package/dist/Chart/index.js +16 -0
- package/dist/Chart/index.js.map +1 -0
- package/dist/Chart/styles.js +49 -0
- package/dist/Chart/styles.js.map +1 -0
- package/dist/Donutchart/Donutchart.d.ts +10 -0
- package/dist/Donutchart/Donutchart.js +124 -0
- package/dist/Donutchart/Donutchart.js.map +1 -0
- package/dist/Donutchart/donutchartPlotlyOverrides.js +56 -0
- package/dist/Donutchart/donutchartPlotlyOverrides.js.map +1 -0
- package/dist/Donutchart/index.d.ts +2 -0
- package/dist/Donutchart/index.js +16 -0
- package/dist/Donutchart/index.js.map +1 -0
- package/dist/Donutchart/styles.js +10 -0
- package/dist/Donutchart/styles.js.map +1 -0
- package/dist/FilterGroup/FilterGroup.d.ts +3 -3
- package/dist/Forms/FormElement/index.d.ts +4 -0
- package/dist/Forms/FormElement/index.js +14 -0
- package/dist/Forms/FormElement/index.js.map +1 -1
- package/dist/Linechart/Linechart.d.ts +14 -0
- package/dist/Linechart/Linechart.js +130 -0
- package/dist/Linechart/Linechart.js.map +1 -0
- package/dist/Linechart/index.d.ts +2 -0
- package/dist/Linechart/index.js +16 -0
- package/dist/Linechart/index.js.map +1 -0
- package/dist/Linechart/lineChartPlotlyOverrides.js +79 -0
- package/dist/Linechart/lineChartPlotlyOverrides.js.map +1 -0
- package/dist/Linechart/styles.js +10 -0
- package/dist/Linechart/styles.js.map +1 -0
- package/dist/Provider/Provider.js +3 -14
- package/dist/Provider/Provider.js.map +1 -1
- package/dist/Slider/Slider.d.ts +185 -0
- package/dist/Slider/Slider.js +803 -0
- package/dist/Slider/Slider.js.map +1 -0
- package/dist/Slider/SliderInput/SliderInput.js +194 -0
- package/dist/Slider/SliderInput/SliderInput.js.map +1 -0
- package/dist/Slider/SliderInput/index.d.ts +1 -0
- package/dist/Slider/SliderInput/index.js +16 -0
- package/dist/Slider/SliderInput/index.js.map +1 -0
- package/dist/Slider/SliderInput/styles.js +24 -0
- package/dist/Slider/SliderInput/styles.js.map +1 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +16 -0
- package/dist/Slider/index.js.map +1 -0
- package/dist/Slider/styles.js +238 -0
- package/dist/Slider/styles.js.map +1 -0
- package/dist/Slider/utils.js +413 -0
- package/dist/Slider/utils.js.map +1 -0
- package/dist/Stack/Stack.js +14 -14
- package/dist/Stack/Stack.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy/Barchart/Barchart.d.ts +14 -0
- package/dist/legacy/Barchart/Barchart.js +195 -0
- package/dist/legacy/Barchart/Barchart.js.map +1 -0
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js +43 -0
- package/dist/legacy/Barchart/barchartPlotlyOverrides.js.map +1 -0
- package/dist/legacy/Barchart/index.d.ts +2 -0
- package/dist/legacy/Barchart/index.js +2 -0
- package/dist/legacy/Barchart/index.js.map +1 -0
- package/dist/legacy/Barchart/styles.js +3 -0
- package/dist/legacy/Barchart/styles.js.map +1 -0
- package/dist/legacy/BaseInput/BaseInput.js +6 -1
- package/dist/legacy/BaseInput/BaseInput.js.map +1 -1
- package/dist/legacy/BaseInput/styles.js +3 -0
- package/dist/legacy/BaseInput/styles.js.map +1 -1
- package/dist/legacy/Chart/Chart.d.ts +25 -0
- package/dist/legacy/Chart/Chart.js +174 -0
- package/dist/legacy/Chart/Chart.js.map +1 -0
- package/dist/legacy/Chart/Plot/Plot.d.ts +43 -0
- package/dist/legacy/Chart/Plot/Plot.js +93 -0
- package/dist/legacy/Chart/Plot/Plot.js.map +1 -0
- package/dist/legacy/Chart/Plot/index.d.ts +2 -0
- package/dist/legacy/Chart/Plot/index.js +2 -0
- package/dist/legacy/Chart/Plot/index.js.map +1 -0
- package/dist/legacy/Chart/Plot/styles.js +3 -0
- package/dist/legacy/Chart/Plot/styles.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js +130 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js +2 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/index.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js +43 -0
- package/dist/legacy/Chart/Tooltip/MultiTooltip/styles.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js +54 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js +2 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/index.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js +18 -0
- package/dist/legacy/Chart/Tooltip/SingleTooltip/styles.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/Tooltip.js +128 -0
- package/dist/legacy/Chart/Tooltip/Tooltip.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/index.js +2 -0
- package/dist/legacy/Chart/Tooltip/index.js.map +1 -0
- package/dist/legacy/Chart/Tooltip/styles.js +9 -0
- package/dist/legacy/Chart/Tooltip/styles.js.map +1 -0
- package/dist/legacy/Chart/chartPlotlyOverrides.js +147 -0
- package/dist/legacy/Chart/chartPlotlyOverrides.js.map +1 -0
- package/dist/legacy/Chart/index.d.ts +5 -0
- package/dist/legacy/Chart/index.js +2 -0
- package/dist/legacy/Chart/index.js.map +1 -0
- package/dist/legacy/Chart/styles.js +32 -0
- package/dist/legacy/Chart/styles.js.map +1 -0
- package/dist/legacy/Donutchart/Donutchart.d.ts +10 -0
- package/dist/legacy/Donutchart/Donutchart.js +86 -0
- package/dist/legacy/Donutchart/Donutchart.js.map +1 -0
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js +40 -0
- package/dist/legacy/Donutchart/donutchartPlotlyOverrides.js.map +1 -0
- package/dist/legacy/Donutchart/index.d.ts +2 -0
- package/dist/legacy/Donutchart/index.js +2 -0
- package/dist/legacy/Donutchart/index.js.map +1 -0
- package/dist/legacy/Donutchart/styles.js +3 -0
- package/dist/legacy/Donutchart/styles.js.map +1 -0
- package/dist/legacy/FilterGroup/FilterGroup.d.ts +3 -3
- package/dist/legacy/Forms/FormElement/index.d.ts +4 -0
- package/dist/legacy/Forms/FormElement/index.js +1 -0
- package/dist/legacy/Forms/FormElement/index.js.map +1 -1
- package/dist/legacy/Linechart/Linechart.d.ts +14 -0
- package/dist/legacy/Linechart/Linechart.js +92 -0
- package/dist/legacy/Linechart/Linechart.js.map +1 -0
- package/dist/legacy/Linechart/index.d.ts +2 -0
- package/dist/legacy/Linechart/index.js +2 -0
- package/dist/legacy/Linechart/index.js.map +1 -0
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js +63 -0
- package/dist/legacy/Linechart/lineChartPlotlyOverrides.js.map +1 -0
- package/dist/legacy/Linechart/styles.js +3 -0
- package/dist/legacy/Linechart/styles.js.map +1 -0
- package/dist/legacy/Provider/Provider.js +4 -15
- package/dist/legacy/Provider/Provider.js.map +1 -1
- package/dist/legacy/Slider/Slider.d.ts +185 -0
- package/dist/legacy/Slider/Slider.js +752 -0
- package/dist/legacy/Slider/Slider.js.map +1 -0
- package/dist/legacy/Slider/SliderInput/SliderInput.js +151 -0
- package/dist/legacy/Slider/SliderInput/SliderInput.js.map +1 -0
- package/dist/legacy/Slider/SliderInput/index.d.ts +1 -0
- package/dist/legacy/Slider/SliderInput/index.js +2 -0
- package/dist/legacy/Slider/SliderInput/index.js.map +1 -0
- package/dist/legacy/Slider/SliderInput/styles.js +16 -0
- package/dist/legacy/Slider/SliderInput/styles.js.map +1 -0
- package/dist/legacy/Slider/index.d.ts +2 -0
- package/dist/legacy/Slider/index.js +2 -0
- package/dist/legacy/Slider/index.js.map +1 -0
- package/dist/legacy/Slider/styles.js +221 -0
- package/dist/legacy/Slider/styles.js.map +1 -0
- package/dist/legacy/Slider/utils.js +347 -0
- package/dist/legacy/Slider/utils.js.map +1 -0
- package/dist/legacy/Stack/Stack.js +14 -14
- package/dist/legacy/Stack/Stack.js.map +1 -1
- package/dist/legacy/index.d.ts +12 -0
- package/dist/legacy/index.js +4 -0
- package/dist/legacy/index.js.map +1 -1
- package/dist/modern/Barchart/Barchart.d.ts +14 -0
- package/dist/modern/Barchart/Barchart.js +176 -0
- package/dist/modern/Barchart/Barchart.js.map +1 -0
- package/dist/modern/Barchart/barchartPlotlyOverrides.js +41 -0
- package/dist/modern/Barchart/barchartPlotlyOverrides.js.map +1 -0
- package/dist/modern/Barchart/index.d.ts +2 -0
- package/dist/modern/Barchart/index.js +2 -0
- package/dist/modern/Barchart/index.js.map +1 -0
- package/dist/modern/Barchart/styles.js +3 -0
- package/dist/modern/Barchart/styles.js.map +1 -0
- package/dist/modern/BaseInput/BaseInput.js +6 -1
- package/dist/modern/BaseInput/BaseInput.js.map +1 -1
- package/dist/modern/BaseInput/styles.js +3 -0
- package/dist/modern/BaseInput/styles.js.map +1 -1
- package/dist/modern/Chart/Chart.d.ts +25 -0
- package/dist/modern/Chart/Chart.js +158 -0
- package/dist/modern/Chart/Chart.js.map +1 -0
- package/dist/modern/Chart/Plot/Plot.d.ts +43 -0
- package/dist/modern/Chart/Plot/Plot.js +94 -0
- package/dist/modern/Chart/Plot/Plot.js.map +1 -0
- package/dist/modern/Chart/Plot/index.d.ts +2 -0
- package/dist/modern/Chart/Plot/index.js +2 -0
- package/dist/modern/Chart/Plot/index.js.map +1 -0
- package/dist/modern/Chart/Plot/styles.js +3 -0
- package/dist/modern/Chart/Plot/styles.js.map +1 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js +123 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/MultiTooltip.js.map +1 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/index.js +2 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/index.js.map +1 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js +41 -0
- package/dist/modern/Chart/Tooltip/MultiTooltip/styles.js.map +1 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js +51 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/SingleTooltip.js.map +1 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/index.js +2 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/index.js.map +1 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js +16 -0
- package/dist/modern/Chart/Tooltip/SingleTooltip/styles.js.map +1 -0
- package/dist/modern/Chart/Tooltip/Tooltip.js +125 -0
- package/dist/modern/Chart/Tooltip/Tooltip.js.map +1 -0
- package/dist/modern/Chart/Tooltip/index.js +2 -0
- package/dist/modern/Chart/Tooltip/index.js.map +1 -0
- package/dist/modern/Chart/Tooltip/styles.js +9 -0
- package/dist/modern/Chart/Tooltip/styles.js.map +1 -0
- package/dist/modern/Chart/chartPlotlyOverrides.js +137 -0
- package/dist/modern/Chart/chartPlotlyOverrides.js.map +1 -0
- package/dist/modern/Chart/index.d.ts +5 -0
- package/dist/modern/Chart/index.js +2 -0
- package/dist/modern/Chart/index.js.map +1 -0
- package/dist/modern/Chart/styles.js +23 -0
- package/dist/modern/Chart/styles.js.map +1 -0
- package/dist/modern/Donutchart/Donutchart.d.ts +10 -0
- package/dist/modern/Donutchart/Donutchart.js +82 -0
- package/dist/modern/Donutchart/Donutchart.js.map +1 -0
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js +38 -0
- package/dist/modern/Donutchart/donutchartPlotlyOverrides.js.map +1 -0
- package/dist/modern/Donutchart/index.d.ts +2 -0
- package/dist/modern/Donutchart/index.js +2 -0
- package/dist/modern/Donutchart/index.js.map +1 -0
- package/dist/modern/Donutchart/styles.js +3 -0
- package/dist/modern/Donutchart/styles.js.map +1 -0
- package/dist/modern/FilterGroup/FilterGroup.d.ts +3 -3
- package/dist/modern/Forms/FormElement/index.d.ts +4 -0
- package/dist/modern/Forms/FormElement/index.js +1 -0
- package/dist/modern/Forms/FormElement/index.js.map +1 -1
- package/dist/modern/Linechart/Linechart.d.ts +14 -0
- package/dist/modern/Linechart/Linechart.js +87 -0
- package/dist/modern/Linechart/Linechart.js.map +1 -0
- package/dist/modern/Linechart/index.d.ts +2 -0
- package/dist/modern/Linechart/index.js +2 -0
- package/dist/modern/Linechart/index.js.map +1 -0
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js +59 -0
- package/dist/modern/Linechart/lineChartPlotlyOverrides.js.map +1 -0
- package/dist/modern/Linechart/styles.js +3 -0
- package/dist/modern/Linechart/styles.js.map +1 -0
- package/dist/modern/Provider/Provider.js +3 -8
- package/dist/modern/Provider/Provider.js.map +1 -1
- package/dist/modern/Slider/Slider.d.ts +185 -0
- package/dist/modern/Slider/Slider.js +689 -0
- package/dist/modern/Slider/Slider.js.map +1 -0
- package/dist/modern/Slider/SliderInput/SliderInput.js +129 -0
- package/dist/modern/Slider/SliderInput/SliderInput.js.map +1 -0
- package/dist/modern/Slider/SliderInput/index.d.ts +1 -0
- package/dist/modern/Slider/SliderInput/index.js +2 -0
- package/dist/modern/Slider/SliderInput/index.js.map +1 -0
- package/dist/modern/Slider/SliderInput/styles.js +16 -0
- package/dist/modern/Slider/SliderInput/styles.js.map +1 -0
- package/dist/modern/Slider/index.d.ts +2 -0
- package/dist/modern/Slider/index.js +2 -0
- package/dist/modern/Slider/index.js.map +1 -0
- package/dist/modern/Slider/styles.js +214 -0
- package/dist/modern/Slider/styles.js.map +1 -0
- package/dist/modern/Slider/utils.js +302 -0
- package/dist/modern/Slider/utils.js.map +1 -0
- package/dist/modern/Stack/Stack.js +4 -4
- package/dist/modern/Stack/Stack.js.map +1 -1
- package/dist/modern/index.d.ts +12 -0
- package/dist/modern/index.js +4 -0
- package/dist/modern/index.js.map +1 -1
- package/package.json +9 -6
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
const _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "stack", "horizontal"];
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
10
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
11
|
+
import React, { useMemo, useEffect, useState, useCallback, useRef } from "react";
|
|
12
|
+
import PropTypes from "prop-types";
|
|
13
|
+
import { withStyles } from "@material-ui/core";
|
|
14
|
+
import Chart from "../Chart";
|
|
15
|
+
import { applyLayoutDefaults, applyDataDefaults } from "./barchartPlotlyOverrides";
|
|
16
|
+
import styles from "./styles";
|
|
17
|
+
const MARGIN = 50;
|
|
18
|
+
const MAX_BAR_WIDTH = 90;
|
|
19
|
+
const MIN_BAR_WIDTH = 3;
|
|
20
|
+
/**
|
|
21
|
+
* A Bar chart is a chart or graph that presents categorical data with rectangular bars.
|
|
22
|
+
*
|
|
23
|
+
* Our implementation leverages the Plotly charting library. If you have a specific case
|
|
24
|
+
* that we don't cover, the Plotly [documentation](https://plotly.com/javascript/) is a good starting point.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const Barchart = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
id,
|
|
30
|
+
classes,
|
|
31
|
+
data,
|
|
32
|
+
layout,
|
|
33
|
+
config,
|
|
34
|
+
tooltipType = "multiple",
|
|
35
|
+
stack = false,
|
|
36
|
+
horizontal = false
|
|
37
|
+
} = _ref,
|
|
38
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
|
|
40
|
+
/* Values derived from props */
|
|
41
|
+
const dataWithDefaults = useMemo(() => applyDataDefaults(data, horizontal), [data, horizontal]);
|
|
42
|
+
const chartLayout = useMemo(() => applyLayoutDefaults(layout, stack, horizontal), [layout, stack, horizontal]);
|
|
43
|
+
/* State */
|
|
44
|
+
|
|
45
|
+
const [chartData, setChartData] = useState(dataWithDefaults);
|
|
46
|
+
/* Effects */
|
|
47
|
+
|
|
48
|
+
const firstRender = useRef(true);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
// only setChartData when prop value changes
|
|
51
|
+
// not needed on first render because the
|
|
52
|
+
// initial state is already properly set
|
|
53
|
+
if (!firstRender.current) {
|
|
54
|
+
setChartData(dataWithDefaults);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
firstRender.current = false;
|
|
58
|
+
}, [dataWithDefaults]);
|
|
59
|
+
/**
|
|
60
|
+
* Used to force the max width of each bar with 90px.
|
|
61
|
+
*
|
|
62
|
+
* (this is effectively more an effect than a callback)
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
const recalculateBarWidth = useCallback(ref => {
|
|
66
|
+
// use the data and layout info directly from the plotly ref
|
|
67
|
+
// as it's always the most uptodate version.
|
|
68
|
+
const plotData = ref.current.props.data;
|
|
69
|
+
const plotLayout = ref.current.props.layout;
|
|
70
|
+
|
|
71
|
+
if (plotData.length > 0) {
|
|
72
|
+
const {
|
|
73
|
+
barmode,
|
|
74
|
+
bargap,
|
|
75
|
+
bargroupgap
|
|
76
|
+
} = plotLayout;
|
|
77
|
+
const isStack = barmode === "stack";
|
|
78
|
+
const numberOfBarsByGroup = isStack ? 1 : plotData.length;
|
|
79
|
+
const numberOfGroup = plotData[0].x.length;
|
|
80
|
+
const {
|
|
81
|
+
width
|
|
82
|
+
} = ref.current.el.getBoundingClientRect();
|
|
83
|
+
const plotWidth = width - MARGIN;
|
|
84
|
+
const groupWidth = plotWidth / numberOfGroup;
|
|
85
|
+
const colWidth = groupWidth * (1 - bargap) - groupWidth * (1 - bargap) * bargroupgap;
|
|
86
|
+
const calculatedBarWidth = colWidth / numberOfBarsByGroup;
|
|
87
|
+
const greaterThan90 = calculatedBarWidth > MAX_BAR_WIDTH;
|
|
88
|
+
const lessThan3 = calculatedBarWidth < MIN_BAR_WIDTH;
|
|
89
|
+
const isAlreadyGreaterThan90 = plotData[0].width !== undefined;
|
|
90
|
+
|
|
91
|
+
if (greaterThan90 && !isAlreadyGreaterThan90) {
|
|
92
|
+
const newWidth = MAX_BAR_WIDTH / plotWidth * numberOfGroup;
|
|
93
|
+
const newData = plotData.map(subData => {
|
|
94
|
+
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
95
|
+
width: newWidth
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
setChartData(newData);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (lessThan3 && !isAlreadyGreaterThan90) {
|
|
102
|
+
const newWidth = MIN_BAR_WIDTH / plotWidth * numberOfGroup;
|
|
103
|
+
const newData = plotData.map(subData => {
|
|
104
|
+
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
105
|
+
width: newWidth
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
setChartData(newData);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!greaterThan90 && isAlreadyGreaterThan90) {
|
|
112
|
+
const newData = plotData.map(subData => {
|
|
113
|
+
return _objectSpread(_objectSpread({}, subData), {}, {
|
|
114
|
+
width: undefined
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
setChartData(newData);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, []);
|
|
121
|
+
return /*#__PURE__*/React.createElement(Chart, _extends({
|
|
122
|
+
id: id,
|
|
123
|
+
classes: classes,
|
|
124
|
+
data: chartData,
|
|
125
|
+
layout: chartLayout,
|
|
126
|
+
config: config,
|
|
127
|
+
tooltipType: tooltipType,
|
|
128
|
+
afterPlot: recalculateBarWidth
|
|
129
|
+
}, others));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
process.env.NODE_ENV !== "production" ? Barchart.propTypes = {
|
|
133
|
+
/**
|
|
134
|
+
* An Id passed on to the component
|
|
135
|
+
*/
|
|
136
|
+
id: PropTypes.string,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A Jss Object used to override or extend the styles applied.
|
|
140
|
+
*/
|
|
141
|
+
classes: PropTypes.instanceOf(Object),
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Plotly data object (see https://plot.ly/javascript/reference/).
|
|
145
|
+
*/
|
|
146
|
+
data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Plotly layout object (see https://plot.ly/javascript/reference/#layout).
|
|
150
|
+
*/
|
|
151
|
+
layout: PropTypes.instanceOf(Object),
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Plotly config object (see https://plot.ly/javascript/configuration-options/).
|
|
155
|
+
*/
|
|
156
|
+
config: PropTypes.instanceOf(Object),
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Defines if should use a single or multiline tooltip.
|
|
160
|
+
*/
|
|
161
|
+
tooltipType: PropTypes.oneOf(["single", "multiple"]),
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Sets is the chart is stack.
|
|
165
|
+
*/
|
|
166
|
+
stack: PropTypes.bool,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Sets is the chart is horizontal.
|
|
170
|
+
*/
|
|
171
|
+
horizontal: PropTypes.bool
|
|
172
|
+
} : void 0;
|
|
173
|
+
export default withStyles(styles, {
|
|
174
|
+
name: "HvBarchart"
|
|
175
|
+
})(Barchart);
|
|
176
|
+
//# sourceMappingURL=Barchart.js.map
|
|
@@ -0,0 +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,mBAA3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;EACE1C,MAAM,EAAEd,SAAS,CAACuD,UAAV,CAAqBC,MAArB,CApBW;;EAqBnB;AACF;AACA;EACEzC,WAAW,EAAEf,SAAS,CAAC2D,KAAV,CAAgB,CAAC,QAAD,EAAW,UAAX,CAAhB,CAxBM;;EAyBnB;AACF;AACA;EACE3C,KAAK,EAAEhB,SAAS,CAAC4D,IA5BE;;EA6BnB;AACF;AACA;EACE3C,UAAU,EAAEjB,SAAS,CAAC4D;AAhCH,CAArB;AAmCA,eAAe3D,UAAU,CAACI,MAAD,EAAS;EAAEwD,IAAI,EAAE;AAAR,CAAT,CAAV,CAA2CpD,QAA3C,CAAf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import clone from "lodash/cloneDeep";
|
|
2
|
+
|
|
3
|
+
const setterIfNil = (object, property, value) => {
|
|
4
|
+
var _object$property;
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line no-param-reassign
|
|
7
|
+
object[property] = (_object$property = object[property]) !== null && _object$property !== void 0 ? _object$property : value;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Auxiliary functions to set the layout in order to follow the DS guideline.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export const applyLayoutDefaults = (inputLayout, stack, isHorizontal) => {
|
|
15
|
+
const layout = inputLayout === undefined ? {} : clone(inputLayout);
|
|
16
|
+
setterIfNil(layout, "bargap", 0.25);
|
|
17
|
+
setterIfNil(layout, "bargroupgap", 0.25);
|
|
18
|
+
setterIfNil(layout, "hovermode", "closest");
|
|
19
|
+
if (stack) setterIfNil(layout, "barmode", "stack");
|
|
20
|
+
setterIfNil(layout, "yaxis", {});
|
|
21
|
+
setterIfNil(layout, "xaxis", {});
|
|
22
|
+
|
|
23
|
+
if (isHorizontal) {
|
|
24
|
+
setterIfNil(layout.yaxis, "showline", true);
|
|
25
|
+
setterIfNil(layout.xaxis, "showline", false);
|
|
26
|
+
} else {
|
|
27
|
+
setterIfNil(layout.yaxis, "showline", false);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return layout;
|
|
31
|
+
};
|
|
32
|
+
export const applyDataDefaults = (inputData, isHorizontal) => {
|
|
33
|
+
const data = inputData;
|
|
34
|
+
data.forEach(trace => {
|
|
35
|
+
setterIfNil(trace, "type", "bar");
|
|
36
|
+
setterIfNil(trace, "hoverinfo", "none");
|
|
37
|
+
if (isHorizontal) setterIfNil(trace, "orientation", "h");
|
|
38
|
+
});
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=barchartPlotlyOverrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barchartPlotlyOverrides.js","names":["clone","setterIfNil","object","property","value","applyLayoutDefaults","inputLayout","stack","isHorizontal","layout","undefined","yaxis","xaxis","applyDataDefaults","inputData","data","forEach","trace"],"sources":["../../../src/Barchart/barchartPlotlyOverrides.js"],"sourcesContent":["import clone from \"lodash/cloneDeep\";\n\nconst setterIfNil = (object, property, value) => {\n // eslint-disable-next-line no-param-reassign\n object[property] = object[property] ?? value;\n};\n\n/**\n * Auxiliary functions to set the layout in order to follow the DS guideline.\n */\nexport const applyLayoutDefaults = (inputLayout, stack, isHorizontal) => {\n const layout = inputLayout === undefined ? {} : clone(inputLayout);\n setterIfNil(layout, \"bargap\", 0.25);\n setterIfNil(layout, \"bargroupgap\", 0.25);\n setterIfNil(layout, \"hovermode\", \"closest\");\n if (stack) setterIfNil(layout, \"barmode\", \"stack\");\n\n setterIfNil(layout, \"yaxis\", {});\n setterIfNil(layout, \"xaxis\", {});\n\n if (isHorizontal) {\n setterIfNil(layout.yaxis, \"showline\", true);\n setterIfNil(layout.xaxis, \"showline\", false);\n } else {\n setterIfNil(layout.yaxis, \"showline\", false);\n }\n\n return layout;\n};\n\nexport const applyDataDefaults = (inputData, isHorizontal) => {\n const data = inputData;\n\n data.forEach((trace) => {\n setterIfNil(trace, \"type\", \"bar\");\n setterIfNil(trace, \"hoverin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GAAGD,SAAb;EAEAC,IAAI,CAACC,OAAL,CAAcC,KAAD,IAAW;IACtBhB,WAAW,CAACgB,KAAD,EAAQ,MAAR,EAAgB,KAAhB,CAAX;IACAhB,WAAW,CAACgB,KAAD,EAAQ,WAAR,EAAqB,MAArB,CAAX;IACA,IAAIT,YAAJ,EAAkBP,WAAW,CAACgB,KAAD,EAAQ,aAAR,EAAuB,GAAvB,CAAX;EACnB,CAJD;EAMA,OAAOF,IAAP;AACD,CAVM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../src/Barchart/index.js"],"sourcesContent":["export { default } from \"./Barchart\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,YAAxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles"],"sources":["../../../src/Barchart/styles.js"],"sourcesContent":["const styles = {};\n\nexport default styles;\n"],"mappings":"AAAA,MAAMA,MAAM,GAAG,EAAf;AAEA,eAAeA,MAAf"}
|
|
@@ -68,7 +68,7 @@ const HvBaseInput = props => {
|
|
|
68
68
|
focused: classes.inputRootFocused,
|
|
69
69
|
disabled: classes.inputRootDisabled,
|
|
70
70
|
multiline: classes.inputRootMultiline,
|
|
71
|
-
input: clsx(classes.input, !formElementProps.disabled && resizable && classes.inputResizable)
|
|
71
|
+
input: clsx(classes.input, !formElementProps.disabled && resizable && classes.inputResizable, disabled && classes.inputDisabled)
|
|
72
72
|
},
|
|
73
73
|
inputProps: _objectSpread(_objectSpread({
|
|
74
74
|
// avoid the required attribute at the root node
|
|
@@ -139,6 +139,11 @@ process.env.NODE_ENV !== "production" ? HvBaseInput.propTypes = {
|
|
|
139
139
|
*/
|
|
140
140
|
input: PropTypes.string,
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Styles applied to input html element when is disabled.
|
|
144
|
+
*/
|
|
145
|
+
inputDisabled: PropTypes.string,
|
|
146
|
+
|
|
142
147
|
/**
|
|
143
148
|
* Styles applied to input html element when it is resizable.
|
|
144
149
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.js","names":["React","useContext","PropTypes","clsx","Input","withStyles","refType","styles","HvFormElementContext","HvFormElementDescriptorsContext","buildFormElementPropsFromContext","buildAriaPropsFromContext","HvBaseInput","props","classes","className","id","name","value","defaultValue","required","readOnly","disabled","onChange","type","placeholder","multiline","resizable","invalid","inputRef","inputProps","others","formElementContext","formElementProps","localInvalid","status","formElementDescriptorsContext","ariaProps","onChangeHandler","event","target","root","inputRoot","focused","inputRootFocused","inputRootDisabled","inputRootMultiline","input","inputResizable","inputBorderContainer","formElementType","propTypes","string","shape","isRequired","bool","func","instanceOf","Object"],"sources":["../../../src/BaseInput/BaseInput.js"],"sourcesContent":["import React, { useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { Input, withStyles } from \"@material-ui/core\";\nimport { refType } from \"../utils\";\nimport styles from \"./styles\";\n\nimport {\n HvFormElementContext,\n HvFormElementDescriptorsContext,\n buildFormElementPropsFromContext,\n buildAriaPropsFromContext,\n} from \"../Forms/FormElement\";\n\n/**\n * An Input component that only posses the most basic functionalities.\n * It should be used alongside the other form elements to construct a proper accessible form.\n */\nconst HvBaseInput = (props) => {\n const {\n classes,\n className = \"\",\n\n id,\n name,\n\n value,\n defaultValue,\n\n required,\n readOnly,\n disabled,\n\n onChange,\n\n type = \"text\",\n\n placeholder,\n\n multiline = false,\n resizable = false,\n invalid = false,\n\n inputRef,\n inputProps = {},\n\n ...others\n } = props;\n\n const formElementContext = useContext(HvFormElementContext);\n const formElementProps = buildFormElementPropsFromContext(props, formElementContext);\n\n const localInvalid = invalid || formElementProps.status === \"invalid\";\n\n const formElementDescriptorsContext = useContext(HvFormElementDescriptorsContext);\n const ariaProps = buildAriaPropsFromContext(\n inputProps,\n formElementDescriptorsContext,\n localInvalid,\n id\n );\n\n const onChangeHandler = (event) => {\n onChange?.(event, event.target.value);\n };\n\n return (\n <div\n className={clsx(classes.root, className, {\n [classes.disabled]: formElementProps.disabled,\n [classes.invalid]: localInvalid,\n [classes.resizable]: multiline && resizable,\n [classes.readOnly]: readOnly,\n })}\n >\n <Input\n id={id}\n name={formElementProps.name}\n value={value}\n defaultValue={defaultValue}\n type={type}\n placeholder={placeholder}\n readOnly={formElementProps.readOnly}\n disabled={formElementProps.disabled}\n onChange={onChangeHandler}\n classes={{\n root: classes.inputRoot,\n focused: classes.inputRootFocused,\n disabled: classes.inputRootDisabled,\n multiline: classes.inputRootMultiline,\n input: clsx(classes.input, {\n [classes.inputResizable]: !formElementProps.disabled && resizable,\n }),\n }}\n inputProps={{\n // avoid the required attribute at the root node\n required: formElementProps.required,\n ...inputProps,\n ...ariaProps,\n }}\n inputRef={inputRef}\n multiline={multiline}\n rows={10}\n {...others}\n />\n {!multiline && <div role=\"presentation\" className={classes.inputBorderContainer} />}\n </div>\n );\n};\n\nHvBaseInput.formElementType = \"input\";\n\nHvBaseInput.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the root container of the input.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is disabled.\n */\n disabled: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is invalid.\n */\n invalid: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is resizable.\n */\n resizable: PropTypes.string,\n\n /**\n * Styles applied to input root which is the input that encloses all the other elements.\n */\n inputRoot: PropTypes.string,\n /**\n * Styles applied to input root when it is focused.\n */\n inputRootFocused: PropTypes.string,\n /**\n * Styles applied to input html element when it is disabled.\n */\n inputRootDisabled: PropTypes.string,\n /**\n * Styles applied to input html element when it is multiline mode.\n */\n inputRootMultiline: PropTypes.string,\n\n /**\n * Styles applied to input html element.\n */\n input: PropTypes.string,\n /**\n * Styles applied to input html element when it is resizable.\n */\n inputResizable: PropTypes.string,\n\n /**\n * Styles applied to the container of the border element.\n */\n inputBorderContainer: PropTypes.string,\n /**\n * Styles applied to the container of the border element, when in read only mode.\n */\n readOnly: PropTypes.string,\n }).isRequired,\n\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * The input name.\n */\n name: PropTypes.string,\n\n /**\n * The value of the input, when controlled.\n */\n value: PropTypes.string,\n /**\n * The initial value of the input, when uncontrolled.\n */\n defaultValue: PropTypes.string,\n\n /**\n * If `true` the input is disabled.\n */\n disabled: PropTypes.bool,\n /**\n * Indicates that the input is not editable.\n */\n readOnly: PropTypes.bool,\n /**\n * If true, the input element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * The function that will be executed onChange, allows modification of the input,\n * it receives the value. If a new value should be presented it must returned it.\n */\n onChange: PropTypes.func,\n\n /**\n * The input type.\n */\n type: PropTypes.string,\n\n /**\n * Label inside the input used to help user.\n */\n placeholder: PropTypes.string,\n\n /**\n * If true, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n /**\n * If true and multiline is also true the textarea element will be resizable.\n */\n resizable: PropTypes.bool,\n /**\n * Denotes if the input is in an invalid state.\n */\n invalid: PropTypes.bool,\n\n /**\n * Attributes applied to the input element.\n */\n inputProps: PropTypes.instanceOf(Object),\n /**\n * Allows passing a ref to the underlying input\n */\n inputRef: refType,\n};\n\nexport default withStyles(styles, { name: \"HvBaseInput\" })(HvBaseInput);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,KAAT,EAAgBC,UAAhB,QAAkC,mBAAlC;AACA,SAASC,OAAT,QAAwB,UAAxB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,SACEC,oBADF,EAEEC,+BAFF,EAGEC,gCAHF,EAIEC,yBAJF,QAKO,sBALP;AAOA;AACA;AACA;AACA;;AACA,MAAMC,WA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;EACE3B,WAAW,EAAEvB,SAAS,CAACkD,MA3GD;;EA6GtB;AACF;AACA;EACE1B,SAAS,EAAExB,SAAS,CAACqD,IAhHC;;EAiHtB;AACF;AACA;EACE5B,SAAS,EAAEzB,SAAS,CAACqD,IApHC;;EAqHtB;AACF;AACA;EACE3B,OAAO,EAAE1B,SAAS,CAACqD,IAxHG;;EA0HtB;AACF;AACA;EACEzB,UAAU,EAAE5B,SAAS,CAACuD,UAAV,CAAqBC,MAArB,CA7HU;;EA8HtB;AACF;AACA;EACE7B,QAAQ,EAAEvB;AAjIY,CAAxB;AAoIA,eAAeD,UAAU,CAACE,MAAD,EAAS;EAAEU,IAAI,EAAE;AAAR,CAAT,CAAV,CAA4CL,WAA5C,CAAf"}
|
|
1
|
+
{"version":3,"file":"BaseInput.js","names":["React","useContext","PropTypes","clsx","Input","withStyles","refType","styles","HvFormElementContext","HvFormElementDescriptorsContext","buildFormElementPropsFromContext","buildAriaPropsFromContext","HvBaseInput","props","classes","className","id","name","value","defaultValue","required","readOnly","disabled","onChange","type","placeholder","multiline","resizable","invalid","inputRef","inputProps","others","formElementContext","formElementProps","localInvalid","status","formElementDescriptorsContext","ariaProps","onChangeHandler","event","target","root","inputRoot","focused","inputRootFocused","inputRootDisabled","inputRootMultiline","input","inputResizable","inputDisabled","inputBorderContainer","formElementType","propTypes","string","shape","isRequired","bool","func","instanceOf","Object"],"sources":["../../../src/BaseInput/BaseInput.js"],"sourcesContent":["import React, { useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { Input, withStyles } from \"@material-ui/core\";\nimport { refType } from \"../utils\";\nimport styles from \"./styles\";\n\nimport {\n HvFormElementContext,\n HvFormElementDescriptorsContext,\n buildFormElementPropsFromContext,\n buildAriaPropsFromContext,\n} from \"../Forms/FormElement\";\n\n/**\n * An Input component that only posses the most basic functionalities.\n * It should be used alongside the other form elements to construct a proper accessible form.\n */\nconst HvBaseInput = (props) => {\n const {\n classes,\n className = \"\",\n\n id,\n name,\n\n value,\n defaultValue,\n\n required,\n readOnly,\n disabled,\n\n onChange,\n\n type = \"text\",\n\n placeholder,\n\n multiline = false,\n resizable = false,\n invalid = false,\n\n inputRef,\n inputProps = {},\n\n ...others\n } = props;\n\n const formElementContext = useContext(HvFormElementContext);\n const formElementProps = buildFormElementPropsFromContext(props, formElementContext);\n\n const localInvalid = invalid || formElementProps.status === \"invalid\";\n\n const formElementDescriptorsContext = useContext(HvFormElementDescriptorsContext);\n const ariaProps = buildAriaPropsFromContext(\n inputProps,\n formElementDescriptorsContext,\n localInvalid,\n id\n );\n\n const onChangeHandler = (event) => {\n onChange?.(event, event.target.value);\n };\n\n return (\n <div\n className={clsx(classes.root, className, {\n [classes.disabled]: formElementProps.disabled,\n [classes.invalid]: localInvalid,\n [classes.resizable]: multiline && resizable,\n [classes.readOnly]: readOnly,\n })}\n >\n <Input\n id={id}\n name={formElementProps.name}\n value={value}\n defaultValue={defaultValue}\n type={type}\n placeholder={placeholder}\n readOnly={formElementProps.readOnly}\n disabled={formElementProps.disabled}\n onChange={onChangeHandler}\n classes={{\n root: classes.inputRoot,\n focused: classes.inputRootFocused,\n disabled: classes.inputRootDisabled,\n multiline: classes.inputRootMultiline,\n input: clsx(classes.input, {\n [classes.inputResizable]: !formElementProps.disabled && resizable,\n [classes.inputDisabled]: disabled,\n }),\n }}\n inputProps={{\n // avoid the required attribute at the root node\n required: formElementProps.required,\n ...inputProps,\n ...ariaProps,\n }}\n inputRef={inputRef}\n multiline={multiline}\n rows={10}\n {...others}\n />\n {!multiline && <div role=\"presentation\" className={classes.inputBorderContainer} />}\n </div>\n );\n};\n\nHvBaseInput.formElementType = \"input\";\n\nHvBaseInput.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the component styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the root container of the input.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is disabled.\n */\n disabled: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is invalid.\n */\n invalid: PropTypes.string,\n /**\n * Styles applied to the root container of the input when it is resizable.\n */\n resizable: PropTypes.string,\n\n /**\n * Styles applied to input root which is the input that encloses all the other elements.\n */\n inputRoot: PropTypes.string,\n /**\n * Styles applied to input root when it is focused.\n */\n inputRootFocused: PropTypes.string,\n /**\n * Styles applied to input html element when it is disabled.\n */\n inputRootDisabled: PropTypes.string,\n /**\n * Styles applied to input html element when it is multiline mode.\n */\n inputRootMultiline: PropTypes.string,\n\n /**\n * Styles applied to input html element.\n */\n input: PropTypes.string,\n /**\n * Styles applied to input html element when is disabled.\n */\n inputDisabled: PropTypes.string,\n /**\n * Styles applied to input html element when it is resizable.\n */\n inputResizable: PropTypes.string,\n\n /**\n * Styles applied to the container of the border element.\n */\n inputBorderContainer: PropTypes.string,\n /**\n * Styles applied to the container of the border element, when in read only mode.\n */\n readOnly: PropTypes.string,\n }).isRequired,\n\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * The input name.\n */\n name: PropTypes.string,\n\n /**\n * The value of the input, when controlled.\n */\n value: PropTypes.string,\n /**\n * The initial value of the input, when uncontrolled.\n */\n defaultValue: PropTypes.string,\n\n /**\n * If `true` the input is disabled.\n */\n disabled: PropTypes.bool,\n /**\n * Indicates that the input is not editable.\n */\n readOnly: PropTypes.bool,\n /**\n * If true, the input element will be required.\n */\n required: PropTypes.bool,\n\n /**\n * The function that will be executed onChange, allows modification of the input,\n * it receives the value. If a new value should be presented it must returned it.\n */\n onChange: PropTypes.func,\n\n /**\n * The input type.\n */\n type: PropTypes.string,\n\n /**\n * Label inside the input used to help user.\n */\n placeholder: PropTypes.string,\n\n /**\n * If true, a textarea element will be rendered.\n */\n multiline: PropTypes.bool,\n /**\n * If true and multiline is also true the textarea element will be resizable.\n */\n resizable: PropTypes.bool,\n /**\n * Denotes if the input is in an invalid state.\n */\n invalid: PropTypes.bool,\n\n /**\n * Attributes applied to the input element.\n */\n inputProps: PropTypes.instanceOf(Object),\n /**\n * Allows passing a ref to the underlying input\n */\n inputRef: refType,\n};\n\nexport default withStyles(styles, { name: \"HvBaseInput\" })(HvBaseInput);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,KAAT,EAAgBC,UAAhB,QAAkC,mBAAlC;AACA,SAASC,OAAT,QAAwB,UAAxB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,SACEC,oBADF,EAEEC,+BAFF,EAGEC,gCAHF,EAIEC,yBAJF,QAKO,sBALP;AAOA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAIC,KAAD,IAAW;EAC7B,MAAM;IACJC,OADI;IAEJC,SAAS,GAAG,EAFR;IAIJC,EAJI;IAKJC,IALI;IAOJC,KAPI;IAQJC,YARI;IAUJC,QAVI;IAWJC,QAXI;IAYJC,QAZI;IAcJC,QAdI;IAgBJC,IAAI,GAAG,MAhBH;IAkBJC,WAlBI;IAoBJC,SAAS,GAAG,KApBR;IAqBJC,SAAS,GAAG,KArBR;IAsBJC,OAAO,GAAG,KAtBN;IAwBJC,QAxBI;IAyBJC,UAAU,GAAG;EAzBT,IA4BFjB,KA5BJ;EAAA,MA2BKkB,MA3BL,4BA4BIlB,KA5BJ;;EA8BA,MAAMmB,kBAAkB,GAAG/B,UAAU,CAACO,oBAAD,CAArC;EACA,MAAMyB,gBAAgB,GAAGvB,gCAAgC,CAACG,KAAD,EAAQmB,kBAAR,CAAzD;EAEA,MAAME,YAAY,GAAGN,OAAO,IAAIK,gBAAgB,CAACE,MAAjB,KAA4B,SAA5D;EAEA,MAAMC,6BAA6B,GAAGnC,UAAU,CAACQ,+BAAD,CAAhD;EACA,MAAM4B,SAAS,GAAG1B,yBAAyB,CACzCmB,UADyC,EAEzCM,6BAFyC,EAGzCF,YAHyC,EAIzClB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B;;EAkEtB;AACF;AACA;EACEvC,EAAE,EAAEd,SAAS,CAACmD,MArEQ;;EAsEtB;AACF;AACA;EACEpC,IAAI,EAAEf,SAAS,CAACmD,MAzEM;;EA2EtB;AACF;AACA;EACEnC,KAAK,EAAEhB,SAAS,CAACmD,MA9EK;;EA+EtB;AACF;AACA;EACElC,YAAY,EAAEjB,SAAS,CAACmD,MAlFF;;EAoFtB;AACF;AACA;EACE/B,QAAQ,EAAEpB,SAAS,CAACsD,IAvFE;;EAwFtB;AACF;AACA;EACEnC,QAAQ,EAAEnB,SAAS,CAACsD,IA3FE;;EA4FtB;AACF;AACA;EACEpC,QAAQ,EAAElB,SAAS,CAACsD,IA/FE;;EAiGtB;AACF;AACA;AACA;EACEjC,QAAQ,EAAErB,SAAS,CAACuD,IArGE;;EAuGtB;AACF;AACA;EACEjC,IAAI,EAAEtB,SAAS,CAACmD,MA1GM;;EA4GtB;AACF;AACA;EACE5B,WAAW,EAAEvB,SAAS,CAACmD,MA/GD;;EAiHtB;AACF;AACA;EACE3B,SAAS,EAAExB,SAAS,CAACsD,IApHC;;EAqHtB;AACF;AACA;EACE7B,SAAS,EAAEzB,SAAS,CAACsD,IAxHC;;EAyHtB;AACF;AACA;EACE5B,OAAO,EAAE1B,SAAS,CAACsD,IA5HG;;EA8HtB;AACF;AACA;EACE1B,UAAU,EAAE5B,SAAS,CAACwD,UAAV,CAAqBC,MAArB,CAjIU;;EAkItB;AACF;AACA;EACE9B,QAAQ,EAAEvB;AArIY,CAAxB;AAwIA,eAAeD,UAAU,CAACE,MAAD,EAAS;EAAEU,IAAI,EAAE;AAAR,CAAT,CAAV,CAA4CL,WAA5C,CAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["outlineStyles","styles","theme","root","display","width","position","overflow","border","hv","palette","accent","acce1","backgroundColor","resizable","readOnly","disabled","atmosphere","atmo4","atmo3","invalid","semantic","sema4","inputRoot","margin","borderRadius","atmo1","inputRootFocused","background","inputRootDisabled","cursor","inputRootMultiline","padding","height","minHeight","marginLeft","marginRight","input","spacing","xs","typography","normalText","textOverflow","outline","placeholderText","opacity","flexGrow","inputResizable","resize","inputBorderContainer","top","left","color"],"sources":["../../../src/BaseInput/styles.js"],"sourcesContent":["import { outlineStyles } from \"../Focus/styles\";\n\nconst styles = (theme) => ({\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n \"& $inputRootMultiline\": {\n overflow: \"auto\",\n border: \"none\",\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n },\n resizable: {\n width: \"auto\",\n },\n readOnly: {\n \"& $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n // multiline\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n },\n disabled: {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n },\n },\n invalid: {\n \"&:not($disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.semantic.sema4,\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.semantic.sema4,\n },\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n },\n },\n\n inputRoot: {\n margin: 0,\n width: \"100%\",\n borderRadius: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n },\n inputRootFocused: {\n background: theme.hv.palette.atmosphere.atmo1,\n ...outlineStyles,\n \"&:hover\": {\n background: theme.hv.palette.atmosphere.atmo1,\n },\n },\n inputRootDisabled: {\n background: theme.hv.palette.atmosphere.atmo3,\n \"&:hover\": {\n background: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n },\n cursor: \"not-allowed\",\n },\n inputRootMultiline: {\n padding: 0,\n backgroundColor: \"transparent\",\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n borderRadius: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n },\n },\n\n input: {\n height: \"21px\",\n marginLeft: theme.hv.spacing.xs,\n marginRight: theme.hv.spacing.xs,\n padding: \"6px 0 5px\",\n ...theme.hv.typography.normalText,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n \"&::placeholder\": {\n ...theme.hv.typography.placeholderText,\n opacity: 1,\n },\n \"&::-ms-clear\": {\n display: \"none\",\n },\n width: \"initial\",\n flexGrow: 1,\n },\n inputResizable: {\n resize: \"both\",\n width: \"100%\",\n },\n\n inputBorderContainer: {\n position: \"absolute\",\n width: \"calc(100% - 4px)\",\n height: \"1px\",\n top: \"31px\",\n left: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n\n \"@global\": {\n \"input:-webkit-autofill\": {\n \"-webkit-box-shadow\": `0 0 0px 1000px ${theme.hv.palette.atmosphere.atmo1} inset`,\n \"-webkit-text-fill-color\": theme.hv.typography.normalText.color,\n },\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,SAASA,aAAT,QAA8B,iBAA9B;;AAEA,MAAMC,MAAM,GAAIC,KAAD,KAAY;EACzBC,IAAI,EAAE;IACJC,OAAO,EAAE,cADL;IAEJC,KAAK,EAAE,MAFH;IAGJC,QAAQ,EAAE,UAHN;IAIJ,yBAAyB;MACvBC,QAAQ,EAAE,MADa;MAEvBC,MAAM,EAAE;IAFe,CAJrB;IAQJ,+BAA+B;MAC7B,YAAY;QACVA,MAAM,EAAG,aAAYN,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBC,MAAjB,CAAwBC,KAAM;MADzC;IADiB,CAR3B;IAaJ,iCAAiC;MAC/BC,eAAe,EAAEX,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBC,MAAjB,CAAwBC;IADV,CAb7B;IAgBJ,wCAAwC;MACtCC,eAA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UAAT,CAAoBC,UALpB;IAMHlC,QAAQ,EAAE,QANP;IAOHmC,YAAY,EAAE,UAPX;IAQHC,OAAO,EAAE,MARN;IASH,kDACKzC,KAAK,CAACO,EAAN,CAAS+B,UAAT,CAAoBI,eADzB;MAEEC,OAAO,EAAE;IAFX,EATG;IAaH,gBAAgB;MACdzC,OAAO,EAAE;IADK,CAbb;IAgBHC,KAAK,EAAE,SAhBJ;IAiBHyC,QAAQ,EAAE;EAjBP,EA5JoB;EA+KzBC,cAAc,EAAE;IACdC,MAAM,EAAE,MADM;IAEd3C,KAAK,EAAE;EAFO,CA/KS;EAoLzB4C,oBAAoB,EAAE;IACpB3C,QAAQ,EAAE,UADU;IAEpBD,KAAK,EAAE,kBAFa;IAGpB4B,MAAM,EAAE,KAHY;IAIpBiB,GAAG,EAAE,MAJe;IAKpBC,IAAI,EAAE,KALc;IAMpBtC,eAAe,EAAEX,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBO,UAAjB,CAA4BC;EANzB,CApLG;EA6LzB,WAAW;IACT,0BAA0B;MACxB,sBAAuB,kBAAiBhB,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBO,UAAjB,CAA4BS,KAAM,QADlD;MAExB,2BAA2BxB,KAAK,CAACO,EAAN,CAAS+B,UAAT,CAAoBC,UAApB,CAA+BW;IAFlC;EADjB;AA7Lc,CAAZ,CAAf;;AAqMA,eAAenD,MAAf"}
|
|
1
|
+
{"version":3,"file":"styles.js","names":["outlineStyles","styles","theme","root","display","width","position","overflow","border","hv","palette","accent","acce1","backgroundColor","resizable","readOnly","disabled","atmosphere","atmo4","atmo3","invalid","semantic","sema4","inputRoot","margin","borderRadius","atmo1","inputRootFocused","background","inputRootDisabled","cursor","inputRootMultiline","padding","height","minHeight","marginLeft","marginRight","input","spacing","xs","typography","normalText","textOverflow","outline","placeholderText","opacity","flexGrow","inputDisabled","color","atmo5","inputResizable","resize","inputBorderContainer","top","left"],"sources":["../../../src/BaseInput/styles.js"],"sourcesContent":["import { outlineStyles } from \"../Focus/styles\";\n\nconst styles = (theme) => ({\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n \"& $inputRootMultiline\": {\n overflow: \"auto\",\n border: \"none\",\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.accent.acce1,\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.accent.acce1}`,\n },\n },\n },\n resizable: {\n width: \"auto\",\n },\n readOnly: {\n \"& $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n // multiline\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: \"1px solid transparent\",\n },\n },\n },\n disabled: {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n },\n },\n invalid: {\n \"&:not($disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.semantic.sema4,\n },\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.hv.palette.semantic.sema4,\n },\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n // IE fallback code (using focus-within-polyfill)\n \"&.focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.semantic.sema4}`,\n },\n },\n },\n },\n\n inputRoot: {\n margin: 0,\n width: \"100%\",\n borderRadius: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n },\n inputRootFocused: {\n background: theme.hv.palette.atmosphere.atmo1,\n ...outlineStyles,\n \"&:hover\": {\n background: theme.hv.palette.atmosphere.atmo1,\n },\n },\n inputRootDisabled: {\n background: theme.hv.palette.atmosphere.atmo3,\n \"&:hover\": {\n background: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n },\n cursor: \"not-allowed\",\n },\n inputRootMultiline: {\n padding: 0,\n backgroundColor: \"transparent\",\n \"& $input\": {\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n borderRadius: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n },\n },\n\n input: {\n height: \"21px\",\n marginLeft: theme.hv.spacing.xs,\n marginRight: theme.hv.spacing.xs,\n padding: \"6px 0 5px\",\n ...theme.hv.typography.normalText,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n \"&::placeholder\": {\n ...theme.hv.typography.placeholderText,\n opacity: 1,\n },\n \"&::-ms-clear\": {\n display: \"none\",\n },\n width: \"initial\",\n flexGrow: 1,\n },\n inputDisabled: {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n inputResizable: {\n resize: \"both\",\n width: \"100%\",\n },\n\n inputBorderContainer: {\n position: \"absolute\",\n width: \"calc(100% - 4px)\",\n height: \"1px\",\n top: \"31px\",\n left: \"2px\",\n backgroundColor: theme.hv.palette.atmosphere.atmo4,\n },\n\n \"@global\": {\n \"input:-webkit-autofill\": {\n \"-webkit-box-shadow\": `0 0 0px 1000px ${theme.hv.palette.atmosphere.atmo1} inset`,\n \"-webkit-text-fill-color\": theme.hv.typography.normalText.color,\n },\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;AAAA,SAASA,aAAT,QAA8B,iBAA9B;;AAEA,MAAMC,MAAM,GAAIC,KAAD,KAAY;EACzBC,IAAI,EAAE;IACJC,OAAO,EAAE,cADL;IAEJC,KAAK,EAAE,MAFH;IAGJC,QAAQ,EAAE,UAHN;IAIJ,yBAAyB;MACvBC,QAAQ,EAAE,MADa;MAEvBC,MAAM,EAAE;IAFe,CAJrB;IAQJ,+BAA+B;MAC7B,YAAY;QACVA,MAAM,EAAG,aAAYN,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBC,MAAjB,CAAwBC,KAAM;MADzC;IADiB,CAR3B;IAaJ,iCAAiC;MAC/BC,eAAe,EAAEX,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBC,MAAjB,CAAwBC;IADV,CAb7B;IAgBJ,wCAAwC;MACtCC,eAAe,EAAEX,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBC,MAAjB,CAAwBC;IADH,CAhBpC;IAmBJ;IACA,wCAAwC;MACtCC,eAAe,EAAEX,KA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,EAAN,CAAS+B,UAAT,CAAoBI,eADzB;MAEEC,OAAO,EAAE;IAFX,EATG;IAaH,gBAAgB;MACdzC,OAAO,EAAE;IADK,CAbb;IAgBHC,KAAK,EAAE,SAhBJ;IAiBHyC,QAAQ,EAAE;EAjBP,EA5JoB;EA+KzBC,aAAa,EAAE;IACbC,KAAK,EAAE9C,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBO,UAAjB,CAA4BgC;EADtB,CA/KU;EAkLzBC,cAAc,EAAE;IACdC,MAAM,EAAE,MADM;IAEd9C,KAAK,EAAE;EAFO,CAlLS;EAuLzB+C,oBAAoB,EAAE;IACpB9C,QAAQ,EAAE,UADU;IAEpBD,KAAK,EAAE,kBAFa;IAGpB4B,MAAM,EAAE,KAHY;IAIpBoB,GAAG,EAAE,MAJe;IAKpBC,IAAI,EAAE,KALc;IAMpBzC,eAAe,EAAEX,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBO,UAAjB,CAA4BC;EANzB,CAvLG;EAgMzB,WAAW;IACT,0BAA0B;MACxB,sBAAuB,kBAAiBhB,KAAK,CAACO,EAAN,CAASC,OAAT,CAAiBO,UAAjB,CAA4BS,KAAM,QADlD;MAExB,2BAA2BxB,KAAK,CAACO,EAAN,CAAS+B,UAAT,CAAoBC,UAApB,CAA+BO;IAFlC;EADjB;AAhMc,CAAZ,CAAf;;AAwMA,eAAe/C,MAAf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StandardProps } from "@material-ui/core";
|
|
2
|
+
import { HvPlotProps } from "./Plot";
|
|
3
|
+
|
|
4
|
+
export type HvChartClassKey = "root";
|
|
5
|
+
|
|
6
|
+
export interface HvChartProps extends StandardProps<HvPlotProps, HvChartClassKey> {
|
|
7
|
+
/**
|
|
8
|
+
* Defines if should use a single or multiline tooltip.
|
|
9
|
+
*/
|
|
10
|
+
tooltipType?: "single" | "multiple";
|
|
11
|
+
/**
|
|
12
|
+
* Defines the X axis title.
|
|
13
|
+
*/
|
|
14
|
+
xAxisTitle?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the Y axis title.
|
|
17
|
+
*/
|
|
18
|
+
yAxisTitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Defines the chart subtitle.
|
|
21
|
+
*/
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function HvChart(props: HvChartProps): JSX.Element | null;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["id", "classes", "data", "layout", "config", "tooltipType", "afterPlot", "xAxisTitle", "yAxisTitle"];
|
|
4
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
5
|
+
import React, { useState, useMemo, useCallback } from "react";
|
|
6
|
+
import PropTypes from "prop-types";
|
|
7
|
+
import isNil from "lodash/isNil";
|
|
8
|
+
import { useTheme, withStyles } from "@material-ui/core";
|
|
9
|
+
import Tooltip from "./Tooltip";
|
|
10
|
+
import { applyLayoutDefaults, applyConfigDefaults } from "./chartPlotlyOverrides";
|
|
11
|
+
import Plot from "./Plot";
|
|
12
|
+
import styles from "./styles";
|
|
13
|
+
|
|
14
|
+
const Chart = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
id,
|
|
17
|
+
classes,
|
|
18
|
+
data,
|
|
19
|
+
layout,
|
|
20
|
+
config,
|
|
21
|
+
tooltipType = "multiple",
|
|
22
|
+
afterPlot,
|
|
23
|
+
xAxisTitle,
|
|
24
|
+
yAxisTitle
|
|
25
|
+
} = _ref,
|
|
26
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
/* Values derived from props */
|
|
30
|
+
// Check if the barchart is horizontal or vertical.
|
|
31
|
+
|
|
32
|
+
const isHorizontal = useMemo(() => {
|
|
33
|
+
var _data$;
|
|
34
|
+
|
|
35
|
+
return !isNil((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.orientation) ? data[0].orientation.toUpperCase() === "H" : false;
|
|
36
|
+
}, [data]);
|
|
37
|
+
const chartLayout = useMemo(() => applyLayoutDefaults(layout, theme, isHorizontal, xAxisTitle, yAxisTitle), [isHorizontal, layout, theme, xAxisTitle, yAxisTitle]);
|
|
38
|
+
const chartConfig = useMemo(() => applyConfigDefaults(config), [config]);
|
|
39
|
+
const useSingle = tooltipType === "single";
|
|
40
|
+
/* State */
|
|
41
|
+
|
|
42
|
+
const [isHover, setIsHover] = useState(false);
|
|
43
|
+
const [coordinates, setCoordinates] = useState({
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0
|
|
46
|
+
});
|
|
47
|
+
const [dataTooltip, setDataTooltip] = useState();
|
|
48
|
+
/* Callbacks */
|
|
49
|
+
// Extract data from the plotly onHover event to be used to create the tooltip.
|
|
50
|
+
|
|
51
|
+
const onHover = useCallback(event => {
|
|
52
|
+
const {
|
|
53
|
+
points
|
|
54
|
+
} = event;
|
|
55
|
+
const dataFromPoints = {
|
|
56
|
+
title: "",
|
|
57
|
+
elements: []
|
|
58
|
+
};
|
|
59
|
+
points.forEach((p, i) => {
|
|
60
|
+
var _fData$marker, _fData$line, _fData$labels;
|
|
61
|
+
|
|
62
|
+
const fData = p.fullData;
|
|
63
|
+
const pNumber = p.pointNumber;
|
|
64
|
+
if (i === 0) dataFromPoints.title = isHorizontal ? p.y : p.x || fData.name;
|
|
65
|
+
dataFromPoints.elements.push({
|
|
66
|
+
color: ((_fData$marker = fData.marker) === null || _fData$marker === void 0 ? void 0 : _fData$marker.color) || ((_fData$line = fData.line) === null || _fData$line === void 0 ? void 0 : _fData$line.color) || p.color,
|
|
67
|
+
name: ((_fData$labels = fData.labels) === null || _fData$labels === void 0 ? void 0 : _fData$labels[pNumber]) || fData.name,
|
|
68
|
+
value: isHorizontal ? p.x : p.y || p.value
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
setDataTooltip(dataFromPoints);
|
|
72
|
+
setIsHover(true);
|
|
73
|
+
}, [isHorizontal]);
|
|
74
|
+
const onUnHover = useCallback(() => {
|
|
75
|
+
setIsHover(false);
|
|
76
|
+
}, []);
|
|
77
|
+
const onMouseMove = useCallback(event => {
|
|
78
|
+
setCoordinates({
|
|
79
|
+
x: event.clientX,
|
|
80
|
+
y: event.clientY
|
|
81
|
+
});
|
|
82
|
+
}, []);
|
|
83
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isHover && /*#__PURE__*/React.createElement(Tooltip, {
|
|
84
|
+
coordinates: coordinates,
|
|
85
|
+
data: dataTooltip,
|
|
86
|
+
useSingle: useSingle
|
|
87
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
id: id,
|
|
89
|
+
className: classes.root
|
|
90
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
onMouseMove: onMouseMove
|
|
92
|
+
}, /*#__PURE__*/React.createElement(Plot, _extends({
|
|
93
|
+
data: data,
|
|
94
|
+
layout: chartLayout,
|
|
95
|
+
config: chartConfig,
|
|
96
|
+
onHover: onHover,
|
|
97
|
+
onUnHover: onUnHover,
|
|
98
|
+
afterPlot: afterPlot
|
|
99
|
+
}, others)))));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
process.env.NODE_ENV !== "production" ? Chart.propTypes = {
|
|
103
|
+
/**
|
|
104
|
+
* An Id passed on to the component
|
|
105
|
+
*/
|
|
106
|
+
id: PropTypes.string,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A Jss Object used to override or extend the styles applied.
|
|
110
|
+
*/
|
|
111
|
+
classes: PropTypes.shape({
|
|
112
|
+
root: PropTypes.string
|
|
113
|
+
}),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Plotly data object (see https://plot.ly/javascript/reference/).
|
|
117
|
+
*/
|
|
118
|
+
data: PropTypes.arrayOf(PropTypes.instanceOf(Object)).isRequired,
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Plotly layout object (see https://plot.ly/javascript/reference/#layout).
|
|
122
|
+
*/
|
|
123
|
+
layout: PropTypes.instanceOf(Object).isRequired,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Plotly config object (see https://plot.ly/javascript/configuration-options/).
|
|
127
|
+
*/
|
|
128
|
+
config: PropTypes.instanceOf(Object),
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Defines if should use a single or multiline tooltip.
|
|
132
|
+
*/
|
|
133
|
+
tooltipType: PropTypes.oneOf(["single", "multiple"]),
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Function to be called after plot render.
|
|
137
|
+
*/
|
|
138
|
+
afterPlot: PropTypes.func,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Defines the X axis title.
|
|
142
|
+
*/
|
|
143
|
+
xAxisTitle: PropTypes.string,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Defines the Y axis title.
|
|
147
|
+
*/
|
|
148
|
+
yAxisTitle: PropTypes.string,
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Defines the chart subtitle.
|
|
152
|
+
*/
|
|
153
|
+
subtitle: PropTypes.string
|
|
154
|
+
} : void 0;
|
|
155
|
+
export default withStyles(styles, {
|
|
156
|
+
name: "HvChart"
|
|
157
|
+
})(Chart);
|
|
158
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","useState","useMemo","useCallback","PropTypes","isNil","useTheme","withStyles","Tooltip","applyLayoutDefaults","applyConfigDefaults","Plot","styles","Chart","id","classes","data","layout","config","tooltipType","afterPlot","xAxisTitle","yAxisTitle","others","theme","isHorizontal","orientation","toUpperCase","chartLayout","chartConfig","useSingle","isHover","setIsHover","coordinates","setCoordinates","x","y","dataTooltip","setDataTooltip","onHover","event","points","dataFromPoints","title","elements","forEach","p","i","fData","fullData","pNumber","pointNumber","name","push","color","marker","line","labels","value","onUnHover","onMouseMove","clientX","clientY","root","propTypes","string","shape","arrayOf","instanceOf","Object","isRequired","oneOf","func","subtitle"],"sources":["../../../src/Chart/Chart.js"],"sourcesContent":["import React, { useState, useMemo, useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isNil from \"lodash/isNil\";\nimport { useTheme, withStyles } from \"@material-ui/core\";\nimport Tooltip from \"./Tooltip\";\nimport { applyLayoutDefaults, applyConfigDefaults } from \"./chartPlotlyOverrides\";\n\nimport Plot from \"./Plot\";\nimport styles from \"./styles\";\n\nconst Chart = ({\n id,\n classes,\n data,\n layout,\n config,\n tooltipType = \"multiple\",\n afterPlot,\n xAxisTitle,\n yAxisTitle,\n ...others\n}) => {\n const theme = useTheme();\n\n /* Values derived from props */\n\n // Check if the barchart is horizontal or vertical.\n const isHorizontal = useMemo(\n () => (!isNil(data[0]?.orientation) ? data[0].orientation.toUpperCase() === \"H\" : false),\n [data]\n );\n\n const chartLayout = useMemo(\n () => applyLayoutDefaults(layout, theme, isHorizontal, xAxisTitle, yAxisTitle),\n [isHorizontal, layout, theme, xAxisTitle, yAxisTitle]\n );\n\n const chartConfig = useMemo(() => applyConfigDefaults(config), [config]);\n\n const useSingle = tooltipType === \"single\";\n\n /* State */\n\n const [isHover, setIsHover] = useState(false);\n const [coordinates, setCoordinates] = useState({ x: 0, y: 0 });\n const [dataTooltip, setDataTooltip] = useState();\n\n /* Callbacks */\n\n // Extract data from the plotly onHover event to be used to create the tooltip.\n const onHover = useCallback(\n (event) => {\n const { points } = event;\n\n const dataFromPoints = {\n title: \"\",\n elements: [],\n };\n\n points.forEach((p, i) => {\n const fData = p.fullData;\n const pNumber = p.pointNumber;\n\n if (i === 0) dataFromPoints.title = isHorizontal ? p.y : p.x || fData.name;\n\n dataFromPoints.elements.push({\n color: fData.marker?.color || fData.line?.color || p.color,\n name: fData.labels?.[pNumber] || fData.name,\n value: isHorizontal ? p.x : p.y || p.value,\n });\n });\n\n setDataTooltip(dataFromPoints);\n setIsHover(true);\n },\n [isHorizontal]\n );\n\n const onUnHover = useCallback(() => {\n setIsHover(false);\n }, []);\n\n const onMouseMove = useCallback((event) => {\n setCoordinates({\n x: event.clientX,\n y: event.clientY,\n });\n }, []);\n\n return (\n <>\n {isHover && <Tooltip coordinates={coordinates} data={dataTooltip} useSingle={useSingle} />}\n <div id={id} className={classes.root}>\n <div onMouseMove={onMouseMove}>\n <Plot\n data={data}\n layout={chartLayout}\n config={chartConfig}\n onHover={onHover}\n onUnHover={onUnHover}\n afterPlot={afterPlot}\n {...others}\n />\n </div>\n </div>\n </>\n );\n};\n\nChart.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.shape({\n root: PropTypes.string,\n }),\n\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).isRequired,\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 * Function to be called after plot render.\n */\n afterPlot: PropTypes.func,\n /**\n * Defines the X axis title.\n */\n xAxisTitle: PropTypes.string,\n /**\n * Defines the Y axis title.\n */\n yAxisTitle: PropTypes.string,\n /**\n * Defines the chart subtitle.\n */\n subtitle: PropTypes.string,\n};\n\nexport default withStyles(styles, { name: \"HvChart\" })(Chart);\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,OAA1B,EAAmCC,WAAnC,QAAsD,OAAtD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,cAAlB;AACA,SAASC,Q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