@auth0/quantum-charts 1.3.15 → 1.3.17

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.
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  var __read = (this && this.__read) || function (o, n) {
37
47
  var m = typeof Symbol === "function" && o[Symbol.iterator];
38
48
  if (!m) return o;
@@ -53,7 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
53
63
  return (mod && mod.__esModule) ? mod : { "default": mod };
54
64
  };
55
65
  Object.defineProperty(exports, "__esModule", { value: true });
56
- exports.BarChart = void 0;
66
+ exports.BarChart = BarChart;
57
67
  var lodash_1 = __importDefault(require("lodash"));
58
68
  var React = __importStar(require("react"));
59
69
  var recharts_1 = require("recharts");
@@ -138,4 +148,3 @@ function BarChart(props) {
138
148
  } },
139
149
  React.createElement(quantum_product_1.Text, { variant: "subtitle1" }, "No data"))))));
140
150
  }
141
- exports.BarChart = BarChart;
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ChartCard = void 0;
36
+ exports.ChartCard = ChartCard;
27
37
  var quantum_product_1 = require("@auth0/quantum-product");
28
38
  var React = __importStar(require("react"));
29
39
  var chart_summary_1 = require("../chart-summary");
@@ -33,4 +43,3 @@ function ChartCard(props) {
33
43
  React.createElement(chart_summary_1.ChartSummary, { title: title, value: value, dataTable: dataTable, helperText: helperText, label: label, headerAction: headerAction, showChartTable: showChartTable, allowDownload: allowDownload, additionalMenuItems: additionalMenuItems, customViewChartTable: customViewChartTable, triggerButtonSize: triggerButtonSize, chartStatus: chartStatus, titleIcon: titleIcon, finalMenuItem: finalMenuItem, isVertical: isVertical }),
34
44
  children));
35
45
  }
36
- exports.ChartCard = ChartCard;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __read = (this && this.__read) || function (o, n) {
26
36
  var m = typeof Symbol === "function" && o[Symbol.iterator];
27
37
  if (!m) return o;
@@ -42,7 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
42
52
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
53
  };
44
54
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.DataTableChart = void 0;
55
+ exports.DataTableChart = DataTableChart;
46
56
  var lodash_1 = __importDefault(require("lodash"));
47
57
  var React = __importStar(require("react"));
48
58
  var date_fns_1 = require("date-fns");
@@ -86,4 +96,3 @@ function DataTableChart(props) {
86
96
  ] })));
87
97
  }))))))));
88
98
  }
89
- exports.DataTableChart = DataTableChart;
@@ -30,13 +30,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
30
30
  }) : function(o, v) {
31
31
  o["default"] = v;
32
32
  });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
40
50
  var __read = (this && this.__read) || function (o, n) {
41
51
  var m = typeof Symbol === "function" && o[Symbol.iterator];
42
52
  if (!m) return o;
@@ -63,7 +73,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
63
73
  return to.concat(ar || Array.prototype.slice.call(from));
64
74
  };
65
75
  Object.defineProperty(exports, "__esModule", { value: true });
66
- exports.ChartSummary = exports.titleToAnalyticName = void 0;
76
+ exports.titleToAnalyticName = void 0;
77
+ exports.ChartSummary = ChartSummary;
67
78
  var React = __importStar(require("react"));
68
79
  var quantum_product_1 = require("@auth0/quantum-product");
69
80
  var downloadCsv_1 = require("../helpers/downloadCsv");
@@ -185,5 +196,4 @@ function ChartSummary(props) {
185
196
  label) }),
186
197
  showChartTable && (React.createElement(data_table_chart_1.DataTableChart, { title: title, isOpen: isOpen, toggleIsOpen: toggleIsOpen, data: dataTable, customViewChartTable: customViewChartTable, allowDownload: allowDownload }))));
187
198
  }
188
- exports.ChartSummary = ChartSummary;
189
199
  var templateObject_1, templateObject_2, templateObject_3;
