@m4l/components 0.1.20 → 0.1.22

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 (30) hide show
  1. package/components/CommonActions/components/ActionCancel/{index.3775989f.js → index.7b862bd3.js} +1 -1
  2. package/components/CommonActions/components/ActionFormCancel/{index.d69d9e0f.js → index.b59a0011.js} +2 -2
  3. package/components/CommonActions/components/ActionIntro/{index.ca7b6952.js → index.35c8757f.js} +1 -1
  4. package/components/CommonActions/components/Actions/{index.a908e4b9.js → index.edceed6b.js} +7 -7
  5. package/components/DataGrid/{index.5cbf0dd8.js → index.cd4fff69.js} +3 -3
  6. package/components/DynamicFilter/{index.8a571617.js → index.4d3c60b4.js} +19 -18
  7. package/components/ModalDialog/{index.16024a4e.js → index.e1f31e50.js} +2 -2
  8. package/components/ObjectLogs/{index.ac2bfa48.js → index.9c43ba69.js} +3 -3
  9. package/components/Period/{index.497b8df4.js → index.ba6c0e11.js} +2 -2
  10. package/components/contexts/RHFormContext/{index.f8241292.js → index.33dba822.js} +12 -12
  11. package/components/hook-form/RHFAutocomplete/index.ee3d9b3c.js +171 -0
  12. package/components/hook-form/RHFAutocomplete/types.d.ts +3 -1
  13. package/components/hook-form/RHFAutocompleteAsync/index.3b3da5f6.js +73 -0
  14. package/components/hook-form/RHFAutocompleteAsync/types.d.ts +2 -1
  15. package/components/hook-form/RHFPeriod/{index.e17b1c72.js → index.fc3af81f.js} +1 -1
  16. package/components/hook-form/RHFUpload/{index.cbf11b68.js → index.56e2e277.js} +19 -19
  17. package/components/mui_extended/Button/{index.16591787.js → index.6df3e958.js} +4 -4
  18. package/components/mui_extended/Pager/{index.80c2f8a0.js → index.b072df6b.js} +1 -1
  19. package/components/mui_extended/Popover/{index.305f2ea5.js → index.d708b699.js} +3 -3
  20. package/contexts/ModalContext/index.33dc1be9.js +136 -0
  21. package/contexts/ModalContext/index.d.ts +1 -1
  22. package/hooks/useModal/index.34cc1e55.js +11 -0
  23. package/hooks/useModal/index.d.ts +2 -1
  24. package/index.js +153 -152
  25. package/package.json +3 -3
  26. package/components/hook-form/RHFAutocomplete/index.b7f11146.js +0 -146
  27. package/components/hook-form/RHFAutocompleteAsync/index.97a5a66e.js +0 -51
  28. package/contexts/ModalContext/index.699767c7.js +0 -150
  29. package/hooks/useModal/index.8201ccec.js +0 -6
  30. package/lodash.e09401f0.js +0 -32
@@ -1,13 +1,13 @@
1
1
  import { styled as y, FormHelperText as f } from "@mui/material";
2
2
  import { useCallback as x } from "react";
3
3
  import { useFormContext as v, Controller as C } from "react-hook-form";
4
- import { i as w } from "../../../lodash.e09401f0.js";
4
+ import w from "lodash/isString";
5
5
  import { useDropzone as b } from "react-dropzone";
6
- import { styled as i, alpha as I } from "@mui/material/styles";
6
+ import { styled as o, alpha as I } from "@mui/material/styles";
7
7
  import { I as h } from "../../Image/index.c9da2d5a.js";
8
8
  import { useEnvironment as _, useModuleDictionary as R } from "@m4l/core";
9
9
  import { jsxs as a, Fragment as j, jsx as e } from "react/jsx-runtime";
