@auth0/quantum-charts 0.0.4 → 0.1.1

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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/bar-chart/index.js +46 -25
  3. package/chart-card/index.d.ts +1 -0
  4. package/chart-card/index.js +2 -2
  5. package/chart-summary/data-table-chart.d.ts +2 -2
  6. package/chart-summary/data-table-chart.js +46 -4
  7. package/chart-summary/index.d.ts +1 -1
  8. package/common/chart.d.ts +6 -0
  9. package/common/chart.js +30 -0
  10. package/common/custom-legend.d.ts +2 -0
  11. package/common/custom-legend.js +69 -0
  12. package/common/custom-tooltip.d.ts +4 -0
  13. package/common/custom-tooltip.js +54 -0
  14. package/donut-chart/decoupled-legend.d.ts +2 -0
  15. package/donut-chart/decoupled-legend.js +44 -21
  16. package/donut-chart/index.d.ts +3 -0
  17. package/donut-chart/index.js +27 -11
  18. package/esm/bar-chart/index.js +47 -26
  19. package/esm/chart-card/index.js +2 -2
  20. package/esm/chart-summary/data-table-chart.js +47 -5
  21. package/esm/common/chart.js +28 -1
  22. package/esm/common/custom-legend.js +42 -0
  23. package/esm/common/custom-tooltip.js +26 -0
  24. package/esm/donut-chart/decoupled-legend.js +46 -20
  25. package/esm/donut-chart/index.js +29 -13
  26. package/esm/line-chart/index.js +56 -18
  27. package/esm/scorecard/index.js +9 -3
  28. package/esm/styles.js +11 -11
  29. package/esm/theme.js +37 -21
  30. package/line-chart/index.js +55 -17
  31. package/package.json +14 -12
  32. package/scorecard/index.js +8 -2
  33. package/styles.d.ts +3 -4
  34. package/styles.js +11 -14
  35. package/theme.d.ts +10 -2
  36. package/theme.js +39 -24
  37. package/esm/line-chart/custom-tooltip.js +0 -20
  38. package/line-chart/custom-tooltip.d.ts +0 -6
  39. package/line-chart/custom-tooltip.js +0 -48
  40. /package/{custom-color-status-dot.d.ts → common/custom-color-status-dot.d.ts} +0 -0
  41. /package/{custom-color-status-dot.js → common/custom-color-status-dot.js} +0 -0
  42. /package/esm/{custom-color-status-dot.js → common/custom-color-status-dot.js} +0 -0
package/esm/theme.js CHANGED
@@ -1,22 +1,38 @@
1
- export var getBaseColorScale = function (_a) {
2
- var palette = _a.palette;
3
- return [
4
- palette.purple[500],
5
- palette.magenta[500],
6
- palette.green[500],
7
- palette.yellow[500],
8
- palette.red[500],
9
- palette.neutral[500],
10
- ];
11
- };
12
- export var getBaseColorScaleMuted = function (_a) {
13
- var palette = _a.palette;
14
- return [
15
- palette.purple[300],
16
- palette.yellow[300],
17
- palette.green[300],
18
- palette.red[300],
19
- palette.neutral[300],
20
- palette.magenta[300],
21
- ];
1
+ import { alpha } from '@auth0/quantum-product';
2
+ export var getColorScale = function (_a) {
3
+ var tokens = _a.tokens;
4
+ return {
5
+ categorical: {
6
+ base: [
7
+ tokens.color_chart_categorical_1,
8
+ tokens.color_chart_categorical_2,
9
+ tokens.color_chart_categorical_3,
10
+ tokens.color_chart_categorical_4,
11
+ tokens.color_chart_categorical_5,
12
+ tokens.color_chart_categorical_6,
13
+ ],
14
+ muted: [
15
+ alpha(tokens.color_chart_categorical_1, 0.35),
16
+ alpha(tokens.color_chart_categorical_2, 0.35),
17
+ alpha(tokens.color_chart_categorical_3, 0.35),
18
+ alpha(tokens.color_chart_categorical_4, 0.35),
19
+ alpha(tokens.color_chart_categorical_5, 0.35),
20
+ alpha(tokens.color_chart_categorical_6, 0.35),
21
+ ],
22
+ },
23
+ sequential: {
24
+ base: [
25
+ tokens.color_chart_sequential_1,
26
+ tokens.color_chart_sequential_2,
27
+ tokens.color_chart_sequential_3,
28
+ tokens.color_chart_sequential_4,
29
+ ],
30
+ muted: [
31
+ alpha(tokens.color_chart_sequential_1, 0.35),
32
+ alpha(tokens.color_chart_sequential_2, 0.35),
33
+ alpha(tokens.color_chart_sequential_3, 0.35),
34
+ alpha(tokens.color_chart_sequential_4, 0.35),
35
+ ],
36
+ },
37
+ };
22
38
  };
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,6 +33,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
33
  __setModuleDefault(result, mod);
23
34
  return result;
24
35
  };
