@nethru/ui 1.0.82 → 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.
Files changed (140) hide show
  1. package/base/AddableFormList.js +56 -0
  2. package/base/Alert.js +27 -0
  3. package/base/Checkbox.js +20 -0
  4. package/base/CircularProgressButton.js +36 -0
  5. package/base/ColumnedSection.js +44 -0
  6. package/base/DropdownButton.js +74 -0
  7. package/base/MainHeader.js +56 -0
  8. package/base/MenuItem.js +92 -0
  9. package/base/PropertyTable.js +69 -0
  10. package/base/SearchTextField.js +44 -0
  11. package/base/SearchableSelect.js +64 -0
  12. package/base/Select.js +33 -0
  13. package/{dist → base}/Slider.js +12 -13
  14. package/base/Snackbar.js +33 -0
  15. package/base/Switch.js +20 -0
  16. package/base/assets/icons.js +390 -0
  17. package/base/assets/images.js +1 -0
  18. package/{dist → base}/colors/blue.js +3 -1
  19. package/{dist → base}/colors/blueGrey.js +1 -1
  20. package/base/datagrid/DataGrid.js +57 -0
  21. package/base/datagrid/Footer.js +51 -0
  22. package/base/datagrid/Pagination.js +24 -0
  23. package/base/dialog/AlertDialog.js +21 -0
  24. package/base/dialog/ConfirmDialog.js +29 -0
  25. package/base/dialog/Dialog.js +56 -0
  26. package/base/dialog/SimpleDialog.js +33 -0
  27. package/{dist → base}/error/Error.js +1 -2
  28. package/base/frame/AppBar.js +54 -0
  29. package/base/frame/Brand.js +36 -0
  30. package/base/frame/Frame.js +49 -0
  31. package/{dist → base/frame}/sidebar/MenuToggler.js +14 -3
  32. package/{dist → base/frame}/sidebar/PrimaryMenu.js +15 -20
  33. package/base/frame/sidebar/SecondaryMenu.js +41 -0
  34. package/{dist → base/frame}/sidebar/Sidebar.js +21 -10
  35. package/base/frame/sidebar/SidebarContext.js +74 -0
  36. package/base/frame/sidebar/css/primary.module.css +69 -0
  37. package/base/frame/sidebar/css/sidebar.module.css +63 -0
  38. package/base/index.js +33 -0
  39. package/{dist → base}/samples/menu.sample.json +2 -2
  40. package/base/styles/borderRadius.js +7 -0
  41. package/base/styles/createTheme.js +90 -0
  42. package/base/styles/globalStyles.js +47 -0
  43. package/base/styles/mui/alert.js +40 -0
  44. package/base/styles/mui/appBar.js +17 -0
  45. package/base/styles/mui/autocomplete.js +46 -0
  46. package/base/styles/mui/avatar.js +14 -0
  47. package/base/styles/mui/button.js +276 -0
  48. package/base/styles/mui/buttonBase.js +10 -0
  49. package/base/styles/mui/checkbox.js +37 -0
  50. package/base/styles/mui/chip.js +83 -0
  51. package/base/styles/mui/cssBaseline.js +12 -0
  52. package/base/styles/mui/dataGrid.js +101 -0
  53. package/base/styles/mui/dialog.js +13 -0
  54. package/base/styles/mui/dialogActions.js +8 -0
  55. package/base/styles/mui/dialogContent.js +10 -0
  56. package/base/styles/mui/dialogTitle.js +11 -0
  57. package/base/styles/mui/formControl.js +8 -0
  58. package/base/styles/mui/formControlLabel.js +9 -0
  59. package/base/styles/mui/formHelperText.js +10 -0
  60. package/base/styles/mui/grid.js +15 -0
  61. package/base/styles/mui/icon.js +12 -0
  62. package/base/styles/mui/iconButton.js +79 -0
  63. package/base/styles/mui/inputLabel.js +13 -0
  64. package/base/styles/mui/list.js +11 -0
  65. package/base/styles/mui/menuItem.js +83 -0
  66. package/base/styles/mui/outlinedInput.js +53 -0
  67. package/base/styles/mui/paginationItem.js +25 -0
  68. package/base/styles/mui/paper.js +8 -0
  69. package/base/styles/mui/popover.js +11 -0
  70. package/base/styles/mui/select.js +11 -0
  71. package/base/styles/mui/slider.js +15 -0
  72. package/base/styles/mui/snackbar.js +24 -0
  73. package/base/styles/mui/switch.js +33 -0
  74. package/base/styles/mui/tab.js +23 -0
  75. package/base/styles/mui/tablePagination.js +8 -0
  76. package/base/styles/mui/tabs.js +20 -0
  77. package/base/styles/mui/textField.js +11 -0
  78. package/base/styles/mui/toggleButton.js +96 -0
  79. package/base/styles/mui/tooltip.js +22 -0
  80. package/base/styles/palette.js +40 -0
  81. package/base/styles/shadow.js +8 -0
  82. package/base/styles/typography.js +131 -0
  83. package/package.json +6 -5
  84. package/dist/Accordion.js +0 -45
  85. package/dist/AccordionDetails.js +0 -19
  86. package/dist/AccordionSummary.js +0 -35
  87. package/dist/AlertDialog.js +0 -55
  88. package/dist/AppBar.js +0 -68
  89. package/dist/AppendableFormList.js +0 -56
  90. package/dist/AvatarDropdown.js +0 -80
  91. package/dist/Button.js +0 -61
  92. package/dist/Checkbox.js +0 -27
  93. package/dist/CircularProgress.js +0 -33
  94. package/dist/ColumnedSection.js +0 -64
  95. package/dist/ConfirmDialog.js +0 -65
  96. package/dist/DataGrid.js +0 -150
  97. package/dist/Dialog.js +0 -42
  98. package/dist/DropdownButton.js +0 -59
  99. package/dist/FormLabel.js +0 -23
  100. package/dist/Frame.js +0 -47
  101. package/dist/GroupSelect.js +0 -67
  102. package/dist/ListItem.js +0 -21
  103. package/dist/ListItemDivider.js +0 -15
  104. package/dist/ListItemGrid.js +0 -12
  105. package/dist/ListItemText.js +0 -44
  106. package/dist/MainHeader.js +0 -59
  107. package/dist/PropertyTable.js +0 -141
  108. package/dist/ReferenceChipList.js +0 -59
  109. package/dist/SearchTextField.js +0 -24
  110. package/dist/SearchableSelect.js +0 -41
  111. package/dist/Section.js +0 -22
  112. package/dist/Select.js +0 -48
  113. package/dist/ShadowedSection.js +0 -36
  114. package/dist/Snackbar.js +0 -51
  115. package/dist/StatusChip.js +0 -34
  116. package/dist/Switch.js +0 -37
  117. package/dist/TabbedSection.js +0 -37
  118. package/dist/Tabs.js +0 -38
  119. package/dist/TextField.js +0 -25
  120. package/dist/index.js +0 -44
  121. package/dist/samples/global.sample.css +0 -59
  122. package/dist/sidebar/MenuTree.js +0 -95
  123. package/dist/sidebar/MenuTreeGroup.js +0 -65
  124. package/dist/sidebar/SecondaryMenu.js +0 -36
  125. package/dist/sidebar/SidebarContext.js +0 -122
  126. package/dist/sidebar/css/primary.module.css +0 -80
  127. package/dist/sidebar/css/sidebar.module.css +0 -50
  128. package/dist/variables.js +0 -6
  129. /package/{dist → base}/colors/green.js +0 -0
  130. /package/{dist → base}/colors/grey.js +0 -0
  131. /package/{dist → base}/colors/index.js +0 -0
  132. /package/{dist → base}/colors/lime.js +0 -0
  133. /package/{dist → base}/colors/orange.js +0 -0
  134. /package/{dist → base}/colors/purple.js +0 -0
  135. /package/{dist → base}/colors/red.js +0 -0
  136. /package/{dist → base}/colors/yellow.js +0 -0
  137. /package/{dist → base}/editor/Editor.js +0 -0
  138. /package/{dist → base}/editor/nScript.js +0 -0
  139. /package/{dist → base}/editor/nScriptKeywords.js +0 -0
  140. /package/{dist → base}/error/HttpError.js +0 -0
