@m4l/components 0.1.26 → 0.1.28
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/assets/Logo/index.228dcb5a.js +42 -35
- package/commonjs.565e6834.js +5 -5
- package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
- package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
- package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
- package/components/DataGrid/index.76d8fd25.js +1075 -0
- package/components/DynamicFilter/index.342ba5fe.js +1577 -0
- package/components/ErrorLabel/index.c8615f16.js +13 -12
- package/components/Icon/index.619c31c4.js +96 -0
- package/components/Icon/types.d.ts +2 -1
- package/components/Image/index.93d5f37f.js +190 -0
- package/components/Loadable/index.f5518558.js +8 -8
- package/components/ModalDialog/index.9ea10764.js +184 -0
- package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
- package/components/ObjectLogs/index.f941fb79.js +288 -0
- package/components/Page/index.4237c241.js +22 -20
- package/components/PaperForm/index.ec9cb8c9.js +112 -0
- package/components/Period/index.2941fbda.js +249 -0
- package/components/PropertyValue/index.dfcfe1ba.js +147 -0
- package/components/PropertyValue/styles.d.ts +2 -1
- package/components/PropertyValue/types.d.ts +3 -3
- package/components/Resizeable/index.45995d2b.js +19 -19
- package/components/ScrollBar/index.39eeb2de.js +26 -21
- package/components/ScrollToTop/index.e06f98f6.js +8 -7
- package/components/SplitLayout/index.4032673d.js +35 -33
- package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
- package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
- package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
- package/components/animate/features.0fbf41e1.js +3 -3
- package/components/animate/variants/bounce.784aaaaa.js +16 -13
- package/components/animate/variants/container.11f82b76.js +8 -6
- package/components/animate/variants/fade.b561c0fc.js +32 -28
- package/components/animate/variants/transition.bd46b9ce.js +17 -12
- package/components/formatters/BooleanFormatter/index.8da35c9c.js +55 -0
- package/components/formatters/DateFormatter/index.1b9baacc.js +69 -0
- package/components/formatters/index.689a8086.js +119 -0
- package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
- package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
- package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
- package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
- package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
- package/components/hook-form/RHFTextField/index.f9aaaa90.js +146 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/styles.d.ts +4 -3
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/types.d.ts +0 -0
- package/components/hook-form/RHFUpload/index.d5cc7c13.js +285 -0
- package/components/mui_extended/Accordion/index.a02ac6ae.js +107 -0
- package/components/mui_extended/Avatar/index.fe06afd7.js +51 -0
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
- package/components/mui_extended/Button/index.53b56958.js +178 -0
- package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
- package/components/mui_extended/IconButton/index.a321e5cb.js +120 -0
- package/components/mui_extended/IconButton/index.d.ts +1 -1
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
- package/components/mui_extended/Pager/index.c0865b70.js +141 -0
- package/components/mui_extended/Popover/index.705275a4.js +278 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
- package/components/mui_extended/Typography/index.e5494696.js +25 -21
- package/contexts/ModalContext/index.b92fa565.js +153 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
- package/contexts/RHFormContext/index.b142190a.js +63 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
- package/hooks/useModal/index.5fee01a3.js +11 -0
- package/index.js +153 -153
- package/package.json +2 -1
- package/react-data-grid.d46d625e.js +2206 -1663
- package/react-draggable.20e95c61.js +800 -553
- package/react-json-view.f56a7f8e.js +2344 -2340
- package/react-resizable.5277deaf.js +470 -298
- package/react-splitter-layout.7810ac1b.js +130 -128
- package/utils/index.214d9542.js +500 -354
- package/components/CommonActions/components/ActionCancel/index.6736b782.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.281ee166.js +0 -49
- package/components/CommonActions/components/ActionIntro/index.4665a611.js +0 -18
- package/components/CommonActions/components/Actions/index.cd7b2671.js +0 -742
- package/components/DataGrid/index.2caf6231.js +0 -894
- package/components/DynamicFilter/index.f2377369.js +0 -1157
- package/components/Icon/index.f569765b.js +0 -82
- package/components/Image/index.c9da2d5a.js +0 -152
- package/components/ModalDialog/index.bee344a5.js +0 -168
- package/components/ObjectLogs/index.6b6f95e6.js +0 -266
- package/components/PaperForm/index.3f8c7ef2.js +0 -105
- package/components/Period/index.a112ce37.js +0 -175
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/contexts/RHFormContext/index.33dba822.js +0 -56
- package/components/formatters/BooleanFormatter/index.3ec56305.js +0 -42
- package/components/formatters/DateFormatter/index.08d8823b.js +0 -57
- package/components/formatters/index.6959c2de.js +0 -106
- package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
- package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
- package/components/hook-form/RHFPeriod/index.979d0898.js +0 -51
- package/components/hook-form/RHFTextField/index.ba2a8f67.js +0 -129
- package/components/hook-form/RHFUpload/index.6347159a.js +0 -258
- package/components/mui_extended/Accordion/index.49f5df8e.js +0 -103
- package/components/mui_extended/Avatar/index.dadb0528.js +0 -37
- package/components/mui_extended/Button/index.52d18aea.js +0 -144
- package/components/mui_extended/IconButton/index.4b5ce8b5.js +0 -103
- package/components/mui_extended/Pager/index.951b6975.js +0 -126
- package/components/mui_extended/Popover/index.4da8587a.js +0 -252
- package/contexts/ModalContext/index.5388dfd5.js +0 -136
- package/hooks/useModal/index.3b1ff084.js +0 -11
- package/node_modules.168cb897.js +0 -55
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Skeleton, Accordion as Accordion$1, AccordionSummary, AccordionDetails } from "@mui/material";
|
|
2
|
+
import { I as IconButton } from "../IconButton/index.a321e5cb.js";
|
|
3
|
+
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
4
|
+
import { I as Icon } from "../../Icon/index.619c31c4.js";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
styled("div")(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
10
|
+
display: "flex",
|
|
11
|
+
justifyContent: "space-between",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
borderRadius: theme.spacing(0.5),
|
|
14
|
+
height: theme.spacing(4.5),
|
|
15
|
+
minHeight: theme.spacing(4.5),
|
|
16
|
+
backgroundColor: theme.palette.background.header,
|
|
17
|
+
paddingLeft: theme.spacing(2),
|
|
18
|
+
paddingRight: theme.spacing(2),
|
|
19
|
+
marginBottom: "0px"
|
|
20
|
+
}));
|
|
21
|
+
const WrapperAccordionLabel = styled("div")(({
|
|
22
|
+
theme
|
|
23
|
+
}) => ({
|
|
24
|
+
display: "flex",
|
|
25
|
+
justifyContent: "flex-start",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
gap: theme.spacing(2)
|
|
28
|
+
}));
|
|
29
|
+
const Label = styled("span")(({
|
|
30
|
+
theme
|
|
31
|
+
}) => ({
|
|
32
|
+
...theme.typography.subtitle2
|
|
33
|
+
}));
|
|
34
|
+
const AccordionLabel = (props) => {
|
|
35
|
+
const {
|
|
36
|
+
isSkeleton,
|
|
37
|
+
label,
|
|
38
|
+
SKTWidht,
|
|
39
|
+
SKTHeight,
|
|
40
|
+
labelIcon
|
|
41
|
+
} = props;
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
children: isSkeleton ? /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
44
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
45
|
+
variant: "circular",
|
|
46
|
+
width: "16px",
|
|
47
|
+
height: "16px"
|
|
48
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
49
|
+
variant: "text",
|
|
50
|
+
width: SKTWidht,
|
|
51
|
+
height: SKTHeight
|
|
52
|
+
})]
|
|
53
|
+
}) : /* @__PURE__ */ jsxs(WrapperAccordionLabel, {
|
|
54
|
+
children: [labelIcon && /* @__PURE__ */ jsx(Icon, {
|
|
55
|
+
src: labelIcon
|
|
56
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
57
|
+
children: label
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
function Accordion(props) {
|
|
63
|
+
const {
|
|
64
|
+
label,
|
|
65
|
+
SKTWidht,
|
|
66
|
+
SKTHeight,
|
|
67
|
+
children,
|
|
68
|
+
accordionProps,
|
|
69
|
+
summaryProps,
|
|
70
|
+
labelIcon
|
|
71
|
+
} = props;
|
|
72
|
+
const {
|
|
73
|
+
host_static_assets,
|
|
74
|
+
environment_assets
|
|
75
|
+
} = useEnvironment();
|
|
76
|
+
const isSkeleton = useModuleSkeleton();
|
|
77
|
+
return /* @__PURE__ */ jsxs(Accordion$1, {
|
|
78
|
+
variant: "outlined",
|
|
79
|
+
square: true,
|
|
80
|
+
TransitionProps: {
|
|
81
|
+
unmountOnExit: true
|
|
82
|
+
},
|
|
83
|
+
defaultExpanded: true,
|
|
84
|
+
...accordionProps,
|
|
85
|
+
children: [/* @__PURE__ */ jsx(AccordionSummary, {
|
|
86
|
+
"aria-controls": "expanded-content",
|
|
87
|
+
disableTouchRipple: false,
|
|
88
|
+
expandIcon: /* @__PURE__ */ jsx(IconButton, {
|
|
89
|
+
"aria-label": "settings",
|
|
90
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/accordion/assets/icons/expanded.svg`
|
|
91
|
+
}),
|
|
92
|
+
...summaryProps,
|
|
93
|
+
children: /* @__PURE__ */ jsx(AccordionLabel, {
|
|
94
|
+
isSkeleton,
|
|
95
|
+
label,
|
|
96
|
+
SKTWidht,
|
|
97
|
+
SKTHeight,
|
|
98
|
+
labelIcon
|
|
99
|
+
})
|
|
100
|
+
}), /* @__PURE__ */ jsx(AccordionDetails, {
|
|
101
|
+
children
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
Accordion as A
|
|
107
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { useTheme } from "@mui/material/styles";
|
|
3
|
+
import { Skeleton, Avatar as Avatar$1 } from "@mui/material";
|
|
4
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
const SkeletonAvatar = () => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
8
|
+
variant: "circular",
|
|
9
|
+
width: "32px",
|
|
10
|
+
height: "32px"
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
const Avatar = forwardRef(({
|
|
14
|
+
color = "default",
|
|
15
|
+
children,
|
|
16
|
+
sx,
|
|
17
|
+
...other
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const isSkeleton = useModuleSkeleton();
|
|
21
|
+
if (isSkeleton) {
|
|
22
|
+
return /* @__PURE__ */ jsx(SkeletonAvatar, {});
|
|
23
|
+
}
|
|
24
|
+
if (color === "default") {
|
|
25
|
+
return /* @__PURE__ */ jsx(Avatar$1, {
|
|
26
|
+
ref,
|
|
27
|
+
sx: {
|
|
28
|
+
cursor: "pointer",
|
|
29
|
+
...sx
|
|
30
|
+
},
|
|
31
|
+
...other,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(Avatar$1, {
|
|
36
|
+
ref,
|
|
37
|
+
sx: {
|
|
38
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
39
|
+
color: theme.palette[color].contrastText,
|
|
40
|
+
backgroundColor: theme.palette[color].main,
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
...sx
|
|
43
|
+
},
|
|
44
|
+
...other,
|
|
45
|
+
children
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
Avatar.displayName = "Avatar";
|
|
49
|
+
export {
|
|
50
|
+
Avatar as A
|
|
51
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Box
|
|
2
|
-
import { jsx
|
|
3
|
-
function
|
|
4
|
-
src
|
|
5
|
-
sx
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function BoxIcon({
|
|
4
|
+
src,
|
|
5
|
+
sx
|
|
6
6
|
}) {
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
8
8
|
component: "span",
|
|
9
9
|
sx: {
|
|
10
10
|
width: 20,
|
|
11
11
|
height: 20,
|
|
12
12
|
display: "inline-block",
|
|
13
13
|
bgcolor: "currentColor",
|
|
14
|
-
mask: `url(${
|
|
15
|
-
WebkitMask: `url(${
|
|
16
|
-
...
|
|
14
|
+
mask: `url(${src}) no-repeat center / contain`,
|
|
15
|
+
WebkitMask: `url(${src}) no-repeat center / contain`,
|
|
16
|
+
...sx
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
BoxIcon as B
|
|
22
22
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { useMemo
|
|
2
|
-
import { useModuleDictionary
|
|
3
|
-
import { Link
|
|
4
|
-
import { Link as
|
|
5
|
-
import { jsxs
|
|
6
|
-
function
|
|
7
|
-
link
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { Link, Box, Typography, Breadcrumbs as Breadcrumbs$1 } from "@mui/material";
|
|
4
|
+
import { Link as Link$1 } from "react-router-dom";
|
|
5
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
6
|
+
function LinkItem({
|
|
7
|
+
link
|
|
8
8
|
}) {
|
|
9
9
|
const {
|
|
10
|
-
href
|
|
11
|
-
name
|
|
12
|
-
icon
|
|
13
|
-
dictionaryField:
|
|
14
|
-
} =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
href,
|
|
11
|
+
name,
|
|
12
|
+
icon,
|
|
13
|
+
dictionaryField: dictionaryDescription
|
|
14
|
+
} = link;
|
|
15
|
+
const {
|
|
16
|
+
getLabel
|
|
17
|
+
} = useModuleDictionary();
|
|
18
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
18
19
|
variant: "body2",
|
|
19
|
-
component:
|
|
20
|
-
to:
|
|
20
|
+
component: Link$1,
|
|
21
|
+
to: href || "#",
|
|
21
22
|
sx: {
|
|
22
23
|
lineHeight: 2,
|
|
23
24
|
display: "flex",
|
|
@@ -27,7 +28,7 @@ function d({
|
|
|
27
28
|
display: "inherit"
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
|
-
children: [
|
|
31
|
+
children: [icon && /* @__PURE__ */ jsx(Box, {
|
|
31
32
|
sx: {
|
|
32
33
|
mr: 1,
|
|
33
34
|
"& svg": {
|
|
@@ -35,29 +36,33 @@ function d({
|
|
|
35
36
|
height: 20
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
|
-
children:
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
39
|
+
children: icon
|
|
40
|
+
}), dictionaryDescription !== void 0 && getLabel ? getLabel(dictionaryDescription) : name]
|
|
41
|
+
}, name);
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function Breadcrumbs(props) {
|
|
44
|
+
const {
|
|
45
|
+
links,
|
|
46
|
+
activeLast = false,
|
|
47
|
+
...other
|
|
48
|
+
} = props;
|
|
43
49
|
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
getLabel: o
|
|
49
|
-
} = m(), r = c(() => {
|
|
50
|
-
if (e.length === 0)
|
|
50
|
+
getLabel
|
|
51
|
+
} = useModuleDictionary();
|
|
52
|
+
const currentLink = useMemo(() => {
|
|
53
|
+
if (links.length === 0)
|
|
51
54
|
return "";
|
|
52
55
|
const {
|
|
53
|
-
dictionaryField
|
|
54
|
-
} =
|
|
55
|
-
return
|
|
56
|
-
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
dictionaryField
|
|
57
|
+
} = links[links.length - 1];
|
|
58
|
+
return getLabel(dictionaryField);
|
|
59
|
+
}, [getLabel, links]);
|
|
60
|
+
const listDefault = useMemo(() => links.map((link) => /* @__PURE__ */ jsx(LinkItem, {
|
|
61
|
+
link
|
|
62
|
+
}, link.name)), [links]);
|
|
63
|
+
const listActiveLast = useMemo(() => links.map((link) => link.name !== currentLink ? /* @__PURE__ */ jsx(LinkItem, {
|
|
64
|
+
link
|
|
65
|
+
}, link.name) : /* @__PURE__ */ jsx(Typography, {
|
|
61
66
|
variant: "body2",
|
|
62
67
|
sx: {
|
|
63
68
|
maxWidth: 260,
|
|
@@ -66,11 +71,11 @@ function D(s) {
|
|
|
66
71
|
color: "text.disabled",
|
|
67
72
|
textOverflow: "ellipsis"
|
|
68
73
|
},
|
|
69
|
-
children:
|
|
70
|
-
},
|
|
71
|
-
return /* @__PURE__ */
|
|
74
|
+
children: currentLink
|
|
75
|
+
}, link.name)), [currentLink, links]);
|
|
76
|
+
return /* @__PURE__ */ jsx(Breadcrumbs$1, {
|
|
72
77
|
id: "MUIBreadcrumbs",
|
|
73
|
-
separator: /* @__PURE__ */
|
|
78
|
+
separator: /* @__PURE__ */ jsx(Box, {
|
|
74
79
|
component: "span",
|
|
75
80
|
sx: {
|
|
76
81
|
width: 4,
|
|
@@ -80,10 +85,10 @@ function D(s) {
|
|
|
80
85
|
bgcolor: "text.disabled"
|
|
81
86
|
}
|
|
82
87
|
}),
|
|
83
|
-
...
|
|
84
|
-
children:
|
|
88
|
+
...other,
|
|
89
|
+
children: activeLast ? listDefault : listActiveLast
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
92
|
export {
|
|
88
|
-
|
|
93
|
+
Breadcrumbs as B
|
|
89
94
|
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { useModuleSkeleton, useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
2
|
+
import { Skeleton, styled, IconButton as IconButton$1, Tooltip } from "@mui/material";
|
|
3
|
+
import MuiButton from "@mui/material/Button";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { LoadingButton as LoadingButton$1 } from "@mui/lab";
|
|
6
|
+
import { I as IconButton } from "../IconButton/index.a321e5cb.js";
|
|
7
|
+
import { styled as styled$1, alpha } from "@mui/material/styles";
|
|
8
|
+
import { u as useBase } from "../../DynamicFilter/index.342ba5fe.js";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { I as Image } from "../../Image/index.93d5f37f.js";
|
|
11
|
+
const Button = (props) => {
|
|
12
|
+
const isSkeleton = useModuleSkeleton();
|
|
13
|
+
if (isSkeleton) {
|
|
14
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
15
|
+
sx: {
|
|
16
|
+
borderRadius: 2
|
|
17
|
+
},
|
|
18
|
+
variant: "rectangular",
|
|
19
|
+
width: "100px",
|
|
20
|
+
height: "36px"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(MuiButton, {
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const WrapperSkeleton = styled("div")(({
|
|
28
|
+
theme
|
|
29
|
+
}) => ({
|
|
30
|
+
display: "flex",
|
|
31
|
+
width: "100%",
|
|
32
|
+
borderRadius: theme.spacing(1),
|
|
33
|
+
overflow: "hidden"
|
|
34
|
+
}));
|
|
35
|
+
const SkeletonLoadingButton = () => /* @__PURE__ */ jsx(WrapperSkeleton, {
|
|
36
|
+
id: "WrapperSKTLoadingButton",
|
|
37
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
38
|
+
variant: "rectangular",
|
|
39
|
+
width: "100%",
|
|
40
|
+
height: "48px"
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
const LoadingButton = (props) => {
|
|
44
|
+
const {
|
|
45
|
+
children,
|
|
46
|
+
...other
|
|
47
|
+
} = props;
|
|
48
|
+
const isSkeleton = useModuleSkeleton();
|
|
49
|
+
if (isSkeleton) {
|
|
50
|
+
return /* @__PURE__ */ jsx(SkeletonLoadingButton, {});
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(LoadingButton$1, {
|
|
53
|
+
...other,
|
|
54
|
+
children
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const SKTWrapperFilterButton = styled$1("div")(({
|
|
58
|
+
theme
|
|
59
|
+
}) => ({
|
|
60
|
+
display: "flex",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
minWidth: theme.spacing(3.75),
|
|
64
|
+
height: theme.spacing(3.75),
|
|
65
|
+
background: alpha(theme.palette.primary.main, 0.3)
|
|
66
|
+
}));
|
|
67
|
+
const WrapperFilterButton = styled$1("div")(() => ({
|
|
68
|
+
"&.isDirty": {
|
|
69
|
+
animationName: "dirtyEffect",
|
|
70
|
+
animationDuration: "1s",
|
|
71
|
+
animationFillMode: "both",
|
|
72
|
+
animationIterationCount: "infinite",
|
|
73
|
+
transition: "all .3s",
|
|
74
|
+
"@keyframes dirtyEffect": {
|
|
75
|
+
"20%": {
|
|
76
|
+
opacity: 1
|
|
77
|
+
},
|
|
78
|
+
"50%": {
|
|
79
|
+
opacity: 0.5
|
|
80
|
+
},
|
|
81
|
+
"100%": {
|
|
82
|
+
opacity: 1
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"&.isDirtyError": {}
|
|
87
|
+
}));
|
|
88
|
+
function FilterButton() {
|
|
89
|
+
const {
|
|
90
|
+
isSkeleton,
|
|
91
|
+
fireOnChangeFilters,
|
|
92
|
+
automatic,
|
|
93
|
+
isDirty,
|
|
94
|
+
isValid
|
|
95
|
+
} = useBase();
|
|
96
|
+
const {
|
|
97
|
+
host_static_assets,
|
|
98
|
+
environment_assets
|
|
99
|
+
} = useEnvironment();
|
|
100
|
+
if (isSkeleton) {
|
|
101
|
+
return /* @__PURE__ */ jsx(SKTWrapperFilterButton, {
|
|
102
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
103
|
+
variant: "circular",
|
|
104
|
+
width: 20,
|
|
105
|
+
height: 20
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const color = useMemo(() => {
|
|
110
|
+
if (automatic || !isDirty) {
|
|
111
|
+
return "action.active";
|
|
112
|
+
}
|
|
113
|
+
if (!isValid) {
|
|
114
|
+
return "error.main";
|
|
115
|
+
}
|
|
116
|
+
return "primary.main";
|
|
117
|
+
}, [automatic, isValid, isDirty]);
|
|
118
|
+
return /* @__PURE__ */ jsx(WrapperFilterButton, {
|
|
119
|
+
id: "WrapperFilterButton",
|
|
120
|
+
className: isDirty && isValid ? "isDirty" : "",
|
|
121
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
122
|
+
bgColor: color,
|
|
123
|
+
dictionaryTooltip: "dynamic_filter.filter_tooltip",
|
|
124
|
+
onClick: () => fireOnChangeFilters(),
|
|
125
|
+
"aria-label": "settings",
|
|
126
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/${automatic ? "refresh" : "search"}.svg`
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function ImageButton({
|
|
131
|
+
src,
|
|
132
|
+
width,
|
|
133
|
+
height,
|
|
134
|
+
className,
|
|
135
|
+
useIntersectionObserver,
|
|
136
|
+
skeletonVariant = "circle",
|
|
137
|
+
tooltip,
|
|
138
|
+
dictionaryTooltip,
|
|
139
|
+
sx = {
|
|
140
|
+
width: 40,
|
|
141
|
+
height: 40
|
|
142
|
+
},
|
|
143
|
+
...other
|
|
144
|
+
}) {
|
|
145
|
+
const {
|
|
146
|
+
getLabel
|
|
147
|
+
} = useModuleDictionary();
|
|
148
|
+
const finalTooltip = useMemo(() => {
|
|
149
|
+
if (dictionaryTooltip && getLabel) {
|
|
150
|
+
return getLabel(dictionaryTooltip);
|
|
151
|
+
}
|
|
152
|
+
return tooltip;
|
|
153
|
+
}, [tooltip, dictionaryTooltip, getLabel]);
|
|
154
|
+
const imageButton = useMemo(() => {
|
|
155
|
+
return /* @__PURE__ */ jsx(IconButton$1, {
|
|
156
|
+
sx,
|
|
157
|
+
className: `m4l_image_button ${className ? className : ""}`,
|
|
158
|
+
...other,
|
|
159
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
160
|
+
src,
|
|
161
|
+
width,
|
|
162
|
+
height,
|
|
163
|
+
useIntersectionObserver,
|
|
164
|
+
skeletonVariant
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
}, [src, width, height, useIntersectionObserver, skeletonVariant, sx]);
|
|
168
|
+
return finalTooltip ? /* @__PURE__ */ jsx(Tooltip, {
|
|
169
|
+
title: finalTooltip || "",
|
|
170
|
+
children: imageButton
|
|
171
|
+
}) : imageButton;
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
Button as B,
|
|
175
|
+
FilterButton as F,
|
|
176
|
+
ImageButton as I,
|
|
177
|
+
LoadingButton as L
|
|
178
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { CircularProgress as
|
|
2
|
-
import { jsx
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CircularProgress as CircularProgress$1 } from "@mui/material";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const CircularProgress = (props) => {
|
|
4
|
+
return /* @__PURE__ */ jsx(CircularProgress$1, {
|
|
5
|
+
...props
|
|
6
|
+
});
|
|
7
|
+
};
|
|
6
8
|
export {
|
|
7
|
-
|
|
9
|
+
CircularProgress as C
|
|
8
10
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { m } from "framer-motion";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { IconButton as IconButton$1, Box, Skeleton, Tooltip } from "@mui/material";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
6
|
+
import { I as Icon } from "../../Icon/index.619c31c4.js";
|
|
7
|
+
const varSmall = {
|
|
8
|
+
hover: {
|
|
9
|
+
scale: 1.1
|
|
10
|
+
},
|
|
11
|
+
tap: {
|
|
12
|
+
scale: 0.95
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const varMedium = {
|
|
16
|
+
hover: {
|
|
17
|
+
scale: 1.09
|
|
18
|
+
},
|
|
19
|
+
tap: {
|
|
20
|
+
scale: 0.97
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const varLarge = {
|
|
24
|
+
hover: {
|
|
25
|
+
scale: 1.08
|
|
26
|
+
},
|
|
27
|
+
tap: {
|
|
28
|
+
scale: 0.99
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function AnimateWrap({
|
|
32
|
+
size,
|
|
33
|
+
children
|
|
34
|
+
}) {
|
|
35
|
+
const isSmall = size === "small";
|
|
36
|
+
const isLarge = size === "large";
|
|
37
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
38
|
+
component: m.div,
|
|
39
|
+
whileTap: "tap",
|
|
40
|
+
whileHover: "hover",
|
|
41
|
+
variants: isSmall && varSmall || isLarge && varLarge || varMedium,
|
|
42
|
+
sx: {
|
|
43
|
+
display: "inline-flex"
|
|
44
|
+
},
|
|
45
|
+
children
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const IconButtonAnimate = forwardRef(({
|
|
49
|
+
children,
|
|
50
|
+
size = "medium",
|
|
51
|
+
...other
|
|
52
|
+
}, ref) => /* @__PURE__ */ jsx(AnimateWrap, {
|
|
53
|
+
size,
|
|
54
|
+
children: /* @__PURE__ */ jsx(IconButton$1, {
|
|
55
|
+
size,
|
|
56
|
+
ref,
|
|
57
|
+
...other,
|
|
58
|
+
children
|
|
59
|
+
})
|
|
60
|
+
}));
|
|
61
|
+
IconButtonAnimate.displayName = "IconButtonAnimate";
|
|
62
|
+
const SkeletonIconButton = () => {
|
|
63
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
64
|
+
variant: "circular",
|
|
65
|
+
width: "30px",
|
|
66
|
+
height: "30px"
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
function IconButton({
|
|
70
|
+
src,
|
|
71
|
+
tooltip,
|
|
72
|
+
size = "small",
|
|
73
|
+
dictionaryTooltip,
|
|
74
|
+
bgColor = "primary.active",
|
|
75
|
+
rotationAngle,
|
|
76
|
+
angleTransition,
|
|
77
|
+
...other
|
|
78
|
+
}) {
|
|
79
|
+
const {
|
|
80
|
+
getLabel
|
|
81
|
+
} = useModuleDictionary();
|
|
82
|
+
const isSkeleton = useModuleSkeleton();
|
|
83
|
+
const finalTooltip = useMemo(() => {
|
|
84
|
+
if (other.disabled) {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
if (dictionaryTooltip && getLabel) {
|
|
88
|
+
return getLabel(dictionaryTooltip);
|
|
89
|
+
}
|
|
90
|
+
return tooltip;
|
|
91
|
+
}, [dictionaryTooltip, getLabel, other.disabled]);
|
|
92
|
+
if (isSkeleton) {
|
|
93
|
+
return /* @__PURE__ */ jsx(SkeletonIconButton, {});
|
|
94
|
+
}
|
|
95
|
+
return finalTooltip ? /* @__PURE__ */ jsx(Tooltip, {
|
|
96
|
+
title: finalTooltip || "",
|
|
97
|
+
children: /* @__PURE__ */ jsx(IconButton$1, {
|
|
98
|
+
size,
|
|
99
|
+
...other,
|
|
100
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
101
|
+
src,
|
|
102
|
+
bgColor: other.disabled ? "action.disabled" : bgColor,
|
|
103
|
+
rotationAngle
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}) : /* @__PURE__ */ jsx(IconButton$1, {
|
|
107
|
+
size,
|
|
108
|
+
...other,
|
|
109
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
110
|
+
src,
|
|
111
|
+
bgColor: other.disabled ? "action.disabled" : bgColor,
|
|
112
|
+
rotationAngle,
|
|
113
|
+
angleTransition
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
IconButton as I,
|
|
119
|
+
IconButtonAnimate as a
|
|
120
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconButtonProps as MUIIconButtonProps } from '@mui/material';
|
|
3
3
|
import { IconButtonProps } from './types';
|
|
4
|
-
export declare function IconButton({ src, tooltip, size, dictionaryTooltip, bgColor,
|
|
4
|
+
export declare function IconButton({ src, tooltip, size, dictionaryTooltip, bgColor, rotationAngle, angleTransition, ...other }: IconButtonProps & MUIIconButtonProps): JSX.Element;
|