@centreon/ui 23.10.1-MON-22436-cloud-notification-fix-wording.6 → 23.10.1-MON-20803-RS-add-basic-filter.26

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 (32) hide show
  1. package/package.json +1 -1
  2. package/src/ActionsList/index.stories.tsx +0 -74
  3. package/src/ActionsList/index.tsx +12 -20
  4. package/src/Checkbox/Checkbox.tsx +20 -18
  5. package/src/Checkbox/CheckboxGroup/index.tsx +14 -5
  6. package/src/Listing/Listing.cypress.spec.tsx +15 -17
  7. package/src/Listing/Listing.styles.ts +0 -5
  8. package/src/Listing/index.stories.tsx +1 -2
  9. package/src/Listing/index.tsx +151 -140
  10. package/src/ListingPage/index.stories.tsx +8 -21
  11. package/src/ListingPage/index.tsx +37 -19
  12. package/src/PopoverMenu/index.tsx +18 -4
  13. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -23
  14. package/src/RichTextEditor/index.stories.tsx +2 -4
  15. package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +0 -15
  16. package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +0 -2
  17. package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +2 -4
  18. package/src/api/buildListingEndpoint/index.ts +1 -1
  19. package/src/components/Menu/Button/MenuButton.tsx +0 -3
  20. package/src/components/Tooltip/Tooltip.styles.ts +5 -0
  21. package/src/components/Tooltip/Tooltip.tsx +8 -19
  22. package/src/index.ts +4 -1
  23. package/src/utils/useDebounce.ts +7 -2
  24. package/src/ActionsList/ActionsList.styles.ts +0 -116
  25. package/src/ActionsList/models.ts +0 -8
  26. package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +0 -115
  27. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +0 -62
  28. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.styles.tsx +0 -19
  29. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +0 -67
  30. package/src/components/Tooltip/ConfirmationTooltip/TooltipContent.tsx +0 -31
  31. package/src/components/Tooltip/ConfirmationTooltip/index.ts +0 -0
  32. package/src/components/Tooltip/ConfirmationTooltip/models.ts +0 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "23.10.1-MON-22436-cloud-notification-fix-wording.6",
3
+ "version": "23.10.1-MON-20803-RS-add-basic-filter.26",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -24,68 +24,6 @@ const actions = [
24
24
  }
25
25
  ];
26
26
 
