@centreon/ui 23.10.25-feature-MON-19319.1 → 23.10.25

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 (54) hide show
  1. package/package.json +1 -8
  2. package/src/Button/Save/index.stories.tsx +10 -5
  3. package/src/Dashboard/DashboardLayout.stories.tsx +5 -3
  4. package/src/Dashboard/Layout.tsx +4 -4
  5. package/src/Dashboard/utils.ts +28 -28
  6. package/src/ThemeProvider/index.tsx +5 -6
  7. package/src/ThemeProvider/palettes.ts +208 -234
  8. package/src/components/Button/Button.styles.ts +2 -7
  9. package/src/components/Button/Button.tsx +1 -1
  10. package/src/components/Form/Dashboard/Dashboard.resource.ts +1 -1
  11. package/src/components/Form/Dashboard/DashboardForm.tsx +10 -6
  12. package/src/components/Form/Dashboard/translatedLabels.ts +1 -0
  13. package/src/components/Header/Header.stories.tsx +27 -0
  14. package/src/components/Header/Header.styles.ts +27 -0
  15. package/src/components/Header/Header.tsx +23 -0
  16. package/src/components/Header/index.ts +1 -1
  17. package/src/components/index.ts +0 -2
  18. package/src/index.ts +2 -0
  19. package/src/layout/TiledListingPage/TiledListingActions.tsx +15 -0
  20. package/src/layout/TiledListingPage/TiledListingContent.tsx +21 -0
  21. package/src/layout/TiledListingPage/TiledListingList.tsx +11 -0
  22. package/src/layout/TiledListingPage/TiledListingPage.styles.ts +16 -0
  23. package/src/layout/TiledListingPage/TiledListingPage.tsx +15 -0
  24. package/src/layout/TiledListingPage/index.ts +4 -0
  25. package/src/screens/dashboard/DashboardsOverview.stories.tsx +101 -109
  26. package/test/setupTests.js +0 -3
  27. package/src/components/Header/PageHeader/PageHeader.stories.tsx +0 -83
  28. package/src/components/Header/PageHeader/PageHeader.styles.ts +0 -105
  29. package/src/components/Header/PageHeader/PageHeader.tsx +0 -15
  30. package/src/components/Header/PageHeader/PageHeaderActions.tsx +0 -17
  31. package/src/components/Header/PageHeader/PageHeaderMain.tsx +0 -15
  32. package/src/components/Header/PageHeader/PageHeaderMenu.tsx +0 -15
  33. package/src/components/Header/PageHeader/PageHeaderTitle.tsx +0 -44
  34. package/src/components/Header/PageHeader/index.ts +0 -12
  35. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
  36. package/src/components/Layout/AreaIndicator.tsx +0 -35
  37. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +0 -81
  38. package/src/components/Layout/PageLayout/PageLayout.styles.ts +0 -30
  39. package/src/components/Layout/PageLayout/PageLayout.tsx +0 -21
  40. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -15
  41. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -24
  42. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +0 -15
  43. package/src/components/Layout/PageLayout/index.ts +0 -10
  44. package/src/components/Layout/index.ts +0 -1
  45. package/src/components/Menu/Menu.tsx +0 -0
  46. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +0 -71
  47. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +0 -5
  48. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +0 -115
  49. package/src/components/Tooltip/TextOverflowTooltip/index.tsx +0 -1
  50. package/src/components/Tooltip/Tooltip.stories.tsx +0 -41
  51. package/src/components/Tooltip/Tooltip.styles.ts +0 -5
  52. package/src/components/Tooltip/Tooltip.tsx +0 -46
  53. package/src/components/Tooltip/index.ts +0 -1
  54. package/src/utils/useResizeObserver.ts +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "23.10.25-feature-MON-19319.1",
3
+ "version": "23.10.25",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -8,7 +8,6 @@
8
8
  "storybook": "storybook dev -p 9001 -c .storybook",
9
9
  "build:storybook": "storybook build -c .storybook -o .out",
10
10
  "test": "jest",
11
- "test:storybook:local": "test-storybook --url http://127.0.0.1:9001",
12
11
  "test:ci": "jest --silent --reporter=jest-junit",
13
12
  "cypress:ui": "cypress open --component --browser=chrome",
14
13
  "cypress:cli:updateSnapshot": "pnpm cypress:cli --env updateSnapshots=true",
@@ -55,23 +54,18 @@
55
54
  "@storybook/addon-interactions": "^7.0.9",
56
55
  "@storybook/addon-styling": "^1.0.6",
57
56
  "@storybook/builder-vite": "^7.0.9",
58
- "@storybook/jest": "^0.1.0",
59
57
  "@storybook/manager-api": "^7.0.9",
60
58
  "@storybook/mdx2-csf": "^1.0.0",
