@auth0/quantum-charts 0.0.2
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/LICENSE +186 -0
- package/bar-chart/index.d.ts +7 -0
- package/bar-chart/index.js +115 -0
- package/chart-card/index.d.ts +6 -0
- package/chart-card/index.js +36 -0
- package/chart-summary/data-table-chart.d.ts +8 -0
- package/chart-summary/data-table-chart.js +84 -0
- package/chart-summary/index.d.ts +10 -0
- package/chart-summary/index.js +83 -0
- package/common/chart.d.ts +24 -0
- package/common/chart.js +2 -0
- package/compare-aggregate/compare-aggregate.d.ts +19 -0
- package/compare-aggregate/compare-aggregate.js +40 -0
- package/compare-aggregate/index.d.ts +2 -0
- package/compare-aggregate/index.js +5 -0
- package/custom-color-status-dot.d.ts +12 -0
- package/custom-color-status-dot.js +17 -0
- package/delta/delta.d.ts +18 -0
- package/delta/delta.js +99 -0
- package/delta/index.d.ts +2 -0
- package/delta/index.js +6 -0
- package/donut-chart/center.d.ts +8 -0
- package/donut-chart/center.js +61 -0
- package/donut-chart/decoupled-legend.d.ts +9 -0
- package/donut-chart/decoupled-legend.js +72 -0
- package/donut-chart/index.d.ts +12 -0
- package/donut-chart/index.js +82 -0
- package/esm/bar-chart/index.js +85 -0
- package/esm/chart-card/index.js +9 -0
- package/esm/chart-summary/data-table-chart.js +54 -0
- package/esm/chart-summary/index.js +56 -0
- package/esm/common/chart.js +1 -0
- package/esm/compare-aggregate/compare-aggregate.js +13 -0
- package/esm/compare-aggregate/index.js +1 -0
- package/esm/custom-color-status-dot.js +15 -0
- package/esm/delta/delta.js +71 -0
- package/esm/delta/index.js +1 -0
- package/esm/donut-chart/center.js +36 -0
- package/esm/donut-chart/decoupled-legend.js +44 -0
- package/esm/donut-chart/index.js +52 -0
- package/esm/helpers/dataSampleFactory.js +55 -0
- package/esm/helpers/format-number.js +30 -0
- package/esm/index.js +10 -0
- package/esm/line-chart/custom-active-dot.js +19 -0
- package/esm/line-chart/custom-tooltip.js +20 -0
- package/esm/line-chart/index.js +65 -0
- package/esm/scorecard/index.js +12 -0
- package/esm/styles.js +37 -0
- package/esm/theme.js +22 -0
- package/helpers/dataSampleFactory.d.ts +1 -0
- package/helpers/dataSampleFactory.js +59 -0
- package/helpers/format-number.d.ts +7 -0
- package/helpers/format-number.js +39 -0
- package/index.d.ts +10 -0
- package/index.js +26 -0
- package/line-chart/custom-active-dot.d.ts +4 -0
- package/line-chart/custom-active-dot.js +44 -0
- package/line-chart/custom-tooltip.d.ts +6 -0
- package/line-chart/custom-tooltip.js +48 -0
- package/line-chart/index.d.ts +6 -0
- package/line-chart/index.js +95 -0
- package/package.json +49 -0
- package/scorecard/index.d.ts +7 -0
- package/scorecard/index.js +39 -0
- package/styles.d.ts +8 -0
- package/styles.js +43 -0
- package/theme.d.ts +3 -0
- package/theme.js +27 -0
package/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bar-chart"), exports);
|
|
18
|
+
__exportStar(require("./chart-card"), exports);
|
|
19
|
+
__exportStar(require("./chart-summary"), exports);
|
|
20
|
+
__exportStar(require("./common/chart"), exports);
|
|
21
|
+
__exportStar(require("./compare-aggregate"), exports);
|
|
22
|
+
__exportStar(require("./donut-chart"), exports);
|
|
23
|
+
__exportStar(require("./helpers/format-number"), exports);
|
|
24
|
+
__exportStar(require("./line-chart"), exports);
|
|
25
|
+
__exportStar(require("./scorecard"), exports);
|
|
26
|
+
__exportStar(require("./delta"), exports);
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
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
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
var React = __importStar(require("react"));
|
|
38
|
+
var recharts_1 = require("recharts");
|
|
39
|
+
var CustomActiveDot = function (onMouseOver) { return function (props) {
|
|
40
|
+
return (React.createElement(React.Fragment, null,
|
|
41
|
+
React.createElement(recharts_1.Dot, __assign({}, props, { key: "outerDot", r: 10, strokeWidth: 0 }, (onMouseOver ? { onMouseOver: onMouseOver } : {}))),
|
|
42
|
+
React.createElement(recharts_1.Dot, __assign({}, props, { key: "innerDot", r: 4, style: { fill: 'white' } }, (onMouseOver ? { onMouseOver: onMouseOver } : {})))));
|
|
43
|
+
}; };
|
|
44
|
+
exports.default = CustomActiveDot;
|
|
@@ -0,0 +1,48 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IBaseChartProps } from '../common/chart';
|
|
3
|
+
export interface ILineChartProps<DataType = unknown> extends IBaseChartProps<DataType> {
|
|
4
|
+
syncId?: number | string;
|
|
5
|
+
}
|
|
6
|
+
export declare function LineChart<DataType = unknown>(props: ILineChartProps<DataType>): JSX.Element;
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
exports.LineChart = void 0;
|
|
30
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
var React = __importStar(require("react"));
|
|
32
|
+
var recharts_1 = require("recharts");
|
|
33
|
+
var date_fns_1 = require("date-fns");
|
|
34
|
+
var quantum_product_1 = require("@auth0/quantum-product");
|
|
35
|
+
var theme_1 = require("../theme");
|
|
36
|
+
var custom_active_dot_1 = __importDefault(require("./custom-active-dot"));
|
|
37
|
+
var custom_tooltip_1 = __importDefault(require("./custom-tooltip"));
|
|
38
|
+
var chart_card_1 = require("../chart-card");
|
|
39
|
+
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;
|
|
41
|
+
var theme = (0, quantum_product_1.useTheme)();
|
|
42
|
+
// Function to know how many lines we need based of how much different group values are.
|
|
43
|
+
var groups = lodash_1.default.uniqBy(data, 'group').map(function (item) { return item.group; });
|
|
44
|
+
var bottomAxisDataKey = bottomAxis.mapsTo || 'date';
|
|
45
|
+
var leftAxisDataKey = leftAxis.mapsTo || 'value';
|
|
46
|
+
var entries = {};
|
|
47
|
+
data.forEach(function (entry) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
var entrytKey = entry[bottomAxisDataKey];
|
|
50
|
+
if (entries[entrytKey]) {
|
|
51
|
+
entries[entrytKey][entry.group] = entry[leftAxisDataKey];
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
entries[entrytKey] = (_a = {},
|
|
55
|
+
_a[bottomAxisDataKey] = entry[bottomAxisDataKey],
|
|
56
|
+
_a[entry.group] = entry[leftAxisDataKey],
|
|
57
|
+
_a);
|
|
58
|
+
}
|
|
59
|
+
return _b = {},
|
|
60
|
+
_b[bottomAxisDataKey] = entry[bottomAxisDataKey],
|
|
61
|
+
_b[entry.group] = entry[leftAxisDataKey],
|
|
62
|
+
_b;
|
|
63
|
+
});
|
|
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
|
+
return (React.createElement(chart_card_1.ChartCard, { title: title, value: value, dataTable: data, label: label, helperText: helperText },
|
|
74
|
+
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
|
+
top: 24,
|
|
76
|
+
right: 10,
|
|
77
|
+
left: -24,
|
|
78
|
+
bottom: 0,
|
|
79
|
+
} },
|
|
80
|
+
React.createElement(recharts_1.XAxis, { tickFormatter: formatBottomTick, dataKey: bottomAxisDataKey, height: 30, interval: "preserveStartEnd" }),
|
|
81
|
+
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 } }),
|
|
85
|
+
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)() }));
|
|
87
|
+
}))) : (React.createElement("div", { style: {
|
|
88
|
+
display: 'grid',
|
|
89
|
+
placeItems: 'center',
|
|
90
|
+
height: '100%',
|
|
91
|
+
textAlign: 'center',
|
|
92
|
+
} },
|
|
93
|
+
React.createElement(quantum_product_1.Text, { variant: "subtitle1" }, "No data"))))));
|
|
94
|
+
}
|
|
95
|
+
exports.LineChart = LineChart;
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@auth0/quantum-charts",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"author": "Okta, Inc.",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/auth0/quantum-product.git",
|
|
12
|
+
"directory": "packages/quantum-charts"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@auth0/quantum-product": "^1.5.1",
|
|
19
|
+
"@formatjs/intl": "^2.5.1",
|
|
20
|
+
"date-fns": "^2.29.3",
|
|
21
|
+
"recharts": "^2.0.7"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "*",
|
|
25
|
+
"react-dom": "*"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "yarn clean && yarn build:cjs && yarn build:esm && yarn copy:files",
|
|
29
|
+
"clean": "rm -rf ./build",
|
|
30
|
+
"watch": "tsc --watch --project ./tsconfig.publish.esm.json & tsc --watch --project ./tsconfig.publish.json",
|
|
31
|
+
"build:cjs": "tsc --project ./tsconfig.publish.json",
|
|
32
|
+
"build:esm": "tsc --project ./tsconfig.publish.esm.json",
|
|
33
|
+
"copy:files": "node scripts/copy-files.js",
|
|
34
|
+
"artifactory": "cd ./build && npm publish --access public",
|
|
35
|
+
"storybook": "start-storybook -p 6006"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babel/core": "^7.14.6",
|
|
39
|
+
"@storybook/addon-actions": "6.5.10",
|
|
40
|
+
"@storybook/addon-essentials": "6.5.10",
|
|
41
|
+
"@storybook/addon-links": "6.5.10",
|
|
42
|
+
"@storybook/react": "6.5.10",
|
|
43
|
+
"@storybook/theming": "6.5.10",
|
|
44
|
+
"@types/md5": "^2.3.2",
|
|
45
|
+
"@types/node": "12.12.47",
|
|
46
|
+
"babel-loader": "^8.2.2"
|
|
47
|
+
},
|
|
48
|
+
"module": "./esm/index.js"
|
|
49
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ScoreCard = void 0;
|
|
27
|
+
var React = __importStar(require("react"));
|
|
28
|
+
var chart_summary_1 = require("../chart-summary");
|
|
29
|
+
var chart_card_1 = require("../chart-card");
|
|
30
|
+
var quantum_product_1 = require("@auth0/quantum-product");
|
|
31
|
+
function ScoreCard(props) {
|
|
32
|
+
var data = props.data;
|
|
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 },
|
|
36
|
+
React.createElement(chart_summary_1.ChartSummary, { title: summary.title, value: summary.value, helperText: summary.helperText, label: summary.label })));
|
|
37
|
+
}))));
|
|
38
|
+
}
|
|
39
|
+
exports.ScoreCard = ScoreCard;
|
package/styles.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type IChartContainerProps = {
|
|
2
|
+
height?: number | 'initial';
|
|
3
|
+
marginTop?: number;
|
|
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>;
|
package/styles.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
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"));
|
|
12
|
+
var quantum_product_1 = require("@auth0/quantum-product");
|
|
13
|
+
exports.ChartContainer = styled_components_1.default.div(function (_a) {
|
|
14
|
+
var theme = _a.theme, height = _a.height, marginTop = _a.marginTop;
|
|
15
|
+
var props = {
|
|
16
|
+
marginTop: theme.spacing(3),
|
|
17
|
+
height: 'initial',
|
|
18
|
+
};
|
|
19
|
+
if (height !== 'initial') {
|
|
20
|
+
props.height = "".concat(height !== null && height !== void 0 ? height : 220, "px");
|
|
21
|
+
}
|
|
22
|
+
if (marginTop !== undefined) {
|
|
23
|
+
props.marginTop = "".concat(marginTop, "px");
|
|
24
|
+
}
|
|
25
|
+
return props;
|
|
26
|
+
});
|
|
27
|
+
exports.CustomTooltip = styled_components_1.default.div(function (_a) {
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return ({
|
|
30
|
+
backgroundColor: theme.tokens.color_bg_layer_boldest,
|
|
31
|
+
borderRadius: theme.shape.borderRadius,
|
|
32
|
+
padding: theme.spacing(1, 3),
|
|
33
|
+
color: theme.tokens.color_fg_inverse,
|
|
34
|
+
fontSize: theme.typography.caption.fontSize,
|
|
35
|
+
fontWeight: theme.typography.caption.fontWeight,
|
|
36
|
+
lineHeight: theme.typography.caption.lineHeight,
|
|
37
|
+
letterSpacing: theme.typography.caption.letterSpacing,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
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;
|
package/theme.d.ts
ADDED
package/theme.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
];
|
|
14
|
+
};
|
|
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;
|