package/common/chart.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TooltipProps } from 'recharts';
3
2
  import { IChartCardProps } from '../chart-card';
4
3
  import { DropdownMenuListItemValue } from '@auth0/quantum-product';
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
48
  };
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.CompareAggregate = void 0;
36
+ exports.CompareAggregate = CompareAggregate;
27
37
  var React = __importStar(require("react"));
28
38
  var styles_1 = require("../styles");
29
39
  var delta_1 = require("../delta");
@@ -37,4 +47,3 @@ function CompareAggregate(props) {
37
47
  React.createElement(styles_1.DefaultCursorBox, null,
38
48
  React.createElement(delta_1.Delta, { value: value, comparedValue: comparedValue, displayType: displayType, direction: direction })))));
39
49
  }
40
- exports.CompareAggregate = CompareAggregate;
package/delta/delta.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.Delta = exports.computeDelta = void 0;
27
37
  var React = __importStar(require("react"));
@@ -19,13 +19,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
19
19
  }) : function(o, v) {
20
20
  o["default"] = v;
21
21
  });
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
29
39
  Object.defineProperty(exports, "__esModule", { value: true });
30
40
  var React = __importStar(require("react"));
31
41
  var quantum_product_1 = require("@auth0/quantum-product");
@@ -51,12 +61,14 @@ var Center = function (props) {
51
61
  };
52
62
  return (React.createElement(CenterPositioning, null,
53
63
  React.createElement(quantum_product_1.Box, null,
54
- React.createElement(Aggregate, null, hasNoData
55
- ? 'No data'
56
- : displayType === 'absolute'
57
- ? (0, format_number_1.toShortCompactNotation)(aggregate)
58
- : (0, format_number_1.toPercentageAdaptive)(percentage(aggregate, sumValues(data)) / 100)),
59
- centerLabel)));
64
+ React.createElement(Aggregate, null, hasNoData ? (React.createElement("div", { style: {
65
+ display: 'grid',
66
+ placeItems: 'center',
67
+ height: '100%',
68
+ textAlign: 'center',
69
+ } },
70
+ React.createElement(quantum_product_1.Text, { variant: "subtitle1" }, "No data"))) : displayType === 'absolute' ? ((0, format_number_1.toShortCompactNotation)(aggregate)) : ((0, format_number_1.toPercentageAdaptive)(percentage(aggregate, sumValues(data)) / 100))),
71
+ hasNoData ? null : centerLabel)));
60
72
  };
61
73
  exports.default = Center;
62
74
  var templateObject_1, templateObject_2;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  var React = __importStar(require("react"));
27
37
  var quantum_product_1 = require("@auth0/quantum-product");
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  var __read = (this && this.__read) || function (o, n) {
37
47
  var m = typeof Symbol === "function" && o[Symbol.iterator];
38
48
  if (!m) return o;
@@ -53,7 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
53
63
  return (mod && mod.__esModule) ? mod : { "default": mod };
54
64
  };
55
65
  Object.defineProperty(exports, "__esModule", { value: true });
56
- exports.DonutChart = void 0;
66
+ exports.DonutChart = DonutChart;
57
67
  var React = __importStar(require("react"));
58
68
  var recharts_1 = require("recharts");
59
69
  var quantum_product_1 = require("@auth0/quantum-product");
@@ -104,4 +114,3 @@ function DonutChart(props) {
104
114
  React.createElement(quantum_product_1.StackLayoutItem, null,
105
115
  React.createElement(decoupled_legend_1.default, { activeIndex: activeIndex, setActiveIndex: setActiveIndex, data: data, color: color, statusColorMapping: statusColorMapping, isStacked: isStacked })))));
106
116
  }
107
- exports.DonutChart = DonutChart;
@@ -3,7 +3,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  return cooked;
4
4
  };
5
5
  import * as React from 'react';
