@nethru/ui 1.0.28 → 1.0.30
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/AppendableFormList.js +50 -0
- package/dist/ColumnedSection.js +62 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Button, IconButton, Stack, Tooltip, Typography } from "@mui/material";
|
|
3
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
4
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
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
|
+
export default function AppendableFormList({
|
|
9
|
+
forms,
|
|
10
|
+
onAppend,
|
|
11
|
+
onRemove
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/_jsxs(Stack, {
|
|
14
|
+
gap: 1,
|
|
15
|
+
children: [/*#__PURE__*/_jsxs(_Fragment, {
|
|
16
|
+
children: [forms.map((form, index) => /*#__PURE__*/_jsxs(Stack, {
|
|
17
|
+
direction: "row",
|
|
18
|
+
alignItems: "end",
|
|
19
|
+
gap: 2,
|
|
20
|
+
children: [form, /*#__PURE__*/_jsx(Tooltip, {
|
|
21
|
+
title: "\uC0AD\uC81C",
|
|
22
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
23
|
+
onClick: _ => onRemove(index),
|
|
24
|
+
size: "small",
|
|
25
|
+
sx: {
|
|
26
|
+
ml: '-10px',
|
|
27
|
+
mb: '-5px'
|
|
28
|
+
},
|
|
29
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {
|
|
30
|
+
fontSize: "small"
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
}, index)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
|
|
35
|
+
variant: "body2",
|
|
36
|
+
sx: {
|
|
37
|
+
color: '#999'
|
|
38
|
+
},
|
|
39
|
+
children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
|
|
40
|
+
})]
|
|
41
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
42
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
43
|
+
variant: "text",
|
|
44
|
+
startIcon: /*#__PURE__*/_jsx(AddIcon, {}),
|
|
45
|
+
onClick: onAppend,
|
|
46
|
+
children: "\uCD94\uAC00"
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { List, Stack } from "@mui/material";
|
|
2
|
+
import ListItem from "./ListItem";
|
|
3
|
+
import ListItemGrid from "./ListItemGrid";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default function ColumnedSection({
|
|
8
|
+
columns,
|
|
9
|
+
labels = [],
|
|
10
|
+
contents = [],
|
|
11
|
+
sx
|
|
12
|
+
}) {
|
|
13
|
+
const width = useMemo(() => {
|
|
14
|
+
return `${100 / columns}%`;
|
|
15
|
+
}, [columns]);
|
|
16
|
+
const styles = useMemo(() => {
|
|
17
|
+
return {
|
|
18
|
+
width: width,
|
|
19
|
+
bgcolor: '#f8f9fa',
|
|
20
|
+
p: '10px 20px',
|
|
21
|
+
borderRadius: '7px'
|
|
22
|
+
};
|
|
23
|
+
}, [width]);
|
|
24
|
+
return /*#__PURE__*/_jsx(List, {
|
|
25
|
+
children: /*#__PURE__*/_jsxs(ListItem, {
|
|
26
|
+
grid: true,
|
|
27
|
+
children: [labels.length > 0 && /*#__PURE__*/_jsx(ListItemGrid, {
|
|
28
|
+
xs: 12,
|
|
29
|
+
children: /*#__PURE__*/_jsx(Stack, {
|
|
30
|
+
direction: "row",
|
|
31
|
+
gap: 1,
|
|
32
|
+
children: labels.map((label, index) => /*#__PURE__*/_jsx(Stack, {
|
|
33
|
+
spacing: 1,
|
|
34
|
+
sx: {
|
|
35
|
+
width: width
|
|
36
|
+
},
|
|
37
|
+
children: /*#__PURE__*/_jsx(Stack, {
|
|
38
|
+
direction: "row",
|
|
39
|
+
alignItems: "baseline",
|
|
40
|
+
spacing: 1,
|
|
41
|
+
children: label
|
|
42
|
+
})
|
|
43
|
+
}, index))
|
|
44
|
+
})
|
|
45
|
+
}), /*#__PURE__*/_jsx(ListItemGrid, {
|
|
46
|
+
xs: 12,
|
|
47
|
+
children: /*#__PURE__*/_jsx(Stack, {
|
|
48
|
+
direction: "row",
|
|
49
|
+
gap: 1,
|
|
50
|
+
children: contents.map((content, index) => /*#__PURE__*/_jsx(Stack, {
|
|
51
|
+
spacing: 1,
|
|
52
|
+
sx: {
|
|
53
|
+
...styles,
|
|
54
|
+
...sx
|
|
55
|
+
},
|
|
56
|
+
children: content
|
|
57
|
+
}, index))
|
|
58
|
+
})
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,11 @@ 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 AppendableFormList } from "./AppendableFormList";
|
|
6
7
|
export { default as AvatarDropdown } from "./AvatarDropdown";
|
|
7
8
|
export { default as Checkbox } from "./Checkbox";
|
|
8
9
|
export { default as CircularProgress } from "./CircularProgress";
|
|
10
|
+
export { default as ColumnedSection } from "./ColumnedSection";
|
|
9
11
|
export { default as ConfirmDialog } from "./ConfirmDialog";
|
|
10
12
|
export { default as DataGrid } from "./DataGrid";
|
|
11
13
|
export { default as Dialog } from "./Dialog";
|