@nethru/ui 1.0.51 → 1.0.53

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/Button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from "react";
2
2
  import MuiButton from "@mui/material/Button";
3
- import { Box } from "@mui/material";
3
+ import { Box, IconButton } from "@mui/material";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export default function Button({
6
6
  label,
@@ -27,10 +27,13 @@ export default function Button({
27
27
  const endIcon = useMemo(() => {
28
28
  return iconPlacement === 'end' ? iconComponent : null;
29
29
  }, [iconComponent, iconPlacement]);
30
- return /*#__PURE__*/_jsx(MuiButton, {
30
+ return label ? /*#__PURE__*/_jsx(MuiButton, {
31
31
  startIcon: startIcon,
32
32
  endIcon: endIcon,
33
33
  ...props,
34
34
  children: label
35
+ }) : /*#__PURE__*/_jsx(IconButton, {
36
+ ...props,
37
+ children: iconComponent
35
38
  });
36
39
  }
package/dist/DataGrid.js CHANGED
@@ -107,8 +107,8 @@ export default function DataGrid({
107
107
  getRowHeight: () => 'auto',
108
108
  localeText: {
109
109
  ...koKR.components.MuiDataGrid.defaultProps.localeText,
110
- ...localText,
111
- noRowsLabel: '항목이 없습니다.'
110
+ noRowsLabel: '항목이 없습니다.',
111
+ ...localText
112
112
  },
113
113
  slots: {
114
114
  toolbar: hideToolbar ? null : CustomToolbar,
@@ -6,6 +6,10 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  export default function DropdownButton({
8
8
  label,
9
+ icon,
10
+ iconPlacement = 'start',
11
+ iconSize = '20px',
12
+ iconProps = {},
9
13
  options = [],
10
14
  onClick,
11
15
  onSelect,
@@ -24,6 +28,10 @@ export default function DropdownButton({
24
28
  return /*#__PURE__*/_jsxs(_Fragment, {
25
29
  children: [/*#__PURE__*/_jsx(Button, {
26
30
  label: label,
31
+ icon: icon,
32
+ iconPlacement: iconPlacement,
33
+ iconSize: iconSize,
34
+ iconProps: iconProps,
27
35
  onClick: handleClick,
28
36
  ...props
29
37
  }), options.length > 0 && /*#__PURE__*/_jsx(Menu, {
@@ -24,7 +24,7 @@ export default function MenuTree({
24
24
  backgroundColor: 'transparent'
25
25
  }
26
26
  };
27
- const naviate = useNavigate();
27
+ const navigate = useNavigate();
28
28
  const {
29
29
  states,
30
30
  dispatch
@@ -40,7 +40,7 @@ export default function MenuTree({
40
40
  hasChildren: hasChildren(event.target)
41
41
  });
42
42
  const node = getNode(ids);
43
- if (node && node.href) naviate(node.href);
43
+ if (node && node.href) navigate(node.href instanceof Array ? node.href[0] : node.href);
44
44
  };
45
45
  const handleToggle = (event, ids) => {
46
46
  dispatch({
@@ -91,7 +91,7 @@ function updateActiveItems(draft, menu, href) {
91
91
  function updateActiveSection(sections) {
92
92
  if (!sections) return;
93
93
  for (let section of sections) {
94
- if (href.indexOf(section.href) === 0) {
94
+ if (startsWith(section.href)) {
95
95
  draft.activeSecondaryItem = section.id;
96
96
  return true;
97
97
  }
@@ -104,7 +104,7 @@ function updateActiveItems(draft, menu, href) {
104
104
  function updateActiveSubmenuItems(id, submenu) {
105
105
  if (!submenu) return;
106
106
  for (let item of submenu) {
107
- if (href.indexOf(item.href) === 0) {
107
+ if (startsWith(item.href)) {
108
108
  if (!(id in draft.menuTrees)) draft.menuTrees[id] = emptyState();
109
109
  draft.activeSecondaryItem = item.id;
110
110
  return true;
@@ -115,4 +115,8 @@ function updateActiveItems(draft, menu, href) {
115
115
  }
116
116
  }
117
117
  }
118
+ function startsWith(hrefs) {
119
+ const menuHrefs = hrefs instanceof Array ? hrefs : [hrefs];
120
+ return menuHrefs.some(menuHref => href.startsWith(menuHref));
121
+ }
118
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"