@centreon/ui 24.5.1 → 24.5.3
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/package.json +4 -4
- package/src/Graph/BarStack/BarStack.stories.tsx +8 -6
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +3 -3
- package/src/Graph/HeatMap/HeatMap.stories.tsx +20 -0
- package/src/Graph/LineChart/index.stories.tsx +1 -1
- package/src/Graph/PieChart/PieChart.stories.tsx +11 -15
- package/src/Graph/PieChart/ResponsivePie.tsx +1 -1
- package/src/TimePeriods/index.stories.tsx +7 -12
- package/src/components/Form/Dashboard/translatedLabels.ts +0 -1
- package/src/components/Form/Dashboard/DashboardForm.stories.ts +0 -39
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "24.5.
|
|
3
|
+
"version": "24.5.3",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
7
7
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
8
8
|
"eslint:fix": "pnpm eslint --fix",
|
|
9
|
-
"storybook": "storybook dev -p 9001 -c .storybook
|
|
9
|
+
"storybook": "storybook dev -p 9001 -c .storybook",
|
|
10
10
|
"build:storybook": "storybook build -c .storybook -o .out",
|
|
11
11
|
"test": "jest",
|
|
12
12
|
"test:storybook:local": "test-storybook --url http://127.0.0.1:9001",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@storybook/addon-interactions": "^7.0.9",
|
|
63
63
|
"@storybook/addon-styling": "^1.0.6",
|
|
64
64
|
"@storybook/blocks": "^7.0.26",
|
|
65
|
-
"@storybook/builder-vite": "^7.
|
|
65
|
+
"@storybook/builder-vite": "^7.6.18",
|
|
66
66
|
"@storybook/jest": "^0.1.0",
|
|
67
67
|
"@storybook/manager-api": "^7.0.9",
|
|
68
68
|
"@storybook/mdx2-csf": "^1.1.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"use-resize-observer": "^9.1.0",
|
|
105
105
|
"vite": "^4.3.5",
|
|
106
106
|
"vite-plugin-istanbul": "^5.0.0",
|
|
107
|
-
"vite-plugin-svgr": "^3.
|
|
107
|
+
"vite-plugin-svgr": "^3.3.0",
|
|
108
108
|
"vite-plugin-turbosnap": "^1.0.3"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
3
|
import { BarType } from './models';
|
|
4
|
+
import ResponsiveBarStack from './ResponsiveBarStack';
|
|
4
5
|
|
|
5
6
|
import { BarStack } from '.';
|
|
6
7
|
|
|
@@ -26,7 +27,12 @@ const dataWithSmallNumber = [
|
|
|
26
27
|
];
|
|
27
28
|
|
|
28
29
|
const meta: Meta<typeof BarStack> = {
|
|
29
|
-
component: BarStack
|
|
30
|
+
component: BarStack,
|
|
31
|
+
parameters: {
|
|
32
|
+
chromatic: {
|
|
33
|
+
delay: 1000
|
|
34
|
+
}
|
|
35
|
+
}
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
export default meta;
|
|
@@ -41,11 +47,7 @@ const TooltipContent = ({ label, color, value }: BarType): JSX.Element => {
|
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
const Template = (args): JSX.Element => {
|
|
44
|
-
return
|
|
45
|
-
<div style={{ height: '300px', width: '500px' }}>
|
|
46
|
-
<BarStack {...args} />
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
50
|
+
return <ResponsiveBarStack height={300} width={500} {...args} />;
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
export const Vertical: Story = {
|
|
@@ -20,7 +20,7 @@ const DefaultLengd = ({ scale, direction }: LegendProps): JSX.Element => (
|
|
|
20
20
|
<LegendComponent direction={direction} scale={scale} />
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const ResponsiveBarStack = ({
|
|
24
24
|
title,
|
|
25
25
|
data,
|
|
26
26
|
width,
|
|
@@ -73,7 +73,7 @@ const BarStack = ({
|
|
|
73
73
|
<div
|
|
74
74
|
className={classes.svgWrapper}
|
|
75
75
|
style={{
|
|
76
|
-
height,
|
|
76
|
+
minHeight: height,
|
|
77
77
|
width: svgWrapperWidth
|
|
78
78
|
}}
|
|
79
79
|
>
|
|
@@ -206,4 +206,4 @@ const BarStack = ({
|
|
|
206
206
|
);
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
-
export default
|
|
209
|
+
export default ResponsiveBarStack;
|
|
@@ -55,6 +55,26 @@ const Template = (args): JSX.Element => {
|
|
|
55
55
|
return <HeatMap {...args} arrowClassName={classes.arrow} />;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
const TileContent = ({
|
|
59
|
+
data,
|
|
60
|
+
backgroundColor
|
|
61
|
+
}: {
|
|
62
|
+
backgroundColor: string;
|
|
63
|
+
data: Data;
|
|
64
|
+
}): JSX.Element => (
|
|
65
|
+
<div
|
|
66
|
+
style={{
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
backgroundColor,
|
|
69
|
+
display: 'flex',
|
|
70
|
+
height: '100%',
|
|
71
|
+
justifyContent: 'center'
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{data.counter}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
|
|
58
78
|
export const normal: Story = {
|
|
59
79
|
args: {
|
|
60
80
|
children: TileContent,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
3
|
import { ArcType } from './models';
|
|
4
|
-
|
|
5
|
-
import { PieChart } from '.';
|
|
4
|
+
import ResponsivePie from './ResponsivePie';
|
|
6
5
|
|
|
7
6
|
const data = [
|
|
8
7
|
{ color: '#88B922', label: 'Ok', value: 148 },
|
|
@@ -18,19 +17,20 @@ const dataWithBigNumbers = [
|
|
|
18
17
|
{ color: '#FF6666', label: 'Down', value: 122222 }
|
|
19
18
|
];
|
|
20
19
|
|
|
21
|
-
const meta: Meta<typeof
|
|
22
|
-
component:
|
|
20
|
+
const meta: Meta<typeof ResponsivePie> = {
|
|
21
|
+
component: ResponsivePie,
|
|
22
|
+
parameters: {
|
|
23
|
+
chromatic: {
|
|
24
|
+
delay: 1000
|
|
25
|
+
}
|
|
26
|
+
}
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
export default meta;
|
|
26
|
-
type Story = StoryObj<typeof
|
|
30
|
+
type Story = StoryObj<typeof ResponsivePie>;
|
|
27
31
|
|
|
28
32
|
const Template = (args): JSX.Element => {
|
|
29
|
-
return
|
|
30
|
-
<div style={{ height: '350px', width: '350px' }}>
|
|
31
|
-
<PieChart {...args} />
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
33
|
+
return <ResponsivePie height={350} width={350} {...args} />;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const Pie: Story = {
|
|
@@ -141,11 +141,7 @@ export const DonutWithTooltip: Story = {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
const TemplateForSmallDimensions = (args): JSX.Element => {
|
|
144
|
-
return
|
|
145
|
-
<div style={{ height: '130px', width: '130px' }}>
|
|
146
|
-
<PieChart {...args} />
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
144
|
+
return <ResponsivePie height={130} width={130} {...args} />;
|
|
149
145
|
};
|
|
150
146
|
|
|
151
147
|
export const PieWithSmallDimensions: Story = {
|
|
@@ -10,6 +10,9 @@ import TimePeriod from '.';
|
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof TimePeriod> = {
|
|
12
12
|
component: TimePeriod,
|
|
13
|
+
parameters: {
|
|
14
|
+
chromatic: { disableSnapshot: true }
|
|
15
|
+
},
|
|
13
16
|
tags: ['autodocs']
|
|
14
17
|
};
|
|
15
18
|
|
|
@@ -88,27 +91,20 @@ const args = {
|
|
|
88
91
|
]
|
|
89
92
|
};
|
|
90
93
|
|
|
91
|
-
const parameters = {
|
|
92
|
-
chromatic: { diffThreshold: 0.1 }
|
|
93
|
-
};
|
|
94
|
-
|
|
95
94
|
export const BasicTimePeriod: Story = {
|
|
96
95
|
...Template,
|
|
97
|
-
argTypes
|
|
98
|
-
parameters
|
|
96
|
+
argTypes
|
|
99
97
|
};
|
|
100
98
|
|
|
101
99
|
export const WithExtraTimePeriods: Story = {
|
|
102
100
|
...Template,
|
|
103
101
|
argTypes,
|
|
104
|
-
args
|
|
105
|
-
parameters
|
|
102
|
+
args
|
|
106
103
|
};
|
|
107
104
|
|
|
108
105
|
export const WithExternalComponent: Story = {
|
|
109
106
|
...TemplateWithExternalComponent,
|
|
110
|
-
argTypes
|
|
111
|
-
parameters
|
|
107
|
+
argTypes
|
|
112
108
|
};
|
|
113
109
|
|
|
114
110
|
export const SimpleTimePeriod: StorySimpleTimePeriod = {
|
|
@@ -116,6 +112,5 @@ export const SimpleTimePeriod: StorySimpleTimePeriod = {
|
|
|
116
112
|
args: {
|
|
117
113
|
endDate: dayjs(Date.now()).toDate(),
|
|
118
114
|
startDate: dayjs(Date.now()).subtract(29, 'day').toDate()
|
|
119
|
-
}
|
|
120
|
-
parameters
|
|
115
|
+
}
|
|
121
116
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// TODO use i18n conventions for translation (interpolation, plurals, etc.) and setup for storybook (only works in FE atm.)
|
|
2
1
|
export const labelMustBeMost = '{{label}} can be at most {{max}} characters';
|
|
3
2
|
export const labelMustBeAtLeast =
|
|
4
3
|
'{{label}} should be at least {{min}} characters long';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { DashboardForm } from './DashboardForm';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof DashboardForm> = {
|
|
6
|
-
component: DashboardForm
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof DashboardForm>;
|
|
11
|
-
|
|
12
|
-
export const Default: Story = {
|
|
13
|
-
args: {
|
|
14
|
-
labels: {
|
|
15
|
-
actions: {
|
|
16
|
-
cancel: 'Cancel',
|
|
17
|
-
submit: {
|
|
18
|
-
create: 'Create',
|
|
19
|
-
update: 'Update'
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
entity: {
|
|
23
|
-
description: 'Description',
|
|
24
|
-
name: 'Name'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const AsUpdateVariant: Story = {
|
|
31
|
-
args: {
|
|
32
|
-
...Default.args,
|
|
33
|
-
resource: {
|
|
34
|
-
description: 'Description 1',
|
|
35
|
-
name: 'Dashboard 1'
|
|
36
|
-
},
|
|
37
|
-
variant: 'update'
|
|
38
|
-
}
|
|
39
|
-
};
|