@centreon/ui 23.10.30-MON-19324-dashboard-section-navigation.3 → 23.10.30

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 (205) hide show
  1. package/package.json +9 -12
  2. package/src/@assets/icons/downtime.icon.svg +1 -0
  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/Graph/BasicComponents/Axes/UnitLabel.tsx +20 -0
  7. package/src/Graph/BasicComponents/Axes/index.tsx +88 -0
  8. package/src/Graph/BasicComponents/Axes/models.ts +26 -0
  9. package/src/Graph/BasicComponents/Axes/useAxisY.ts +100 -0
  10. package/src/Graph/BasicComponents/Grids/index.tsx +20 -0
  11. package/src/Graph/BasicComponents/Lines/RegularLines/index.tsx +91 -0
  12. package/src/Graph/BasicComponents/Lines/RegularLines/useRegularLines.ts +15 -0
  13. package/src/Graph/BasicComponents/Lines/StackedLines/index.tsx +76 -0
  14. package/src/Graph/BasicComponents/Lines/StackedLines/useStackedLines.ts +39 -0
  15. package/src/Graph/BasicComponents/Lines/Threshold/BasicThreshold.tsx +51 -0
  16. package/src/Graph/BasicComponents/Lines/Threshold/Circle.tsx +43 -0
  17. package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +73 -0
  18. package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +59 -0
  19. package/src/Graph/BasicComponents/Lines/Threshold/helpers/index.ts +69 -0
  20. package/src/Graph/BasicComponents/Lines/Threshold/index.tsx +138 -0
  21. package/src/Graph/BasicComponents/Lines/Threshold/models.ts +105 -0
  22. package/src/Graph/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +46 -0
  23. package/src/Graph/BasicComponents/Lines/Threshold/useScaleThreshold.ts +171 -0
  24. package/src/Graph/BasicComponents/Lines/index.tsx +180 -0
  25. package/src/Graph/BasicComponents/Lines/models.ts +42 -0
  26. package/src/Graph/BasicComponents/LoadingProgress.tsx +46 -0
  27. package/src/Graph/BasicComponents/useFilterLines.ts +60 -0
  28. package/src/Graph/Graph.styles.ts +45 -0
  29. package/src/Graph/Graph.tsx +217 -0
  30. package/src/Graph/Header/index.tsx +65 -0
  31. package/src/Graph/Icons/Downtime.tsx +9 -0
  32. package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +58 -0
  33. package/src/Graph/InteractiveComponents/AnchorPoint/GuidingLines.tsx +45 -0
  34. package/src/Graph/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +66 -0
  35. package/src/Graph/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +76 -0
  36. package/src/Graph/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +70 -0
  37. package/src/Graph/InteractiveComponents/AnchorPoint/index.tsx +20 -0
  38. package/src/Graph/InteractiveComponents/AnchorPoint/models.ts +62 -0
  39. package/src/Graph/InteractiveComponents/AnchorPoint/useTickGraph.ts +94 -0
  40. package/src/Graph/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +107 -0
  41. package/src/Graph/InteractiveComponents/Annotations/Annotation/Area.tsx +114 -0
  42. package/src/Graph/InteractiveComponents/Annotations/Annotation/Line.tsx +103 -0
  43. package/src/Graph/InteractiveComponents/Annotations/Annotation/index.tsx +81 -0
  44. package/src/Graph/InteractiveComponents/Annotations/Area/Downtime.tsx +27 -0
  45. package/src/Graph/InteractiveComponents/Annotations/EventAnnotations.tsx +61 -0
  46. package/src/Graph/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +27 -0
  47. package/src/Graph/InteractiveComponents/Annotations/Line/Comments.tsx +25 -0
  48. package/src/Graph/InteractiveComponents/Annotations/annotationsAtoms.ts +183 -0
  49. package/src/Graph/InteractiveComponents/Annotations/index.tsx +49 -0
  50. package/src/Graph/InteractiveComponents/Annotations/models.ts +25 -0
  51. package/src/Graph/InteractiveComponents/Annotations/useAnnotation.ts +56 -0
  52. package/src/Graph/InteractiveComponents/Bar.tsx +21 -0
  53. package/src/Graph/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +62 -0
  54. package/src/Graph/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +74 -0
  55. package/src/Graph/InteractiveComponents/TimeShiftZones/index.tsx +85 -0
  56. package/src/Graph/InteractiveComponents/TimeShiftZones/models.ts +12 -0
  57. package/src/Graph/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +72 -0
  58. package/src/Graph/InteractiveComponents/Tooltip/index.tsx +59 -0
  59. package/src/Graph/InteractiveComponents/Tooltip/models.ts +9 -0
  60. package/src/Graph/InteractiveComponents/Tooltip/useGraphTooltip.ts +67 -0
  61. package/src/Graph/InteractiveComponents/ZoomPreview/index.tsx +38 -0
  62. package/src/Graph/InteractiveComponents/ZoomPreview/models.ts +9 -0
  63. package/src/Graph/InteractiveComponents/ZoomPreview/useZoomPreview.ts +107 -0
  64. package/src/Graph/InteractiveComponents/ZoomPreview/zoomPreviewAtoms.ts +3 -0
  65. package/src/Graph/InteractiveComponents/index.tsx +168 -0
  66. package/src/Graph/InteractiveComponents/interactionWithGraphAtoms.ts +51 -0
  67. package/src/Graph/Legend/InteractiveValue.tsx +22 -0
  68. package/src/Graph/Legend/Legend.styles.ts +71 -0
  69. package/src/Graph/Legend/LegendContent.tsx +27 -0
  70. package/src/Graph/Legend/LegendHeader.tsx +45 -0
  71. package/src/Graph/Legend/Marker.tsx +43 -0
  72. package/src/Graph/Legend/index.tsx +166 -0
  73. package/src/Graph/Legend/models.ts +11 -0
  74. package/src/Graph/Legend/useInteractiveValues.ts +86 -0
  75. package/src/Graph/Legend/useLegend.ts +114 -0
  76. package/src/Graph/LoadingSkeleton.tsx +44 -0
  77. package/src/Graph/common/index.ts +35 -0
  78. package/src/Graph/graphAtoms.ts +6 -0
  79. package/src/Graph/helpers/doc.ts +560 -0
  80. package/src/Graph/helpers/index.ts +58 -0
  81. package/src/Graph/index.stories.tsx +372 -0
  82. package/src/Graph/index.tsx +90 -0
  83. package/src/Graph/mockedData/annotationData.json +326 -0
  84. package/src/Graph/mockedData/exclusionPeriodFirstPeriod.json +588 -0
  85. package/src/Graph/mockedData/exclusionPeriodSecondPeriod.json +588 -0
  86. package/src/Graph/mockedData/exclusionPeriodThirdPeriod.json +581 -0
  87. package/src/Graph/mockedData/lastDay.json +1326 -0
  88. package/src/Graph/mockedData/lastDayAreaStack.json +3106 -0
  89. package/src/Graph/mockedData/lastDayForward.json +1338 -0
  90. package/src/Graph/mockedData/lastDayThreshold.json +2352 -0
  91. package/src/Graph/mockedData/lastMonth.json +1674 -0
  92. package/src/Graph/mockedData/lastWeek.json +2202 -0
  93. package/src/Graph/mockedData/zoomPreview.json +742 -0
  94. package/src/Graph/models.ts +150 -0
  95. package/src/Graph/timeSeries/index.test.ts +506 -0
  96. package/src/Graph/timeSeries/index.ts +512 -0
  97. package/src/Graph/timeSeries/models.ts +120 -0
  98. package/src/Graph/translatedLabels.ts +9 -0
  99. package/src/Graph/useGraphData.ts +47 -0
  100. package/src/Graph/useGraphIntersection.ts +36 -0
  101. package/src/ThemeProvider/index.tsx +5 -6
  102. package/src/ThemeProvider/palettes.ts +215 -385
  103. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +51 -0
  104. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +95 -0
  105. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/ErrorText.tsx +14 -0
  106. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +163 -0
  107. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +76 -0
  108. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +61 -0
  109. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +82 -0
  110. package/src/TimePeriods/CustomTimePeriod/index.tsx +66 -0
  111. package/src/TimePeriods/DateTimePickerInput.tsx +49 -0
  112. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +65 -0
  113. package/src/TimePeriods/SelectedTimePeriod.tsx +102 -0
  114. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +510 -0
  115. package/src/TimePeriods/TimePeriods.styles.ts +22 -0
  116. package/src/TimePeriods/helpers/index.ts +26 -0
  117. package/src/TimePeriods/index.stories.tsx +98 -0
  118. package/src/TimePeriods/index.tsx +78 -0
  119. package/src/TimePeriods/mockedData.ts +12 -0
  120. package/src/TimePeriods/models.ts +97 -0
  121. package/src/TimePeriods/timePeriodsAtoms.ts +102 -0
  122. package/src/TimePeriods/translatedLabels.ts +9 -0
  123. package/src/TimePeriods/useSortTimePeriods.ts +31 -0
  124. package/src/TimePeriods/useTimePeriod.ts +49 -0
  125. package/src/api/TestQueryProvider.tsx +1 -2
  126. package/src/api/useFetchQuery/index.ts +7 -8
  127. package/src/api/useMutationQuery/index.ts +10 -11
  128. package/src/components/Button/Button.styles.ts +3 -17
  129. package/src/components/Button/Button.tsx +3 -6
  130. package/src/components/Button/Icon/IconButton.styles.ts +2 -9
  131. package/src/components/DataTable/DataTable.stories.tsx +0 -9
  132. package/src/components/DataTable/DataTable.styles.ts +0 -5
  133. package/src/components/DataTable/DataTable.tsx +6 -8
  134. package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +1 -4
  135. package/src/components/DataTable/Item/DataTableItem.styles.ts +2 -5
  136. package/src/components/DataTable/Item/DataTableItem.tsx +18 -36
  137. package/src/components/Header/Header.stories.tsx +27 -0
  138. package/src/components/Header/Header.styles.ts +27 -0
  139. package/src/components/Header/Header.tsx +23 -0
  140. package/src/components/Header/index.ts +1 -1
  141. package/src/components/Modal/index.ts +0 -2
  142. package/src/components/index.ts +0 -3
  143. package/src/index.ts +2 -0
  144. package/src/layout/TiledListingPage/TiledListingActions.tsx +15 -0
  145. package/src/layout/TiledListingPage/TiledListingContent.tsx +21 -0
  146. package/src/layout/TiledListingPage/TiledListingList.tsx +11 -0
  147. package/src/layout/TiledListingPage/TiledListingPage.styles.ts +16 -0
  148. package/src/layout/TiledListingPage/TiledListingPage.tsx +15 -0
  149. package/src/layout/TiledListingPage/index.ts +4 -0
  150. package/src/screens/dashboard/DashboardsOverview.stories.tsx +102 -110
  151. package/src/utils/index.ts +1 -1
  152. package/src/utils/sanitizedHTML.ts +1 -1
  153. package/test/setupTests.js +0 -3
  154. package/src/base/tokens/README.md +0 -3
  155. package/src/base/tokens/source/$metadata.json +0 -5
  156. package/src/base/tokens/source/base.json +0 -142
  157. package/src/base/tokens/themes/base.tokens.d.ts +0 -38
  158. package/src/base/tokens/themes/base.tokens.json +0 -695
  159. package/src/base/tokens/themes/base.tokens.ts +0 -38
  160. package/src/base/tokens/themes/ui-dark.tokens.d.ts +0 -38
  161. package/src/base/tokens/themes/ui-dark.tokens.json +0 -695
  162. package/src/base/tokens/themes/ui-dark.tokens.ts +0 -38
  163. package/src/base/tokens/themes/ui-light.tokens.d.ts +0 -38
  164. package/src/base/tokens/themes/ui-light.tokens.json +0 -695
  165. package/src/base/tokens/themes/ui-light.tokens.ts +0 -38
  166. package/src/components/Header/PageHeader/PageHeader.stories.tsx +0 -88
  167. package/src/components/Header/PageHeader/PageHeader.styles.ts +0 -99
  168. package/src/components/Header/PageHeader/PageHeader.tsx +0 -15
  169. package/src/components/Header/PageHeader/PageHeaderActions.tsx +0 -17
  170. package/src/components/Header/PageHeader/PageHeaderMain.tsx +0 -15
  171. package/src/components/Header/PageHeader/PageHeaderMenu.tsx +0 -15
  172. package/src/components/Header/PageHeader/PageHeaderTitle.tsx +0 -47
  173. package/src/components/Header/PageHeader/index.ts +0 -12
  174. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
  175. package/src/components/Layout/AreaIndicator.tsx +0 -35
  176. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +0 -81
  177. package/src/components/Layout/PageLayout/PageLayout.styles.ts +0 -40
  178. package/src/components/Layout/PageLayout/PageLayout.tsx +0 -21
  179. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -15
  180. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -24
  181. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +0 -15
  182. package/src/components/Layout/PageLayout/index.ts +0 -10
  183. package/src/components/Layout/index.ts +0 -1
  184. package/src/components/Menu/Button/MenuButton.stories.tsx +0 -16
  185. package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
  186. package/src/components/Menu/Button/MenuButton.tsx +0 -59
  187. package/src/components/Menu/Button/index.ts +0 -1
  188. package/src/components/Menu/Menu.stories.tsx +0 -71
  189. package/src/components/Menu/Menu.styles.ts +0 -70
  190. package/src/components/Menu/Menu.tsx +0 -25
  191. package/src/components/Menu/MenuDivider.tsx +0 -13
  192. package/src/components/Menu/MenuItem.tsx +0 -36
  193. package/src/components/Menu/MenuItems.tsx +0 -35
  194. package/src/components/Menu/index.ts +0 -12
  195. package/src/components/Menu/useMenu.tsx +0 -79
  196. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +0 -71
  197. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +0 -5
  198. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +0 -115
  199. package/src/components/Tooltip/TextOverflowTooltip/index.tsx +0 -1
  200. package/src/components/Tooltip/Tooltip.stories.tsx +0 -41
  201. package/src/components/Tooltip/Tooltip.styles.ts +0 -5
  202. package/src/components/Tooltip/Tooltip.tsx +0 -46
  203. package/src/components/Tooltip/index.ts +0 -1
  204. package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
  205. package/src/utils/useResizeObserver.ts +0 -6
