@nethru/ui 1.0.81 → 2.0.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/base/AddableFormList.js +56 -0
- package/base/Alert.js +27 -0
- package/base/Checkbox.js +20 -0
- package/base/CircularProgressButton.js +36 -0
- package/base/ColumnedSection.js +44 -0
- package/base/DropdownButton.js +74 -0
- package/base/MainHeader.js +56 -0
- package/base/MenuItem.js +92 -0
- package/base/PropertyTable.js +69 -0
- package/base/SearchTextField.js +44 -0
- package/base/SearchableSelect.js +64 -0
- package/base/Select.js +33 -0
- package/{dist → base}/Slider.js +12 -13
- package/base/Snackbar.js +33 -0
- package/base/Switch.js +20 -0
- package/base/assets/icons.js +390 -0
- package/base/assets/images.js +1 -0
- package/base/colors/blue.js +15 -0
- package/base/colors/blueGrey.js +6 -0
- package/base/colors/green.js +13 -0
- package/base/colors/grey.js +18 -0
- package/base/colors/index.js +9 -0
- package/base/colors/lime.js +13 -0
- package/base/colors/orange.js +13 -0
- package/base/colors/purple.js +13 -0
- package/base/colors/red.js +13 -0
- package/base/colors/yellow.js +13 -0
- package/base/datagrid/DataGrid.js +57 -0
- package/base/datagrid/Footer.js +51 -0
- package/base/datagrid/Pagination.js +24 -0
- package/base/dialog/AlertDialog.js +21 -0
- package/base/dialog/ConfirmDialog.js +29 -0
- package/base/dialog/Dialog.js +56 -0
- package/base/dialog/SimpleDialog.js +33 -0
- package/{dist → base}/error/Error.js +1 -2
- package/base/frame/AppBar.js +54 -0
- package/base/frame/Brand.js +36 -0
- package/base/frame/Frame.js +49 -0
- package/{dist → base/frame}/sidebar/MenuToggler.js +14 -3
- package/{dist → base/frame}/sidebar/PrimaryMenu.js +15 -20
- package/base/frame/sidebar/SecondaryMenu.js +41 -0
- package/{dist → base/frame}/sidebar/Sidebar.js +21 -10
- package/base/frame/sidebar/SidebarContext.js +74 -0
- package/base/frame/sidebar/css/primary.module.css +69 -0
- package/base/frame/sidebar/css/sidebar.module.css +63 -0
- package/base/index.js +33 -0
- package/{dist → base}/samples/menu.sample.json +2 -2
- package/base/styles/borderRadius.js +7 -0
- package/base/styles/createTheme.js +90 -0
- package/base/styles/globalStyles.js +47 -0
- package/base/styles/mui/alert.js +40 -0
- package/base/styles/mui/appBar.js +17 -0
- package/base/styles/mui/autocomplete.js +46 -0
- package/base/styles/mui/avatar.js +14 -0
- package/base/styles/mui/button.js +276 -0
- package/base/styles/mui/buttonBase.js +10 -0
- package/base/styles/mui/checkbox.js +37 -0
- package/base/styles/mui/chip.js +83 -0
- package/base/styles/mui/cssBaseline.js +12 -0
- package/base/styles/mui/dataGrid.js +101 -0
- package/base/styles/mui/dialog.js +13 -0
- package/base/styles/mui/dialogActions.js +8 -0
- package/base/styles/mui/dialogContent.js +10 -0
- package/base/styles/mui/dialogTitle.js +11 -0
- package/base/styles/mui/formControl.js +8 -0
- package/base/styles/mui/formControlLabel.js +9 -0
- package/base/styles/mui/formHelperText.js +10 -0
- package/base/styles/mui/grid.js +15 -0
- package/base/styles/mui/icon.js +12 -0
- package/base/styles/mui/iconButton.js +79 -0
- package/base/styles/mui/inputLabel.js +13 -0
- package/base/styles/mui/list.js +11 -0
- package/base/styles/mui/menuItem.js +83 -0
- package/base/styles/mui/outlinedInput.js +53 -0
- package/base/styles/mui/paginationItem.js +25 -0
- package/base/styles/mui/paper.js +8 -0
- package/base/styles/mui/popover.js +11 -0
- package/base/styles/mui/select.js +11 -0
- package/base/styles/mui/slider.js +15 -0
- package/base/styles/mui/snackbar.js +24 -0
- package/base/styles/mui/switch.js +33 -0
- package/base/styles/mui/tab.js +23 -0
- package/base/styles/mui/tablePagination.js +8 -0
- package/base/styles/mui/tabs.js +20 -0
- package/base/styles/mui/textField.js +11 -0
- package/base/styles/mui/toggleButton.js +96 -0
- package/base/styles/mui/tooltip.js +22 -0
- package/base/styles/palette.js +40 -0
- package/base/styles/shadow.js +8 -0
- package/base/styles/typography.js +131 -0
- package/package.json +14 -10
- package/dist/Accordion.js +0 -45
- package/dist/AccordionDetails.js +0 -19
- package/dist/AccordionSummary.js +0 -35
- package/dist/AlertDialog.js +0 -55
- package/dist/AppBar.js +0 -68
- package/dist/AppendableFormList.js +0 -56
- package/dist/AvatarDropdown.js +0 -80
- package/dist/Button.js +0 -61
- package/dist/Checkbox.js +0 -27
- package/dist/CircularProgress.js +0 -33
- package/dist/ColumnedSection.js +0 -64
- package/dist/ConfirmDialog.js +0 -65
- package/dist/DataGrid.js +0 -150
- package/dist/Dialog.js +0 -42
- package/dist/DropdownButton.js +0 -59
- package/dist/FormLabel.js +0 -23
- package/dist/Frame.js +0 -47
- package/dist/GroupSelect.js +0 -67
- package/dist/ListItem.js +0 -21
- package/dist/ListItemDivider.js +0 -15
- package/dist/ListItemGrid.js +0 -12
- package/dist/ListItemText.js +0 -44
- package/dist/MainHeader.js +0 -59
- package/dist/PropertyTable.js +0 -141
- package/dist/ReferenceChipList.js +0 -59
- package/dist/SearchTextField.js +0 -24
- package/dist/SearchableSelect.js +0 -41
- package/dist/Section.js +0 -22
- package/dist/Select.js +0 -48
- package/dist/ShadowedSection.js +0 -36
- package/dist/Snackbar.js +0 -51
- package/dist/StatusChip.js +0 -34
- package/dist/Switch.js +0 -37
- package/dist/TabbedSection.js +0 -37
- package/dist/Tabs.js +0 -38
- package/dist/TextField.js +0 -25
- package/dist/index.js +0 -42
- package/dist/samples/global.sample.css +0 -59
- package/dist/sidebar/MenuTree.js +0 -95
- package/dist/sidebar/MenuTreeGroup.js +0 -65
- package/dist/sidebar/SecondaryMenu.js +0 -36
- package/dist/sidebar/SidebarContext.js +0 -122
- package/dist/sidebar/css/primary.module.css +0 -80
- package/dist/sidebar/css/sidebar.module.css +0 -50
- package/dist/variables.js +0 -6
- /package/{dist → base}/editor/Editor.js +0 -0
- /package/{dist → base}/editor/nScript.js +0 -0
- /package/{dist → base}/editor/nScriptKeywords.js +0 -0
- /package/{dist → base}/error/HttpError.js +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { forwardRef, useCallback } from "react";
|
|
2
|
+
import { DataGridPro as MuiDataGridPro, GridToolbarQuickFilter, koKR } from "@mui/x-data-grid-pro";
|
|
3
|
+
import { Box, Stack } from "@mui/material";
|
|
4
|
+
import Footer from "./Footer";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const DataGrid = /*#__PURE__*/forwardRef(({
|
|
8
|
+
toolbarLeadingSlot,
|
|
9
|
+
hideToolbar = false,
|
|
10
|
+
...props
|
|
11
|
+
}, ref) => {
|
|
12
|
+
const getRowHeight = useCallback(() => 'auto', []);
|
|
13
|
+
return /*#__PURE__*/_jsx(MuiDataGridPro, {
|
|
14
|
+
ref: ref,
|
|
15
|
+
autoHeight: true,
|
|
16
|
+
getRowHeight: getRowHeight,
|
|
17
|
+
disableColumnMenu: true,
|
|
18
|
+
disableColumnReorder: true,
|
|
19
|
+
disableRowSelectionOnClick: true,
|
|
20
|
+
pagination: true,
|
|
21
|
+
pageSizeOptions: [10, 25, 50, 100],
|
|
22
|
+
initialState: {
|
|
23
|
+
pagination: {
|
|
24
|
+
paginationModel: {
|
|
25
|
+
pageSize: 10,
|
|
26
|
+
page: 0
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
localeText: {
|
|
31
|
+
...koKR.components.MuiDataGrid.defaultProps.localeText,
|
|
32
|
+
noRowsLabel: '항목이 없습니다.',
|
|
33
|
+
...props.localText
|
|
34
|
+
},
|
|
35
|
+
slots: {
|
|
36
|
+
toolbar: hideToolbar ? null : Toolbar,
|
|
37
|
+
footer: Footer,
|
|
38
|
+
...props.slots
|
|
39
|
+
},
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
function Toolbar() {
|
|
43
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
44
|
+
direction: "row",
|
|
45
|
+
justifyContent: "space-between",
|
|
46
|
+
mb: 1.5,
|
|
47
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
48
|
+
children: toolbarLeadingSlot
|
|
49
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
50
|
+
children: /*#__PURE__*/_jsx(GridToolbarQuickFilter, {
|
|
51
|
+
variant: "outlined"
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export default DataGrid;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useMemo } from "react";
|
|
2
|
+
import { Box, Stack } from "@mui/material";
|
|
3
|
+
import { GridFooter, GridPagination } from "@mui/x-data-grid-pro";
|
|
4
|
+
import Pagination from "./Pagination";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const Footer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
|
+
const nullFunction = useCallback(() => null, []);
|
|
9
|
+
const footerStyles = useMemo(() => ({
|
|
10
|
+
'.MuiDataGrid-selectedRowCount': {},
|
|
11
|
+
'.MuiTablePagination-root': {
|
|
12
|
+
display: 'none'
|
|
13
|
+
}
|
|
14
|
+
}), []);
|
|
15
|
+
const rowsPerPageNone = useMemo(() => ({
|
|
16
|
+
'.MuiTablePagination-selectLabel + .MuiTablePagination-input': {
|
|
17
|
+
display: 'none'
|
|
18
|
+
}
|
|
19
|
+
}), []);
|
|
20
|
+
const rowsPerPageStyles = useMemo(() => ({
|
|
21
|
+
'.MuiTablePagination-selectLabel + .MuiTablePagination-input': {
|
|
22
|
+
marginLeft: 0,
|
|
23
|
+
marginRight: 0
|
|
24
|
+
}
|
|
25
|
+
}), []);
|
|
26
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
direction: "row",
|
|
29
|
+
children: [/*#__PURE__*/_jsx(GridFooter, {
|
|
30
|
+
sx: footerStyles,
|
|
31
|
+
...props
|
|
32
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
33
|
+
display: "flex",
|
|
34
|
+
flexGrow: 1,
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
children: /*#__PURE__*/_jsx(GridPagination, {
|
|
37
|
+
labelDisplayedRows: nullFunction,
|
|
38
|
+
labelRowsPerPage: null,
|
|
39
|
+
ActionsComponent: Pagination,
|
|
40
|
+
sx: rowsPerPageNone,
|
|
41
|
+
...props
|
|
42
|
+
})
|
|
43
|
+
}), /*#__PURE__*/_jsx(GridPagination, {
|
|
44
|
+
labelDisplayedRows: () => null,
|
|
45
|
+
ActionsComponent: () => null,
|
|
46
|
+
sx: rowsPerPageStyles,
|
|
47
|
+
...props
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export default Footer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import MuiPagination from "@mui/material/Pagination";
|
|
3
|
+
import { gridPageCountSelector, useGridApiContext, useGridSelector } from "@mui/x-data-grid-pro";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const Pagination = /*#__PURE__*/forwardRef(({
|
|
6
|
+
page,
|
|
7
|
+
onPageChange,
|
|
8
|
+
className
|
|
9
|
+
}, ref) => {
|
|
10
|
+
const apiRef = useGridApiContext();
|
|
11
|
+
const pageCount = useGridSelector(apiRef, gridPageCountSelector);
|
|
12
|
+
return /*#__PURE__*/_jsx(MuiPagination, {
|
|
13
|
+
ref: ref,
|
|
14
|
+
color: "primary",
|
|
15
|
+
size: "small",
|
|
16
|
+
className: className,
|
|
17
|
+
count: pageCount,
|
|
18
|
+
page: page + 1,
|
|
19
|
+
onChange: (event, newPage) => {
|
|
20
|
+
onPageChange(event, newPage - 1);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
export default Pagination;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Button } from "@mui/material";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import SimpleDialog from "./SimpleDialog";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const AlertDialog = /*#__PURE__*/forwardRef(({
|
|
6
|
+
onClose,
|
|
7
|
+
closeText = '확인',
|
|
8
|
+
...props
|
|
9
|
+
}, ref) => {
|
|
10
|
+
return /*#__PURE__*/_jsx(SimpleDialog, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
onClose: onClose,
|
|
13
|
+
...props,
|
|
14
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
15
|
+
variant: "contained",
|
|
16
|
+
onClick: onClose,
|
|
17
|
+
children: closeText
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export default AlertDialog;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { Button } from "@mui/material";
|
|
3
|
+
import SimpleDialog from "./SimpleDialog";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const ConfirmDialog = /*#__PURE__*/forwardRef(({
|
|
7
|
+
onConfirm,
|
|
8
|
+
onCancel,
|
|
9
|
+
confirmText = '예',
|
|
10
|
+
cancelText = '아니오',
|
|
11
|
+
...props
|
|
12
|
+
}, ref) => {
|
|
13
|
+
return /*#__PURE__*/_jsxs(SimpleDialog, {
|
|
14
|
+
ref: ref,
|
|
15
|
+
onClose: onCancel,
|
|
16
|
+
...props,
|
|
17
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
18
|
+
variant: "contained",
|
|
19
|
+
onClick: onConfirm,
|
|
20
|
+
autoFocus: true,
|
|
21
|
+
children: confirmText
|
|
22
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
23
|
+
variant: "outlined",
|
|
24
|
+
onClick: onCancel,
|
|
25
|
+
children: cancelText
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
export default ConfirmDialog;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { forwardRef, useMemo } from "react";
|
|
2
|
+
import { DialogTitle, IconButton, Slide, Zoom } from "@mui/material";
|
|
3
|
+
import MuiDialog from "@mui/material/Dialog";
|
|
4
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const ZoomTransition = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
8
|
+
return /*#__PURE__*/_jsx(Zoom, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
const SlideTransition = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
14
|
+
return /*#__PURE__*/_jsx(Slide, {
|
|
15
|
+
direction: "down",
|
|
16
|
+
ref: ref,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const Dialog = /*#__PURE__*/forwardRef(({
|
|
21
|
+
title,
|
|
22
|
+
showCloseIcon,
|
|
23
|
+
center = true,
|
|
24
|
+
children,
|
|
25
|
+
sx,
|
|
26
|
+
...props
|
|
27
|
+
}, ref) => {
|
|
28
|
+
const styles = useMemo(() => ({
|
|
29
|
+
'& .MuiDialog-container': {
|
|
30
|
+
alignItems: center ? 'center' : 'flex-start'
|
|
31
|
+
}
|
|
32
|
+
}), [center]);
|
|
33
|
+
const iconButtonStyles = useMemo(() => ({
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: 20,
|
|
36
|
+
top: 24,
|
|
37
|
+
color: theme => theme.palette.grey[700]
|
|
38
|
+
}), []);
|
|
39
|
+
return /*#__PURE__*/_jsxs(MuiDialog, {
|
|
40
|
+
ref: ref,
|
|
41
|
+
TransitionComponent: center ? ZoomTransition : SlideTransition,
|
|
42
|
+
sx: {
|
|
43
|
+
...styles,
|
|
44
|
+
sx
|
|
45
|
+
},
|
|
46
|
+
...props,
|
|
47
|
+
children: [title && /*#__PURE__*/_jsx(DialogTitle, {
|
|
48
|
+
children: title
|
|
49
|
+
}), showCloseIcon && /*#__PURE__*/_jsx(IconButton, {
|
|
50
|
+
onClick: props.onClose,
|
|
51
|
+
sx: iconButtonStyles,
|
|
52
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
|
53
|
+
}), children]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
export default Dialog;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
2
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
3
|
+
import Dialog from "./Dialog";
|
|
4
|
+
import Alert from "../Alert";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const SimpleDialog = /*#__PURE__*/forwardRef(({
|
|
9
|
+
severity,
|
|
10
|
+
content,
|
|
11
|
+
subcontent,
|
|
12
|
+
children,
|
|
13
|
+
open,
|
|
14
|
+
onClose,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
return /*#__PURE__*/_jsxs(Dialog, {
|
|
18
|
+
ref: ref,
|
|
19
|
+
open: open,
|
|
20
|
+
onClose: onClose,
|
|
21
|
+
...props,
|
|
22
|
+
children: [/*#__PURE__*/_jsx(DialogContent, {
|
|
23
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
24
|
+
severity: severity,
|
|
25
|
+
subcontent: subcontent,
|
|
26
|
+
children: content
|
|
27
|
+
})
|
|
28
|
+
}), /*#__PURE__*/_jsx(DialogActions, {
|
|
29
|
+
children: children
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export default SimpleDialog;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Box, Button, Paper, Stack, Typography } from "@mui/material";
|
|
2
2
|
import CampaignIcon from '@mui/icons-material/Campaign';
|
|
3
3
|
import { useNavigate } from "react-router-dom";
|
|
4
|
-
import { variables } from "../variables";
|
|
5
4
|
import { useCallback } from "react";
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -22,7 +21,7 @@ export default function Error({
|
|
|
22
21
|
justifyContent: "center",
|
|
23
22
|
alignItems: "center",
|
|
24
23
|
sx: {
|
|
25
|
-
backgroundColor:
|
|
24
|
+
backgroundColor: 'red'
|
|
26
25
|
},
|
|
27
26
|
children: [/*#__PURE__*/_jsxs(Paper, {
|
|
28
27
|
variant: "outlined",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from "react";
|
|
2
|
+
import { Box, Stack, Toolbar } from "@mui/material";
|
|
3
|
+
import MuiAppBar from "@mui/material/AppBar";
|
|
4
|
+
import { useSidebarContext } from "./sidebar/SidebarContext";
|
|
5
|
+
import { appbarBackground } from "../assets/images";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const AppBar = /*#__PURE__*/forwardRef(({
|
|
9
|
+
mode,
|
|
10
|
+
appsSlot,
|
|
11
|
+
brandSlot,
|
|
12
|
+
avatarSlot,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
states
|
|
18
|
+
} = useSidebarContext();
|
|
19
|
+
const styles = useMemo(() => ({
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
right: 0,
|
|
22
|
+
top: 'calc(var(--gnb-height) - 10px)',
|
|
23
|
+
width: `calc(100% - var(--primary-menu-width) - ${states.menuClosed ? 'var(--secondary-menu-collapsed-width) - 3px' : 'var(--secondary-menu-width)'} )`,
|
|
24
|
+
height: 10,
|
|
25
|
+
backgroundImage: appbarBackground,
|
|
26
|
+
backgroundRepeat: 'repeat-x',
|
|
27
|
+
backgroundPositionY: 'bottom'
|
|
28
|
+
}), [states.menuClosed]);
|
|
29
|
+
return /*#__PURE__*/_jsxs(MuiAppBar, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
className: mode === 'preview' ? 'MuiAppBar-preview' : '',
|
|
32
|
+
...props,
|
|
33
|
+
children: [/*#__PURE__*/_jsx(Toolbar, {
|
|
34
|
+
children: /*#__PURE__*/_jsxs(Stack, {
|
|
35
|
+
direction: "row",
|
|
36
|
+
justifyContent: "space-between",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
flexGrow: 1,
|
|
39
|
+
gap: 5.5,
|
|
40
|
+
children: [appsSlot, brandSlot, /*#__PURE__*/_jsxs(Stack, {
|
|
41
|
+
direction: "row",
|
|
42
|
+
justifyContent: "space-between",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
flexGrow: 1,
|
|
45
|
+
gap: 6,
|
|
46
|
+
children: [children, !children && /*#__PURE__*/_jsx(Box, {}), avatarSlot]
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
49
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
50
|
+
sx: styles
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
export default AppBar;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from "react";
|
|
2
|
+
import { Box, Stack, Typography } from "@mui/material";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const Brand = /*#__PURE__*/forwardRef(({
|
|
6
|
+
title,
|
|
7
|
+
logoUri,
|
|
8
|
+
onLogoClick,
|
|
9
|
+
...props
|
|
10
|
+
}, ref) => {
|
|
11
|
+
const logoStyles = useMemo(() => ({
|
|
12
|
+
cursor: onLogoClick ? 'pointer' : 'default'
|
|
13
|
+
}), [onLogoClick]);
|
|
14
|
+
const titleStyles = useMemo(() => ({
|
|
15
|
+
cursor: 'default'
|
|
16
|
+
}), []);
|
|
17
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
18
|
+
gap: 1.5,
|
|
19
|
+
direction: "row",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
...props,
|
|
22
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
23
|
+
component: "img",
|
|
24
|
+
src: logoUri,
|
|
25
|
+
onClick: onLogoClick,
|
|
26
|
+
sx: logoStyles,
|
|
27
|
+
alt: "logo"
|
|
28
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
29
|
+
variant: "logo",
|
|
30
|
+
noWrap: true,
|
|
31
|
+
sx: titleStyles,
|
|
32
|
+
children: title
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
export default Brand;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { forwardRef, useMemo } from "react";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import { SidebarContextProvider } from '../frame/sidebar/SidebarContext';
|
|
4
|
+
import { blueGrey } from "../colors";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const Frame = /*#__PURE__*/forwardRef(({
|
|
8
|
+
appBar,
|
|
9
|
+
sideBar,
|
|
10
|
+
menu,
|
|
11
|
+
menuIcons = {},
|
|
12
|
+
children,
|
|
13
|
+
footer,
|
|
14
|
+
mainRef,
|
|
15
|
+
onScroll
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const containerStyles = useMemo(() => ({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
overflow: 'auto',
|
|
21
|
+
marginTop: 'var(--gnb-height)'
|
|
22
|
+
}), []);
|
|
23
|
+
const contentStyles = useMemo(() => ({
|
|
24
|
+
flexGrow: 1,
|
|
25
|
+
overflow: 'auto',
|
|
26
|
+
padding: '24px 28px',
|
|
27
|
+
backgroundColor: blueGrey.contentBg
|
|
28
|
+
}), []);
|
|
29
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
children: /*#__PURE__*/_jsxs(SidebarContextProvider, {
|
|
32
|
+
menu: menu,
|
|
33
|
+
icons: menuIcons,
|
|
34
|
+
children: [appBar, /*#__PURE__*/_jsxs(Box, {
|
|
35
|
+
sx: containerStyles,
|
|
36
|
+
children: [sideBar, /*#__PURE__*/_jsxs(Box, {
|
|
37
|
+
ref: mainRef,
|
|
38
|
+
component: "section",
|
|
39
|
+
sx: contentStyles,
|
|
40
|
+
onScroll: onScroll,
|
|
41
|
+
children: [/*#__PURE__*/_jsx("main", {
|
|
42
|
+
children: children
|
|
43
|
+
}), footer]
|
|
44
|
+
})]
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
export default Frame;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Box } from '@mui/material';
|
|
2
|
-
import NavigateBeforeIcon from '@mui/icons-material/NavigateBefore';
|
|
3
|
-
import NavigateNextIcon from '@mui/icons-material/NavigateNext';
|
|
4
2
|
import styles from './css/sidebar.module.css';
|
|
3
|
+
import { CollapseIcon, ExpandIcon } from "../../assets/icons";
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
6
|
export default function MenuToggler({
|
|
@@ -11,8 +10,20 @@ export default function MenuToggler({
|
|
|
11
10
|
return /*#__PURE__*/_jsx(Box, {
|
|
12
11
|
className: `${styles.toggler} ${closed ? styles.closed : styles.opened}`,
|
|
13
12
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
13
|
+
display: "flex",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
height: "100%",
|
|
14
17
|
onClick: onClick,
|
|
15
|
-
children: [!closed && /*#__PURE__*/_jsx(
|
|
18
|
+
children: [!closed && /*#__PURE__*/_jsx(CollapseIcon, {
|
|
19
|
+
sx: {
|
|
20
|
+
fontSize: 24
|
|
21
|
+
}
|
|
22
|
+
}), closed && /*#__PURE__*/_jsx(ExpandIcon, {
|
|
23
|
+
sx: {
|
|
24
|
+
fontSize: 24
|
|
25
|
+
}
|
|
26
|
+
})]
|
|
16
27
|
})
|
|
17
28
|
});
|
|
18
29
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Link } from 'react-router-dom';
|
|
2
1
|
import { Box, Stack } from '@mui/material';
|
|
3
2
|
import { useSidebarContext } from "./SidebarContext";
|
|
4
3
|
import styles from './css/primary.module.css';
|
|
5
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
6
|
export default function PrimaryMenu({
|
|
8
|
-
items
|
|
7
|
+
items,
|
|
8
|
+
onClick
|
|
9
9
|
}) {
|
|
10
10
|
const {
|
|
11
11
|
states,
|
|
@@ -13,10 +13,11 @@ export default function PrimaryMenu({
|
|
|
13
13
|
} = useSidebarContext();
|
|
14
14
|
return /*#__PURE__*/_jsx(Stack, {
|
|
15
15
|
className: styles.container,
|
|
16
|
+
gap: 4,
|
|
16
17
|
children: items.map(item => /*#__PURE__*/_jsx(MenuItem, {
|
|
17
18
|
icon: icons[item.href],
|
|
18
19
|
active: item.id === states.activePrimaryItem,
|
|
19
|
-
|
|
20
|
+
onClick: _ => onClick(item),
|
|
20
21
|
...item
|
|
21
22
|
}, item.href))
|
|
22
23
|
});
|
|
@@ -24,24 +25,18 @@ export default function PrimaryMenu({
|
|
|
24
25
|
function MenuItem({
|
|
25
26
|
name,
|
|
26
27
|
icon,
|
|
27
|
-
href,
|
|
28
28
|
active,
|
|
29
|
-
|
|
29
|
+
onClick
|
|
30
30
|
}) {
|
|
31
|
-
return /*#__PURE__*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: /*#__PURE__*/
|
|
35
|
-
className:
|
|
36
|
-
children: [active
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
42
|
-
className: styles.text,
|
|
43
|
-
children: name
|
|
44
|
-
})]
|
|
45
|
-
})
|
|
31
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
32
|
+
className: `${styles['nav-item']} ${active && styles.active}`,
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
35
|
+
className: styles.icon,
|
|
36
|
+
children: icon instanceof Array ? icon[active ? 1 : 0] : icon
|
|
37
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
38
|
+
className: styles.text,
|
|
39
|
+
children: name
|
|
40
|
+
})]
|
|
46
41
|
});
|
|
47
42
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MenuList, Stack } from '@mui/material';
|
|
2
|
+
import styles from './css/sidebar.module.css';
|
|
3
|
+
import MenuItem from "../../MenuItem";
|
|
4
|
+
import { useSidebarContext } from "./SidebarContext";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export default function SecondaryMenu({
|
|
7
|
+
sections,
|
|
8
|
+
closed,
|
|
9
|
+
onClick
|
|
10
|
+
}) {
|
|
11
|
+
const {
|
|
12
|
+
states
|
|
13
|
+
} = useSidebarContext();
|
|
14
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
15
|
+
className: `${styles.secondary} ${closed ? styles.closed : styles.opened}`,
|
|
16
|
+
children: /*#__PURE__*/_jsx(MenuList, {
|
|
17
|
+
sx: {
|
|
18
|
+
visibility: closed ? 'hidden' : 'visible'
|
|
19
|
+
},
|
|
20
|
+
children: sections.map((section, index) => {
|
|
21
|
+
let jsx = [];
|
|
22
|
+
if (section.name) jsx.push( /*#__PURE__*/_jsx(MenuItem, {
|
|
23
|
+
variant: "menusection",
|
|
24
|
+
children: section.name
|
|
25
|
+
}, section.id));
|
|
26
|
+
section.menu.forEach(item => {
|
|
27
|
+
jsx.push( /*#__PURE__*/_jsx(MenuItem, {
|
|
28
|
+
variant: "menuitem",
|
|
29
|
+
selected: item.id === states.activeSecondaryItem,
|
|
30
|
+
onClick: _ => onClick(item),
|
|
31
|
+
children: item.name
|
|
32
|
+
}, item.id));
|
|
33
|
+
});
|
|
34
|
+
jsx.push( /*#__PURE__*/_jsx(MenuItem, {
|
|
35
|
+
variant: "spacer"
|
|
36
|
+
}, `${index}-${section.menu?.length}`));
|
|
37
|
+
return jsx;
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
3
|
-
import { useSidebarContext } from "./SidebarContext";
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
4
3
|
import { Stack } from "@mui/material";
|
|
4
|
+
import { useSidebarContext } from "./SidebarContext";
|
|
5
5
|
import PrimaryMenu from "./PrimaryMenu";
|
|
6
6
|
import SecondaryMenu from "./SecondaryMenu";
|
|
7
7
|
import MenuToggler from "./MenuToggler";
|
|
8
8
|
import styles from './css/sidebar.module.css';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
const Sidebar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
12
12
|
const [sections, setSections] = useState();
|
|
13
13
|
const {
|
|
14
14
|
menu,
|
|
@@ -19,6 +19,15 @@ export default function Sidebar() {
|
|
|
19
19
|
menuClosed: closed
|
|
20
20
|
} = states;
|
|
21
21
|
const location = useLocation();
|
|
22
|
+
const navigate = useNavigate();
|
|
23
|
+
const handleClick = useCallback(item => {
|
|
24
|
+
navigate(item.href);
|
|
25
|
+
}, [navigate]);
|
|
26
|
+
const handleToggle = useCallback(_ => {
|
|
27
|
+
dispatch({
|
|
28
|
+
type: 'secondaryMenuToggled'
|
|
29
|
+
});
|
|
30
|
+
}, [dispatch]);
|
|
22
31
|
useEffect(() => {
|
|
23
32
|
dispatch({
|
|
24
33
|
type: 'updateActiveItems',
|
|
@@ -33,20 +42,22 @@ export default function Sidebar() {
|
|
|
33
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
43
|
}, [states]);
|
|
35
44
|
return /*#__PURE__*/_jsxs(Stack, {
|
|
45
|
+
ref: ref,
|
|
36
46
|
className: `${styles.container} ${closed || isEmpty(sections) ? styles.closed : styles.opened}`,
|
|
37
47
|
children: [/*#__PURE__*/_jsx(PrimaryMenu, {
|
|
38
|
-
items: menu
|
|
48
|
+
items: menu,
|
|
49
|
+
onClick: handleClick
|
|
39
50
|
}), /*#__PURE__*/_jsx(SecondaryMenu, {
|
|
40
51
|
sections: sections ? sections : [],
|
|
41
|
-
closed: !isEmpty(sections) ? closed : true
|
|
52
|
+
closed: !isEmpty(sections) ? closed : true,
|
|
53
|
+
onClick: handleClick
|
|
42
54
|
}), !isEmpty(sections) && /*#__PURE__*/_jsx(MenuToggler, {
|
|
43
55
|
closed: closed,
|
|
44
|
-
onClick:
|
|
45
|
-
type: "secondaryMenuToggled"
|
|
46
|
-
})
|
|
56
|
+
onClick: handleToggle
|
|
47
57
|
})]
|
|
48
58
|
});
|
|
49
|
-
}
|
|
59
|
+
});
|
|
60
|
+
export default Sidebar;
|
|
50
61
|
function isEmpty(list) {
|
|
51
62
|
return list && list.length === 0;
|
|
52
63
|
}
|