@centreon/ui 24.7.1 → 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 (29) 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/Icons/Downtime.tsx +1 -1
  7. package/src/Graph/LineChart/helpers/index.ts +3 -0
  8. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +0 -4
  9. package/src/{Home.stories.mdx → Home.mdx} +41 -39
  10. package/src/Image/index.stories.tsx +101 -101
  11. package/src/RichTextEditor/index.stories.tsx +102 -102
  12. package/src/ThemeProvider/index.tsx +5 -4
  13. package/src/TimePeriods/DateTimePickerInput.tsx +1 -1
  14. package/src/Typography/FluidTypography/index.stories.tsx +63 -63
  15. package/src/components/Form/AccessRights/AccessRights.stories.tsx +5 -5
  16. package/test/setupTests.js +1 -0
  17. package/src/Listing/index.test.tsx +0 -234
  18. /package/{public → src}/fonts/roboto-bold-webfont.ttf +0 -0
  19. /package/{public → src}/fonts/roboto-bold-webfont.woff +0 -0
  20. /package/{public → src}/fonts/roboto-bold-webfont.woff2 +0 -0
  21. /package/{public → src}/fonts/roboto-light-webfont.ttf +0 -0
  22. /package/{public → src}/fonts/roboto-light-webfont.woff +0 -0
  23. /package/{public → src}/fonts/roboto-light-webfont.woff2 +0 -0
  24. /package/{public → src}/fonts/roboto-medium-webfont.ttf +0 -0
  25. /package/{public → src}/fonts/roboto-medium-webfont.woff +0 -0
  26. /package/{public → src}/fonts/roboto-medium-webfont.woff2 +0 -0
  27. /package/{public → src}/fonts/roboto-regular-webfont.ttf +0 -0
  28. /package/{public → src}/fonts/roboto-regular-webfont.woff +0 -0
  29. /package/{public → src}/fonts/roboto-regular-webfont.woff2 +0 -0
@@ -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}
@@ -1,63 +1,63 @@
1
- import { ComponentMeta } from '@storybook/react';
2
-
3
- import { Box } from '@mui/material';
4
-
5
- import FluidTypography, { FluidTypographyProps } from '.';
6
-
7
- interface Props extends FluidTypographyProps {
8
- height?: string | number;
9
- width?: string | number;
10
- }
11
-
12
- const FluidTypographyTemplate = ({
13
- width = '900px',
14
- height = '700px',
15
- text,
16
- variant
17
- }: Props): JSX.Element => {
18
- return (
19
- <Box sx={{ height, width }}>
20
- <FluidTypography text={text} variant={variant} />
21
- </Box>
22
- );
23
- };
24
-
25
- export default {
26
- argTypes: {
27
- height: { control: 'text' },
28
- text: { control: 'text' },
29
- variant: { control: 'text' },
30
- width: { control: 'text' }
31
- },
32
- component: FluidTypographyTemplate,
33
- title: 'Fluid Typography'
34
- } as ComponentMeta<typeof FluidTypographyTemplate>;
35
-
36
- export const basic = FluidTypographyTemplate.bind({});
37
- basic.args = {
38
- text: 'Hello world'
39
- };
40
-
41
- export const with200pxWidth = FluidTypographyTemplate.bind({});
42
- with200pxWidth.args = {
43
- height: '50%',
44
- text: 'Hello world',
45
- width: '50%'
46
- };
47
-
48
- export const with20pxHeight = FluidTypographyTemplate.bind({});
49
- with20pxHeight.args = {
50
- height: '20px',
51
- text: 'Hello world'
52
- };
53
-
54
- export const withLongText = FluidTypographyTemplate.bind({});
55
- withLongText.args = {
56
- text: 'This is a very long text becaaaaaaause it has a lot to sayyyyy !!!!!!!!'
57
- };
58
-
59
- export const withHeading5Variant = FluidTypographyTemplate.bind({});
60
- withHeading5Variant.args = {
61
- text: 'Hello world',
62
- variant: 'h5'
63
- };
1
+ import { ComponentMeta } from '@storybook/react';
2
+
3
+ import { Box } from '@mui/material';
4
+
5
+ import FluidTypography, { FluidTypographyProps } from '.';
6
+
7
+ interface Props extends FluidTypographyProps {
8
+ height?: string | number;
9
+ width?: string | number;
10
+ }
11
+
12
+ const FluidTypographyTemplate = ({
13
+ width = '900px',
14
+ height = '700px',
15
+ text,
16
+ variant
17
+ }: Props): JSX.Element => {
18
+ return (
19
+ <Box sx={{ height, width }}>
20
+ <FluidTypography text={text} variant={variant} />
21
+ </Box>
22
+ );
23
+ };
24
+
25
+ export default {
26
+ argTypes: {
27
+ height: { control: 'text' },
28
+ text: { control: 'text' },
29
+ variant: { control: 'text' },
30
+ width: { control: 'text' }
31
+ },
32
+ component: FluidTypographyTemplate,
33
+ title: 'Fluid Typography'
34
+ } as ComponentMeta<typeof FluidTypographyTemplate>;
35
+
36
+ export const basic = FluidTypographyTemplate.bind({});
37
+ basic.args = {
38
+ text: 'Hello world'
39
+ };
40
+
41
+ export const with200pxWidth = FluidTypographyTemplate.bind({});
42
+ with200pxWidth.args = {
43
+ height: '50%',
44
+ text: 'Hello world',
45
+ width: '50%'
46
+ };
47
+
48
+ export const with20pxHeight = FluidTypographyTemplate.bind({});
49
+ with20pxHeight.args = {
50
+ height: '20px',
51
+ text: 'Hello world'
52
+ };
53
+
54
+ export const withLongText = FluidTypographyTemplate.bind({});
55
+ withLongText.args = {
56
+ text: 'This is a very long text becaaaaaaause it has a lot to sayyyyy !!!!!!!!'
57
+ };
58
+
59
+ export const withHeading5Variant = FluidTypographyTemplate.bind({});
60
+ withHeading5Variant.args = {
61
+ text: 'Hello world',
62
+ variant: 'h5'
63
+ };
@@ -1,5 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
- import { rest } from 'msw';
2
+ import { http, HttpResponse } from 'msw';
3
3
 
4
4
  import { SnackbarProvider } from '../../..';
5
5
 
@@ -18,11 +18,11 @@ const meta: Meta<typeof AccessRightsForm> = {
18
18
  parameters: {
19
19
  msw: {
20
20
  handlers: [
21
- rest.get('api/latest/contact?**', (req, res, ctx) => {
22
- return res(ctx.json(buildResult(false)));
21
+ http.get('api/latest/contact?**', () => {
22
+ return HttpResponse.json(buildResult(false));
23
23
  }),
24
- rest.get('api/latest/contactGroup?**', (req, res, ctx) => {
25
- return res(ctx.json(buildResult(true)));
24
+ http.get('api/latest/contactGroup?**', () => {
25
+ return HttpResponse.json(buildResult(true));
26
26
  })
27
27
  ]
28
28
  }
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-underscore-dangle */
2
2
  /* eslint-disable no-undef */
3
3
 
4
+ import '@testing-library/jest-dom';
4
5
  import i18n from 'i18next';
5
6
  import { initReactI18next } from 'react-i18next';
6
7
  import fetchMock from 'jest-fetch-mock';