@nethru/ui 2.0.0 → 2.0.1

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.
@@ -0,0 +1,45 @@
1
+ import MuiAccordion from "@mui/material/Accordion";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const styles = {
4
+ border: '1px solid #eaeaea',
5
+ boxShadow: 'none',
6
+ '.MuiAccordionDetails-root': {
7
+ pt: 0,
8
+ pl: 8,
9
+ pr: 8
10
+ },
11
+ '.MuiFormLabel-root.MuiInputLabel-root': {
12
+ fontSize: '14px'
13
+ },
14
+ '.MuiInputBase-input.MuiInput-input': {
15
+ color: '#555',
16
+ fontSize: '15px'
17
+ },
18
+ '.MuiTabs-root.MuiTabs-vertical': {
19
+ mt: 2
20
+ },
21
+ '.MuiTabs-root.MuiTabs-vertical .MuiButtonBase-root.MuiTab-root': {
22
+ fontSize: '14px',
23
+ minWidth: '32px',
24
+ maxWidth: '32px'
25
+ },
26
+ '.MuiButtonBase-root.MuiToggleButton-root': {
27
+ pt: '1px',
28
+ pb: '1px',
29
+ fontSize: '12px'
30
+ }
31
+ };
32
+ export default function Accordion({
33
+ children,
34
+ sx,
35
+ ...props
36
+ }) {
37
+ return /*#__PURE__*/_jsx(MuiAccordion, {
38
+ sx: {
39
+ ...sx,
40
+ ...styles
41
+ },
42
+ ...props,
43
+ children: children
44
+ });
45
+ }
@@ -0,0 +1,19 @@
1
+ import MuiAccordionDetails from "@mui/material/AccordionDetails";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const styles = {
4
+ mb: 2
5
+ };
6
+ export default function AccordionDetails({
7
+ children,
8
+ sx,
9
+ ...props
10
+ }) {
11
+ return /*#__PURE__*/_jsx(MuiAccordionDetails, {
12
+ sx: {
13
+ ...sx,
14
+ ...styles
15
+ },
16
+ ...props,
17
+ children: children
18
+ });
19
+ }
@@ -0,0 +1,35 @@
1
+ import { Stack, Typography } from "@mui/material";
2
+ import MuiAccordionSummary from "@mui/material/AccordionSummary";
3
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ export default function AccordionSummary({
8
+ title,
9
+ desc,
10
+ children,
11
+ ...props
12
+ }) {
13
+ return /*#__PURE__*/_jsxs(_Fragment, {
14
+ children: [title && /*#__PURE__*/_jsx(MuiAccordionSummary, {
15
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreIcon, {}),
16
+ ...props,
17
+ children: /*#__PURE__*/_jsxs(Stack, {
18
+ direction: "row",
19
+ alignItems: "flex-end",
20
+ gap: 1,
21
+ children: [/*#__PURE__*/_jsx(Typography, {
22
+ children: title
23
+ }), desc && /*#__PURE__*/_jsx(Typography, {
24
+ variant: "caption",
25
+ color: "#aaa",
26
+ children: desc
27
+ })]
28
+ })
29
+ }), !title && /*#__PURE__*/_jsx(MuiAccordionSummary, {
30
+ expandIcon: /*#__PURE__*/_jsx(ExpandMoreIcon, {}),
31
+ ...props,
32
+ children: children
33
+ })]
34
+ });
35
+ }
@@ -0,0 +1,56 @@
1
+ import React from "react";
2
+ import { 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
+ gap = 1,
10
+ forms,
11
+ renderForm,
12
+ addOns,
13
+ onAppend,
14
+ onRemove,
15
+ readOnly
16
+ }) {
17
+ return /*#__PURE__*/_jsxs(Stack, {
18
+ gap: gap,
19
+ children: [/*#__PURE__*/_jsxs(_Fragment, {
20
+ children: [forms.map((form, index) => /*#__PURE__*/_jsxs(Stack, {
21
+ direction: "row",
22
+ alignItems: "end",
23
+ gap: 2,
24
+ children: [renderForm(form, index), !readOnly && /*#__PURE__*/_jsx(Tooltip, {
25
+ title: "\uC0AD\uC81C",
26
+ children: /*#__PURE__*/_jsx(IconButton, {
27
+ onClick: _ => onRemove(index),
28
+ size: "small",
29
+ sx: {
30
+ ml: '-10px',
31
+ mb: '-5px'
32
+ },
33
+ children: /*#__PURE__*/_jsx(DeleteIcon, {
34
+ fontSize: "small"
35
+ })
36
+ })
37
+ })]
38
+ }, index)), forms.length === 0 && /*#__PURE__*/_jsx(Typography, {
39
+ variant: "body2",
40
+ sx: {
41
+ color: '#999'
42
+ },
43
+ children: "\uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4"
44
+ })]
45
+ }), !readOnly && /*#__PURE__*/_jsxs(Stack, {
46
+ direction: "row",
47
+ gap: 1,
48
+ children: [/*#__PURE__*/_jsx(Button, {
49
+ variant: "text",
50
+ startIcon: /*#__PURE__*/_jsx(AddIcon, {}),
51
+ onClick: onAppend,
52
+ children: "\uCD94\uAC00"
53
+ }), addOns]
54
+ })]
55
+ });
56
+ }
@@ -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
+ }
@@ -0,0 +1,61 @@
1
+ import { useMemo } from "react";
2
+ import MuiButton from "@mui/material/Button";
3
+ import { Box, CircularProgress, IconButton } from "@mui/material";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export default function Button({
7
+ label,
8
+ icon,
9
+ iconPlacement = 'start',
10
+ iconSize = '20px',
11
+ iconProps = {},
12
+ progressProps = {},
13
+ loading = false,
14
+ ...props
15
+ }) {
16
+ const iconComponent = useMemo(() => {
17
+ return icon ? /*#__PURE__*/_jsx(Box, {
18
+ component: icon,
19
+ sx: {
20
+ '&.MuiSvgIcon-root': {
21
+ fontSize: `${iconSize}!important`
22
+ }
23
+ },
24
+ ...iconProps
25
+ }) : null;
26
+ }, [icon, iconSize, iconProps]);
27
+ const startIcon = useMemo(() => {
28
+ return iconPlacement === 'start' ? iconComponent : null;
29
+ }, [iconComponent, iconPlacement]);
30
+ const endIcon = useMemo(() => {
31
+ return iconPlacement === 'end' ? iconComponent : null;
32
+ }, [iconComponent, iconPlacement]);
33
+ return /*#__PURE__*/_jsxs(Box, {
34
+ sx: {
35
+ position: 'relative',
36
+ width: 'fit-content'
37
+ },
38
+ children: [label ? /*#__PURE__*/_jsx(MuiButton, {
39
+ startIcon: startIcon,
40
+ endIcon: endIcon,
41
+ disabled: loading,
42
+ ...props,
43
+ children: label
44
+ }) : /*#__PURE__*/_jsx(IconButton, {
45
+ disabled: loading,
46
+ ...props,
47
+ children: iconComponent
48
+ }), loading && /*#__PURE__*/_jsx(CircularProgress, {
49
+ size: 24,
50
+ thickness: 6,
51
+ sx: {
52
+ position: 'absolute',
53
+ top: '50%',
54
+ left: '50%',
55
+ marginTop: '-12px',
56
+ marginLeft: '-12px'
57
+ },
58
+ ...progressProps
59
+ })]
60
+ });
61
+ }
@@ -0,0 +1,33 @@
1
+ import { Box, Typography } from "@mui/material";
2
+ import MuiCircularProgress from "@mui/material/CircularProgress";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default function CircularProgress(props) {
6
+ return /*#__PURE__*/_jsxs(Box, {
7
+ sx: {
8
+ position: 'relative',
9
+ display: 'inline-flex'
10
+ },
11
+ children: [/*#__PURE__*/_jsx(MuiCircularProgress, {
12
+ variant: "determinate",
13
+ ...props
14
+ }), /*#__PURE__*/_jsx(Box, {
15
+ sx: {
16
+ top: 0,
17
+ left: 0,
18
+ bottom: 0,
19
+ right: 0,
20
+ position: 'absolute',
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ justifyContent: 'center'
24
+ },
25
+ children: /*#__PURE__*/_jsx(Typography, {
26
+ variant: "caption",
27
+ component: "div",
28
+ color: "text.secondary",
29
+ children: `${Math.round(props.value)}%`
30
+ })
31
+ })]
32
+ });
33
+ }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import MuiFormLabel from "@mui/material/FormLabel";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function FormLabel({
5
+ value = false,
6
+ children,
7
+ sx,
8
+ ...props
9
+ }) {
10
+ const styles = {
11
+ color: value ? 'rgba(0, 0, 0, 0.87)' : 'rgba(0, 0, 0, 0.6)',
12
+ fontSize: value ? 16 : 14,
13
+ fontWeight: value ? 600 : 400
14
+ };
15
+ return /*#__PURE__*/_jsx(MuiFormLabel, {
16
+ sx: {
17
+ ...sx,
18
+ ...styles
19
+ },
20
+ ...props,
21
+ children: children
22
+ });
23
+ }
@@ -0,0 +1,67 @@
1
+ import { Autocomplete, TextField } from "@mui/material";
2
+ import Paper from "@mui/material/Paper";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function GroupSelect({
5
+ id,
6
+ options,
7
+ groupKey,
8
+ value,
9
+ onSelect,
10
+ placeholder,
11
+ disableClearable = false,
12
+ sx,
13
+ ...props
14
+ }) {
15
+ const styles = {
16
+ '.MuiInputLabel-root, .MuiInputBase-input': {
17
+ fontSize: '0.875rem'
18
+ }
19
+ };
20
+ const paperStyles = {
21
+ '& .MuiAutocomplete-groupLabel': {
22
+ fontSize: '0.8rem',
23
+ paddingTop: 0,
24
+ paddingBottom: 0
25
+ },
26
+ '& .MuiAutocomplete-option': {
27
+ color: '#333',
28
+ fontSize: '0.875rem',
29
+ paddingTop: '3px',
30
+ paddingBottom: '3px'
31
+ },
32
+ '& .MuiAutocomplete-noOptions': {
33
+ fontSize: '0.8rem'
34
+ }
35
+ };
36
+ const handleSelect = (event, value, reason) => {
37
+ if (reason !== 'selectOption') return;
38
+ if (onSelect) onSelect(id, value);
39
+ };
40
+ function CustomPaper(props) {
41
+ return /*#__PURE__*/_jsx(Paper, {
42
+ ...props,
43
+ sx: paperStyles
44
+ });
45
+ }
46
+ return /*#__PURE__*/_jsx(Autocomplete, {
47
+ id: id,
48
+ size: "small",
49
+ options: options,
50
+ groupBy: option => option[groupKey],
51
+ value: value,
52
+ onChange: handleSelect,
53
+ blurOnSelect: true,
54
+ disableClearable: disableClearable,
55
+ noOptionsText: "\uC77C\uCE58\uD558\uB294 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
56
+ PaperComponent: CustomPaper,
57
+ renderInput: params => /*#__PURE__*/_jsx(TextField, {
58
+ ...params,
59
+ label: placeholder
60
+ }),
61
+ sx: {
62
+ ...sx,
63
+ ...styles
64
+ },
65
+ ...props
66
+ });
67
+ }
@@ -0,0 +1,21 @@
1
+ import MuiListItem from "@mui/material/ListItem";
2
+ import { Grid } from "@mui/material";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export default function ListItem({
6
+ grid,
7
+ spacing = 10,
8
+ verticalAlign = 'flex-start',
9
+ children,
10
+ ...props
11
+ }) {
12
+ return /*#__PURE__*/_jsxs(MuiListItem, {
13
+ ...props,
14
+ children: [grid && /*#__PURE__*/_jsx(Grid, {
15
+ container: true,
16
+ columnSpacing: spacing,
17
+ alignItems: verticalAlign,
18
+ children: children
19
+ }), !grid && children]
20
+ });
21
+ }
@@ -0,0 +1,15 @@
1
+ import { Divider } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function ListItemDivider({
4
+ sx,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx(Divider, {
8
+ sx: {
9
+ ...sx,
10
+ mt: 3,
11
+ mb: 2
12
+ },
13
+ ...props
14
+ });
15
+ }
@@ -0,0 +1,12 @@
1
+ import { Grid } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function ListItemGrid({
4
+ children,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx(Grid, {
8
+ item: true,
9
+ ...props,
10
+ children: children
11
+ });
12
+ }
@@ -0,0 +1,44 @@
1
+ import { useState } from "react";
2
+ import { Box, Stack, Tooltip, Typography } from "@mui/material";
3
+ import MuiListItemText from "@mui/material/ListItemText";
4
+ import HelpIcon from "@mui/icons-material/Help";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ export default function ListItemText({
8
+ primary,
9
+ secondary,
10
+ tooltip,
11
+ ...props
12
+ }) {
13
+ const [hover, setHover] = useState(false);
14
+ return /*#__PURE__*/_jsx(MuiListItemText, {
15
+ primary: typeof primary === 'string' ? /*#__PURE__*/_jsx(Typography, {
16
+ fontSize: 17,
17
+ fontWeight: 600,
18
+ children: primary
19
+ }) : /*#__PURE__*/_jsx(Box, {
20
+ children: primary
21
+ }),
22
+ secondary: /*#__PURE__*/_jsxs(Stack, {
23
+ direction: "row",
24
+ spacing: 0.5,
25
+ children: [/*#__PURE__*/_jsx(Box, {
26
+ color: "rgba(0, 0, 0, 0.6)",
27
+ fontSize: 14,
28
+ children: secondary
29
+ }), /*#__PURE__*/_jsx(Tooltip, {
30
+ title: tooltip,
31
+ children: /*#__PURE__*/_jsx(HelpIcon, {
32
+ sx: {
33
+ fontSize: 18,
34
+ visibility: tooltip && hover ? 'visible' : 'hidden'
35
+ }
36
+ })
37
+ })]
38
+ }),
39
+ disableTypography: true,
40
+ onMouseEnter: _ => setHover(true),
41
+ onMouseLeave: _ => setHover(false),
42
+ ...props
43
+ });
44
+ }
@@ -0,0 +1,59 @@
1
+ import { Chip, Stack, Link } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default function ReferenceChipList({
4
+ references,
5
+ onClick,
6
+ chipStyles,
7
+ chipProps,
8
+ sx,
9
+ ...props
10
+ }) {
11
+ const handleClick = (id, event) => {
12
+ if (onClick) onClick(id, event);
13
+ };
14
+ return /*#__PURE__*/_jsx(Stack, {
15
+ direction: "row",
16
+ gap: 0.5,
17
+ sx: {
18
+ flexWrap: 'wrap',
19
+ ...sx
20
+ },
21
+ ...props,
22
+ children: references.map((reference, index) => {
23
+ return reference.href ? /*#__PURE__*/_jsx(Link, {
24
+ href: reference.href,
25
+ underline: "none",
26
+ onClick: event => handleClick(reference.id, event),
27
+ children: /*#__PURE__*/_jsx(ReferenceChip, {
28
+ name: reference.name,
29
+ sx: chipStyles,
30
+ ...chipProps
31
+ })
32
+ }, index) : /*#__PURE__*/_jsx(ReferenceChip, {
33
+ name: reference.name,
34
+ onClick: event => reference.clickable && handleClick(reference.id, event),
35
+ sx: {
36
+ cursor: reference.clickable ? 'pointer' : 'default',
37
+ ...chipStyles
38
+ },
39
+ ...chipProps
40
+ }, index);
41
+ })
42
+ });
43
+ }
44
+ function ReferenceChip({
45
+ name,
46
+ sx,
47
+ ...props
48
+ }) {
49
+ return /*#__PURE__*/_jsx(Chip, {
50
+ variant: "outlined",
51
+ label: name,
52
+ size: "small",
53
+ sx: {
54
+ fontSize: '13px',
55
+ ...sx
56
+ },
57
+ ...props
58
+ });
59
+ }
@@ -0,0 +1,22 @@
1
+ import { Paper } from "@mui/material";
2
+ import { forwardRef } from "react";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const Section = /*#__PURE__*/forwardRef(({
5
+ children,
6
+ sx,
7
+ ...props
8
+ }, ref) => {
9
+ return /*#__PURE__*/_jsx(Paper, {
10
+ ref: ref,
11
+ variant: "outlined",
12
+ square: false,
13
+ sx: {
14
+ marginTop: '20px',
15
+ padding: 3,
16
+ ...sx
17
+ },
18
+ ...props,
19
+ children: children
20
+ });
21
+ });
22
+ export default Section;
@@ -0,0 +1,36 @@
1
+ import { Box, Divider, Stack, Typography } from "@mui/material";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export default function ShadowedSection({
6
+ label,
7
+ children,
8
+ marginTop = '20px',
9
+ sx,
10
+ ...props
11
+ }) {
12
+ return /*#__PURE__*/_jsxs(_Fragment, {
13
+ children: [/*#__PURE__*/_jsx(Box, {
14
+ sx: {
15
+ mt: marginTop
16
+ },
17
+ children: /*#__PURE__*/_jsx(Typography, {
18
+ variant: "subtitle1",
19
+ children: label
20
+ })
21
+ }), /*#__PURE__*/_jsxs(Stack, {
22
+ sx: {
23
+ backgroundColor: '#fff',
24
+ boxShadow: '0 0.3rem 0.3rem rgba(0, 0, 0, 0.03) !important'
25
+ },
26
+ children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Stack, {
27
+ sx: {
28
+ padding: 3,
29
+ ...sx
30
+ },
31
+ ...props,
32
+ children: children
33
+ }), /*#__PURE__*/_jsx(Divider, {})]
34
+ })]
35
+ });
36
+ }
@@ -0,0 +1,34 @@
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
+ id,
7
+ label,
8
+ status,
9
+ onOperate,
10
+ sx,
11
+ ...props
12
+ }) {
13
+ const styles = {
14
+ '&': {
15
+ bgcolor: status === 'normal' ? '#4caf50' : '#fff'
16
+ },
17
+ '.MuiSvgIcon-root.MuiChip-deleteIcon': {
18
+ cursor: onOperate ? 'pointer' : 'default'
19
+ }
20
+ };
21
+ return /*#__PURE__*/_jsx(Chip, {
22
+ id: id,
23
+ label: label,
24
+ variant: status === 'normal' ? 'filled' : 'outlined',
25
+ color: status === 'normal' ? 'success' : 'default',
26
+ deleteIcon: status === 'normal' ? /*#__PURE__*/_jsx(CheckCircleIcon, {}) : /*#__PURE__*/_jsx(ErrorIcon, {}),
27
+ onDelete: _ => onOperate && onOperate(id, status),
28
+ sx: {
29
+ ...sx,
30
+ ...styles
31
+ },
32
+ ...props
33
+ });
34
+ }
@@ -0,0 +1,37 @@
1
+ import { Stack, Tab } from "@mui/material";
2
+ import Tabs from "./Tabs";
3
+ import Section from "./Section";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export default function TabbedSection({
7
+ orientation,
8
+ labels = [],
9
+ tabProps = {},
10
+ sectionProps = {},
11
+ children,
12
+ ...props
13
+ }) {
14
+ const styles = {
15
+ mt: 0,
16
+ width: orientation === 'vertical' ? '100%' : 'unset'
17
+ };
18
+ return /*#__PURE__*/_jsxs(Stack, {
19
+ direction: orientation === 'vertical' ? 'row' : 'column',
20
+ children: [/*#__PURE__*/_jsx(Tabs, {
21
+ orientation: orientation,
22
+ ...props,
23
+ children: labels.map((label, index) => /*#__PURE__*/_jsx(Tab, {
24
+ label: label,
25
+ wrapped: orientation === 'vertical',
26
+ ...tabProps
27
+ }, index))
28
+ }), /*#__PURE__*/_jsx(Section, {
29
+ sx: {
30
+ ...styles,
31
+ ...sectionProps.sx
32
+ },
33
+ ...sectionProps,
34
+ children: children
35
+ })]
36
+ });
37
+ }
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import MuiTabs from "@mui/material/Tabs";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ export default function Tabs({
6
+ orientation,
7
+ sx,
8
+ ...props
9
+ }) {
10
+ const vertical = orientation === 'vertical';
11
+ const styles = {
12
+ ml: vertical ? 0 : 0.5,
13
+ mr: vertical ? 0 : 0.5,
14
+ mt: vertical ? 0.5 : 0,
15
+ mb: vertical ? 0.5 : 0,
16
+ '& .MuiButtonBase-root.MuiTab-root': {
17
+ fontSize: '15px'
18
+ },
19
+ '&.MuiTabs-root.MuiTabs-vertical': {
20
+ minWidth: '40px',
21
+ maxWidth: '40px'
22
+ },
23
+ '&.MuiTabs-root.MuiTabs-vertical .MuiButtonBase-root.MuiTab-root': {
24
+ minWidth: '40px',
25
+ maxWidth: '40px'
26
+ }
27
+ };
28
+ return /*#__PURE__*/_jsx(_Fragment, {
29
+ children: /*#__PURE__*/_jsx(MuiTabs, {
30
+ orientation: orientation,
31
+ sx: {
32
+ ...styles,
33
+ ...sx
34
+ },
35
+ ...props
36
+ })
37
+ });
38
+ }
@@ -0,0 +1,25 @@
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 TextField({
5
+ width,
6
+ fontSize,
7
+ textAlign,
8
+ inputProps,
9
+ ...props
10
+ }) {
11
+ const styles = {
12
+ fontSize: fontSize ? fontSize : 16,
13
+ textAlign: textAlign ? textAlign : 'left',
14
+ width
15
+ };
16
+ return /*#__PURE__*/_jsx(_Fragment, {
17
+ children: /*#__PURE__*/_jsx(MuiTextField, {
18
+ inputProps: {
19
+ ...inputProps,
20
+ style: styles
21
+ },
22
+ ...props
23
+ })
24
+ });
25
+ }
package/base/index.js CHANGED
@@ -30,4 +30,24 @@ export { default as Snackbar } from "./Snackbar";
30
30
  export { default as Switch } from "./Switch";
