@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.
Files changed (112) hide show
  1. package/assets/Logo/index.228dcb5a.js +42 -35
  2. package/commonjs.565e6834.js +5 -5
  3. package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
  6. package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
  7. package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
  8. package/components/DataGrid/index.76d8fd25.js +1075 -0
  9. package/components/DynamicFilter/index.342ba5fe.js +1577 -0
  10. package/components/ErrorLabel/index.c8615f16.js +13 -12
  11. package/components/Icon/index.619c31c4.js +96 -0
  12. package/components/Icon/types.d.ts +2 -1
  13. package/components/Image/index.93d5f37f.js +190 -0
  14. package/components/Loadable/index.f5518558.js +8 -8
  15. package/components/ModalDialog/index.9ea10764.js +184 -0
  16. package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
  17. package/components/ObjectLogs/index.f941fb79.js +288 -0
  18. package/components/Page/index.4237c241.js +22 -20
  19. package/components/PaperForm/index.ec9cb8c9.js +112 -0
  20. package/components/Period/index.2941fbda.js +249 -0
  21. package/components/PropertyValue/index.dfcfe1ba.js +147 -0
  22. package/components/PropertyValue/styles.d.ts +2 -1
  23. package/components/PropertyValue/types.d.ts +3 -3
  24. package/components/Resizeable/index.45995d2b.js +19 -19
  25. package/components/ScrollBar/index.39eeb2de.js +26 -21
  26. package/components/ScrollToTop/index.e06f98f6.js +8 -7
  27. package/components/SplitLayout/index.4032673d.js +35 -33
  28. package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
  29. package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
  30. package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
  31. package/components/animate/features.0fbf41e1.js +3 -3
  32. package/components/animate/variants/bounce.784aaaaa.js +16 -13
  33. package/components/animate/variants/container.11f82b76.js +8 -6
  34. package/components/animate/variants/fade.b561c0fc.js +32 -28
  35. package/components/animate/variants/transition.bd46b9ce.js +17 -12
  36. package/components/formatters/BooleanFormatter/index.8da35c9c.js +55 -0
  37. package/components/formatters/DateFormatter/index.1b9baacc.js +69 -0
  38. package/components/formatters/index.689a8086.js +119 -0
  39. package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
  40. package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
  41. package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
  42. package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
  43. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
  44. package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
  45. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
  46. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
  47. package/components/hook-form/RHFTextField/index.f9aaaa90.js +146 -0
  48. package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/index.d.ts +0 -0
  49. package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/styles.d.ts +4 -3
  50. package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/index.d.ts +0 -0
  51. package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -0
  52. package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/types.d.ts +0 -0
  53. package/components/hook-form/RHFUpload/index.d5cc7c13.js +285 -0
  54. package/components/mui_extended/Accordion/index.a02ac6ae.js +107 -0
  55. package/components/mui_extended/Avatar/index.fe06afd7.js +51 -0
  56. package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
  57. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
  58. package/components/mui_extended/Button/index.53b56958.js +178 -0
  59. package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
  60. package/components/mui_extended/IconButton/index.a321e5cb.js +120 -0
  61. package/components/mui_extended/IconButton/index.d.ts +1 -1
  62. package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
  63. package/components/mui_extended/Pager/index.c0865b70.js +141 -0
  64. package/components/mui_extended/Popover/index.705275a4.js +278 -0
  65. package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
  66. package/components/mui_extended/Typography/index.e5494696.js +25 -21
  67. package/contexts/ModalContext/index.b92fa565.js +153 -0
  68. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
  69. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
  70. package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
  71. package/contexts/RHFormContext/index.b142190a.js +63 -0
  72. package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
  73. package/hooks/useModal/index.5fee01a3.js +11 -0
  74. package/index.js +153 -153
  75. package/package.json +2 -1
  76. package/react-data-grid.d46d625e.js +2206 -1663
  77. package/react-draggable.20e95c61.js +800 -553
  78. package/react-json-view.f56a7f8e.js +2344 -2340
  79. package/react-resizable.5277deaf.js +470 -298
  80. package/react-splitter-layout.7810ac1b.js +130 -128
  81. package/utils/index.214d9542.js +500 -354
  82. package/components/CommonActions/components/ActionCancel/index.6736b782.js +0 -17
  83. package/components/CommonActions/components/ActionFormCancel/index.281ee166.js +0 -49
  84. package/components/CommonActions/components/ActionIntro/index.4665a611.js +0 -18
  85. package/components/CommonActions/components/Actions/index.cd7b2671.js +0 -742
  86. package/components/DataGrid/index.2caf6231.js +0 -894
  87. package/components/DynamicFilter/index.f2377369.js +0 -1157
  88. package/components/Icon/index.f569765b.js +0 -82
  89. package/components/Image/index.c9da2d5a.js +0 -152
  90. package/components/ModalDialog/index.bee344a5.js +0 -168
  91. package/components/ObjectLogs/index.6b6f95e6.js +0 -266
  92. package/components/PaperForm/index.3f8c7ef2.js +0 -105
  93. package/components/Period/index.a112ce37.js +0 -175
  94. package/components/PropertyValue/index.ab3dd7e9.js +0 -116
  95. package/components/contexts/RHFormContext/index.33dba822.js +0 -56
  96. package/components/formatters/BooleanFormatter/index.3ec56305.js +0 -42
  97. package/components/formatters/DateFormatter/index.08d8823b.js +0 -57
  98. package/components/formatters/index.6959c2de.js +0 -106
  99. package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
  100. package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
  101. package/components/hook-form/RHFPeriod/index.979d0898.js +0 -51
  102. package/components/hook-form/RHFTextField/index.ba2a8f67.js +0 -129
  103. package/components/hook-form/RHFUpload/index.6347159a.js +0 -258
  104. package/components/mui_extended/Accordion/index.49f5df8e.js +0 -103
  105. package/components/mui_extended/Avatar/index.dadb0528.js +0 -37
  106. package/components/mui_extended/Button/index.52d18aea.js +0 -144
  107. package/components/mui_extended/IconButton/index.4b5ce8b5.js +0 -103
  108. package/components/mui_extended/Pager/index.951b6975.js +0 -126
  109. package/components/mui_extended/Popover/index.4da8587a.js +0 -252
  110. package/contexts/ModalContext/index.5388dfd5.js +0 -136
  111. package/hooks/useModal/index.3b1ff084.js +0 -11
  112. package/node_modules.168cb897.js +0 -55