27
- const actionsWithVariants = [
28
- {
29
- label: 'No variant',
30
- onClick: (): void => undefined
31
- },
32
- {
33
- label: 'Primary',
34
- onClick: (): void => undefined,
35
- variant: 'primary'
36
- },
37
- {
38
- label: 'Secondary',
39
- onClick: (): void => undefined,
40
- variant: 'secondary'
41
- },
42
- {
43
- label: 'Success',
44
- onClick: (): void => undefined,
45
- variant: 'success'
46
- },
47
- {
48
- label: 'Warning',
49
- onClick: (): void => undefined,
50
- variant: 'warning'
51
- },
52
- {
53
- label: 'Error',
54
- onClick: (): void => undefined,
55
- variant: 'error'
56
- },
57
- {
58
- label: 'Info',
59
- onClick: (): void => undefined,
60
- variant: 'info'
61
- },
62
- {
63
- label: 'Pending',
64
- onClick: (): void => undefined,
65
- variant: 'pending'
66
- }
67
- ];
68
-
69
- const actionsWithSecondaryLabel = [
70
- {
71
- Icon: EditIcon,
72
- label: 'Edit',
73
- onClick: (): void => undefined
74
- },
75
- {
76
- Icon: CopyIcon,
77
- label: 'Duplicate',
78
- onClick: (): void => undefined,
79
- secondaryLabel:
80
- 'This is a secondary label that the purpose is to give a small description about an action'
81
- },
82
- {
83
- Icon: DeleteIcon,
84
- label: 'Delete',
85
- onClick: (): void => undefined
86
- }
87
- ];
88
-
89
27
  export default {
90
28
  argTypes: {},
91
29
  component: ActionsList,
@@ -101,15 +39,3 @@ export const Playground = Template.bind({});
101
39
  Playground.args = {
102
40
  actions
103
41
  };
104
-
105
- export const Variants = Template.bind({});
106
-
107
- Variants.args = {
108
- actions: actionsWithVariants
109
- };
110
-
111
- export const SecondaryLabel = Template.bind({});
112
-
113
- SecondaryLabel.args = {
114
- actions: actionsWithSecondaryLabel
115
- };
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
+ import { makeStyles } from 'tss-react/mui';
2
3
  import { useTranslation } from 'react-i18next';
3
4
  import { equals } from 'ramda';
4
5
 
@@ -11,15 +12,10 @@ import {
11
12
  Divider
12
13
  } from '@mui/material';
13
14
 
14
- import { useStyles } from './ActionsList.styles';
15
- import { ActionVariants } from './models';
16
-
17
15
  interface ActionsType {
18
16
  Icon?: (props: SvgIconProps) => JSX.Element;
19
17
  label: string;
20
18
  onClick?: (e?) => void;
21
- secondaryLabel?: string;
22
- variant?: ActionVariants;
23
19
  }
24
20
 
25
21
  interface Props {
@@ -28,6 +24,12 @@ interface Props {
28
24
  listItemClassName?: string;
29
25
  }
30
26
 
27
+ const useStyles = makeStyles()({
28
+ list: {
29
+ maxWidth: '100%'
30
+ }
31
+ });
32
+
31
33
  const ActionsList = ({
32
34
  className,
33
35
  listItemClassName,
@@ -43,28 +45,18 @@ const ActionsList = ({
43
45
  return <Divider key={`divider_${idx}`} />;
44
46
  }
45
47
 
46
- const { label, Icon, onClick, variant, secondaryLabel } =
47
- action as ActionsType;
48
+ const { label, Icon, onClick } = action as ActionsType;
48
49
 
49
50
  return (
50
- <MenuItem
51
- aria-label={label}
52
- className={classes.item}
53
- data-variant={variant}
54
- id={label}
55
- key={label}
56
- onClick={onClick}
57
- >
51
+ <MenuItem aria-label={label} id={label} key={label} onClick={onClick}>
58
52
  {Icon && (
59
53
  <ListItemIcon>
60
54
  <Icon fontSize="small" />
61
55
  </ListItemIcon>
62
56
  )}
63
- <ListItemText
64
- className={listItemClassName}
65
- primary={t(label)}
66
- secondary={secondaryLabel && t(secondaryLabel)}
67
- />
57
+ <ListItemText className={listItemClassName}>
58
+ {t(label)}
59
+ </ListItemText>
68
60
  </MenuItem>
69
61
  );
70
62
  })}
@@ -2,16 +2,13 @@ import { makeStyles } from 'tss-react/mui';
2
2
  import { T, always, cond, equals } from 'ramda';
3
3
 
4
4
  import { SvgIconComponent } from '@mui/icons-material';
5
- import {
6
- FormControlLabel,
7
- Checkbox as MuiCheckbox,
8
- Box,
9
- Typography
10
- } from '@mui/material';
5
+ import Typography, { TypographyTypeMap } from '@mui/material/Typography';
6
+ import { FormControlLabel, Checkbox as MuiCheckbox, Box } from '@mui/material';
11
7
 
12
8
  export type LabelPlacement = 'bottom' | 'top' | 'end' | 'start' | undefined;
13
9
 
14
10
  interface StyleProps {
11
+ disabled: boolean;
15
12
  hasIcon: boolean;
16
13
  labelPlacement: LabelPlacement;
17
14
  }
@@ -25,13 +22,7 @@ const getLabelSpacing = (labelPlacement, theme): string => {
25
22
  };
26
23
 
27
24
  const useStyles = makeStyles<StyleProps>()(
28
- (theme, { hasIcon, labelPlacement }) => ({
29
- checkbox: {
30
- '&.Mui-checked': {
31
- color: theme.palette.primary.main
32
- },
33
- color: theme.palette.primary.main
34
- },
25
+ (theme, { disabled, hasIcon, labelPlacement }) => ({
35
26
  container: hasIcon
36
27
  ? {
37
28
  alignItems: 'center',
@@ -45,8 +36,13 @@ const useStyles = makeStyles<StyleProps>()(
45
36
  fontSize: theme.spacing(10)
46
37
  },
47
38
  label: {
48
- fontSize: theme.typography.body2.fontSize,
49
- fontWeight: theme.typography.fontWeightMedium,
39
+ color: disabled
40
+ ? theme.palette.action.disabled
41
+ : theme.palette.text.secondary,
42
+ fontSize: theme.typography.body1.fontSize,
43
+ fontWeight: equals(labelPlacement, 'top')
44
+ ? theme.typography.fontWeightBold
45
+ : theme.typography.fontWeightMedium,
50
46
  padding: getLabelSpacing(labelPlacement, theme)
51
47
  }
52
48
  })
@@ -60,6 +56,7 @@ interface Props {
60
56
  disabled?: boolean;
61
57
  label: string;
62
58
  labelPlacement?: LabelPlacement;
59
+ labelProps?: TypographyTypeMap['props'];
63
60
  onChange?: (e) => void;
64
61
  }
65
62
 
@@ -71,9 +68,11 @@ const Checkbox = ({
71
68
  className,
72
69
  disabled = false,
73
70
  labelPlacement = 'end',
74
- dataTestId
71
+ dataTestId,
72
+ labelProps
75
73
  }: Props): JSX.Element => {
76
74
  const { classes, cx } = useStyles({
75
+ disabled,
77
76
  hasIcon: !!Icon,
78
77
  labelPlacement
79
78
  });
@@ -85,7 +84,6 @@ const Checkbox = ({
85
84
  control={
86
85
  <MuiCheckbox
87
86
  checked={checked}
88
- className={classes.checkbox}
89
87
  color="primary"
90
88
  disabled={disabled}
91
89
  id={label}
@@ -96,7 +94,11 @@ const Checkbox = ({
96
94
  }
97
95
  data-testid={dataTestId || ''}
98
96
  key={label}
99
- label={<Typography className={classes.label}>{label}</Typography>}
97
+ label={
98
+ <Typography classes={{ root: classes.label }} {...labelProps}>
99
+ {label}
100
+ </Typography>
101
+ }
100
102
  labelPlacement={labelPlacement}
101
103
  sx={{ margin: 0, padding: 0 }}
102
104
  />
@@ -1,15 +1,19 @@
1
1
  import { equals, includes } from 'ramda';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
 
4
- import { FormGroup } from '@mui/material';
4
+ import FormGroup, { FormGroupProps } from '@mui/material/FormGroup';
5
+ import { TypographyTypeMap } from '@mui/material/Typography';
5
6
 
6
7
  import Checkbox, { LabelPlacement } from '../Checkbox';
7
8
 
8
9
  interface Props {
10
+ className?: string;
9
11
  dataTestId?: string;
10
12
  direction?: 'horizontal' | 'vertical';
11
13
  disabled?: boolean;
14
+ formGroupProps?: FormGroupProps;
12
15
  labelPlacement?: LabelPlacement;
16
+ labelProps?: TypographyTypeMap['props'];
13
17
  onChange?: (e) => void;
14
18
  options: Array<string>;
15
19
  values: Array<string>;
@@ -34,27 +38,32 @@ const CheckboxGroup = ({
34
38
  onChange,
35
39
  labelPlacement = 'end',
36
40
  disabled = false,
37
- dataTestId
41
+ dataTestId,
42
+ className,
43
+ labelProps,
44
+ formGroupProps
38
45
  }: Props): JSX.Element => {
39
- const { classes } = useStyles();
46
+ const { classes, cx } = useStyles();
40
47
 
41
48
  const row = !equals(direction, 'vertical');
42
49
 
43
50
  return (
44
51
  <FormGroup
45
- className={classes.container}
52
+ classes={{ root: classes.container }}
46
53
  data-testid={dataTestId || ''}
47
54
  row={row}
55
+ {...formGroupProps}
48
56
  >
49
57
  {options.map((value) => {
50
58
  return (
51
59
  <Checkbox
52
60
  checked={includes(value, values)}
53
- className={classes.checkbox}
61
+ className={cx(classes.checkbox, className)}
54
62
  disabled={disabled}
55
63
  key={value}
56
64
  label={value}
57
65
  labelPlacement={labelPlacement}
66
+ labelProps={labelProps}
58
67
  onChange={onChange}
59
68
  />
60
69
  );
@@ -67,23 +67,21 @@ const mountListing = (): void => {
67
67
 
68
68
  cy.mount({
69
69
  Component: (
70
- <div style={{ height: '100vh' }}>
71
- <Listing
72
- checkable
73
- columns={columnsWithSubItems}
74
- currentPage={1}
75
- limit={10}
76
- rows={listingWithSubItems}
77
- subItems={{
78
- canCheckSubItems: false,
79
- enable: true,
80
- labelCollapse: 'Collapse',
81
- labelExpand: 'Expand',
82
- rowProperty: 'subItems'
83
- }}
84
- totalRows={10}
85
- />
86
- </div>
70
+ <Listing
71
+ checkable
72
+ columns={columnsWithSubItems}
73
+ currentPage={1}
74
+ limit={10}
75
+ rows={listingWithSubItems}
76
+ subItems={{
77
+ canCheckSubItems: false,
78
+ enable: true,
79
+ labelCollapse: 'Collapse',
80
+ labelExpand: 'Expand',
81
+ rowProperty: 'subItems'
82
+ }}
83
+ totalRows={10}
84
+ />
87
85
  )
88
86
  });
89
87
  };
@@ -30,11 +30,6 @@ const useListingStyles = makeStyles<StylesProps>()(
30
30
  height: '100%',
31
31
  width: '100%'
32
32
  },
33
- listingContainer: {
34
- height: '100%',
35
- overflow: 'hidden',
36
- width: '100%'
37
- },
38
33
  loadingIndicator: {
39
34
  height: loadingIndicatorHeight,
40
35
  width: '100%'
@@ -34,8 +34,7 @@ type Story = StoryObj<typeof Listing>;
34
34
 
35
35
  const useStyles = makeStyles()((theme) => ({
36
36
  listing: {
37
- backgroundColor: theme.palette.background.default,
38
- height: '100vh'
37
+ backgroundColor: theme.palette.background.default
39
38
  }
40
39
  }));
41
40