@scality/core-ui 0.166.0 → 0.168.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 +5 -1
- package/dist/components/barchartv2/Barchart.component.d.ts.map +1 -1
- package/dist/components/barchartv2/Barchart.component.js +6 -2
- package/dist/components/barchartv2/utils.js +2 -2
- 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/date/FormattedDateTime.d.ts +6 -1
- package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
- package/dist/components/date/FormattedDateTime.js +11 -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 +30 -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 +8 -2
- package/dist/components/linetimeseriechart/linetimeseriechart.component.d.ts.map +1 -1
- package/dist/components/linetimeseriechart/linetimeseriechart.component.js +17 -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 +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/barchartv2/Barchart.component.test.tsx +11 -7
- package/src/lib/components/barchartv2/Barchart.component.tsx +15 -3
- package/src/lib/components/barchartv2/utils.test.ts +2 -2
- package/src/lib/components/barchartv2/utils.ts +2 -2
- 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/date/FormattedDateTime.tsx +14 -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 +38 -26
- package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +19 -15
- package/src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx +36 -13
- package/src/lib/components/linetimeseriechart/linetimeseriechart.test.tsx +68 -0
- 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/barchart.stories.tsx +108 -13
- 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 +146 -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,319 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LineChart } from '../src/lib/components/linechart/LineChart.component';
|
|
3
|
-
import {
|
|
4
|
-
data,
|
|
5
|
-
data_graph_with_axis,
|
|
6
|
-
forecast_data,
|
|
7
|
-
in_out_data,
|
|
8
|
-
} from './data/linechart';
|
|
9
|
-
import { Wrapper, Title } from './common';
|
|
10
|
-
const xAxis = {
|
|
11
|
-
field: 'time',
|
|
12
|
-
type: 'temporal',
|
|
13
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
14
|
-
title: 'time',
|
|
15
|
-
};
|
|
16
|
-
const yAxis = [
|
|
17
|
-
{
|
|
18
|
-
field: 'total_space',
|
|
19
|
-
type: 'quantitative',
|
|
20
|
-
title: 'TOTAL SPACE (GB)',
|
|
21
|
-
color: 'yellow',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
field: 'used_space',
|
|
25
|
-
type: 'quantitative',
|
|
26
|
-
title: 'USED SPACE (GB)',
|
|
27
|
-
color: 'blue',
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
// the line chart without x axis and y axis
|
|
31
|
-
const xAxis_without_axis = {
|
|
32
|
-
field: 'time',
|
|
33
|
-
type: 'temporal',
|
|
34
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
35
|
-
title: 'time',
|
|
36
|
-
axis: null,
|
|
37
|
-
};
|
|
38
|
-
const yAxis_without_axis = [
|
|
39
|
-
{
|
|
40
|
-
field: 'Latency',
|
|
41
|
-
type: 'quantitative',
|
|
42
|
-
color: '#18DFAD',
|
|
43
|
-
axis: {
|
|
44
|
-
title: null,
|
|
45
|
-
ticks: false,
|
|
46
|
-
labels: false,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
field: 'Latency',
|
|
51
|
-
type: 'quantitative',
|
|
52
|
-
color: '#968BFF',
|
|
53
|
-
axis: {
|
|
54
|
-
title: null,
|
|
55
|
-
ticks: false,
|
|
56
|
-
labels: false,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
field: 'Latency',
|
|
61
|
-
type: 'quantitative',
|
|
62
|
-
color: '#F6B187',
|
|
63
|
-
axis: {
|
|
64
|
-
title: null,
|
|
65
|
-
ticks: false,
|
|
66
|
-
labels: false,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
field: 'Latency',
|
|
71
|
-
type: 'quantitative',
|
|
72
|
-
color: '#4BE4E2',
|
|
73
|
-
axis: {
|
|
74
|
-
title: null,
|
|
75
|
-
ticks: false,
|
|
76
|
-
labels: false,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
const color = {
|
|
81
|
-
field: 'resquest_method',
|
|
82
|
-
type: 'nominal',
|
|
83
|
-
legend: {
|
|
84
|
-
direction: 'horizontal',
|
|
85
|
-
orient: 'bottom',
|
|
86
|
-
title: null,
|
|
87
|
-
symbolType: 'stroke',
|
|
88
|
-
labelFontSize: 15,
|
|
89
|
-
columnPadding: 50,
|
|
90
|
-
symbolStrokeWidth: 5,
|
|
91
|
-
},
|
|
92
|
-
domain: ['Get', 'Put', 'Delete', 'List'],
|
|
93
|
-
scale: {
|
|
94
|
-
range: ['#18DFAD', '#968BFF', '#F6B187', '#4BE4E2'],
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
const lineConfig = {
|
|
98
|
-
strokeWidth: 1,
|
|
99
|
-
opacity: 0.5,
|
|
100
|
-
};
|
|
101
|
-
const id = 'vis';
|
|
102
|
-
const id_without_axis = 'vis2';
|
|
103
|
-
// forecast chart
|
|
104
|
-
const xAxis_forecast_chart = {
|
|
105
|
-
field: 'time',
|
|
106
|
-
type: 'ordinal',
|
|
107
|
-
title: null,
|
|
108
|
-
axis: {
|
|
109
|
-
labelAngle: 0,
|
|
110
|
-
},
|
|
111
|
-
// sort the according the given xlabel
|
|
112
|
-
sort: ['-3m', 'Now', '+3m'],
|
|
113
|
-
};
|
|
114
|
-
const yAxis_forecast_chart = [
|
|
115
|
-
{
|
|
116
|
-
field: 'capacity',
|
|
117
|
-
type: 'quantitative',
|
|
118
|
-
color: '#968BFF',
|
|
119
|
-
axis: {
|
|
120
|
-
title: null,
|
|
121
|
-
ticks: false,
|
|
122
|
-
labels: false,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
];
|
|
126
|
-
const lineConfig_forecast_chart = {
|
|
127
|
-
interpolate: 'monotone',
|
|
128
|
-
};
|
|
129
|
-
const id_forecast_chart = 'vis_forecast_chart';
|
|
130
|
-
const xAxis_inout_chart = {
|
|
131
|
-
field: 'date',
|
|
132
|
-
type: 'temporal',
|
|
133
|
-
axis: {
|
|
134
|
-
format: '%m/%d',
|
|
135
|
-
ticks: true,
|
|
136
|
-
tickCount: 4,
|
|
137
|
-
labelAngle: -50,
|
|
138
|
-
labelColor: '#B5B5B5',
|
|
139
|
-
},
|
|
140
|
-
title: null,
|
|
141
|
-
};
|
|
142
|
-
const yAxis_inout_chart = [
|
|
143
|
-
{
|
|
144
|
-
field: 'value',
|
|
145
|
-
type: 'quantitative',
|
|
146
|
-
title: null,
|
|
147
|
-
},
|
|
148
|
-
];
|
|
149
|
-
const color_inout_chart = {
|
|
150
|
-
field: 'type',
|
|
151
|
-
type: 'nominal',
|
|
152
|
-
domain: ['in', 'out'],
|
|
153
|
-
scale: {
|
|
154
|
-
range: ['#F6B187', '#968BFF'],
|
|
155
|
-
},
|
|
156
|
-
legend: {
|
|
157
|
-
direction: 'horizontal',
|
|
158
|
-
orient: 'bottom',
|
|
159
|
-
title: null,
|
|
160
|
-
values: ['in', 'out'],
|
|
161
|
-
symbolSize: 300,
|
|
162
|
-
labelFontSize: 15,
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
const strokeDashConfig_inout = {
|
|
166
|
-
field: 'symbol',
|
|
167
|
-
type: 'nominal',
|
|
168
|
-
legend: {
|
|
169
|
-
direction: 'horizontal',
|
|
170
|
-
orient: 'bottom',
|
|
171
|
-
title: null,
|
|
172
|
-
values: ['Cluster avg'],
|
|
173
|
-
symbolSize: 300,
|
|
174
|
-
labelFontSize: 15,
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
const opacityConfig_inout = {
|
|
178
|
-
condition: {
|
|
179
|
-
test: 'datum.symbol == "Cluster avg"',
|
|
180
|
-
value: 0.5,
|
|
181
|
-
},
|
|
182
|
-
value: 1,
|
|
183
|
-
};
|
|
184
|
-
const lineConfigInOut = {
|
|
185
|
-
strokeWidth: 1.5,
|
|
186
|
-
};
|
|
187
|
-
// Overriding the tooltip config to format data properly through the tooltipConfig prop
|
|
188
|
-
const tooltipConfigInOut = {
|
|
189
|
-
transform: [
|
|
190
|
-
{
|
|
191
|
-
pivot: 'type',
|
|
192
|
-
value: 'value',
|
|
193
|
-
groupby: ['date'],
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
mark: 'rule',
|
|
197
|
-
encoding: {
|
|
198
|
-
opacity: {
|
|
199
|
-
condition: {
|
|
200
|
-
value: 1,
|
|
201
|
-
selection: 'hover',
|
|
202
|
-
},
|
|
203
|
-
value: 0,
|
|
204
|
-
},
|
|
205
|
-
tooltip: [
|
|
206
|
-
{
|
|
207
|
-
field: 'date',
|
|
208
|
-
type: 'temporal',
|
|
209
|
-
axis: {
|
|
210
|
-
format: '%d/%m %H:%M',
|
|
211
|
-
ticks: true,
|
|
212
|
-
tickCount: 4,
|
|
213
|
-
labelAngle: -50,
|
|
214
|
-
labelColor: '#B5B5B5',
|
|
215
|
-
},
|
|
216
|
-
title: 'Date',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
field: 'in',
|
|
220
|
-
type: 'quantitative',
|
|
221
|
-
title: 'In',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
field: 'out',
|
|
225
|
-
type: 'quantitative',
|
|
226
|
-
title: 'Out',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
field: 'avgIn',
|
|
230
|
-
type: 'quantitative',
|
|
231
|
-
title: 'Avg In',
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
field: 'avgOut',
|
|
235
|
-
type: 'quantitative',
|
|
236
|
-
title: 'Avg Out',
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
color: {
|
|
240
|
-
legend: null,
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
selection: {
|
|
244
|
-
hover: {
|
|
245
|
-
type: 'single',
|
|
246
|
-
fields: ['date'],
|
|
247
|
-
nearest: true,
|
|
248
|
-
on: 'mouseover',
|
|
249
|
-
empty: 'none',
|
|
250
|
-
clear: 'mouseout',
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
export default {
|
|
255
|
-
title: 'Components/Data Display/Charts/LineChart',
|
|
256
|
-
component: LineChart,
|
|
257
|
-
args: {
|
|
258
|
-
width: 800,
|
|
259
|
-
tooltip: true,
|
|
260
|
-
},
|
|
261
|
-
argTypes: {
|
|
262
|
-
data: {
|
|
263
|
-
control: false,
|
|
264
|
-
},
|
|
265
|
-
},
|
|
266
|
-
};
|
|
267
|
-
export const VegaLiteChart = {
|
|
268
|
-
name: 'Vega-Lite line chart demo',
|
|
269
|
-
args: {
|
|
270
|
-
id,
|
|
271
|
-
data,
|
|
272
|
-
xAxis,
|
|
273
|
-
yAxis,
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
export const VegaChartWithoutAxis = {
|
|
278
|
-
name: 'Vega-Lite line chart without axis',
|
|
279
|
-
args: {
|
|
280
|
-
id: id_without_axis,
|
|
281
|
-
data: data_graph_with_axis,
|
|
282
|
-
xAxis: xAxis_without_axis,
|
|
283
|
-
yAxis: yAxis_without_axis,
|
|
284
|
-
tooltip: false,
|
|
285
|
-
color,
|
|
286
|
-
lineConfig,
|
|
287
|
-
},
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
export const ForecastChart = {
|
|
291
|
-
args: {
|
|
292
|
-
id: id_forecast_chart,
|
|
293
|
-
data: forecast_data,
|
|
294
|
-
xAxis: xAxis_forecast_chart,
|
|
295
|
-
yAxis: yAxis_forecast_chart,
|
|
296
|
-
tooltip: false,
|
|
297
|
-
lineConfig: lineConfig_forecast_chart,
|
|
298
|
-
width: 300,
|
|
299
|
-
heigth: 150,
|
|
300
|
-
displayTrendLine: true,
|
|
301
|
-
},
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
export const AnotherExample = {
|
|
305
|
-
name: 'Vega-Lite with strokeDash config, opacity config and custom Tooltip',
|
|
306
|
-
args: {
|
|
307
|
-
id: 'id_strokedash',
|
|
308
|
-
data: in_out_data,
|
|
309
|
-
xAxis: xAxis_inout_chart,
|
|
310
|
-
yAxis: yAxis_inout_chart,
|
|
311
|
-
color: color_inout_chart,
|
|
312
|
-
height: 250,
|
|
313
|
-
lineConfig: lineConfigInOut,
|
|
314
|
-
strokeDashEncodingConfig: strokeDashConfig_inout,
|
|
315
|
-
opacityEncodingConfig: opacityConfig_inout,
|
|
316
|
-
tooltipConfig: tooltipConfigInOut,
|
|
317
|
-
tooltipTheme: 'dark',
|
|
318
|
-
},
|
|
319
|
-
};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MultiSelect } from '../src/lib/components/multiselect/MultiSelect.component';
|
|
3
|
-
import { action } from '@storybook/addon-actions';
|
|
4
|
-
import { Wrapper, Title } from './common';
|
|
5
|
-
const items = [
|
|
6
|
-
{
|
|
7
|
-
selected: true,
|
|
8
|
-
isFavorite: true,
|
|
9
|
-
label: 'AWS',
|
|
10
|
-
description: 'Amazon',
|
|
11
|
-
onSelect: action('onSelect clicked'),
|
|
12
|
-
onFavoriteClick: action('onFavoriteClick clicked'),
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
selected: false,
|
|
16
|
-
isFavorite: false,
|
|
17
|
-
label: 'WM',
|
|
18
|
-
description: 'Walmart',
|
|
19
|
-
onSelect: action('onSelect clicked'),
|
|
20
|
-
onFavoriteClick: action('onFavoriteClick clicked'),
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
const itemsWithoutFavourite = [
|
|
24
|
-
{
|
|
25
|
-
selected: true,
|
|
26
|
-
label: 'AWS',
|
|
27
|
-
description: 'Amazon',
|
|
28
|
-
onSelect: action('onSelect clicked'),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
selected: false,
|
|
32
|
-
label: 'WM',
|
|
33
|
-
description: 'Walmart',
|
|
34
|
-
onSelect: action('onSelect clicked'),
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
const itemsWithoutCheckboxFavourite = [
|
|
38
|
-
{
|
|
39
|
-
label: 'AWS',
|
|
40
|
-
description: 'Amazon',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: 'WM',
|
|
44
|
-
description: 'Walmart',
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
const options = [
|
|
48
|
-
{
|
|
49
|
-
label: 'Azure',
|
|
50
|
-
value: 'Azure',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: 'S3',
|
|
54
|
-
value: 'S3',
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
const search = {
|
|
58
|
-
placeholder: 'Select location to add',
|
|
59
|
-
options: options,
|
|
60
|
-
onSelect: action('onSelect clicked'),
|
|
61
|
-
onAdd: action('onAdd clicked'),
|
|
62
|
-
selectedOption: null,
|
|
63
|
-
};
|
|
64
|
-
export default {
|
|
65
|
-
title: 'Components/Deprecated/Selector/MultiSelect',
|
|
66
|
-
component: MultiSelect,
|
|
67
|
-
};
|
|
68
|
-
export const Default = {
|
|
69
|
-
render: ({}) => {
|
|
70
|
-
return (
|
|
71
|
-
<Wrapper>
|
|
72
|
-
<Title>MultiSelect List</Title>
|
|
73
|
-
<div className="storybook-mutiselect-container">
|
|
74
|
-
<MultiSelect
|
|
75
|
-
title="Destination Locations"
|
|
76
|
-
items={items}
|
|
77
|
-
search={search}
|
|
78
|
-
onItemRemove={action('onItemRemove clicked')}
|
|
79
|
-
/>
|
|
80
|
-
</div>
|
|
81
|
-
<Title>MultiSelect List without search</Title>
|
|
82
|
-
<div className="storybook-mutiselect-container">
|
|
83
|
-
<MultiSelect
|
|
84
|
-
title="Destination Locations"
|
|
85
|
-
items={items}
|
|
86
|
-
onItemRemove={action('onItemRemove clicked')}
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
<Title>MultiSelect List without Favourite</Title>
|
|
90
|
-
<div className="storybook-mutiselect-container">
|
|
91
|
-
<MultiSelect
|
|
92
|
-
title="Destination Locations"
|
|
93
|
-
items={itemsWithoutFavourite}
|
|
94
|
-
search={search}
|
|
95
|
-
onItemRemove={action('onItemRemove clicked')}
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
<Title>MultiSelect List without Favourite and Selectbox</Title>
|
|
99
|
-
<div className="storybook-mutiselect-container">
|
|
100
|
-
<MultiSelect
|
|
101
|
-
title="Destination Locations"
|
|
102
|
-
items={itemsWithoutCheckboxFavourite}
|
|
103
|
-
search={search}
|
|
104
|
-
onItemRemove={action('onItemRemove clicked')}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
<Title>
|
|
108
|
-
MultiSelect List without Remove Button, Favourite and Selectbox
|
|
109
|
-
</Title>
|
|
110
|
-
<div className="storybook-mutiselect-container">
|
|
111
|
-
<MultiSelect
|
|
112
|
-
title="Destination Locations"
|
|
113
|
-
items={itemsWithoutCheckboxFavourite}
|
|
114
|
-
search={search}
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
117
|
-
<Title>
|
|
118
|
-
MultiSelect List without Title, Remove Button, Favourite and Selectbox
|
|
119
|
-
</Title>
|
|
120
|
-
<div className="storybook-mutiselect-container">
|
|
121
|
-
<MultiSelect items={itemsWithoutCheckboxFavourite} search={search} />
|
|
122
|
-
</div>
|
|
123
|
-
</Wrapper>
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Select } from '../src/lib/components/select/Select.component';
|
|
3
|
-
import { Wrapper } from './common';
|
|
4
|
-
const options = Array.from(new Array(100), (_, index) => ({
|
|
5
|
-
label: `Item ${index}`,
|
|
6
|
-
value: index,
|
|
7
|
-
title: `Item ${index}`,
|
|
8
|
-
'data-cy': `Item_${index}`,
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
const customFormatOptionLabel = ({ value, label, ...rest }) => (
|
|
12
|
-
<div className="sc-select-option-custom-label" {...rest}>
|
|
13
|
-
{label} {value % 2 === 0 ? <i className="fas fa-flag-usa"></i> : null}
|
|
14
|
-
</div>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
title: 'Components/Deprecated/Selector/Select',
|
|
19
|
-
component: Select,
|
|
20
|
-
argTypes: {
|
|
21
|
-
options: {
|
|
22
|
-
description: 'Array of objects with label, title and value properties',
|
|
23
|
-
control: false,
|
|
24
|
-
},
|
|
25
|
-
isMulti: {
|
|
26
|
-
control: {
|
|
27
|
-
type: 'boolean',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Playground = {
|
|
34
|
-
args: {
|
|
35
|
-
options,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const WithCustomLabel = {
|
|
40
|
-
args: {
|
|
41
|
-
options,
|
|
42
|
-
formatOptionLabel: customFormatOptionLabel,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const MultiSelect = {
|
|
47
|
-
args: {
|
|
48
|
-
options,
|
|
49
|
-
isMulti: true,
|
|
50
|
-
value: [options[0], options[1]],
|
|
51
|
-
},
|
|
52
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Sparkline as SparkLine } from '../src/lib/components/sparkline/SparkLine.component';
|
|
3
|
-
import { data, multiLineData } from './data/sparklinechart';
|
|
4
|
-
import { Wrapper, Title } from './common';
|
|
5
|
-
const xAxis = {
|
|
6
|
-
field: 'date',
|
|
7
|
-
type: 'temporal',
|
|
8
|
-
axis: null,
|
|
9
|
-
};
|
|
10
|
-
const yAxis = {
|
|
11
|
-
field: 'y',
|
|
12
|
-
type: 'quantitative',
|
|
13
|
-
axis: {
|
|
14
|
-
title: null,
|
|
15
|
-
ticks: false,
|
|
16
|
-
labels: false,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const row = {
|
|
20
|
-
field: 'symbol',
|
|
21
|
-
type: 'nominal',
|
|
22
|
-
title: null,
|
|
23
|
-
// the header of the subplot
|
|
24
|
-
header: {
|
|
25
|
-
labelAngle: 0,
|
|
26
|
-
labelAlign: 'left',
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
const id = 'vis';
|
|
30
|
-
const id_multi = 'multiVis';
|
|
31
|
-
const lineConfig = {
|
|
32
|
-
interpolate: 'monotone',
|
|
33
|
-
};
|
|
34
|
-
export default {
|
|
35
|
-
title: 'Components/Data Display/Charts/SparkLine',
|
|
36
|
-
component: SparkLine,
|
|
37
|
-
args: {
|
|
38
|
-
xAxis,
|
|
39
|
-
yAxis,
|
|
40
|
-
row,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const ChartDemo = {
|
|
45
|
-
args: {
|
|
46
|
-
id,
|
|
47
|
-
data,
|
|
48
|
-
title: 'OPERATIONS BY SECONDS',
|
|
49
|
-
lineConfig,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const MultiChartDmeo = {
|
|
54
|
-
args: {
|
|
55
|
-
id: id_multi,
|
|
56
|
-
data: multiLineData,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Default = {
|
|
61
|
-
render: ({}) => {
|
|
62
|
-
return (
|
|
63
|
-
<Wrapper>
|
|
64
|
-
<Title>Vege-Lite sparkline chart demo</Title>
|
|
65
|
-
<SparkLine
|
|
66
|
-
id={id}
|
|
67
|
-
data={data}
|
|
68
|
-
xAxis={xAxis}
|
|
69
|
-
yAxis={yAxis}
|
|
70
|
-
title={'OPERATIONS PER SECONDS'}
|
|
71
|
-
row={row}
|
|
72
|
-
lineConfig={lineConfig}
|
|
73
|
-
/>
|
|
74
|
-
<Title>Vege-Lite sparkline multi chart demo</Title>
|
|
75
|
-
<SparkLine
|
|
76
|
-
id={id_multi}
|
|
77
|
-
data={multiLineData}
|
|
78
|
-
xAxis={xAxis}
|
|
79
|
-
yAxis={yAxis}
|
|
80
|
-
row={row}
|
|
81
|
-
/>
|
|
82
|
-
</Wrapper>
|
|
83
|
-
);
|
|
84
|
-
},
|
|
85
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { VegaChart } from '../src/lib/components/vegachart/VegaChart.component';
|
|
3
|
-
import { data } from './data/linechart';
|
|
4
|
-
import { Wrapper, Title } from './common';
|
|
5
|
-
const spec = {
|
|
6
|
-
data: {
|
|
7
|
-
values: data,
|
|
8
|
-
},
|
|
9
|
-
encoding: {
|
|
10
|
-
x: {
|
|
11
|
-
field: 'time',
|
|
12
|
-
type: 'temporal',
|
|
13
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
14
|
-
title: 'time',
|
|
15
|
-
},
|
|
16
|
-
tooltip: [
|
|
17
|
-
{
|
|
18
|
-
field: 'time',
|
|
19
|
-
type: 'temporal',
|
|
20
|
-
timeUnit: 'yearmonthdatehoursminutes',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
field: 'total_space',
|
|
24
|
-
type: 'quantitative',
|
|
25
|
-
title: 'TOTAL SPACE',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
field: 'used_space',
|
|
29
|
-
type: 'quantitative',
|
|
30
|
-
title: 'USED SPACE',
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
layer: [
|
|
35
|
-
{
|
|
36
|
-
mark: {
|
|
37
|
-
type: 'line',
|
|
38
|
-
color: 'green',
|
|
39
|
-
},
|
|
40
|
-
encoding: {
|
|
41
|
-
y: {
|
|
42
|
-
field: 'total_space',
|
|
43
|
-
type: 'quantitative',
|
|
44
|
-
title: 'TOTAL SPACE (GB)',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
mark: {
|
|
50
|
-
type: 'line',
|
|
51
|
-
color: 'orange',
|
|
52
|
-
},
|
|
53
|
-
encoding: {
|
|
54
|
-
y: {
|
|
55
|
-
field: 'used_space',
|
|
56
|
-
type: 'quantitative',
|
|
57
|
-
title: 'USED SPACE (GB)',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
mark: 'rule',
|
|
63
|
-
selection: {
|
|
64
|
-
index: {
|
|
65
|
-
type: 'single',
|
|
66
|
-
on: 'mousemove',
|
|
67
|
-
encodings: ['x'],
|
|
68
|
-
nearest: true,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
encoding: {
|
|
72
|
-
color: {
|
|
73
|
-
condition: {
|
|
74
|
-
selection: {
|
|
75
|
-
not: 'index',
|
|
76
|
-
},
|
|
77
|
-
value: 'transparent',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
};
|
|
84
|
-
const id = 'vis';
|
|
85
|
-
export default {
|
|
86
|
-
title: 'Components/Data Display/Charts/VegaChart',
|
|
87
|
-
component: VegaChart,
|
|
88
|
-
};
|
|
89
|
-
export const Default = {
|
|
90
|
-
render: (args) => {
|
|
91
|
-
return (
|
|
92
|
-
<Wrapper>
|
|
93
|
-
<Title>Vega-Lite wrapper - need to specify the entire spec</Title>
|
|
94
|
-
<VegaChart id={id} spec={spec} {...args} />
|
|
95
|
-
</Wrapper>
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
};
|