@redsift/dashboard 11.6.0-muiv5-alpha.10 → 11.6.0-muiv5-alpha.11
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/{_internal/context.js → _virtual/_internal/_rollupPluginBabelHelpers.js} +2 -11
- package/_virtual/_internal/_rollupPluginBabelHelpers.js.map +1 -0
- package/components/ChartEmptyState/_internal/ChartEmptyState.js +2 -0
- package/{_internal → components/ChartEmptyState/_internal}/ChartEmptyState2.js +2 -33
- package/components/ChartEmptyState/_internal/ChartEmptyState2.js.map +1 -0
- package/components/ChartEmptyState/_internal/styles.js +35 -0
- package/components/ChartEmptyState/_internal/styles.js.map +1 -0
- package/components/CrossfilterRegistry/_internal/CrossfilterRegistry.js +2 -0
- package/{_internal → components/CrossfilterRegistry/_internal}/CrossfilterRegistry2.js +1 -1
- package/components/CrossfilterRegistry/_internal/CrossfilterRegistry2.js.map +1 -0
- package/components/Dashboard/_internal/Dashboard.js +5 -0
- package/{_internal → components/Dashboard/_internal}/Dashboard.js.map +1 -1
- package/components/Dashboard/_internal/Dashboard2.js +46 -0
- package/components/Dashboard/_internal/Dashboard2.js.map +1 -0
- package/components/Dashboard/_internal/context.js +11 -0
- package/components/Dashboard/_internal/context.js.map +1 -0
- package/{_internal/Dashboard2.js → components/Dashboard/_internal/reducer.js} +4 -44
- package/components/Dashboard/_internal/reducer.js.map +1 -0
- package/{_internal → components/Dashboard/_internal}/types.js +1 -1
- package/components/Dashboard/_internal/types.js.map +1 -0
- package/components/PdfExportButton/_internal/PdfDocument.js +173 -0
- package/components/PdfExportButton/_internal/PdfDocument.js.map +1 -0
- package/components/PdfExportButton/_internal/PdfExportButton.js +2 -0
- package/components/PdfExportButton/_internal/PdfExportButton2.js +110 -0
- package/components/PdfExportButton/_internal/PdfExportButton2.js.map +1 -0
- package/components/PdfExportButton/_internal/styles.js +146 -0
- package/components/PdfExportButton/_internal/styles.js.map +1 -0
- package/components/TimeSeriesBarChart/_internal/TimeSeriesBarChart.js +3 -0
- package/{_internal → components/TimeSeriesBarChart/_internal}/TimeSeriesBarChart.js.map +1 -1
- package/{_internal → components/TimeSeriesBarChart/_internal}/TimeSeriesBarChart2.js +10 -119
- package/components/TimeSeriesBarChart/_internal/TimeSeriesBarChart2.js.map +1 -0
- package/components/TimeSeriesBarChart/_internal/styles.js +98 -0
- package/components/TimeSeriesBarChart/_internal/styles.js.map +1 -0
- package/components/TimeSeriesBarChart/_internal/types.js +22 -0
- package/components/TimeSeriesBarChart/_internal/types.js.map +1 -0
- package/components/WithFilters/_internal/FilterableBarChart.js +152 -0
- package/components/WithFilters/_internal/FilterableBarChart.js.map +1 -0
- package/components/WithFilters/_internal/FilterableDataGrid.js +51 -0
- package/components/WithFilters/_internal/FilterableDataGrid.js.map +1 -0
- package/components/WithFilters/_internal/FilterablePieChart.js +160 -0
- package/components/WithFilters/_internal/FilterablePieChart.js.map +1 -0
- package/components/WithFilters/_internal/FilterableScatterPlot.js +252 -0
- package/components/WithFilters/_internal/FilterableScatterPlot.js.map +1 -0
- package/components/WithFilters/_internal/WithFilters.js +2 -0
- package/components/WithFilters/_internal/WithFilters2.js +36 -0
- package/components/WithFilters/_internal/WithFilters2.js.map +1 -0
- package/hooks/_internal/useCategoricalChartAsListbox.js +94 -0
- package/hooks/_internal/useCategoricalChartAsListbox.js.map +1 -0
- package/index.js +11 -15
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/utils/groupReducers/_internal/groupReduceCount.js +5 -0
- package/utils/groupReducers/_internal/groupReduceCount.js.map +1 -0
- package/utils/groupReducers/_internal/groupReduceSum.js +5 -0
- package/utils/groupReducers/_internal/groupReduceSum.js.map +1 -0
- package/_internal/ChartEmptyState.js +0 -2
- package/_internal/ChartEmptyState2.js.map +0 -1
- package/_internal/CrossfilterRegistry.js +0 -2
- package/_internal/CrossfilterRegistry2.js.map +0 -1
- package/_internal/Dashboard.js +0 -4
- package/_internal/Dashboard2.js.map +0 -1
- package/_internal/PdfExportButton.js +0 -2
- package/_internal/PdfExportButton2.js +0 -417
- package/_internal/PdfExportButton2.js.map +0 -1
- package/_internal/TimeSeriesBarChart.js +0 -2
- package/_internal/TimeSeriesBarChart2.js.map +0 -1
- package/_internal/WithFilters.js +0 -2
- package/_internal/WithFilters2.js +0 -701
- package/_internal/WithFilters2.js.map +0 -1
- package/_internal/context.js.map +0 -1
- package/_internal/types.js.map +0 -1
- /package/{_internal → components/ChartEmptyState/_internal}/ChartEmptyState.js.map +0 -0
- /package/{_internal → components/CrossfilterRegistry/_internal}/CrossfilterRegistry.js.map +0 -0
- /package/{_internal → components/PdfExportButton/_internal}/PdfExportButton.js.map +0 -0
- /package/{_internal → components/WithFilters/_internal}/WithFilters.js.map +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { forwardRef, useState, useContext, useEffect } from 'react';
|
|
3
|
+
import { gridFilteredSortedRowEntriesSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector } from '@mui/x-data-grid-pro';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { saveAs } from 'file-saver';
|
|
6
|
+
import { pdf } from '@react-pdf/renderer';
|
|
7
|
+
import domToImage from 'dom-to-image';
|
|
8
|
+
import { Button, Spinner, RedsiftColorBlueD1 } from '@redsift/design-system';
|
|
9
|
+
import { PdfDocument } from './PdfDocument.js';
|
|
10
|
+
import { DashboardContext } from '../../Dashboard/_internal/context.js';
|
|
11
|
+
|
|
12
|
+
const _excluded = ["children", "className", "componentRef", "fileName", "introduction", "localeText", "logo", "onClick", "primaryColor"];
|
|
13
|
+
const COMPONENT_NAME = 'PdfExportButton';
|
|
14
|
+
const CLASSNAME = 'redsift-pdf-export-button';
|
|
15
|
+
const getDashboardImage = async componentRef => {
|
|
16
|
+
var _componentRef$current, _componentRef$current2, _componentRef$current3, _componentRef$current4;
|
|
17
|
+
const filter = el => {
|
|
18
|
+
const classList = el.classList;
|
|
19
|
+
return !(classList !== null && classList !== void 0 && classList.contains('redsift-datagrid') || classList !== null && classList !== void 0 && classList.contains('redsift-button'));
|
|
20
|
+
};
|
|
21
|
+
const dashboardHeight = componentRef.current.getBoundingClientRect().height;
|
|
22
|
+
const datagridHeight = ((_componentRef$current = componentRef.current) === null || _componentRef$current === void 0 ? void 0 : (_componentRef$current2 = _componentRef$current.getElementsByClassName('redsift-datagrid')) === null || _componentRef$current2 === void 0 ? void 0 : (_componentRef$current3 = _componentRef$current2[0]) === null || _componentRef$current3 === void 0 ? void 0 : (_componentRef$current4 = _componentRef$current3.getBoundingClientRect()) === null || _componentRef$current4 === void 0 ? void 0 : _componentRef$current4.height) || 0;
|
|
23
|
+
return new Promise(resolve => {
|
|
24
|
+
domToImage.toPng(componentRef.current, {
|
|
25
|
+
filter,
|
|
26
|
+
height: dashboardHeight - datagridHeight
|
|
27
|
+
}).then(function (dataUrl) {
|
|
28
|
+
resolve(dataUrl);
|
|
29
|
+
}).catch(() => {
|
|
30
|
+
resolve('');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const PdfExportButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
35
|
+
const {
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
componentRef: propComponentRef,
|
|
39
|
+
fileName,
|
|
40
|
+
introduction,
|
|
41
|
+
localeText,
|
|
42
|
+
logo,
|
|
43
|
+
onClick,
|
|
44
|
+
primaryColor
|
|
45
|
+
} = props,
|
|
46
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
47
|
+
const [componentRef, setComponentRef] = useState(propComponentRef);
|
|
48
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
49
|
+
const {
|
|
50
|
+
dashboardRef,
|
|
51
|
+
dataGridApiRef
|
|
52
|
+
} = useContext(DashboardContext);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!componentRef || !componentRef.current) {
|
|
55
|
+
setComponentRef(dashboardRef);
|
|
56
|
+
}
|
|
57
|
+
}, [dashboardRef]);
|
|
58
|
+
const exportPdf = async () => {
|
|
59
|
+
if (onClick) {
|
|
60
|
+
onClick();
|
|
61
|
+
}
|
|
62
|
+
setIsLoading(true);
|
|
63
|
+
try {
|
|
64
|
+
const dashboardImage = await getDashboardImage(componentRef || dashboardRef);
|
|
65
|
+
let dataTable;
|
|
66
|
+
if (dataGridApiRef && dataGridApiRef.current && Object.keys(dataGridApiRef.current).length) {
|
|
67
|
+
dataTable = {
|
|
68
|
+
data: gridFilteredSortedRowEntriesSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId).slice(0, 1000).map(_ref => {
|
|
69
|
+
let {
|
|
70
|
+
model
|
|
71
|
+
} = _ref;
|
|
72
|
+
return model;
|
|
73
|
+
}),
|
|
74
|
+
columns: gridVisibleColumnDefinitionsSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId),
|
|
75
|
+
totalWidth: gridColumnsTotalWidthSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const doc = /*#__PURE__*/React.createElement(PdfDocument, {
|
|
79
|
+
localeText: localeText,
|
|
80
|
+
dashboardImage: dashboardImage,
|
|
81
|
+
introduction: introduction,
|
|
82
|
+
logo: logo,
|
|
83
|
+
primaryColor: primaryColor || RedsiftColorBlueD1,
|
|
84
|
+
dataTable: dataTable
|
|
85
|
+
});
|
|
86
|
+
const asPdf = pdf([]);
|
|
87
|
+
asPdf.updateContainer(doc);
|
|
88
|
+
const blob = await asPdf.toBlob();
|
|
89
|
+
saveAs(blob, fileName || 'redsift-dashboard.pdf');
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.log('error:', e);
|
|
92
|
+
}
|
|
93
|
+
setIsLoading(false);
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
96
|
+
className: classNames(PdfExportButton.className, className),
|
|
97
|
+
onClick: exportPdf,
|
|
98
|
+
isDisabled: isLoading
|
|
99
|
+
}, forwardedProps, {
|
|
100
|
+
ref: ref
|
|
101
|
+
}), isLoading ? /*#__PURE__*/React.createElement(Spinner, {
|
|
102
|
+
size: "xsmall",
|
|
103
|
+
isColored: false
|
|
104
|
+
}) : null, " ", children);
|
|
105
|
+
});
|
|
106
|
+
PdfExportButton.className = CLASSNAME;
|
|
107
|
+
PdfExportButton.displayName = COMPONENT_NAME;
|
|
108
|
+
|
|
109
|
+
export { PdfExportButton };
|
|
110
|
+
//# sourceMappingURL=PdfExportButton2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfExportButton2.js","sources":["../../../../src/components/PdfExportButton/PdfExportButton.tsx"],"sourcesContent":["// istanbul ignore file\n\nimport React, {\n forwardRef,\n JSXElementConstructor,\n ReactElement,\n RefObject,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n gridFilteredSortedRowEntriesSelector,\n gridVisibleColumnDefinitionsSelector,\n gridColumnsTotalWidthSelector,\n} from '@mui/x-data-grid-pro';\nimport classNames from 'classnames';\nimport { saveAs } from 'file-saver';\nimport { pdf } from '@react-pdf/renderer';\nimport domToImage from 'dom-to-image';\n\nimport { Comp, Button, Spinner, RedsiftColorBlueD1 } from '@redsift/design-system';\n\nimport { PdfExportButtonProps } from './types';\nimport { PdfDocument } from './PdfDocument';\nimport { DashboardContext } from '../Dashboard';\n\nconst COMPONENT_NAME = 'PdfExportButton';\nconst CLASSNAME = 'redsift-pdf-export-button';\n\nconst getDashboardImage = async (componentRef: RefObject<HTMLElement>): Promise<string> => {\n const filter = (el: Node) => {\n const classList = (el as HTMLElement).classList;\n return !(classList?.contains('redsift-datagrid') || classList?.contains('redsift-button'));\n };\n\n const dashboardHeight = (componentRef.current as HTMLElement).getBoundingClientRect().height;\n const datagridHeight =\n (componentRef.current as HTMLElement)?.getElementsByClassName('redsift-datagrid')?.[0]?.getBoundingClientRect()\n ?.height || 0;\n\n return new Promise((resolve) => {\n domToImage\n .toPng(componentRef.current as HTMLElement, {\n filter,\n height: dashboardHeight - datagridHeight,\n })\n .then(function (dataUrl: string) {\n resolve(dataUrl);\n })\n .catch(() => {\n resolve('');\n });\n });\n};\n\nexport const PdfExportButton: Comp<PdfExportButtonProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const {\n children,\n className,\n componentRef: propComponentRef,\n fileName,\n introduction,\n localeText,\n logo,\n onClick,\n primaryColor,\n ...forwardedProps\n } = props;\n const [componentRef, setComponentRef] = useState(propComponentRef);\n const [isLoading, setIsLoading] = useState(false);\n\n const { dashboardRef, dataGridApiRef } = useContext(DashboardContext);\n\n useEffect(() => {\n if (!componentRef || !componentRef.current) {\n setComponentRef(dashboardRef);\n }\n }, [dashboardRef]);\n\n const exportPdf = async () => {\n if (onClick) {\n onClick();\n }\n setIsLoading(true);\n try {\n const dashboardImage = await getDashboardImage(componentRef || dashboardRef!);\n\n let dataTable;\n if (dataGridApiRef && dataGridApiRef.current && Object.keys(dataGridApiRef.current).length) {\n dataTable = {\n data: gridFilteredSortedRowEntriesSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId)\n .slice(0, 1000)\n .map(({ model }) => model),\n columns: gridVisibleColumnDefinitionsSelector(\n dataGridApiRef.current.state,\n dataGridApiRef.current.instanceId\n ),\n totalWidth: gridColumnsTotalWidthSelector(dataGridApiRef.current.state, dataGridApiRef.current.instanceId),\n };\n }\n\n const doc = (\n <PdfDocument\n localeText={localeText}\n dashboardImage={dashboardImage}\n introduction={introduction}\n logo={logo}\n primaryColor={primaryColor || RedsiftColorBlueD1}\n dataTable={dataTable}\n />\n );\n const asPdf = pdf([] as unknown as ReactElement<any, string | JSXElementConstructor<any>>);\n asPdf.updateContainer(doc);\n const blob = await asPdf.toBlob();\n saveAs(blob, fileName || 'redsift-dashboard.pdf');\n } catch (e) {\n console.log('error:', e);\n }\n setIsLoading(false);\n };\n\n return (\n <Button\n className={classNames(PdfExportButton.className, className)}\n onClick={exportPdf}\n isDisabled={isLoading}\n {...forwardedProps}\n ref={ref as RefObject<HTMLButtonElement>}\n >\n {isLoading ? <Spinner size=\"xsmall\" isColored={false} /> : null} {children}\n </Button>\n );\n});\nPdfExportButton.className = CLASSNAME;\nPdfExportButton.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getDashboardImage","componentRef","_componentRef$current","_componentRef$current2","_componentRef$current3","_componentRef$current4","filter","el","classList","contains","dashboardHeight","current","getBoundingClientRect","height","datagridHeight","getElementsByClassName","Promise","resolve","domToImage","toPng","then","dataUrl","catch","PdfExportButton","forwardRef","props","ref","children","className","propComponentRef","fileName","introduction","localeText","logo","onClick","primaryColor","forwardedProps","_objectWithoutProperties","_excluded","setComponentRef","useState","isLoading","setIsLoading","dashboardRef","dataGridApiRef","useContext","DashboardContext","useEffect","exportPdf","dashboardImage","dataTable","Object","keys","length","data","gridFilteredSortedRowEntriesSelector","state","instanceId","slice","map","_ref","model","columns","gridVisibleColumnDefinitionsSelector","totalWidth","gridColumnsTotalWidthSelector","doc","React","createElement","PdfDocument","RedsiftColorBlueD1","asPdf","pdf","updateContainer","blob","toBlob","saveAs","e","console","log","Button","_extends","classNames","isDisabled","Spinner","size","isColored","displayName"],"mappings":";;;;;;;;;;;;AA2BA,MAAMA,cAAc,GAAG,iBAAiB,CAAA;AACxC,MAAMC,SAAS,GAAG,2BAA2B,CAAA;AAE7C,MAAMC,iBAAiB,GAAG,MAAOC,YAAoC,IAAsB;AAAA,EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,CAAA;EACzF,MAAMC,MAAM,GAAIC,EAAQ,IAAK;AAC3B,IAAA,MAAMC,SAAS,GAAID,EAAE,CAAiBC,SAAS,CAAA;IAC/C,OAAO,EAAEA,SAAS,KAATA,IAAAA,IAAAA,SAAS,eAATA,SAAS,CAAEC,QAAQ,CAAC,kBAA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QAAA,CAAA;IACLrD,SAAS,EAAEsD,UAAU,CAAC3D,eAAe,CAACK,SAAS,EAAEA,SAAS,CAAE;AAC5DM,IAAAA,OAAO,EAAEc,SAAU;AACnBmC,IAAAA,UAAU,EAAE1C,SAAAA;AAAU,GAAA,EAClBL,cAAc,EAAA;AAClBV,IAAAA,GAAG,EAAEA,GAAAA;AAAoC,GAAA,CAAA,EAExCe,SAAS,gBAAG0B,KAAA,CAAAC,aAAA,CAACgB,OAAO,EAAA;AAACC,IAAAA,IAAI,EAAC,QAAQ;AAACC,IAAAA,SAAS,EAAE,KAAA;AAAM,GAAE,CAAC,GAAG,IAAI,EAAC,GAAC,EAAC3D,QAC5D,CAAC,CAAA;AAEb,CAAC,EAAC;AACFJ,eAAe,CAACK,SAAS,GAAG7B,SAAS,CAAA;AACrCwB,eAAe,CAACgE,WAAW,GAAGzF,cAAc;;;;"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Font, StyleSheet } from '@react-pdf/renderer';
|
|
2
|
+
|
|
3
|
+
// istanbul ignore file
|
|
4
|
+
const BACKGROUND_COLOR = '#F8F8F8';
|
|
5
|
+
const GREY_1 = '#E2E6EA';
|
|
6
|
+
const GREY_2 = '#bff0fd';
|
|
7
|
+
const getPdfStyles = primaryColor => {
|
|
8
|
+
Font.register({
|
|
9
|
+
family: 'Source Code Pro',
|
|
10
|
+
fonts: [{
|
|
11
|
+
src: 'https://fonts.gstatic.com/s/sourcecodepro/v7/HI_SiYsKILxRpg3hIP6sJ7fM7PqlM-vT.ttf'
|
|
12
|
+
}]
|
|
13
|
+
});
|
|
14
|
+
Font.register({
|
|
15
|
+
family: 'Roboto',
|
|
16
|
+
fonts: [{
|
|
17
|
+
fontWeight: 700,
|
|
18
|
+
src: 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/fonts/roboto/Roboto-Regular.ttf'
|
|
19
|
+
}, {
|
|
20
|
+
fontWeight: 400,
|
|
21
|
+
src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf'
|
|
22
|
+
}]
|
|
23
|
+
});
|
|
24
|
+
return StyleSheet.create({
|
|
25
|
+
page: {
|
|
26
|
+
borderTopStyle: 'solid',
|
|
27
|
+
borderTopWidth: 32,
|
|
28
|
+
borderTopColor: primaryColor,
|
|
29
|
+
borderBottomStyle: 'solid',
|
|
30
|
+
borderBottomWidth: 6,
|
|
31
|
+
borderBottomColor: primaryColor,
|
|
32
|
+
backgroundColor: BACKGROUND_COLOR,
|
|
33
|
+
paddingTop: 20,
|
|
34
|
+
paddingBottom: 40
|
|
35
|
+
},
|
|
36
|
+
logoContainer: {
|
|
37
|
+
margin: 0,
|
|
38
|
+
paddingBottom: 10,
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
width: '100%'
|
|
41
|
+
},
|
|
42
|
+
logo: {
|
|
43
|
+
width: 'auto',
|
|
44
|
+
height: 30
|
|
45
|
+
},
|
|
46
|
+
introductionContainer: {
|
|
47
|
+
lineHeight: 1.4,
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
marginHorizontal: 40,
|
|
50
|
+
marginVertical: 10
|
|
51
|
+
},
|
|
52
|
+
introductionText: {
|
|
53
|
+
fontSize: 8,
|
|
54
|
+
fontFamily: 'Roboto',
|
|
55
|
+
fontWeight: 400,
|
|
56
|
+
color: 'black'
|
|
57
|
+
},
|
|
58
|
+
pageNumber: {
|
|
59
|
+
fontFamily: 'Source Code Pro',
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
fontSize: 6,
|
|
62
|
+
bottom: 5,
|
|
63
|
+
right: 20,
|
|
64
|
+
left: 0,
|
|
65
|
+
textAlign: 'right',
|
|
66
|
+
color: 'black'
|
|
67
|
+
},
|
|
68
|
+
pageContinue: {
|
|
69
|
+
fontSize: 8,
|
|
70
|
+
fontFamily: 'Roboto',
|
|
71
|
+
fontWeight: 400,
|
|
72
|
+
top: -10,
|
|
73
|
+
left: 20
|
|
74
|
+
},
|
|
75
|
+
tableContainer: {
|
|
76
|
+
backgroundColor: 'white',
|
|
77
|
+
marginHorizontal: 20,
|
|
78
|
+
marginVertical: 10,
|
|
79
|
+
paddingTop: 10,
|
|
80
|
+
paddingLeft: 10,
|
|
81
|
+
borderRightWidth: 1,
|
|
82
|
+
borderBottomWidth: 1,
|
|
83
|
+
borderRightColor: BACKGROUND_COLOR,
|
|
84
|
+
borderBottomColor: GREY_1,
|
|
85
|
+
width: 'auto'
|
|
86
|
+
},
|
|
87
|
+
tableRowContainer: {
|
|
88
|
+
flexDirection: 'row',
|
|
89
|
+
borderBottomColor: GREY_2,
|
|
90
|
+
alignItems: 'flex-start',
|
|
91
|
+
fontSize: 8,
|
|
92
|
+
marginLeft: 16,
|
|
93
|
+
marginRight: 24,
|
|
94
|
+
height: 'auto'
|
|
95
|
+
},
|
|
96
|
+
tableHeaderContainer: {
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
alignItems: 'flex-start',
|
|
99
|
+
fontSize: 7,
|
|
100
|
+
fontFamily: 'Roboto',
|
|
101
|
+
fontWeight: 700,
|
|
102
|
+
marginLeft: 16,
|
|
103
|
+
marginRight: 24,
|
|
104
|
+
marginBottom: 12,
|
|
105
|
+
paddingTop: 12,
|
|
106
|
+
paddingBottom: 12,
|
|
107
|
+
borderBottomWidth: 2,
|
|
108
|
+
borderBottomColor: primaryColor
|
|
109
|
+
},
|
|
110
|
+
tableCellHeaderText: {
|
|
111
|
+
fontSize: 7,
|
|
112
|
+
fontFamily: 'Roboto',
|
|
113
|
+
fontWeight: 700,
|
|
114
|
+
color: 'black',
|
|
115
|
+
overflow: 'hidden'
|
|
116
|
+
},
|
|
117
|
+
tableCellText: {
|
|
118
|
+
fontSize: 6,
|
|
119
|
+
lineHeight: 1.5,
|
|
120
|
+
fontFamily: 'Roboto',
|
|
121
|
+
fontWeight: 400,
|
|
122
|
+
color: 'black',
|
|
123
|
+
overflow: 'hidden'
|
|
124
|
+
},
|
|
125
|
+
dashboardImageContainer: {
|
|
126
|
+
marginHorizontal: 20,
|
|
127
|
+
marginTop: 0,
|
|
128
|
+
marginBottom: 10
|
|
129
|
+
},
|
|
130
|
+
constraintsContainer: {
|
|
131
|
+
width: 'auto',
|
|
132
|
+
height: 'auto',
|
|
133
|
+
paddingVertical: 30,
|
|
134
|
+
textAlign: 'center'
|
|
135
|
+
},
|
|
136
|
+
constraints: {
|
|
137
|
+
fontSize: 6,
|
|
138
|
+
fontFamily: 'Roboto',
|
|
139
|
+
fontWeight: 700,
|
|
140
|
+
color: 'black'
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export { getPdfStyles };
|
|
146
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/PdfExportButton/styles.ts"],"sourcesContent":["// istanbul ignore file\n\nimport { Font, StyleSheet } from '@react-pdf/renderer';\nconst BACKGROUND_COLOR = '#F8F8F8';\nconst GREY_1 = '#E2E6EA';\nconst GREY_2 = '#bff0fd';\n\nexport const getPdfStyles = (primaryColor: string) => {\n Font.register({\n family: 'Source Code Pro',\n fonts: [\n {\n src: 'https://fonts.gstatic.com/s/sourcecodepro/v7/HI_SiYsKILxRpg3hIP6sJ7fM7PqlM-vT.ttf',\n },\n ],\n });\n\n Font.register({\n family: 'Roboto',\n fonts: [\n {\n fontWeight: 700,\n src: 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/fonts/roboto/Roboto-Regular.ttf',\n },\n {\n fontWeight: 400,\n src: 'https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf',\n },\n ],\n });\n\n return StyleSheet.create({\n page: {\n borderTopStyle: 'solid',\n borderTopWidth: 32,\n borderTopColor: primaryColor,\n borderBottomStyle: 'solid',\n borderBottomWidth: 6,\n borderBottomColor: primaryColor,\n backgroundColor: BACKGROUND_COLOR,\n paddingTop: 20,\n paddingBottom: 40,\n },\n logoContainer: {\n margin: 0,\n paddingBottom: 10,\n alignItems: 'center',\n width: '100%',\n },\n logo: {\n width: 'auto',\n height: 30,\n },\n introductionContainer: {\n lineHeight: 1.4,\n textAlign: 'center',\n marginHorizontal: 40,\n marginVertical: 10,\n },\n introductionText: {\n fontSize: 8,\n fontFamily: 'Roboto',\n fontWeight: 400,\n color: 'black',\n },\n pageNumber: {\n fontFamily: 'Source Code Pro',\n position: 'absolute',\n fontSize: 6,\n bottom: 5,\n right: 20,\n left: 0,\n textAlign: 'right',\n color: 'black',\n },\n pageContinue: {\n fontSize: 8,\n fontFamily: 'Roboto',\n fontWeight: 400,\n top: -10,\n left: 20,\n },\n tableContainer: {\n backgroundColor: 'white',\n marginHorizontal: 20,\n marginVertical: 10,\n paddingTop: 10,\n paddingLeft: 10,\n borderRightWidth: 1,\n borderBottomWidth: 1,\n borderRightColor: BACKGROUND_COLOR,\n borderBottomColor: GREY_1,\n width: 'auto',\n },\n tableRowContainer: {\n flexDirection: 'row',\n borderBottomColor: GREY_2,\n alignItems: 'flex-start',\n fontSize: 8,\n marginLeft: 16,\n marginRight: 24,\n height: 'auto',\n },\n tableHeaderContainer: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n fontSize: 7,\n fontFamily: 'Roboto',\n fontWeight: 700,\n marginLeft: 16,\n marginRight: 24,\n marginBottom: 12,\n paddingTop: 12,\n paddingBottom: 12,\n borderBottomWidth: 2,\n borderBottomColor: primaryColor,\n },\n tableCellHeaderText: {\n fontSize: 7,\n fontFamily: 'Roboto',\n fontWeight: 700,\n color: 'black',\n overflow: 'hidden',\n },\n tableCellText: {\n fontSize: 6,\n lineHeight: 1.5,\n fontFamily: 'Roboto',\n fontWeight: 400,\n color: 'black',\n overflow: 'hidden',\n },\n dashboardImageContainer: {\n marginHorizontal: 20,\n marginTop: 0,\n marginBottom: 10,\n },\n constraintsContainer: {\n width: 'auto',\n height: 'auto',\n paddingVertical: 30,\n textAlign: 'center',\n },\n constraints: {\n fontSize: 6,\n fontFamily: 'Roboto',\n fontWeight: 700,\n color: 'black',\n },\n });\n};\n"],"names":["BACKGROUND_COLOR","GREY_1","GREY_2","getPdfStyles","primaryColor","Font","register","family","fonts","src","fontWeight","StyleSheet","create","page","borderTopStyle","borderTopWidth","borderTopColor","borderBottomStyle","borderBottomWidth","borderBottomColor","backgroundColor","paddingTop","paddingBottom","logoContainer","margin","alignItems","width","logo","height","introductionContainer","lineHeight","textAlign","marginHorizontal","marginVertical","introductionText","fontSize","fontFamily","color","pageNumber","position","bottom","right","left","pageContinue","top","tableContainer","paddingLeft","borderRightWidth","borderRightColor","tableRowContainer","flexDirection","marginLeft","marginRight","tableHeaderContainer","marginBottom","tableCellHeaderText","overflow","tableCellText","dashboardImageContainer","marginTop","constraintsContainer","paddingVertical","constraints"],"mappings":";;AAAA;AAGA,MAAMA,gBAAgB,GAAG,SAAS,CAAA;AAClC,MAAMC,MAAM,GAAG,SAAS,CAAA;AACxB,MAAMC,MAAM,GAAG,SAAS,CAAA;AAEXC,MAAAA,YAAY,GAAIC,YAAoB,IAAK;EACpDC,IAAI,CAACC,QAAQ,CAAC;AACZC,IAAAA,MAAM,EAAE,iBAAiB;AACzBC,IAAAA,KAAK,EAAE,CACL;AACEC,MAAAA,GAAG,EAAE,mFAAA;KACN,CAAA;AAEL,GAAC,CAAC,CAAA;EAEFJ,IAAI,CAACC,QAAQ,CAAC;AACZC,IAAAA,MAAM,EAAE,QAAQ;AAChBC,IAAAA,KAAK,EAAE,CACL;AACEE,MAAAA,UAAU,EAAE,GAAG;AACfD,MAAAA,GAAG,EAAE,2FAAA;AACP,KAAC,EACD;AACEC,MAAAA,UAAU,EAAE,GAAG;AACfD,MAAAA,GAAG,EAAE,yFAAA;KACN,CAAA;AAEL,GAAC,CAAC,CAAA;EAEF,OAAOE,UAAU,CAACC,MAAM,CAAC;AACvBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,cAAc,EAAE,OAAO;AACvBC,MAAA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QAAQ,EAAE,CAAC;AACXC,MAAAA,UAAU,EAAE,QAAQ;AACpB1B,MAAAA,UAAU,EAAE,GAAG;AACf2B,MAAAA,KAAK,EAAE,OAAO;AACdmB,MAAAA,QAAQ,EAAE,QAAA;KACX;AACDC,IAAAA,aAAa,EAAE;AACbtB,MAAAA,QAAQ,EAAE,CAAC;AACXL,MAAAA,UAAU,EAAE,GAAG;AACfM,MAAAA,UAAU,EAAE,QAAQ;AACpB1B,MAAAA,UAAU,EAAE,GAAG;AACf2B,MAAAA,KAAK,EAAE,OAAO;AACdmB,MAAAA,QAAQ,EAAE,QAAA;KACX;AACDE,IAAAA,uBAAuB,EAAE;AACvB1B,MAAAA,gBAAgB,EAAE,EAAE;AACpB2B,MAAAA,SAAS,EAAE,CAAC;AACZL,MAAAA,YAAY,EAAE,EAAA;KACf;AACDM,IAAAA,oBAAoB,EAAE;AACpBlC,MAAAA,KAAK,EAAE,MAAM;AACbE,MAAAA,MAAM,EAAE,MAAM;AACdiC,MAAAA,eAAe,EAAE,EAAE;AACnB9B,MAAAA,SAAS,EAAE,QAAA;KACZ;AACD+B,IAAAA,WAAW,EAAE;AACX3B,MAAAA,QAAQ,EAAE,CAAC;AACXC,MAAAA,UAAU,EAAE,QAAQ;AACpB1B,MAAAA,UAAU,EAAE,GAAG;AACf2B,MAAAA,KAAK,EAAE,OAAA;AACT,KAAA;AACF,GAAC,CAAC,CAAA;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeriesBarChart.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"TimeSeriesBarChart.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,125 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, extends as _extends } from '../../../_virtual/_internal/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React, { forwardRef, useRef, useState, useContext, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { config, barChart, filters, redrawAll, filterAll } from 'dc';
|
|
5
5
|
import { utcParse, timeFormat, isoParse, timeMonth, scaleTime, timeMonths, timeYear, timeYears, timeWeek, timeWeeks, timeDay, timeDays, timeHour, timeHours } from 'd3';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Component size.
|
|
16
|
-
*/
|
|
17
|
-
const TimeSeriesBarChartSize = {
|
|
18
|
-
large: 'large',
|
|
19
|
-
medium: 'medium',
|
|
20
|
-
small: 'small'
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Component theme.
|
|
24
|
-
*/
|
|
25
|
-
const TimeSeriesBarChartTheme = ColorTheme;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Component props.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
// istanbul ignore file
|
|
32
|
-
/**
|
|
33
|
-
* Component style.
|
|
34
|
-
*/
|
|
35
|
-
const StyledTimeSeriesBarChart = styled.div`
|
|
36
|
-
margin: 16px;
|
|
37
|
-
padding: 16px;
|
|
38
|
-
|
|
39
|
-
text {
|
|
40
|
-
fill: ${_ref => {
|
|
41
|
-
let {
|
|
42
|
-
$theme
|
|
43
|
-
} = _ref;
|
|
44
|
-
return `var(--redsift-color-${$theme}-components-text-primary)`;
|
|
45
|
-
}};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.redsift-timeseries-barchart__chart {
|
|
49
|
-
display: flex;
|
|
50
|
-
font-family: var(--redsift-typography-font-family-poppins);
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
justify-content: center;
|
|
53
|
-
margin: 8px 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
svg > g {
|
|
57
|
-
margin: 8px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.grid-line,
|
|
61
|
-
.axis .grid-line,
|
|
62
|
-
.grid-line line,
|
|
63
|
-
.axis .grid-line line {
|
|
64
|
-
fill: none;
|
|
65
|
-
stroke: #ccc;
|
|
66
|
-
shape-rendering: crispEdges;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.axis text {
|
|
70
|
-
font-family: var(--redsift-typography-font-family-poppins);
|
|
71
|
-
font-size: 10px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
g.stack rect.bar.deselected {
|
|
75
|
-
fill-opacity: 0.5;
|
|
76
|
-
fill: var(--redsift-color-neutral-mid-grey);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.brush .custom-brush-handle {
|
|
80
|
-
fill: #eee;
|
|
81
|
-
stroke: #666;
|
|
82
|
-
cursor: ew-resize;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
text {
|
|
86
|
-
user-select: none;
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
const StyledTimeSeriesBarChartTitle = styled(Flexbox)`
|
|
90
|
-
font-family: var(--redsift-typography-h4-font-family);
|
|
91
|
-
font-size: var(--redsift-typography-h4-font-size);
|
|
92
|
-
font-weight: var(--redsift-typography-h4-font-weight);
|
|
93
|
-
line-height: var(--redsift-typography-h4-line-height);
|
|
94
|
-
`;
|
|
95
|
-
const StyledTimeSeriesBarChartCaption = styled.p`
|
|
96
|
-
font-family: var(--redsift-typography-caption-font-family);
|
|
97
|
-
font-size: var(--redsift-typography-caption-font-size);
|
|
98
|
-
font-weight: var(--redsift-typography-caption-font-weight);
|
|
99
|
-
line-height: var(--redsift-typography-caption-line-height);
|
|
100
|
-
`;
|
|
101
|
-
const StyledTimeSeriesBarChartContainer = styled.div`
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: center;
|
|
104
|
-
gap: 16px;
|
|
105
|
-
font-family: var(--redsift-typography-font-family-poppins);
|
|
106
|
-
font-size: 11px;
|
|
107
|
-
justify-content: center;
|
|
108
|
-
margin: 8px 0;
|
|
109
|
-
position: relative;
|
|
110
|
-
|
|
111
|
-
.redsift-timeseries-barchart-container__chart {
|
|
112
|
-
position: relative;
|
|
113
|
-
${_ref2 => {
|
|
114
|
-
let {
|
|
115
|
-
$isEmpty
|
|
116
|
-
} = _ref2;
|
|
117
|
-
return $isEmpty ? css`
|
|
118
|
-
display: none;
|
|
119
|
-
` : '';
|
|
120
|
-
}};
|
|
121
|
-
}
|
|
122
|
-
`;
|
|
6
|
+
import { useId, useTheme, Button } from '@redsift/design-system';
|
|
7
|
+
import { useColor, scheme } from '@redsift/charts';
|
|
8
|
+
import { TimeSeriesBarChartTheme, TimeSeriesBarChartSize } from './types.js';
|
|
9
|
+
import { StyledTimeSeriesBarChart, StyledTimeSeriesBarChartTitle, StyledTimeSeriesBarChartContainer, StyledTimeSeriesBarChartCaption } from './styles.js';
|
|
10
|
+
import { DashboardReducerActionType } from '../../Dashboard/_internal/types.js';
|
|
11
|
+
import { ChartEmptyState } from '../../ChartEmptyState/_internal/ChartEmptyState2.js';
|
|
12
|
+
import { DashboardContext } from '../../Dashboard/_internal/context.js';
|
|
13
|
+
import { CrossfilterRegistry } from '../../CrossfilterRegistry/_internal/CrossfilterRegistry2.js';
|
|
123
14
|
|
|
124
15
|
const _excluded = ["areXLabelsRotated", "caption", "className", "colorTheme", "columnToFilter", "data", "dateTimeFieldName", "dateTimeFormat", "dateTimeGroup", "dimension", "isResetable", "localeText", "onFilter", "size", "stackedCategory", "title", "xAxisLabel", "yAxisLabel"];
|
|
125
16
|
const COMPONENT_NAME = 'TimeSeriesBarChart';
|
|
@@ -470,5 +361,5 @@ const TimeSeriesBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
470
361
|
TimeSeriesBarChart.className = CLASSNAME;
|
|
471
362
|
TimeSeriesBarChart.displayName = COMPONENT_NAME;
|
|
472
363
|
|
|
473
|
-
export { TimeSeriesBarChart
|
|
364
|
+
export { TimeSeriesBarChart };
|
|
474
365
|
//# sourceMappingURL=TimeSeriesBarChart2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSeriesBarChart2.js","sources":["../../../../src/components/TimeSeriesBarChart/TimeSeriesBarChart.tsx"],"sourcesContent":["// istanbul ignore file\n\nimport React, { forwardRef, RefObject, useContext, useEffect, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport {\n config as dcconfig,\n filterAll as dcfilterAll,\n filters as dcfilters,\n redrawAll as dcredrawAll,\n barChart as dcbarChart,\n BarChart as dcBarChart,\n UnitFunction as dcUnitFunction,\n} from 'dc';\nimport {\n scaleTime as d3scaleTime,\n timeFormat as d3timeFormat,\n isoParse as d3isoParse,\n utcParse as d3utcParse,\n timeHour as d3timeHour,\n timeHours as d3timeHours,\n timeDay as d3timeDay,\n timeDays as d3timeDays,\n timeWeek as d3timeWeek,\n timeWeeks as d3timeWeeks,\n timeMonth as d3timeMonth,\n timeMonths as d3timeMonths,\n timeYear as d3timeYear,\n timeYears as d3timeYears,\n} from 'd3';\n\nimport { Button, Comp, useId, useTheme } from '@redsift/design-system';\nimport { scheme, useColor } from '@redsift/charts';\n\nimport { DashboardContext, DashboardReducerActionType } from '../Dashboard';\nimport { TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme } from './types';\nimport { JSONObject, JSONArray } from '../../types';\nimport {\n StyledTimeSeriesBarChart,\n StyledTimeSeriesBarChartCaption,\n StyledTimeSeriesBarChartTitle,\n StyledTimeSeriesBarChartContainer,\n} from './styles';\nimport { GridFilterItem } from '@redsift/table';\nimport { ChartEmptyState } from '../ChartEmptyState';\nimport { CrossfilterRegistry } from '../CrossfilterRegistry';\n\nconst COMPONENT_NAME = 'TimeSeriesBarChart';\nconst CLASSNAME = 'redsift-timeseries-barchart';\n\ntype ChartDimensions = {\n width: number;\n height: number;\n marginTop?: number;\n marginRight?: number;\n marginBottom?: number;\n marginLeft?: number;\n};\n\nconst getStartDate = (dates: Date[]) => new Date(Math.min(...dates.map(Number)));\nconst getEndDate = (dates: Date[]) => new Date(Math.max(...dates.map(Number)));\n\nconst sizeToDimension = (size: TimeSeriesBarChartSize): ChartDimensions => {\n switch (size) {\n case TimeSeriesBarChartSize.small:\n return {\n width: 400,\n height: 200,\n marginLeft: 16,\n marginTop: 16,\n marginRight: 16,\n marginBottom: 32,\n };\n case TimeSeriesBarChartSize.large:\n return {\n width: 1000,\n height: 300,\n marginLeft: 16,\n marginTop: 16,\n marginRight: 16,\n marginBottom: 32,\n };\n case TimeSeriesBarChartSize.medium:\n default:\n return {\n width: 600,\n height: 250,\n marginLeft: 16,\n marginTop: 16,\n marginRight: 16,\n marginBottom: 32,\n };\n }\n};\n\nconst parseDateTimeGroup = (\n data: JSONArray,\n dateTimeGroup: TimeSeriesBarChartProps['dateTimeGroup'],\n dateTimeFieldName: string\n) => {\n const dates = [...data.map((d: (typeof data)[number]) => new Date(d[dateTimeFieldName] as string))];\n const startDate = getStartDate(dates);\n const endDate = getEndDate(dates);\n\n switch (dateTimeGroup) {\n case 'hour':\n return {\n group: (g: Date) => d3timeHour(g),\n round: (x: Date) => d3timeHour(x),\n x: d3scaleTime().domain([d3timeHour.offset(startDate, -1), d3timeHour.offset(endDate, 2)]),\n xUnits: d3timeHours,\n };\n case 'day':\n return {\n group: (g: Date) => d3timeDay(g),\n round: (x: Date) => d3timeDay(x),\n x: d3scaleTime().domain([d3timeDay.offset(startDate, -1), d3timeDay.offset(endDate, 2)]),\n xUnits: d3timeDays,\n };\n case 'week':\n return {\n group: (g: Date) => d3timeWeek(g),\n round: (x: Date) => d3timeWeek(x),\n x: d3scaleTime().domain([d3timeWeek.offset(startDate, -1), d3timeWeek.offset(endDate, 2)]),\n xUnits: d3timeWeeks,\n };\n case 'year':\n return {\n group: (g: Date) => d3timeYear(g),\n round: (x: Date) => d3timeYear(x),\n x: d3scaleTime().domain([d3timeYear.offset(startDate, -2), d3timeYear.offset(endDate, 2)]),\n xUnits: d3timeYears,\n };\n case 'month':\n default:\n return {\n group: (g: Date) => d3timeMonth(g),\n round: (x: Date) => d3timeMonth(x),\n x: d3scaleTime().domain([d3timeMonth.offset(startDate, -1), d3timeMonth.offset(endDate, 2)]),\n xUnits: d3timeMonths,\n };\n }\n};\n\nexport const TimeSeriesBarChart: Comp<TimeSeriesBarChartProps, HTMLDivElement> = forwardRef((props, ref) => {\n const containerRef = (ref || useRef<HTMLDivElement>()) as RefObject<HTMLDivElement>;\n const chartRef = useRef<HTMLDivElement>() as RefObject<HTMLDivElement>;\n\n const [id] = useId();\n const [chart, setChart] = useState<dcBarChart>();\n\n const {\n areXLabelsRotated,\n caption,\n className,\n colorTheme = props.stackedCategory ? TimeSeriesBarChartTheme.default : TimeSeriesBarChartTheme.monochrome,\n columnToFilter,\n data: propsData,\n dateTimeFieldName,\n dateTimeFormat = '%Y-%m-%d %H:%M:%S',\n dateTimeGroup = 'month',\n dimension,\n isResetable = true,\n localeText,\n onFilter,\n size = TimeSeriesBarChartSize.medium,\n stackedCategory,\n title,\n xAxisLabel,\n yAxisLabel,\n ...forwardedProps\n } = props;\n const theme = useTheme();\n\n // Get overriden labels and texts.\n const { emptyChartTitle, emptyChartSubtitle, emptyChartResetLabel, resetLabel } = {\n resetLabel: 'Reset',\n ...localeText,\n };\n\n // Get charts dimensions based on the selected size.\n const chartDimensions = sizeToDimension(size!);\n\n // Get ndx from context or initialize it.\n const { dispatch, state, data } = useContext(DashboardContext);\n const { tableFilters } = state;\n\n // Set color scheme.\n const colorScale = useColor({\n data: propsData ?? data,\n colorTheme: colorTheme!,\n category: stackedCategory ?? '',\n theme,\n });\n\n const ndx = CrossfilterRegistry.get(propsData ? propsData : data);\n\n // useEffect called only once to initialize the chart.\n useEffect(() => {\n if (chartRef.current) {\n dcconfig.defaultColors(scheme.default);\n const parseTime = d3utcParse(dateTimeFormat!);\n const barChart = dcbarChart(chartRef.current as any);\n const dataset = ndx.all();\n\n // Get time methods based on props\n const { group, round, x, xUnits } = parseDateTimeGroup(dataset as JSONArray, dateTimeGroup, dateTimeFieldName);\n\n // Compute dimension and group.\n const computedDimension = ndx.dimension((d: JSONArray) => parseTime(dimension(d) as string) as Date);\n const timeGroup = computedDimension.group(group);\n\n // Initialize the chart.\n barChart\n .width(chartDimensions.width)\n .height(chartDimensions.height - (areXLabelsRotated ? 30 : 0))\n .dimension(computedDimension)\n .x(x)\n .xUnits(xUnits as dcUnitFunction)\n .round(round)\n .centerBar(true)\n .alwaysUseRounding(true)\n .renderHorizontalGridLines(true)\n .margins({\n left: chartDimensions.marginLeft! + (yAxisLabel ? 24 : 0),\n top: chartDimensions.marginTop!,\n right: chartDimensions.marginRight!,\n bottom: chartDimensions.marginBottom!,\n })\n .barPadding(0.2);\n\n barChart.yAxis().ticks(5);\n\n // Add label to axis.\n if (xAxisLabel) {\n barChart.xAxisLabel(xAxisLabel);\n }\n if (yAxisLabel) {\n barChart.yAxisLabel(yAxisLabel);\n }\n\n // Rotate labels and reset the height, if asked for.\n if (areXLabelsRotated) {\n barChart.on('pretransition', (rowChart) => {\n barChart\n .select('.axis')\n .attr('text-anchor', 'end')\n .selectAll('text')\n .attr('transform', 'translate(-6,5) rotate(-45)');\n rowChart.select('svg').attr('height', chartDimensions.height);\n });\n }\n\n // Set group whether the chart is stacked or not.\n if (!stackedCategory) {\n barChart.group(timeGroup).colors(colorScale as any);\n } else if (dataset.length) {\n if (!Array.isArray(dataset[0][stackedCategory])) {\n const categories = dataset.reduce((acc: string[], curr: JSONObject) => {\n if (acc.indexOf(curr[stackedCategory] as string) === -1) {\n acc.push(curr[stackedCategory] as string);\n }\n return acc;\n }, []);\n const stackedTimeGroup = timeGroup.reduce(\n (p, v) => {\n (p as JSONObject)[v[stackedCategory]] = (((p as JSONObject)[v[stackedCategory]] as number) || 0) + 1;\n return p;\n },\n (p, v) => {\n (p as JSONObject)[v[stackedCategory]] = (((p as JSONObject)[v[stackedCategory]] as number) || 0) - 1;\n return p;\n },\n () => ({})\n );\n barChart\n .group(\n stackedTimeGroup,\n categories[0], // @ts-expect-error\n (\n (cat) => (d: { key: Date; value: { [key: string]: number } }) =>\n d.value[cat]\n )(categories[0])\n )\n .colors(colorScale as any);\n for (var i = 1; i < categories.length; ++i) {\n barChart.stack(\n stackedTimeGroup,\n categories[i],\n (\n (cat) => (d) =>\n d.value[cat]\n )(categories[i])\n );\n }\n } else {\n const categories = dataset.reduce((acc: string[], curr: JSONObject) => {\n (curr[stackedCategory] as string[]).forEach((val: string) => {\n if (acc.indexOf(val) === -1) {\n acc.push(val);\n }\n });\n return acc;\n }, []);\n const stackedTimeGroup = timeGroup.reduce(\n (p, v) => {\n v[stackedCategory].forEach((val: string) => {\n (p as JSONObject)[val] = (((p as JSONObject)[val] as number) || 0) + 1;\n });\n return p;\n },\n (p, v) => {\n v[stackedCategory].forEach((val: string) => {\n (p as JSONObject)[val] = (((p as JSONObject)[val] as number) || 0) - 1;\n });\n return p;\n },\n () => ({})\n );\n barChart\n .group(\n stackedTimeGroup,\n categories[0], // @ts-expect-error\n (\n (cat) => (d: { key: Date; value: { [key: string]: number } }) =>\n d.value[cat]\n )(categories[0])\n )\n .colors(colorScale as any);\n for (var i = 1; i < categories.length; ++i) {\n barChart.stack(\n stackedTimeGroup,\n categories[i],\n (\n (cat) => (d: { key: Date; value: { [key: string]: number } }) =>\n d.value[cat]\n )(categories[i])\n );\n }\n }\n }\n\n // Dispatch filters to datagrid when a value is selected or unselected.\n const formatTime = d3timeFormat('%Y-%m-%dT%H:%M');\n barChart.on('filtered', () => {\n if (columnToFilter) {\n const dateArray = barChart.filters()?.[0];\n if (Array.isArray(dateArray) && dateArray.length === 2) {\n dispatch?.({\n type: DashboardReducerActionType.FilterTableBatch,\n filter: [\n {\n id: `${barChart.anchorName()}-start`,\n columnField: columnToFilter,\n operatorValue: 'after',\n value: formatTime(dateArray[0]),\n },\n {\n id: `${barChart.anchorName()}-end`,\n columnField: columnToFilter,\n operatorValue: 'onOrBefore',\n value: formatTime(dateArray[1]),\n },\n ],\n });\n }\n }\n\n onFilter?.(barChart.filters(), ndx.allFiltered());\n });\n\n // Render the chart.\n barChart.render();\n\n // Store chart for further use.\n setChart(barChart);\n }\n }, [propsData, data]);\n\n // Filter chart if context is updated by an external component.\n const filterStart = tableFilters.find(\n (filter) => filter.columnField === columnToFilter && filter.operatorValue === 'after'\n );\n const filterEnd = tableFilters.find(\n (filter) => filter.columnField === columnToFilter && filter.operatorValue === 'onOrBefore'\n );\n useEffect(() => {\n if (chart && filterStart && filterEnd && filterStart.value && filterEnd.value) {\n const chartFiltersObj = chart.filters();\n const chartFilters = chartFiltersObj?.[0];\n const chartFilterStart = chartFilters?.[0];\n const chartFilterEnd = chartFilters?.[1];\n if (chartFilterStart !== d3isoParse(filterStart.value) && chartFilterEnd !== d3isoParse(filterEnd.value)) {\n chart.filter(null);\n chart.filter(\n dcfilters.RangedFilter(\n d3isoParse(filterStart.value)?.getTime() || 0,\n d3isoParse(filterEnd.value)?.getTime() || 0\n )\n );\n dcredrawAll();\n }\n }\n }, [filterStart?.value, filterEnd?.value]);\n\n return (\n <StyledTimeSeriesBarChart\n {...forwardedProps}\n className={classNames(TimeSeriesBarChart.className, className)}\n ref={containerRef as RefObject<HTMLDivElement>}\n $theme={theme}\n >\n <StyledTimeSeriesBarChartTitle\n className={`${TimeSeriesBarChart.className}__title`}\n alignItems=\"center\"\n $theme={theme}\n >\n {title ? <div id={`id${id}__title`}>{title}</div> : null}\n {chart && isResetable ? (\n <Button\n variant=\"unstyled\"\n onClick={() => {\n chart.filter(null);\n dcredrawAll();\n\n if (columnToFilter) {\n dispatch?.({\n type: DashboardReducerActionType.ResetFilter,\n filter: {\n id: `${chart.anchorName()}-start`,\n columnField: columnToFilter,\n operatorValue: 'after',\n } as GridFilterItem,\n });\n dispatch?.({\n type: DashboardReducerActionType.ResetFilter,\n filter: {\n id: `${chart.anchorName()}-end`,\n columnField: columnToFilter,\n operatorValue: 'onOrBefore',\n } as GridFilterItem,\n });\n }\n }}\n >\n {resetLabel}\n </Button>\n ) : null}\n </StyledTimeSeriesBarChartTitle>\n\n <StyledTimeSeriesBarChartContainer\n className={`${TimeSeriesBarChart.className}__container`}\n $isEmpty={ndx.all().length === 0}\n >\n <div\n className={`${TimeSeriesBarChart.className}-container__chart`}\n ref={chartRef as RefObject<HTMLDivElement>}\n />\n {ndx.all().length === 0 ? (\n <ChartEmptyState\n title={emptyChartTitle!}\n subtitle={emptyChartSubtitle}\n resetLabel={emptyChartResetLabel}\n onReset={() => {\n dcfilterAll();\n dcredrawAll();\n dispatch?.({\n type: DashboardReducerActionType.ResetFilters,\n });\n }}\n />\n ) : null}\n </StyledTimeSeriesBarChartContainer>\n\n {caption ? (\n <StyledTimeSeriesBarChartCaption\n className={`${TimeSeriesBarChart.className}__caption`}\n id={`id${id}__caption`}\n $theme={theme}\n >\n {caption}\n </StyledTimeSeriesBarChartCaption>\n ) : null}\n </StyledTimeSeriesBarChart>\n );\n});\nTimeSeriesBarChart.className = CLASSNAME;\nTimeSeriesBarChart.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getStartDate","dates","Date","Math","min","map","Number","getEndDate","max","sizeToDimension","size","TimeSeriesBarChartSize","small","width","height","marginLeft","marginTop","marginRight","marginBottom","large","medium","parseDateTimeGroup","data","dateTimeGroup","dateTimeFieldName","d","startDate","endDate","group","g","d3timeHour","round","x","d3scaleTime","domain","offset","xUnits","d3timeHours","d3timeDay","d3timeDays","d3timeWeek","d3timeWeeks","d3timeYear","d3timeYears","d3timeMonth","d3timeMonths","TimeSeriesBarChart","forwardRef","props","ref","containerRef","useRef","chartRef","id","useId","chart","setChart","useState","areXLabelsRotated","caption","className","colorTheme","stackedCategory","TimeSeriesBarChartTheme","default","monochrome","columnToFilter","propsData","dateTimeFormat","dimension","isResetable","localeText","onFilter","title","xAxisLabel","yAxisLabel","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","emptyChartTitle","emptyChartSubtitle","emptyChartResetLabel","resetLabel","_objectSpread","chartDimensions","dispatch","state","useContext","DashboardContext","tableFilters","colorScale","useColor","category","ndx","CrossfilterRegistry","get","useEffect","current","dcconfig","defaultColors","scheme","parseTime","d3utcParse","barChart","dcbarChart","dataset","all","computedDimension","timeGroup","centerBar","alwaysUseRounding","renderHorizontalGridLines","margins","left","top","right","bottom","barPadding","yAxis","ticks","on","rowChart","select","attr","selectAll","colors","length","Array","isArray","categories","reduce","acc","curr","indexOf","push","stackedTimeGroup","p","v","cat","value","i","stack","forEach","val","formatTime","d3timeFormat","_barChart$filters","dateArray","filters","type","DashboardReducerActionType","FilterTableBatch","filter","anchorName","columnField","operatorValue","allFiltered","render","filterStart","find","filterEnd","chartFiltersObj","chartFilters","chartFilterStart","chartFilterEnd","d3isoParse","_d3isoParse","_d3isoParse2","dcfilters","RangedFilter","getTime","dcredrawAll","React","createElement","StyledTimeSeriesBarChart","_extends","classNames","$theme","StyledTimeSeriesBarChartTitle","alignItems","Button","variant","onClick","ResetFilter","StyledTimeSeriesBarChartContainer","$isEmpty","ChartEmptyState","subtitle","onReset","dcfilterAll","ResetFilters","StyledTimeSeriesBarChartCaption","displayName"],"mappings":";;;;;;;;;;;;;;;AA8CA,MAAMA,cAAc,GAAG,oBAAoB,CAAA;AAC3C,MAAMC,SAAS,GAAG,6BAA6B,CAAA;AAW/C,MAAMC,YAAY,GAAIC,KAAa,IAAK,IAAIC,IAAI,CAACC,IAAI,CAACC,GAAG,CAAC,GAAGH,KAAK,CAACI,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAAA;AAChF,MAAMC,UAAU,GAAIN,KAAa,IAAK,IAAIC,IAAI,CAACC,IAAI,CAACK,GAAG,CAAC,GAAGP,KAAK,CAACI,GAAG,CAACC,MAAM,CAAC,CAAC,CAAC,CAAA;AAE9E,MAAMG,eAAe,GAAIC,IAA4B,IAAsB;AACzE,EAAA,QAAQA,IAAI;IACV,KAAKC,sBAAsB,CAACC,KAAK;MAC/B,OAAO;AACLC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AAA,CAACa,eAAe,EAAA;AACdnH,IAAAA,KAAK,EAAEQ,eAAiB;AACxB4G,IAAAA,QAAQ,EAAE3G,kBAAmB;AAC7BE,IAAAA,UAAU,EAAED,oBAAqB;IACjC2G,OAAO,EAAEA,MAAM;AACbC,MAAAA,SAAW,EAAE,CAAA;AACblB,MAAAA,SAAW,EAAE,CAAA;AACbtF,MAAAA,QAAQ,KAARA,IAAAA,IAAAA,QAAQ,KAARA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAG;QACTgE,IAAI,EAAEC,0BAA0B,CAACwC,YAAAA;AACnC,OAAC,CAAC,CAAA;AACJ,KAAA;GACD,CAAC,GACA,IAC6B,CAAC,EAEnCrI,OAAO,gBACNmH,KAAA,CAAAC,aAAA,CAACkB,+BAA+B,EAAA;AAC9BrI,IAAAA,SAAS,EAAG,CAAA,EAAEd,kBAAkB,CAACc,SAAU,CAAW,SAAA,CAAA;IACtDP,EAAE,EAAG,CAAIA,EAAAA,EAAAA,EAAG,CAAW,SAAA,CAAA;AACvB8H,IAAAA,MAAM,EAAEpG,KAAAA;AAAM,GAAA,EAEbpB,OAC8B,CAAC,GAChC,IACoB,CAAC,CAAA;AAE/B,CAAC,EAAC;AACFb,kBAAkB,CAACc,SAAS,GAAG7D,SAAS,CAAA;AACxC+C,kBAAkB,CAACoJ,WAAW,GAAGpM,cAAc;;;;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { Flexbox } from '@redsift/design-system';
|
|
3
|
+
|
|
4
|
+
// istanbul ignore file
|
|
5
|
+
/**
|
|
6
|
+
* Component style.
|
|
7
|
+
*/
|
|
8
|
+
const StyledTimeSeriesBarChart = styled.div`
|
|
9
|
+
margin: 16px;
|
|
10
|
+
padding: 16px;
|
|
11
|
+
|
|
12
|
+
text {
|
|
13
|
+
fill: ${_ref => {
|
|
14
|
+
let {
|
|
15
|
+
$theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
return `var(--redsift-color-${$theme}-components-text-primary)`;
|
|
18
|
+
}};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.redsift-timeseries-barchart__chart {
|
|
22
|
+
display: flex;
|
|
23
|
+
font-family: var(--redsift-typography-font-family-poppins);
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
margin: 8px 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
svg > g {
|
|
30
|
+
margin: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.grid-line,
|
|
34
|
+
.axis .grid-line,
|
|
35
|
+
.grid-line line,
|
|
36
|
+
.axis .grid-line line {
|
|
37
|
+
fill: none;
|
|
38
|
+
stroke: #ccc;
|
|
39
|
+
shape-rendering: crispEdges;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.axis text {
|
|
43
|
+
font-family: var(--redsift-typography-font-family-poppins);
|
|
44
|
+
font-size: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
g.stack rect.bar.deselected {
|
|
48
|
+
fill-opacity: 0.5;
|
|
49
|
+
fill: var(--redsift-color-neutral-mid-grey);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.brush .custom-brush-handle {
|
|
53
|
+
fill: #eee;
|
|
54
|
+
stroke: #666;
|
|
55
|
+
cursor: ew-resize;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
text {
|
|
59
|
+
user-select: none;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
const StyledTimeSeriesBarChartTitle = styled(Flexbox)`
|
|
63
|
+
font-family: var(--redsift-typography-h4-font-family);
|
|
64
|
+
font-size: var(--redsift-typography-h4-font-size);
|
|
65
|
+
font-weight: var(--redsift-typography-h4-font-weight);
|
|
66
|
+
line-height: var(--redsift-typography-h4-line-height);
|
|
67
|
+
`;
|
|
68
|
+
const StyledTimeSeriesBarChartCaption = styled.p`
|
|
69
|
+
font-family: var(--redsift-typography-caption-font-family);
|
|
70
|
+
font-size: var(--redsift-typography-caption-font-size);
|
|
71
|
+
font-weight: var(--redsift-typography-caption-font-weight);
|
|
72
|
+
line-height: var(--redsift-typography-caption-line-height);
|
|
73
|
+
`;
|
|
74
|
+
const StyledTimeSeriesBarChartContainer = styled.div`
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 16px;
|
|
78
|
+
font-family: var(--redsift-typography-font-family-poppins);
|
|
79
|
+
font-size: 11px;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
margin: 8px 0;
|
|
82
|
+
position: relative;
|
|
83
|
+
|
|
84
|
+
.redsift-timeseries-barchart-container__chart {
|
|
85
|
+
position: relative;
|
|
86
|
+
${_ref2 => {
|
|
87
|
+
let {
|
|
88
|
+
$isEmpty
|
|
89
|
+
} = _ref2;
|
|
90
|
+
return $isEmpty ? css`
|
|
91
|
+
display: none;
|
|
92
|
+
` : '';
|
|
93
|
+
}};
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
export { StyledTimeSeriesBarChart, StyledTimeSeriesBarChartCaption, StyledTimeSeriesBarChartContainer, StyledTimeSeriesBarChartTitle };
|
|
98
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../src/components/TimeSeriesBarChart/styles.ts"],"sourcesContent":["// istanbul ignore file\n\nimport styled, { css } from 'styled-components';\nimport { Flexbox } from '@redsift/design-system';\nimport { StyledTimeSeriesBarChartProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledTimeSeriesBarChart = styled.div<StyledTimeSeriesBarChartProps>`\n margin: 16px;\n padding: 16px;\n\n text {\n fill: ${({ $theme }) => `var(--redsift-color-${$theme}-components-text-primary)`};\n }\n\n .redsift-timeseries-barchart__chart {\n display: flex;\n font-family: var(--redsift-typography-font-family-poppins);\n font-size: 12px;\n justify-content: center;\n margin: 8px 0;\n }\n\n svg > g {\n margin: 8px;\n }\n\n .grid-line,\n .axis .grid-line,\n .grid-line line,\n .axis .grid-line line {\n fill: none;\n stroke: #ccc;\n shape-rendering: crispEdges;\n }\n\n .axis text {\n font-family: var(--redsift-typography-font-family-poppins);\n font-size: 10px;\n }\n\n g.stack rect.bar.deselected {\n fill-opacity: 0.5;\n fill: var(--redsift-color-neutral-mid-grey);\n }\n\n .brush .custom-brush-handle {\n fill: #eee;\n stroke: #666;\n cursor: ew-resize;\n }\n\n text {\n user-select: none;\n }\n`;\n\nexport const StyledTimeSeriesBarChartTitle = styled(Flexbox)<StyledTimeSeriesBarChartProps>`\n font-family: var(--redsift-typography-h4-font-family);\n font-size: var(--redsift-typography-h4-font-size);\n font-weight: var(--redsift-typography-h4-font-weight);\n line-height: var(--redsift-typography-h4-line-height);\n`;\n\nexport const StyledTimeSeriesBarChartCaption = styled.p<StyledTimeSeriesBarChartProps>`\n font-family: var(--redsift-typography-caption-font-family);\n font-size: var(--redsift-typography-caption-font-size);\n font-weight: var(--redsift-typography-caption-font-weight);\n line-height: var(--redsift-typography-caption-line-height);\n`;\n\nexport const StyledTimeSeriesBarChartContainer = styled.div<{\n $isEmpty: boolean;\n}>`\n display: flex;\n align-items: center;\n gap: 16px;\n font-family: var(--redsift-typography-font-family-poppins);\n font-size: 11px;\n justify-content: center;\n margin: 8px 0;\n position: relative;\n\n .redsift-timeseries-barchart-container__chart {\n position: relative;\n ${({ $isEmpty }) =>\n $isEmpty\n ? css`\n display: none;\n `\n : ''};\n }\n`;\n"],"names":["StyledTimeSeriesBarChart","styled","div","_ref","$theme","StyledTimeSeriesBarChartTitle","Flexbox","StyledTimeSeriesBarChartCaption","p","StyledTimeSeriesBarChartContainer","_ref2","$isEmpty","css"],"mappings":";;;AAAA;AAMA;AACA;AACA;AACaA,MAAAA,wBAAwB,GAAGC,MAAM,CAACC,GAAmC,CAAA;AAClF;AACA;AACA;AACA;AACA,UAAA,EAAYC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;EAAA,OAAM,CAAA,oBAAA,EAAsBC,MAAO,CAA0B,yBAAA,CAAA,CAAA;AAAA,CAAC,CAAA;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;MAEYC,6BAA6B,GAAGJ,MAAM,CAACK,OAAO,CAAiC,CAAA;AAC5F;AACA;AACA;AACA;AACA,EAAC;AAEYC,MAAAA,+BAA+B,GAAGN,MAAM,CAACO,CAAiC,CAAA;AACvF;AACA;AACA;AACA;AACA,EAAC;AAEYC,MAAAA,iCAAiC,GAAGR,MAAM,CAACC,GAErD,CAAA;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAA,EAAMQ,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,QAAAA;AAAS,GAAC,GAAAD,KAAA,CAAA;EAAA,OACbC,QAAQ,GACJC,GAAI,CAAA;AACd;AACA,UAAA,CAAW,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACb;AACA;;;;"}
|