@canmingir/link 1.1.8 → 1.2.1
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 +1 -1
- package/src/layouts/DashboardLayout/header.jsx +3 -5
- package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +88 -0
- package/src/lib/CustomBreadcrumbs/index.js +1 -0
- package/src/lib/CustomBreadcrumbs/link-item.jsx +58 -0
- package/src/lib/CustomPopover/CustomPopover.jsx +46 -0
- package/src/lib/CustomPopover/index.js +3 -0
- package/src/lib/CustomPopover/styles.js +82 -0
- package/src/lib/CustomPopover/usePopover.js +20 -0
- package/src/lib/CustomPopover/utils.js +100 -0
- package/src/lib/FormProvider/FormProvider.jsx +16 -0
- package/src/lib/FormProvider/index.js +1 -0
- package/src/lib/IconSelector/IconSelector.jsx +4 -4
- package/src/lib/Image/Image.jsx +116 -0
- package/src/lib/Image/index.js +1 -0
- package/src/lib/Image/utils.js +15 -0
- package/src/lib/Label/Label.jsx +51 -0
- package/src/lib/Label/index.js +1 -0
- package/src/lib/Label/styles.js +76 -0
- package/src/lib/ProjectWizard.jsx +6 -6
- package/src/lib/RHFTextfield/RHFTextfield.jsx +39 -0
- package/src/lib/RHFTextfield/index.js +1 -0
- package/src/lib/Scrollbar/Scrollbar.jsx +39 -0
- package/src/lib/Scrollbar/index.js +1 -0
- package/src/lib/Scrollbar/styles.js +27 -0
- package/src/lib/SearchNotFound/SearchNotFound.jsx +29 -0
- package/src/lib/SearchNotFound/index.js +1 -0
- package/src/lib/TableHeadCustom/TableHeadCustom.jsx +87 -0
- package/src/lib/TableHeadCustom/index.js +1 -0
- package/src/lib/TableSelectedAction/TableSelectedAction.jsx +72 -0
- package/src/lib/TableSelectedAction/index.js +1 -0
- package/src/lib/index.js +13 -0
- package/src/lib/useChart/useChart.js +179 -0
- package/src/lib/useTable/useTable.js +121 -0
- package/src/widgets/SettingsDialog.jsx +6 -6
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { HEADER, NAV } from "../config-layout";
|
|
2
|
+
|
|
1
3
|
import AccountPopover from "../common/account-popover";
|
|
2
4
|
import AppBar from "@mui/material/AppBar";
|
|
3
5
|
import IconButton from "@mui/material/IconButton";
|
|
4
|
-
import Iconify from "
|
|
6
|
+
import Iconify from "../../components/Iconify";
|
|
5
7
|
import Logo from "../../components/logo";
|
|
6
8
|
import NotificationsPopover from "../common/notifications-popover";
|
|
7
9
|
import ProjectBar from "../common/ProjectBar";
|
|
@@ -16,10 +18,6 @@ import { useResponsive } from "../../hooks/use-responsive";
|
|
|
16
18
|
import { useSettingsContext } from "../../components/settings";
|
|
17
19
|
import { useTheme } from "@mui/material/styles";
|
|
18
20
|
|
|
19
|
-
import { HEADER, NAV } from "../config-layout";
|
|
20
|
-
|
|
21
|
-
// ----------------------------------------------------------------------
|
|
22
|
-
|
|
23
21
|
export default function Header({ onOpenNav }) {
|
|
24
22
|
const theme = useTheme();
|
|
25
23
|
const settings = useSettingsContext();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import Breadcrumbs from "@mui/material/Breadcrumbs";
|
|
3
|
+
import Link from "@mui/material/Link";
|
|
4
|
+
import LinkItem from "./link-item";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import Stack from "@mui/material/Stack";
|
|
7
|
+
import Typography from "@mui/material/Typography";
|
|
8
|
+
|
|
9
|
+
export default function CustomBreadcrumbs({
|
|
10
|
+
links,
|
|
11
|
+
action,
|
|
12
|
+
heading,
|
|
13
|
+
moreLink,
|
|
14
|
+
activeLast,
|
|
15
|
+
sx,
|
|
16
|
+
...other
|
|
17
|
+
}) {
|
|
18
|
+
const lastLink = links[links.length - 1].name;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Box sx={{ ...sx }}>
|
|
22
|
+
<Stack direction="row" alignItems="center">
|
|
23
|
+
<Box sx={{ flexGrow: 1 }}>
|
|
24
|
+
{heading && (
|
|
25
|
+
<Typography variant="h4" gutterBottom>
|
|
26
|
+
{heading}
|
|
27
|
+
</Typography>
|
|
28
|
+
)}
|
|
29
|
+
|
|
30
|
+
{!!links.length && (
|
|
31
|
+
<Breadcrumbs separator={<Separator />} {...other}>
|
|
32
|
+
{links.map((link) => (
|
|
33
|
+
<LinkItem
|
|
34
|
+
key={link.name || ""}
|
|
35
|
+
link={link}
|
|
36
|
+
activeLast={activeLast}
|
|
37
|
+
disabled={link.name === lastLink}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</Breadcrumbs>
|
|
41
|
+
)}
|
|
42
|
+
</Box>
|
|
43
|
+
|
|
44
|
+
{action && <Box sx={{ flexShrink: 0 }}> {action} </Box>}
|
|
45
|
+
</Stack>
|
|
46
|
+
|
|
47
|
+
{!!moreLink && (
|
|
48
|
+
<Box sx={{ mt: 2 }}>
|
|
49
|
+
{moreLink.map((href) => (
|
|
50
|
+
<Link
|
|
51
|
+
key={href}
|
|
52
|
+
href={href}
|
|
53
|
+
variant="body2"
|
|
54
|
+
target="_blank"
|
|
55
|
+
rel="noopener"
|
|
56
|
+
sx={{ display: "table" }}
|
|
57
|
+
>
|
|
58
|
+
{href}
|
|
59
|
+
</Link>
|
|
60
|
+
))}
|
|
61
|
+
</Box>
|
|
62
|
+
)}
|
|
63
|
+
</Box>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
CustomBreadcrumbs.propTypes = {
|
|
68
|
+
sx: PropTypes.object,
|
|
69
|
+
action: PropTypes.node,
|
|
70
|
+
links: PropTypes.array,
|
|
71
|
+
heading: PropTypes.string,
|
|
72
|
+
moreLink: PropTypes.array,
|
|
73
|
+
activeLast: PropTypes.bool,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
function Separator() {
|
|
77
|
+
return (
|
|
78
|
+
<Box
|
|
79
|
+
component="span"
|
|
80
|
+
sx={{
|
|
81
|
+
width: 4,
|
|
82
|
+
height: 4,
|
|
83
|
+
borderRadius: "50%",
|
|
84
|
+
bgcolor: "text.disabled",
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./CustomBreadcrumbs";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import Link from "@mui/material/Link";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { RouterLink } from "../../routes/components/router-link";
|
|
5
|
+
|
|
6
|
+
export default function BreadcrumbsLink({ link, activeLast, disabled }) {
|
|
7
|
+
const styles = {
|
|
8
|
+
typography: "body2",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
color: "text.primary",
|
|
11
|
+
display: "inline-flex",
|
|
12
|
+
...(disabled &&
|
|
13
|
+
!activeLast && {
|
|
14
|
+
cursor: "default",
|
|
15
|
+
pointerEvents: "none",
|
|
16
|
+
color: "text.disabled",
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const renderContent = (
|
|
21
|
+
<>
|
|
22
|
+
{link.icon && (
|
|
23
|
+
<Box
|
|
24
|
+
component="span"
|
|
25
|
+
sx={{
|
|
26
|
+
mr: 1,
|
|
27
|
+
display: "inherit",
|
|
28
|
+
"& svg": { width: 20, height: 20 },
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{link.icon}
|
|
32
|
+
</Box>
|
|
33
|
+
)}
|
|
34
|
+
|
|
35
|
+
{link.name}
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (link.href) {
|
|
40
|
+
return (
|
|
41
|
+
<Link component={RouterLink} href={link.href} sx={styles}>
|
|
42
|
+
{renderContent}
|
|
43
|
+
</Link>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return <Box sx={styles}> {renderContent} </Box>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
BreadcrumbsLink.propTypes = {
|
|
51
|
+
activeLast: PropTypes.bool,
|
|
52
|
+
disabled: PropTypes.bool,
|
|
53
|
+
link: PropTypes.shape({
|
|
54
|
+
href: PropTypes.string,
|
|
55
|
+
icon: PropTypes.node,
|
|
56
|
+
name: PropTypes.string,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import Popover from "@mui/material/Popover";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { StyledArrow } from "./styles";
|
|
4
|
+
import { getPosition } from "./utils";
|
|
5
|
+
import { menuItemClasses } from "@mui/material/MenuItem";
|
|
6
|
+
|
|
7
|
+
export default function CustomPopover({
|
|
8
|
+
open,
|
|
9
|
+
children,
|
|
10
|
+
arrow = "top-right",
|
|
11
|
+
hiddenArrow,
|
|
12
|
+
sx,
|
|
13
|
+
...other
|
|
14
|
+
}) {
|
|
15
|
+
const { style, anchorOrigin, transformOrigin } = getPosition(arrow);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Popover
|
|
19
|
+
open={Boolean(open)}
|
|
20
|
+
anchorEl={open}
|
|
21
|
+
anchorOrigin={anchorOrigin}
|
|
22
|
+
transformOrigin={transformOrigin}
|
|
23
|
+
slotProps={{
|
|
24
|
+
paper: {
|
|
25
|
+
sx: {
|
|
26
|
+
width: "auto",
|
|
27
|
+
overflow: "inherit",
|
|
28
|
+
...style,
|
|
29
|
+
[`& .${menuItemClasses.root}`]: {
|
|
30
|
+
"& svg": {
|
|
31
|
+
mr: 2,
|
|
32
|
+
flexShrink: 0,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
...sx,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}}
|
|
39
|
+
{...other}
|
|
40
|
+
>
|
|
41
|
+
{!hiddenArrow && <StyledArrow arrow={arrow} />}
|
|
42
|
+
|
|
43
|
+
{children}
|
|
44
|
+
</Popover>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { alpha, styled } from "@mui/material/styles";
|
|
2
|
+
|
|
3
|
+
import { bgBlur } from "../../theme/css";
|
|
4
|
+
|
|
5
|
+
export const StyledArrow = styled("span")(({ arrow, theme }) => {
|
|
6
|
+
const SIZE = 14;
|
|
7
|
+
|
|
8
|
+
const POSITION = -(SIZE / 2) + 0.5;
|
|
9
|
+
|
|
10
|
+
const topStyle = {
|
|
11
|
+
top: POSITION,
|
|
12
|
+
transform: "rotate(135deg)",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const bottomStyle = {
|
|
16
|
+
bottom: POSITION,
|
|
17
|
+
transform: "rotate(-45deg)",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const leftStyle = {
|
|
21
|
+
left: POSITION,
|
|
22
|
+
transform: "rotate(45deg)",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const rightStyle = {
|
|
26
|
+
right: POSITION,
|
|
27
|
+
transform: "rotate(-135deg)",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
width: SIZE,
|
|
32
|
+
height: SIZE,
|
|
33
|
+
position: "absolute",
|
|
34
|
+
borderBottomLeftRadius: SIZE / 4,
|
|
35
|
+
clipPath: "polygon(0% 0%, 100% 100%, 0% 100%)",
|
|
36
|
+
border: `solid 1px ${alpha(
|
|
37
|
+
theme.palette.mode === "light"
|
|
38
|
+
? theme.palette.grey[500]
|
|
39
|
+
: theme.palette.common.black,
|
|
40
|
+
0.12
|
|
41
|
+
)}`,
|
|
42
|
+
...bgBlur({
|
|
43
|
+
color: theme.palette.background.paper,
|
|
44
|
+
}),
|
|
45
|
+
// Top
|
|
46
|
+
...(arrow === "top-left" && { ...topStyle, left: 20 }),
|
|
47
|
+
...(arrow === "top-center" && {
|
|
48
|
+
...topStyle,
|
|
49
|
+
left: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
margin: "auto",
|
|
52
|
+
}),
|
|
53
|
+
...(arrow === "top-right" && { ...topStyle, right: 20 }),
|
|
54
|
+
// Bottom
|
|
55
|
+
...(arrow === "bottom-left" && { ...bottomStyle, left: 20 }),
|
|
56
|
+
...(arrow === "bottom-center" && {
|
|
57
|
+
...bottomStyle,
|
|
58
|
+
left: 0,
|
|
59
|
+
right: 0,
|
|
60
|
+
margin: "auto",
|
|
61
|
+
}),
|
|
62
|
+
...(arrow === "bottom-right" && { ...bottomStyle, right: 20 }),
|
|
63
|
+
// Left
|
|
64
|
+
...(arrow === "left-top" && { ...leftStyle, top: 20 }),
|
|
65
|
+
...(arrow === "left-center" && {
|
|
66
|
+
...leftStyle,
|
|
67
|
+
top: 0,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
margin: "auto",
|
|
70
|
+
}),
|
|
71
|
+
...(arrow === "left-bottom" && { ...leftStyle, bottom: 20 }),
|
|
72
|
+
// Right
|
|
73
|
+
...(arrow === "right-top" && { ...rightStyle, top: 20 }),
|
|
74
|
+
...(arrow === "right-center" && {
|
|
75
|
+
...rightStyle,
|
|
76
|
+
top: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
margin: "auto",
|
|
79
|
+
}),
|
|
80
|
+
...(arrow === "right-bottom" && { ...rightStyle, bottom: 20 }),
|
|
81
|
+
};
|
|
82
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export default function usePopover() {
|
|
4
|
+
const [open, setOpen] = useState(null);
|
|
5
|
+
|
|
6
|
+
const onOpen = useCallback((event) => {
|
|
7
|
+
setOpen(event.currentTarget);
|
|
8
|
+
}, []);
|
|
9
|
+
|
|
10
|
+
const onClose = useCallback(() => {
|
|
11
|
+
setOpen(null);
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
open,
|
|
16
|
+
onOpen,
|
|
17
|
+
onClose,
|
|
18
|
+
setOpen,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export function getPosition(arrow) {
|
|
2
|
+
let props;
|
|
3
|
+
|
|
4
|
+
switch (arrow) {
|
|
5
|
+
case "top-left":
|
|
6
|
+
props = {
|
|
7
|
+
style: { ml: -0.75 },
|
|
8
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
9
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
10
|
+
};
|
|
11
|
+
break;
|
|
12
|
+
case "top-center":
|
|
13
|
+
props = {
|
|
14
|
+
style: {},
|
|
15
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
16
|
+
transformOrigin: { vertical: "top", horizontal: "center" },
|
|
17
|
+
};
|
|
18
|
+
break;
|
|
19
|
+
case "top-right":
|
|
20
|
+
props = {
|
|
21
|
+
style: { ml: 0.75 },
|
|
22
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
23
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
24
|
+
};
|
|
25
|
+
break;
|
|
26
|
+
case "bottom-left":
|
|
27
|
+
props = {
|
|
28
|
+
style: { ml: -0.75 },
|
|
29
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
30
|
+
transformOrigin: { vertical: "bottom", horizontal: "left" },
|
|
31
|
+
};
|
|
32
|
+
break;
|
|
33
|
+
case "bottom-center":
|
|
34
|
+
props = {
|
|
35
|
+
style: {},
|
|
36
|
+
anchorOrigin: { vertical: "top", horizontal: "center" },
|
|
37
|
+
transformOrigin: { vertical: "bottom", horizontal: "center" },
|
|
38
|
+
};
|
|
39
|
+
break;
|
|
40
|
+
case "bottom-right":
|
|
41
|
+
props = {
|
|
42
|
+
style: { ml: 0.75 },
|
|
43
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
44
|
+
transformOrigin: { vertical: "bottom", horizontal: "right" },
|
|
45
|
+
};
|
|
46
|
+
break;
|
|
47
|
+
case "left-top":
|
|
48
|
+
props = {
|
|
49
|
+
style: { mt: -0.75 },
|
|
50
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
51
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
52
|
+
};
|
|
53
|
+
break;
|
|
54
|
+
case "left-center":
|
|
55
|
+
props = {
|
|
56
|
+
style: {},
|
|
57
|
+
anchorOrigin: { vertical: "center", horizontal: "right" },
|
|
58
|
+
transformOrigin: { vertical: "center", horizontal: "left" },
|
|
59
|
+
};
|
|
60
|
+
break;
|
|
61
|
+
case "left-bottom":
|
|
62
|
+
props = {
|
|
63
|
+
style: { mt: 0.75 },
|
|
64
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
65
|
+
transformOrigin: { vertical: "bottom", horizontal: "left" },
|
|
66
|
+
};
|
|
67
|
+
break;
|
|
68
|
+
case "right-top":
|
|
69
|
+
props = {
|
|
70
|
+
style: { mt: -0.75 },
|
|
71
|
+
anchorOrigin: { vertical: "top", horizontal: "left" },
|
|
72
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
73
|
+
};
|
|
74
|
+
break;
|
|
75
|
+
case "right-center":
|
|
76
|
+
props = {
|
|
77
|
+
style: {},
|
|
78
|
+
anchorOrigin: { vertical: "center", horizontal: "left" },
|
|
79
|
+
transformOrigin: { vertical: "center", horizontal: "right" },
|
|
80
|
+
};
|
|
81
|
+
break;
|
|
82
|
+
case "right-bottom":
|
|
83
|
+
props = {
|
|
84
|
+
style: { mt: 0.75 },
|
|
85
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
86
|
+
transformOrigin: { vertical: "bottom", horizontal: "right" },
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
// top-right
|
|
91
|
+
default:
|
|
92
|
+
props = {
|
|
93
|
+
style: { ml: 0.75 },
|
|
94
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
95
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return props;
|
|
100
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormProvider as Form } from "react-hook-form";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
export default function FormProvider({ children, onSubmit, methods }) {
|
|
5
|
+
return (
|
|
6
|
+
<Form {...methods}>
|
|
7
|
+
<form onSubmit={onSubmit}>{children}</form>
|
|
8
|
+
</Form>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
FormProvider.propTypes = {
|
|
13
|
+
children: PropTypes.node,
|
|
14
|
+
methods: PropTypes.object,
|
|
15
|
+
onSubmit: PropTypes.func,
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./FormProvider";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { Dialog, Stack } from "@mui/material";
|
|
2
|
+
|
|
1
3
|
import Avatar from "@mui/material/Avatar";
|
|
2
4
|
import IconButton from "@mui/material/IconButton";
|
|
3
|
-
import
|
|
5
|
+
import Iconify from "../Iconify";
|
|
4
6
|
import Icons from "../lib/Icons";
|
|
5
7
|
import Picker from "@emoji-mart/react";
|
|
6
8
|
import React from "react";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { Dialog, Stack } from "@mui/material";
|
|
9
|
+
import SvgColor from "../SvgColor";
|
|
10
10
|
|
|
11
11
|
export default function IconSelector({
|
|
12
12
|
handleEmojiSelect,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { alpha, useTheme } from "@mui/material/styles";
|
|
2
|
+
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import { LazyLoadImage } from "react-lazy-load-image-component";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { getRatio } from "./utils";
|
|
8
|
+
|
|
9
|
+
const Image = forwardRef(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
ratio,
|
|
13
|
+
overlay,
|
|
14
|
+
disabledEffect = false,
|
|
15
|
+
alt,
|
|
16
|
+
src,
|
|
17
|
+
afterLoad,
|
|
18
|
+
delayTime,
|
|
19
|
+
threshold,
|
|
20
|
+
beforeLoad,
|
|
21
|
+
delayMethod,
|
|
22
|
+
placeholder,
|
|
23
|
+
wrapperProps,
|
|
24
|
+
scrollPosition,
|
|
25
|
+
effect = "blur",
|
|
26
|
+
visibleByDefault,
|
|
27
|
+
wrapperClassName,
|
|
28
|
+
useIntersectionObserver,
|
|
29
|
+
sx,
|
|
30
|
+
...other
|
|
31
|
+
},
|
|
32
|
+
ref
|
|
33
|
+
) => {
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
|
|
36
|
+
const overlayStyles = !!overlay && {
|
|
37
|
+
"&:before": {
|
|
38
|
+
content: "''",
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
width: 1,
|
|
42
|
+
height: 1,
|
|
43
|
+
zIndex: 1,
|
|
44
|
+
position: "absolute",
|
|
45
|
+
background: overlay || alpha(theme.palette.grey[900], 0.48),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const content = (
|
|
50
|
+
<Box
|
|
51
|
+
component={LazyLoadImage}
|
|
52
|
+
alt={alt}
|
|
53
|
+
src={src}
|
|
54
|
+
afterLoad={afterLoad}
|
|
55
|
+
delayTime={delayTime}
|
|
56
|
+
threshold={threshold}
|
|
57
|
+
beforeLoad={beforeLoad}
|
|
58
|
+
delayMethod={delayMethod}
|
|
59
|
+
placeholder={placeholder}
|
|
60
|
+
wrapperProps={wrapperProps}
|
|
61
|
+
scrollPosition={scrollPosition}
|
|
62
|
+
visibleByDefault={visibleByDefault}
|
|
63
|
+
effect={disabledEffect ? undefined : effect}
|
|
64
|
+
useIntersectionObserver={useIntersectionObserver}
|
|
65
|
+
wrapperClassName={wrapperClassName || "component-image-wrapper"}
|
|
66
|
+
placeholderSrc={
|
|
67
|
+
disabledEffect ? "/assets/transparent.png" : "/assets/placeholder.svg"
|
|
68
|
+
}
|
|
69
|
+
sx={{
|
|
70
|
+
width: 1,
|
|
71
|
+
height: 1,
|
|
72
|
+
objectFit: "cover",
|
|
73
|
+
verticalAlign: "bottom",
|
|
74
|
+
...(!!ratio && {
|
|
75
|
+
top: 0,
|
|
76
|
+
left: 0,
|
|
77
|
+
position: "absolute",
|
|
78
|
+
}),
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Box
|
|
85
|
+
ref={ref}
|
|
86
|
+
component="span"
|
|
87
|
+
className="component-image"
|
|
88
|
+
sx={{
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
position: "relative",
|
|
91
|
+
verticalAlign: "bottom",
|
|
92
|
+
display: "inline-block",
|
|
93
|
+
...(!!ratio && {
|
|
94
|
+
width: 1,
|
|
95
|
+
}),
|
|
96
|
+
"& span.component-image-wrapper": {
|
|
97
|
+
width: 1,
|
|
98
|
+
height: 1,
|
|
99
|
+
verticalAlign: "bottom",
|
|
100
|
+
backgroundSize: "cover !important",
|
|
101
|
+
...(!!ratio && {
|
|
102
|
+
pt: getRatio(ratio),
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
...overlayStyles,
|
|
106
|
+
...sx,
|
|
107
|
+
}}
|
|
108
|
+
{...other}
|
|
109
|
+
>
|
|
110
|
+
{content}
|
|
111
|
+
</Box>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
export default Image;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Image";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
export function getRatio(ratio = "1/1") {
|
|
4
|
+
return {
|
|
5
|
+
"4/3": "calc(100% / 4 * 3)",
|
|
6
|
+
"3/4": "calc(100% / 3 * 4)",
|
|
7
|
+
"6/4": "calc(100% / 6 * 4)",
|
|
8
|
+
"4/6": "calc(100% / 4 * 6)",
|
|
9
|
+
"16/9": "calc(100% / 16 * 9)",
|
|
10
|
+
"9/16": "calc(100% / 9 * 16)",
|
|
11
|
+
"21/9": "calc(100% / 21 * 9)",
|
|
12
|
+
"9/21": "calc(100% / 9 * 21)",
|
|
13
|
+
"1/1": "100%",
|
|
14
|
+
}[ratio];
|
|
15
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { StyledLabel } from "./styles";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { useTheme } from "@mui/material/styles";
|
|
6
|
+
|
|
7
|
+
const Label = forwardRef(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
children,
|
|
11
|
+
color = "default",
|
|
12
|
+
variant = "soft",
|
|
13
|
+
startIcon,
|
|
14
|
+
endIcon,
|
|
15
|
+
sx,
|
|
16
|
+
...other
|
|
17
|
+
},
|
|
18
|
+
ref
|
|
19
|
+
) => {
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
|
|
22
|
+
const iconStyles = {
|
|
23
|
+
width: 16,
|
|
24
|
+
height: 16,
|
|
25
|
+
"& svg, img": { width: 1, height: 1, objectFit: "cover" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<StyledLabel
|
|
30
|
+
ref={ref}
|
|
31
|
+
component="span"
|
|
32
|
+
ownerState={{ color, variant }}
|
|
33
|
+
sx={{
|
|
34
|
+
...(startIcon && { pl: 0.75 }),
|
|
35
|
+
...(endIcon && { pr: 0.75 }),
|
|
36
|
+
...sx,
|
|
37
|
+
}}
|
|
38
|
+
theme={theme}
|
|
39
|
+
{...other}
|
|
40
|
+
>
|
|
41
|
+
{startIcon && <Box sx={{ mr: 0.75, ...iconStyles }}> {startIcon} </Box>}
|
|
42
|
+
|
|
43
|
+
{children}
|
|
44
|
+
|
|
45
|
+
{endIcon && <Box sx={{ ml: 0.75, ...iconStyles }}> {endIcon} </Box>}
|
|
46
|
+
</StyledLabel>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default Label;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./label";
|