@@ -1,43 +1,43 @@
1
- import { useFormContext as s, Controller as u } from "react-hook-form";
2
- import { RadioGroup as c, FormControlLabel as x, Radio as p, FormHelperText as f } from "@mui/material";
3
- import { jsx as r, jsxs as R } from "react/jsx-runtime";
4
- function j({
5
- name: l,
6
- options: m,
7
- getOptionLabel: e,
8
- ...n
1
+ import { useFormContext, Controller } from "react-hook-form";
2
+ import { RadioGroup, FormControlLabel, Radio, FormHelperText } from "@mui/material";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ function RHFRadioGroup({
5
+ name,
6
+ options,
7
+ getOptionLabel,
8
+ ...other
9
9
  }) {
10
10
  const {
11
- control: a
12
- } = s();
13
- return /* @__PURE__ */ r(u, {
14
- name: l,
15
- control: a,
11
+ control
12
+ } = useFormContext();
13
+ return /* @__PURE__ */ jsx(Controller, {
14
+ name,
15
+ control,
16
16
  render: ({
17
- field: d,
17
+ field,
18
18
  fieldState: {
19
- error: t
19
+ error
20
20
  }
21
- }) => /* @__PURE__ */ R("div", {
22
- children: [/* @__PURE__ */ r(c, {
23
- ...d,
24
- row: !0,
25
- ...n,
26
- children: m.map((o, i) => /* @__PURE__ */ r(x, {
27
- value: o,
28
- control: /* @__PURE__ */ r(p, {}),
29
- label: e?.length ? e[i] : o
30
- }, o))
31
- }), !!t && /* @__PURE__ */ r(f, {
32
- error: !0,
21
+ }) => /* @__PURE__ */ jsxs("div", {
22
+ children: [/* @__PURE__ */ jsx(RadioGroup, {
23
+ ...field,
24
+ row: true,
25
+ ...other,
26
+ children: options.map((option, index) => /* @__PURE__ */ jsx(FormControlLabel, {
27
+ value: option,
28
+ control: /* @__PURE__ */ jsx(Radio, {}),
29
+ label: getOptionLabel?.length ? getOptionLabel[index] : option
30
+ }, option))
31
+ }), !!error && /* @__PURE__ */ jsx(FormHelperText, {
32
+ error: true,
33
33
  sx: {
34
34
  px: 2
35
35
  },
36
- children: t.message
36
+ children: error.message
37
37
  })]
38
38
  })
39
39
  });
40
40
  }
41
41
  export {
42
- j as R
42
+ RHFRadioGroup as R
43
43
  };
@@ -1,36 +1,36 @@
1
- import { useFormContext as m, Controller as s } from "react-hook-form";
2
- import { TextField as u } from "@mui/material";
3
- import { jsx as t } from "react/jsx-runtime";
4
- function x({
5
- name: r,
6
- children: o,
7
- ...l
1
+ import { useFormContext, Controller } from "react-hook-form";
2
+ import { TextField } from "@mui/material";
3
+ import { jsx } from "react/jsx-runtime";
4
+ function RHFSelect({
5
+ name,
6
+ children,
7
+ ...other
8
8
  }) {
9
9
  const {
10
- control: n
11
- } = m();
12
- return /* @__PURE__ */ t(s, {
13
- name: r,
14
- control: n,
10
+ control
11
+ } = useFormContext();
12
+ return /* @__PURE__ */ jsx(Controller, {
13
+ name,
14
+ control,
15
15
  render: ({
16
- field: i,
16
+ field,
17
17
  fieldState: {
18
- error: e
18
+ error
19
19
  }
20
- }) => /* @__PURE__ */ t(u, {
21
- ...i,
22
- select: !0,
23
- fullWidth: !0,
20
+ }) => /* @__PURE__ */ jsx(TextField, {
21
+ ...field,
22
+ select: true,
23
+ fullWidth: true,
24
24
  SelectProps: {
25
- native: !0
25
+ native: true
26
26
  },
27
- error: !!e,
28
- helperText: e?.message,
29
- ...l,
30
- children: o
27
+ error: !!error,
28
+ helperText: error?.message,
29
+ ...other,
30
+ children
31
31
  })
32
32
  });
33
33
  }
34
34
  export {
35
- x as R
35
+ RHFSelect as R
36
36
  };
@@ -0,0 +1,146 @@
1
+ import { useModuleSkeleton, useEnvironment } from "@m4l/core";
2
+ import { styled, Skeleton, TextField, InputAdornment } from "@mui/material";
3
+ import { forwardRef, useState } from "react";
4
+ import { I as IconButton } from "../../mui_extended/IconButton/index.a321e5cb.js";
5
+ import { useFormContext, Controller } from "react-hook-form";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ const WrapperSkeletonRHFTextField = styled("div")(({
8
+ theme
9
+ }) => ({
10
+ display: "flex",
11
+ width: "100%",
12
+ height: "42.25px",
13
+ alignItems: "center",
14
+ justifyContent: "space-between",
15
+ border: `1px solid ${theme.palette.divider}`,
16
+ padding: "12px 14px",
17
+ borderRadius: theme.spacing(1)
18
+ }));
19
+ const SkeletonTextField = (props) => {
20
+ const {
21
+ skeletonWidth,
22
+ skeletonHeight,
23
+ skeletonVariant
24
+ } = props;
25
+ if (skeletonVariant === "text") {
26
+ return /* @__PURE__ */ jsx(WrapperSkeletonRHFTextField, {
27
+ children: /* @__PURE__ */ jsx(Skeleton, {
28
+ variant: "text",
29
+ width: skeletonWidth,
30
+ height: skeletonHeight
31
+ })
32
+ });
33
+ }
34
+ return /* @__PURE__ */ jsxs(WrapperSkeletonRHFTextField, {
35
+ children: [/* @__PURE__ */ jsx(Skeleton, {
36
+ variant: "text",
37
+ width: skeletonWidth,
38
+ height: skeletonHeight
39
+ }), /* @__PURE__ */ jsx(Skeleton, {
40
+ variant: "circular",
41
+ width: "20px",
42
+ height: "20px"
43
+ })]
44
+ });
45
+ };
46
+ const RHFTextField = forwardRef((props, inputRef) => {
47
+ const {
48
+ name: nameRHF,
49
+ autoComplete = "off",
50
+ skeletonWidth = "100%",
51
+ skeletonHeight = "18px",
52
+ type,
53
+ skeletonVariant = "text",
54
+ ...other
55
+ } = props;
56
+ const isSkeleton = useModuleSkeleton();
57
+ const {
58
+ control
59
+ } = useFormContext();
60
+ if (isSkeleton) {
61
+ return /* @__PURE__ */ jsx(SkeletonTextField, {
62
+ skeletonWidth,
63
+ skeletonHeight,
64
+ skeletonVariant
65
+ });
66
+ }
67
+ return /* @__PURE__ */ jsx(Controller, {
68
+ name: nameRHF,
69
+ control,
70
+ render: ({
71
+ field: {
72
+ onChange,
73
+ onBlur,
74
+ value,
75
+ name,
76
+ ref
77
+ },
78
+ fieldState: {
79
+ error
80
+ }
81
+ }) => {
82
+ const onInternalChange = (event) => {
83
+ if (type === "number") {
84
+ if (event.target.value) {
85
+ onChange(Number(event.target.value));
86
+ return;
87
+ }
88
+ }
89
+ onChange(event);
90
+ };
91
+ return /* @__PURE__ */ jsx(
92
+ TextField,
93
+ {
94
+ inputRef,
95
+ autoComplete,
96
+ onChange: onInternalChange,
97
+ onBlur,
98
+ value: value || "",
99
+ name,
100
+ ref,
101
+ fullWidth: true,
102
+ error: !!error,
103
+ helperText: error?.message,
104
+ type,
105
+ ...other
106
+ }
107
+ );
108
+ }
109
+ });
110
+ });
111
+ RHFTextField.displayName = "RHFTextField";
112
+ const RHFTextFieldPassword = (props) => {
113
+ const {
114
+ name,
115
+ label,
116
+ skeletonWidth,
117
+ skeletonHeight
118
+ } = props;
119
+ const [showPassword, setShowPassword] = useState(false);
120
+ const {
121
+ host_static_assets,
122
+ environment_assets
123
+ } = useEnvironment();
124
+ return /* @__PURE__ */ jsx(RHFTextField, {
125
+ name,
126
+ label,
127
+ type: showPassword ? "text" : "password",
128
+ skeletonVariant: "password",
129
+ autoComplete: "on",
130
+ skeletonWidth,
131
+ skeletonHeight,
132
+ InputProps: {
133
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, {
134
+ position: "end",
135
+ children: /* @__PURE__ */ jsx(IconButton, {
136
+ onClick: () => setShowPassword(!showPassword),
137
+ src: showPassword ? `${host_static_assets}/${environment_assets}/frontend/domain/host/login/assets/icons/eye.svg` : `${host_static_assets}/${environment_assets}/frontend/domain/host/login/assets/icons/eye_off.svg`
138
+ })
139
+ })
140
+ }
141
+ });
142
+ };
143
+ export {
144
+ RHFTextField as R,
145
+ RHFTextFieldPassword as a
146
+ };
@@ -4,8 +4,9 @@ export declare const DropZoneStyle: import("@emotion/styled").StyledComponent<im
4
4
  export declare const PlaceholderStyle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
5
  export declare const ContainerUploadBody: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
6
  export declare const Containermessage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
- export declare const ContainerTitle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
8
- export declare const ContainerDescription: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
9
- export declare const ContainerConditions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
7
+ export declare const ContainerTitle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
+ export declare const ContainerDescription: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export declare const ContainerConditions: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
10
  export declare const WrapperImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
11
11
  export declare const ContainerPlaceHolder: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
+ export declare const WrapperFileImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,285 @@
1
+ import { styled as styled$1, Skeleton, FormHelperText } from "@mui/material";
2
+ import { useCallback } from "react";
3
+ import { useFormContext, Controller } from "react-hook-form";
4
+ import isString from "lodash/isString";
5
+ import { useDropzone } from "react-dropzone";
6
+ import { styled, alpha } from "@mui/material/styles";
7
+ import { I as Image } from "../../Image/index.93d5f37f.js";
8
+ import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
9
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
10
+ const WrapperUploadImage = styled("div")(({
11
+ theme
12
+ }) => ({
13
+ width: "inherit",
14
+ height: "100%",
15
+ minHeight: "200px",
16
+ minWidth: theme.spacing(20),
17
+ margin: "auto",
18
+ borderRadius: theme.spacing(1),
19
+ padding: theme.spacing(1),
20
+ border: `1px dashed ${theme.palette.divider}`
21
+ }));
22
+ const DropZoneStyle = styled("div")(({
23
+ theme
24
+ }) => ({
25
+ zIndex: 0,
26
+ width: "100%",
27
+ height: "100%",
28
+ outline: "none",
29
+ display: "flex",
30
+ overflow: "hidden",
31
+ borderRadius: theme.spacing(1),
32
+ position: "relative",
33
+ alignItems: "center",
34
+ justifyContent: "center",
35
+ "& > *": {
36
+ width: "100%",
37
+ height: "100%"
38
+ },
39
+ "&:hover": {
40
+ cursor: "pointer",
41
+ "& .placeholder": {
42
+ zIndex: 9
43
+ }
44
+ }
45
+ }));
46
+ const PlaceholderStyle = styled("div")(({
47
+ theme
48
+ }) => ({
49
+ "&:hover": {
50
+ opacity: 1
51
+ },
52
+ display: "flex",
53
+ justifyContent: "center",
54
+ position: "absolute",
55
+ zIndex: "2",
56
+ inset: "0",
57
+ transition: theme.transitions.create("opacity", {
58
+ easing: theme.transitions.easing.easeInOut,
59
+ duration: theme.transitions.duration.shorter
60
+ }),
61
+ overflow: "auto"
62
+ }));
63
+ const ContainerUploadBody = styled("div")(({
64
+ theme
65
+ }) => ({
66
+ padding: theme.spacing(3, 5),
67
+ display: "flex",
68
+ flexDirection: "column",
69
+ justifyContent: "center",
70
+ width: "100%",
71
+ height: "100%",
72
+ gap: theme.spacing(3)
73
+ }));
74
+ const Containermessage = styled("div")(({
75
+ theme
76
+ }) => ({
77
+ display: "flex",
78
+ justifyContent: "center",
79
+ flexDirection: "column",
80
+ gap: theme.spacing(1)
81
+ }));
82
+ const ContainerTitle = styled("div")(({
83
+ theme
84
+ }) => ({
85
+ ...theme.typography.subtitle1,
86
+ textAlign: "center"
87
+ }));
88
+ const ContainerDescription = styled("div")(({
89
+ theme
90
+ }) => ({
91
+ ...theme.typography.body2,
92
+ textAlign: "center"
93
+ }));
94
+ const ContainerConditions = styled("div")(({
95
+ theme
96
+ }) => ({
97
+ ...theme.typography.caption,
98
+ textAlign: "center"
99
+ }));
100
+ const WrapperImage = styled("div")(() => ({
101
+ display: "flex",
102
+ justifyContent: "center"
103
+ }));
104
+ styled("div")(() => ({
105
+ width: "100%",
106
+ height: "100%",
107
+ position: "absolute",
108
+ inset: "0",
109
+ display: "flex",
110
+ justifyContent: "center",
111
+ alignItems: "center"
112
+ }));
113
+ const WrapperFileImage = styled("div")(() => ({
114
+ "& .m4l_image > img": {
115
+ objectFit: "cover",
116
+ width: "auto",
117
+ margin: "0 auto"
118
+ }
119
+ }));
120
+ const MaskSkeletonUploadImage = styled$1("div")(({
121
+ theme
122
+ }) => ({
123
+ maskPosition: "center!important",
124
+ maskRepeat: "no-repeat!important",
125
+ WebkitMaskRepeat: "no-repeat!important",
126
+ border: `1px dashed ${theme.palette.divider}`,
127
+ width: "100%",
128
+ height: "100%",
129
+ mask: `url('data:image/svg+xml;base64, PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjMuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaH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AuMS0xLjYtMC40cy0wLjktMC42LTEuMi0xLjEKCQljLTAuMi0wLjUtMC40LTEtMC40LTEuNXMwLjEtMS4xLDAuNC0xLjVsMjMtMzYuNGMwLjMtMC41LDAuNy0wLjgsMS4yLTEuMXMxLTAuNCwxLjYtMC40czEuMSwwLjEsMS42LDAuNHMwLjksMC42LDEuMiwxLjEKCQlsMTEuNSwxOC4yYzAuMiwwLjMsMC41LDAuNSwwLjgsMC43czAuNiwwLjMsMSwwLjNjMC4zLDAsMC43LTAuMSwxLTAuM3MwLjYtMC40LDAuOC0wLjdsMy4xLTQuOWMwLjMtMC41LDAuNy0wLjgsMS4yLTEuMQoJCXMxLTAuNCwxLjYtMC40czEuMSwwLjEsMS42LDAuNGMwLjUsMC4zLDAuOSwwLjYsMS4yLDEuMWwxNC42LDIzLjFjMC4zLDAuNSwwLjMsMSwwLjMsMS41UzY4LjcsNjEuNyw2OC40LDYyLjF6Ii8+CjwvZz4KPC9zdmc+Cg==')`
131
+ }));
132
+ const SkeletonUploadImage = () => {
133
+ return /* @__PURE__ */ jsx(WrapperUploadImage, {
134
+ children: /* @__PURE__ */ jsx(MaskSkeletonUploadImage, {
135
+ children: /* @__PURE__ */ jsx(Skeleton, {
136
+ variant: "rectangular",
137
+ width: "100%",
138
+ height: "100%"
139
+ })
140
+ })
141
+ });
142
+ };
143
+ function UploadImage({
144
+ error,
145
+ file,
146
+ helperText,
147
+ sx,
148
+ ...other
149
+ }) {
150
+ const {
151
+ getRootProps,
152
+ getInputProps,
153
+ isDragActive,
154
+ isDragReject
155
+ } = useDropzone({
156
+ multiple: false,
157
+ ...other
158
+ });
159
+ const {
160
+ host_static_assets,
161
+ environment_assets
162
+ } = useEnvironment();
163
+ const {
164
+ getLabel
165
+ } = useModuleDictionary();
166
+ const isSkeleton = useModuleSkeleton();
167
+ if (isSkeleton) {
168
+ return /* @__PURE__ */ jsx(SkeletonUploadImage, {});
169
+ }
170
+ return /* @__PURE__ */ jsxs(Fragment, {
171
+ children: [/* @__PURE__ */ jsx(WrapperUploadImage, {
172
+ sx: {
173
+ ...(isDragReject || error) && {
174
+ borderColor: "error.light"
175
+ },
176
+ ...sx
177
+ },
178
+ children: /* @__PURE__ */ jsxs(DropZoneStyle, {
179
+ ...getRootProps(),
180
+ sx: {
181
+ ...isDragActive && {
182
+ opacity: 0.72
183
+ }
184
+ },
185
+ children: [/* @__PURE__ */ jsx("input", {
186
+ ...getInputProps()
187
+ }), file && /* @__PURE__ */ jsx(WrapperFileImage, {
188
+ children: /* @__PURE__ */ jsx(Image, {
189
+ alt: "avatar",
190
+ src: isString(file) ? file : file.preview || "",
191
+ width: "auto",
192
+ height: "100%"
193
+ })
194
+ }), /* @__PURE__ */ jsx(PlaceholderStyle, {
195
+ id: "PlaceholderStyle",
196
+ className: "placeholder",
197
+ sx: {
198
+ ...file ? {
199
+ bgcolor: alpha("#161C24", 0.72),
200
+ color: "common.white",
201
+ opacity: 0
202
+ } : {
203
+ opacity: 1
204
+ },
205
+ ...(isDragReject || error) && {
206
+ bgcolor: "error.lighter",
207
+ borderColor: "error.light",
208
+ color: "error.main"
209
+ }
210
+ },
211
+ children: /* @__PURE__ */ jsxs(ContainerUploadBody, {
212
+ className: "ContainerUploadBody",
213
+ children: [/* @__PURE__ */ jsx(WrapperImage, {
214
+ children: /* @__PURE__ */ jsx(Image, {
215
+ src: `${host_static_assets}/${environment_assets}/frontend/components/upload_image/assets/img/upload_image_illustration.svg`,
216
+ width: "100px",
217
+ height: "100px"
218
+ })
219
+ }), /* @__PURE__ */ jsxs(Containermessage, {
220
+ children: [/* @__PURE__ */ jsx(ContainerTitle, {
221
+ children: getLabel("upload_image.title_upload")
222
+ }), /* @__PURE__ */ jsx(ContainerDescription, {
223
+ children: getLabel("upload_image.description")
224
+ }), /* @__PURE__ */ jsx(ContainerConditions, {
225
+ children: getLabel("upload_image.conditions")
226
+ })]
227
+ })]
228
+ })
229
+ })]
230
+ })
231
+ }), helperText && helperText]
232
+ });
233
+ }
234
+ const WrapperRHFUploadImage = styled$1("div")(() => ({
235
+ width: "inherit",
236
+ height: "inherit",
237
+ padding: "1px"
238
+ }));
239
+ function RHFUploadImage({
240
+ name,
241
+ ...other
242
+ }) {
243
+ const {
244
+ control,
245
+ setValue
246
+ } = useFormContext();
247
+ const handleDrop = useCallback((acceptedFiles) => {
248
+ const file = acceptedFiles[0];
249
+ if (file) {
250
+ setValue(name, Object.assign(file, {
251
+ preview: URL.createObjectURL(file)
252
+ }));
253
+ }
254
+ }, [setValue]);
255
+ return /* @__PURE__ */ jsx(Controller, {
256
+ name,
257
+ control,
258
+ render: ({
259
+ field,
260
+ fieldState: {
261
+ error
262
+ }
263
+ }) => {
264
+ const checkError = !!error && !field.value;
265
+ return /* @__PURE__ */ jsxs(WrapperRHFUploadImage, {
266
+ children: [/* @__PURE__ */ jsx(UploadImage, {
267
+ onDrop: handleDrop,
268
+ error: checkError,
269
+ ...other,
270
+ file: field.value
271
+ }), checkError && /* @__PURE__ */ jsx(FormHelperText, {
272
+ error: true,
273
+ sx: {
274
+ px: 2,
275
+ textAlign: "center"
276
+ },
277
+ children: error.message
278
+ })]
279
+ });
280
+ }
281
+ });
282
+ }
283
+ export {
284
+ RHFUploadImage as R
285
+ };