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