@nethru/ui 1.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.
Files changed (42) hide show
  1. package/README.md +28 -0
  2. package/dist/Accordion.js +41 -0
  3. package/dist/AccordionDetails.js +15 -0
  4. package/dist/AccordionSummary.js +25 -0
  5. package/dist/AlertDialog.js +48 -0
  6. package/dist/AppBar.js +64 -0
  7. package/dist/Checkbox.js +17 -0
  8. package/dist/ConfirmDialog.js +54 -0
  9. package/dist/DataGrid.js +129 -0
  10. package/dist/Dialog.js +26 -0
  11. package/dist/FormLabel.js +18 -0
  12. package/dist/Frame.js +43 -0
  13. package/dist/GroupSelect.js +65 -0
  14. package/dist/ListItem.js +19 -0
  15. package/dist/ListItemDivider.js +13 -0
  16. package/dist/ListItemGrid.js +12 -0
  17. package/dist/ListItemText.js +35 -0
  18. package/dist/MainHeader.js +56 -0
  19. package/dist/SearchTextField.js +22 -0
  20. package/dist/Section.js +17 -0
  21. package/dist/Select.js +40 -0
  22. package/dist/Slider.js +31 -0
  23. package/dist/Snackbar.js +44 -0
  24. package/dist/StatusChip.js +19 -0
  25. package/dist/Switch.js +32 -0
  26. package/dist/TextField.js +23 -0
  27. package/dist/error/Error.js +63 -0
  28. package/dist/error/HttpError.js +33 -0
  29. package/dist/index.js +29 -0
  30. package/dist/samples/global.sample.css +48 -0
  31. package/dist/samples/menu.sample.json +303 -0
  32. package/dist/sidebar/MenuToggler.js +18 -0
  33. package/dist/sidebar/MenuTree.js +95 -0
  34. package/dist/sidebar/MenuTreeGroup.js +65 -0
  35. package/dist/sidebar/PrimaryMenu.js +47 -0
  36. package/dist/sidebar/SecondaryMenu.js +36 -0
  37. package/dist/sidebar/Sidebar.js +52 -0
  38. package/dist/sidebar/SidebarContext.js +118 -0
  39. package/dist/sidebar/css/primary.module.css +80 -0
  40. package/dist/sidebar/css/sidebar.module.css +50 -0
  41. package/dist/variables.js +6 -0
  42. package/package.json +61 -0