36
+ var __read = (this && this.__read) || function (o, n) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38
+ if (!m) return o;
39
+ var i = m.call(o), r, ar = [], e;
40
+ try {
41
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42
+ }
43
+ catch (error) { e = { error: error }; }
44
+ finally {
45
+ try {
46
+ if (r && !r.done && (m = i["return"])) m.call(i);
47
+ }
48
+ finally { if (e) throw e.error; }
49
+ }
50
+ return ar;
51
+ };
25
52
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
53
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
54
  };
@@ -30,17 +57,35 @@ exports.LineChart = void 0;
30
57
  var lodash_1 = __importDefault(require("lodash"));
31
58
  var React = __importStar(require("react"));
32
59
  var recharts_1 = require("recharts");
33
- var date_fns_1 = require("date-fns");
34
60
  var quantum_product_1 = require("@auth0/quantum-product");
35
61
  var theme_1 = require("../theme");
36
62
  var custom_active_dot_1 = __importDefault(require("./custom-active-dot"));
37
- var custom_tooltip_1 = __importDefault(require("./custom-tooltip"));
63
+ var custom_tooltip_1 = __importDefault(require("../common/custom-tooltip"));
38
64
  var chart_card_1 = require("../chart-card");
65
+ var chart_1 = require("../common/chart");
66
+ var custom_legend_1 = require("../common/custom-legend");
39
67
  function LineChart(props) {
40
- 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;
68
+ 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;
41
69
  var theme = (0, quantum_product_1.useTheme)();
42
70
  // Function to know how many lines we need based of how much different group values are.
43
71
  var groups = lodash_1.default.uniqBy(data, 'group').map(function (item) { return item.group; });
72
+ var initialState = __assign({ hover: null }, groups.reduce(function (acc, group) {
73
+ var _a;
74
+ return (__assign(__assign({}, acc), (_a = {}, _a[group] = false, _a)));
75
+ }, {}));
76
+ var _e = __read(React.useState(initialState), 2), lineVisibility = _e[0], setLineVisibility = _e[1];
77
+ var handleLegendMouseEnter = function (e) {
78
+ if (!lineVisibility[e.dataKey]) {
79
+ setLineVisibility(__assign(__assign({}, lineVisibility), { hover: e.dataKey }));
80
+ }
81
+ };
82
+ var handleLegendMouseLeave = function () {
83
+ setLineVisibility(__assign(__assign({}, lineVisibility), { hover: null }));
84
+ };
85
+ var selectLine = function (e) {
86
+ var _a;
87
+ setLineVisibility(__assign(__assign({}, lineVisibility), (_a = {}, _a[e.dataKey] = !lineVisibility[e.dataKey], _a.hover = null, _a)));
88
+ };
44
89
  var bottomAxisDataKey = bottomAxis.mapsTo || 'date';
45
90
  var leftAxisDataKey = leftAxis.mapsTo || 'value';
46
91
  var entries = {};
@@ -61,15 +106,6 @@ function LineChart(props) {
61
106
  _b[entry.group] = entry[leftAxisDataKey],
62
107
  _b;
63
108
  });