@@ -16,11 +16,6 @@ const useStyles = makeStyles()((theme) => ({
16
16
  width: '100%'
17
17
  },
18
18
  display: 'flex'
19
- },
20
- dataTableScrollContainer: {
21
- // FIXME the global -webkit-scrollbar styles are not optimal for this component in grid variant
22
- height: '100%',
23
- overflowY: 'auto'
24
19
  }
25
20
  }));
26
21
 
@@ -20,14 +20,12 @@ const DataTable = ({
20
20
  const { classes } = useStyles();
21
21
 
22
22
  return (
23
- <div className={classes.dataTableScrollContainer}>
24
- <div
25
- className={classes.dataTable}
26
- data-is-empty={isEmpty}
27
- data-variant={variant}
28
- >
29
- {children}
30
- </div>
23
+ <div
24
+ className={classes.dataTable}
25
+ data-is-empty={isEmpty}
26
+ data-variant={variant}
27
+ >
28
+ {children}
31
29
  </div>
32
30
  );
33
31
  };
@@ -27,10 +27,7 @@ const DataTableEmptyState = ({
27
27
  const { t } = useTranslation();
28
28
 
29
29
  return (
30
- <div
31
- className={classes.dataTableEmptyState}
32
- data-testid="data-table-empty-state"
33
- >
30
+ <div className={classes.dataTableEmptyState}>
34
31
  <MuiTypography variant="h2">{t(labels.title)}</MuiTypography>
35
32
  <div className={classes.actions}>
36
33
  <Button
@@ -10,13 +10,10 @@ const useStyles = makeStyles()((theme) => ({
10
10
  justifyContent: 'space-between'
11
11
  },
12
12
  '& .MuiCardActions-root': {
13
- '& > span': {
14
- display: 'flex',
15
- gap: theme.spacing(1)
16
- },
17
13
  display: 'flex',
14
+ flexDirection: 'row-reverse',
15
+ gap: theme.spacing(1),
18
16
 
19
- justifyContent: 'space-between',
20
17
  opacity: 0
21
18
  },
22
19
  '&:hover .MuiCardActions-root': {
@@ -7,11 +7,7 @@ import {
7
7
  CardContent as MuiCardContent,
8
8
  Typography as MuiTypography
9
9
  } from '@mui/material';
10
- import {
11
- Delete as DeleteIcon,
12
- Settings as SettingsIcon,
13
- Share as ShareIcon
14
- } from '@mui/icons-material';
10
+ import { Delete as DeleteIcon, Edit as EditIcon } from '@mui/icons-material';
15
11
 
16
12
  import { IconButton } from '../../Button';
17
13
 
@@ -24,7 +20,6 @@ export interface DataTableItemProps {
24
20
  onClick?: () => void;
25
21
  onDelete?: () => void;
26
22
  onEdit?: () => void;
27
- onEditAccessRights?: () => void;
28
23
  title: string;
29
24
  }
30
25
 
@@ -37,8 +32,7 @@ const DataTableItem = forwardRef(
37
32
  hasActions = false,
38
33
  onClick,
39
34
  onEdit,
40
- onDelete,
41
- onEditAccessRights
35
+ onDelete
42
36
  }: DataTableItemProps,
43
37
  ref
44
38
  ): ReactElement => {
@@ -63,34 +57,22 @@ const DataTableItem = forwardRef(
63
57
  </ActionArea>
64
58
  {hasActions && (
65
59
  <MuiCardActions>
66
- <span>
67
- <IconButton
68
- aria-label="delete"
69
- data-testid="delete"
70
- icon={<DeleteIcon />}
71
- size="small"
72
- variant="ghost"
73
- onClick={() => onDelete?.()}
74
- />
75
- </span>
76
- <span>
77
- <IconButton
78
- aria-label="edit access rights"
79
- data-testid="edit-access-rights"
80
- icon={<ShareIcon />}
81
- size="small"
82
- variant="primary"
83
- onClick={() => onEditAccessRights?.()}
84
- />
85
- <IconButton
86
- aria-label="edit"
87
- data-testid="edit"
88
- icon={<SettingsIcon />}
89
- size="small"
90
- variant="primary"
91
- onClick={() => onEdit?.()}
92
- />
93
- </span>
60
+ <IconButton
61
+ aria-label="edit"
62
+ data-testid="edit"
63
+ icon={<EditIcon />}
64
+ size="small"
65
+ variant="primary"
66
+ onClick={() => onEdit?.()}
67
+ />
68
+ <IconButton
69
+ aria-label="delete"
70
+ data-testid="delete"
71
+ icon={<DeleteIcon />}
72
+ size="small"
73
+ variant="ghost"
74
+ onClick={() => onDelete?.()}
75
+ />
94
76
  </MuiCardActions>
95
77
  )}
96
78
  </MuiCard>
@@ -0,0 +1,27 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Settings as SettingsIcon } from '@mui/icons-material';
4
+
5
+ import { IconButton } from '../Button';
6
+
7
+ import { Header } from './Header';
8
+
9
+ const meta: Meta<typeof Header> = {
10
+ component: Header
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof Header>;
15
+
16
+ export const Default: Story = {
17
+ args: {
18
+ title: 'Header'
19
+ }
20
+ };
21
+
22
+ export const WithNav: Story = {
23
+ args: {
24
+ nav: <IconButton icon={<SettingsIcon />} size="small" variant="ghost" />,
25
+ title: 'Header with nav'
26
+ }
27
+ };
@@ -0,0 +1,27 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+
3
+ const useStyles = makeStyles()((theme) => ({
4
+ header: {
5
+ alignItems: 'flex-start',
6
+ borderBottom: `1px solid ${theme.palette.primary.main}`,
7
+ display: 'flex',
8
+ flexDirection: 'row',
9
+ h1: {
10
+ font: 'normal normal 600 24px/24px Roboto',
11
+ letterSpacing: '0.18px',
12
+ margin: theme.spacing(0, 0, 1.5, 0)
13
+ },
14
+ justifyContent: 'space-between',
15
+ marginBottom: theme.spacing(2.5),
16
+
17
+ nav: {
18
+ display: 'flex',
19
+ gap: theme.spacing(1),
20
+ justifyContent: 'flex-end'
21
+ },
22
+
23
+ padding: theme.spacing(0, 0, 1.5, 0)
24
+ }
25
+ }));
26
+
27
+ export { useStyles };
@@ -0,0 +1,23 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+
3
+ import { Typography as MuiTypography } from '@mui/material';
4
+
5
+ import { useStyles } from './Header.styles';
6
+
7
+ type HeaderProps = {
8
+ nav?: ReactNode;
9
+ title: string;
10
+ };
11
+
12
+ const Header = ({ title, nav }: HeaderProps): ReactElement => {
13
+ const { classes } = useStyles();
14
+
15
+ return (
16
+ <header className={classes.header}>
17
+ <MuiTypography variant="h1">{title}</MuiTypography>
18
+ {nav && <nav>{nav}</nav>}
19
+ </header>
20
+ );
21
+ };
22
+
23
+ export { Header };
@@ -1 +1 @@
1
- export * from './PageHeader';
1
+ export * from './Header';
@@ -8,5 +8,3 @@ export const Modal = Object.assign(ModalRoot, {
8
8
  Body: ModalBody,
9
9
  Header: ModalHeader
10
10
  });
11
-
12
- export type { ModalActionsLabels } from './ModalActions';
@@ -3,6 +3,3 @@ export * from './Modal';
3
3
  export * from './Form';
4
4
  export * from './Header';
5
5
  export * from './DataTable';
6
- export * from './Layout';
7
- export * from './Tooltip';
8
- export * from './Menu';
package/src/index.ts CHANGED
@@ -140,6 +140,8 @@ export { default as ActionsList } from './ActionsList';
140
140
 
141
141
  export type { ResponseError, CatchErrorProps } from './api/customFetch';
142
142
 
143
+ export * from './layout/TiledListingPage';
144
+
143
145
  export * from './utils';
144
146
  export { default as FluidTypography } from './Typography/FluidTypography';
145
147
  export * from './Dashboard';
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import { useTiledListingActionsStyles } from './TiledListingPage.styles';
4
+
5
+ interface TiledListingActionsProps {
6
+ children: Array<ReactNode> | ReactNode;
7
+ }
8
+
9
+ export const TiledListingActions = ({
10
+ children
11
+ }: TiledListingActionsProps): JSX.Element => {
12
+ const { classes } = useTiledListingActionsStyles();
13
+
14
+ return <div className={classes.actions}>{children}</div>;
15
+ };
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import Responsive from '../../Responsive';
4
+
5
+ import { useTiledListingActionsStyles } from './TiledListingPage.styles';
6
+
7
+ interface TiledListingContentProps {
8
+ children: ReactNode;
9
+ }
10
+
11
+ export const TiledListingContent = ({
12
+ children
13
+ }: TiledListingContentProps): JSX.Element => {
14
+ const { classes } = useTiledListingActionsStyles();
15
+
16
+ return (
17
+ <Responsive>
18
+ <div className={classes.actions}>{children}</div>
19
+ </Responsive>
20
+ );
21
+ };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface TiledListingListProps {
4
+ children: Array<ReactNode>;
5
+ }
6
+
7
+ export const TiledListingList = ({
8
+ children
9
+ }: TiledListingListProps): JSX.Element => {
10
+ return <div>{children}</div>;
11
+ };
@@ -0,0 +1,16 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+
3
+ export const useTiledListPageStyles = makeStyles()((theme) => ({
4
+ listPage: {
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ height: '100%',
8
+ padding: theme.spacing(1.5)
9
+ }
10
+ }));
11
+
12
+ export const useTiledListingActionsStyles = makeStyles()((theme) => ({
13
+ actions: {
14
+ paddingBottom: theme.spacing(2.5)
15
+ }
16
+ }));
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import { useTiledListPageStyles } from './TiledListingPage.styles';
4
+
5
+ interface TiledListingPageProps {
6
+ children: Array<ReactNode>;
7
+ }
8
+
9
+ export const TiledListingPage = ({
10
+ children
11
+ }: TiledListingPageProps): JSX.Element => {
12
+ const { classes } = useTiledListPageStyles();
13
+
14
+ return <div className={classes.listPage}>{children}</div>;
15
+ };
@@ -0,0 +1,4 @@
1
+ export * from './TiledListingPage';
2
+ export * from './TiledListingActions';
3
+ export * from './TiledListingList';
4
+ export * from './TiledListingContent';
@@ -11,11 +11,16 @@ import {
11
11
  DashboardForm,
12
12
  DashboardFormProps,
13
13
  DataTable,
14
- Modal,
15
- PageHeader,
16
- PageLayout
14
+ Header,
15
+ Modal
17
16
  } from '../../components';
18
17
  import { Default as DashboardFormDefaultStory } from '../../components/Form/Dashboard/DashboardForm.stories';
18
+ import {
19
+ TiledListingActions,
20
+ TiledListingContent,
21
+ TiledListingList,
22
+ TiledListingPage
23
+ } from '../../layout/TiledListingPage';
19
24
 
20
25
  const meta: Meta = {
21
26
  args: {
@@ -59,10 +64,7 @@ const meta: Meta = {
59
64
  },
60
65
  title: 'Dashboards overview'
61
66
  },
62
- parameters: {
63
- layout: 'fullscreen'
64
- },
65
- title: 'screens/Dashboards overview'
67
+ title: 'screens/Dashboards'
66
68
  };
67
69
 
68
70
  export default meta;
@@ -132,16 +134,10 @@ const DefaultView = (args): JSX.Element => {
132
134
  };
133
135
 
134
136
  return (
135
- <PageLayout>
136
- <PageLayout.Header>
137
- <PageHeader>
138
- <PageHeader.Main>
139
- <PageHeader.Title title={title} />
140
- </PageHeader.Main>
141
- </PageHeader>
142
- </PageLayout.Header>
143
- <PageLayout.Body>
144
- <PageLayout.Actions>
137
+ <TiledListingPage>
138
+ <Header title={title} />
139
+ <TiledListingList>
140
+ <TiledListingActions>
145
141
  {dataDashboards.length !== 0 && (
146
142
  <Button
147
143
  aria-label="add"
@@ -154,105 +150,101 @@ const DefaultView = (args): JSX.Element => {
154
150
  {actions.create.label}
155
151
  </Button>
156
152
  )}
157
- </PageLayout.Actions>
158
-
159
- <DataTable isEmpty={dataDashboards.length === 0}>
160
- {dataDashboards.length === 0 ? (
161
- <DataTable.EmptyState
162
- labels={list.emptyState.labels}
163
- onCreate={() =>
153
+ </TiledListingActions>
154
+ <TiledListingContent>
155
+ <DataTable isEmpty={dataDashboards.length === 0}>
156
+ {dataDashboards.length === 0 ? (
157
+ <DataTable.EmptyState
158
+ labels={list.emptyState.labels}
159
+ onCreate={() =>
160
+ setDialogState({ item: null, open: true, variant: 'create' })
161
+ }
162
+ />
163
+ ) : (
164
+ dataDashboards.map((dashboard) => (
165
+ <DataTable.Item
166
+ hasActions
167
+ hasCardAction
168
+ description={dashboard.description}
169
+ key={dashboard.id}
170
+ title={dashboard.name}
171
+ onDelete={() =>
172
+ setDeleteDialogState({ item: dashboard, open: true })
173
+ }
174
+ onEdit={() =>
175
+ setDialogState({
176
+ item: dashboard,
177
+ open: true,
178
+ variant: 'update'
179
+ })
180
+ }
181
+ />
182
+ ))
183
+ )}
184
+ </DataTable>
185
+ </TiledListingContent>
186
+ <Modal
187
+ open={dialogState.open}
188
+ onClose={() =>
189
+ setDialogState({
190
+ item: null,
191
+ open: false,
192
+ variant: dialogState.variant
193
+ })
194
+ }
195
+ >
196
+ <Modal.Header>
197
+ {form.labels.title[dialogState.variant ?? 'create']}
198
+ </Modal.Header>
199
+ <Modal.Body>
200
+ <DashboardForm
201
+ labels={DashboardFormDefaultStory!.args!.labels!}
202
+ resource={dialogState.item || undefined}
203
+ variant={dialogState.variant}
204
+ onCancel={() =>
164
205
  setDialogState({
165
206
  item: null,
166
- open: true,
167
- variant: 'create'
207
+ open: false,
208
+ variant: dialogState.variant
168
209
  })
169
210
  }
211
+ onSubmit={(values) =>
212
+ dialogState.variant === 'create'
213
+ ? createDashboard(values)
214
+ : updateDashboard(values)
215
+ }
170
216
  />
171
- ) : (
172
- dataDashboards.map((dashboard) => (
173
- <DataTable.Item
174
- hasActions
175
- hasCardAction
176
- description={dashboard.description}
177
- key={dashboard.id}
178
- title={dashboard.name}
179
- onDelete={() =>
180
- setDeleteDialogState({ item: dashboard, open: true })
181
- }
182
- onEdit={() =>
183
- setDialogState({
184
- item: dashboard,
185
- open: true,
186
- variant: 'update'
187
- })
188
- }
189
- />
190
- ))
191
- )}
192
- </DataTable>
193
- </PageLayout.Body>
194
-
195
- <Modal
196
- open={dialogState.open}
197
- onClose={() =>
198
- setDialogState({
199
- item: null,
200
- open: false,
201
- variant: dialogState.variant
202
- })
203
- }
204
- >
205
- <Modal.Header>
206
- {form.labels.title[dialogState.variant ?? 'create']}
207
- </Modal.Header>
208
- <Modal.Body>
209
- <DashboardForm
210
- labels={DashboardFormDefaultStory!.args!.labels!}
211
- resource={dialogState.item || undefined}
212
- variant={dialogState.variant}
213
- onCancel={() =>
214
- setDialogState({
215
- item: null,
216
- open: false,
217
- variant: dialogState.variant
218
- })
219
- }
220
- onSubmit={(values) =>
221
- dialogState.variant === 'create'
222
- ? createDashboard(values)
223
- : updateDashboard(values)
224
- }
217
+ </Modal.Body>
218
+ </Modal>
219
+ <Modal
220
+ open={deleteDialogState.open}
221
+ onClose={() =>
222
+ setDeleteDialogState({
223
+ ...deleteDialogState,
224
+ open: false
225
+ })
226
+ }
227
+ >
228
+ <Modal.Header>{deleteConfirmation.labels.title}</Modal.Header>
229
+ <Modal.Body>
230
+ <p>
231
+ {deleteConfirmation.labels.description(
232
+ deleteDialogState.item?.name
233
+ )}
234
+ </p>
235
+ </Modal.Body>
236
+ <Modal.Actions
237
+ isDanger
238
+ labels={deleteConfirmation.labels.actions}
239
+ onCancel={() => setDeleteDialogState({ item: null, open: false })}
240
+ onConfirm={() => {
241
+ deleteDashboard(deleteDialogState.item?.id);
242
+ setDeleteDialogState({ item: null, open: false });
243
+ }}
225
244
  />
226
- </Modal.Body>
227
- </Modal>
228
- <Modal
229
- open={deleteDialogState.open}
230
- onClose={() =>
231
- setDeleteDialogState({
232
- ...deleteDialogState,
233
- open: false
234
- })
235
- }
236
- >
237
- <Modal.Header>{deleteConfirmation.labels.title}</Modal.Header>
238
- <Modal.Body>
239
- <p>
240
- {deleteConfirmation.labels.description(
241
- deleteDialogState.item?.name
242
- )}
243
- </p>
244
- </Modal.Body>
245
- <Modal.Actions
246
- isDanger
247
- labels={deleteConfirmation.labels.actions}
248
- onCancel={() => setDeleteDialogState({ item: null, open: false })}
249
- onConfirm={() => {
250
- deleteDashboard(deleteDialogState.item?.id);
251
- setDeleteDialogState({ item: null, open: false });
252
- }}
253
- />
254
- </Modal>
255
- </PageLayout>
245
+ </Modal>
246
+ </TiledListingList>
247
+ </TiledListingPage>
256
248
  );
257
249
  };
258
250
 
@@ -14,4 +14,4 @@ export * from './useMemoComponent';
14
14
  export * from './useThemeMode';
15
15
  export * from './useViewportIntersection';
16
16
  export * from './panelSize';
17
- export * from './sanitizedHTML';
17
+ export { default as sanitizedHTML } from './sanitizedHTML';
@@ -15,4 +15,4 @@ const sanitizedHTML = ({
15
15
  return ReactHtmlParser(sanitizedContent);
16
16
  };
17
17
 
18
- export { sanitizedHTML };
18
+ export default sanitizedHTML;
@@ -1,8 +1,5 @@
1
1
  /* eslint-disable no-underscore-dangle */
2
2
  /* eslint-disable no-undef */
3
- // FIXME: testing library setup
4
- // import '@testing-library/jest-dom';
5
- // import '@testing-library/react';
6
3
  // import '@testing-library/jest-dom/extend-expect';
7
4
  import i18n from 'i18next';
8
5
  import { initReactI18next } from 'react-i18next';
@@ -1,3 +0,0 @@
1
- `// TODO`
2
-
3
- - [ ] integrate design tokens with MUI ThemeProvider
@@ -1,5 +0,0 @@
1
- {
2
- "tokenSetOrder": [
3
- "base"
4
- ]
5
- }