@centreon/ui 23.10.32 → 23.10.34-MON-19940-Add-testIds-cloud-notifications.0
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 +12 -2
- package/src/Dashboard/DashboardLayout.stories.tsx +3 -5
- package/src/Dashboard/Layout.tsx +4 -4
- package/src/Dashboard/utils.ts +28 -28
- package/src/Dialog/index.tsx +20 -1
- package/src/ThemeProvider/index.tsx +6 -5
- package/src/ThemeProvider/palettes.ts +389 -215
- package/src/api/TestQueryProvider.tsx +2 -1
- package/src/api/useFetchQuery/index.ts +8 -7
- package/src/api/useMutationQuery/index.ts +11 -10
- package/src/base/tokens/README.md +3 -0
- package/src/base/tokens/source/$metadata.json +5 -0
- package/src/base/tokens/source/base.json +142 -0
- package/src/base/tokens/themes/base.tokens.d.ts +38 -0
- package/src/base/tokens/themes/base.tokens.json +695 -0
- package/src/base/tokens/themes/base.tokens.ts +38 -0
- package/src/base/tokens/themes/ui-dark.tokens.d.ts +38 -0
- package/src/base/tokens/themes/ui-dark.tokens.json +695 -0
- package/src/base/tokens/themes/ui-dark.tokens.ts +38 -0
- package/src/base/tokens/themes/ui-light.tokens.d.ts +38 -0
- package/src/base/tokens/themes/ui-light.tokens.json +695 -0
- package/src/base/tokens/themes/ui-light.tokens.ts +38 -0
- package/src/components/Button/Button.styles.ts +17 -3
- package/src/components/Button/Button.tsx +6 -3
- package/src/components/Button/Icon/IconButton.styles.ts +9 -2
- package/src/components/DataTable/DataTable.stories.tsx +9 -0
- package/src/components/DataTable/DataTable.styles.ts +5 -0
- package/src/components/DataTable/DataTable.tsx +8 -6
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
- package/src/components/DataTable/Item/DataTableItem.styles.ts +5 -2
- package/src/components/DataTable/Item/DataTableItem.tsx +36 -18
- package/src/components/Header/Header.styles.ts +0 -27
- package/src/components/Header/PageHeader/PageHeader.stories.tsx +88 -0
- package/src/components/Header/PageHeader/PageHeader.styles.ts +99 -0
- package/src/components/Header/PageHeader/PageHeader.tsx +15 -0
- package/src/components/Header/PageHeader/PageHeaderActions.tsx +17 -0
- package/src/components/Header/PageHeader/PageHeaderMain.tsx +15 -0
- package/src/components/Header/PageHeader/PageHeaderMenu.tsx +15 -0
- package/src/components/Header/PageHeader/PageHeaderTitle.tsx +47 -0
- package/src/components/Header/PageHeader/index.ts +12 -0
- package/src/components/Header/index.ts +1 -1
- package/src/components/Layout/AreaIndicator.styles.ts +33 -0
- package/src/components/Layout/AreaIndicator.tsx +35 -0
- package/src/components/Layout/PageLayout/PageLayout.stories.tsx +81 -0
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +40 -0
- package/src/components/Layout/PageLayout/PageLayout.tsx +21 -0
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +15 -0
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +24 -0
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +15 -0
- package/src/components/Layout/PageLayout/index.ts +10 -0
- package/src/components/Layout/index.ts +1 -0
- package/src/components/Menu/Button/MenuButton.stories.tsx +16 -0
- package/src/components/Menu/Button/MenuButton.styles.ts +27 -0
- package/src/components/Menu/Button/MenuButton.tsx +62 -0
- package/src/components/Menu/Button/index.ts +1 -0
- package/src/components/Menu/Menu.stories.tsx +71 -0
- package/src/components/Menu/Menu.styles.ts +70 -0
- package/src/components/Menu/Menu.tsx +25 -0
- package/src/components/Menu/MenuDivider.tsx +13 -0
- package/src/components/Menu/MenuItem.tsx +36 -0
- package/src/components/Menu/MenuItems.tsx +35 -0
- package/src/components/Menu/index.ts +12 -0
- package/src/components/Menu/useMenu.tsx +79 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +70 -0
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +5 -0
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +115 -0
- package/src/components/Tooltip/TextOverflowTooltip/index.tsx +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +41 -0
- package/src/components/Tooltip/Tooltip.styles.ts +5 -0
- package/src/components/Tooltip/Tooltip.tsx +46 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/index.ts +0 -2
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +108 -0
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +110 -102
- package/src/styles/tokens/themes/_ui-dark.tokens.json +695 -0
- package/src/styles/tokens/themes/_ui-light.tokens.json +695 -0
- package/src/utils/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/src/utils/useResizeObserver.ts +6 -0
- package/test/setupTests.js +1 -1
- package/src/components/Header/Header.stories.tsx +0 -27
- package/src/components/Header/Header.tsx +0 -23
- package/src/layout/TiledListingPage/TiledListingActions.tsx +0 -15
- package/src/layout/TiledListingPage/TiledListingContent.tsx +0 -21
- package/src/layout/TiledListingPage/TiledListingList.tsx +0 -11
- package/src/layout/TiledListingPage/TiledListingPage.styles.ts +0 -16
- package/src/layout/TiledListingPage/TiledListingPage.tsx +0 -15
- package/src/layout/TiledListingPage/index.ts +0 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Sun, 04 Jun 2023 10:14:22 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const colorBlue50 = '#ecf4fdff';
|
|
7
|
+
export const colorBlue100 = '#d2e4f9ff';
|
|
8
|
+
export const colorBlue200 = '#9ec4f0ff';
|
|
9
|
+
export const colorBlue300 = '#6da4e4ff';
|
|
10
|
+
export const colorBlue400 = '#3e85d5ff';
|
|
11
|
+
export const colorBlue500 = '#2e68aaff';
|
|
12
|
+
export const colorBlue600 = '#205593ff';
|
|
13
|
+
export const colorBlue700 = '#164274ff';
|
|
14
|
+
export const colorBlue800 = '#0d2e54ff';
|
|
15
|
+
export const colorBlue900 = '#071d37ff';
|
|
16
|
+
export const colorBlue950 = '#031326ff';
|
|
17
|
+
export const colorPurple50 = '#f8f1f9ff';
|
|
18
|
+
export const colorPurple100 = '#f0def2ff';
|
|
19
|
+
export const colorPurple200 = '#ddafe4ff';
|
|
20
|
+
export const colorPurple300 = '#ce81daff';
|
|
21
|
+
export const colorPurple400 = '#c151d2ff';
|
|
22
|
+
export const colorPurple500 = '#ac28c1ff';
|
|
23
|
+
export const colorPurple600 = '#872796ff';
|
|
24
|
+
export const colorPurple700 = '#682172ff';
|
|
25
|
+
export const colorPurple800 = '#491b50ff';
|
|
26
|
+
export const colorPurple900 = '#29112cff';
|
|
27
|
+
export const colorPurple950 = '#1a0d1cff';
|
|
28
|
+
export const colorGrey50 = '#f9fafbff';
|
|
29
|
+
export const colorGrey100 = '#eaedf0ff';
|
|
30
|
+
export const colorGrey200 = '#cad0d8ff';
|
|
31
|
+
export const colorGrey300 = '#aab4c0ff';
|
|
32
|
+
export const colorGrey400 = '#8c98a6ff';
|
|
33
|
+
export const colorGrey500 = '#6f7b8aff';
|
|
34
|
+
export const colorGrey600 = '#596573ff';
|
|
35
|
+
export const colorGrey700 = '#434e5bff';
|
|
36
|
+
export const colorGrey800 = '#2f3741ff';
|
|
37
|
+
export const colorGrey900 = '#1b2127ff';
|
|
38
|
+
export const colorGrey950 = '#101418ff';
|
|
@@ -2,9 +2,20 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
2
2
|
|
|
3
3
|
const useStyles = makeStyles()((theme) => ({
|
|
4
4
|
button: {
|
|
5
|
+
'&[data-size="medium"]': {
|
|
6
|
+
fontSize: '16px',
|
|
7
|
+
height: 'unset',
|
|
8
|
+
lineHeight: '24px'
|
|
9
|
+
},
|
|
10
|
+
|
|
5
11
|
'&[data-size="small"]': {
|
|
6
|
-
|
|
7
|
-
|
|
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'
|
|
8
19
|
},
|
|
9
20
|
|
|
10
21
|
'&[data-variant="primary"]:not(:disabled)': {
|
|
@@ -23,7 +34,10 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
23
34
|
|
|
24
35
|
borderColor: theme.palette.primary.main,
|
|
25
36
|
color: theme.palette.primary.main
|
|
26
|
-
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
textWrap: 'noWrap',
|
|
40
|
+
transition: 'unset'
|
|
27
41
|
}
|
|
28
42
|
}));
|
|
29
43
|
|
|
@@ -16,13 +16,15 @@ const muiVariantMap: Record<
|
|
|
16
16
|
secondary: 'outlined'
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
type ButtonProps = {
|
|
19
|
+
export type ButtonProps = {
|
|
20
20
|
children: ReactNode;
|
|
21
|
+
className?: string;
|
|
21
22
|
disabled?: boolean;
|
|
22
23
|
icon?: string | ReactNode;
|
|
23
24
|
iconVariant?: 'none' | 'start' | 'end';
|
|
24
25
|
isDanger?: boolean;
|
|
25
26
|
onClick?: (e) => void;
|
|
27
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
26
28
|
size?: 'small' | 'medium' | 'large';
|
|
27
29
|
type?: 'button' | 'submit' | 'reset';
|
|
28
30
|
variant?: 'primary' | 'secondary' | 'ghost';
|
|
@@ -39,9 +41,10 @@ const Button = ({
|
|
|
39
41
|
disabled = false,
|
|
40
42
|
onClick,
|
|
41
43
|
isDanger = false,
|
|
44
|
+
className = '',
|
|
42
45
|
...attr
|
|
43
46
|
}: ButtonProps): ReactElement => {
|
|
44
|
-
const { classes } = useStyles();
|
|
47
|
+
const { classes, cx } = useStyles();
|
|
45
48
|
|
|
46
49
|
const MuiOverrideProps = useMemo(
|
|
47
50
|
() => ({
|
|
@@ -54,7 +57,7 @@ const Button = ({
|
|
|
54
57
|
|
|
55
58
|
return (
|
|
56
59
|
<MuiButton
|
|
57
|
-
className={classes.button}
|
|
60
|
+
className={cx(classes.button, className)}
|
|
58
61
|
data-icon-variant={iconVariant}
|
|
59
62
|
data-is-danger={isDanger}
|
|
60
63
|
data-size={size}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { makeStyles } from 'tss-react/mui';
|
|
2
2
|
|
|
3
|
-
const useStyles = makeStyles()(() => ({
|
|
4
|
-
iconButton: {
|
|
3
|
+
const useStyles = makeStyles()((theme) => ({
|
|
4
|
+
iconButton: {
|
|
5
|
+
'&[data-size="small"]': {
|
|
6
|
+
'& > svg, & > .MuiSvgIcon-root': {
|
|
7
|
+
fontSize: '1.125rem'
|
|
8
|
+
},
|
|
9
|
+
padding: theme.spacing(0.75)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
5
12
|
}));
|
|
6
13
|
|
|
7
14
|
export { useStyles };
|
|
@@ -40,3 +40,12 @@ export const AsEmptyState: Story = {
|
|
|
40
40
|
isEmpty: true
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
|
|
44
|
+
export const withFixedHeightContainer: Story = {
|
|
45
|
+
args: { ...Default.args },
|
|
46
|
+
render: (args) => (
|
|
47
|
+
<div style={{ height: '400px' }}>
|
|
48
|
+
<DataTable {...args} />
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
};
|
|
@@ -16,6 +16,11 @@ 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'
|
|
19
24
|
}
|
|
20
25
|
}));
|
|
21
26
|
|
|
@@ -20,12 +20,14 @@ const DataTable = ({
|
|
|
20
20
|
const { classes } = useStyles();
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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>
|
|
29
31
|
</div>
|
|
30
32
|
);
|
|
31
33
|
};
|
|
@@ -29,7 +29,10 @@ const DataTableEmptyState = ({
|
|
|
29
29
|
const { t } = useTranslation();
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<div
|
|
32
|
+
<div
|
|
33
|
+
className={classes.dataTableEmptyState}
|
|
34
|
+
data-testid="data-table-empty-state"
|
|
35
|
+
>
|
|
33
36
|
<MuiTypography variant="h2">{t(labels.title)}</MuiTypography>
|
|
34
37
|
<div className={classes.actions}>
|
|
35
38
|
{canCreate && (
|
|
@@ -10,10 +10,13 @@ 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
|
+
},
|
|
13
17
|
display: 'flex',
|
|
14
|
-
flexDirection: 'row-reverse',
|
|
15
|
-
gap: theme.spacing(1),
|
|
16
18
|
|
|
19
|
+
justifyContent: 'space-between',
|
|
17
20
|
opacity: 0
|
|
18
21
|
},
|
|
19
22
|
'&:hover .MuiCardActions-root': {
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
CardContent as MuiCardContent,
|
|
8
8
|
Typography as MuiTypography
|
|
9
9
|
} from '@mui/material';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Delete as DeleteIcon,
|
|
12
|
+
Settings as SettingsIcon,
|
|
13
|
+
Share as ShareIcon
|
|
14
|
+
} from '@mui/icons-material';
|
|
11
15
|
|
|
12
16
|
import { IconButton } from '../../Button';
|
|
13
17
|
|
|
@@ -20,6 +24,7 @@ export interface DataTableItemProps {
|
|
|
20
24
|
onClick?: () => void;
|
|
21
25
|
onDelete?: () => void;
|
|
22
26
|
onEdit?: () => void;
|
|
27
|
+
onEditAccessRights?: () => void;
|
|
23
28
|
title: string;
|
|
24
29
|
}
|
|
25
30
|
|
|
@@ -32,7 +37,8 @@ const DataTableItem = forwardRef(
|
|
|
32
37
|
hasActions = false,
|
|
33
38
|
onClick,
|
|
34
39
|
onEdit,
|
|
35
|
-
onDelete
|
|
40
|
+
onDelete,
|
|
41
|
+
onEditAccessRights
|
|
36
42
|
}: DataTableItemProps,
|
|
37
43
|
ref
|
|
38
44
|
): ReactElement => {
|
|
@@ -58,22 +64,34 @@ const DataTableItem = forwardRef(
|
|
|
58
64
|
</ActionArea>
|
|
59
65
|
{hasActions && (
|
|
60
66
|
<MuiCardActions>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
<span>
|
|
68
|
+
<IconButton
|
|
69
|
+
aria-label="delete"
|
|
70
|
+
data-testid="delete"
|
|
71
|
+
icon={<DeleteIcon />}
|
|
72
|
+
size="small"
|
|
73
|
+
variant="ghost"
|
|
74
|
+
onClick={() => onDelete?.()}
|
|
75
|
+
/>
|
|
76
|
+
</span>
|
|
77
|
+
<span>
|
|
78
|
+
<IconButton
|
|
79
|
+
aria-label="edit access rights"
|
|
80
|
+
data-testid="edit-access-rights"
|
|
81
|
+
icon={<ShareIcon />}
|
|
82
|
+
size="small"
|
|
83
|
+
variant="primary"
|
|
84
|
+
onClick={() => onEditAccessRights?.()}
|
|
85
|
+
/>
|
|
86
|
+
<IconButton
|
|
87
|
+
aria-label="edit"
|
|
88
|
+
data-testid="edit"
|
|
89
|
+
icon={<SettingsIcon />}
|
|
90
|
+
size="small"
|
|
91
|
+
variant="primary"
|
|
92
|
+
onClick={() => onEdit?.()}
|
|
93
|
+
/>
|
|
94
|
+
</span>
|
|
77
95
|
</MuiCardActions>
|
|
78
96
|
)}
|
|
79
97
|
</MuiCard>
|
|
@@ -1,27 +0,0 @@
|
|
|
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,88 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Settings as SettingsIcon,
|
|
5
|
+
StarOutline as StarOutlineIcon
|
|
6
|
+
} from '@mui/icons-material';
|
|
7
|
+
|
|
8
|
+
import { Button, IconButton } from '../../Button';
|
|
9
|
+
import { Menu } from '../../Menu';
|
|
10
|
+
|
|
11
|
+
import { PageHeader } from './index';
|
|
12
|
+
|
|
13
|
+
type PageHeaderComponent = typeof PageHeader & typeof PageHeader.Title;
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof PageHeader> = {
|
|
16
|
+
component: PageHeader
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<PageHeaderComponent>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
title: 'Page header'
|
|
25
|
+
},
|
|
26
|
+
render: (args) => (
|
|
27
|
+
<PageHeader>
|
|
28
|
+
<PageHeader.Main>
|
|
29
|
+
<PageHeader.Title {...args} />
|
|
30
|
+
</PageHeader.Main>
|
|
31
|
+
<PageHeader.Actions>
|
|
32
|
+
<Button
|
|
33
|
+
icon={<SettingsIcon />}
|
|
34
|
+
iconVariant="start"
|
|
35
|
+
size="small"
|
|
36
|
+
variant="ghost"
|
|
37
|
+
>
|
|
38
|
+
Manage
|
|
39
|
+
</Button>
|
|
40
|
+
</PageHeader.Actions>
|
|
41
|
+
</PageHeader>
|
|
42
|
+
)
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WithDescription: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
description:
|
|
48
|
+
'Eu aliquip quis in minim laboris occaecat quis nostrud occaecat. Cupidatat consectetur non Lorem eiusmod ut cupidatat dolor enim cillum ex enim irure velit. ',
|
|
49
|
+
title: 'Nulla ex dolore tempor magna ex'
|
|
50
|
+
},
|
|
51
|
+
render: Default.render
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const WithMenu: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
...WithDescription.args,
|
|
57
|
+
actions: (
|
|
58
|
+
<IconButton icon={<StarOutlineIcon />} size="small" variant="ghost" />
|
|
59
|
+
)
|
|
60
|
+
},
|
|
61
|
+
render: (args) => (
|
|
62
|
+
<PageHeader>
|
|
63
|
+
<PageHeader.Main>
|
|
64
|
+
<PageHeader.Menu>
|
|
65
|
+
<Menu>
|
|
66
|
+
<Menu.Button />
|
|
67
|
+
<Menu.Items>
|
|
68
|
+
<Menu.Item>Menu Item</Menu.Item>
|
|
69
|
+
<Menu.Item>Menu Item</Menu.Item>
|
|
70
|
+
<Menu.Item>Menu Item</Menu.Item>
|
|
71
|
+
</Menu.Items>
|
|
72
|
+
</Menu>
|
|
73
|
+
</PageHeader.Menu>
|
|
74
|
+
<PageHeader.Title {...args} />
|
|
75
|
+
</PageHeader.Main>
|
|
76
|
+
<PageHeader.Actions>
|
|
77
|
+
<Button
|
|
78
|
+
icon={<SettingsIcon />}
|
|
79
|
+
iconVariant="start"
|
|
80
|
+
size="small"
|
|
81
|
+
variant="ghost"
|
|
82
|
+
>
|
|
83
|
+
Manage
|
|
84
|
+
</Button>
|
|
85
|
+
</PageHeader.Actions>
|
|
86
|
+
</PageHeader>
|
|
87
|
+
)
|
|
88
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
|
|
16
|
+
nav: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
gap: theme.spacing(1),
|
|
19
|
+
justifyContent: 'flex-end'
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
padding: theme.spacing(0, 0, 1.5, 0)
|
|
23
|
+
},
|
|
24
|
+
pageHeader: {
|
|
25
|
+
alignItems: 'flex-start',
|
|
26
|
+
borderBottom: `1px solid ${theme.palette.header.page.border}`,
|
|
27
|
+
display: 'flex',
|
|
28
|
+
gap: theme.spacing(4),
|
|
29
|
+
paddingBottom: theme.spacing(2)
|
|
30
|
+
},
|
|
31
|
+
pageHeaderActions: {
|
|
32
|
+
'& > button': {
|
|
33
|
+
'&:hover': {
|
|
34
|
+
backgroundColor: theme.palette.header.page.action.background.active,
|
|
35
|
+
color: theme.palette.header.page.action.color.active
|
|
36
|
+
},
|
|
37
|
+
backgroundColor: theme.palette.header.page.action.background.default,
|
|
38
|
+
|
|
39
|
+
color: theme.palette.header.page.action.color.default
|
|
40
|
+
},
|
|
41
|
+
display: 'flex',
|
|
42
|
+
|
|
43
|
+
gap: theme.spacing(2)
|
|
44
|
+
},
|
|
45
|
+
pageHeaderMain: {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexGrow: 1,
|
|
48
|
+
gap: theme.spacing(1)
|
|
49
|
+
},
|
|
50
|
+
pageHeaderMenu: {
|
|
51
|
+
alignItems: 'flex-start',
|
|
52
|
+
display: 'flex',
|
|
53
|
+
position: 'relative',
|
|
54
|
+
transform: `translateY(-${theme.spacing(0.25)})`
|
|
55
|
+
},
|
|
56
|
+
pageHeaderTitle: {
|
|
57
|
+
'& > *': {
|
|
58
|
+
display: 'grid'
|
|
59
|
+
},
|
|
60
|
+
'& > span': {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
|
|
64
|
+
gap: theme.spacing(2)
|
|
65
|
+
},
|
|
66
|
+
display: 'flex',
|
|
67
|
+
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
|
|
70
|
+
gap: theme.spacing(1),
|
|
71
|
+
|
|
72
|
+
h1: {
|
|
73
|
+
color: theme.palette.header.page.title,
|
|
74
|
+
font: 'normal normal 700 24px/100% Roboto',
|
|
75
|
+
letterSpacing: '0.15px',
|
|
76
|
+
margin: theme.spacing(0)
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
pageHeaderTitleActions: {
|
|
80
|
+
'& > button': {
|
|
81
|
+
opacity: 0.2,
|
|
82
|
+
padding: 0
|
|
83
|
+
},
|
|
84
|
+
alignItems: 'bottom',
|
|
85
|
+
display: 'flex',
|
|
86
|
+
gap: theme.spacing(1)
|
|
87
|
+
},
|
|
88
|
+
pageHeaderTitleDescription: {
|
|
89
|
+
color: theme.palette.header.page.description,
|
|
90
|
+
font: 'normal normal 400 12px/16px Roboto',
|
|
91
|
+
letterSpacing: '0.15px',
|
|
92
|
+
maxWidth: '560px',
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
textOverflow: 'ellipsis',
|
|
95
|
+
whiteSpace: 'nowrap'
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
export { useStyles };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyles } from './PageHeader.styles';
|
|
4
|
+
|
|
5
|
+
type PageHeaderProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PageHeader = ({ children }: PageHeaderProps): ReactElement => {
|
|
10
|
+
const { classes } = useStyles();
|
|
11
|
+
|
|
12
|
+
return <section className={classes.pageHeader}>{children}</section>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { PageHeader };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyles } from './PageHeader.styles';
|
|
4
|
+
|
|
5
|
+
type PageHeaderActionsProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PageHeaderActions = ({
|
|
10
|
+
children
|
|
11
|
+
}: PageHeaderActionsProps): ReactElement => {
|
|
12
|
+
const { classes } = useStyles();
|
|
13
|
+
|
|
14
|
+
return <header className={classes.pageHeaderActions}>{children}</header>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { PageHeaderActions };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyles } from './PageHeader.styles';
|
|
4
|
+
|
|
5
|
+
type PageHeaderMainProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PageHeaderMain = ({ children }: PageHeaderMainProps): ReactElement => {
|
|
10
|
+
const { classes } = useStyles();
|
|
11
|
+
|
|
12
|
+
return <div className={classes.pageHeaderMain}>{children}</div>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { PageHeaderMain };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useStyles } from './PageHeader.styles';
|
|
4
|
+
|
|
5
|
+
type PageHeaderMenuProps = {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const PageHeaderMenu = ({ children }: PageHeaderMenuProps): ReactElement => {
|
|
10
|
+
const { classes } = useStyles();
|
|
11
|
+
|
|
12
|
+
return <nav className={classes.pageHeaderMenu}>{children}</nav>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { PageHeaderMenu };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Typography as MuiTypography } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
import { TextOverflowTooltip } from '../../Tooltip/TextOverflowTooltip';
|
|
6
|
+
|
|
7
|
+
import { useStyles } from './PageHeader.styles';
|
|
8
|
+
|
|
9
|
+
type PageHeaderTitleProps = {
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
description?: string;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const PageHeaderTitle = ({
|
|
16
|
+
actions,
|
|
17
|
+
title,
|
|
18
|
+
description
|
|
19
|
+
}: PageHeaderTitleProps): ReactElement => {
|
|
20
|
+
const { classes } = useStyles();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={classes.pageHeaderTitle}>
|
|
24
|
+
<span>
|
|
25
|
+
<MuiTypography aria-label="page header title" variant="h1">
|
|
26
|
+
{title}
|
|
27
|
+
</MuiTypography>
|
|
28
|
+
{actions && (
|
|
29
|
+
<div className={classes.pageHeaderTitleActions}>{actions}</div>
|
|
30
|
+
)}
|
|
31
|
+
</span>
|
|
32
|
+
{description && (
|
|
33
|
+
<TextOverflowTooltip label={description}>
|
|
34
|
+
<MuiTypography
|
|
35
|
+
aria-label="page header description"
|
|
36
|
+
className={classes.pageHeaderTitleDescription}
|
|
37
|
+
variant="body2"
|
|
38
|
+
>
|
|
39
|
+
{description}
|
|
40
|
+
</MuiTypography>
|
|
41
|
+
</TextOverflowTooltip>
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { PageHeaderTitle };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PageHeader as PageHeaderRoot } from './PageHeader';
|
|
2
|
+
import { PageHeaderMain } from './PageHeaderMain';
|
|
3
|
+
import { PageHeaderMenu } from './PageHeaderMenu';
|
|
4
|
+
import { PageHeaderTitle } from './PageHeaderTitle';
|
|
5
|
+
import { PageHeaderActions } from './PageHeaderActions';
|
|
6
|
+
|
|
7
|
+
export const PageHeader = Object.assign(PageHeaderRoot, {
|
|
8
|
+
Actions: PageHeaderActions,
|
|
9
|
+
Main: PageHeaderMain,
|
|
10
|
+
Menu: PageHeaderMenu,
|
|
11
|
+
Title: PageHeaderTitle
|
|
12
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './PageHeader';
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}));
|