@scality/core-ui 0.165.0 → 0.167.0
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/.storybook/preview.js +6 -4
- package/README.md +27 -80
- package/dist/components/barchart/BarChart.component.d.ts +5 -0
- package/dist/components/barchart/BarChart.component.d.ts.map +1 -1
- package/dist/components/barchart/BarChart.component.js +5 -0
- package/dist/components/barchartv2/Barchart.component.d.ts +19 -0
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.js +31 -5
- package/dist/components/barchartv2/ChartTooltip.d.ts +18 -0
- package/dist/components/barchartv2/ChartTooltip.d.ts.map +1 -0
- package/dist/components/barchartv2/ChartTooltip.js +31 -0
- package/dist/components/barchartv2/utils.d.ts +0 -7
- package/dist/components/barchartv2/utils.d.ts.map +1 -1
- package/dist/components/barchartv2/utils.js +1 -29
- package/dist/components/button/Button.component.d.ts +2 -1
- package/dist/components/button/Button.component.d.ts.map +1 -1
- package/dist/components/button/Button.component.js +2 -1
- package/dist/components/chartlegend/ChartLegend.d.ts +9 -0
- package/dist/components/chartlegend/ChartLegend.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +32 -9
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +3 -0
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +18 -2
- package/dist/components/constants.d.ts +2 -0
- package/dist/components/constants.d.ts.map +1 -1
- package/dist/components/constants.js +6 -0
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts +3 -1
- package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
- package/dist/components/constrainedtext/Constrainedtext.component.js +2 -2
- package/dist/components/date/FormattedDateTime.d.ts +2 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +10 -0
- package/dist/components/icon/Icon.component.d.ts +9 -11
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +2 -0
- package/dist/components/linetemporalchart/ChartUtil.d.ts +3 -2
- package/dist/components/linetemporalchart/ChartUtil.d.ts.map +1 -1
- package/dist/components/linetemporalchart/ChartUtil.js +24 -20
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts +4 -0
- package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -1
- package/dist/components/linetemporalchart/LineTemporalChart.component.js +4 -0
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts +4 -2
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +5 -7
- package/dist/components/text/Text.component.js +1 -1
- package/dist/components/toast/Toast.component.d.ts.map +1 -1
- package/dist/components/toast/Toast.component.js +24 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -11
- package/dist/next.d.ts +2 -0
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +1 -0
- package/jest.config.js +1 -0
- package/package.json +16 -38
- package/src/lib/components/barchart/BarChart.component.tsx +5 -0
- package/src/lib/components/barchartv2/Barchart.component.test.tsx +99 -1
- package/src/lib/components/barchartv2/Barchart.component.tsx +39 -11
- package/src/lib/components/barchartv2/ChartTooltip.tsx +76 -0
- package/src/lib/components/barchartv2/utils.ts +2 -33
- package/src/lib/components/button/Button.component.tsx +2 -1
- package/src/lib/components/chartlegend/ChartLegend.test.tsx +235 -0
- package/src/lib/components/chartlegend/ChartLegend.tsx +36 -8
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +67 -29
- package/src/lib/components/constants.ts +11 -0
- package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +5 -2
- package/src/lib/components/date/FormattedDateTime.tsx +15 -1
- package/src/lib/components/icon/Icon.component.tsx +12 -1
- package/src/lib/components/linetemporalchart/ChartUtil.test.ts +23 -35
- package/src/lib/components/linetemporalchart/ChartUtil.ts +32 -26
- package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +19 -15
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +13 -11
- package/src/lib/components/selectv2/selectv2.test.tsx +1 -1
- package/src/lib/components/text/Text.component.tsx +1 -1
- package/src/lib/components/toast/Toast.component.tsx +27 -19
- package/src/lib/components/toast/useMutationsHandler.test.tsx +22 -32
- package/src/lib/index.ts +6 -11
- package/src/lib/next.ts +2 -0
- package/stories/barchart.stories.tsx +1 -1
- package/stories/card.stories.tsx +7 -5
- package/stories/constrainedtext.stories.tsx +4 -1
- package/stories/controls.ts +19 -20
- package/stories/linecharttemporal.stories.tsx +1 -1
- package/stories/linetimeseriechart.stories.tsx +79 -25
- package/stories/navbar.stories.tsx +103 -0
- package/stories/tabsv2.stories.tsx +51 -56
- package/dist/components/areachart/AreaChart.component.d.ts +0 -13
- package/dist/components/areachart/AreaChart.component.d.ts.map +0 -1
- package/dist/components/areachart/AreaChart.component.js +0 -27
- package/dist/components/chips/Chips.component.d.ts +0 -21
- package/dist/components/chips/Chips.component.d.ts.map +0 -1
- package/dist/components/chips/Chips.component.js +0 -105
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts +0 -10
- package/dist/components/cloudprogressbar/CloudProgressBar.component.d.ts.map +0 -1
- package/dist/components/cloudprogressbar/CloudProgressBar.component.js +0 -38
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts +0 -9
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.d.ts.map +0 -1
- package/dist/components/collapsiblepanel/CollapsiblePanel.component.js +0 -44
- package/dist/components/linechart/LineChart.component.d.ts +0 -21
- package/dist/components/linechart/LineChart.component.d.ts.map +0 -1
- package/dist/components/linechart/LineChart.component.js +0 -109
- package/dist/components/multiselect/MultiSelect.component.d.ts +0 -28
- package/dist/components/multiselect/MultiSelect.component.d.ts.map +0 -1
- package/dist/components/multiselect/MultiSelect.component.js +0 -73
- package/dist/components/select/Select.component.d.ts +0 -14
- package/dist/components/select/Select.component.d.ts.map +0 -1
- package/dist/components/select/Select.component.js +0 -71
- package/dist/components/spacedbox/SpacedBox.d.ts +0 -34
- package/dist/components/spacedbox/SpacedBox.d.ts.map +0 -1
- package/dist/components/spacedbox/SpacedBox.js +0 -64
- package/dist/components/sparkline/SparkLine.component.d.ts +0 -18
- package/dist/components/sparkline/SparkLine.component.d.ts.map +0 -1
- package/dist/components/sparkline/SparkLine.component.js +0 -148
- package/dist/components/vegachart/VegaChart.component.d.ts +0 -13
- package/dist/components/vegachart/VegaChart.component.d.ts.map +0 -1
- package/dist/components/vegachart/VegaChart.component.js +0 -120
- package/plopfile.js +0 -38
- package/src/lib/components/areachart/AreaChart.component.tsx +0 -49
- package/src/lib/components/chips/Chips.component.tsx +0 -169
- package/src/lib/components/cloudprogressbar/CloudProgressBar.component.tsx +0 -105
- package/src/lib/components/collapsiblepanel/CollapsiblePanel.component.tsx +0 -77
- package/src/lib/components/linechart/LineChart.component.tsx +0 -152
- package/src/lib/components/multiselect/MultiSelect.component.tsx +0 -158
- package/src/lib/components/select/Select.component.tsx +0 -98
- package/src/lib/components/spacedbox/SpacedBox.ts +0 -116
- package/src/lib/components/sparkline/SparkLine.component.tsx +0 -176
- package/src/lib/components/vegachart/VegaChart.component.tsx +0 -146
- package/stories/areachart.stories.tsx +0 -120
- package/stories/chips.stories.tsx +0 -107
- package/stories/cloudprogressbar.stories.tsx +0 -93
- package/stories/collapsiblepanel.stories.tsx +0 -57
- package/stories/data/areachart.ts +0 -122
- package/stories/data/sparklinechart.ts +0 -164
- package/stories/linechart.stories.tsx +0 -319
- package/stories/multiselect.stories.tsx +0 -126
- package/stories/select.stories.tsx +0 -52
- package/stories/sparkline.stories.tsx +0 -85
- package/stories/vegachart.stories.tsx +0 -98
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { spacing } from '../../spacing';
|
|
4
|
-
import { fontSize } from '../../style/theme';
|
|
5
|
-
import { Icon } from '../icon/Icon.component';
|
|
6
|
-
const ARROW = {
|
|
7
|
-
colapsed: 'fas fa-angle-down',
|
|
8
|
-
expanded: 'fas fa-angle-up',
|
|
9
|
-
};
|
|
10
|
-
const HeaderText = styled.div `
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
flex-grow: 1;
|
|
14
|
-
`;
|
|
15
|
-
const HeaderItem = styled.div `
|
|
16
|
-
margin-right: ${spacing.r16};
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-grow: 1;
|
|
19
|
-
`;
|
|
20
|
-
const HeaderIcon = styled.div `
|
|
21
|
-
font-size: ${fontSize.larger};
|
|
22
|
-
margin: 0 ${spacing.r16};
|
|
23
|
-
`;
|
|
24
|
-
const CollapsiblePanelContainer = styled.div `
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
border-radius: 4px;
|
|
28
|
-
background-color: ${(props) => props.theme.backgroundLevel1};
|
|
29
|
-
color: ${(props) => props.theme.textPrimary};
|
|
30
|
-
`;
|
|
31
|
-
const HeaderContainer = styled.div `
|
|
32
|
-
display: flex;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
padding: ${spacing.r16};
|
|
35
|
-
`;
|
|
36
|
-
const ExpandedContainer = styled.div `
|
|
37
|
-
padding: ${spacing.r16};
|
|
38
|
-
color: ${(props) => props.theme.textPrimary};
|
|
39
|
-
background-color: ${(props) => props.theme.backgroundLevel1};
|
|
40
|
-
`;
|
|
41
|
-
function CollapsiblePanel({ expanded = false, onHeaderClick, children, headerItems = [], }) {
|
|
42
|
-
return (_jsxs(CollapsiblePanelContainer, { className: "sc-collapsiblepanel", children: [_jsxs(HeaderContainer, { onClick: onHeaderClick, className: "sc-collapsiblepanel-header", children: [_jsx(HeaderText, { children: headerItems.map((item, index) => (_jsx(HeaderItem, { children: item }, index))) }), _jsx(HeaderIcon, { children: _jsx(Icon, { name: expanded ? 'Dropdown-up' : 'Dropdown-down' }) })] }), expanded && (_jsx(ExpandedContainer, { className: "sc-collapsiblepanel-content", children: children }))] }));
|
|
43
|
-
}
|
|
44
|
-
export { CollapsiblePanel };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { $PropertyType } from 'utility-types';
|
|
2
|
-
import type { Encoding, Field } from 'vega-lite';
|
|
3
|
-
type Props = {
|
|
4
|
-
id: string;
|
|
5
|
-
data: Array<Record<string, any>>;
|
|
6
|
-
xAxis: Record<string, any>;
|
|
7
|
-
yAxis: Array<Record<string, any>>;
|
|
8
|
-
color?: Record<string, any>;
|
|
9
|
-
tooltip?: boolean;
|
|
10
|
-
lineConfig?: Record<string, any>;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
displayTrendLine?: boolean;
|
|
14
|
-
strokeDashEncodingConfig?: $PropertyType<Encoding<Field>, 'strokeDash'>;
|
|
15
|
-
opacityEncodingConfig?: $PropertyType<Encoding<Field>, 'opacity'>;
|
|
16
|
-
tooltipConfig?: $PropertyType<Encoding<Field>, 'tooltip'>;
|
|
17
|
-
tooltipTheme?: 'light' | 'dark' | 'custom';
|
|
18
|
-
};
|
|
19
|
-
declare function LineChart({ id, data, xAxis, yAxis, color, tooltip, lineConfig, height, width, displayTrendLine, strokeDashEncodingConfig, opacityEncodingConfig, tooltipConfig, tooltipTheme, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export { LineChart };
|
|
21
|
-
//# sourceMappingURL=LineChart.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linechart/LineChart.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACjD,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wBAAwB,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC;IACxE,qBAAqB,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;IAClE,aAAa,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC5C,CAAC;AAEF,iBAAS,SAAS,CAAC,EACjB,EAAE,EACF,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAe,EACf,UAAU,EACV,MAAY,EACZ,KAAY,EACZ,gBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,GAAG,IAAI,EACR,EAAE,KAAK,2CAgHP;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { VegaChart } from '../vegachart/VegaChart.component';
|
|
3
|
-
function LineChart({ id, data, xAxis, yAxis, color, tooltip = false, lineConfig, height = 300, width = 1000, displayTrendLine = false, strokeDashEncodingConfig, opacityEncodingConfig, tooltipConfig, tooltipTheme, ...rest }) {
|
|
4
|
-
// hardcode the trendline configuration for tooltip
|
|
5
|
-
const trendline = {
|
|
6
|
-
mark: 'rule',
|
|
7
|
-
selection: {
|
|
8
|
-
index: {
|
|
9
|
-
type: 'single',
|
|
10
|
-
on: 'mousemove',
|
|
11
|
-
encodings: ['x'],
|
|
12
|
-
nearest: true,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
encoding: {
|
|
16
|
-
color: {
|
|
17
|
-
condition: {
|
|
18
|
-
selection: {
|
|
19
|
-
not: 'index',
|
|
20
|
-
},
|
|
21
|
-
value: 'transparent',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
/*
|
|
27
|
-
** strokeDash encoding allows to define a field in data items that defines the line stroke dash property
|
|
28
|
-
** this would allow to get same color lines but having some dashed and some plains
|
|
29
|
-
** https://vega.github.io/vega-lite/docs/line.html#multi-series-line-chart-with-varying-dashes
|
|
30
|
-
*/
|
|
31
|
-
/*
|
|
32
|
-
** opacity Encoding allows to define rules for each line's opacity
|
|
33
|
-
*/
|
|
34
|
-
const lines = yAxis.map((y) => ({
|
|
35
|
-
mark: {
|
|
36
|
-
type: 'line',
|
|
37
|
-
...lineConfig,
|
|
38
|
-
},
|
|
39
|
-
encoding: {
|
|
40
|
-
y,
|
|
41
|
-
strokeDash: strokeDashEncodingConfig,
|
|
42
|
-
opacity: opacityEncodingConfig,
|
|
43
|
-
},
|
|
44
|
-
}));
|
|
45
|
-
const currentTimeTrendline = {
|
|
46
|
-
mark: {
|
|
47
|
-
type: 'rule',
|
|
48
|
-
style: 'ruleCurrentTime',
|
|
49
|
-
color: 'white',
|
|
50
|
-
opacity: 0.2,
|
|
51
|
-
},
|
|
52
|
-
encoding: {
|
|
53
|
-
x: {
|
|
54
|
-
value: width / 2,
|
|
55
|
-
},
|
|
56
|
-
y: {
|
|
57
|
-
value: height,
|
|
58
|
-
},
|
|
59
|
-
y2: {
|
|
60
|
-
value: 0,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const topTrendline = {
|
|
65
|
-
mark: {
|
|
66
|
-
type: 'rule',
|
|
67
|
-
style: 'ruleTop',
|
|
68
|
-
color: 'orange',
|
|
69
|
-
opacity: 0.2,
|
|
70
|
-
},
|
|
71
|
-
encoding: {
|
|
72
|
-
y: {
|
|
73
|
-
aggregate: 'max',
|
|
74
|
-
field: 'capacity',
|
|
75
|
-
type: 'quantitative',
|
|
76
|
-
},
|
|
77
|
-
x: {
|
|
78
|
-
value: 0,
|
|
79
|
-
},
|
|
80
|
-
x2: {
|
|
81
|
-
value: width,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
const spec = {
|
|
86
|
-
data: {
|
|
87
|
-
values: data,
|
|
88
|
-
},
|
|
89
|
-
encoding: {
|
|
90
|
-
x: xAxis,
|
|
91
|
-
color,
|
|
92
|
-
// To disable tooltips for a particular single view specification, you can set the "tooltip" property of a mark definition block to null.
|
|
93
|
-
tooltip: tooltip ? [xAxis, ...yAxis] : null,
|
|
94
|
-
},
|
|
95
|
-
height,
|
|
96
|
-
width,
|
|
97
|
-
layer: [...lines],
|
|
98
|
-
...rest,
|
|
99
|
-
};
|
|
100
|
-
if (tooltip) {
|
|
101
|
-
spec.layer.push(tooltipConfig || trendline);
|
|
102
|
-
}
|
|
103
|
-
if (displayTrendLine) {
|
|
104
|
-
spec.layer.push(currentTimeTrendline);
|
|
105
|
-
spec.layer.push(topTrendline);
|
|
106
|
-
}
|
|
107
|
-
return (_jsx(VegaChart, { id: id, spec: spec, theme: tooltipTheme || 'light' }));
|
|
108
|
-
}
|
|
109
|
-
export { LineChart };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type ItemProps = {
|
|
2
|
-
selected?: boolean;
|
|
3
|
-
label: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
onSelect?: (arg0: any, arg1: any) => void;
|
|
6
|
-
onItemRemove?: (arg0: any, arg1: any) => void;
|
|
7
|
-
};
|
|
8
|
-
export type OptionProps = {
|
|
9
|
-
label: string;
|
|
10
|
-
value: string | number;
|
|
11
|
-
};
|
|
12
|
-
export type SearchProps = {
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
options: Array<OptionProps>;
|
|
15
|
-
onSelect: (arg0: any) => void;
|
|
16
|
-
onAdd?: (arg0: any) => void;
|
|
17
|
-
selectedOption: any;
|
|
18
|
-
};
|
|
19
|
-
type MultiSelectProps = {
|
|
20
|
-
title?: string;
|
|
21
|
-
items: Array<ItemProps>;
|
|
22
|
-
search?: SearchProps;
|
|
23
|
-
onItemRemove?: (arg0: any, arg1: any) => void;
|
|
24
|
-
};
|
|
25
|
-
declare function MultiSelectList({ title, items, search, onItemRemove, }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export declare const MultiSelect: typeof MultiSelectList;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=MultiSelect.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/multiselect/MultiSelect.component.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAE1C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/C,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAE5B,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAE9B,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,cAAc,EAAE,GAAG,CAAC;CACrB,CAAC;AACF,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/C,CAAC;AAqGF,iBAAS,eAAe,CAAC,EACvB,KAAU,EACV,KAAU,EACV,MAAM,EACN,YAAY,GACb,EAAE,gBAAgB,2CAclB;AAED,eAAO,MAAM,WAAW,wBAAkB,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { spacing } from '../../spacing';
|
|
4
|
-
import { fontSize, fontWeight } from '../../style/theme';
|
|
5
|
-
import { getThemePropSelector } from '../../utils';
|
|
6
|
-
import { Icon } from '../icon/Icon.component';
|
|
7
|
-
import { Button } from './../button/Button.component';
|
|
8
|
-
import { Checkbox } from './../checkbox/Checkbox.component';
|
|
9
|
-
import { Select } from './../select/Select.component';
|
|
10
|
-
const MultiSelectContainer = styled.div `
|
|
11
|
-
color: ${getThemePropSelector('textPrimary')};
|
|
12
|
-
`;
|
|
13
|
-
const MultiSelectTitle = styled.h3 `
|
|
14
|
-
padding: ${spacing.r16} 0;
|
|
15
|
-
margin: 0;
|
|
16
|
-
font-weight: ${fontWeight.bold};
|
|
17
|
-
font-size: ${fontSize.large};
|
|
18
|
-
`;
|
|
19
|
-
const MultiSelectItemContainer = styled.div `
|
|
20
|
-
margin: ${spacing.r4} 0;
|
|
21
|
-
padding: ${spacing.r8} 0;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
border-bottom: 1px solid gray;
|
|
25
|
-
&:last-child {
|
|
26
|
-
border: none;
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
const MultiSelectSearchContainer = styled.div `
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
.sc-select-container {
|
|
33
|
-
width: 100%;
|
|
34
|
-
}
|
|
35
|
-
.sc-button {
|
|
36
|
-
margin: 0 ${spacing.r8};
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
const MultiSelectItemLeft = styled.div `
|
|
40
|
-
.sc-checkbox,
|
|
41
|
-
.sc-button {
|
|
42
|
-
margin: 0 ${spacing.r8};
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
const MultiSelectItemCenter = styled.div `
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-grow: 1;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: space-between;
|
|
50
|
-
`;
|
|
51
|
-
const MultiSelectItemRight = styled.div `
|
|
52
|
-
padding: 0 ${spacing.r16};
|
|
53
|
-
`;
|
|
54
|
-
const MultiSelectItemLabel = styled.span `
|
|
55
|
-
font-size: ${fontSize.large};
|
|
56
|
-
`;
|
|
57
|
-
const MultiSelectItemDescription = styled.span ``;
|
|
58
|
-
function MultiSelectItem(props) {
|
|
59
|
-
const { selected, label, description, onItemRemove, onSelect } = props;
|
|
60
|
-
return (_jsxs(MultiSelectItemContainer, { className: "sc-multi-select-item", children: [_jsx(MultiSelectItemLeft, { className: "sc-multi-select-item-left", children: typeof selected === 'boolean' && onSelect && (_jsx(Checkbox, { checked: selected, onChange: (event) => onSelect(label, event) })) }), _jsxs(MultiSelectItemCenter, { className: "sc-multi-select-item-center", children: [_jsx(MultiSelectItemLabel, { className: "sc-multi-select-item-label", children: label }), description && (_jsx(MultiSelectItemDescription, { className: "sc-multi-select-item-description", children: description }))] }), _jsx(MultiSelectItemRight, { className: "sc-multi-select-item-right", children: onItemRemove && (_jsx(Button, { inverted: true, variant: "buttonDelete", onClick: (event) => onItemRemove(label, event), icon: _jsx(Icon, { name: "Delete" }) })) })] }));
|
|
61
|
-
}
|
|
62
|
-
function MultiSelectSearch(props) {
|
|
63
|
-
const { selectedOption, onSelect, onAdd, ...rest } = props;
|
|
64
|
-
return (_jsxs(MultiSelectSearchContainer, { className: "sc-multi-select-list-search", children: [_jsx(Select
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
, {
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
onChange: onSelect, value: selectedOption, ...rest }), onAdd && _jsx(Button, { onClick: onAdd, icon: _jsx(Icon, { name: "Create-add" }) })] }));
|
|
69
|
-
}
|
|
70
|
-
function MultiSelectList({ title = '', items = [], search, onItemRemove, }) {
|
|
71
|
-
return (_jsxs(MultiSelectContainer, { className: "sc-multi-select-list", children: [title && _jsx(MultiSelectTitle, { children: title }), search && _jsx(MultiSelectSearch, { ...search }), items.map((item, index) => (_jsx(MultiSelectItem, { onItemRemove: onItemRemove, ...item }, `sc-multi-select-item-${index}`)))] }));
|
|
72
|
-
}
|
|
73
|
-
export const MultiSelect = MultiSelectList;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Item = {
|
|
2
|
-
label: string;
|
|
3
|
-
value: string | number;
|
|
4
|
-
};
|
|
5
|
-
type Items = Array<Item>;
|
|
6
|
-
type Props = {
|
|
7
|
-
id?: any;
|
|
8
|
-
options: Items;
|
|
9
|
-
formatOptionLabel?: (arg0: any) => JSX.Element;
|
|
10
|
-
};
|
|
11
|
-
declare function SelectBox({ options, formatOptionLabel, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare const Select: typeof SelectBox;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=Select.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/select/Select.component.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK,KAAK,GAAG;IACX,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,KAAK,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,OAAO,CAAC;CAChD,CAAC;AAqEF,iBAAS,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,2CAYhE;AAED,eAAO,MAAM,MAAM,kBAAY,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactSelect from 'react-select';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { fontSize, fontWeight, gray, zIndex } from '../../style/theme';
|
|
5
|
-
import { getThemePropSelector } from '../../utils';
|
|
6
|
-
const SelectContainer = styled.div `
|
|
7
|
-
font-size: ${fontSize.base};
|
|
8
|
-
.sc-select__control {
|
|
9
|
-
background-color: ${getThemePropSelector('backgroundLevel1')};
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
border: 1px solid ${getThemePropSelector('border')};
|
|
12
|
-
height: auto;
|
|
13
|
-
|
|
14
|
-
.sc-select__placeholder,
|
|
15
|
-
.sc-select__single-value {
|
|
16
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
17
|
-
}
|
|
18
|
-
&.sc-select__control--is-focused {
|
|
19
|
-
border-color: ${getThemePropSelector('selectedActive')};
|
|
20
|
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
|
|
21
|
-
0 0 0 1px rgba(0, 126, 255, 0.1);
|
|
22
|
-
outline: none;
|
|
23
|
-
}
|
|
24
|
-
.sc-select__indicator {
|
|
25
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
26
|
-
&.sc-select__dropdown-indicator:hover {
|
|
27
|
-
color: ${getThemePropSelector('selectedActive')};
|
|
28
|
-
}
|
|
29
|
-
&.sc-select__clear-indicator:hover {
|
|
30
|
-
color: ${gray};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
.sc-select__multi-value__remove {
|
|
34
|
-
border-radius: 0;
|
|
35
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
36
|
-
background-color: ${getThemePropSelector('backgroundLevel4')};
|
|
37
|
-
&:hover {
|
|
38
|
-
color: ${gray};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
.sc-select__multi-value__label {
|
|
42
|
-
border-radius: 0;
|
|
43
|
-
color: ${getThemePropSelector('selectedActive')};
|
|
44
|
-
background-color: ${getThemePropSelector('backgroundLevel4')};
|
|
45
|
-
vertical-align: initial;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
.sc-select__menu {
|
|
49
|
-
background-color: ${getThemePropSelector('backgroundLevel1')};
|
|
50
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
51
|
-
border: 1px solid ${getThemePropSelector('selectedActive')};
|
|
52
|
-
box-sizing: border-box;
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
z-index: ${zIndex.dropdown};
|
|
55
|
-
.sc-select__option {
|
|
56
|
-
&.sc-select__option--is-focused {
|
|
57
|
-
background-color: ${getThemePropSelector('backgroundLevel1')};
|
|
58
|
-
}
|
|
59
|
-
&.sc-select__option--is-selected {
|
|
60
|
-
background-color: ${getThemePropSelector('backgroundLevel1')};
|
|
61
|
-
color: ${getThemePropSelector('selectedActive')};
|
|
62
|
-
font-weight: ${fontWeight.bold};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
const defaultFormatOptionLabel = ({ label, ...rest }) => (_jsx("div", { className: "sc-select-option-label", ...rest, children: label }));
|
|
68
|
-
function SelectBox({ options, formatOptionLabel, ...rest }) {
|
|
69
|
-
return (_jsx(SelectContainer, { className: "sc-select-container", children: _jsx(ReactSelect, { className: "sc-select", classNamePrefix: "sc-select", options: options, formatOptionLabel: formatOptionLabel || defaultFormatOptionLabel, ...rest }) }));
|
|
70
|
-
}
|
|
71
|
-
export const Select = SelectBox;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
type SpacingValue = 0 | 1 | 2 | 4 | 8 | 12 | 14 | 16 | 20 | 24 | 28 | 32;
|
|
2
|
-
export type Props = {
|
|
3
|
-
m?: SpacingValue;
|
|
4
|
-
mt?: SpacingValue;
|
|
5
|
-
mr?: SpacingValue;
|
|
6
|
-
mb?: SpacingValue;
|
|
7
|
-
ml?: SpacingValue;
|
|
8
|
-
mx?: SpacingValue;
|
|
9
|
-
my?: SpacingValue;
|
|
10
|
-
p?: SpacingValue;
|
|
11
|
-
pt?: SpacingValue;
|
|
12
|
-
pr?: SpacingValue;
|
|
13
|
-
pb?: SpacingValue;
|
|
14
|
-
pl?: SpacingValue;
|
|
15
|
-
px?: SpacingValue;
|
|
16
|
-
py?: SpacingValue;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* Please use Box with import { Box } from '@scality/core-ui/dist/next';
|
|
21
|
-
*
|
|
22
|
-
* Most common use cases:
|
|
23
|
-
*
|
|
24
|
-
* `<SpacedBox m={14}><Component /></SpacedBox>`
|
|
25
|
-
*
|
|
26
|
-
* `<SpacedBox as={SpanComponent}><Component /></SpacedBox>`
|
|
27
|
-
*
|
|
28
|
-
* Props : m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py
|
|
29
|
-
*
|
|
30
|
-
* Values: 0, 1, 2, 4, 8, 12, 14, 16, 20, 24, 28, 32
|
|
31
|
-
*/
|
|
32
|
-
declare const SpacedBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Props, never>;
|
|
33
|
-
export { SpacedBox };
|
|
34
|
-
//# sourceMappingURL=SpacedBox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpacedBox.d.ts","sourceRoot":"","sources":["../../../src/lib/components/spacedbox/SpacedBox.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACzE,MAAM,MAAM,KAAK,GAAG;IAClB,CAAC,CAAC,EAAE,YAAY,CAAC;IACjB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,CAAC,CAAC,EAAE,YAAY,CAAC;IACjB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,EAAE,CAAC,EAAE,YAAY,CAAC;CACnB,CAAC;AAmEF;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,SAAS,4GAed,CAAC;AACF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { spacing } from '../../style/theme';
|
|
3
|
-
const validValue = [0, 1, 2, 4, 8, 12, 14, 16, 20, 24, 28, 32];
|
|
4
|
-
const createSpacingFn = (propsName, spacingFields) => (props) => {
|
|
5
|
-
if (!props[propsName] && props[propsName] !== 0) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
//@ts-ignore -- this is ensured below
|
|
9
|
-
let value = props[propsName];
|
|
10
|
-
if (!validValue.includes(value)) {
|
|
11
|
-
console.warn(`'${propsName}' props should be a number in this list: ` +
|
|
12
|
-
'0, 1, 2, 4, 8, 12, 14, 16, 20, 24, 28, 32');
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const result = spacingFields
|
|
16
|
-
.map((param) => `${param}: ${spacing[`sp${value}`]}`)
|
|
17
|
-
.join(';');
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
20
|
-
const m = createSpacingFn('m', ['margin']);
|
|
21
|
-
const mt = createSpacingFn('mt', ['margin-top']);
|
|
22
|
-
const mr = createSpacingFn('mr', ['margin-right']);
|
|
23
|
-
const mb = createSpacingFn('mb', ['margin-bottom']);
|
|
24
|
-
const ml = createSpacingFn('ml', ['margin-left']);
|
|
25
|
-
const mx = createSpacingFn('mx', ['margin-left', 'margin-right']);
|
|
26
|
-
const my = createSpacingFn('my', ['margin-top', 'margin-bottom']);
|
|
27
|
-
const p = createSpacingFn('p', ['padding']);
|
|
28
|
-
const pt = createSpacingFn('pt', ['padding-top']);
|
|
29
|
-
const pr = createSpacingFn('pr', ['padding-right']);
|
|
30
|
-
const pb = createSpacingFn('pb', ['padding-bottom']);
|
|
31
|
-
const pl = createSpacingFn('pl', ['padding-left']);
|
|
32
|
-
const px = createSpacingFn('px', ['padding-left', 'padding-right']);
|
|
33
|
-
const py = createSpacingFn('py', ['padding-top', 'padding-bottom']);
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated
|
|
36
|
-
* Please use Box with import { Box } from '@scality/core-ui/dist/next';
|
|
37
|
-
*
|
|
38
|
-
* Most common use cases:
|
|
39
|
-
*
|
|
40
|
-
* `<SpacedBox m={14}><Component /></SpacedBox>`
|
|
41
|
-
*
|
|
42
|
-
* `<SpacedBox as={SpanComponent}><Component /></SpacedBox>`
|
|
43
|
-
*
|
|
44
|
-
* Props : m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py
|
|
45
|
-
*
|
|
46
|
-
* Values: 0, 1, 2, 4, 8, 12, 14, 16, 20, 24, 28, 32
|
|
47
|
-
*/
|
|
48
|
-
const SpacedBox = styled.div `
|
|
49
|
-
${m};
|
|
50
|
-
${mt};
|
|
51
|
-
${mr};
|
|
52
|
-
${mb};
|
|
53
|
-
${ml};
|
|
54
|
-
${mx};
|
|
55
|
-
${my};
|
|
56
|
-
${p};
|
|
57
|
-
${pt};
|
|
58
|
-
${pr};
|
|
59
|
-
${pb};
|
|
60
|
-
${pl};
|
|
61
|
-
${px};
|
|
62
|
-
${py};
|
|
63
|
-
`;
|
|
64
|
-
export { SpacedBox };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
id: string;
|
|
3
|
-
title?: string;
|
|
4
|
-
width?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
data: Array<Record<string, any>>;
|
|
7
|
-
xAxis: Record<string, any>;
|
|
8
|
-
yAxis: Record<string, any>;
|
|
9
|
-
row: Record<string, any>;
|
|
10
|
-
lineConfig?: Record<string, any>;
|
|
11
|
-
sparkLineColor?: string;
|
|
12
|
-
upTrendColor?: string;
|
|
13
|
-
bottomTrendColor?: string;
|
|
14
|
-
};
|
|
15
|
-
declare function SparkLine({ id, title, width, height, data, xAxis, yAxis, row, lineConfig, sparkLineColor, upTrendColor, bottomTrendColor, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare const Sparkline: typeof SparkLine;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=SparkLine.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SparkLine.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/sparkline/SparkLine.component.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,iBAAS,SAAS,CAAC,EACjB,EAAE,EACF,KAAK,EACL,KAAW,EACX,MAAW,EACX,IAAI,EACJ,KAAK,EACL,KAAK,EACL,GAAG,EACH,UAAU,EACV,cAAc,EACd,YAA2B,EAC3B,gBAAwB,GACzB,EAAE,KAAK,2CA+IP;AAED,eAAO,MAAM,SAAS,kBAAY,CAAC"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { VegaChart } from '../vegachart/VegaChart.component';
|
|
3
|
-
import { yellowOrange, green } from '../../style/theme';
|
|
4
|
-
function SparkLine({ id, title, width = 300, height = 80, data, xAxis, yAxis, row, lineConfig, sparkLineColor, upTrendColor = yellowOrange, bottomTrendColor = green, }) {
|
|
5
|
-
const spec = {
|
|
6
|
-
title: {
|
|
7
|
-
text: title,
|
|
8
|
-
},
|
|
9
|
-
data: {
|
|
10
|
-
values: data,
|
|
11
|
-
},
|
|
12
|
-
facet: {
|
|
13
|
-
row,
|
|
14
|
-
},
|
|
15
|
-
spec: {
|
|
16
|
-
width,
|
|
17
|
-
height,
|
|
18
|
-
layer: [
|
|
19
|
-
// display the sparkline chart
|
|
20
|
-
{
|
|
21
|
-
mark: {
|
|
22
|
-
type: 'line',
|
|
23
|
-
...lineConfig,
|
|
24
|
-
},
|
|
25
|
-
encoding: {
|
|
26
|
-
x: xAxis,
|
|
27
|
-
y: yAxis,
|
|
28
|
-
color: {
|
|
29
|
-
value: sparkLineColor,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
}, // display the label to specify the max/min data
|
|
33
|
-
{
|
|
34
|
-
mark: {
|
|
35
|
-
type: 'text',
|
|
36
|
-
style: 'labelMin',
|
|
37
|
-
align: 'bottom',
|
|
38
|
-
dy: height / 2,
|
|
39
|
-
dx: width / 2 + 10,
|
|
40
|
-
},
|
|
41
|
-
encoding: {
|
|
42
|
-
text: {
|
|
43
|
-
aggregate: 'min',
|
|
44
|
-
field: 'y',
|
|
45
|
-
type: 'quantitative',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
mark: {
|
|
51
|
-
type: 'text',
|
|
52
|
-
style: 'labelMax',
|
|
53
|
-
align: 'top',
|
|
54
|
-
dy: -(height / 2),
|
|
55
|
-
dx: width / 2 + 10,
|
|
56
|
-
},
|
|
57
|
-
encoding: {
|
|
58
|
-
text: {
|
|
59
|
-
aggregate: 'max',
|
|
60
|
-
field: 'y',
|
|
61
|
-
type: 'quantitative',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
}, // display the up and bottom trend line
|
|
65
|
-
{
|
|
66
|
-
mark: {
|
|
67
|
-
type: 'rule',
|
|
68
|
-
style: 'ruleMaxEnd',
|
|
69
|
-
color: upTrendColor,
|
|
70
|
-
},
|
|
71
|
-
encoding: {
|
|
72
|
-
y: {
|
|
73
|
-
aggregate: 'max',
|
|
74
|
-
field: 'y',
|
|
75
|
-
type: 'quantitative',
|
|
76
|
-
},
|
|
77
|
-
x: {
|
|
78
|
-
value: width - 15,
|
|
79
|
-
},
|
|
80
|
-
x2: {
|
|
81
|
-
value: width,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
mark: {
|
|
87
|
-
type: 'rule',
|
|
88
|
-
style: 'ruleMaxStart',
|
|
89
|
-
color: upTrendColor,
|
|
90
|
-
opacity: 0.1,
|
|
91
|
-
},
|
|
92
|
-
encoding: {
|
|
93
|
-
y: {
|
|
94
|
-
aggregate: 'max',
|
|
95
|
-
field: 'y',
|
|
96
|
-
type: 'quantitative',
|
|
97
|
-
},
|
|
98
|
-
x: {
|
|
99
|
-
value: 0,
|
|
100
|
-
},
|
|
101
|
-
x2: {
|
|
102
|
-
value: width - 15,
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
mark: {
|
|
108
|
-
type: 'rule',
|
|
109
|
-
style: 'ruleMinEnd',
|
|
110
|
-
color: bottomTrendColor,
|
|
111
|
-
},
|
|
112
|
-
encoding: {
|
|
113
|
-
y: {
|
|
114
|
-
value: height,
|
|
115
|
-
},
|
|
116
|
-
x: {
|
|
117
|
-
value: width - 15,
|
|
118
|
-
},
|
|
119
|
-
x2: {
|
|
120
|
-
value: width,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
mark: {
|
|
126
|
-
type: 'rule',
|
|
127
|
-
style: 'ruleMinStart',
|
|
128
|
-
color: bottomTrendColor,
|
|
129
|
-
opacity: 0.1,
|
|
130
|
-
},
|
|
131
|
-
encoding: {
|
|
132
|
-
y: {
|
|
133
|
-
value: height,
|
|
134
|
-
},
|
|
135
|
-
x: {
|
|
136
|
-
value: 0,
|
|
137
|
-
},
|
|
138
|
-
x2: {
|
|
139
|
-
value: width - 15,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
return _jsx(VegaChart, { className: "sc-sparkline", id: id, spec: spec });
|
|
147
|
-
}
|
|
148
|
-
export const Sparkline = SparkLine;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const TOP = "top";
|
|
2
|
-
export declare const BOTTOM = "bottom";
|
|
3
|
-
type Position = typeof TOP | typeof BOTTOM;
|
|
4
|
-
type Props = {
|
|
5
|
-
id: string;
|
|
6
|
-
spec: Record<string, any>;
|
|
7
|
-
tooltipPosition?: Position;
|
|
8
|
-
theme?: 'light' | 'dark' | 'custom';
|
|
9
|
-
className?: string;
|
|
10
|
-
};
|
|
11
|
-
declare function VegaChart({ id, spec, tooltipPosition, theme, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export { VegaChart };
|
|
13
|
-
//# sourceMappingURL=VegaChart.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VegaChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/vegachart/VegaChart.component.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,KAAK,QAAQ,GAAG,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;AAC3C,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA0BF,iBAAS,SAAS,CAAC,EACjB,EAAE,EACF,IAAI,EACJ,eAAwB,EACxB,KAAgB,GACjB,EAAE,KAAK,2CAkGP;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|