@@ -0,0 +1,56 @@
1
+ import React, { forwardRef } from "react";
2
+ import { IconButton, Stack, Tooltip, Typography } from "@mui/material";
3
+ import AddIcon from "@mui/icons-material/Add";
4
+ import RemoveIcon from '@mui/icons-material/Remove';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
8
+ const AddableFormList = /*#__PURE__*/forwardRef(({
9
+ forms = [],
10
+ renderForm,
11
+ onAdd,
12
+ onRemove,
13
+ readOnly,
14
+ gap = 2,
15
+ margins = [5, 5],
16
+ ...props
17
+ }, ref) => {
18
+ return /*#__PURE__*/_jsx(Stack, {
19
+ ref: ref,
20
+ gap: gap,
21
+ ...props,
22
+ children: /*#__PURE__*/_jsxs(_Fragment, {
23
+ children: [forms.map((form, index) => /*#__PURE__*/_jsxs(Stack, {
24
+ direction: "row",
25
+ alignItems: "start",
26
+ gap: gap,
27
+ children: [renderForm(form, index), !readOnly && /*#__PURE__*/_jsxs(Stack, {
28
+ direction: "row",
29
+ alignItems: "start",
30
+ gap: 1,
31
+ marginTop: `${margins[index > 0 ? 1 : 0]}px`,
32
+ children: [/*#__PURE__*/_jsx(Tooltip, {
33
+ title: "\uC0AD\uC81C",
34
+ children: /*#__PURE__*/_jsx(IconButton, {
35
+ color: "crud",
36
+ onClick: _ => onRemove(index),
37
+ disabled: forms.length === 1,
38
+ children: /*#__PURE__*/_jsx(RemoveIcon, {})
39
+ })
40
+ }), /*#__PURE__*/_jsx(Tooltip, {
41
+ title: "\uCD94\uAC00",
42
+ children: /*#__PURE__*/_jsx(IconButton, {
43
+ color: "crud",
44
+ onClick: _ => onAdd(index),
45
+ children: /*#__PURE__*/_jsx(AddIcon, {})
46
+ })
47
+ })]
48
+ })]
49
+ }, form.id)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
50
+ variant: "bodySmRegular",
51
+ children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
52
+ })]
53
+ })
54
+ });
55
+ });
56
+ export default AddableFormList;
package/base/Alert.js ADDED
@@ -0,0 +1,27 @@
1
+ import { forwardRef } from "react";
2
+ import { Box } from "@mui/material";
3
+ import MuiAlert from "@mui/material/Alert";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const Alert = /*#__PURE__*/forwardRef(({
7
+ subcontent,
8
+ children,
9
+ ...props
10
+ }, ref) => {
11
+ return /*#__PURE__*/_jsxs(MuiAlert, {
12
+ ref: ref,
13
+ ...props,
14
+ children: [/*#__PURE__*/_jsx(Box, {
15
+ whiteSpace: "pre",
16
+ children: unescape(children)
17
+ }), subcontent && /*#__PURE__*/_jsx(Box, {
18
+ className: "MuiAlert-subcontent",
19
+ whiteSpace: "pre",
20
+ children: unescape(subcontent)
21
+ })]
22
+ });
23
+ });
24
+ function unescape(content) {
25
+ return typeof content === 'string' ? content.replace(/(\\n)/g, '\n') : content;
26
+ }
27
+ export default Alert;
@@ -0,0 +1,20 @@
1
+ import { FormControlLabel } from "@mui/material";
2
+ import MuiCheckbox from "@mui/material/Checkbox";
3
+ import { forwardRef } from "react";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const Checkbox = /*#__PURE__*/forwardRef(({
6
+ label,
7
+ formControlLabelProps,
8
+ ...props
9
+ }, ref) => {
10
+ return /*#__PURE__*/_jsx(FormControlLabel, {
11
+ ref: ref,
12
+ label: label,
13
+ control: /*#__PURE__*/_jsx(MuiCheckbox, {
14
+ ...props,
15
+ color: "info"
16
+ }),
17
+ ...formControlLabelProps
18
+ });
19
+ });
20
+ export default Checkbox;
@@ -0,0 +1,36 @@
1
+ import { forwardRef } from "react";
2
+ import { Box, Button, CircularProgress } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const CircularProgressButton = /*#__PURE__*/forwardRef(({
6
+ loading = false,
7
+ children,
8
+ progressProps = {},
9
+ ...props
10
+ }, ref) => {
11
+ return /*#__PURE__*/_jsxs(Box, {
12
+ ref: ref,
13
+ sx: {
14
+ position: 'relative',
15
+ width: 'fit-content'
16
+ },
17
+ children: [/*#__PURE__*/_jsx(Button, {
18
+ disabled: loading || props.disabled,
19
+ ...props,
20
+ children: children
21
+ }), loading && /*#__PURE__*/_jsx(CircularProgress, {
22
+ color: props.color,
23
+ size: props.size === 'small' ? 16 : 24,
24
+ thickness: 6,
25
+ sx: {
26
+ position: 'absolute',
27
+ top: '50%',
28
+ left: '50%',
29
+ marginTop: `${props.size === 'small' ? -8 : -12}px`,
30
+ marginLeft: '-12px'
31
+ },
32
+ ...progressProps
33
+ })]
34
+ });
35
+ });
36
+ export default CircularProgressButton;
@@ -0,0 +1,44 @@
1
+ import { forwardRef, useMemo } from "react";
2
+ import { Box, Grid } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const ColumnedSection = /*#__PURE__*/forwardRef(({
6
+ columns,
7
+ labels = [],
8
+ contents = [],
9
+ spacing = 5,
10
+ breakpoints,
11
+ ...props
12
+ }, ref) => {
13
+ const arrangedBreakpoints = useMemo(() => {
14
+ if (breakpoints) return breakpoints;
15
+ const point = Math.floor(12 / columns);
16
+ if (columns <= 3) {
17
+ return {
18
+ xs: 12,
19
+ sm: point
20
+ };
21
+ }
22
+ return {
23
+ xs: 12,
24
+ sm: point * 2,
25
+ md: point
26
+ };
27
+ }, [columns, breakpoints]);
28
+ return /*#__PURE__*/_jsx(Grid, {
29
+ ref: ref,
30
+ container: true,
31
+ spacing: spacing,
32
+ alignItems: "stretch",
33
+ ...props,
34
+ children: contents.map((content, index) => /*#__PURE__*/_jsxs(Grid, {
35
+ item: true,
36
+ ...arrangedBreakpoints,
37
+ children: [labels[index], /*#__PURE__*/_jsx(Box, {
38
+ className: "MuiGrid-box",
39
+ children: content
40
+ })]
41
+ }, index))
42
+ });
43
+ });
44
+ export default ColumnedSection;
@@ -0,0 +1,74 @@
1
+ import { forwardRef, useCallback, useState } from "react";
2
+ import { Box, Button, IconButton, Menu, Popover, ToggleButton, ToggleButtonGroup } from "@mui/material";
3
+ import { v4 } from 'uuid';
4
+ import MenuItem from "./MenuItem";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ const DropdownButton = /*#__PURE__*/forwardRef(({
8
+ component = 'button',
9
+ onClick,
10
+ onSelect,
11
+ options = [],
12
+ popover,
13
+ children,
14
+ ...props
15
+ }, ref) => {
16
+ const [anchor, setAnchor] = useState(null);
17
+ const [toggle, setToggle] = useState(null);
18
+ const handleClick = useCallback(event => {
19
+ setAnchor(event.currentTarget);
20
+ if (onClick) onClick(event);
21
+ }, [onClick]);
22
+ const handleChange = useCallback((event, value) => {
23
+ setToggle(value);
24
+ handleClick(event);
25
+ }, [handleClick]);
26
+ const handleClose = useCallback(id => {
27
+ setToggle(null);
28
+ setAnchor(null);
29
+ }, []);
30
+ const handleSelect = useCallback(id => {
31
+ handleClose();
32
+ if (onSelect) onSelect(id);
33
+ }, [onSelect, handleClose]);
34
+ return /*#__PURE__*/_jsxs(Box, {
35
+ ref: ref,
36
+ children: [component === 'button' && /*#__PURE__*/_jsx(Button, {
37
+ onClick: handleClick,
38
+ ...props,
39
+ children: children
40
+ }), component === 'iconbutton' && /*#__PURE__*/_jsx(IconButton, {
41
+ onClick: handleClick,
42
+ ...props,
43
+ children: children
44
+ }), component === 'togglebutton' && /*#__PURE__*/_jsx(ToggleButtonGroup, {
45
+ exclusive: true,
46
+ value: toggle,
47
+ onChange: handleChange,
48
+ children: /*#__PURE__*/_jsx(ToggleButton, {
49
+ value: "on",
50
+ ...props,
51
+ children: children
52
+ })
53
+ }), options.length > 0 && /*#__PURE__*/_jsx(Menu, {
54
+ anchorEl: anchor,
55
+ open: Boolean(anchor),
56
+ onClose: handleClose,
57
+ children: options.map(option => /*#__PURE__*/_jsx(MenuItem, {
58
+ variant: option.variant,
59
+ onClick: _ => handleSelect(option.id),
60
+ children: option.content
61
+ }, option.id ?? v4()))
62
+ }), options.length === 0 && /*#__PURE__*/_jsx(Popover, {
63
+ anchorEl: anchor,
64
+ open: Boolean(anchor),
65
+ onClose: handleClose,
66
+ anchorOrigin: {
67
+ vertical: 'bottom',
68
+ horizontal: 'right'
69
+ },
70
+ children: popover
71
+ })]
72
+ });
73
+ });
74
+ export default DropdownButton;
@@ -0,0 +1,56 @@
1
+ import { Button, Stack, Typography } from "@mui/material";
2
+ import { forwardRef } from "react";
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
+ const MainHeader = /*#__PURE__*/forwardRef(({
7
+ title,
8
+ editable = false,
9
+ edit = false,
10
+ onEditClick,
11
+ onConfirmClick,
12
+ onCancelClick,
13
+ editButtonText = '편집',
14
+ confirmButtonText = '저장',
15
+ cancelButtonText = '취소',
16
+ confirmButtonDisabled = false,
17
+ rightSlot,
18
+ ...props
19
+ }, ref) => {
20
+ return /*#__PURE__*/_jsxs(Stack, {
21
+ ref: ref,
22
+ direction: "row",
23
+ justifyContent: "space-between",
24
+ sx: {
25
+ mb: 2.5
26
+ },
27
+ ...props,
28
+ children: [/*#__PURE__*/_jsx(Typography, {
29
+ variant: "headline1",
30
+ children: title
31
+ }), rightSlot && /*#__PURE__*/_jsx(_Fragment, {
32
+ children: rightSlot
33
+ }), !rightSlot && editable && /*#__PURE__*/_jsxs(Stack, {
34
+ direction: "row",
35
+ spacing: 1,
36
+ justifyContent: "flex-end",
37
+ children: [!edit && /*#__PURE__*/_jsx(Button, {
38
+ variant: "contained",
39
+ onClick: onEditClick,
40
+ children: editButtonText
41
+ }), edit && /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsx(Button, {
43
+ variant: "outlined",
44
+ onClick: onCancelClick,
45
+ children: cancelButtonText
46
+ }), /*#__PURE__*/_jsx(Button, {
47
+ type: "submit",
48
+ onClick: onConfirmClick,
49
+ disabled: confirmButtonDisabled,
50
+ children: confirmButtonText
51
+ })]
52
+ })]
53
+ })]
54
+ });
55
+ });
56
+ export default MainHeader;
@@ -0,0 +1,92 @@
1
+ import React, { forwardRef, useMemo } from "react";
2
+ import MuiMenuItem from "@mui/material/MenuItem";
3
+ import { Box, Divider, ListItemIcon, ListItemText } from "@mui/material";
4
+ import { DataStoryIcon, NethruBulletIcon, NethruIcon, SmartCepIcon, SmartExpIcon, SmartOfferIcon, UserFlowIcon, WiseCollectorIcon } from "./assets/icons";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
8
+ const MenuItem = /*#__PURE__*/forwardRef(({
9
+ variant,
10
+ children,
11
+ ...props
12
+ }, ref) => {
13
+ const isIndicator = useMemo(() => {
14
+ return variant === 'placeholder' || variant === 'menusection' || variant === 'spacer';
15
+ }, [variant]);
16
+ return /*#__PURE__*/_jsx(_Fragment, {
17
+ children: variant === 'divider' ? /*#__PURE__*/_jsx(Divider, {
18
+ ...props
19
+ }) : /*#__PURE__*/_jsxs(MuiMenuItem, {
20
+ variant: variant,
21
+ value: isIndicator ? '' : undefined,
22
+ disabled: isIndicator,
23
+ ...props,
24
+ children: [variant === 'menusection' && /*#__PURE__*/_jsx(NethruBulletIcon, {
25
+ sx: {
26
+ fontSize: 12,
27
+ mr: 0.5
28
+ }
29
+ }), children]
30
+ })
31
+ });
32
+ });
33
+ export default MenuItem;
34
+ function AppMenuItem({
35
+ icon,
36
+ children
37
+ }) {
38
+ return /*#__PURE__*/_jsxs(_Fragment, {
39
+ children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
40
+ children: /*#__PURE__*/_jsx(Box, {
41
+ component: icon,
42
+ sx: {
43
+ fontSize: 23
44
+ }
45
+ })
46
+ }), /*#__PURE__*/_jsx(ListItemText, {
47
+ children: children
48
+ })]
49
+ });
50
+ }
51
+ export function NethruMenuItem() {
52
+ return /*#__PURE__*/_jsx(AppMenuItem, {
53
+ icon: NethruIcon,
54
+ children: "Nethru"
55
+ });
56
+ }
57
+ export function WiseCollectorMenuItem() {
58
+ return /*#__PURE__*/_jsx(AppMenuItem, {
59
+ icon: WiseCollectorIcon,
60
+ children: "WiseCollector"
61
+ });
62
+ }
63
+ export function DataStoryMenuItem() {
64
+ return /*#__PURE__*/_jsx(AppMenuItem, {
65
+ icon: DataStoryIcon,
66
+ children: "DataStory"
67
+ });
68
+ }
69
+ export function UserFlowMenuItem() {
70
+ return /*#__PURE__*/_jsx(AppMenuItem, {
71
+ icon: UserFlowIcon,
72
+ children: "UserFlow"
73
+ });
74
+ }
75
+ export function SmartCepMenuItem() {
76
+ return /*#__PURE__*/_jsx(AppMenuItem, {
77
+ icon: SmartCepIcon,
78
+ children: "SmartCep"
79
+ });
80
+ }
81
+ export function SmartOfferMenuItem() {
82
+ return /*#__PURE__*/_jsx(AppMenuItem, {
83
+ icon: SmartOfferIcon,
84
+ children: "SmartOffer"
85
+ });
86
+ }
87
+ export function SmartExpMenuItem() {
88
+ return /*#__PURE__*/_jsx(AppMenuItem, {
89
+ icon: SmartExpIcon,
90
+ children: "SmartExp"
91
+ });
92
+ }
@@ -0,0 +1,69 @@
1
+ import { forwardRef, useCallback, useMemo, useState } from "react";
2
+ import { Box, FormHelperText } from "@mui/material";
3
+ import { DataGridPro, koKR } from "@mui/x-data-grid-pro";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const PropertyTable = /*#__PURE__*/forwardRef(({
7
+ columns,
8
+ onUpdate,
9
+ readOnly,
10
+ error = false,
11
+ helperText,
12
+ outerSx,
13
+ ...props
14
+ }, ref) => {
15
+ const getRowHeight = useCallback(() => 'auto', []);
16
+ const arrangedColumns = useMemo(() => {
17
+ return columns.map(column => {
18
+ const newColumn = {
19
+ ...column
20
+ };
21
+ if (readOnly) newColumn.editable = false;
22
+ if (column.greyed) newColumn.cellClassName = 'MuiTypography-greyed';else if (column.bold) {
23
+ newColumn.cellClassName = params => {
24
+ return !params.row.deletable ? 'MuiTypography-bold' : '';
25
+ };
26
+ }
27
+ return newColumn;
28
+ });
29
+ }, [columns, readOnly]);
30
+ const [updatedRows, setUpdatedRows] = useState(props.rows);
31
+ const processRowUpdate = row => {
32
+ const newRows = updatedRows.filter(r => r.id !== row.id);
33
+ newRows.push(row);
34
+ setUpdatedRows(newRows);
35
+ if (onUpdate) onUpdate(row, newRows);
36
+ return row;
37
+ };
38
+ return /*#__PURE__*/_jsxs(Box, {
39
+ ref: ref,
40
+ sx: outerSx,
41
+ children: [/*#__PURE__*/_jsx(DataGridPro, {
42
+ columns: arrangedColumns,
43
+ rows: props.rows,
44
+ autoHeight: true,
45
+ getRowHeight: getRowHeight,
46
+ disableColumnMenu: true,
47
+ disableColumnReorder: true,
48
+ disableRowSelectionOnClick: readOnly,
49
+ hideFooter: true,
50
+ editable: !readOnly,
51
+ isCellEditable: params => {
52
+ return !readOnly && (params.row.deletable || !params.colDef.bold);
53
+ },
54
+ processRowUpdate: processRowUpdate,
55
+ onProcessRowUpdateError: error => console.log(error),
56
+ error: error,
57
+ localeText: {
58
+ ...koKR.components.MuiDataGrid.defaultProps.localeText,
59
+ noRowsLabel: '항목이 없습니다.',
60
+ ...props.localText
61
+ },
62
+ ...props
63
+ }), helperText && /*#__PURE__*/_jsx(FormHelperText, {
64
+ error: error,
65
+ children: helperText
66
+ })]
67
+ });
68
+ });
69
+ export default PropertyTable;
@@ -0,0 +1,44 @@
1
+ import { forwardRef, useMemo } from "react";
2
+ import TextField from "@mui/material/TextField";
3
+ import { IconButton, InputAdornment } from "@mui/material";
4
+ import SearchIcon from "@mui/icons-material/Search";
5
+ import ClearIcon from '@mui/icons-material/Clear';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const SearchTextField = /*#__PURE__*/forwardRef(({
8
+ value,
9
+ onClear,
10
+ ...props
11
+ }, ref) => {
12
+ const styles = useMemo(() => ({
13
+ visibility: value ? "visible" : "hidden",
14
+ '&:hover': {
15
+ backgroundColor: 'transparent'
16
+ }
17
+ }), [value]);
18
+ return /*#__PURE__*/_jsx(TextField, {
19
+ ref: ref,
20
+ value: value,
21
+ placeholder: "\uAC80\uC0C9...",
22
+ InputProps: {
23
+ startAdornment: /*#__PURE__*/_jsx(InputAdornment, {
24
+ position: "start",
25
+ children: /*#__PURE__*/_jsx(SearchIcon, {
26
+ fontSize: "small"
27
+ })
28
+ }),
29
+ endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
30
+ position: "end",
31
+ children: /*#__PURE__*/_jsx(IconButton, {
32
+ onClick: onClear,
33
+ sx: styles,
34
+ children: /*#__PURE__*/_jsx(ClearIcon, {
35
+ fontSize: "small"
36
+ })
37
+ })
38
+ }),
39
+ ...props.InputProps
40
+ },
41
+ ...props
42
+ });
43
+ });
44
+ export default SearchTextField;
@@ -0,0 +1,64 @@
1
+ import { Autocomplete, FormControl, FormHelperText, InputLabel, TextField } from "@mui/material";
2
+ import { forwardRef, useCallback, useMemo } from "react";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ const SearchableSelect = /*#__PURE__*/forwardRef(({
6
+ id,
7
+ label,
8
+ placeholder,
9
+ helperText,
10
+ value,
11
+ options,
12
+ onSelect,
13
+ idKey = 'id',
14
+ labelKey = 'label',
15
+ groupKey,
16
+ error,
17
+ formControlProps,
18
+ textFieldProps,
19
+ ...props
20
+ }, ref) => {
21
+ const styles = useMemo(() => ({
22
+ mt: label ? '17px' : undefined,
23
+ ...formControlProps?.sx
24
+ }), [label, formControlProps]);
25
+ const isOptionEqualToValue = useCallback((a, b) => a[idKey] === b[idKey], [idKey]);
26
+ const renderInput = useCallback(params => /*#__PURE__*/_jsx(TextField, {
27
+ ...params,
28
+ placeholder: placeholder,
29
+ ...textFieldProps
30
+ }), [placeholder, textFieldProps]);
31
+ const handleSelect = useCallback((event, value, reason) => {
32
+ if (reason !== 'selectOption') return;
33
+ if (onSelect) onSelect(id, value);
34
+ }, [id, onSelect]);
35
+ return /*#__PURE__*/_jsxs(FormControl, {
36
+ ref: ref,
37
+ disabled: props.disabled,
38
+ error: error,
39
+ sx: styles,
40
+ ...formControlProps,
41
+ children: [label && /*#__PURE__*/_jsx(InputLabel, {
42
+ disabled: props.disabled,
43
+ children: label
44
+ }), /*#__PURE__*/_jsx(Autocomplete, {
45
+ id: id,
46
+ options: options,
47
+ getOptionKey: option => option[idKey],
48
+ getOptionLabel: option => option[labelKey],
49
+ groupBy: option => option[groupKey],
50
+ isOptionEqualToValue: isOptionEqualToValue,
51
+ value: value,
52
+ onChange: handleSelect,
53
+ blurOnSelect: true,
54
+ disableClearable: true,
55
+ noOptionsText: "\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
56
+ renderInput: renderInput,
57
+ className: error ? 'Mui-error' : '',
58
+ ...props
59
+ }), helperText && /*#__PURE__*/_jsx(FormHelperText, {
60
+ children: helperText
61
+ })]
62
+ });
63
+ });
64
+ export default SearchableSelect;
package/base/Select.js ADDED
@@ -0,0 +1,33 @@
1
+ import { FormControl, FormHelperText, InputLabel } from "@mui/material";
2
+ import MuiSelect from "@mui/material/Select";
3
+ import { forwardRef, useMemo } from "react";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const Select = /*#__PURE__*/forwardRef(({
7
+ label,
8
+ helperText,
9
+ children,
10
+ formControlProps,
11
+ ...props
12
+ }, ref) => {
13
+ const styles = useMemo(() => ({
14
+ mt: label ? '17px' : undefined,
15
+ ...formControlProps?.sx
16
+ }), [label, formControlProps]);
17
+ return /*#__PURE__*/_jsxs(FormControl, {
18
+ ref: ref,
19
+ disabled: props.disabled,
20
+ error: props.error,
21
+ sx: styles,
22
+ ...formControlProps,
23
+ children: [label && /*#__PURE__*/_jsx(InputLabel, {
24
+ children: label
25
+ }), /*#__PURE__*/_jsx(MuiSelect, {
26
+ ...props,
27
+ children: children
28
+ }), helperText && /*#__PURE__*/_jsx(FormHelperText, {
29
+ children: helperText
30
+ })]
31
+ });
32
+ });
33
+ export default Select;
@@ -1,13 +1,12 @@
1
+ import { forwardRef, useMemo } from "react";
1
2
  import MuiSlider from "@mui/material/Slider";
2
- import { useMemo } from "react";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
- import { Fragment as _Fragment } from "react/jsx-runtime";
5
- export default function Slider({
4
+ const Slider = /*#__PURE__*/forwardRef(({
6
5
  value,
7
6
  defaultValue,
8
7
  marks,
9
8
  ...props
10
- }) {
9
+ }, ref) => {
11
10
  const autoMarks = useMemo(() => {
12
11
  let values = value || defaultValue;
13
12
  if (values === undefined) return {};
@@ -19,13 +18,13 @@ export default function Slider({
19
18
  };
20
19
  });
21
20
  }, [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
- })
21
+ return /*#__PURE__*/_jsx(MuiSlider, {
22
+ ref: ref,
23
+ value: value,
24
+ defaultValue: defaultValue,
25
+ valueLabelDisplay: "off",
26
+ marks: marks ? marks : autoMarks,
27
+ ...props
30
28
  });
31
- }
29
+ });
30
+ export default Slider;