@centreon/ui 24.7.0 → 24.7.2

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.
Files changed (42) hide show
  1. package/package.json +66 -85
  2. package/public/mockServiceWorker.js +1 -1
  3. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +85 -2
  4. package/src/Graph/BarChart/BarStack.tsx +8 -6
  5. package/src/Graph/BarChart/SingleBar.tsx +2 -2
  6. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +3 -3
  7. package/src/Graph/LineChart/Icons/Downtime.tsx +1 -1
  8. package/src/Graph/LineChart/LineChart.tsx +2 -0
  9. package/src/Graph/LineChart/helpers/index.ts +3 -0
  10. package/src/Graph/LineChart/index.tsx +2 -1
  11. package/src/Graph/LineChart/models.ts +1 -0
  12. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +0 -4
  13. package/src/Graph/common/Axes/index.tsx +3 -5
  14. package/src/Graph/common/BaseChart/BaseChart.tsx +5 -1
  15. package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +2 -2
  16. package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +7 -2
  17. package/src/Graph/index.ts +5 -0
  18. package/src/{Home.stories.mdx → Home.mdx} +41 -39
  19. package/src/Image/index.stories.tsx +101 -101
  20. package/src/RichTextEditor/index.stories.tsx +102 -102
  21. package/src/ThemeProvider/index.tsx +5 -4
  22. package/src/TimePeriods/DateTimePickerInput.tsx +1 -1
  23. package/src/TimePeriods/index.tsx +10 -2
  24. package/src/TimePeriods/models.ts +1 -0
  25. package/src/Typography/FluidTypography/index.stories.tsx +63 -63
  26. package/src/components/Form/AccessRights/AccessRights.stories.tsx +5 -5
  27. package/src/index.ts +0 -2
  28. package/test/setupTests.js +1 -0
  29. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +0 -60
  30. package/src/Listing/index.test.tsx +0 -234
  31. /package/{public → src}/fonts/roboto-bold-webfont.ttf +0 -0
  32. /package/{public → src}/fonts/roboto-bold-webfont.woff +0 -0
  33. /package/{public → src}/fonts/roboto-bold-webfont.woff2 +0 -0
  34. /package/{public → src}/fonts/roboto-light-webfont.ttf +0 -0
  35. /package/{public → src}/fonts/roboto-light-webfont.woff +0 -0
  36. /package/{public → src}/fonts/roboto-light-webfont.woff2 +0 -0
  37. /package/{public → src}/fonts/roboto-medium-webfont.ttf +0 -0
  38. /package/{public → src}/fonts/roboto-medium-webfont.woff +0 -0
  39. /package/{public → src}/fonts/roboto-medium-webfont.woff2 +0 -0
  40. /package/{public → src}/fonts/roboto-regular-webfont.ttf +0 -0
  41. /package/{public → src}/fonts/roboto-regular-webfont.woff +0 -0
  42. /package/{public → src}/fonts/roboto-regular-webfont.woff2 +0 -0
