@centreon/ui 25.6.0 → 25.6.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 (50) hide show
  1. package/package.json +15 -6
  2. package/src/Button/Save/index.stories.tsx +1 -0
  3. package/src/Colors/index.tsx +1 -1
  4. package/src/Dashboard/Dashboard.styles.ts +1 -1
  5. package/src/Dashboard/Layout.tsx +1 -1
  6. package/src/Dialog/UnsavedChanges/index.stories.tsx +1 -0
  7. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +0 -2
  8. package/src/Listing/ActionBar/Pagination.tsx +10 -23
  9. package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
  10. package/src/Listing/Cell/DataCell.tsx +6 -6
  11. package/src/Listing/Cell/EllipsisTypography.tsx +10 -32
  12. package/src/Listing/Cell/index.tsx +37 -76
  13. package/src/Listing/Checkbox.tsx +8 -20
  14. package/src/Listing/Header/Cell/ListingHeaderCell.tsx +17 -14
  15. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +5 -9
  16. package/src/Listing/Header/ListingHeader.tsx +2 -5
  17. package/src/Listing/Header/_internals/Label.tsx +1 -17
  18. package/src/Listing/Row/EmptyRow.tsx +2 -6
  19. package/src/Listing/Row/Row.tsx +7 -36
  20. package/src/Listing/index.stories.tsx +1 -0
  21. package/src/Listing/index.tsx +20 -22
  22. package/src/ListingPage/index.stories.tsx +1 -0
  23. package/src/MultiSelectEntries/index.stories.tsx +1 -0
  24. package/src/MultiSelectEntries/index.tsx +1 -1
  25. package/src/SortableItems/index.stories.tsx +2 -2
  26. package/src/StoryBookThemeProvider/index.tsx +3 -1
  27. package/src/ThemeProvider/index.tsx +3 -1
  28. package/src/ThemeProvider/tailwindcss.css +202 -0
  29. package/src/components/Avatar/Avatar.stories.tsx +1 -0
  30. package/src/components/Button/Button.module.css +38 -0
  31. package/src/components/Button/Button.stories.tsx +25 -0
  32. package/src/components/Button/Button.tsx +2 -5
  33. package/src/components/CrudPage/CrudPage.stories.tsx +1 -0
  34. package/src/components/DataTable/DataTable.stories.tsx +1 -0
  35. package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -0
  36. package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -0
  37. package/src/components/Form/AccessRights/AccessRights.stories.tsx +1 -0
  38. package/src/components/Layout/AreaIndicator.tsx +4 -6
  39. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -0
  40. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -0
  41. package/src/components/Modal/Modal.stories.tsx +1 -0
  42. package/src/components/Tabs/Tabs.tsx +6 -5
  43. package/src/Listing/Cell/DataCell.styles.ts +0 -27
  44. package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
  45. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
  46. package/src/Listing/Header/ListingHeader.styles.ts +0 -16
  47. package/src/Listing/Listing.styles.ts +0 -78
  48. package/src/Listing/Row/EmptyRow.styles.ts +0 -14
  49. package/src/components/Button/Button.styles.ts +0 -44
  50. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
