@scality/core-ui 0.166.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/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.map +1 -1
- package/dist/components/chartlegend/ChartLegend.js +7 -13
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts +1 -2
- package/dist/components/chartlegend/ChartLegendWrapper.d.ts.map +1 -1
- package/dist/components/chartlegend/ChartLegendWrapper.js +4 -9
- 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 +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- 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 +1 -0
- package/dist/next.d.ts.map +1 -1
- package/jest.config.js +1 -0
- package/package.json +16 -37
- package/src/lib/components/barchart/BarChart.component.tsx +5 -0
- package/src/lib/components/button/Button.component.tsx +2 -1
- package/src/lib/components/chartlegend/ChartLegend.test.tsx +17 -0
- package/src/lib/components/chartlegend/ChartLegend.tsx +6 -12
- package/src/lib/components/chartlegend/ChartLegendWrapper.tsx +5 -13
- 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 +5 -5
- package/src/lib/components/selectv2/selectv2.test.tsx +1 -1
- package/src/lib/components/toast/useMutationsHandler.test.tsx +22 -32
- package/src/lib/index.ts +6 -11
- package/src/lib/next.ts +1 -0
- package/stories/barchart.stories.tsx +1 -1
- package/stories/card.stories.tsx +7 -5
- package/stories/controls.ts +19 -20
- package/stories/linecharttemporal.stories.tsx +1 -1
- package/stories/linetimeseriechart.stories.tsx +49 -0
- 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,176 +0,0 @@
|
|
|
1
|
-
import { VegaChart } from '../vegachart/VegaChart.component';
|
|
2
|
-
import { yellowOrange, green } from '../../style/theme';
|
|
3
|
-
type Props = {
|
|
4
|
-
id: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
width?: number;
|
|
7
|
-
height?: number;
|
|
8
|
-
data: Array<Record<string, any>>;
|
|
9
|
-
xAxis: Record<string, any>;
|
|
10
|
-
yAxis: Record<string, any>;
|
|
11
|
-
row: Record<string, any>;
|
|
12
|
-
lineConfig?: Record<string, any>;
|
|
13
|
-
sparkLineColor?: string;
|
|
14
|
-
upTrendColor?: string;
|
|
15
|
-
bottomTrendColor?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function SparkLine({
|
|
19
|
-
id,
|
|
20
|
-
title,
|
|
21
|
-
width = 300,
|
|
22
|
-
height = 80,
|
|
23
|
-
data,
|
|
24
|
-
xAxis,
|
|
25
|
-
yAxis,
|
|
26
|
-
row,
|
|
27
|
-
lineConfig,
|
|
28
|
-
sparkLineColor,
|
|
29
|
-
upTrendColor = yellowOrange,
|
|
30
|
-
bottomTrendColor = green,
|
|
31
|
-
}: Props) {
|
|
32
|
-
const spec = {
|
|
33
|
-
title: {
|
|
34
|
-
text: title,
|
|
35
|
-
},
|
|
36
|
-
data: {
|
|
37
|
-
values: data,
|
|
38
|
-
},
|
|
39
|
-
facet: {
|
|
40
|
-
row,
|
|
41
|
-
},
|
|
42
|
-
spec: {
|
|
43
|
-
width,
|
|
44
|
-
height,
|
|
45
|
-
layer: [
|
|
46
|
-
// display the sparkline chart
|
|
47
|
-
{
|
|
48
|
-
mark: {
|
|
49
|
-
type: 'line',
|
|
50
|
-
...lineConfig,
|
|
51
|
-
},
|
|
52
|
-
encoding: {
|
|
53
|
-
x: xAxis,
|
|
54
|
-
y: yAxis,
|
|
55
|
-
color: {
|
|
56
|
-
value: sparkLineColor,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}, // display the label to specify the max/min data
|
|
60
|
-
{
|
|
61
|
-
mark: {
|
|
62
|
-
type: 'text',
|
|
63
|
-
style: 'labelMin',
|
|
64
|
-
align: 'bottom',
|
|
65
|
-
dy: height / 2,
|
|
66
|
-
dx: width / 2 + 10,
|
|
67
|
-
},
|
|
68
|
-
encoding: {
|
|
69
|
-
text: {
|
|
70
|
-
aggregate: 'min',
|
|
71
|
-
field: 'y',
|
|
72
|
-
type: 'quantitative',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
mark: {
|
|
78
|
-
type: 'text',
|
|
79
|
-
style: 'labelMax',
|
|
80
|
-
align: 'top',
|
|
81
|
-
dy: -(height / 2),
|
|
82
|
-
dx: width / 2 + 10,
|
|
83
|
-
},
|
|
84
|
-
encoding: {
|
|
85
|
-
text: {
|
|
86
|
-
aggregate: 'max',
|
|
87
|
-
field: 'y',
|
|
88
|
-
type: 'quantitative',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
}, // display the up and bottom trend line
|
|
92
|
-
{
|
|
93
|
-
mark: {
|
|
94
|
-
type: 'rule',
|
|
95
|
-
style: 'ruleMaxEnd',
|
|
96
|
-
color: upTrendColor,
|
|
97
|
-
},
|
|
98
|
-
encoding: {
|
|
99
|
-
y: {
|
|
100
|
-
aggregate: 'max',
|
|
101
|
-
field: 'y',
|
|
102
|
-
type: 'quantitative',
|
|
103
|
-
},
|
|
104
|
-
x: {
|
|
105
|
-
value: width - 15,
|
|
106
|
-
},
|
|
107
|
-
x2: {
|
|
108
|
-
value: width,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
mark: {
|
|
114
|
-
type: 'rule',
|
|
115
|
-
style: 'ruleMaxStart',
|
|
116
|
-
color: upTrendColor,
|
|
117
|
-
opacity: 0.1,
|
|
118
|
-
},
|
|
119
|
-
encoding: {
|
|
120
|
-
y: {
|
|
121
|
-
aggregate: 'max',
|
|
122
|
-
field: 'y',
|
|
123
|
-
type: 'quantitative',
|
|
124
|
-
},
|
|
125
|
-
x: {
|
|
126
|
-
value: 0,
|
|
127
|
-
},
|
|
128
|
-
x2: {
|
|
129
|
-
value: width - 15,
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
mark: {
|
|
135
|
-
type: 'rule',
|
|
136
|
-
style: 'ruleMinEnd',
|
|
137
|
-
color: bottomTrendColor,
|
|
138
|
-
},
|
|
139
|
-
encoding: {
|
|
140
|
-
y: {
|
|
141
|
-
value: height,
|
|
142
|
-
},
|
|
143
|
-
x: {
|
|
144
|
-
value: width - 15,
|
|
145
|
-
},
|
|
146
|
-
x2: {
|
|
147
|
-
value: width,
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
mark: {
|
|
153
|
-
type: 'rule',
|
|
154
|
-
style: 'ruleMinStart',
|
|
155
|
-
color: bottomTrendColor,
|
|
156
|
-
opacity: 0.1,
|
|
157
|
-
},
|
|
158
|
-
encoding: {
|
|
159
|
-
y: {
|
|
160
|
-
value: height,
|
|
161
|
-
},
|
|
162
|
-
x: {
|
|
163
|
-
value: 0,
|
|
164
|
-
},
|
|
165
|
-
x2: {
|
|
166
|
-
value: width - 15,
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
return <VegaChart className="sc-sparkline" id={id} spec={spec}></VegaChart>;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export const Sparkline = SparkLine;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { useEffect, useContext, useRef } from 'react';
|
|
3
|
-
import vegaEmbed, { Result } from 'vega-embed';
|
|
4
|
-
import { ThemeContext, createGlobalStyle } from 'styled-components';
|
|
5
|
-
import { getThemePropSelector } from '../../utils';
|
|
6
|
-
export const TOP = 'top';
|
|
7
|
-
export const BOTTOM = 'bottom';
|
|
8
|
-
type Position = typeof TOP | typeof BOTTOM;
|
|
9
|
-
type Props = {
|
|
10
|
-
id: string;
|
|
11
|
-
spec: Record<string, any>;
|
|
12
|
-
tooltipPosition?: Position;
|
|
13
|
-
theme?: 'light' | 'dark' | 'custom';
|
|
14
|
-
className?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/* How to theme tooltip:
|
|
18
|
-
https://github.com/vega/vega-tooltip/blob/master/docs/customizing_your_tooltip.md
|
|
19
|
-
*/
|
|
20
|
-
const VegaTooltipTheme = createGlobalStyle`
|
|
21
|
-
#vg-tooltip-element.vg-tooltip.custom-theme {
|
|
22
|
-
padding: 8px;
|
|
23
|
-
position: fixed;
|
|
24
|
-
z-index: 1000;
|
|
25
|
-
font-family: 'Lato';
|
|
26
|
-
font-size: 12px;
|
|
27
|
-
border-radius: 3px;
|
|
28
|
-
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
|
|
29
|
-
color: ${getThemePropSelector('textPrimary')};
|
|
30
|
-
background-color: ${getThemePropSelector('backgroundLevel1')};
|
|
31
|
-
border: 1px solid ${getThemePropSelector('border')};
|
|
32
|
-
// customize the title
|
|
33
|
-
h2 {
|
|
34
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
35
|
-
margin-bottom: 10px;
|
|
36
|
-
font-size: 12px;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
function VegaChart({
|
|
42
|
-
id,
|
|
43
|
-
spec,
|
|
44
|
-
tooltipPosition = BOTTOM,
|
|
45
|
-
theme = 'custom',
|
|
46
|
-
}: Props) {
|
|
47
|
-
const themeContext = useContext(ThemeContext);
|
|
48
|
-
const currentBackgroundColor =
|
|
49
|
-
themeContext && themeContext.brand
|
|
50
|
-
? themeContext.brand.backgroundLevel4
|
|
51
|
-
: themeContext.backgroundLevel4;
|
|
52
|
-
// the background color of the view
|
|
53
|
-
const currentBackgroundColor2 =
|
|
54
|
-
themeContext && themeContext.brand
|
|
55
|
-
? themeContext.brand.backgroundLevel1
|
|
56
|
-
: themeContext.backgroundLevel1;
|
|
57
|
-
const brandText =
|
|
58
|
-
themeContext && themeContext.brand
|
|
59
|
-
? themeContext.brand.textPrimary
|
|
60
|
-
: themeContext.textPrimary;
|
|
61
|
-
const themeConfig = {
|
|
62
|
-
config: {
|
|
63
|
-
background: currentBackgroundColor,
|
|
64
|
-
axis: {
|
|
65
|
-
labelColor: brandText,
|
|
66
|
-
titleColor: brandText,
|
|
67
|
-
grid: false,
|
|
68
|
-
domainColor: currentBackgroundColor2,
|
|
69
|
-
},
|
|
70
|
-
title: {
|
|
71
|
-
color: brandText,
|
|
72
|
-
font: 'Lato',
|
|
73
|
-
},
|
|
74
|
-
view: {
|
|
75
|
-
stroke: 'transparent',
|
|
76
|
-
fill: currentBackgroundColor2,
|
|
77
|
-
},
|
|
78
|
-
// the headers provide a title and labels for faceted plots.
|
|
79
|
-
header: {
|
|
80
|
-
labelColor: brandText,
|
|
81
|
-
},
|
|
82
|
-
// the label of max/min
|
|
83
|
-
text: {
|
|
84
|
-
color: brandText,
|
|
85
|
-
font: 'Lato',
|
|
86
|
-
},
|
|
87
|
-
// the up, bottom trend line and verticle line when hover
|
|
88
|
-
rule: {
|
|
89
|
-
color: brandText,
|
|
90
|
-
},
|
|
91
|
-
legend: {
|
|
92
|
-
labelColor: brandText,
|
|
93
|
-
titleColor: brandText,
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
const themedSpec = { ...spec, ...themeConfig };
|
|
98
|
-
const vegaInstance = useRef<Result>();
|
|
99
|
-
let tooltipOptions = {
|
|
100
|
-
theme: theme,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
if (tooltipPosition === TOP) {
|
|
104
|
-
tooltipOptions = {
|
|
105
|
-
theme: theme,
|
|
106
|
-
offsetX: -85,
|
|
107
|
-
offsetY: -140,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
let isMounted = true;
|
|
113
|
-
vegaEmbed(`#${id}`, themedSpec, {
|
|
114
|
-
renderer: 'svg',
|
|
115
|
-
// Override the DEFAULT_OPTIONS https://github.com/vega/vega-tooltip/blob/master/src/defaults.ts
|
|
116
|
-
tooltip: tooltipOptions,
|
|
117
|
-
|
|
118
|
-
/* Determines if action links
|
|
119
|
-
("Export as PNG/SVG", "View Source", "View Vega" (only for Vega-Lite), "Open in Vega Editor") are included with the embedded view.
|
|
120
|
-
If the value is true, all action links will be shown and none if the value is false. */
|
|
121
|
-
actions: false,
|
|
122
|
-
})
|
|
123
|
-
.then((result) => {
|
|
124
|
-
vegaInstance.current = result; // result.view contains the Vega view
|
|
125
|
-
})
|
|
126
|
-
.catch((...args) => {
|
|
127
|
-
if (isMounted) {
|
|
128
|
-
console.error(...args); // TODO: we should handle this with a retry or an error state of the component
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
return () => {
|
|
132
|
-
isMounted = false;
|
|
133
|
-
|
|
134
|
-
if (vegaInstance.current) {
|
|
135
|
-
vegaInstance.current.view.finalize();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}, [id, themedSpec, tooltipOptions, vegaInstance]);
|
|
139
|
-
return (
|
|
140
|
-
<div id={id} className="sc-vegachart">
|
|
141
|
-
<VegaTooltipTheme />
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export { VegaChart };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { AreaChart } from '../src/lib/components/areachart/AreaChart.component';
|
|
2
|
-
import { area_charts } from './data/areachart';
|
|
3
|
-
import { Wrapper } from './common';
|
|
4
|
-
const xAxis_area_chart = {
|
|
5
|
-
field: 'time',
|
|
6
|
-
type: 'temporal',
|
|
7
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
8
|
-
title: 'time',
|
|
9
|
-
axis: null,
|
|
10
|
-
};
|
|
11
|
-
const yAxis_area_chart = [
|
|
12
|
-
{
|
|
13
|
-
field: 'Bandwidth',
|
|
14
|
-
type: 'quantitative',
|
|
15
|
-
color: '#968BFF',
|
|
16
|
-
axis: {
|
|
17
|
-
title: null,
|
|
18
|
-
ticks: false,
|
|
19
|
-
labels: false,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
field: 'Bandwidth',
|
|
24
|
-
type: 'quantitative',
|
|
25
|
-
color: '#F6B288',
|
|
26
|
-
axis: {
|
|
27
|
-
title: null,
|
|
28
|
-
ticks: false,
|
|
29
|
-
labels: false,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
const color_area_chart = {
|
|
34
|
-
field: 'Average',
|
|
35
|
-
type: 'nominal',
|
|
36
|
-
legend: {
|
|
37
|
-
direction: 'horizontal',
|
|
38
|
-
orient: 'bottom',
|
|
39
|
-
title: null,
|
|
40
|
-
labelFontSize: 15,
|
|
41
|
-
columnPadding: 50,
|
|
42
|
-
symbolStrokeWidth: 5,
|
|
43
|
-
},
|
|
44
|
-
domain: ['AvgIn', 'AvgOut'],
|
|
45
|
-
scale: {
|
|
46
|
-
range: ['#968BFF', '#F6B288'],
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const area = {
|
|
50
|
-
transform: [
|
|
51
|
-
{
|
|
52
|
-
filter: "datum.Average==='AvgOut'",
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
mark: {
|
|
56
|
-
opacity: 0.3,
|
|
57
|
-
type: 'area',
|
|
58
|
-
},
|
|
59
|
-
encoding: {
|
|
60
|
-
x: {
|
|
61
|
-
field: 'time',
|
|
62
|
-
type: 'temporal',
|
|
63
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
64
|
-
title: 'time',
|
|
65
|
-
axis: null,
|
|
66
|
-
},
|
|
67
|
-
y: {
|
|
68
|
-
field: 'Bandwidth',
|
|
69
|
-
type: 'quantitative',
|
|
70
|
-
},
|
|
71
|
-
y2: {
|
|
72
|
-
value: 0,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
const area2 = {
|
|
77
|
-
transform: [
|
|
78
|
-
{
|
|
79
|
-
filter: "datum.Average==='AvgIn'",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
mark: {
|
|
83
|
-
opacity: 0.3,
|
|
84
|
-
type: 'area',
|
|
85
|
-
},
|
|
86
|
-
encoding: {
|
|
87
|
-
x: {
|
|
88
|
-
field: 'time',
|
|
89
|
-
type: 'temporal',
|
|
90
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
91
|
-
title: 'time',
|
|
92
|
-
axis: null,
|
|
93
|
-
},
|
|
94
|
-
y: {
|
|
95
|
-
field: 'Bandwidth',
|
|
96
|
-
type: 'quantitative',
|
|
97
|
-
},
|
|
98
|
-
y2: {
|
|
99
|
-
value: 0,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
const areas = [area, area2];
|
|
104
|
-
const id_area_chart = 'vis_area_chart';
|
|
105
|
-
export default {
|
|
106
|
-
title: 'Components/Data Display/Charts/Area Chart',
|
|
107
|
-
component: AreaChart,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const Default = {
|
|
111
|
-
args: {
|
|
112
|
-
id: id_area_chart,
|
|
113
|
-
data: area_charts,
|
|
114
|
-
xAxis: xAxis_area_chart,
|
|
115
|
-
yAxis: yAxis_area_chart,
|
|
116
|
-
color: color_area_chart,
|
|
117
|
-
areas,
|
|
118
|
-
width: 800,
|
|
119
|
-
},
|
|
120
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Chips } from '../src/lib/components/chips/Chips.component';
|
|
4
|
-
import { Icon } from '../src/lib/components/icon/Icon.component';
|
|
5
|
-
import { Wrapper } from './common';
|
|
6
|
-
import { iconArgType } from './controls';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Components/Deprecated/Chips',
|
|
10
|
-
component: Chips,
|
|
11
|
-
decorators: [
|
|
12
|
-
(story) => (
|
|
13
|
-
<Wrapper
|
|
14
|
-
style={{ minHeight: '10vh', padding: '3rem' }}
|
|
15
|
-
className="storybook-chips"
|
|
16
|
-
>
|
|
17
|
-
{story()}
|
|
18
|
-
</Wrapper>
|
|
19
|
-
),
|
|
20
|
-
],
|
|
21
|
-
argTypes: {
|
|
22
|
-
icon: iconArgType,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Template = {
|
|
27
|
-
render: ({ variant, text, icon, ...args }) => {
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
{variant.map((status) => {
|
|
31
|
-
return (
|
|
32
|
-
<Chips
|
|
33
|
-
key={status}
|
|
34
|
-
variant={status}
|
|
35
|
-
icon={icon && <Icon name={icon}></Icon>}
|
|
36
|
-
text={text}
|
|
37
|
-
{...args}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
})}
|
|
41
|
-
</>
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
args: {
|
|
45
|
-
variant: [
|
|
46
|
-
'infoPrimary',
|
|
47
|
-
'statusHealthy',
|
|
48
|
-
'statusWarning',
|
|
49
|
-
'statusCritical',
|
|
50
|
-
],
|
|
51
|
-
text: 'Basic Chip',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const Playground = {
|
|
56
|
-
render: ({ icon, text, ...args }) => {
|
|
57
|
-
return (
|
|
58
|
-
<Chips icon={icon && <Icon name={icon}></Icon>} text={text} {...args} />
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
args: {
|
|
62
|
-
text: 'Playground',
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const BasicChips = {
|
|
67
|
-
...Template,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const ClickableChips = {
|
|
71
|
-
...Template,
|
|
72
|
-
args: {
|
|
73
|
-
...Template.args,
|
|
74
|
-
text: 'Clickable Chip',
|
|
75
|
-
icon: 'Check',
|
|
76
|
-
onClick: action('Clickable Chip'),
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const DeletableChips = {
|
|
81
|
-
...Template,
|
|
82
|
-
args: {
|
|
83
|
-
...Template.args,
|
|
84
|
-
icon: 'Delete',
|
|
85
|
-
onRemove: action('Deletable Chip'),
|
|
86
|
-
text: 'Deletable',
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const DifferentsSizeChips = {
|
|
91
|
-
render: (args) => {
|
|
92
|
-
return (
|
|
93
|
-
<>
|
|
94
|
-
<Chips text="Smaller" size="smaller" {...args} />
|
|
95
|
-
<Chips text="Small" size="small" {...args} />
|
|
96
|
-
<Chips text="Base" size="base" {...args} />
|
|
97
|
-
<Chips text="Large" size="large" {...args} />
|
|
98
|
-
<Chips text="Larger" size="larger" {...args} />
|
|
99
|
-
</>
|
|
100
|
-
);
|
|
101
|
-
},
|
|
102
|
-
args: {
|
|
103
|
-
variant: 'statusHealthy',
|
|
104
|
-
icon: <i className="fas fa-star" />,
|
|
105
|
-
onClick: action('Clickable Chip'),
|
|
106
|
-
},
|
|
107
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CloudProgressBar } from '../src/lib/components/cloudprogressbar/CloudProgressBar.component';
|
|
3
|
-
import { Wrapper, Title, SubTitle } from './common';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Components/Deprecated/CloudProgressBar',
|
|
6
|
-
component: CloudProgressBar,
|
|
7
|
-
decorators: [
|
|
8
|
-
(story) => (
|
|
9
|
-
<Wrapper style={{ minHeight: '10vh', padding: '3rem' }}>
|
|
10
|
-
{story()}
|
|
11
|
-
</Wrapper>
|
|
12
|
-
),
|
|
13
|
-
],
|
|
14
|
-
render: ({ containerSize, percentage, borderSize, ...args }) => (
|
|
15
|
-
<div
|
|
16
|
-
style={{
|
|
17
|
-
width: containerSize,
|
|
18
|
-
margin: '20px 0 20px 0',
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<CloudProgressBar
|
|
22
|
-
percentage={percentage}
|
|
23
|
-
borderSize={borderSize}
|
|
24
|
-
{...args}
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
style={{
|
|
28
|
-
position: 'absolute',
|
|
29
|
-
top: '50%',
|
|
30
|
-
left: '50%',
|
|
31
|
-
transform: 'translate(-50%,-50%)',
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<Title>{percentage}%</Title>
|
|
35
|
-
<SubTitle>of the quotas has been reached.</SubTitle>
|
|
36
|
-
</div>
|
|
37
|
-
</CloudProgressBar>
|
|
38
|
-
</div>
|
|
39
|
-
),
|
|
40
|
-
args: {
|
|
41
|
-
containerSize: '300px',
|
|
42
|
-
percentage: 30,
|
|
43
|
-
borderSize: '1.5px',
|
|
44
|
-
cloudColor: 'yellow',
|
|
45
|
-
progressCloudColor: 'blue',
|
|
46
|
-
},
|
|
47
|
-
argTypes: {
|
|
48
|
-
containerSize: {
|
|
49
|
-
description: 'The container width determines the cloud size',
|
|
50
|
-
},
|
|
51
|
-
cloudColor: {
|
|
52
|
-
control: {
|
|
53
|
-
type: 'color',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
progressCloudColor: {
|
|
57
|
-
control: {
|
|
58
|
-
type: 'color',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
export const Default = {};
|
|
64
|
-
|
|
65
|
-
export const DifferentSize = {
|
|
66
|
-
args: {
|
|
67
|
-
containerSize: '400px',
|
|
68
|
-
percentage: 50,
|
|
69
|
-
borderSize: '1.5px',
|
|
70
|
-
cloudColor: '#ccc',
|
|
71
|
-
progressCloudColor: '#000',
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const DifferentColor = {
|
|
76
|
-
args: {
|
|
77
|
-
containerSize: '500px',
|
|
78
|
-
percentage: 80,
|
|
79
|
-
borderSize: '2px',
|
|
80
|
-
cloudColor: '#3d383a',
|
|
81
|
-
progressCloudColor: '#83d136',
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const HugeSize = {
|
|
86
|
-
args: {
|
|
87
|
-
containerSize: '700px',
|
|
88
|
-
percentage: 70,
|
|
89
|
-
borderSize: '2.5px',
|
|
90
|
-
cloudColor: '#BDFFB0',
|
|
91
|
-
progressCloudColor: '#A3FFCB',
|
|
92
|
-
},
|
|
93
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { Wrapper } from './common';
|
|
4
|
-
import { CollapsiblePanel } from '../src/lib/components/collapsiblepanel/CollapsiblePanel.component';
|
|
5
|
-
const items = [<i className="fas fa-carrot" />, 'banana', 'apple', 'grape'];
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Components/Deprecated/Navigation/CollapsiblePanel',
|
|
8
|
-
component: CollapsiblePanel,
|
|
9
|
-
decorators: [
|
|
10
|
-
(story) => (
|
|
11
|
-
<Wrapper style={{ minHeight: '30vh', padding: '3rem' }}>
|
|
12
|
-
{story()}
|
|
13
|
-
</Wrapper>
|
|
14
|
-
),
|
|
15
|
-
],
|
|
16
|
-
args: {
|
|
17
|
-
headerItems: items,
|
|
18
|
-
children: 'orange',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Collapsed = {
|
|
23
|
-
args: {
|
|
24
|
-
expanded: false,
|
|
25
|
-
onHeaderClick: action('Expand panel'),
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Expanded = {
|
|
30
|
-
args: {
|
|
31
|
-
expanded: true,
|
|
32
|
-
onHeaderClick: action('Collapse panel'),
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
// export const Default = {
|
|
36
|
-
// render: ({}) => {
|
|
37
|
-
// return (
|
|
38
|
-
// <Wrapper className="storybook-collapsiblepanel">
|
|
39
|
-
// <Title>Collapsed</Title>
|
|
40
|
-
// <CollapsiblePanel
|
|
41
|
-
// expanded={false}
|
|
42
|
-
// headerItems={items}
|
|
43
|
-
// onHeaderClick={action('Expand panel')}
|
|
44
|
-
// children="orange"
|
|
45
|
-
// />
|
|
46
|
-
|
|
47
|
-
// <Title>Expanded</Title>
|
|
48
|
-
// <CollapsiblePanel
|
|
49
|
-
// headerItems={items}
|
|
50
|
-
// expanded={true}
|
|
51
|
-
// onHeaderClick={action('Colapse panel')}
|
|
52
|
-
// children="orange"
|
|
53
|
-
// />
|
|
54
|
-
// </Wrapper>
|
|
55
|
-
// );
|
|
56
|
-
// },
|
|
57
|
-
// };
|