61
59
  "@storybook/preview-api": "^7.0.9",
62
60
  "@storybook/react": "^7.0.9",
63
61
  "@storybook/react-vite": "^7.0.9",
64
- "@storybook/test-runner": "^0.10.0",
65
- "@storybook/testing-library": "^0.1.0",
66
62
  "@storybook/theming": "^7.0.9",
67
63
  "@testing-library/cypress": "^8.0.7",
68
- "@testing-library/jest-dom": "^5.16.5",
69
64
  "@testing-library/react": "^13.4.0",
70
65
  "@testing-library/react-hooks": "^8.0.1",
71
66
  "@types/jest": "^27.5.0",
72
67
  "@types/ramda": "^0.28.12",
73
68
  "@types/react": "^18.0.26",
74
- "@types/testing-library__jest-dom": "^5.14.6",
75
69
  "@vitejs/plugin-react": "^4.0.0",
76
70
  "@vitejs/plugin-react-swc": "^3.3.0",
77
71
  "axios-mock-adapter": "^1.21.4",
@@ -89,7 +83,6 @@
89
83
  "storybook": "^7.0.9",
90
84
  "storybook-addon-mock": "^4.0.0",
91
85
  "storybook-dark-mode": "^3.0.0",
92
- "use-resize-observer": "^9.1.0",
93
86
  "vite": "^4.3.5",
94
87
  "vite-plugin-svgr": "^3.2.0",
95
88
  "vite-plugin-turbosnap": "^1.0.2"
@@ -1,4 +1,4 @@
1
- import { ComponentMeta, ComponentStory } from '@storybook/react';
1
+ import { ComponentStory } from '@storybook/react';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
 
4
4
  import { Theme } from '@mui/material';
@@ -13,7 +13,7 @@ const useStyles = makeStyles()((theme: Theme) => ({
13
13
  }
14
14
  }));
15
15
 
