@auth0/quantum-charts 1.1.2 → 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.
@@ -94,7 +94,7 @@ function BarChart(props) {
94
94
  if (entries[entryKey]) {
95
95
  entries[entryKey][entry.group] = entry[leftAxisDataKey];
96
96
  entries[entryKey].value = entry[leftAxisDataKey];
97
- if (entry.isPartial !== undefined) {
97
+ if (entry.isPartial === true || (entry.isPartial === false && entries[entryKey].isPartial !== true)) {
98
98
  entries[entryKey].isPartial = entry.isPartial;
99
99
  }
100
100
  }
@@ -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(true);
101
+ setIsOpen(false);
102
102
  (0, downloadCsv_1.downloadCSV)(dataTable, title);
103
103
  },
104
104
  title: 'Download CSV',
@@ -65,7 +65,7 @@ export function BarChart(props) {
65
65
  if (entries[entryKey]) {
66
66
  entries[entryKey][entry.group] = entry[leftAxisDataKey];
67
67
  entries[entryKey].value = entry[leftAxisDataKey];
68
- if (entry.isPartial !== undefined) {
68
+ if (entry.isPartial === true || (entry.isPartial === false && entries[entryKey].isPartial !== true)) {
69
69
  entries[entryKey].isPartial = entry.isPartial;
70
70
  }
71
71
  }
@@ -72,7 +72,7 @@ export function ChartSummary(props) {
72
72
  type: 'item',
73
73
  endIcon: React.createElement(DownloadCloudIcon, null),
74
74
  onClick: function () {
75
- setIsOpen(true);
75
+ setIsOpen(false);
76
76
  downloadCSV(dataTable, title);
77
77
  },
78
78
  title: 'Download CSV',
@@ -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 _e = useDropdownMenuState({ baseId: 'threshold-menu' }), triggerProps = _e.triggerProps, menuProps = _e.menuProps;
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 _f = __read(React.useState(initialState), 2), lineVisibility = _f[0], setLineVisibility = _f[1];
53
- var _g = __read(React.useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]), 2), threshold = _g[0], setThreshold = _g[1];
54
- var _h = __read(React.useState(false), 2), isOpen = _h[0], setIsOpen = _h[1];
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,
@@ -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;
@@ -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 _e = (0, quantum_product_1.useDropdownMenuState)({ baseId: 'threshold-menu' }), triggerProps = _e.triggerProps, menuProps = _e.menuProps;
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 _f = __read(React.useState(initialState), 2), lineVisibility = _f[0], setLineVisibility = _f[1];
82
- var _g = __read(React.useState(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]), 2), threshold = _g[0], setThreshold = _g[1];
83
- var _h = __read(React.useState(false), 2), isOpen = _h[0], setIsOpen = _h[1];
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-charts",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "sideEffects": false,
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",