31
31
  export * from './frame/sidebar/SidebarContext';
32
32
  export { default as Error } from "./error/Error";
33
- export { default as HttpError } from "./error/HttpError";
33
+ export { default as HttpError } from "./error/HttpError";
34
+ export { default as Accordion } from "./deprecated/Accordion";
35
+ export { default as AccordionDetails } from "./deprecated/AccordionDetails";
36
+ export { default as AccordionSummary } from "./deprecated/AccordionSummary";
37
+ export { default as AppendableFormList } from "./deprecated/AppendableFormList";
38
+ export { default as AvatarDropdown } from "./deprecated/AvatarDropdown";
39
+ export { default as Button } from "./deprecated/Button";
40
+ export { default as CircularProgress } from "./deprecated/CircularProgress";
41
+ export { default as FormLabel } from "./deprecated/FormLabel";
42
+ export { default as GroupSelect } from "./deprecated/GroupSelect";
43
+ export { default as ListItem } from "./deprecated/ListItem";
44
+ export { default as ListItemDivider } from "./deprecated/ListItemDivider";
45
+ export { default as ListItemGrid } from "./deprecated/ListItemGrid";
46
+ export { default as ListItemText } from "./deprecated/ListItemText";
47
+ export { default as ReferenceChipList } from "./deprecated/ReferenceChipList";
48
+ export { default as Section } from "./deprecated/Section";
49
+ export { default as ShadowedSection } from "./deprecated/ShadowedSection";
50
+ export { default as StatusChip } from "./deprecated/StatusChip";
51
+ export { default as TabbedSection } from "./deprecated/TabbedSection";
52
+ export { default as Tabs } from "./deprecated/Tabs";
53
+ export { default as TextField } from "./deprecated/TextField";
@@ -0,0 +1,199 @@
1
+ import { blue, grey, orange, red } from "../colors";
2
+ export const primary = {
3
+ contained: (ownerState, theme) => {
4
+ return ownerState.color === 'primary' && ownerState.variant === 'contained' && {
5
+ color: theme.palette.primary.contrastText,
6
+ backgroundColor: theme.palette.primary.main,
7
+ ':hover': {
8
+ color: theme.palette.primary.contrastText,
9
+ backgroundColor: '#242424'
10
+ },
11
+ ':active': {
12
+ color: grey[300],
13
+ backgroundColor: '#141414'
14
+ },
15
+ ':disabled': {
16
+ color: grey[500],
17
+ backgroundColor: grey[300]
18
+ }
19
+ };
20
+ },
21
+ outlined: (ownerState, theme) => {
22
+ return ownerState.color === 'primary' && ownerState.variant === 'outlined' && {
23
+ color: grey[900],
24
+ backgroundColor: '#fff',
25
+ borderColor: grey[700],
26
+ ':hover': {
27
+ color: grey[900],
28
+ backgroundColor: grey[10]
29
+ },
30
+ ':active': {
31
+ color: grey[900],
32
+ backgroundColor: grey[20]
33
+ },
34
+ ':disabled': {
35
+ color: grey[400],
36
+ backgroundColor: '#fff',
37
+ borderColor: grey[400]
38
+ }
39
+ };
40
+ },
41
+ text: (ownerState, theme) => {
42
+ return ownerState.color === 'primary' && ownerState.variant === 'text' && {
43
+ color: grey[900],
44
+ backgroundColor: '#fff',
45
+ ':hover': {
46
+ color: grey[900],
47
+ backgroundColor: grey[100]
48
+ },
49
+ ':active': {
50
+ color: grey[900],
51
+ backgroundColor: grey[200]
52
+ },
53
+ ':disabled': {
54
+ color: grey[400],
55
+ backgroundColor: '#fff'
56
+ }
57
+ };
58
+ }
59
+ };
60
+ export const info = {
61
+ contained: (ownerState, theme) => {
62
+ return ownerState.color === 'info' && ownerState.variant === 'contained' && {
63
+ color: theme.palette.info.contrastText,
64
+ backgroundColor: theme.palette.info.main,
65
+ ':hover': {
66
+ color: theme.palette.info.contrastText,
67
+ backgroundColor: blue[600]
68
+ },
69
+ ':active': {
70
+ color: theme.palette.info.contrastText,
71
+ backgroundColor: blue[800]
72
+ },
73
+ ':disabled': {
74
+ color: grey[500],
75
+ backgroundColor: grey[300]
76
+ }
77
+ };
78
+ },
79
+ outlined: (ownerState, theme) => {
80
+ return ownerState.color === 'info' && ownerState.variant === 'outlined' && {
81
+ color: blue[500],
82
+ backgroundColor: '#fff',
83
+ borderColor: blue[500],
84
+ ':hover': {
85
+ color: blue[500],
86
+ backgroundColor: blue[50]
87
+ },
88
+ ':active': {
89
+ color: blue[500],
90
+ backgroundColor: blue[100]
91
+ },
92
+ ':disabled': {
93
+ color: grey[400],
94
+ backgroundColor: '#fff',
95
+ borderColor: grey[400]
96
+ }
97
+ };
98
+ },
99
+ text: (ownerState, theme) => {
100
+ return ownerState.color === 'info' && ownerState.variant === 'text' && {
101
+ color: blue[500],
102
+ backgroundColor: '#fff',
103
+ ':hover': {
104
+ color: blue[500],
105
+ backgroundColor: blue[50]
106
+ },
107
+ ':active': {
108
+ color: blue[500],
109
+ backgroundColor: blue[100]
110
+ },
111
+ ':disabled': {
112
+ color: grey[400],
113
+ backgroundColor: '#fff'
114
+ }
115
+ };
116
+ }
117
+ };
118
+ export const warning = {
119
+ contained: (ownerState, theme) => {
120
+ return ownerState.color === 'warning' && ownerState.variant === 'contained' && {
121
+ color: theme.palette.warning.contrastText,
122
+ backgroundColor: theme.palette.warning.main,
123
+ ':hover': {
124
+ color: theme.palette.warning.contrastText,
125
+ backgroundColor: orange[600]
126
+ },
127
+ ':active': {
128
+ color: theme.palette.warning.contrastText,
129
+ backgroundColor: orange[800]
130
+ },
131
+ ':disabled': {
132
+ color: grey[500],
133
+ backgroundColor: grey[300]
134
+ }
135
+ };
136
+ }
137
+ };
138
+ export const error = {
139
+ contained: (ownerState, theme) => {
140
+ return ownerState.color === 'error' && ownerState.variant === 'contained' && {
141
+ color: theme.palette.error.contrastText,
142
+ backgroundColor: theme.palette.error.main,
143
+ ':hover': {
144
+ color: theme.palette.error.contrastText,
145
+ backgroundColor: red[600]
146
+ },
147
+ ':active': {
148
+ color: theme.palette.error.contrastText,
149
+ backgroundColor: red[800]
150
+ },
151
+ ':disabled': {
152
+ color: grey[500],
153
+ backgroundColor: grey[300]
154
+ }
155
+ };
156
+ },
157
+ outlined: (ownerState, theme) => {
158
+ return ownerState.color === 'error' && ownerState.variant === 'outlined' && {
159
+ color: red[700],
160
+ backgroundColor: '#fff',
161
+ borderColor: red[600],
162
+ ':hover': {
163
+ color: red[700],
164
+ backgroundColor: red[50] //'#fef2f4',
165
+ },
166
+
167
+ ':active': {
168
+ color: red[700],
169
+ backgroundColor: red[100] //'#fcdee5',
170
+ },
171
+
172
+ ':disabled': {
173
+ color: grey[400],
174
+ backgroundColor: '#fff',
175
+ borderColor: grey[400]
176
+ }
177
+ };
178
+ },
179
+ text: (ownerState, theme) => {
180
+ return ownerState.color === 'error' && ownerState.variant === 'text' && {
181
+ color: red[700],
182
+ backgroundColor: '#fff',
183
+ ':hover': {
184
+ color: red[700],
185
+ backgroundColor: red[50] //'#fef2f4',
186
+ },
187
+
188
+ ':active': {
189
+ color: red[700],
190
+ backgroundColor: red[100] //'#fcdee5',
191
+ },
192
+
193
+ ':disabled': {
194
+ color: grey[400],
195
+ backgroundColor: '#fff'
196
+ }
197
+ };
198
+ }
199
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"