16
- export default {
16
+ const meta = {
17
17
  argTypes: {
18
18
  labelLoading: { control: 'text' },
19
19
  labelSave: { control: 'text' },
@@ -26,8 +26,13 @@ export default {
26
26
 
27
27
  component: ButtonSave,
28
28
 
29
+ parameters: {
30
+ chromatic: { delay: 300 }
31
+ },
29
32
  title: 'Button/Save'
30
- } as ComponentMeta<typeof ButtonSave>;
33
+ };
34
+
35
+ export default meta;
31
36
 
32
37
  const TemplateButtonSave: ComponentStory<typeof ButtonSave> = (args) => (
33
38
  <ButtonSave {...args} />
@@ -42,7 +47,7 @@ export const loading = (): JSX.Element => <ButtonSave loading />;
42
47
  export const succeeded = (): JSX.Element => <ButtonSave succeeded />;
43
48
 
44
49
  export const normalWithText = (): JSX.Element => (
45
- <ButtonSave labelSave="Save" />
50
+ <ButtonSave labelSave="Save" size="medium" />
46
51
  );
47
52
 
48
53
  export const largeWithText = (): JSX.Element => (
@@ -50,7 +55,7 @@ export const largeWithText = (): JSX.Element => (
50
55
  );
51
56
 
52
57
  export const loadingWithTextAndMediumSize = (): JSX.Element => (
53
- <ButtonSave loading labelLoading="Loading" />
58
+ <ButtonSave loading labelLoading="Loading" size="medium" />
54
59
  );
55
60
 
56
61
  export const succeededWithText = (): JSX.Element => (
@@ -1,3 +1,5 @@
1
+ import { ReactElement } from 'react';
2
+
1
3
  import { ComponentMeta } from '@storybook/react';
2
4
  import { Layout } from 'react-grid-layout';
3
5
 
@@ -60,18 +62,18 @@ const generateLayout = (maxElements: number): Array<CustomLayout> => {
60
62
  };
61
63
 
62
64
  interface DashboardTemplateProps {
63
- header?: JSX.Element;
65
+ header?: ReactElement;
64
66
  layout?: Array<CustomLayout>;
65
67
  }
66
68
 
67
- const Header = (): JSX.Element => (
69
+ const Header = (): ReactElement => (
68
70
  <Typography variant="body2">The title</Typography>
69
71
  );
70
72
 
71
73
  const DashboardTemplate = ({
72
74
  header,
73
75
  layout = dashboardLayout
74
- }: DashboardTemplateProps): JSX.Element => (
76
+ }: DashboardTemplateProps): ReactElement => (
75
77
  <DashboardLayout.Layout<CustomLayout> layout={layout}>
76
78
  {layout.map(({ i, content, shouldUseFluidTypography }) => (
77
79
  <DashboardLayout.Item header={header} key={i}>
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { ReactElement, useEffect, useState } from 'react';
2
2
 
3
3
  import { Responsive } from '@visx/visx';
4
4
  import GridLayout, { Layout, WidthProvider } from 'react-grid-layout';
@@ -14,7 +14,7 @@ const ReactGridLayout = WidthProvider(GridLayout);
14
14
 
15
15
  interface DashboardLayoutProps<T> {
16
16
  changeLayout?: (newLayout: Array<Layout>) => void;
17
- children: Array<JSX.Element>;
17
+ children: Array<ReactElement>;
18
18
  displayGrid?: boolean;
19
19
  layout: Array<T>;
20
20
  }
@@ -24,7 +24,7 @@ const Layout = <T extends Layout>({
24
24
  changeLayout,
25
25
  displayGrid,
26
26
  layout
27
- }: DashboardLayoutProps<T>): JSX.Element => {
27
+ }: DashboardLayoutProps<T>): ReactElement => {
28
28
  const { classes } = useDashboardLayoutStyles();
29
29
 
30
30
  const [columns, setColumns] = useState(getColumnsFromScreenSize());
@@ -45,7 +45,7 @@ const Layout = <T extends Layout>({
45
45
  Component: (
46
46
  <ResponsiveHeight>
47
47
  <Responsive.ParentSize>
48
- {({ width, height }): JSX.Element => (
48
+ {({ width, height }): ReactElement => (
49
49
  <div className={classes.container}>
50
50
  {displayGrid && (
51
51
  <Grid columns={columns} height={height} width={width} />
@@ -1,28 +1,28 @@
1
- import { lt } from 'ramda';
2
- import { Layout } from 'react-grid-layout';
3
-
4
- export const maxColumns = 12;
5
- const minColumns = 1;
6
- const breakpoint = 768;
7
-
8
- export const rowHeight = 64;
9
-
10
- export const getIsSmallScreenSize = (): boolean =>
11
- lt(window.innerWidth, breakpoint);
12
-
13
- export const getColumnsFromScreenSize = (): number =>
14
- getIsSmallScreenSize() ? minColumns : maxColumns;
15
-
16
- export const getLayout = <T extends Layout>(layout: Array<T>): Array<T> => {
17
- const isSmallScreenSize = getIsSmallScreenSize();
18
- if (!isSmallScreenSize) {
19
- return layout;
20
- }
21
-
22
- return layout
23
- .sort((a, b) => a.x + a.y - (b.x + b.y))
24
- .map((widget) => ({
25
- ...widget,
26
- w: 1
27
- }));
28
- };
1
+ import { lt } from 'ramda';
2
+ import { Layout } from 'react-grid-layout';
3
+
4
+ export const maxColumns = 12;
5
+ const minColumns = 1;
6
+ const breakpoint = 768;
7
+
8
+ export const rowHeight = 64;
9
+
10
+ export const getIsSmallScreenSize = (): boolean =>
11
+ lt(window.innerWidth, breakpoint);
12
+
13
+ export const getColumnsFromScreenSize = (): number =>
14
+ getIsSmallScreenSize() ? minColumns : maxColumns;
15
+
16
+ export const getLayout = <T extends Layout>(layout: Array<T>): Array<T> => {
17
+ const isSmallScreenSize = getIsSmallScreenSize();
18
+ if (!isSmallScreenSize) {
19
+ return layout;
20
+ }
21
+
22
+ return layout
23
+ .sort((a, b) => a.x + a.y - (b.x + b.y))
24
+ .map((widget) => ({
25
+ ...widget,
26
+ w: 1
27
+ }));
28
+ };
@@ -5,12 +5,12 @@ import { CSSInterpolation } from 'tss-react';
5
5
  import { equals } from 'ramda';
6
6
 
7
7
  import {
8
- ButtonProps,
8
+ ThemeProvider as MuiThemeProvider,
9
+ Theme,
10
+ StyledEngineProvider,
9
11
  createTheme,
10
12
  InputBaseProps,
11
- StyledEngineProvider,
12
- Theme,
13
- ThemeProvider as MuiThemeProvider
13
+ ButtonProps
14
14
  } from '@mui/material';
15
15
  import CssBaseline from '@mui/material/CssBaseline';
16
16
  import { autocompleteClasses } from '@mui/material/Autocomplete';
@@ -177,7 +177,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
177
177
  padding: 0;
178
178
  width: 100%;
179
179
  height: 100%;
180
- text-rendering: optimizeLegibility;
181
180
  }
182
181
  body {
183
182
  background-color: ${theme.palette.background.paper};
@@ -206,7 +205,7 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
206
205
  @font-face {
207
206
  font-family: 'Roboto';
208
207
  font-style: normal;
209
- font-weight: 700;
208
+ font-weight: 600;
210
209
  src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
211
210
  }
212
211
  `