@@ -1,39 +1,41 @@
1
- import { Meta } from '@storybook/addon-docs'
2
- import { Typography, Link, Stack } from '@mui/material'
3
-
4
-
5
- <Meta title="Home" />
6
-
7
- <Typography variant="h4">Welcome to Centreon UI</Typography>
8
- <br />
9
-
10
- <Typography>This project contains design system's component used in every Centreon projects using ReactJS</Typography>
11
- <br />
12
-
13
- <Typography>Discover older versions of the Centreon UI's storybook</Typography>
14
- <Stack>
15
- <Link href="https://storybook.centreon.com/index.html" target="__blank" rel="noopener noreferrer">
16
- <Typography>Latest</Typography>
17
- </Link>
18
- <Link href="https://storybook.centreon.com/23.04/index.html" target="__blank" rel="noopener noreferrer">
19
- <Typography>23.04</Typography>
20
- </Link>
21
- <Link href="https://storybook.centreon.com/22.10/index.html" target="__blank" rel="noopener noreferrer">
22
- <Typography>22.10</Typography>
23
- </Link>
24
- <Link href="https://storybook.centreon.com/22.04/index.html" target="__blank" rel="noopener noreferrer">
25
- <Typography>22.04</Typography>
26
- </Link>
27
- <Link href="https://storybook.centreon.com/21.10/index.html" target="__blank" rel="noopener noreferrer">
28
- <Typography>21.10</Typography>
29
- </Link>
30
- <Link href="https://storybook.centreon.com/21.04/index.html" target="__blank" rel="noopener noreferrer">
31
- <Typography>21.04</Typography>
32
- </Link>
33
- <Link href="https://storybook.centreon.com/20.10/index.html" target="__blank" rel="noopener noreferrer">
34
- <Typography>20.10</Typography>
35
- </Link>
36
- <Link href="https://storybook.centreon.com/20.04/index.html" target="__blank" rel="noopener noreferrer">
37
- <Typography>20.04</Typography>
38
- </Link>
39
- </Stack>
1
+ {/* Home.mdx */}
2
+
3
+ import { Meta } from '@storybook/addon-docs'
4
+ import { Typography, Link, Stack } from '@mui/material'
5
+
6
+
7
+ <Meta title="Home" />
8
+
9
+ <Typography variant="h4">Welcome to Centreon UI</Typography>
10
+ <br />
11
+
12
+ <Typography>This project contains design system's component used in every Centreon projects using ReactJS</Typography>
13
+ <br />
14
+
15
+ <Typography>Discover older versions of the Centreon UI's storybook</Typography>
16
+ <Stack>
17
+ <Link href="https://storybook.centreon.com/index.html" target="__blank" rel="noopener noreferrer">
18
+ <Typography>Latest</Typography>
19
+ </Link>
20
+ <Link href="https://storybook.centreon.com/23.04/index.html" target="__blank" rel="noopener noreferrer">
21
+ <Typography>23.04</Typography>
22
+ </Link>
23
+ <Link href="https://storybook.centreon.com/22.10/index.html" target="__blank" rel="noopener noreferrer">
24
+ <Typography>22.10</Typography>
25
+ </Link>
26
+ <Link href="https://storybook.centreon.com/22.04/index.html" target="__blank" rel="noopener noreferrer">
27
+ <Typography>22.04</Typography>
28
+ </Link>
29
+ <Link href="https://storybook.centreon.com/21.10/index.html" target="__blank" rel="noopener noreferrer">
30
+ <Typography>21.10</Typography>
31
+ </Link>
32
+ <Link href="https://storybook.centreon.com/21.04/index.html" target="__blank" rel="noopener noreferrer">
33
+ <Typography>21.04</Typography>
34
+ </Link>
35
+ <Link href="https://storybook.centreon.com/20.10/index.html" target="__blank" rel="noopener noreferrer">
36
+ <Typography>20.10</Typography>
37
+ </Link>
38
+ <Link href="https://storybook.centreon.com/20.04/index.html" target="__blank" rel="noopener noreferrer">
39
+ <Typography>20.04</Typography>
40
+ </Link>
41
+ </Stack>
@@ -1,101 +1,101 @@
1
- import { ComponentStory } from '@storybook/react';
2
-
3
- import LoadingSkeleton from '../LoadingSkeleton';
4
- import CentreonLogoLight from '../@assets/brand/centreon-logo-one-line-light.svg';
5
- import NotAuthorized from '../@assets/images/not-authorized-template-background-light.svg';
6
-
7
- import Image, { ImageVariant } from './Image';
8
-
9
- export default {
10
- argTypes: {
11
- alt: { control: 'text' },
12
- height: { control: 'number' },
13
- width: { control: 'number' }
14
- },
15
- component: Image,
16
-
17
- title: 'Image'
18
- };
19
-
20
- const Template: ComponentStory<typeof Image> = (args) => (
21
- <Image
22
- {...args}
23
- fallback={<LoadingSkeleton />}
24
- imagePath={CentreonLogoLight}
25
- />
26
- );
27
-
28
- const size = 50;
29
-
30
- export const basic = Template.bind({});
31
- basic.args = {
32
- alt: 'Centreon logo light'
33
- };
34
-
35
- export const multipleImages = (): JSX.Element => {
36
- return (
37
- <div
38
- style={{
39
- columnGap: '16px',
40
- display: 'grid',
41
- gridTemplateColumns: `repeat(2, ${size}px)`
42
- }}
43
- >
44
- <Image
45
- alt="Centreon logo light"
46
- fallback={<LoadingSkeleton height={size} width={size} />}
47
- height={size}
48
- imagePath={CentreonLogoLight}
49
- width={size}
50
- />
51
- <Image
52
- alt="Not authorized"
53
- fallback={<LoadingSkeleton height={size} width={size} />}
54
- height={size}
55
- imagePath={NotAuthorized}
56
- width={size}
57
- />
58
- <Image
59
- alt="Centreon logo light"
60
- fallback={<LoadingSkeleton height={size} width={size} />}
61
- height={size}
62
- imagePath={CentreonLogoLight}
63
- width={size}
64
- />
65
- <Image
66
- alt="Not authorized"
67
- fallback={<LoadingSkeleton height={size} width={size} />}
68
- height={size}
69
- imagePath={NotAuthorized}
70
- width={size}
71
- />
72
- </div>
73
- );
74
- };
75
-
76
- export const withWidthAndHeight = Template.bind({});
77
- withWidthAndHeight.args = {
78
- alt: 'Centreon logo light',
79
- fallback: <LoadingSkeleton height={size} width={size} />,
80
- height: size,
81
- imagePath: CentreonLogoLight,
82
- width: size
83
- };
84
-
85
- export const imageNotFound = (): JSX.Element => (
86
- <Image
87
- alt="Not found alt text"
88
- fallback={<LoadingSkeleton height={size} width={size} />}
89
- height={size}
90
- imagePath="not-found"
91
- width={size}
92
- />
93
- );
94
-
95
- export const variantContain = Template.bind({});
96
- variantContain.args = {
97
- alt: 'Centreon logo light',
98
- height: size,
99
- variant: ImageVariant.Contain,
100
- width: size
101
- };
1
+ import { ComponentStory } from '@storybook/react';
2
+
3
+ import LoadingSkeleton from '../LoadingSkeleton';
4
+ import CentreonLogoLight from '../@assets/brand/centreon-logo-one-line-light.svg';
5
+ import NotAuthorized from '../@assets/images/not-authorized-template-background-light.svg';
6
+
7
+ import Image, { ImageVariant } from './Image';
8
+
9
+ export default {
10
+ argTypes: {
11
+ alt: { control: 'text' },
12
+ height: { control: 'number' },
13
+ width: { control: 'number' }
14
+ },
15
+ component: Image,
16
+
17
+ title: 'Image'
18
+ };
19
+
20
+ const Template: ComponentStory<typeof Image> = (args) => (
21
+ <Image
22
+ {...args}
23
+ fallback={<LoadingSkeleton />}
24
+ imagePath={CentreonLogoLight}
25
+ />
26
+ );
27
+
28
+ const size = 50;
29
+
30
+ export const basic = Template.bind({});
31
+ basic.args = {
32
+ alt: 'Centreon logo light'
33
+ };
34
+
35
+ export const multipleImages = (): JSX.Element => {
36
+ return (
37
+ <div
38
+ style={{
39
+ columnGap: '16px',
40
+ display: 'grid',
41
+ gridTemplateColumns: `repeat(2, ${size}px)`
42
+ }}
43
+ >
44
+ <Image
45
+ alt="Centreon logo light"
46
+ fallback={<LoadingSkeleton height={size} width={size} />}
47
+ height={size}
48
+ imagePath={CentreonLogoLight}
49
+ width={size}
50
+ />
51
+ <Image
52
+ alt="Not authorized"
53
+ fallback={<LoadingSkeleton height={size} width={size} />}
54
+ height={size}
55
+ imagePath={NotAuthorized}
56
+ width={size}
57
+ />
58
+ <Image
59
+ alt="Centreon logo light"
60
+ fallback={<LoadingSkeleton height={size} width={size} />}
61
+ height={size}
62
+ imagePath={CentreonLogoLight}
63
+ width={size}
64
+ />
65
+ <Image
66
+ alt="Not authorized"
67
+ fallback={<LoadingSkeleton height={size} width={size} />}
68
+ height={size}
69
+ imagePath={NotAuthorized}
70
+ width={size}
71
+ />
72
+ </div>
73
+ );
74
+ };
75
+
76
+ export const withWidthAndHeight = Template.bind({});
77
+ withWidthAndHeight.args = {
78
+ alt: 'Centreon logo light',
79
+ fallback: <LoadingSkeleton height={size} width={size} />,
80
+ height: size,
81
+ imagePath: CentreonLogoLight,
82
+ width: size
83
+ };
84
+
85
+ export const imageNotFound = (): JSX.Element => (
86
+ <Image
87
+ alt="Not found alt text"
88
+ fallback={<LoadingSkeleton height={size} width={size} />}
89
+ height={size}
90
+ imagePath="not-found"
91
+ width={size}
92
+ />
93
+ );
94
+
95
+ export const variantContain = Template.bind({});
96
+ variantContain.args = {
97
+ alt: 'Centreon logo light',
98
+ height: size,
99
+ variant: ImageVariant.Contain,
100
+ width: size
101
+ };
@@ -1,102 +1,102 @@
1
- import { useState } from 'react';
2
-
3
- import { ComponentMeta } from '@storybook/react';
4
- import { EditorState } from 'lexical';
5
-
6
- import RichTextEditor from './RichTextEditor';
7
- import type { RichTextEditorProps } from './RichTextEditor';
8
- import initialEditorState from './initialEditorState.json';
9
-
10
- export default {
11
- argTypes: {
12
- editable: { control: false },
13
- initialEditorState: { control: 'text' },
14
- inputClassname: { control: 'text' },
15
- minInputHeight: { control: 'number' },
16
- namespace: { control: 'text' },
17
- placeholder: { control: 'text' }
18
- },
19
- component: RichTextEditor,
20
- title: 'RichTextEditor'
21
- } as ComponentMeta<typeof RichTextEditor>;
22
-
23
- const Template = (props: RichTextEditorProps): JSX.Element => (
24
- <RichTextEditor {...props} />
25
- );
26
-
27
- export const normal = Template.bind({});
28
-
29
- export const withCustomEditorMinHeight = Template.bind({});
30
- withCustomEditorMinHeight.args = {
31
- minInputHeight: 300
32
- };
33
-
34
- const StoryWithUpdateListener = (): JSX.Element => {
35
- const [editorState, setEditorState] = useState<EditorState>();
36
-
37
- return (
38
- <div>
39
- <Template getEditorState={setEditorState} />
40
- <pre>{JSON.stringify(editorState, null, 2)}</pre>
41
- </div>
42
- );
43
- };
44
-
45
- export const withUpdateListener = (): JSX.Element => (
46
- <StoryWithUpdateListener />
47
- );
48
-
49
- export const withInitialEditorState = Template.bind({});
50
- withInitialEditorState.args = {
51
- initialEditorState: JSON.stringify(initialEditorState)
52
- };
53
-
54
- export const withCustomPlaceholder = Template.bind({});
55
- withCustomPlaceholder.args = {
56
- placeholder: 'Custom placeholder...'
57
- };
58
-
59
- export const withMacrosPlugin = Template.bind({});
60
- withMacrosPlugin.args = {
61
- displayMacrosButton: true
62
- };
63
-
64
- export const withEditableFalse = Template.bind({});
65
- withEditableFalse.args = {
66
- editable: true,
67
- editorState: JSON.stringify(initialEditorState),
68
- initialEditorState: JSON.stringify(initialEditorState)
69
- };
70
-
71
- export const Disabled = Template.bind({});
72
- Disabled.args = {
73
- disabled: true,
74
- editable: false,
75
- editorState: JSON.stringify(initialEditorState),
76
- initialEditorState: JSON.stringify(initialEditorState)
77
- };
78
-
79
- const StoryWithEditableFalseLikePreview = (): JSX.Element => {
80
- const [editorState, setEditorState] =
81
- useState<EditorState>(initialEditorState);
82
-
83
- return (
84
- <div>
85
- <Template
86
- getEditorState={setEditorState}
87
- initialEditorState={JSON.stringify(initialEditorState)}
88
- namespace="editable"
89
- />
90
- <Template
91
- editable={false}
92
- editorStateForReadOnlyMode={JSON.stringify(editorState)}
93
- namespace="uneditable"
94
- placeholder=""
95
- />
96
- </div>
97
- );
98
- };
99
-
100
- export const withEditableFalseLikePreview = (): JSX.Element => (
101
- <StoryWithEditableFalseLikePreview />
102
- );
1
+ import { useState } from 'react';
2
+
3
+ import { ComponentMeta } from '@storybook/react';
4
+ import { EditorState } from 'lexical';
5
+
6
+ import RichTextEditor from './RichTextEditor';
7
+ import type { RichTextEditorProps } from './RichTextEditor';
8
+ import initialEditorState from './initialEditorState.json';
9
+
10
+ export default {
11
+ argTypes: {
12
+ editable: { control: false },
13
+ initialEditorState: { control: 'text' },
14
+ inputClassname: { control: 'text' },
15
+ minInputHeight: { control: 'number' },
16
+ namespace: { control: 'text' },
17
+ placeholder: { control: 'text' }
18
+ },
19
+ component: RichTextEditor,
20
+ title: 'RichTextEditor'
21
+ } as ComponentMeta<typeof RichTextEditor>;
22
+
23
+ const Template = (props: RichTextEditorProps): JSX.Element => (
24
+ <RichTextEditor {...props} />
25
+ );
26
+
27
+ export const normal = Template.bind({});
28
+
29
+ export const withCustomEditorMinHeight = Template.bind({});
30
+ withCustomEditorMinHeight.args = {
31
+ minInputHeight: 300
32
+ };
33
+
34
+ const StoryWithUpdateListener = (): JSX.Element => {
35
+ const [editorState, setEditorState] = useState<EditorState>();
36
+
37
+ return (
38
+ <div>
39
+ <Template getEditorState={setEditorState} />
40
+ <pre>{JSON.stringify(editorState, null, 2)}</pre>
41
+ </div>
42
+ );
43
+ };
44
+
45
+ export const withUpdateListener = (): JSX.Element => (
46
+ <StoryWithUpdateListener />
47
+ );
48
+
49
+ export const withInitialEditorState = Template.bind({});
50
+ withInitialEditorState.args = {
51
+ initialEditorState: JSON.stringify(initialEditorState)
52
+ };
53
+
54
+ export const withCustomPlaceholder = Template.bind({});
55
+ withCustomPlaceholder.args = {
56
+ placeholder: 'Custom placeholder...'
57
+ };
58
+
59
+ export const withMacrosPlugin = Template.bind({});
60
+ withMacrosPlugin.args = {
61
+ displayMacrosButton: true
62
+ };
63
+
64
+ export const withEditableFalse = Template.bind({});
65
+ withEditableFalse.args = {
66
+ editable: true,
67
+ editorState: JSON.stringify(initialEditorState),
68
+ initialEditorState: JSON.stringify(initialEditorState)
69
+ };
70
+
71
+ export const Disabled = Template.bind({});
72
+ Disabled.args = {
73
+ disabled: true,
74
+ editable: false,
75
+ editorState: JSON.stringify(initialEditorState),
76
+ initialEditorState: JSON.stringify(initialEditorState)
77
+ };
78
+
79
+ const StoryWithEditableFalseLikePreview = (): JSX.Element => {
80
+ const [editorState, setEditorState] =
81
+ useState<EditorState>(initialEditorState);
82
+
83
+ return (
84
+ <div>
85
+ <Template
86
+ getEditorState={setEditorState}
87
+ initialEditorState={JSON.stringify(initialEditorState)}
88
+ namespace="editable"
89
+ />
90
+ <Template
91
+ editable={false}
92
+ editorStateForReadOnlyMode={JSON.stringify(editorState)}
93
+ namespace="uneditable"
94
+ placeholder=""
95
+ />
96
+ </div>
97
+ );
98
+ };
99
+
100
+ export const withEditableFalseLikePreview = (): JSX.Element => (
101
+ <StoryWithEditableFalseLikePreview />
102
+ );
@@ -17,10 +17,11 @@ import { autocompleteClasses } from '@mui/material/Autocomplete';
17
17
  import { ThemeOptions } from '@mui/material/styles/createTheme';
