@centreon/ui 23.10.45 → 23.10.46

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "23.10.45",
3
+ "version": "23.10.46",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -1,14 +1,17 @@
1
+ /* eslint-disable react/no-array-index-key */
1
2
  import * as React from 'react';
2
3
 
3
4
  import { makeStyles } from 'tss-react/mui';
4
5
  import { useTranslation } from 'react-i18next';
6
+ import { equals } from 'ramda';
5
7
 
6
8
  import {
7
9
  SvgIconProps,
8
10
  MenuList,
9
11
  MenuItem,
10
12
  ListItemText,
11
- ListItemIcon
13
+ ListItemIcon,
14
+ Divider
12
15
  } from '@mui/material';
13
16
 
14
17
  interface ActionsType {
@@ -18,7 +21,7 @@ interface ActionsType {
18
21
  }
19
22
 
20
23
  interface Props {
21
- actions: Array<ActionsType>;
24
+ actions: Array<ActionsType | 'divider'>;
22
25
  className?: string;
23
26
  }
24
27
 
@@ -34,7 +37,13 @@ const ActionsList = ({ className, actions }: Props): JSX.Element => {
34
37
 
35
38
  return (
36
39
  <MenuList className={cx(classes.list, className)}>
37
- {actions?.map(({ Icon, label, onClick }) => {
40
+ {actions?.map((action, idx) => {
41
+ if (equals(action, 'divider')) {
42
+ return <Divider key={`divider_${idx}`} />;
43
+ }
44
+
45
+ const { label, Icon, onClick } = action as ActionsType;
46
+
38
47
  return (
39
48
  <MenuItem aria-label={label} key={label} onClick={onClick}>
40
49
  <ListItemIcon>
@@ -72,8 +72,7 @@ export const useDashboardItemStyles = makeStyles()((theme) => ({
72
72
  width: '100%'
73
73
  },
74
74
  widgetContent: {
75
- height: '100%',
76
- padding: theme.spacing(1, 2)
75
+ height: '100%'
77
76
  },
78
77
  widgetHeader: {
79
78
  '&:hover': {
@@ -81,5 +80,8 @@ export const useDashboardItemStyles = makeStyles()((theme) => ({
81
80
  },
82
81
  cursor: 'move',
83
82
  padding: theme.spacing(0.5, 2)
83
+ },
84
+ widgetPadding: {
85
+ padding: theme.spacing(1, 2)
84
86
  }
85
87
  }));
@@ -17,6 +17,7 @@ import { useDashboardItemStyles } from './Dashboard.styles';
17
17
  interface DashboardItemProps {
18
18
  children: ReactElement;
19
19
  className?: string;
20
+ disablePadding?: boolean;
20
21
  header?: ReactElement;
21
22
  id: string;
22
23
  onMouseDown?: (e: MouseEvent<HTMLDivElement>) => void;
@@ -35,11 +36,12 @@ const Item = forwardRef(
35
36
  onMouseDown,
36
37
  onMouseUp,
37
38
  onTouchEnd,
38
- id
39
+ id,
40
+ disablePadding = false
39
41
  }: DashboardItemProps,
40
42
  ref: ForwardedRef<HTMLDivElement>
41
43
  ): ReactElement => {
42
- const { classes } = useDashboardItemStyles();
44
+ const { classes, cx } = useDashboardItemStyles();
43
45
 
44
46
  const hasHeader = !isNil(header);
45
47
 
@@ -69,7 +71,14 @@ const Item = forwardRef(
69
71
  {header}
70
72
  </div>
71
73
  )}
72
- <div className={classes.widgetContent}>{children}</div>
74
+ <div
75
+ className={cx(
76
+ classes.widgetContent,
77
+ !disablePadding && classes.widgetPadding
78
+ )}
79
+ >
80
+ {children}
81
+ </div>
73
82
  </Card>
74
83
  </div>
75
84
  ),
@@ -12,7 +12,7 @@ import { useStyles } from './DataTableEmptyState.styles';
12
12
  type ListEmptyStateProps = {
13
13
  canCreate?: boolean;
14
14
  labels: {
15
- actions: {
15
+ actions?: {
16
16
  create: string;
17
17
  };
18
18
  title: string;
@@ -42,7 +42,7 @@ const DataTableEmptyState = ({
42
42
  iconVariant="start"
43
43
  onClick={() => onCreate?.()}
44
44
  >
45
- {t(labels.actions.create)}
45
+ {t(labels.actions?.create || '')}
46
46
  </Button>
47
47
  )}
48
48
  </div>
@@ -15,6 +15,10 @@ const useStyles = makeStyles()((theme) => ({
15
15
  },
16
16
  '&[data-size="small"] .MuiDialog-paper': {
17
17
  width: '400px'
18
+ },
19
+ '&[data-size="xlarge"] .MuiDialog-paper': {
20
+ maxWidth: '1200px',
21
+ width: 'calc(100% - 64px)'
18
22
  }
19
23
  },
20
24
  modalActions: {
@@ -16,7 +16,7 @@ export type ModalProps = {
16
16
  reason: 'escapeKeyDown' | 'backdropClick' | 'closeButton'
17
17
  ) => void;
18
18
  open: boolean;
19
- size?: 'small' | 'medium' | 'large';
19
+ size?: 'small' | 'medium' | 'large' | 'xlarge';
20
20
  } & AriaLabelingAttributes;
21
21
 
22
22
  /** *