@centreon/ui 23.10.32-MON-19938-cloud-notifications-fix-search-select-boxes.2 → 23.10.32
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 +2 -12
- package/src/Dashboard/DashboardLayout.stories.tsx +5 -3
- package/src/Dashboard/Layout.tsx +4 -4
- package/src/Dashboard/utils.ts +28 -28
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +3 -13
- package/src/Form/Inputs/models.ts +0 -13
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +0 -10
- package/src/ThemeProvider/index.tsx +5 -6
- package/src/ThemeProvider/palettes.ts +215 -389
- package/src/api/TestQueryProvider.tsx +1 -2
- package/src/api/useFetchQuery/index.ts +7 -8
- package/src/api/useMutationQuery/index.ts +10 -11
- package/src/components/Button/Button.styles.ts +3 -17
- package/src/components/Button/Button.tsx +3 -6
- package/src/components/Button/Icon/IconButton.styles.ts +2 -9
- package/src/components/DataTable/DataTable.stories.tsx +0 -9
- package/src/components/DataTable/DataTable.styles.ts +0 -5
- package/src/components/DataTable/DataTable.tsx +6 -8
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +1 -4
- package/src/components/DataTable/Item/DataTableItem.styles.ts +2 -5
- package/src/components/DataTable/Item/DataTableItem.tsx +18 -36
- package/src/components/Header/Header.stories.tsx +27 -0
- package/src/components/Header/Header.styles.ts +27 -0
- package/src/components/Header/Header.tsx +23 -0
- package/src/components/Header/index.ts +1 -1
- package/src/components/Modal/index.ts +0 -2
- package/src/components/index.ts +0 -3
- package/src/index.ts +2 -0
- package/src/layout/TiledListingPage/TiledListingActions.tsx +15 -0
- package/src/layout/TiledListingPage/TiledListingContent.tsx +21 -0
- package/src/layout/TiledListingPage/TiledListingList.tsx +11 -0
- package/src/layout/TiledListingPage/TiledListingPage.styles.ts +16 -0
- package/src/layout/TiledListingPage/TiledListingPage.tsx +15 -0
- package/src/layout/TiledListingPage/index.ts +4 -0
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +102 -110
- package/src/utils/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/test/setupTests.js +1 -1
- package/src/base/tokens/README.md +0 -3
- package/src/base/tokens/source/$metadata.json +0 -5
- package/src/base/tokens/source/base.json +0 -142
- package/src/base/tokens/themes/base.tokens.d.ts +0 -38
- package/src/base/tokens/themes/base.tokens.json +0 -695
- package/src/base/tokens/themes/base.tokens.ts +0 -38
- package/src/base/tokens/themes/ui-dark.tokens.d.ts +0 -38
- package/src/base/tokens/themes/ui-dark.tokens.json +0 -695
- package/src/base/tokens/themes/ui-dark.tokens.ts +0 -38
- package/src/base/tokens/themes/ui-light.tokens.d.ts +0 -38
- package/src/base/tokens/themes/ui-light.tokens.json +0 -695
- package/src/base/tokens/themes/ui-light.tokens.ts +0 -38
- package/src/components/Header/PageHeader/PageHeader.stories.tsx +0 -88
- package/src/components/Header/PageHeader/PageHeader.styles.ts +0 -99
- package/src/components/Header/PageHeader/PageHeader.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderActions.tsx +0 -17
- package/src/components/Header/PageHeader/PageHeaderMain.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderMenu.tsx +0 -15
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +0 -47
- package/src/components/Header/PageHeader/index.ts +0 -12
- package/src/components/Layout/AreaIndicator.styles.ts +0 -33
- package/src/components/Layout/AreaIndicator.tsx +0 -35
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +0 -81
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +0 -40
- package/src/components/Layout/PageLayout/PageLayout.tsx +0 -21
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -15
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -24
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +0 -15
- package/src/components/Layout/PageLayout/index.ts +0 -10
- package/src/components/Layout/index.ts +0 -1
- package/src/components/Menu/Button/MenuButton.stories.tsx +0 -16
- package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
- package/src/components/Menu/Button/MenuButton.tsx +0 -62
- package/src/components/Menu/Button/index.ts +0 -1
- package/src/components/Menu/Menu.stories.tsx +0 -71
- package/src/components/Menu/Menu.styles.ts +0 -70
- package/src/components/Menu/Menu.tsx +0 -25
- package/src/components/Menu/MenuDivider.tsx +0 -13
- package/src/components/Menu/MenuItem.tsx +0 -36
- package/src/components/Menu/MenuItems.tsx +0 -35
- package/src/components/Menu/index.ts +0 -12
- package/src/components/Menu/useMenu.tsx +0 -79
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +0 -70
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +0 -5
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +0 -115
- package/src/components/Tooltip/TextOverflowTooltip/index.tsx +0 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -41
- package/src/components/Tooltip/Tooltip.styles.ts +0 -5
- package/src/components/Tooltip/Tooltip.tsx +0 -46
- package/src/components/Tooltip/index.ts +0 -1
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
- package/src/styles/tokens/themes/_ui-dark.tokens.json +0 -695
- package/src/styles/tokens/themes/_ui-light.tokens.json +0 -695
- 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.32
|
|
3
|
+
"version": "23.10.32",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -8,12 +8,10 @@
|
|
|
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",
|
|
15
|
-
"cypress:cli": "cypress run --component --browser=chrome"
|
|
16
|
-
"tokens:transform": "TS_NODE_PROJECT=tsconfig.node.json ts-node style-dictionary.transform.ts"
|
|
14
|
+
"cypress:cli": "cypress run --component --browser=chrome"
|
|
17
15
|
},
|
|
18
16
|
"sideEffects": false,
|
|
19
17
|
"repository": {
|
|
@@ -56,23 +54,18 @@
|
|
|
56
54
|
"@storybook/addon-interactions": "^7.0.9",
|
|
57
55
|
"@storybook/addon-styling": "^1.0.6",
|
|
58
56
|
"@storybook/builder-vite": "^7.0.9",
|
|
59
|
-
"@storybook/jest": "^0.1.0",
|
|
60
57
|
"@storybook/manager-api": "^7.0.9",
|
|
61
58
|
"@storybook/mdx2-csf": "^1.0.0",
|
|
62
59
|
"@storybook/preview-api": "^7.0.9",
|
|
63
60
|
"@storybook/react": "^7.0.9",
|
|
64
61
|
"@storybook/react-vite": "^7.0.9",
|
|
65
|
-
"@storybook/test-runner": "^0.10.0",
|
|
66
|
-
"@storybook/testing-library": "^0.1.0",
|
|
67
62
|
"@storybook/theming": "^7.0.9",
|
|
68
63
|
"@testing-library/cypress": "^8.0.7",
|
|
69
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
70
64
|
"@testing-library/react": "^13.4.0",
|
|
71
65
|
"@testing-library/react-hooks": "^8.0.1",
|
|
72
66
|
"@types/jest": "^27.5.0",
|
|
73
67
|
"@types/ramda": "^0.28.12",
|
|
74
68
|
"@types/react": "^18.0.26",
|
|
75
|
-
"@types/testing-library__jest-dom": "^5.14.6",
|
|
76
69
|
"@vitejs/plugin-react": "^4.0.0",
|
|
77
70
|
"@vitejs/plugin-react-swc": "^3.3.0",
|
|
78
71
|
"axios-mock-adapter": "^1.21.4",
|
|
@@ -90,9 +83,6 @@
|
|
|
90
83
|
"storybook": "^7.0.9",
|
|
91
84
|
"storybook-addon-mock": "^4.0.0",
|
|
92
85
|
"storybook-dark-mode": "^3.0.0",
|
|
93
|
-
"style-dictionary": "^3.8.0",
|
|
94
|
-
"ts-node": "^10.9.1",
|
|
95
|
-
"use-resize-observer": "^9.1.0",
|
|
96
86
|
"vite": "^4.3.5",
|
|
97
87
|
"vite-plugin-svgr": "^3.2.0",
|
|
98
88
|
"vite-plugin-turbosnap": "^1.0.2"
|
|
@@ -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?:
|
|
65
|
+
header?: ReactElement;
|
|
64
66
|
layout?: Array<CustomLayout>;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
const Header = ():
|
|
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):
|
|
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}>
|
package/src/Dashboard/Layout.tsx
CHANGED
|
@@ -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<
|
|
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>):
|
|
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 }):
|
|
48
|
+
{({ width, height }): ReactElement => (
|
|
49
49
|
<div className={classes.container}>
|
|
50
50
|
{displayGrid && (
|
|
51
51
|
<Grid columns={columns} height={height} width={width} />
|
package/src/Dashboard/utils.ts
CHANGED
|
@@ -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
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { FormikValues, useFormikContext } from 'formik';
|
|
4
4
|
import { equals, isEmpty, path, split } from 'ramda';
|
|
@@ -11,12 +11,7 @@ import {
|
|
|
11
11
|
} from '../..';
|
|
12
12
|
import MultiConnectedAutocompleteField from '../../InputField/Select/Autocomplete/Connected/Multi';
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
AutoCompleteChangeData,
|
|
16
|
-
InputPropsWithoutGroup,
|
|
17
|
-
InputType,
|
|
18
|
-
Reason
|
|
19
|
-
} from './models';
|
|
14
|
+
import { InputPropsWithoutGroup, InputType } from './models';
|
|
20
15
|
|
|
21
16
|
const defaultFilterKey = 'name';
|
|
22
17
|
|
|
@@ -34,8 +29,6 @@ const ConnectedAutocomplete = ({
|
|
|
34
29
|
}: InputPropsWithoutGroup): JSX.Element => {
|
|
35
30
|
const { t } = useTranslation();
|
|
36
31
|
|
|
37
|
-
const [autocompleteChangeData, setAutocompleteChangeData] =
|
|
38
|
-
useState<AutoCompleteChangeData>();
|
|
39
32
|
const { values, touched, errors, setFieldValue, setFieldTouched } =
|
|
40
33
|
useFormikContext<FormikValues>();
|
|
41
34
|
|
|
@@ -62,9 +55,7 @@ const ConnectedAutocomplete = ({
|
|
|
62
55
|
const fieldNamePath = split('.', fieldName);
|
|
63
56
|
|
|
64
57
|
const changeAutocomplete = useCallback(
|
|
65
|
-
(_, value
|
|
66
|
-
setAutocompleteChangeData({ reason, value });
|
|
67
|
-
|
|
58
|
+
(_, value): void => {
|
|
68
59
|
if (change) {
|
|
69
60
|
change({ setFieldValue, value });
|
|
70
61
|
|
|
@@ -113,7 +104,6 @@ const ConnectedAutocomplete = ({
|
|
|
113
104
|
return useMemoComponent({
|
|
114
105
|
Component: (
|
|
115
106
|
<AutocompleteField
|
|
116
|
-
autocompleteChangeData={autocompleteChangeData}
|
|
117
107
|
dataTestId={dataTestId}
|
|
118
108
|
disableClearable={false}
|
|
119
109
|
disabled={disabled}
|
|
@@ -103,16 +103,3 @@ export interface Group {
|
|
|
103
103
|
name: string;
|
|
104
104
|
order: number;
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
export enum Reason {
|
|
108
|
-
blur = 'blur',
|
|
109
|
-
clear = 'clear',
|
|
110
|
-
createOption = 'createOption',
|
|
111
|
-
removeOption = 'removeOption',
|
|
112
|
-
selectOption = 'selectOption'
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface AutoCompleteChangeData {
|
|
116
|
-
reason: Reason;
|
|
117
|
-
value: string;
|
|
118
|
-
}
|
|
@@ -28,10 +28,8 @@ import {
|
|
|
28
28
|
SearchParameter
|
|
29
29
|
} from '../../../../api/buildListingEndpoint/models';
|
|
30
30
|
import useFetchQuery from '../../../../api/useFetchQuery';
|
|
31
|
-
import { AutoCompleteChangeData } from '../../../../Form/Inputs/models';
|
|
32
31
|
|
|
33
32
|
export interface ConnectedAutoCompleteFieldProps<TData> {
|
|
34
|
-
autocompleteChangeData?: AutoCompleteChangeData;
|
|
35
33
|
conditionField?: keyof SelectEntry;
|
|
36
34
|
field: string;
|
|
37
35
|
getEndpoint: ({ search, page }) => string;
|
|
@@ -57,7 +55,6 @@ const ConnectedAutocompleteField = (
|
|
|
57
55
|
getRenderedOptionText = (option): string => option.name?.toString(),
|
|
58
56
|
getRequestHeaders,
|
|
59
57
|
displayOptionThumbnail,
|
|
60
|
-
autocompleteChangeData,
|
|
61
58
|
...props
|
|
62
59
|
}: ConnectedAutoCompleteFieldProps<TData> &
|
|
63
60
|
Omit<AutocompleteFieldProps, 'options'>): JSX.Element => {
|
|
@@ -277,13 +274,6 @@ const ConnectedAutocompleteField = (
|
|
|
277
274
|
);
|
|
278
275
|
}, useDeepCompare([searchConditions]));
|
|
279
276
|
|
|
280
|
-
useEffect(() => {
|
|
281
|
-
if (!autocompleteChangeData) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
setSearchParameter(undefined);
|
|
285
|
-
}, [autocompleteChangeData?.reason, autocompleteChangeData?.value]);
|
|
286
|
-
|
|
287
277
|
useEffect(() => {
|
|
288
278
|
if (!optionsOpen) {
|
|
289
279
|
return;
|
|
@@ -5,12 +5,12 @@ import { CSSInterpolation } from 'tss-react';
|
|
|
5
5
|
import { equals } from 'ramda';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
ThemeProvider as MuiThemeProvider,
|
|
9
|
+
Theme,
|
|
10
|
+
StyledEngineProvider,
|
|
9
11
|
createTheme,
|
|
10
12
|
InputBaseProps,
|
|
11
|
-
|
|
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:
|
|
208
|
+
font-weight: 600;
|
|
210
209
|
src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
|
|
211
210
|
}
|
|
212
211
|
`
|