18
18
 
19
19
  import { ThemeMode, userAtom } from '@centreon/ui-context';
20
- import RobotoLightWoff2 from '@centreon/ui/fonts/roboto-light-webfont.woff2';
21
- import RobotoRegularWoff2 from '@centreon/ui/fonts/roboto-regular-webfont.woff2';
22
- import RobotoMediumWoff2 from '@centreon/ui/fonts/roboto-medium-webfont.woff2';
23
- import RobotoBoldWoff2 from '@centreon/ui/fonts/roboto-bold-webfont.woff2';
20
+
21
+ import RobotoMediumWoff2 from '../fonts/roboto-medium-webfont.woff2';
22
+ import RobotoBoldWoff2 from '../fonts/roboto-bold-webfont.woff2';
23
+ import RobotoLightWoff2 from '../fonts/roboto-light-webfont.woff2';
24
+ import RobotoRegularWoff2 from '../fonts/roboto-regular-webfont.woff2';
24
25
 
25
26
  import { getPalette } from './palettes';
26
27
 
@@ -68,7 +68,7 @@ const DateTimePickerInput = ({
68
68
  >
69
69
  <DateTimePicker<dayjs.Dayjs>
70
70
  dayOfWeekFormatter={(dayOfWeek) =>
71
- dayOfWeek.substring(0, 2).toLocaleUpperCase()
71
+ dayOfWeek.format('dd').toLocaleUpperCase()
72
72
  }
73
73
  desktopModeMediaQuery={desktopMediaQuery ?? desktopPickerMediaQuery}
74
74
  disabled={disabled}
@@ -9,6 +9,7 @@ import timezonePlugin from 'dayjs/plugin/timezone';
9
9
  import utcPlugin from 'dayjs/plugin/utc';
10
10
 
11
11
  import { ParentSize } from '..';
12
+ import LoadingSkeleton from '../LoadingSkeleton';
12
13
 
13
14
  import { WrapperTimePeriodProps } from './models';
14
15
  import TimePeriods from './TimePeriods';
@@ -18,10 +19,17 @@ dayjs.extend(utcPlugin);
18
19
  dayjs.extend(timezonePlugin);
19
20
  dayjs.extend(duration);
20
21
 
21
- const WrapperTimePeriods = (props: WrapperTimePeriodProps): JSX.Element => (
22
+ const WrapperTimePeriods = ({
23
+ skeletonHeight = 38,
24
+ ...rest
25
+ }: WrapperTimePeriodProps): JSX.Element => (
22
26
  <ParentSize>
23
27
  {({ width }): JSX.Element => {
24
- return <TimePeriods width={width} {...props} />;
28
+ return !width ? (
29
+ <LoadingSkeleton height={skeletonHeight} variant="rectangular" />
30
+ ) : (
31
+ <TimePeriods width={width} {...rest} />
32
+ );
25
33
  }}
26
34
  </ParentSize>
27
35
  );
@@ -109,4 +109,5 @@ export interface WrapperTimePeriodProps {
109
109
  getIsError?: (value: boolean) => void;
110
110
  getParameters?: ({ start, end, timelineEventsLimit }: Parameters) => void;
111
111
  renderExternalComponent?: ReactNode;
112
+ skeletonHeight?: number;
112
113
  }