@nethru/ui 2.0.16 → 2.1.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.
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import React, { forwardRef, useMemo } from "react";
2
2
  import { IconButton, Stack, Tooltip, Typography } from "@mui/material";
3
3
  import AddIcon from "@mui/icons-material/Add";
4
4
  import RemoveIcon from '@mui/icons-material/Remove';
@@ -8,6 +8,7 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
8
8
  const AddableFormList = /*#__PURE__*/forwardRef(({
9
9
  forms = [],
10
10
  renderForm,
11
+ renderButton = () => [true, true],
11
12
  onAdd,
12
13
  onRemove,
13
14
  readOnly,
@@ -18,6 +19,7 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
18
19
  allowEmpty = false,
19
20
  ...props
20
21
  }, ref) => {
22
+ const removable = useMemo(() => allowEmpty || forms.length > 1, [allowEmpty, forms.length]);
21
23
  return /*#__PURE__*/_jsx(Stack, {
22
24
  ref: ref,
23
25
  gap: gap,
@@ -32,19 +34,20 @@ const AddableFormList = /*#__PURE__*/forwardRef(({
32
34
  alignItems: "start",
33
35
  gap: 1,
34
36
  marginTop: `${margins[index > 0 ? 1 : 0]}px`,
35
- children: [showRemoveButton && /*#__PURE__*/_jsx(Tooltip, {
37
+ children: [showRemoveButton && renderButton(form, index)[0] && /*#__PURE__*/_jsx(Tooltip, {
36
38
  title: "\uC0AD\uC81C",
37
39
  children: /*#__PURE__*/_jsx(IconButton, {
38
40
  variant: "menu",
39
41
  onClick: _ => onRemove(index),
40
- disabled: !allowEmpty && forms.length === 1,
42
+ disabled: !removable,
43
+ component: !removable ? 'span' : undefined,
41
44
  children: /*#__PURE__*/_jsx(RemoveIcon, {
42
45
  sx: {
43
46
  fontSize: 17
44
47
  }
45
48
  })
46
49
  })
47
- }), showAddButton && /*#__PURE__*/_jsx(Tooltip, {
50
+ }), showAddButton && renderButton(form, index)[1] && /*#__PURE__*/_jsx(Tooltip, {
48
51
  title: "\uCD94\uAC00",
49
52
  children: /*#__PURE__*/_jsx(IconButton, {
50
53
  variant: "menu",
@@ -31,7 +31,7 @@ const DataGrid = /*#__PURE__*/forwardRef(({
31
31
  localeText: {
32
32
  ...koKR.components.MuiDataGrid.defaultProps.localeText,
33
33
  noRowsLabel: '항목이 없습니다.',
34
- ...props.localText
34
+ ...props.localeText
35
35
  },
36
36
  slots: {
37
37
  toolbar: hideToolbar ? null : Toolbar,
@@ -66,6 +66,9 @@ export default function Editor({
66
66
  '.cm-content .cm-selectionMatch': {
67
67
  backgroundColor: blue[100]
68
68
  },
69
+ '.cm-selectionLayer': {
70
+ zIndex: 'unset !important'
71
+ },
69
72
  '.cm-selectionLayer .cm-selectionBackground': {
70
73
  backgroundColor: `${blue[200]} !important`
71
74
  },
@@ -10,6 +10,7 @@
10
10
  }
11
11
  .container.closed {
12
12
  width: calc(var(--primary-menu-width) + var(--secondary-menu-collapsed-width));
13
+ min-width: calc(var(--primary-menu-width) + var(--secondary-menu-collapsed-width));
13
14
  }
14
15
 
15
16
 
package/base/index.js CHANGED
@@ -42,15 +42,12 @@ export * from './frame/sidebar/SidebarContext';
42
42
  export { default as Error } from "./error/Error";
43
43
  export { default as HttpError } from "./error/HttpError";
44
44
  export { default as AppendableFormList } from "./deprecated/AppendableFormList";
45
- export { default as AvatarDropdown } from "./deprecated/AvatarDropdown";
46
45
  export { default as CircularProgress } from "./deprecated/CircularProgress";
47
46
  export { default as FormLabel } from "./deprecated/FormLabel";
48
- export { default as GroupSelect } from "./deprecated/GroupSelect";
49
47
  export { default as ListItem } from "./deprecated/ListItem";
50
48
  export { default as ListItemDivider } from "./deprecated/ListItemDivider";
51
49
  export { default as ListItemGrid } from "./deprecated/ListItemGrid";
52
50
  export { default as ListItemText } from "./deprecated/ListItemText";
53
51
  export { default as ShadowedSection } from "./deprecated/ShadowedSection";
54
- export { default as StatusChip } from "./deprecated/StatusChip";
55
52
  export { default as TabbedSection } from "./deprecated/TabbedSection";
56
53
  export { default as Tabs } from "./deprecated/Tabs";
@@ -22,6 +22,7 @@ import * as formLabel from "./mui/formLabel";
22
22
  import * as outlinedInput from "./mui/outlinedInput";
23
23
  import * as formHelperText from "./mui/formHelperText";
24
24
  import * as inputLabel from "./mui/inputLabel";
25
+ import * as inputAdornment from "./mui/inputAdornment";
25
26
  import * as popover from "./mui/popover";
26
27
  import * as paper from "./mui/paper";
27
28
  import * as list from "./mui/list";
@@ -72,6 +73,7 @@ export default function createTheme() {
72
73
  MuiFormControlLabel: formControlLabel.styles,
73
74
  MuiFormLabel: formLabel.styles,
74
75
  MuiInputLabel: inputLabel.styles,
76
+ MuiInputAdornment: inputAdornment.styles,
75
77
  MuiOutlinedInput: outlinedInput.styles,
76
78
  MuiFormHelperText: formHelperText.styles,
77
79
  MuiPopover: popover.styles,
@@ -54,13 +54,13 @@ export const styles = {
54
54
  '.MuiDataGrid-cell .MuiDataGrid-actions': {
55
55
  display: 'none'
56
56
  },
57
- '&.Mui-hovered': {
57
+ '&:hover': {
58
58
  backgroundColor: grey[5],
59
59
  '.MuiDataGrid-cell .MuiDataGrid-actions': {
60
60
  display: 'block'
61
61
  }
62
62
  },
63
- '&.Mui-selected, &.Mui-selected.Mui-hovered': {
63
+ '&.Mui-selected, &.Mui-selected:hover': {
64
64
  backgroundColor: blue[5]
65
65
  }
66
66
  },
@@ -104,7 +104,8 @@ export const styles = {
104
104
  }
105
105
  },
106
106
  overlayWrapperInner: {
107
- ...typography.bodySmRegular
107
+ ...typography.bodySmRegular,
108
+ height: '60px !important'
108
109
  }
109
110
  }
110
111
  };
@@ -0,0 +1,9 @@
1
+ import typography from "../typography";
2
+ export const styles = {
3
+ styleOverrides: {
4
+ root: {
5
+ fontFamily: typography.fontFamily,
6
+ ...typography.bodySmRegular
7
+ }
8
+ }
9
+ };
@@ -44,8 +44,7 @@ export const styles = {
44
44
  paddingLeft: 10,
45
45
  paddingRight: 10,
46
46
  '&.Mui-disabled': {
47
- color: grey[500],
48
- '-webkit-text-fill-color': grey[500]
47
+ color: grey[500]
49
48
  }
50
49
  },
51
50
  multiline: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "2.0.16",
3
+ "version": "2.1.1",
4
4
  "main": "base/index.js",
5
5
  "files": [
6
6
  "/base"
@@ -1,80 +0,0 @@
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
- }
@@ -1,67 +0,0 @@
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
- }
@@ -1,34 +0,0 @@
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
- }