@nethru/ui 1.0.50 → 1.0.52

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,
@@ -0,0 +1,59 @@
1
+ import * as React from "react";
2
+ import { Divider, Menu, MenuItem } from "@mui/material";
3
+ import Button from "./Button";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ export default function DropdownButton({
8
+ label,
9
+ icon,
10
+ iconPlacement = 'start',
11
+ iconSize = '20px',
12
+ iconProps = {},
13
+ options = [],
14
+ onClick,
15
+ onSelect,
16
+ menuProps = {},
17
+ ...props
18
+ }) {
19
+ const [anchor, setAnchor] = React.useState(null);
20
+ const handleClick = event => {
21
+ setAnchor(event.currentTarget);
22
+ if (onClick) onClick(event);
23
+ };
24
+ const handleSelect = id => {
25
+ setAnchor(null);
26
+ if (onSelect) onSelect(id);
27
+ };
28
+ return /*#__PURE__*/_jsxs(_Fragment, {
29
+ children: [/*#__PURE__*/_jsx(Button, {
30
+ label: label,
31
+ icon: icon,
32
+ iconPlacement: iconPlacement,
33
+ iconSize: iconSize,
34
+ iconProps: iconProps,
35
+ onClick: handleClick,
36
+ ...props
37
+ }), options.length > 0 && /*#__PURE__*/_jsx(Menu, {
38
+ anchorEl: anchor,
39
+ open: Boolean(anchor),
40
+ onClose: _ => setAnchor(null),
41
+ sx: {
42
+ ...styles,
43
+ ...menuProps.sx
44
+ },
45
+ ...menuProps,
46
+ children: options.map(option => {
47
+ return option.type === 'divider' ? /*#__PURE__*/_jsx(Divider, {}) : /*#__PURE__*/_jsx(MenuItem, {
48
+ onClick: _ => handleSelect(option.id),
49
+ children: option.label
50
+ }, option.id);
51
+ })
52
+ })]
53
+ });
54
+ }
55
+ const styles = {
56
+ '.MuiButtonBase-root.MuiMenuItem-root': {
57
+ fontSize: 14
58
+ }
59
+ };
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { default as ColumnedSection } from "./ColumnedSection";
12
12
  export { default as ConfirmDialog } from "./ConfirmDialog";
13
13
  export { default as DataGrid } from "./DataGrid";
14
14
  export { default as Dialog } from "./Dialog";
15
+ export { default as DropdownButton } from "./DropdownButton";
15
16
  export { default as Editor } from "./Editor";
16
17
  export { default as FormLabel } from "./FormLabel";
17
18
  export { default as Frame } from "./Frame";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"