@@ -7,8 +7,7 @@ import {
7
7
 
8
8
  import { AriaLabelingAttributes } from '../../@types/aria-attributes';
9
9
  import { DataTestAttributes } from '../../@types/data-attributes';
10
-
11
- import { useStyles } from './Button.styles';
10
+ import { button } from './Button.module.css';
12
11
 
13
12
  const muiVariantMap: Record<
14
13
  Required<ButtonProps>['variant'],
@@ -48,8 +47,6 @@ const Button = ({
48
47
  className = '',
49
48
  ...attr
50
49
  }: ButtonProps): ReactElement => {
51
- const { classes, cx } = useStyles();
52
-
53
50
  const MuiOverrideProps = useMemo(
54
51
  () => ({
55
52
  color: 'primary' as const,
@@ -61,7 +58,7 @@ const Button = ({
61
58
 
62
59
  return (
63
60
  <MuiButton
64
- className={cx(classes.button, className)}
61
+ className={`${button} ${className}`}
65
62
  data-icon-variant={iconVariant}
66
63
  data-is-danger={isDanger}
67
64
  data-size={size}
@@ -7,6 +7,7 @@ import { ChangeEvent, useEffect } from 'react';
7
7
  import { CrudPage } from '.';
8
8
  import { SnackbarProvider } from '../../';
9
9
  import { Column, ColumnType } from '../../Listing/models';
10
+ import '../../ThemeProvider/tailwindcss.css';
10
11
 
11
12
  interface Item {
12
13
  id: number;
@@ -5,6 +5,7 @@ import { Box } from '@mui/material';
5
5
  import { ColumnType } from '../../Listing/models';
6
6
 
7
7
  import { DataTable } from './index';
8
+ import '../../ThemeProvider/tailwindcss.css';
8
9
 
9
10
  const meta: Meta<typeof DataTable> = {
10
11
  component: DataTable
@@ -1,6 +1,7 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
 
3
3
  import { DataTableEmptyState } from './DataTableEmptyState';
4
+ import '../../../ThemeProvider/tailwindcss.css';
4
5
 
5
6
  const meta: Meta<typeof DataTableEmptyState> = {
6
7
  component: DataTableEmptyState
@@ -1,6 +1,7 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
 
3
3
  import { DataTableItem } from './DataTableItem';
4
+ import '../../../ThemeProvider/tailwindcss.css';
4
5
 
5
6
  const meta: Meta<typeof DataTableItem> = {
6
7
  component: DataTableItem
@@ -12,6 +12,7 @@ import {
12
12
  labels,
13
13
  roles
14
14
  } from './storiesData';
15
+ import '../../../ThemeProvider/tailwindcss.css';
15
16
 
16
17
  const meta: Meta<typeof AccessRights> = {
17
18
  component: AccessRights,
@@ -1,7 +1,5 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
2
 
3
- import { useStyles } from './AreaIndicator.styles';
4
-
5
3
  type AreaIndicatorProps = {
6
4
  children?: ReactNode | Array<ReactNode>;
7
5
  depth?: number;
@@ -17,16 +15,16 @@ const AreaIndicator = ({
17
15
  height = '100%',
18
16
  depth = 0
19
17
  }: AreaIndicatorProps): ReactElement => {
20
- const { classes } = useStyles();
21
-
22
18
  return (
23
19
  <div
24
- className={classes.areaIndicator}
20
+ className={'bg-secondary-main/25 min-h-8 grid grid-cols-[3fr_1fr]'}
25
21
  data-depth={depth}
26
22
  style={{ height, width }}
27
23
  >
28
24
  {/* biome-ignore lint/a11y: */}
29
- <label>{name}</label>
25
+ <label className="left-2 rounded-sm border border-[#9747FF7F] border-dashed text-[#9747FF] text-[0.75rem] font-medium left-2 top-1.5 px-2 py-0.5">
26
+ {name}
27
+ </label>
30
28
  {children}
31
29
  </div>
32
30
  );
@@ -4,6 +4,7 @@ import { Default as DefaultPageHeaderStory } from '../../Header/PageHeader/PageH
4
4
  import { AreaIndicator } from '../AreaIndicator';
5
5
 
6
6
  import { PageLayout } from './index';
7
+ import '../../../ThemeProvider/tailwindcss.css';
7
8
 
8
9
  const meta: Meta<typeof PageLayout> = {
9
10
  argTypes: {
@@ -4,6 +4,7 @@ import { Provider, atom, createStore, useSetAtom } from 'jotai';
4
4
  import { Button } from '../../Button';
5
5
 
6
6
  import { ConfirmationModal } from './ConfirmationModal';
7
+ import '../../../ThemeProvider/tailwindcss.css';
7
8
 
8
9
  const meta: Meta<typeof ConfirmationModal> = {
9
10
  component: ConfirmationModal
@@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
3
3
  import { Button } from '../Button';
4
4
 
5
5
  import { Modal } from '.';
6
+ import '../../ThemeProvider/tailwindcss.css';
6
7
 
7
8
  const meta: Meta<typeof Modal> = {
8
9
  argTypes: {
@@ -1,14 +1,14 @@
1
1
  import { useCallback, useState } from 'react';
2
2
 
3
- import { TabContext, TabList, TabListProps } from '@mui/lab';
4
- import { Tab } from '@mui/material';
3
+ import { TabContext } from '@mui/lab';
4
+ import { Tab, Tabs as MuiTabs, TabsProps } from '@mui/material';
5
5
 
6
6
  import { useTabsStyles } from './Tab.styles';
7
7
 
8
8
  type Props = {
9
9
  children: Array<JSX.Element>;
10
10
  defaultTab: string;
11
- tabList?: TabListProps;
11
+ tabList?: TabsProps;
12
12
  tabs: Array<{
13
13
  label: string;
14
14
  value: string;
@@ -31,12 +31,13 @@ export const Tabs = ({
31
31
 
32
32
  return (
33
33
  <TabContext value={selectedTab}>
34
- <TabList
34
+ <MuiTabs
35
35
  classes={{
36
36
  indicator: classes.indicator,
37
37
  root: classes.tabs
38
38
  }}
39
39
  onChange={changeTab}
40
+ value={selectedTab}
40
41
  {...tabList}
41
42
  >
42
43
  {tabs.map(({ value, label }) => (
@@ -48,7 +49,7 @@ export const Tabs = ({
48
49
  value={value}
49
50
  />
50
51
  ))}
51
- </TabList>
52
+ </MuiTabs>
52
53
  {children}
53
54
  </TabContext>
54
55
  );
@@ -1,27 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()((theme) => ({
4
- cell: {
5
- alignItems: 'center',
6
- display: 'flex',
7
- height: '100%',
8
- overflow: 'hidden',
9
- whiteSpace: 'nowrap'
10
- },
11
- clickable: {
12
- cursor: 'default'
13
- },
14
- componentColumn: {
15
- width: theme.spacing(2.75)
16
- },
17
- rowNotHovered: {
18
- color: theme.palette.text.secondary
19
- },
20
- text: {
21
- overflow: 'hidden',
22
- textOverflow: 'ellipsis',
23
- whiteSpace: 'nowrap'
24
- }
25
- }));
26
-
27
- export { useStyles };
@@ -1,71 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- import { ListingVariant } from '@centreon/ui-context';
4
-
5
- import { getTextStyleByViewMode } from '../../useStyleTable';
6
-
7
- interface StylesProps {
8
- isDragging?: boolean;
9
- isInDragOverlay?: boolean;
10
- listingVariant?: ListingVariant;
11
- }
12
-
13
- const useStyles = makeStyles<StylesProps>()(
14
- (theme, { isDragging, isInDragOverlay, listingVariant }) => ({
15
- active: {
16
- '&, &:hover, &:focus': {
17
- color: theme.palette.common.white
18
- },
19
- '&.Mui-active': {
20
- '& .MuiTableSortLabel-icon': {
21
- color: theme.palette.common.white
22
- },
23
- color: theme.palette.common.white
24
- }
25
- },
26
- content: {
27
- alignItems: 'center',
28
- borderRadius: isDragging && isInDragOverlay ? theme.spacing(0.5) : 0,
29
- color: theme.palette.common.white,
30
- display: 'flex',
31
- height: '100%',
32
- justifyContent: 'space-between'
33
- },
34
- dragHandle: {
35
- '&, &.Mui-focus, &:focus': {
36
- color: theme.palette.common.white
37
- },
38
- color: theme.palette.common.white,
39
-
40
- cursor: isDragging ? 'grabbing' : 'grab',
41
- opacity: 0,
42
- padding: 0
43
- },
44
- simpleHeaderCellContent: {
45
- alignItems: 'center',
46
- display: 'inline-flex',
47
- marginRight: theme.spacing(2),
48
- userSelect: 'none'
49
- },
50
- tableCell: {
51
- backgroundColor: isInDragOverlay
52
- ? 'transparent'
53
- : theme.palette.background.listingHeader,
54
- borderBottom: 'none',
55
- height: 'inherit',
56
- padding: theme.spacing(0, 1),
57
- ...getTextStyleByViewMode({ listingVariant, theme }),
58
- '&:hover, &:focus-within, &[data-isdragging=true]': {
59
- '& .dragHandle': {
60
- opacity: 1
61
- }
62
- },
63
- '&[data-isindragoverlay=true]': {
64
- display: 'block',
65
- opacity: 0.7
66
- }
67
- }
68
- })
69
- );
70
-
71
- export { useStyles, type StylesProps };
@@ -1,26 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()((theme) => ({
4
- checkbox: {
5
- '&.Mui-checked': {
6
- color: theme.palette.common.white
7
- },
8
- '&.MuiCheckbox-indeterminate': {
9
- color: theme.palette.common.white
10
- },
11
- color: theme.palette.common.white
12
- },
13
- checkboxHeaderCell: {
14
- alignItems: 'center',
15
- backgroundColor: theme.palette.background.listingHeader,
16
- borderBottom: 'none',
17
- display: 'flex',
18
- justifyContent: 'start',
19
- lineHeight: 'inherit'
20
- },
21
- predefinedRowsMenu: {
22
- color: theme.palette.common.white
23
- }
24
- }));
25
-
26
- export { useStyles };
@@ -1,16 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()((theme) => ({
4
- headerLabelDragging: {
5
- cursor: 'grabbing'
6
- },
7
- root: {
8
- height: '100%',
9
- padding: theme.spacing(0, 1)
10
- },
11
- row: {
12
- display: 'contents'
13
- }
14
- }));
15
-
16
- export { useStyles };
@@ -1,78 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- import { TableStyleAtom as TableStyle } from './models';
4
-
5
- const loadingIndicatorHeight = 3;
6
-
7
- interface StylesProps {
8
- dataStyle: TableStyle;
9
- gridTemplateColumn: string;
10
- isResponsive: string;
11
- rows: Array<unknown>;
12
- }
13
-
14
- const useListingStyles = makeStyles<StylesProps>()(
15
- (theme, { dataStyle, gridTemplateColumn, rows, isResponsive }) => ({
16
- actionBar: {
17
- alignItems: 'center',
18
- display: 'flex'
19
- },
20
- checkbox: {
21
- justifyContent: 'start'
22
- },
23
- container: {
24
- background: 'none',
25
- display: 'flex',
26
- flexDirection: 'column',
27
- height: '100%',
28
- width: '100%'
29
- },
30
- listingContainer: {
31
- height: '100%',
32
- overflow: 'hidden',
33
- width: '100%'
34
- },
35
- loadingIndicator: {
36
- height: loadingIndicatorHeight,
37
- width: '100%'
38
- },
39
- table: {
40
- '.listingHeader': {
41
- backgroundColor: theme.palette.background.listingHeader,
42
- padding: theme.spacing(0, 1)
43
- },
44
- '.listingHeader > div > div': {
45
- backgroundColor: theme.palette.background.listingHeader,
46
- height: theme.spacing(dataStyle.header.height / 8)
47
- },
48
- '.listingHeader > div > div:first-of-type': {
49
- height: '100%',
50
- padding: theme.spacing(0, 0.5, 0, 1.5)
51
- },
52
- alignItems: 'center',
53
- display: 'grid',
54
- gridTemplateColumns: gridTemplateColumn,
55
- gridTemplateRows: `${theme.spacing(dataStyle.header.height / 8)} repeat(${
56
- rows?.length || 1
57
- }, ${isResponsive ? 'auto' : `${dataStyle.body.height}px`})`,
58
- position: 'relative'
59
- },
60
- tableBody: {
61
- '.MuiTableRow-root > div:first-of-type': {
62
- paddingLeft: theme.spacing(1.5)
63
- },
64
-
65
- display: 'contents',
66
- 'div:first-of-type': {
67
- gridColumnStart: 1
68
- },
69
- position: 'relative'
70
- },
71
- tableWrapper: {
72
- borderBottom: 'none',
73
- overflow: 'auto'
74
- }
75
- })
76
- );
77
-
78
- export { useListingStyles, loadingIndicatorHeight };
@@ -1,14 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()(() => ({
4
- emptyDataCell: {
5
- flexDirection: 'column',
6
- gridColumn: 'auto / -1',
7
- justifyContent: 'center'
8
- },
9
- emptyDataRow: {
10
- display: 'contents'
11
- }
12
- }));
13
-
14
- export { useStyles };
@@ -1,44 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- const useStyles = makeStyles()((theme) => ({
4
- button: {
5
- '&[data-size="medium"]': {
6
- fontSize: '16px',
7
- height: 'unset',
8
- lineHeight: '24px'
9
- },
10
-
11
- '&[data-size="small"]': {
12
- '&[data-variant="primary"], &[data-variant="secondary"]': {
13
- paddingLeft: theme.spacing(2),
14
- paddingRight: theme.spacing(2)
15
- },
16
- fontSize: '14px',
17
- height: 'unset',
18
- lineHeight: '22px'
19
- },
20
-
21
- '&[data-variant="primary"]:not(:disabled)': {
22
- '&[data-is-danger="true"]': {
23
- backgroundColor: theme.palette.error.main
24
- },
25
-
26
- backgroundColor: theme.palette.primary.main
27
- },
28
-
29
- '&[data-variant="secondary"]:not(:disabled)': {
30
- '&[data-is-danger="true"]': {
31
- borderColor: theme.palette.error.main,
32
- color: theme.palette.error.main
33
- },
34
-
35
- borderColor: theme.palette.primary.main,
36
- color: theme.palette.primary.main
37
- },
38
-
39
- textWrap: 'noWrap',
40
- transition: 'unset'
41
- }
42
- }));
43
-
44
- export { useStyles };
@@ -1,33 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- export const useStyles = makeStyles()((theme) => ({
4
- areaIndicator: {
5
- '& .areaIndicator': {
6
- left: theme.spacing(10)
7
- },
8
- '& label:first-of-type': {
9
- border: '1px dashed #9747FF7F',
10
- borderRadius: '4px',
11
- color: '#9747FFFF',
12
- fontSize: '0.75rem',
13
- fontWeight: 500,
14
- left: theme.spacing(1),
15
- padding: theme.spacing(0.125, 1),
16
- position: 'absolute',
17
- top: theme.spacing(0.75)
18
- },
19
- '&[data-depth="1"]': {
20
- '& label:first-of-type': {
21
- '&:before': {
22
- content: '"+ "'
23
- },
24
- left: theme.spacing(10)
25
- }
26
- },
27
-
28
- backgroundColor: '#9747FF19',
29
- minHeight: theme.spacing(4),
30
-
31
- position: 'relative'
32
- }
33
- }));