10
- const D = i("div")(({
10
+ const D = o("div")(({
11
11
  theme: t
12
12
  }) => ({
13
13
  width: "inherit",
@@ -17,7 +17,7 @@ const D = i("div")(({
17
17
  borderRadius: t.spacing(1),
18
18
  padding: t.spacing(1),
19
19
  border: `1px dashed ${t.palette.grey[50032]}`
20
- })), S = i("div")(({
20
+ })), S = o("div")(({
21
21
  theme: t
22
22
  }) => ({
23
23
  zIndex: 0,
@@ -40,7 +40,7 @@ const D = i("div")(({
40
40
  zIndex: 9
41
41
  }
42
42
  }
43
- })), U = i("div")(({
43
+ })), U = o("div")(({
44
44
  theme: t
45
45
  }) => ({
46
46
  "&:hover": {
@@ -56,7 +56,7 @@ const D = i("div")(({
56
56
  duration: t.transitions.duration.shorter
57
57
  }),
58
58
  overflow: "auto"
59
- })), W = i("div")(({
59
+ })), W = o("div")(({
60
60
  theme: t
61
61
  }) => ({
62
62
  padding: t.spacing(3, 5),
@@ -66,36 +66,36 @@ const D = i("div")(({
66
66
  width: "100%",
67
67
  height: "100%",
68
68
  gap: t.spacing(3)
69
- })), F = i("div")(({
69
+ })), F = o("div")(({
70
70
  theme: t
71
71
  }) => ({
72
72
  display: "flex",
73
73
  justifyContent: "center",
74
74
  flexDirection: "column",
75
75
  gap: t.spacing(3)
76
- })), z = i("span")(({
76
+ })), z = o("span")(({
77
77
  theme: t
78
78
  }) => ({
79
79
  ...t.typography.subtitle2,
80
80
  width: "fit-content"
81
- })), P = i("span")(({
81
+ })), P = o("span")(({
82
82
  theme: t
83
83
  }) => ({
84
84
  ...t.typography.body2,
85
85
  minWidth: t.spacing(20)
86
- })), $ = i("span")(({
86
+ })), $ = o("span")(({
87
87
  theme: t
88
88
  }) => ({
89
89
  ...t.typography.caption,
90
90
  width: "fit-content"
91
- })), H = i("div")(({
91
+ })), H = o("div")(({
92
92
  theme: t
93
93
  }) => ({
94
94
  display: "flex",
95
95
  alignItems: "center",
96
96
  maxWidth: t.spacing(20)
97
97
  }));
98
- i("div")(() => ({
98
+ o("div")(() => ({
99
99
  width: "100%",
100
100
  height: "100%",
101
101
  position: "absolute",
@@ -106,7 +106,7 @@ i("div")(() => ({
106
106
  }));
107
107
  function L({
108
108
  error: t,
109
- file: o,
109
+ file: i,
110
110
  helperText: s,
111
111
  sx: l,
112
112
  ...c
@@ -144,15 +144,15 @@ function L({
144
144
  },
145
145
  children: [/* @__PURE__ */ e("input", {
146
146
  ...n()
147
- }), o && /* @__PURE__ */ e(h, {
147
+ }), i && /* @__PURE__ */ e(h, {
148
148
  alt: "avatar",
149
- src: w(o) ? o : o.preview || "",
149
+ src: w(i) ? i : i.preview || "",
150
150
  width: "100%"
151
151
  }), /* @__PURE__ */ e(U, {
152
152
  id: "PlaceholderStyle",
153
153
  className: "placeholder",
154
154
  sx: {
155
- ...o ? {
155
+ ...i ? {
156
156
  bgcolor: I("#161C24", 0.72),
157
157
  color: "common.white",
158
158
  opacity: 0
@@ -175,7 +175,7 @@ function L({
175
175
  })
176
176
  }), /* @__PURE__ */ a(F, {
177
177
  children: [/* @__PURE__ */ e(z, {
178
- children: p(o ? "upload_image.title_update" : "upload_image.title_upload")
178
+ children: p(i ? "upload_image.title_update" : "upload_image.title_upload")
179
179
  }), /* @__PURE__ */ e(P, {
180
180
  children: p("upload_image.description")
181
181
  }), /* @__PURE__ */ e($, {
@@ -195,7 +195,7 @@ const O = y("div")(() => ({
195
195
  }));
196
196
  function q({
197
197
  name: t,
198
- ...o
198
+ ...i
199
199
  }) {
200
200
  const {
201
201
  control: s,
@@ -220,7 +220,7 @@ function q({
220
220
  children: [/* @__PURE__ */ e(L, {
221
221
  onDrop: c,
222
222
  error: d,
223
- ...o,
223
+ ...i,
224
224
  file: r.value
225
225
  }), d && /* @__PURE__ */ e(f, {
226
226
  error: !0,
@@ -5,18 +5,18 @@ import { jsx as i } from "react/jsx-runtime";
5
5
  import { LoadingButton as b } from "@mui/lab";
6
6
  import { I as x } from "../IconButton/index.4b5ce8b5.js";
7
7
  import { styled as h, alpha as F } from "@mui/material/styles";
8
- import { u as L } from "../../DynamicFilter/index.8a571617.js";
8
+ import { u as L } from "../../DynamicFilter/index.4d3c60b4.js";
9
9
  import { useMemo as u } from "react";
10
10
  import { I as $ } from "../../Image/index.c9da2d5a.js";
11
- const G = (t) => g() ? /* @__PURE__ */ i(_, {
12
- ...t
13
- }) : /* @__PURE__ */ i(m, {
11
+ const G = (t) => g() ? /* @__PURE__ */ i(m, {
14
12
  sx: {
15
13
  borderRadius: 2
16
14
  },
17
15
  variant: "rectangular",
18
16
  width: "100px",
19
17
  height: "36px"
18
+ }) : /* @__PURE__ */ i(_, {
19
+ ...t
20
20
  }), D = S("div")(({
21
21
  theme: t
22
22
  }) => ({
@@ -1,6 +1,6 @@
1
1
  import { useMemo as y } from "react";
2
2
  import { Skeleton as i, TablePagination as R } from "@mui/material";
3
- import { P as S } from "../../CommonActions/components/Actions/index.a908e4b9.js";
3
+ import { P as S } from "../../CommonActions/components/Actions/index.edceed6b.js";
4
4
  import { styled as a } from "@mui/material/styles";
5
5
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
6
6
  a("div")(() => ({
@@ -11,9 +11,9 @@ import "../Avatar/index.dadb0528.js";
11
11
  import "react-router-dom";
12
12
  import "@mui/material/Button";
13
13
  import "@mui/lab";
14
- import { I as S } from "../Button/index.16591787.js";
15
- import "../../CommonActions/components/Actions/index.a908e4b9.js";
16
- import "../Pager/index.80c2f8a0.js";
14
+ import { I as S } from "../Button/index.6df3e958.js";
15
+ import "../../CommonActions/components/Actions/index.edceed6b.js";
16
+ import "../Pager/index.b072df6b.js";
17
17
  import "../Tab/index.e0653a0a.js";
18
18
  const O = I("span")(({
19
19
  arrowType: t,
@@ -0,0 +1,136 @@
1
+ import { createContext as x, useState as g } from "react";
2
+ import { useEnvironment as y, voidFunction as w } from "@m4l/core";
3
+ import { Typography as M } from "@mui/material";
4
+ import { styled as l } from "@mui/material/styles";
5
+ import { B as I } from "../../components/mui_extended/BoxIcon/index.e638ecc8.js";
6
+ import { jsx as t, jsxs as p, Fragment as _ } from "react/jsx-runtime";
7
+ import { M as k } from "../../components/ModalDialog/index.e1f31e50.js";
8
+ import { A as $ } from "../../components/CommonActions/components/ActionIntro/index.35c8757f.js";
9
+ import { A as b } from "../../components/CommonActions/components/ActionCancel/index.7b862bd3.js";
10
+ import { b as A } from "../../utils/index.214d9542.js";
11
+ const j = l("div")(() => ({
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ height: "100%"
15
+ })), D = l("div")(({
16
+ theme: n
17
+ }) => ({
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ justifyContent: "center",
21
+ alignItems: "center",
22
+ gridGap: n.spacing(5),
23
+ flexGrow: 1,
24
+ [n.breakpoints.up("sm")]: {
25
+ display: "grid",
26
+ flexDirection: "row",
27
+ gridTemplateColumns: "1fr 1fr"
28
+ }
29
+ })), O = l("div")(({
30
+ theme: n,
31
+ variant: o
32
+ }) => ({
33
+ display: "flex",
34
+ justifyContent: "center",
35
+ alignItems: "center",
36
+ "& > span": {
37
+ background: o === "warning" ? n.palette.warning.main : o === "delete" ? n.palette.error.main : o === "info" ? n.palette.info.main : "theme.palette.text.primary"
38
+ }
39
+ })), B = l("div")(() => ({
40
+ display: "flex",
41
+ alignItems: "center"
42
+ })), E = (n) => {
43
+ const {
44
+ variant: o = "info",
45
+ msg: i = "Are you sure you want to perform this action? Once complete, the information will be deleted."
46
+ } = n, {
47
+ host_static_assets: r,
48
+ environment_assets: e
49
+ } = y(), c = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`, m = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`, s = `${r}/${e}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
50
+ return /* @__PURE__ */ t(j, {
51
+ children: /* @__PURE__ */ p(D, {
52
+ children: [/* @__PURE__ */ t(O, {
53
+ variant: o,
54
+ children: /* @__PURE__ */ t(I, {
55
+ src: o === "warning" ? c : o === "delete" ? m : s,
56
+ sx: {
57
+ width: "230px",
58
+ height: "194px"
59
+ }
60
+ })
61
+ }), /* @__PURE__ */ t(B, {
62
+ children: /* @__PURE__ */ t(M, {
63
+ variant: "body1",
64
+ children: i
65
+ })
66
+ })]
67
+ })
68
+ });
69
+ }, F = x(null);
70
+ function K({
71
+ children: n
72
+ }) {
73
+ const [o, i] = g({
74
+ open: !1,
75
+ withClose: !0,
76
+ onQueryClose: w,
77
+ title: "",
78
+ iconComponent: void 0,
79
+ contentComponent: void 0,
80
+ variant: void 0
81
+ }), [r, e] = g(!1), c = (a) => {
82
+ i({
83
+ open: !0,
84
+ ...a
85
+ });
86
+ }, m = (a) => {
87
+ const {
88
+ variant: d = "warning",
89
+ title: u,
90
+ msg: h,
91
+ onClickIntro: f,
92
+ onClickCancel: v = s
93
+ } = a;
94
+ i({
95
+ open: !0,
96
+ title: u,
97
+ variant: d,
98
+ contentComponent: /* @__PURE__ */ t(E, {
99
+ variant: d,
100
+ msg: h
101
+ }),
102
+ actions: /* @__PURE__ */ p(_, {
103
+ children: [/* @__PURE__ */ t(b, {
104
+ onClick: v
105
+ }), " ", /* @__PURE__ */ t($, {
106
+ onClick: () => {
107
+ f && f(), s();
108
+ },
109
+ color: A(d)
110
+ })]
111
+ })
112
+ });
113
+ }, s = () => {
114
+ i((a) => ({
115
+ ...a,
116
+ open: !1
117
+ })), e(!1);
118
+ }, C = () => {
119
+ e(!0);
120
+ };
121
+ return /* @__PURE__ */ p(F.Provider, {
122
+ value: {
123
+ ...o,
124
+ openModal: c,
125
+ openModalConfirm: m,
126
+ closeModal: s,
127
+ hasChanges: r,
128
+ setChanges: C
129
+ },
130
+ children: [n, /* @__PURE__ */ t(k, {})]
131
+ });
132
+ }
133
+ export {
134
+ F as M,
135
+ K as a
136
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { ModalContextProps, TProps } from './types';
3
- declare const ModalContext: import("react").Context<ModalContextProps>;
3
+ declare const ModalContext: import("react").Context<ModalContextProps | null>;
4
4
  declare function ModalProvider({ children }: TProps): JSX.Element;
5
5
  export { ModalProvider, ModalContext };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { M as e } from "../../contexts/ModalContext/index.33dc1be9.js";
3
+ function s() {
4
+ const o = t(e);
5
+ if (!o)
6
+ throw new Error("useModal context must be use inside ModalContext");
7
+ return o;
8
+ }
9
+ export {
10
+ s as u
11
+ };
@@ -1 +1,2 @@
1
- export declare const useModal: () => import("../..").ModalContextProps;
1
+ export declare function useModal(): import("../..").ModalContextProps;
2
+ export default useModal;