64
- var formatBottomTick = function (value) {
65
- if (bottomAxis.scaleType === 'date') {
66
- return (0, date_fns_1.format)(new Date(value), 'LLL d');
67
- }
68
- if (bottomAxis.scaleType === 'datetime') {
69
- return (0, date_fns_1.format)(new Date(value), 'LLL d p');
70
- }
71
- return value;
72
- };
73
109
  return (React.createElement(chart_card_1.ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText },
74
110
  React.createElement(recharts_1.ResponsiveContainer, { width: '100%', height: height }, data.length ? (React.createElement(recharts_1.LineChart, { data: Object.values(entries), height: height, width: 500, syncId: syncId, margin: {
75
111
  top: 24,
@@ -77,13 +113,15 @@ function LineChart(props) {
77
113
  left: -24,
78
114
  bottom: 0,
79
115
  } },
80
- React.createElement(recharts_1.XAxis, { tickFormatter: formatBottomTick, dataKey: bottomAxisDataKey, height: 30, interval: "preserveStartEnd" }),
81
116
  React.createElement(recharts_1.CartesianGrid, { vertical: false, stroke: theme.tokens.color_border_default }),
82
- React.createElement(recharts_1.YAxis, { domain: ['auto', 'auto'] }),
83
- React.createElement(recharts_1.Tooltip, { content: React.createElement(custom_tooltip_1.default, { active: undefined, payload: undefined }) }),
84
- legend && React.createElement(recharts_1.Legend, { align: "center", iconType: "square", iconSize: 14, wrapperStyle: { paddingTop: 16 } }),
117
+ React.createElement(recharts_1.XAxis, { tickFormatter: function (value) { return (0, chart_1.tickFormatter)(value, bottomAxis.scaleType); }, dataKey: bottomAxisDataKey, height: 30, interval: "preserveStartEnd", minTickGap: theme.spacingPX(14), tickMargin: theme.spacingPX(3), axisLine: { stroke: theme.tokens.color_border_bold }, tickLine: { stroke: theme.tokens.color_border_bold } }),
118
+ React.createElement(recharts_1.YAxis, { tickFormatter: function (value) { return (0, chart_1.tickFormatter)(value, leftAxis.scaleType); }, domain: ['auto', 'auto'], width: 78, axisLine: { stroke: theme.tokens.color_border_bold }, tickLine: { stroke: theme.tokens.color_border_bold } }),
119
+ React.createElement(recharts_1.Tooltip, { wrapperStyle: { outline: 'none' }, content: React.createElement(custom_tooltip_1.default, { active: undefined, payload: undefined, scaleType: bottomAxis.scaleType }) }),
120
+ legend && (React.createElement(recharts_1.Legend, { align: "center", iconSize: 14, wrapperStyle: { paddingTop: 16 }, content: React.createElement(custom_legend_1.CustomLegend, { selectData: selectLine, handleLegendMouseEnter: handleLegendMouseEnter, handleLegendMouseLeave: handleLegendMouseLeave, dataVisibility: lineVisibility }) })),
85
121
  groups.map(function (group, index) {
86
- return (React.createElement(recharts_1.Line, { key: group, dataKey: group, name: group, strokeWidth: 3, stroke: (0, theme_1.getBaseColorScale)(theme)[index], dot: false, activeDot: (0, custom_active_dot_1.default)() }));
122
+ return (React.createElement(recharts_1.Line, { key: group, dataKey: group, name: group, strokeWidth: 3, hide: lineVisibility[group] === true, stroke: lineVisibility.hover === group || !lineVisibility.hover
123
+ ? (0, theme_1.getColorScale)(theme)[color]['base'][index]
124
+ : (0, theme_1.getColorScale)(theme)[color]['muted'][index], dot: false, activeDot: (0, custom_active_dot_1.default)() }));
87
125
  }))) : (React.createElement("div", { style: {
88
126
  display: 'grid',
89
127
  placeItems: 'center',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-charts",
3
- "version": "0.0.4",
3
+ "version": "0.1.1",
4
4
  "sideEffects": false,
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -29,22 +29,24 @@
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": "tsc --project ./tsconfig.publish.json",
33
- "build:esm": "tsc --project ./tsconfig.publish.esm.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",
34
34
  "copy:files": "node scripts/copy-files.js",
35
35
  "artifactory": "cd ./build && npm publish",
36
- "storybook": "start-storybook -p 6006"
36
+ "storybook": "storybook dev -p 6006"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "^7.14.6",
40
- "@storybook/addon-actions": "6.5.10",
41
- "@storybook/addon-essentials": "6.5.10",
42
- "@storybook/addon-links": "6.5.10",
43
- "@storybook/react": "6.5.10",
44
- "@storybook/theming": "6.5.10",
39
+ "@babel/core": "^7.22.10",
40
+ "@storybook/addon-actions": "^7.3.2",
41
+ "@storybook/addon-essentials": "^7.3.2",
42
+ "@storybook/addon-links": "^7.3.2",
43
+ "@storybook/react": "^7.3.2",
44
+ "@storybook/react-webpack5": "7.3.2",
45
+ "@storybook/theming": "^7.3.2",
45
46
  "@types/md5": "^2.3.2",
46
- "@types/node": "12.12.47",
47
- "babel-loader": "^8.2.2"
47
+ "@types/node": "^18.16.19",
48
+ "babel-loader": "^9.1.3",
49
+ "storybook": "7.3.2"
48
50
  },
49
51
  "module": "./esm/index.js"
50
52
  }
@@ -31,8 +31,14 @@ var quantum_product_1 = require("@auth0/quantum-product");
31
31
  function ScoreCard(props) {
32
32
  var data = props.data;
33
33
  return (React.createElement(chart_card_1.ChartCard, null,
34
- React.createElement(quantum_product_1.GalleryLayout, null, data.map(function (summary, index) {
35
- return (React.createElement(quantum_product_1.GalleryLayoutItem, { key: index },
34
+ React.createElement(quantum_product_1.StackLayout, { sx: {
35
+ justifyContent: 'space-between',
36
+ alignContent: ['initial', 'center'],
37
+ alignItems: ['initial', 'center'],
38
+ flexWrap: 'wrap',
39
+ flexDirection: ['column', 'row'],
40
+ } }, data.map(function (summary, index) {
41
+ return (React.createElement(quantum_product_1.StackLayoutItem, { key: index, sx: { flex: 1, mr: 2 } },
36
42
  React.createElement(chart_summary_1.ChartSummary, { title: summary.title, value: summary.value, helperText: summary.helperText, label: summary.label })));
37
43
  }))));
38
44
  }
package/styles.d.ts CHANGED
@@ -2,7 +2,6 @@ export declare type IChartContainerProps = {
2
2
  height?: number | 'initial';
3
3
  marginTop?: number;
4
4
  };
5
- export declare const ChartContainer: import("styled-components").StyledComponent<"div", any, IChartContainerProps, never>;
6
- export declare const CustomTooltip: import("styled-components").StyledComponent<"div", any, {}, never>;
7
- export declare const CustomTooltipLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
8
- export declare const DefaultCursorBox: import("styled-components").StyledComponent<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").BoxTypeMap<{}, "div">>, any, {}, never>;
5
+ export declare const ChartContainer: import("styled-components").StyledComponent<"div", import("@auth0/quantum-product").ITheme, import("@mui/system").MUIStyledCommonProps<import("@auth0/quantum-product").ITheme> & IChartContainerProps, never>;
6
+ export declare const CustomTooltip: import("styled-components").StyledComponent<"div", import("@auth0/quantum-product").ITheme, import("@mui/system").MUIStyledCommonProps<import("@auth0/quantum-product").ITheme>, never>;
7
+ export declare const DefaultCursorBox: import("styled-components").StyledComponent<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").BoxTypeMap<{}, "div">>, import("@auth0/quantum-product").ITheme, import("@mui/system").MUIStyledCommonProps<import("@auth0/quantum-product").ITheme>, never>;
package/styles.js CHANGED
@@ -3,14 +3,10 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
4
  return cooked;
5
5
  };
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.DefaultCursorBox = exports.CustomTooltipLabel = exports.CustomTooltip = exports.ChartContainer = void 0;
11
- var styled_components_1 = __importDefault(require("styled-components"));
7
+ exports.DefaultCursorBox = exports.CustomTooltip = exports.ChartContainer = void 0;
12
8
  var quantum_product_1 = require("@auth0/quantum-product");
13
- exports.ChartContainer = styled_components_1.default.div(function (_a) {
9
+ exports.ChartContainer = (0, quantum_product_1.styled)('div')(function (_a) {
14
10
  var theme = _a.theme, height = _a.height, marginTop = _a.marginTop;
15
11
  var props = {
16
12
  marginTop: theme.spacing(3),
@@ -24,20 +20,21 @@ exports.ChartContainer = styled_components_1.default.div(function (_a) {
24
20
  }
25
21
  return props;
26
22
  });
27
- exports.CustomTooltip = styled_components_1.default.div(function (_a) {
23
+ exports.CustomTooltip = (0, quantum_product_1.styled)('div')(function (_a) {
28
24
  var theme = _a.theme;
29
25
  return ({
30
- backgroundColor: theme.tokens.color_bg_layer_boldest,
26
+ display: 'grid',
27
+ gap: theme.spacing(1),
28
+ backgroundColor: theme.tokens.color_bg_layer_elevated,
29
+ border: "1px solid ".concat(theme.tokens.color_border_bold),
31
30
  borderRadius: theme.shape.borderRadius,
32
- padding: theme.spacing(1, 3),
33
- color: theme.tokens.color_fg_inverse,
31
+ padding: theme.spacing(1, 2),
32
+ color: theme.tokens.color_fg_bold,
34
33
  fontSize: theme.typography.caption.fontSize,
35
34
  fontWeight: theme.typography.caption.fontWeight,
36
35
  lineHeight: theme.typography.caption.lineHeight,
37
36
  letterSpacing: theme.typography.caption.letterSpacing,
38
37
  });
39
38
  });
40
- // `textSecondary` doesn't have enough contrast for the black background of the tooltip
41
- exports.CustomTooltipLabel = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: lightgrey;\n"], ["\n color: lightgrey;\n"])));
42
- exports.DefaultCursorBox = (0, styled_components_1.default)(quantum_product_1.Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n cursor: default;\n"], ["\n cursor: default;\n"])));
43
- var templateObject_1, templateObject_2;
39
+ exports.DefaultCursorBox = (0, quantum_product_1.styled)(quantum_product_1.Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: default;\n"], ["\n cursor: default;\n"])));
40
+ var templateObject_1;
package/theme.d.ts CHANGED
@@ -1,3 +1,11 @@
1
1
  import { ITheme } from '@auth0/quantum-product';
2
- export declare const getBaseColorScale: ({ palette }: ITheme) => string[];
3
- export declare const getBaseColorScaleMuted: ({ palette }: ITheme) => string[];
2
+ export declare const getColorScale: ({ tokens }: ITheme) => {
3
+ categorical: {
4
+ base: string[];
5
+ muted: string[];
6
+ };
7
+ sequential: {
8
+ base: string[];
9
+ muted: string[];
10
+ };
11
+ };
package/theme.js CHANGED
@@ -1,27 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBaseColorScaleMuted = exports.getBaseColorScale = void 0;
4
- var getBaseColorScale = function (_a) {
5
- var palette = _a.palette;
6
- return [
7
- palette.purple[500],
8
- palette.magenta[500],
9
- palette.green[500],
10
- palette.yellow[500],
11
- palette.red[500],
12
- palette.neutral[500],
13
- ];
3
+ exports.getColorScale = void 0;
4
+ var quantum_product_1 = require("@auth0/quantum-product");
5
+ var getColorScale = function (_a) {
6
+ var tokens = _a.tokens;
7
+ return {
8
+ categorical: {
9
+ base: [
10
+ tokens.color_chart_categorical_1,
11
+ tokens.color_chart_categorical_2,
12
+ tokens.color_chart_categorical_3,
13
+ tokens.color_chart_categorical_4,
14
+ tokens.color_chart_categorical_5,
15
+ tokens.color_chart_categorical_6,
16
+ ],
17
+ muted: [
18
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_1, 0.35),
19
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_2, 0.35),
20
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_3, 0.35),
21
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_4, 0.35),
22
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_5, 0.35),
23
+ (0, quantum_product_1.alpha)(tokens.color_chart_categorical_6, 0.35),
24
+ ],
25
+ },
26
+ sequential: {
27
+ base: [
28
+ tokens.color_chart_sequential_1,
29
+ tokens.color_chart_sequential_2,
30
+ tokens.color_chart_sequential_3,
31
+ tokens.color_chart_sequential_4,
32
+ ],
33
+ muted: [
34
+ (0, quantum_product_1.alpha)(tokens.color_chart_sequential_1, 0.35),
35
+ (0, quantum_product_1.alpha)(tokens.color_chart_sequential_2, 0.35),
36
+ (0, quantum_product_1.alpha)(tokens.color_chart_sequential_3, 0.35),
37
+ (0, quantum_product_1.alpha)(tokens.color_chart_sequential_4, 0.35),
38
+ ],
39
+ },
40
+ };
14
41
  };
15
- exports.getBaseColorScale = getBaseColorScale;
16
- var getBaseColorScaleMuted = function (_a) {
17
- var palette = _a.palette;
18
- return [
19
- palette.purple[300],
20
- palette.yellow[300],
21
- palette.green[300],
22
- palette.red[300],
23
- palette.neutral[300],
24
- palette.magenta[300],
25
- ];
26
- };
27
- exports.getBaseColorScaleMuted = getBaseColorScaleMuted;
42
+ exports.getColorScale = getColorScale;
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- import { Box, RowLayout } from '@auth0/quantum-product';
3
- import StatusDot from '../custom-color-status-dot';
4
- import { format } from 'date-fns';
5
- import { CustomTooltip as CustomTooltipStyled, CustomTooltipLabel } from '../styles';
6
- // -------------------------------- Component --------------------------------
7
- var CustomTooltip = function (_a) {
8
- var _b;
9
- var active = _a.active, payload = _a.payload;
10
- if (!active || !payload.length) {
11
- return null;
12
- }
13
- return (React.createElement(CustomTooltipStyled, null,
14
- React.createElement(CustomTooltipLabel, null, "".concat(format(new Date(payload && ((_b = payload[0].payload) === null || _b === void 0 ? void 0 : _b.date)), 'LLL d p'))),
15
- React.createElement(Box, null,
16
- React.createElement(RowLayout, { gutter: 1 }, payload.map(function (x, index) {
17
- return React.createElement(StatusDot, { key: index, dotColor: 'grey', label: "".concat(x.name, ": ").concat(x.payload[x.name]) });
18
- })))));
19
- };
20
- export default CustomTooltip;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare const CustomTooltip: ({ active, payload }: {
3
- active: any;
4
- payload: any;
5
- }) => JSX.Element | null;
6
- export default CustomTooltip;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
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
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- var React = __importStar(require("react"));
30
- var quantum_product_1 = require("@auth0/quantum-product");
31
- var custom_color_status_dot_1 = __importDefault(require("../custom-color-status-dot"));
32
- var date_fns_1 = require("date-fns");
33
- var styles_1 = require("../styles");
34
- // -------------------------------- Component --------------------------------
35
- var CustomTooltip = function (_a) {
36
- var _b;
37
- var active = _a.active, payload = _a.payload;
38
- if (!active || !payload.length) {
39
- return null;
40
- }
41
- return (React.createElement(styles_1.CustomTooltip, null,
42
- React.createElement(styles_1.CustomTooltipLabel, null, "".concat((0, date_fns_1.format)(new Date(payload && ((_b = payload[0].payload) === null || _b === void 0 ? void 0 : _b.date)), 'LLL d p'))),
43
- React.createElement(quantum_product_1.Box, null,
44
- React.createElement(quantum_product_1.RowLayout, { gutter: 1 }, payload.map(function (x, index) {
45
- return React.createElement(custom_color_status_dot_1.default, { key: index, dotColor: 'grey', label: "".concat(x.name, ": ").concat(x.payload[x.name]) });
46
- })))));
47
- };
48
- exports.default = CustomTooltip;