@auth0/quantum-charts 1.1.3 → 1.1.4
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/chart-summary/index.js
CHANGED
|
@@ -98,7 +98,7 @@ function ChartSummary(props) {
|
|
|
98
98
|
type: 'item',
|
|
99
99
|
endIcon: React.createElement(quantum_product_1.DownloadCloudIcon, null),
|
|
100
100
|
onClick: function () {
|
|
101
|
-
setIsOpen(
|
|
101
|
+
setIsOpen(false);
|
|
102
102
|
(0, downloadCsv_1.downloadCSV)(dataTable, title);
|
|
103
103
|
},
|
|
104
104
|
title: 'Download CSV',
|
package/esm/line-chart/index.js
CHANGED
|
@@ -40,18 +40,18 @@ var getThresholdColor = function (data, baseColor) {
|
|
|
40
40
|
return data.hover === 'thresholdControl' || !data.hover ? baseColor : alpha(baseColor, 0.35);
|
|
41
41
|
};
|
|
42
42
|
export function LineChart(props) {
|
|
43
|
-
var _a = props, data = _a.data, leftAxis = _a.leftAxis, bottomAxis = _a.bottomAxis, _b = _a.height, height = _b === void 0 ? 300 : _b, title = _a.title, value = _a.value, label = _a.label, helperText = _a.helperText, _c = _a.legend, legend = _c === void 0 ? true : _c, syncId = _a.syncId, _d = _a.color, color = _d === void 0 ? 'categorical' : _d, headerAction = _a.headerAction, additionalMenuItems = _a.additionalMenuItems, thresholds = _a.thresholds, breaches = _a.breaches, disableThresholdMenu = _a.disableThresholdMenu;
|
|
43
|
+
var _a = props, data = _a.data, leftAxis = _a.leftAxis, bottomAxis = _a.bottomAxis, _b = _a.height, height = _b === void 0 ? 300 : _b, title = _a.title, value = _a.value, label = _a.label, helperText = _a.helperText, _c = _a.legend, legend = _c === void 0 ? true : _c, syncId = _a.syncId, _d = _a.color, color = _d === void 0 ? 'categorical' : _d, headerAction = _a.headerAction, additionalMenuItems = _a.additionalMenuItems, thresholds = _a.thresholds, breaches = _a.breaches, disableThresholdMenu = _a.disableThresholdMenu, _e = _a.allowDownload, allowDownload = _e === void 0 ? true : _e, _f = _a.showChartTable, showChartTable = _f === void 0 ? true : _f;
|
|
44
44
|
var theme = useTheme();
|
|
45
|
-
var
|
|
45
|
+
var _g = useDropdownMenuState({ baseId: 'threshold-menu' }), triggerProps = _g.triggerProps, menuProps = _g.menuProps;
|
|
46
46
|
// Function to know how many lines we need based of how much different group values are.
|
|
47
47
|
var groups = _.uniqBy(data, 'group').map(function (item) { return item.group; });
|
|
48
48
|
var initialState = __assign({ hover: null }, groups.reduce(function (acc, group) {
|
|
49
49
|
var _a;
|
|
50
50
|
return (__assign(__assign({}, acc), (_a = {}, _a[group] = false, _a)));
|
|
51
51
|
}, {}));
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
52
|
+
var _h = __read(React.useState(initialState), 2), lineVisibility = _h[0], setLineVisibility = _h[1];
|
|
53
|
+
var _j = __read(React.useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]), 2), threshold = _j[0], setThreshold = _j[1];
|
|
54
|
+
var _k = __read(React.useState(false), 2), isOpen = _k[0], setIsOpen = _k[1];
|
|
55
55
|
React.useEffect(function () {
|
|
56
56
|
setThreshold(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]);
|
|
57
57
|
}, [thresholds]);
|
|
@@ -145,7 +145,7 @@ export function LineChart(props) {
|
|
|
145
145
|
} },
|
|
146
146
|
React.createElement(TableIcon, null))));
|
|
147
147
|
return (React.createElement(React.Fragment, null,
|
|
148
|
-
React.createElement(ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, additionalMenuItems: additionalMenuItems },
|
|
148
|
+
React.createElement(ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, additionalMenuItems: additionalMenuItems, allowDownload: allowDownload, showChartTable: showChartTable },
|
|
149
149
|
React.createElement(ResponsiveContainer, { width: '100%', height: height }, data.length ? (React.createElement(ComposedChart, { data: Object.values(entries), height: height, width: 500, syncId: syncId, margin: {
|
|
150
150
|
top: 24,
|
|
151
151
|
right: 10,
|
package/line-chart/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export interface ILineChartProps<DataType = unknown> extends IBaseChartProps<Dat
|
|
|
5
5
|
thresholds?: object[] | null;
|
|
6
6
|
breaches?: object[] | null;
|
|
7
7
|
disableThresholdMenu?: boolean;
|
|
8
|
+
allowDownload?: boolean;
|
|
9
|
+
showChartTable?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare function LineChart<DataType = unknown>(props: ILineChartProps<DataType>): React.JSX.Element;
|
package/line-chart/index.js
CHANGED
|
@@ -69,18 +69,18 @@ var getThresholdColor = function (data, baseColor) {
|
|
|
69
69
|
return data.hover === 'thresholdControl' || !data.hover ? baseColor : (0, quantum_product_1.alpha)(baseColor, 0.35);
|
|
70
70
|
};
|
|
71
71
|
function LineChart(props) {
|
|
72
|
-
var _a = props, data = _a.data, leftAxis = _a.leftAxis, bottomAxis = _a.bottomAxis, _b = _a.height, height = _b === void 0 ? 300 : _b, title = _a.title, value = _a.value, label = _a.label, helperText = _a.helperText, _c = _a.legend, legend = _c === void 0 ? true : _c, syncId = _a.syncId, _d = _a.color, color = _d === void 0 ? 'categorical' : _d, headerAction = _a.headerAction, additionalMenuItems = _a.additionalMenuItems, thresholds = _a.thresholds, breaches = _a.breaches, disableThresholdMenu = _a.disableThresholdMenu;
|
|
72
|
+
var _a = props, data = _a.data, leftAxis = _a.leftAxis, bottomAxis = _a.bottomAxis, _b = _a.height, height = _b === void 0 ? 300 : _b, title = _a.title, value = _a.value, label = _a.label, helperText = _a.helperText, _c = _a.legend, legend = _c === void 0 ? true : _c, syncId = _a.syncId, _d = _a.color, color = _d === void 0 ? 'categorical' : _d, headerAction = _a.headerAction, additionalMenuItems = _a.additionalMenuItems, thresholds = _a.thresholds, breaches = _a.breaches, disableThresholdMenu = _a.disableThresholdMenu, _e = _a.allowDownload, allowDownload = _e === void 0 ? true : _e, _f = _a.showChartTable, showChartTable = _f === void 0 ? true : _f;
|
|
73
73
|
var theme = (0, quantum_product_1.useTheme)();
|
|
74
|
-
var
|
|
74
|
+
var _g = (0, quantum_product_1.useDropdownMenuState)({ baseId: 'threshold-menu' }), triggerProps = _g.triggerProps, menuProps = _g.menuProps;
|
|
75
75
|
// Function to know how many lines we need based of how much different group values are.
|
|
76
76
|
var groups = lodash_1.default.uniqBy(data, 'group').map(function (item) { return item.group; });
|
|
77
77
|
var initialState = __assign({ hover: null }, groups.reduce(function (acc, group) {
|
|
78
78
|
var _a;
|
|
79
79
|
return (__assign(__assign({}, acc), (_a = {}, _a[group] = false, _a)));
|
|
80
80
|
}, {}));
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
81
|
+
var _h = __read(React.useState(initialState), 2), lineVisibility = _h[0], setLineVisibility = _h[1];
|
|
82
|
+
var _j = __read(React.useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]), 2), threshold = _j[0], setThreshold = _j[1];
|
|
83
|
+
var _k = __read(React.useState(false), 2), isOpen = _k[0], setIsOpen = _k[1];
|
|
84
84
|
React.useEffect(function () {
|
|
85
85
|
setThreshold(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]);
|
|
86
86
|
}, [thresholds]);
|
|
@@ -174,7 +174,7 @@ function LineChart(props) {
|
|
|
174
174
|
} },
|
|
175
175
|
React.createElement(quantum_product_1.TableIcon, null))));
|
|
176
176
|
return (React.createElement(React.Fragment, null,
|
|
177
|
-
React.createElement(chart_card_1.ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, additionalMenuItems: additionalMenuItems },
|
|
177
|
+
React.createElement(chart_card_1.ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, additionalMenuItems: additionalMenuItems, allowDownload: allowDownload, showChartTable: showChartTable },
|
|
178
178
|
React.createElement(recharts_1.ResponsiveContainer, { width: '100%', height: height }, data.length ? (React.createElement(recharts_1.ComposedChart, { data: Object.values(entries), height: height, width: 500, syncId: syncId, margin: {
|
|
179
179
|
top: 24,
|
|
180
180
|
right: 10,
|