@nethru/ui 1.0.9 → 1.0.11
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/dist/AvatarDropdown.js +80 -0
- package/dist/Frame.js +4 -4
- package/dist/Slider.js +1 -1
- package/dist/StatusChip.js +3 -3
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import { Avatar, Box, IconButton } from '@mui/material';
|
|
3
|
+
import Menu from '@mui/material/Menu';
|
|
4
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
|
+
import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded';
|
|
8
|
+
import { red } from '@mui/material/colors';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export default function AvatarDropdown({
|
|
12
|
+
name,
|
|
13
|
+
color,
|
|
14
|
+
bgcolor,
|
|
15
|
+
children,
|
|
16
|
+
onProfileClick,
|
|
17
|
+
onLogoutClick,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
21
|
+
const open = Boolean(anchorEl);
|
|
22
|
+
const firstLetter = useMemo(() => {
|
|
23
|
+
return name && name.length > 0 ? name[0].toUpperCase() : "?";
|
|
24
|
+
}, [name]);
|
|
25
|
+
const handleClick = event => setAnchorEl(event.currentTarget);
|
|
26
|
+
const handleClose = () => setAnchorEl(null);
|
|
27
|
+
const styles = {
|
|
28
|
+
color: color ? color : '#fff',
|
|
29
|
+
bgcolor: bgcolor ? bgcolor : red[900],
|
|
30
|
+
width: 32,
|
|
31
|
+
height: 32,
|
|
32
|
+
fontSize: 16
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
35
|
+
...props,
|
|
36
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
37
|
+
onClick: handleClick,
|
|
38
|
+
size: "small",
|
|
39
|
+
sx: {
|
|
40
|
+
ml: 2
|
|
41
|
+
},
|
|
42
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
43
|
+
sx: styles,
|
|
44
|
+
children: firstLetter
|
|
45
|
+
})
|
|
46
|
+
}), /*#__PURE__*/_jsxs(Menu, {
|
|
47
|
+
anchorEl: anchorEl,
|
|
48
|
+
open: open,
|
|
49
|
+
onClose: handleClose,
|
|
50
|
+
onClick: handleClose,
|
|
51
|
+
sx: {
|
|
52
|
+
'.MuiButtonBase-root.MuiMenuItem-root': {
|
|
53
|
+
fontSize: 14
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
children: [/*#__PURE__*/_jsxs(MenuItem, {
|
|
57
|
+
onClick: onProfileClick,
|
|
58
|
+
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
59
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
60
|
+
sx: {
|
|
61
|
+
...styles,
|
|
62
|
+
mr: 1,
|
|
63
|
+
fontSize: 13,
|
|
64
|
+
width: 22,
|
|
65
|
+
height: 22
|
|
66
|
+
},
|
|
67
|
+
children: firstLetter
|
|
68
|
+
})
|
|
69
|
+
}), name]
|
|
70
|
+
}), /*#__PURE__*/_jsx(Divider, {}), children, children && /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(MenuItem, {
|
|
71
|
+
onClick: onLogoutClick,
|
|
72
|
+
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
73
|
+
children: /*#__PURE__*/_jsx(LogoutRoundedIcon, {
|
|
74
|
+
fontSize: "small"
|
|
75
|
+
})
|
|
76
|
+
}), "\uB85C\uADF8\uC544\uC6C3"]
|
|
77
|
+
})]
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
}
|
package/dist/Frame.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Outlet } from 'react-router-dom';
|
|
2
1
|
import { Box } from '@mui/material';
|
|
3
2
|
import { SidebarContextProvider } from './sidebar/SidebarContext';
|
|
4
|
-
import Sidebar from "./sidebar/Sidebar";
|
|
5
3
|
import { variables } from './variables';
|
|
6
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
7
|
export default function Frame({
|
|
10
8
|
appBar,
|
|
9
|
+
sideBar,
|
|
10
|
+
children,
|
|
11
11
|
footer,
|
|
12
12
|
menu,
|
|
13
13
|
menuIcons = {}
|
|
@@ -30,12 +30,12 @@ export default function Frame({
|
|
|
30
30
|
children: [/*#__PURE__*/_jsx(SidebarContextProvider, {
|
|
31
31
|
menu: menu,
|
|
32
32
|
icons: menuIcons,
|
|
33
|
-
children:
|
|
33
|
+
children: sideBar
|
|
34
34
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
35
35
|
component: "section",
|
|
36
36
|
sx: contentStyles,
|
|
37
37
|
children: [/*#__PURE__*/_jsx("main", {
|
|
38
|
-
children:
|
|
38
|
+
children: children
|
|
39
39
|
}), footer]
|
|
40
40
|
})]
|
|
41
41
|
})]
|
package/dist/Slider.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function Slider({
|
|
|
11
11
|
const autoMarks = useMemo(() => {
|
|
12
12
|
let values = value || defaultValue;
|
|
13
13
|
if (values === undefined) return {};
|
|
14
|
-
if (values instanceof Array
|
|
14
|
+
if (values instanceof Array === false) values = [values];
|
|
15
15
|
return values.map(v => {
|
|
16
16
|
return {
|
|
17
17
|
value: v,
|
package/dist/StatusChip.js
CHANGED
|
@@ -6,7 +6,7 @@ export default function StatusChip({
|
|
|
6
6
|
id,
|
|
7
7
|
label,
|
|
8
8
|
status,
|
|
9
|
-
|
|
9
|
+
onDelete,
|
|
10
10
|
...props
|
|
11
11
|
}) {
|
|
12
12
|
const styles = {
|
|
@@ -14,7 +14,7 @@ export default function StatusChip({
|
|
|
14
14
|
bgcolor: status === 'normal' ? '#4caf50' : '#fff'
|
|
15
15
|
},
|
|
16
16
|
'.MuiSvgIcon-root.MuiChip-deleteIcon': {
|
|
17
|
-
cursor:
|
|
17
|
+
cursor: onDelete ? 'pointer' : 'default'
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
return /*#__PURE__*/_jsx(Chip, {
|
|
@@ -23,7 +23,7 @@ export default function StatusChip({
|
|
|
23
23
|
variant: status === 'normal' ? 'filled' : 'outlined',
|
|
24
24
|
color: status === 'normal' ? 'success' : 'default',
|
|
25
25
|
deleteIcon: status === 'normal' ? /*#__PURE__*/_jsx(CheckCircleIcon, {}) : /*#__PURE__*/_jsx(ErrorIcon, {}),
|
|
26
|
-
onDelete: _ =>
|
|
26
|
+
onDelete: _ => onDelete && onDelete(id, status),
|
|
27
27
|
sx: styles,
|
|
28
28
|
...props
|
|
29
29
|
});
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { default as AccordionDetails } from "./AccordionDetails";
|
|
|
3
3
|
export { default as AccordionSummary } from "./AccordionSummary";
|
|
4
4
|
export { default as AlertDialog } from "./AlertDialog";
|
|
5
5
|
export { default as AppBar } from "./AppBar";
|
|
6
|
+
export { default as AvatarDropdown } from "./AvatarDropdown";
|
|
6
7
|
export { default as Checkbox } from "./Checkbox";
|
|
7
8
|
export { default as ConfirmDialog } from "./ConfirmDialog";
|
|
8
9
|
export { default as DataGrid } from "./DataGrid";
|