6
- import { Box, styled } from '@auth0/quantum-product';
6
+ import { Box, styled, Text } from '@auth0/quantum-product';
7
7
  import { toPercentageAdaptive, toShortCompactNotation } from '../helpers/format-number';
8
8
  var sumValues = function (data) {
9
9
  return data.reduce(function (accum, item) { return accum + item.value; }, 0);
@@ -26,12 +26,14 @@ var Center = function (props) {
26
26
  };
27
27
  return (React.createElement(CenterPositioning, null,
28
28
  React.createElement(Box, null,
29
- React.createElement(Aggregate, null, hasNoData
30
- ? 'No data'
31
- : displayType === 'absolute'
32
- ? toShortCompactNotation(aggregate)
33
- : toPercentageAdaptive(percentage(aggregate, sumValues(data)) / 100)),
34
- centerLabel)));
29
+ React.createElement(Aggregate, null, hasNoData ? (React.createElement("div", { style: {
30
+ display: 'grid',
31
+ placeItems: 'center',
32
+ height: '100%',
33
+ textAlign: 'center',
34
+ } },
35
+ React.createElement(Text, { variant: "subtitle1" }, "No data"))) : displayType === 'absolute' ? (toShortCompactNotation(aggregate)) : (toPercentageAdaptive(percentage(aggregate, sumValues(data)) / 100))),
36
+ hasNoData ? null : centerLabel)));
35
37
  };
36
38
  export default Center;
37
39
  var templateObject_1, templateObject_2;
@@ -25,8 +25,8 @@ var __read = (this && this.__read) || function (o, n) {
25
25
  }
26
26
  return ar;
27
27
  };
28
- import _ from 'lodash';
29
28
  import * as React from 'react';
