@auth0/quantum-charts 0.1.1 → 0.1.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.
@@ -120,7 +120,7 @@ function BarChart(props) {
120
120
  dataKey: bottomAxisDataKey,
121
121
  }), { domain: ['auto', 'auto'], axisLine: { stroke: theme.tokens.color_border_bold }, tickLine: { stroke: theme.tokens.color_border_bold } })),
122
122
  React.createElement(recharts_1.Tooltip, { wrapperStyle: { outline: 'none' }, content: React.createElement(custom_tooltip_1.default, { active: undefined, payload: undefined, scaleType: bottomAxis.scaleType }) }),
123
- React.createElement(recharts_1.Legend, { align: "center", iconType: "square", iconSize: 14, wrapperStyle: { paddingTop: 16 }, content: React.createElement(custom_legend_1.CustomLegend, { selectData: selectBar, handleLegendMouseEnter: handleLegendMouseEnter, handleLegendMouseLeave: handleLegendMouseLeave, dataVisibility: barVisibility }) }),
123
+ React.createElement(recharts_1.Legend, { align: "center", content: React.createElement(custom_legend_1.CustomLegend, { selectData: selectBar, handleLegendMouseEnter: handleLegendMouseEnter, handleLegendMouseLeave: handleLegendMouseLeave, dataVisibility: barVisibility }) }),
124
124
  groups.map(function (group, index) {
125
125
  return (React.createElement(recharts_1.Bar, __assign({ key: group, dataKey: group }, (isStacked && { stackId: 'stack' }), { name: group, maxBarSize: 70, hide: barVisibility[group] === true, fill: barVisibility.hover === group || !barVisibility.hover
126
126
  ? (0, theme_1.getColorScale)(theme)[color]['base'][index]
@@ -29,7 +29,7 @@ var React = __importStar(require("react"));
29
29
  var chart_summary_1 = require("../chart-summary");
30
30
  function ChartCard(props) {
31
31
  var children = props.children, title = props.title, value = props.value, dataTable = props.dataTable, helperText = props.helperText, label = props.label, height = props.height;
32
- return (React.createElement(quantum_product_1.Card, { sx: { height: height } },
32
+ return (React.createElement(quantum_product_1.Card, { sx: { height: height, padding: 3 } },
33
33
  React.createElement(chart_summary_1.ChartSummary, { title: title, value: value, dataTable: dataTable, helperText: helperText, label: label }),
34
34
  children));
35
35
  }
@@ -93,13 +93,13 @@ function DataTableChart(props) {
93
93
  };
94
94
  return (React.createElement(quantum_product_1.Dialog, { open: isOpen, fullWidth: true, title: title, onClose: toggleIsOpen, actions: React.createElement(React.Fragment, null,
95
95
  React.createElement(quantum_product_1.Button, { color: "primary", variant: "contained", startIcon: React.createElement(quantum_product_1.DownloadIcon, null), onClick: function () { return downloadCSV(title); } }, "Download")) },
96
- React.createElement(quantum_product_1.Box, { p: 2 },
96
+ React.createElement(quantum_product_1.Box, null,
97
97
  React.createElement(quantum_product_1.Tabs, { baseId: 'example', onChange: setSelectedTab, value: selectedTab },
98
- React.createElement(quantum_product_1.TabList, { classes: { indicator: 'chromatic-ignore' } }, !isDonut &&
98
+ React.createElement(quantum_product_1.TabList, { classes: { indicator: 'chromatic-ignore' }, style: isDonut ? { display: 'none' } : { display: 'block' } }, !isDonut &&
99
99
  Object.keys(groups).map(function (group, index) {
100
100
  return React.createElement(quantum_product_1.Tab, { key: index, label: group, value: group });
101
101
  })),
102
- React.createElement(quantum_product_1.Box, { paddingY: 2 }, isDonut ? (React.createElement(quantum_product_1.DataTable, { items: data, columns: [
102
+ React.createElement(quantum_product_1.Box, null, isDonut ? (React.createElement(quantum_product_1.DataTable, { items: data, columns: [
103
103
  { field: 'name', title: 'Group' },
104
104
  { title: 'value', render: function (_a) {
105
105
  var item = _a.item;
@@ -37,12 +37,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.CustomLegend = void 0;
38
38
  var quantum_product_1 = require("@auth0/quantum-product");
39
39
  var React = __importStar(require("react"));
40
- var Root = (0, quantum_product_1.styled)(quantum_product_1.StackLayout)(function (_a) {
41
- var theme = _a.theme;
42
- return ({
43
- justifyContent: 'center',
44
- marginTop: theme.spacing(3),
45
- });
40
+ var Root = (0, quantum_product_1.styled)(quantum_product_1.StackLayout)({
41
+ justifyContent: 'center',
46
42
  });
47
43
  var LegendIcon = (0, quantum_product_1.styled)('div')(function (_a) {
48
44
  var theme = _a.theme, ownerState = _a.ownerState;
@@ -5,7 +5,6 @@ export declare type IDecoupledLegendProps<DataType = unknown> = {
5
5
  activeIndex?: number;
6
6
  setActiveIndex: (index: number | undefined) => void;
7
7
  color?: 'categorical' | 'sequential';
8
- layout?: 'horizontal' | 'vertical';
9
8
  };
10
9
  declare function DecoupledLegend<DataType = unknown>(props: IDecoupledLegendProps<DataType>): JSX.Element;
11
10
  export default DecoupledLegend;
@@ -1,15 +1,4 @@
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
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,23 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
26
  var React = __importStar(require("react"));
38
27
  var quantum_product_1 = require("@auth0/quantum-product");
39
28
  var theme_1 = require("../theme");
40
- var Root = (0, quantum_product_1.styled)('div')(function (_a) {
41
- var _b;
42
- var theme = _a.theme, ownerState = _a.ownerState;
43
- return (__assign((_b = { display: 'flex', flexDirection: 'column' }, _b[theme.breakpoints.down('sm')] = {
44
- flexDirection: 'row',
45
- justifyContent: 'center',
46
- gap: theme.spacing(2),
47
- maxWidth: '300px',
48
- flexWrap: 'wrap',
49
- }, _b), (ownerState.layout === 'vertical' && {
50
- flexDirection: 'row',
51
- justifyContent: 'center',
52
- gap: theme.spacing(2),
53
- maxWidth: '300px',
54
- flexWrap: 'wrap',
55
- })));
56
- });
57
29
  var LegendDot = (0, quantum_product_1.styled)('div')({
58
30
  height: '14px',
59
31
  width: '14px',
@@ -66,11 +38,11 @@ var LegendText = (0, quantum_product_1.styled)('span')({
66
38
  cursor: 'default',
67
39
  });
68
40
  function DecoupledLegend(props) {
69
- var data = props.data, activeIndex = props.activeIndex, setActiveIndex = props.setActiveIndex, _a = props.color, color = _a === void 0 ? 'categorical' : _a, _b = props.layout, layout = _b === void 0 ? 'horizontal' : _b;
41
+ var data = props.data, activeIndex = props.activeIndex, setActiveIndex = props.setActiveIndex, _a = props.color, color = _a === void 0 ? 'categorical' : _a;
70
42
  var theme = (0, quantum_product_1.useTheme)();
71
43
  var BASE_COLORS = (0, theme_1.getColorScale)(theme)[color]['base'];
72
44
  var MUTED_COLORS = (0, theme_1.getColorScale)(theme)[color]['muted'];
73
- return (React.createElement(Root, { ownerState: { layout: layout } }, data.map(function (datum, index) {
45
+ return (React.createElement(quantum_product_1.RowLayout, { gutter: 1 }, data.map(function (datum, index) {
74
46
  var isActive = activeIndex !== undefined && activeIndex === index;
75
47
  var color = BASE_COLORS[index % BASE_COLORS.length];
76
48
  var mutedColor = MUTED_COLORS[index % MUTED_COLORS.length];
@@ -66,7 +66,7 @@ var ResponsiveChartCard = (0, quantum_product_1.styled)(quantum_product_1.StackL
66
66
  var theme = _a.theme, ownerState = _a.ownerState;
67
67
  return (__assign((_b = {}, _b[theme.breakpoints.down('sm')] = {
68
68
  flexDirection: 'column',
69
- }, _b.flexWrap = 'nowrap', _b.justifyContent = 'space-around', _b.paddingTop = theme.spacing(3), _b.paddingBottom = theme.spacing(4), _b.height = 'calc(100% - 44px)', _b), (ownerState.layout === 'vertical' && {
69
+ }, _b.flexWrap = 'nowrap', _b.justifyContent = 'space-around', _b.height = 'calc(100% - 40px)', _b), (ownerState.layout === 'vertical' && {
70
70
  flexDirection: 'column',
71
71
  })));
72
72
  });
@@ -93,6 +93,6 @@ function DonutChart(props) {
93
93
  return (React.createElement(recharts_1.Cell, { key: "cell-".concat(index), fill: BASE_COLORS[index % BASE_COLORS.length], opacity: activeIndex === undefined ? 1 : activeIndex === index ? 1 : 0.5 }));
94
94
  }))))),
95
95
  React.createElement(quantum_product_1.StackLayoutItem, null,
96
- React.createElement(decoupled_legend_1.default, { activeIndex: activeIndex, setActiveIndex: setActiveIndex, data: data, color: color, layout: layout })))));
96
+ React.createElement(decoupled_legend_1.default, { activeIndex: activeIndex, setActiveIndex: setActiveIndex, data: data, color: color })))));
97
97
  }
98
98
  exports.DonutChart = DonutChart;
@@ -91,7 +91,7 @@ export function BarChart(props) {
91
91
  dataKey: bottomAxisDataKey,
92
92
  }), { domain: ['auto', 'auto'], axisLine: { stroke: theme.tokens.color_border_bold }, tickLine: { stroke: theme.tokens.color_border_bold } })),
93
93
  React.createElement(Tooltip, { wrapperStyle: { outline: 'none' }, content: React.createElement(CustomTooltip, { active: undefined, payload: undefined, scaleType: bottomAxis.scaleType }) }),
94
- React.createElement(Legend, { align: "center", iconType: "square", iconSize: 14, wrapperStyle: { paddingTop: 16 }, content: React.createElement(CustomLegend, { selectData: selectBar, handleLegendMouseEnter: handleLegendMouseEnter, handleLegendMouseLeave: handleLegendMouseLeave, dataVisibility: barVisibility }) }),
94
+ React.createElement(Legend, { align: "center", content: React.createElement(CustomLegend, { selectData: selectBar, handleLegendMouseEnter: handleLegendMouseEnter, handleLegendMouseLeave: handleLegendMouseLeave, dataVisibility: barVisibility }) }),
95
95
  groups.map(function (group, index) {
96
96
  return (React.createElement(Bar, __assign({ key: group, dataKey: group }, (isStacked && { stackId: 'stack' }), { name: group, maxBarSize: 70, hide: barVisibility[group] === true, fill: barVisibility.hover === group || !barVisibility.hover
97
97
  ? getColorScale(theme)[color]['base'][index]
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { ChartSummary } from '../chart-summary';
4
4
  export function ChartCard(props) {
5
5
  var children = props.children, title = props.title, value = props.value, dataTable = props.dataTable, helperText = props.helperText, label = props.label, height = props.height;
6
- return (React.createElement(Card, { sx: { height: height } },
6
+ return (React.createElement(Card, { sx: { height: height, padding: 3 } },
7
7
  React.createElement(ChartSummary, { title: title, value: value, dataTable: dataTable, helperText: helperText, label: label }),
8
8
  children));
9
9
  }
@@ -64,13 +64,13 @@ export function DataTableChart(props) {
64
64
  };
65
65
  return (React.createElement(Dialog, { open: isOpen, fullWidth: true, title: title, onClose: toggleIsOpen, actions: React.createElement(React.Fragment, null,
66
66
  React.createElement(Button, { color: "primary", variant: "contained", startIcon: React.createElement(DownloadIcon, null), onClick: function () { return downloadCSV(title); } }, "Download")) },
67
- React.createElement(Box, { p: 2 },
67
+ React.createElement(Box, null,
68
68
  React.createElement(Tabs, { baseId: 'example', onChange: setSelectedTab, value: selectedTab },
69
- React.createElement(TabList, { classes: { indicator: 'chromatic-ignore' } }, !isDonut &&
69
+ React.createElement(TabList, { classes: { indicator: 'chromatic-ignore' }, style: isDonut ? { display: 'none' } : { display: 'block' } }, !isDonut &&
70
70
  Object.keys(groups).map(function (group, index) {
71
71
  return React.createElement(Tab, { key: index, label: group, value: group });
72
72
  })),
73
- React.createElement(Box, { paddingY: 2 }, isDonut ? (React.createElement(DataTable, { items: data, columns: [
73
+ React.createElement(Box, null, isDonut ? (React.createElement(DataTable, { items: data, columns: [
74
74
  { field: 'name', title: 'Group' },
75
75
  { title: 'value', render: function (_a) {
76
76
  var item = _a.item;
@@ -11,12 +11,8 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { StackLayout, Text, styled } from '@auth0/quantum-product';
13
13
  import * as React from 'react';
14
- var Root = styled(StackLayout)(function (_a) {
15
- var theme = _a.theme;
16
- return ({
17
- justifyContent: 'center',
18
- marginTop: theme.spacing(3),
19
- });
14
+ var Root = styled(StackLayout)({
15
+ justifyContent: 'center',
20
16
  });
21
17
  var LegendIcon = styled('div')(function (_a) {
22
18
  var theme = _a.theme, ownerState = _a.ownerState;
@@ -1,34 +1,6 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import * as React from 'react';
13
- import { StackLayout, StackLayoutItem, styled, useTheme } from '@auth0/quantum-product';
2
+ import { StackLayout, StackLayoutItem, RowLayout, styled, useTheme } from '@auth0/quantum-product';
14
3
  import { getColorScale } from '../theme';
15
- var Root = styled('div')(function (_a) {
16
- var _b;
17
- var theme = _a.theme, ownerState = _a.ownerState;
18
- return (__assign((_b = { display: 'flex', flexDirection: 'column' }, _b[theme.breakpoints.down('sm')] = {
19
- flexDirection: 'row',
20
- justifyContent: 'center',
21
- gap: theme.spacing(2),
22
- maxWidth: '300px',
23
- flexWrap: 'wrap',
24
- }, _b), (ownerState.layout === 'vertical' && {
25
- flexDirection: 'row',
26
- justifyContent: 'center',
27
- gap: theme.spacing(2),
28
- maxWidth: '300px',
29
- flexWrap: 'wrap',
30
- })));
31
- });
32
4
  var LegendDot = styled('div')({
33
5
  height: '14px',
34
6
  width: '14px',
@@ -41,11 +13,11 @@ var LegendText = styled('span')({
41
13
  cursor: 'default',
42
14
  });
43
15
  function DecoupledLegend(props) {
44
- var data = props.data, activeIndex = props.activeIndex, setActiveIndex = props.setActiveIndex, _a = props.color, color = _a === void 0 ? 'categorical' : _a, _b = props.layout, layout = _b === void 0 ? 'horizontal' : _b;
16
+ var data = props.data, activeIndex = props.activeIndex, setActiveIndex = props.setActiveIndex, _a = props.color, color = _a === void 0 ? 'categorical' : _a;
45
17
  var theme = useTheme();
46
18
  var BASE_COLORS = getColorScale(theme)[color]['base'];
47
19
  var MUTED_COLORS = getColorScale(theme)[color]['muted'];
48
- return (React.createElement(Root, { ownerState: { layout: layout } }, data.map(function (datum, index) {
20
+ return (React.createElement(RowLayout, { gutter: 1 }, data.map(function (datum, index) {
49
21
  var isActive = activeIndex !== undefined && activeIndex === index;
50
22
  var color = BASE_COLORS[index % BASE_COLORS.length];
51
23
  var mutedColor = MUTED_COLORS[index % MUTED_COLORS.length];
@@ -37,7 +37,7 @@ var ResponsiveChartCard = styled(StackLayout)(function (_a) {
37
37
  var theme = _a.theme, ownerState = _a.ownerState;
38
38
  return (__assign((_b = {}, _b[theme.breakpoints.down('sm')] = {
39
39
  flexDirection: 'column',
40
- }, _b.flexWrap = 'nowrap', _b.justifyContent = 'space-around', _b.paddingTop = theme.spacing(3), _b.paddingBottom = theme.spacing(4), _b.height = 'calc(100% - 44px)', _b), (ownerState.layout === 'vertical' && {
40
+ }, _b.flexWrap = 'nowrap', _b.justifyContent = 'space-around', _b.height = 'calc(100% - 40px)', _b), (ownerState.layout === 'vertical' && {
41
41
  flexDirection: 'column',
42
42
  })));
43
43
  });
@@ -64,5 +64,5 @@ export function DonutChart(props) {
64
64
  return (React.createElement(Cell, { key: "cell-".concat(index), fill: BASE_COLORS[index % BASE_COLORS.length], opacity: activeIndex === undefined ? 1 : activeIndex === index ? 1 : 0.5 }));
65
65
  }))))),
66
66
  React.createElement(StackLayoutItem, null,
67
- React.createElement(DecoupledLegend, { activeIndex: activeIndex, setActiveIndex: setActiveIndex, data: data, color: color, layout: layout })))));
67
+ React.createElement(DecoupledLegend, { activeIndex: activeIndex, setActiveIndex: setActiveIndex, data: data, color: color })))));
68
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auth0/quantum-charts",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "sideEffects": false,
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",