@@ -0,0 +1,56 @@
1
+ import { Button, Stack, Typography } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default function MainHeader({
6
+ title,
7
+ editable = false,
8
+ edit = false,
9
+ onEditClick,
10
+ onConfirmClick,
11
+ onCancelClick,
12
+ editButtonText = '편집',
13
+ confirmButtonText = '저장',
14
+ cancelButtonText = '취소',
15
+ rightSlot
16
+ }) {
17
+ return /*#__PURE__*/_jsx(_Fragment, {
18
+ children: /*#__PURE__*/_jsxs(Stack, {
19
+ direction: "row",
20
+ justifyContent: "space-between",
21
+ sx: {
22
+ mb: 2.5
23
+ },
24
+ children: [/*#__PURE__*/_jsx(Typography, {
25
+ variant: "h5",
26
+ children: title
27
+ }), rightSlot && /*#__PURE__*/_jsx(_Fragment, {
28
+ children: rightSlot
29
+ }), !rightSlot && editable && /*#__PURE__*/_jsxs(Stack, {
30
+ direction: "row",
31
+ spacing: 1,
32
+ justifyContent: "flex-end",
33
+ children: [!edit && /*#__PURE__*/_jsx(_Fragment, {
34
+ children: /*#__PURE__*/_jsx(Button, {
35
+ variant: "contained",
36
+ onClick: onEditClick,
37
+ children: editButtonText
38
+ })
39
+ }), edit && /*#__PURE__*/_jsxs(_Fragment, {
40
+ children: [/*#__PURE__*/_jsx(Button, {
41
+ variant: "contained",
42
+ sx: {
43
+ width: 120
44
+ },
45
+ onClick: onConfirmClick,
46
+ children: confirmButtonText
47
+ }), /*#__PURE__*/_jsx(Button, {
48
+ variant: "outlined",
49
+ onClick: onCancelClick,
50
+ children: cancelButtonText
51
+ })]
52
+ })]
53
+ })]
54
+ })
55
+ });
56
+ }
@@ -0,0 +1,22 @@
1
+ import { InputAdornment } from "@mui/material";
2
+ import SearchIcon from "@mui/icons-material/Search";
3
+ import TextField from "@mui/material/TextField";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export default function SearchTextField({
6
+ ...props
7
+ }) {
8
+ return /*#__PURE__*/_jsx(TextField, {
9
+ variant: "standard",
10
+ placeholder: "\uAC80\uC0C9",
11
+ size: "small",
12
+ InputProps: {
13
+ startAdornment: /*#__PURE__*/_jsx(InputAdornment, {
14
+ position: "start",
15
+ children: /*#__PURE__*/_jsx(SearchIcon, {
16
+ fontSize: "small"
17
+ })
18
+ })
19
+ },
20
+ ...props
21
+ });
22
+ }
@@ -0,0 +1,17 @@
1
+ import { Paper } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function Section({
4
+ children,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx(Paper, {
8
+ variant: "outlined",
9
+ square: false,
10
+ sx: {
11
+ padding: 3,
12
+ marginTop: '20px'
13
+ },
14
+ ...props,
15
+ children: children
16
+ });
17
+ }
package/dist/Select.js ADDED
@@ -0,0 +1,40 @@
1
+ import MuiSelect from "@mui/material/Select";
2
+ import { FormControl, InputLabel } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ export default function Select({
7
+ variant,
8
+ label,
9
+ fontSize,
10
+ fullWidth = false,
11
+ children,
12
+ ...props
13
+ }) {
14
+ return /*#__PURE__*/_jsx(_Fragment, {
15
+ children: /*#__PURE__*/_jsxs(FormControl, {
16
+ variant: variant,
17
+ fullWidth: fullWidth,
18
+ sx: {
19
+ '.MuiSelect-select.MuiInputBase-input': {
20
+ fontSize: fontSize ? fontSize : 15
21
+ }
22
+ },
23
+ children: [/*#__PURE__*/_jsx(InputLabel, {
24
+ children: label
25
+ }), /*#__PURE__*/_jsx(MuiSelect, {
26
+ MenuProps: {
27
+ PaperProps: {
28
+ sx: {
29
+ '& .MuiMenuItem-root': {
30
+ fontSize: fontSize ? fontSize : 15
31
+ }
32
+ }
33
+ }
34
+ },
35
+ ...props,
36
+ children: children
37
+ })]
38
+ })
39
+ });
40
+ }
package/dist/Slider.js ADDED
@@ -0,0 +1,31 @@
1
+ import MuiSlider from "@mui/material/Slider";
2
+ import { useMemo } from "react";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export default function Slider({
6
+ value,
7
+ defaultValue,
8
+ marks,
9
+ ...props
10
+ }) {
11
+ const autoMarks = useMemo(() => {
12
+ let values = value || defaultValue;
13
+ if (values === undefined) return {};
14
+ if (values instanceof Array == false) values = [values];
15
+ return values.map(v => {
16
+ return {
17
+ value: v,
18
+ label: `${v}`
19
+ };
20
+ });
21
+ }, [value, defaultValue]);
22
+ return /*#__PURE__*/_jsx(_Fragment, {
23
+ children: /*#__PURE__*/_jsx(MuiSlider, {
24
+ value: value,
25
+ defaultValue: defaultValue,
26
+ valueLabelDisplay: "off",
27
+ marks: marks ? marks : autoMarks,
28
+ ...props
29
+ })
30
+ });
31
+ }
@@ -0,0 +1,44 @@
1
+ import { Alert, Slide } from "@mui/material";
2
+ import MuiSnackbar from "@mui/material/Snackbar";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export default function Snackbar({
7
+ content,
8
+ severity = 'info',
9
+ maxWidth = '25%',
10
+ autoHideDuration = 3000,
11
+ anchorOrigin = {
12
+ vertical: 'top',
13
+ horizontal: 'right'
14
+ },
15
+ children,
16
+ ...props
17
+ }) {
18
+ const styles = {
19
+ maxWidth: maxWidth,
20
+ boxShadow: '0 0.3rem 0.3rem rgba(0, 0, 0, 0.03)'
21
+ };
22
+ return /*#__PURE__*/_jsxs(_Fragment, {
23
+ children: [!children && /*#__PURE__*/_jsx(MuiSnackbar, {
24
+ autoHideDuration: autoHideDuration,
25
+ anchorOrigin: anchorOrigin,
26
+ TransitionComponent: transition,
27
+ style: styles,
28
+ ...props,
29
+ children: /*#__PURE__*/_jsx(Alert, {
30
+ severity: severity,
31
+ children: content
32
+ })
33
+ }), children && /*#__PURE__*/_jsx(MuiSnackbar, {
34
+ ...props,
35
+ children: children
36
+ })]
37
+ });
38
+ }
39
+ function transition(props) {
40
+ return /*#__PURE__*/_jsx(Slide, {
41
+ ...props,
42
+ direction: "down"
43
+ });
44
+ }
@@ -0,0 +1,19 @@
1
+ import { Chip } from "@mui/material";
2
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
3
+ import ErrorIcon from "@mui/icons-material/Error";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export default function StatusChip({
6
+ label,
7
+ status,
8
+ onClick,
9
+ ...props
10
+ }) {
11
+ return /*#__PURE__*/_jsx(Chip, {
12
+ label: label,
13
+ variant: status === 'normal' ? 'filled' : 'outlined',
14
+ color: status === 'normal' ? 'success' : 'default',
15
+ deleteIcon: status === 'normal' ? /*#__PURE__*/_jsx(CheckCircleIcon, {}) : /*#__PURE__*/_jsx(ErrorIcon, {}),
16
+ onDelete: _ => onClick && onClick(status),
17
+ ...props
18
+ });
19
+ }
package/dist/Switch.js ADDED
@@ -0,0 +1,32 @@
1
+ import { FormControlLabel, Stack } from "@mui/material";
2
+ import MuiSwitch from "@mui/material/Switch";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export default function Switch({
7
+ label,
8
+ ...props
9
+ }) {
10
+ return /*#__PURE__*/_jsxs(_Fragment, {
11
+ children: [label && /*#__PURE__*/_jsx(Stack, {
12
+ direction: "row",
13
+ alignItems: "center",
14
+ sx: {
15
+ '.MuiFormControlLabel-label': {
16
+ color: '#666',
17
+ fontSize: 11
18
+ }
19
+ },
20
+ children: /*#__PURE__*/_jsx(FormControlLabel, {
21
+ control: /*#__PURE__*/_jsx(MuiSwitch, {
22
+ color: "primary",
23
+ ...props
24
+ }),
25
+ label: label,
26
+ labelPlacement: "top"
27
+ })
28
+ }), !label && /*#__PURE__*/_jsx(MuiSwitch, {
29
+ ...props
30
+ })]
31
+ });
32
+ }
@@ -0,0 +1,23 @@
1
+ import MuiTextField from "@mui/material/TextField";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Fragment as _Fragment } from "react/jsx-runtime";
4
+ export default function TextField2({
5
+ width,
6
+ fontSize,
7
+ textAlign,
8
+ ...props
9
+ }) {
10
+ const styles = {
11
+ fontSize: fontSize ? fontSize : 16,
12
+ textAlign: textAlign ? textAlign : 'left',
13
+ width
14
+ };
15
+ return /*#__PURE__*/_jsx(_Fragment, {
16
+ children: /*#__PURE__*/_jsx(MuiTextField, {
17
+ inputProps: {
18
+ style: styles
19
+ },
20
+ ...props
21
+ })
22
+ });
23
+ }
@@ -0,0 +1,63 @@
1
+ import { Box, Button, Paper, Stack, Typography } from "@mui/material";
2
+ import CampaignIcon from '@mui/icons-material/Campaign';
3
+ import { useNavigate } from "react-router-dom";
4
+ import { variables } from "../variables";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ export default function Error({
8
+ title,
9
+ body,
10
+ buttonText = '홈으로 가기',
11
+ buttonHref = '/',
12
+ footer
13
+ }) {
14
+ const navigate = useNavigate();
15
+ return /*#__PURE__*/_jsxs(Stack, {
16
+ height: "100%",
17
+ justifyContent: "center",
18
+ alignItems: "center",
19
+ sx: {
20
+ backgroundColor: variables.bodyBackgroundColor
21
+ },
22
+ children: [/*#__PURE__*/_jsxs(Paper, {
23
+ variant: "outlined",
24
+ square: false,
25
+ sx: {
26
+ padding: 3,
27
+ width: 568,
28
+ height: 280
29
+ },
30
+ children: [/*#__PURE__*/_jsx(Box, {
31
+ align: "center",
32
+ children: /*#__PURE__*/_jsx(CampaignIcon, {
33
+ sx: {
34
+ color: '#777',
35
+ '&': {
36
+ fontSize: 50
37
+ }
38
+ }
39
+ })
40
+ }), /*#__PURE__*/_jsx(Typography, {
41
+ variant: "h1",
42
+ fontSize: 30,
43
+ sx: {
44
+ mt: 3,
45
+ mb: 3
46
+ },
47
+ children: title
48
+ }), /*#__PURE__*/_jsx(Typography, {
49
+ variant: "body2",
50
+ fontSize: 15,
51
+ children: body
52
+ }), /*#__PURE__*/_jsx(Box, {
53
+ align: "center",
54
+ mt: 6,
55
+ children: /*#__PURE__*/_jsx(Button, {
56
+ size: "large",
57
+ onClick: _ => navigate(buttonHref),
58
+ children: buttonText
59
+ })
60
+ })]
61
+ }), footer]
62
+ });
63
+ }
@@ -0,0 +1,33 @@
1
+ import Error from "./Error";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function HttpError({
4
+ code,
5
+ footer,
6
+ ...props
7
+ }) {
8
+ let title, body;
9
+ switch (code) {
10
+ case '401':
11
+ title = '요청을 완료할 수 없습니다.';
12
+ body = '유효한 계정 정보가 존재하지 않아 요청을 완료할 수 없습니다. 로그아웃 되었는지 확인후 다시 로그인 해주시기 바랍니다.';
13
+ break;
14
+ case '403':
15
+ title = '요청을 완료할 수 없습니다.';
16
+ body = '유효한 계정 정보가 존재하지 않거나 권한이 없어 요청을 완료할 수 없습니다. 로그아웃 되었는지 확인후 다시 로그인 하거나 필요한 권한을 시스템 관리자에게 요청하시기 바랍니다.';
17
+ break;
18
+ case '404':
19
+ title = '요청한 페이지를 찾을 수 없습니다.';
20
+ body = '방문하려는 페이지의 주소가 잘못 입력되었거나 페이지의 주소가 변경 또는 삭제되어 요청하신 페이지를 찾을 수 없습니다. 입력하신 주소가 정확한지 다시 한번 확인해 주시기 바랍니다.';
21
+ break;
22
+ default:
23
+ title = '요청을 처리할 수 없습니다.';
24
+ body = '시스템에 문제가 있어 요청을 처리할 수 없습니다. 잠시후 다시 시도해보시기 바랍니다.';
25
+ break;
26
+ }
27
+ return /*#__PURE__*/_jsx(Error, {
28
+ title: title,
29
+ body: body,
30
+ footer: footer,
31
+ ...props
32
+ });
33
+ }
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ export { default as Accordion } from "./Accordion";
2
+ export { default as AccordionDetails } from "./AccordionDetails";
3
+ export { default as AccordionSummary } from "./AccordionSummary";
4
+ export { default as AlertDialog } from "./AlertDialog";
5
+ export { default as AppBar } from "./AppBar";
6
+ export { default as Checkbox } from "./Checkbox";
7
+ export { default as ConfirmDialog } from "./ConfirmDialog";
8
+ export { default as DataGrid } from "./DataGrid";
9
+ export { default as Dialog } from "./Dialog";
10
+ export { default as FormLabel } from "./FormLabel";
11
+ export { default as Frame } from "./Frame";
12
+ export { default as GroupSelect } from "./GroupSelect";
13
+ export { default as ListItem } from "./ListItem";
14
+ export { default as ListItemDivider } from "./ListItemDivider";
15
+ export { default as ListItemGrid } from "./ListItemGrid";
16
+ export { default as ListItemText } from "./ListItemText";
17
+ export { default as MainHeader } from "./MainHeader";
18
+ export { default as SearchTextField } from "./SearchTextField";
19
+ export { default as Section } from "./Section";
20
+ export { default as Select } from "./Select";
21
+ export { default as Slider } from "./Slider";
22
+ export { default as Snackbar } from "./Snackbar";
23
+ export { default as StatusChip } from "./StatusChip";
24
+ export { default as Switch } from "./Switch";
25
+ export { default as TextField } from "./TextField";
26
+ export { default as Sidebar } from "./sidebar/Sidebar";
27
+ export * from './sidebar/SidebarContext';
28
+ export { default as Error } from "./error/Error";
29
+ export { default as HttpError } from "./error/HttpError";
@@ -0,0 +1,48 @@
1
+ /* variable */
2
+ :root {
3
+ --body-background-color: #f8f9fa;
4
+ --gnb-height: 64px;
5
+ --primary-menu-width: 56px;
6
+ --secondary-menu-width: 256px;
7
+ }
8
+
9
+
10
+ /* global */
11
+ html, body {
12
+ margin: 0;
13
+ height: 100%;
14
+ }
15
+
16
+ #root {
17
+ display: flex;
18
+ flex-direction: column;
19
+ height: 100%;
20
+ }
21
+
22
+
23
+ /* margin */
24
+ .ml-auto {
25
+ margin-left: auto;
26
+ }
27
+ .mr-auto {
28
+ margin-right: auto;
29
+ }
30
+ .mt-auto {
31
+ margin-top: auto;
32
+ }
33
+ .mt-bottom {
34
+ margin-bottom: auto;
35
+ }
36
+
37
+
38
+ /* Highchart */
39
+ .highcharts-tooltip-box {
40
+ fill-opacity: 0;
41
+ }
42
+
43
+ .highcharts-tooltip > span {
44
+ background: #fff;
45
+ border: 1px solid #ccc;
46
+ border-radius: 3px;
47
+ padding: 8px;
48
+ }