29
+ import _ from 'lodash';
30
30
  import { Area, CartesianGrid, ComposedChart, Legend, Line, ReferenceArea, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts';
31
31
  import { useTheme, Text, DropdownMenu, useDropdownMenuState, Button, StackLayout, Divider, ChevronDownIcon, AlertDiamondIcon, IconButton, TableIcon, alpha, } from '@auth0/quantum-product';
32
32
  import { getColorScale, getStatusColorForGroup } from '../theme';
@@ -59,7 +59,8 @@ export function LineChart(props) {
59
59
  var _p = __read(React.useState(false), 2), isOpen = _p[0], setIsOpen = _p[1];
60
60
  React.useEffect(function () {
61
61
  setThreshold(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]);
62
- }, [thresholds]);
62
+ setLineVisibility(__assign(__assign({}, ((thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]) && { thresholdControl: false })), lineVisibility));
63
+ }, [thresholds, lineVisibility]);
63
64
  var handleLegendMouseEnter = function (e) {
64
65
  if (!lineVisibility[e.dataKey]) {
65
66
  setLineVisibility(__assign(__assign({}, lineVisibility), { hover: e.dataKey }));
@@ -73,7 +74,10 @@ export function LineChart(props) {
73
74
  };
74
75
  var selectLine = function (e) {
75
76
  var _a;
76
- setLineVisibility(__assign(__assign({}, lineVisibility), (_a = {}, _a[e.dataKey] = !lineVisibility[e.dataKey], _a.hover = null, _a)));
77
+ var checkedLines = Object.values(lineVisibility).filter(function (line) { return line === false; }).length;
78
+ if (checkedLines > 1 || lineVisibility[e.dataKey]) {
79
+ setLineVisibility(__assign(__assign({}, lineVisibility), (_a = {}, _a[e.dataKey] = !lineVisibility[e.dataKey], _a.hover = null, _a)));
80
+ }
77
81
  };
78
82
  var getThresholdData = function (threshold, entry) {
79
83
  var ewma = entry.ewma, stdDev = entry.stdDev;
@@ -142,7 +146,8 @@ export function LineChart(props) {
142
146
  }, [thresholds, menuProps]);
143
147
  var headerActionWithThresholdDropdown = (React.createElement(StackLayout, { gutter: 1 },
144
148
  !disableThresholdMenu && (React.createElement(React.Fragment, null,
145
- React.createElement(Button, __assign({}, triggerProps, { startIcon: React.createElement(AlertDiamondIcon, null), endIcon: React.createElement(ChevronDownIcon, null), disabled: !threshold, variant: 'outlined', size: headerButtonsSize, label: threshold ? threshold.threshold_label : 'No threshold' })),
149
+ React.createElement(Button, __assign({}, triggerProps, { startIcon: React.createElement(AlertDiamondIcon, null), endIcon: React.createElement(ChevronDownIcon, null), disabled: !threshold, variant: 'outlined', size: headerButtonsSize, label: threshold ? threshold.threshold_label : 'No threshold', analyticsId: threshold &&
150
+ "security-center-button-".concat(titleToAnalyticName(threshold.evaluated_metric).replace(/_/g, '-'), "-select-threshold") })),
146
151
  React.createElement(DropdownMenu, __assign({}, menuProps, { items: menuItems })),
147
152
  showDividerInHeader && React.createElement(Divider, { orientation: "vertical" }))),
148
153
  headerAction,
@@ -169,18 +174,18 @@ export function LineChart(props) {
169
174
  setResponsiveContainerHeight(getContainerHeight());
170
175
  setTimeout(function () {
171
176
  setResponsiveContainerWidth('100%');
172
- setVisibility(!!legendContainerHeight);
177
+ setVisibility(!!legendContainerHeight || data.length === 0); //force visibility true if there is no data
173
178
  }, 10);
174
179
  }
175
- }, [legendContainerHeight]);
180
+ }, [legendContainerHeight, data.length]);
176
181
  return (React.createElement(React.Fragment, null,
177
182
  React.createElement(ChartCard, { title: title, chartStatus: chartStatus, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, finalMenuItem: finalMenuItem, additionalMenuItems: additionalMenuItems, allowDownload: allowDownload, showChartTable: showChartTable, triggerButtonSize: headerButtonsSize, titleIcon: titleIcon, isVertical: isVertical },
178
183
  React.createElement(ResponsiveContainer, { width: responsiveContainerWidth, height: responsiveContainerHeight, style: {
179
184
  opacity: visibility ? 1 : 0,
180
185
  transition: 'opacity 0.3s ease-in-out',
181
186
  } }, data.length ? (React.createElement(ComposedChart, { data: Object.values(entries), height: height, width: 500, syncId: syncId, margin: {
182
- top: 24,
183
- right: 10,
187
+ top: 24, // custom active dot gets clipped on the edges otherwise
188
+ right: 10, // custom active dot gets clipped on the edges otherwise
184
189
  left: -24,
185
190
  bottom: 24,
186
191
  } },
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { DotProps } from 'recharts';
3
- declare const CustomActiveDot: (onMouseOver?: DotProps['onMouseOver']) => (props: Omit<DotProps, 'ref'>) => React.JSX.Element;
3
+ declare const CustomActiveDot: (onMouseOver?: DotProps["onMouseOver"]) => (props: Omit<DotProps, "ref">) => React.JSX.Element;
4
4
  export default CustomActiveDot;
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  Object.defineProperty(exports, "__esModule", { value: true });
37
47
  var React = __importStar(require("react"));
38
48
  var recharts_1 = require("recharts");
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  var quantum_product_1 = require("@auth0/quantum-product");
27
37
  var React = __importStar(require("react"));
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
26
  }) : function(o, v) {
27
27
  o["default"] = v;
28
28
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
36
46
  var __read = (this && this.__read) || function (o, n) {
37
47
  var m = typeof Symbol === "function" && o[Symbol.iterator];
38
48
  if (!m) return o;
@@ -53,9 +63,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
53
63
  return (mod && mod.__esModule) ? mod : { "default": mod };
54
64
  };
55
65
  Object.defineProperty(exports, "__esModule", { value: true });
56
- exports.LineChart = void 0;
57
- var lodash_1 = __importDefault(require("lodash"));
66
+ exports.LineChart = LineChart;
58
67
  var React = __importStar(require("react"));
68
+ var lodash_1 = __importDefault(require("lodash"));
59
69
  var recharts_1 = require("recharts");
60
70
  var quantum_product_1 = require("@auth0/quantum-product");
61
71
  var theme_1 = require("../theme");
@@ -88,7 +98,8 @@ function LineChart(props) {
88
98
  var _p = __read(React.useState(false), 2), isOpen = _p[0], setIsOpen = _p[1];
89
99
  React.useEffect(function () {
90
100
  setThreshold(thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]);
91
- }, [thresholds]);
101
+ setLineVisibility(__assign(__assign({}, ((thresholds === null || thresholds === void 0 ? void 0 : thresholds[0]) && { thresholdControl: false })), lineVisibility));
102
+ }, [thresholds, lineVisibility]);
92
103
  var handleLegendMouseEnter = function (e) {
93
104
  if (!lineVisibility[e.dataKey]) {
94
105
  setLineVisibility(__assign(__assign({}, lineVisibility), { hover: e.dataKey }));
@@ -102,7 +113,10 @@ function LineChart(props) {
102
113
  };
103
114
  var selectLine = function (e) {
104
115
  var _a;
105
- setLineVisibility(__assign(__assign({}, lineVisibility), (_a = {}, _a[e.dataKey] = !lineVisibility[e.dataKey], _a.hover = null, _a)));
116
+ var checkedLines = Object.values(lineVisibility).filter(function (line) { return line === false; }).length;
117
+ if (checkedLines > 1 || lineVisibility[e.dataKey]) {
118
+ setLineVisibility(__assign(__assign({}, lineVisibility), (_a = {}, _a[e.dataKey] = !lineVisibility[e.dataKey], _a.hover = null, _a)));
119
+ }
106
120
  };
107
121
  var getThresholdData = function (threshold, entry) {
108
122
  var ewma = entry.ewma, stdDev = entry.stdDev;
@@ -171,7 +185,8 @@ function LineChart(props) {
171
185
  }, [thresholds, menuProps]);
172
186
  var headerActionWithThresholdDropdown = (React.createElement(quantum_product_1.StackLayout, { gutter: 1 },
173
187
  !disableThresholdMenu && (React.createElement(React.Fragment, null,
174
- React.createElement(quantum_product_1.Button, __assign({}, triggerProps, { startIcon: React.createElement(quantum_product_1.AlertDiamondIcon, null), endIcon: React.createElement(quantum_product_1.ChevronDownIcon, null), disabled: !threshold, variant: 'outlined', size: headerButtonsSize, label: threshold ? threshold.threshold_label : 'No threshold' })),
188
+ React.createElement(quantum_product_1.Button, __assign({}, triggerProps, { startIcon: React.createElement(quantum_product_1.AlertDiamondIcon, null), endIcon: React.createElement(quantum_product_1.ChevronDownIcon, null), disabled: !threshold, variant: 'outlined', size: headerButtonsSize, label: threshold ? threshold.threshold_label : 'No threshold', analyticsId: threshold &&
189
+ "security-center-button-".concat(titleToAnalyticName(threshold.evaluated_metric).replace(/_/g, '-'), "-select-threshold") })),
175
190
  React.createElement(quantum_product_1.DropdownMenu, __assign({}, menuProps, { items: menuItems })),
176
191
  showDividerInHeader && React.createElement(quantum_product_1.Divider, { orientation: "vertical" }))),
177
192
  headerAction,
@@ -198,18 +213,18 @@ function LineChart(props) {
198
213
  setResponsiveContainerHeight(getContainerHeight());
199
214
  setTimeout(function () {
200
215
  setResponsiveContainerWidth('100%');
201
- setVisibility(!!legendContainerHeight);
216
+ setVisibility(!!legendContainerHeight || data.length === 0); //force visibility true if there is no data
202
217
  }, 10);
203
218
  }
204
- }, [legendContainerHeight]);
219
+ }, [legendContainerHeight, data.length]);
205
220
  return (React.createElement(React.Fragment, null,
206
221
  React.createElement(chart_card_1.ChartCard, { title: title, chartStatus: chartStatus, value: value, dataTable: data, label: label, helperText: helperText, headerAction: (groups === null || groups === void 0 ? void 0 : groups.length) > 1 ? headerActionWithThresholdDropdown : headerAction, finalMenuItem: finalMenuItem, additionalMenuItems: additionalMenuItems, allowDownload: allowDownload, showChartTable: showChartTable, triggerButtonSize: headerButtonsSize, titleIcon: titleIcon, isVertical: isVertical },
207
222
  React.createElement(recharts_1.ResponsiveContainer, { width: responsiveContainerWidth, height: responsiveContainerHeight, style: {
208
223
  opacity: visibility ? 1 : 0,
209
224
  transition: 'opacity 0.3s ease-in-out',
210
225
  } }, data.length ? (React.createElement(recharts_1.ComposedChart, { data: Object.values(entries), height: height, width: 500, syncId: syncId, margin: {
211
- top: 24,
212
- right: 10,
226
+ top: 24, // custom active dot gets clipped on the edges otherwise
227
+ right: 10, // custom active dot gets clipped on the edges otherwise
213
228
  left: -24,
214
229
  bottom: 24,
215
230
  } },
@@ -261,4 +276,3 @@ function LineChart(props) {
261
276
  React.createElement(quantum_product_1.Text, { variant: "subtitle1" }, "No data"))))),
262
277
  data && data[0] && React.createElement(data_table_chart_1.DataTableChart, { title: title, isOpen: isOpen, toggleIsOpen: toggleIsOpen, data: data })));
263
278
  }
264
- exports.LineChart = LineChart;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-charts",
3
- "version": "1.3.15",
3
+ "version": "1.3.17",
4
4
  "sideEffects": false,
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "build": "yarn clean && yarn build:cjs && yarn build:esm && yarn copy:files",
30
30
  "clean": "rm -rf ./build",
31
31
  "watch": "tsc --watch --project ./tsconfig.publish.esm.json & tsc --watch --project ./tsconfig.publish.json",
32
- "build:cjs": "node --max-old-space-size=4096 ../../node_modules/.bin/tsc --project ./tsconfig.publish.json",
33
- "build:esm": "node --max-old-space-size=4096 ../../node_modules/.bin/tsc --project ./tsconfig.publish.esm.json",
32
+ "build:cjs": "node --max-old-space-size=8192 ../../node_modules/.bin/tsc --project ./tsconfig.publish.json",
33
+ "build:esm": "node --max-old-space-size=8192 ../../node_modules/.bin/tsc --project ./tsconfig.publish.esm.json",
34
34
  "copy:files": "node scripts/copy-files.js",
35
35
  "artifactory": "cd ./build && npm publish",
36
36
  "storybook": "storybook dev -p 6006"
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ScoreCard = void 0;
36
+ exports.ScoreCard = ScoreCard;
27
37
  var React = __importStar(require("react"));
28
38
  var chart_summary_1 = require("../chart-summary");
29
39
  var chart_card_1 = require("../chart-card");
@@ -42,4 +52,3 @@ function ScoreCard(props) {
42
52
  React.createElement(chart_summary_1.ChartSummary, { title: summary.title, value: summary.value, helperText: summary.helperText, label: summary.label })));
43
53
  }))));
44
54
  }
45
- exports.ScoreCard = ScoreCard;