@nethru/ui 1.0.63 → 1.0.64

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.
Files changed (2) hide show
  1. package/dist/Button.js +31 -9
  2. package/package.json +1 -1
package/dist/Button.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import { useMemo } from "react";
2
2
  import MuiButton from "@mui/material/Button";
3
- import { Box, IconButton } from "@mui/material";
3
+ import { Box, CircularProgress, IconButton } from "@mui/material";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default function Button({
6
7
  label,
7
8
  icon,
8
9
  iconPlacement = 'start',
9
10
  iconSize = '20px',
10
11
  iconProps = {},
12
+ progressProps = {},
13
+ loading = false,
11
14
  ...props
12
15
  }) {
13
16
  const iconComponent = useMemo(() => {
@@ -27,13 +30,32 @@ export default function Button({
27
30
  const endIcon = useMemo(() => {
28
31
  return iconPlacement === 'end' ? iconComponent : null;
29
32
  }, [iconComponent, iconPlacement]);
30
- return label ? /*#__PURE__*/_jsx(MuiButton, {
31
- startIcon: startIcon,
32
- endIcon: endIcon,
33
- ...props,
34
- children: label
35
- }) : /*#__PURE__*/_jsx(IconButton, {
36
- ...props,
37
- children: iconComponent
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
+ })]
38
60
  });
39
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nethru/ui",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "/dist"