@m4l/components 0.1.23 → 0.1.25

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 (48) hide show
  1. package/components/CommonActions/components/ActionCancel/{index.7b862bd3.js → index.9cfffe65.js} +1 -1
  2. package/components/CommonActions/components/ActionFormCancel/{index.b59a0011.js → index.ef60c2ee.js} +2 -2
  3. package/components/CommonActions/components/ActionIntro/{index.35c8757f.js → index.f8403e8e.js} +1 -1
  4. package/components/CommonActions/components/Actions/{index.edceed6b.js → index.309d3b6f.js} +7 -7
  5. package/components/DataGrid/{index.cd4fff69.js → index.fe073438.js} +3 -3
  6. package/components/DynamicFilter/{index.4d3c60b4.js → index.d0753667.js} +14 -14
  7. package/components/ModalDialog/{index.e1f31e50.js → index.a24ca508.js} +2 -2
  8. package/components/ObjectLogs/{index.9c43ba69.js → index.a7d36267.js} +3 -3
  9. package/components/Period/index.080a987d.js +175 -0
  10. package/components/Period/styles.d.ts +2 -2
  11. package/components/Period/types.d.ts +4 -1
  12. package/components/hook-form/RHFAutocomplete/dictionary.d.ts +3 -0
  13. package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +174 -0
  14. package/components/hook-form/RHFAutocomplete/types.d.ts +0 -1
  15. package/components/hook-form/RHFAutocompleteAsync/dictionary.d.ts +3 -0
  16. package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +65 -0
  17. package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +58 -0
  18. package/components/hook-form/RHFDateTime/index.9231a7c7.js +81 -0
  19. package/components/hook-form/RHFDateTime/subcomponents/Skeleton/index.d.ts +3 -0
  20. package/components/hook-form/RHFDateTime/{styles.d.ts → subcomponents/Skeleton/styles.d.ts} +0 -0
  21. package/components/hook-form/RHFDateTime/subcomponents/Skeleton/types.d.ts +2 -0
  22. package/components/hook-form/RHFPeriod/index.067790c9.js +51 -0
  23. package/components/hook-form/RHFPeriod/types.d.ts +3 -3
  24. package/components/hook-form/RHFTextField/index.ba2a8f67.js +129 -0
  25. package/components/hook-form/RHFTextField/index.d.ts +1 -1
  26. package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +1 -1
  27. package/components/hook-form/RHFTextField/subcomponents/Skeleton/types.d.ts +2 -4
  28. package/components/hook-form/RHFTextField/types.d.ts +1 -0
  29. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/styles.d.ts +1 -1
  30. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/subcomponents/Skeleton/index.d.ts +2 -0
  31. package/components/hook-form/RHFUpload/RHFUploadImage/components/UploadImage/subcomponents/Skeleton/styles.d.ts +2 -0
  32. package/components/hook-form/RHFUpload/index.6347159a.js +258 -0
  33. package/components/hook-form/index.d.ts +2 -0
  34. package/components/mui_extended/Button/{index.6df3e958.js → index.2afaa420.js} +1 -1
  35. package/components/mui_extended/Pager/{index.b072df6b.js → index.a23cf8de.js} +1 -1
  36. package/components/mui_extended/Popover/{index.d708b699.js → index.12b0ab55.js} +3 -3
  37. package/contexts/ModalContext/{index.33dc1be9.js → index.f17b3653.js} +3 -3
  38. package/hooks/useModal/{index.34cc1e55.js → index.b1f96279.js} +1 -1
  39. package/index.js +140 -138
  40. package/package.json +1 -1
  41. package/components/Period/index.ba6c0e11.js +0 -159
  42. package/components/hook-form/RHFAutocomplete/index.ee3d9b3c.js +0 -171
  43. package/components/hook-form/RHFAutocompleteAsync/index.3b3da5f6.js +0 -73
  44. package/components/hook-form/RHFCheckbox/index.6a40e25f.js +0 -55
  45. package/components/hook-form/RHFDateTime/index.5ed774e3.js +0 -66
  46. package/components/hook-form/RHFPeriod/index.fc3af81f.js +0 -45
  47. package/components/hook-form/RHFTextField/index.bab2a2cf.js +0 -113
  48. package/components/hook-form/RHFUpload/index.56e2e277.js +0 -239
@@ -1,159 +0,0 @@
1
- import { useModuleDictionary as Y, useModuleSkeleton as R, useEnvironment as T } from "@m4l/core";
2
- import { styled as a, Skeleton as d, Autocomplete as $, TextField as x } from "@mui/material";
3
- import { useMemo as D } from "react";
4
- import { I as v } from "../Icon/index.f569765b.js";
5
- import { jsxs as u, jsx as n } from "react/jsx-runtime";
6
- import { g as O } from "../CommonActions/components/Actions/index.edceed6b.js";
7
- import "@mui/material/Button";
8
- import "react-hook-form";
9
- import "react-router-dom";
10
- import "../../contexts/ModalContext/index.33dc1be9.js";
11
- import "@mui/lab";
12
- const S = a("div")(({
13
- theme: t,
14
- error: s
15
- }) => ({
16
- display: "flex",
17
- width: "100%",
18
- height: "auto",
19
- alignItems: "center",
20
- gap: t.spacing(1),
21
- border: s ? `1px solid ${t.palette.error.main}` : `1px solid ${t.palette.divider}`,
22
- padding: t.spacing(0.5, 1),
23
- borderRadius: "4px",
24
- "& .MuiAutocomplete-root, & .MuiTextField-root": {
25
- width: "100%"
26
- },
27
- "& .MuiAutocomplete-root .MuiTextField-root": {
28
- width: "100%"
29
- },
30
- "& .MuiTextField-root .MuiInput-input": {
31
- padding: "5px!important"
32
- }
33
- })), p = a("div")(({
34
- theme: t
35
- }) => ({
36
- width: "1px",
37
- height: "20px",
38
- backgroundColor: t.palette.divider
39
- })), P = a("div")(({
40
- theme: t
41
- }) => ({
42
- display: "flex",
43
- width: "auto",
44
- height: "37.5px",
45
- alignItems: "center",
46
- gap: t.spacing(1),
47
- border: `1px solid ${t.palette.divider}`,
48
- padding: t.spacing(0.5, 1),
49
- borderRadius: "4px"
50
- })), k = a("div")(({
51
- theme: t
52
- }) => ({
53
- ...t.typography.body2,
54
- width: "100%",
55
- display: "flex",
56
- textOverflow: "elipsis",
57
- overflow: "hidden",
58
- padding: "5px",
59
- textAlign: "left"
60
- })), w = a("div")(({
61
- theme: t
62
- }) => ({
63
- ...t.typography.body2,
64
- width: "70px",
65
- display: "flex",
66
- textOverflow: "elipsis",
67
- overflow: "hidden",
68
- padding: "5px",
69
- textAlign: "left"
70
- }));
71
- var i = /* @__PURE__ */ ((t) => (t[t.YEARS = 0] = "YEARS", t[t.MONTHS = 1] = "MONTHS", t[t.DAYS = 2] = "DAYS", t))(i || {});
72
- const F = (t) => t ? t.selPeriodTime ? t.selPeriodTime : t.years && t.years > 0 ? i.YEARS : t.months && t.months > 0 ? i.MONTHS : t.days && t.days > 0 ? i.DAYS : i.YEARS : i.YEARS, _ = (t) => t ? t.singleValue !== void 0 ? t.singleValue : t.years && t.years > 0 ? t.years : t.months && t.months > 0 ? t.months : t.days && t.days > 0 ? t.days : "" : "", z = (t) => {
73
- const {
74
- value: s,
75
- onChange: b,
76
- error: A = !1,
77
- readOnly: M = !1
78
- } = t, {
79
- getLabel: l
80
- } = Y(), C = R(), c = F(s), g = _(s), f = (e, r) => {
81
- const o = {
82
- selPeriodTime: e,
83
- singleValue: r
84
- };
85
- r !== "" && r > 0 && (o.years = 0, o.months = 0, o.days = 0, e === i.YEARS && (o.years = r), e === i.MONTHS && (o.months = r), e === i.DAYS && (o.days = r)), b(o);
86
- }, I = (e) => {
87
- e && f(e.id, g);
88
- }, {
89
- host_static_assets: h,
90
- environment_assets: m
91
- } = T(), y = D(() => [{
92
- id: 0,
93
- label: l("period.years")
94
- }, {
95
- id: 1,
96
- label: l("period.months")
97
- }, {
98
- id: 2,
99
- label: l("period.days")
100
- }], [l]);
101
- return C ? /* @__PURE__ */ u(P, {
102
- children: [/* @__PURE__ */ n(d, {
103
- variant: "rounded",
104
- width: "100%"
105
- }), /* @__PURE__ */ n(p, {}), /* @__PURE__ */ n(d, {
106
- variant: "rounded",
107
- width: "100%"
108
- }), /* @__PURE__ */ n(d, {
109
- variant: "circular",
110
- width: 20,
111
- sx: {
112
- minWidth: "20px",
113
- minHeight: "20px"
114
- }
115
- })]
116
- }) : (M && (s.selPeriodTime, s.singleValue, v, `${h}${m}`), /* @__PURE__ */ u(S, {
117
- error: A,
118
- children: [/* @__PURE__ */ n($, {
119
- options: y,
120
- value: y[c],
121
- disableClearable: !0,
122
- onChange: (e, r) => {
123
- I(r);
124
- },
125
- renderInput: (e) => /* @__PURE__ */ n(x, {
126
- ...e,
127
- fullWidth: !0,
128
- variant: "standard",
129
- SelectProps: {
130
- native: !0
131
- },
132
- InputProps: {
133
- disableUnderline: !0,
134
- ...e.InputProps
135
- },
136
- autoComplete: "off"
137
- }, `tx_async_${e.id}`)
138
- }), /* @__PURE__ */ n(p, {}), /* @__PURE__ */ n(x, {
139
- type: "number",
140
- variant: "standard",
141
- value: g,
142
- InputProps: {
143
- disableUnderline: !0
144
- },
145
- onChange: (e) => {
146
- f(c, e.target.value === "" ? "" : parseInt(e.target.value));
147
- }
148
- }), /* @__PURE__ */ n(v, {
149
- src: `${h}/${m}/frontend/components/period/assets/icons/clock.svg`
150
- })]
151
- }));
152
- };
153
- function B() {
154
- return ["period"].concat(O());
155
- }
156
- export {
157
- z as P,
158
- B as g
159
- };
@@ -1,171 +0,0 @@
1
- import { useModuleDictionary as K, useModuleSkeleton as U } from "@m4l/core";
2
- import { useFormContext as z, Controller as B } from "react-hook-form";
3
- import { Skeleton as y, Autocomplete as G, TextField as N, CircularProgress as J } from "@mui/material";
4
- import { styled as d } from "@mui/material/styles";
5
- import { I as v } from "../../Image/index.c9da2d5a.js";
6
- import { useMemo as Q, useState as F, useEffect as X } from "react";
7
- import { jsxs as O, jsx as n, Fragment as Y } from "react/jsx-runtime";
8
- const Z = d("div")(() => ({
9
- display: "flex",
10
- width: "100%",
11
- flexDirection: "column"
12
- })), ee = d("div")(({
13
- theme: t
14
- }) => ({
15
- width: "100%",
16
- display: "grid",
17
- gridTemplateColumns: "1fr auto",
18
- gridGap: t.spacing(2),
19
- alignItems: "center",
20
- height: `${t.spacing(4.5)}`,
21
- border: `1px solid ${t.palette.divider}`,
22
- borderRadius: `${t.spacing(1)}`,
23
- padding: `0 ${t.spacing(2)}`,
24
- [t.breakpoints.down("md")]: {
25
- width: "100%"
26
- }
27
- })), te = d("div")(({
28
- theme: t
29
- }) => ({
30
- display: "flex",
31
- width: "100%",
32
- "& .MuiAutocomplete-root": {
33
- width: "100%"
34
- },
35
- "& .m4l_image": {
36
- marginLeft: t.spacing(1.5)
37
- }
38
- })), oe = d("li")(({
39
- theme: t
40
- }) => ({
41
- "& .m4l_image": {
42
- marginRight: t.spacing(1.5)
43
- }
44
- }));
45
- function ne(t, l, c) {
46
- return function(s, g) {
47
- return /* @__PURE__ */ O(oe, {
48
- ...s,
49
- children: [/* @__PURE__ */ n(v, {
50
- src: t(g),
51
- width: l,
52
- height: c
53
- }), s.key]
54
- });
55
- };
56
- }
57
- function de(t) {
58
- const {
59
- name: l,
60
- getOptionLabel: c,
61
- isOptionEqualToValue: x,
62
- label: s,
63
- skeletonWidth: g = 100,
64
- skeletonHeight: P = "18px",
65
- options: W,
66
- disabled: E,
67
- getOptionUrlImage: p,
68
- imageWidth: C = "24px",
69
- imageHeight: I = "24px",
70
- onOpen: b,
71
- onClose: T,
72
- loading: L,
73
- onChangeOption: w,
74
- onChangeFilterParmsLocal: a,
75
- ...H
76
- } = t, {
77
- getLabel: k
78
- } = K(), M = U(), {
79
- control: $
80
- } = z(), A = Q(() => p !== void 0, [p]), [q, S] = F(!1), V = (e, o) => {
81
- S(!1), T && T(e, o);
82
- }, j = (e) => {
83
- S(!0), b && b(e);
84
- }, m = (e) => e == null ? "" : c(e), _ = (e) => e == null || p === void 0 ? "" : p(e), D = (e, o) => o == null || e === null ? !1 : x(e, o);
85
- return M ? /* @__PURE__ */ n(Z, {
86
- children: /* @__PURE__ */ O(ee, {
87
- children: [/* @__PURE__ */ n(y, {
88
- variant: "text",
89
- width: g,
90
- height: P
91
- }, "sk1"), /* @__PURE__ */ n(y, {
92
- variant: "circular",
93
- width: 16,
94
- height: 16
95
- }, "sk2")]
96
- })
97
- }) : /* @__PURE__ */ n(B, {
98
- name: l,
99
- control: $,
100
- render: ({
101
- field: {
102
- onChange: e,
103
- value: o
104
- },
105
- fieldState: {
106
- error: R
107
- }
108
- }) => {
109
- const [u, f] = F(m(o));
110
- return X(() => {
111
- !q && o === null && u !== "" && f("");
112
- }, [o]), console.log("Render AC", l, u, typeof u, o), /* @__PURE__ */ n(te, {
113
- className: "m4l_rhf_autocomplete",
114
- children: /* @__PURE__ */ n(G, {
115
- autoComplete: !0,
116
- autoSelect: !a,
117
- options: W,
118
- getOptionLabel: m,
119
- inputValue: u,
120
- clearOnBlur: !1,
121
- onInputChange: (i, r, h) => {
122
- console.debug("******onInputChange*", r, h), h === "input" ? (f(r), a && a(r, h)) : e(null);
123
- },
124
- isOptionEqualToValue: D,
125
- disableClearable: !0,
126
- value: o || null,
127
- onOpen: j,
128
- onClose: V,
129
- onChange: (i, r) => {
130
- console.log("onChange optiion*", r), w && w(r), f(m(r)), e(r);
131
- },
132
- filterOptions: a ? (i) => i : void 0,
133
- loading: L,
134
- loadingText: k("rhf_autocomplete.loading_options"),
135
- disabled: E,
136
- noOptionsText: k("rhf_autocomplete.no_options"),
137
- renderOption: A ? ne(_, C, I) : void 0,
138
- renderInput: (i) => (console.log("renderInput parms", l, i.inputProps.value), /* @__PURE__ */ n(N, {
139
- ...i,
140
- label: s,
141
- fullWidth: !0,
142
- SelectProps: {
143
- native: !0
144
- },
145
- InputProps: {
146
- ...i.InputProps,
147
- startAdornment: A && o ? /* @__PURE__ */ n(v, {
148
- src: _(o),
149
- width: C,
150
- height: I
151
- }, "ImageTextField") : null,
152
- endAdornment: /* @__PURE__ */ O(Y, {
153
- children: [L ? /* @__PURE__ */ n(J, {
154
- color: "inherit",
155
- size: 20
156
- }) : null, i.InputProps.endAdornment]
157
- })
158
- },
159
- autoComplete: "off",
160
- error: !!R,
161
- helperText: R?.message,
162
- ...H
163
- }))
164
- })
165
- });
166
- }
167
- });
168
- }
169
- export {
170
- de as R
171
- };
@@ -1,73 +0,0 @@
1
- import { useState as o, useCallback as H, useEffect as p } from "react";
2
- import { useNetwork as N, getPropertyByString as k } from "@m4l/core";
3
- import { useFormContext as w } from "react-hook-form";
4
- import x from "lodash/debounce";
5
- import { R as S } from "../RHFAutocomplete/index.ee3d9b3c.js";
6
- import { jsx as I } from "react/jsx-runtime";
7
- function J(O) {
8
- const {
9
- name: d,
10
- endPoint: t,
11
- timeout: g = 5e3,
12
- parms: s,
13
- resultField: F = "data",
14
- isRemote: A = !0,
15
- onChangeFilterParms: n,
16
- ...C
17
- } = O;
18
- w();
19
- const {
20
- networkOperation: P
21
- } = N(), [h, r] = o([]), [a, m] = o(!1), [l, c] = o(!1), [u, i] = o(!0), [f, R] = o({}), y = H(x((e) => {
22
- console.debug("setCanLoadOptions", !0), i(!0), console.log("New parms:", e), R(e);
23
- }, 300), []), L = (e) => {
24
- n && y(n(e));
25
- };
26
- return p(() => {
27
- console.log("useEffect RHFAutocompleteAsync Parms", s, t), r([]), i(!0);
28
- }, [s, t]), p(() => {
29
- let e = !0;
30
- if (console.log("useEffect RHFAutocompleteAsync", a, l, u), !(!a || l)) {
31
- if (!u) {
32
- console.log("****NO LOAD OPTIONS***");
33
- return;
34
- }
35
- return c(!0), r([]), i(!1), P({
36
- method: "GET",
37
- endPoint: t,
38
- timeout: g,
39
- parms: {
40
- ...s,
41
- ...f
42
- },
43
- isRemote: A
44
- }).then((b) => {
45
- if (e) {
46
- const E = k(b, F);
47
- r(E);
48
- }
49
- }).catch(() => {
50
- console.error("OJOOOO ");
51
- }).finally(() => {
52
- e && c(!1);
53
- }), () => {
54
- e = !1, c(!1);
55
- };
56
- }
57
- }, [a, s, f, t]), /* @__PURE__ */ I(S, {
58
- name: d,
59
- loading: l,
60
- options: h,
61
- onChangeFilterParmsLocal: n ? L : void 0,
62
- onOpen: () => {
63
- m(!0);
64
- },
65
- onClose: () => {
66
- m(!1);
67
- },
68
- ...C
69
- });
70
- }
71
- export {
72
- J as R
73
- };
@@ -1,55 +0,0 @@
1
- import { useFormContext as i, Controller as c } from "react-hook-form";
2
- import { styled as m } from "@mui/material/styles";
3
- import { styled as p, Skeleton as d, FormControlLabel as u, Checkbox as f } from "@mui/material";
4
- import { useModuleSkeleton as g } from "@m4l/core";
5
- import { jsx as e, jsxs as k, Fragment as x } from "react/jsx-runtime";
6
- const h = p("div")(() => ({
7
- display: "flex",
8
- justifyContent: "center",
9
- alignItems: "center",
10
- padding: "8px"
11
- })), C = () => /* @__PURE__ */ e(h, {
12
- children: /* @__PURE__ */ e(d, {
13
- variant: "rectangular"
14
- })
15
- }), y = m("p")(({
16
- theme: r
17
- }) => ({
18
- ...r.typography.caption,
19
- color: r.palette.error.main,
20
- marginRight: 14,
21
- marginLeft: 14
22
- }));
23
- function L({
24
- name: r,
25
- sizeCheck: n = "small",
26
- ...l
27
- }) {
28
- const {
29
- control: s
30
- } = i(), a = g();
31
- return /* @__PURE__ */ e(u, {
32
- control: /* @__PURE__ */ e(c, {
33
- name: r,
34
- control: s,
35
- render: ({
36
- field: t,
37
- fieldState: {
38
- error: o
39
- }
40
- }) => a ? /* @__PURE__ */ e(C, {}) : /* @__PURE__ */ k(x, {
41
- children: [/* @__PURE__ */ e(f, {
42
- size: n,
43
- ...t,
44
- checked: t.value
45
- }), o?.message && /* @__PURE__ */ e(y, {
46
- children: o?.message + ""
47
- })]
48
- })
49
- }),
50
- ...l
51
- });
52
- }
53
- export {
54
- L as R
55
- };
@@ -1,66 +0,0 @@
1
- import { useFormContext as u, Controller as c } from "react-hook-form";
2
- import { Skeleton as h, TextField as x } from "@mui/material";
3
- import { styled as g } from "@mui/material/styles";
4
- import { DateTimePicker as k } from "@mui/x-date-pickers";
5
- import { useModuleSkeleton as F, useEnvironment as v } from "@m4l/core";
6
- import { jsx as e } from "react/jsx-runtime";
7
- const C = g("div")(({
8
- theme: t
9
- }) => ({
10
- display: "flex",
11
- width: "100%",
12
- alignItems: "center",
13
- border: `1px solid ${t.palette.divider}`,
14
- padding: "12px 14px",
15
- borderRadius: t.spacing(1)
16
- }));
17
- function w(t) {
18
- const {
19
- name: i,
20
- autoComplete: a = "off",
21
- skeletonWidth: m = "100%",
22
- skeletonHeight: s = 14
23
- } = t, l = F(), {
24
- control: d
25
- } = u(), {
26
- dfnsFormat: {
27
- datetime_format: p,
28
- datetime_mask: f
29
- }
30
- } = v();
31
- return l ? /* @__PURE__ */ e(C, {
32
- children: /* @__PURE__ */ e(h, {
33
- variant: "text",
34
- width: m,
35
- height: s
36
- })
37
- }) : /* @__PURE__ */ e(c, {
38
- name: i,
39
- control: d,
40
- render: ({
41
- field: r,
42
- fieldState: {
43
- error: n
44
- }
45
- }) => /* @__PURE__ */ e(k, {
46
- ampm: !1,
47
- inputFormat: p,
48
- mask: f,
49
- label: "",
50
- value: r.value,
51
- onChange: (o) => {
52
- isNaN(o) ? r.onChange(void 0) : r.onChange(o);
53
- },
54
- renderInput: (o) => /* @__PURE__ */ e(x, {
55
- autoComplete: a,
56
- fullWidth: !0,
57
- error: !!n,
58
- helperText: n?.message,
59
- ...o
60
- })
61
- })
62
- });
63
- }
64
- export {
65
- w as R
66
- };
@@ -1,45 +0,0 @@
1
- import { styled as m } from "@mui/material";
2
- import { useFormContext as a, Controller as l } from "react-hook-form";
3
- import { E as f } from "../../ErrorLabel/index.c8615f16.js";
4
- import { P as p } from "../../Period/index.ba6c0e11.js";
5
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
6
- const d = m("div")(({
7
- theme: e
8
- }) => ({
9
- width: "100%",
10
- display: "flex",
11
- flexDirection: "column",
12
- justifyContent: "center",
13
- alignItems: "flex-start",
14
- gap: e.spacing(1)
15
- })), C = (e) => {
16
- const {
17
- name: o
18
- } = e, {
19
- control: s
20
- } = a();
21
- return /* @__PURE__ */ t(l, {
22
- name: o,
23
- control: s,
24
- render: ({
25
- field: {
26
- onChange: n,
27
- value: i
28
- },
29
- fieldState: {
30
- error: r
31
- }
32
- }) => /* @__PURE__ */ c(d, {
33
- children: [/* @__PURE__ */ t(p, {
34
- value: i,
35
- onChange: n,
36
- error: !!r
37
- }), r && /* @__PURE__ */ t(f, {
38
- message: r.message || ""
39
- })]
40
- })
41
- });
42
- };
43
- export {
44
- C as R
45
- };
@@ -1,113 +0,0 @@
1
- import { useModuleSkeleton as w, useEnvironment as F } from "@m4l/core";
2
- import { styled as v, Skeleton as S, TextField as y, InputAdornment as C } from "@mui/material";
3
- import { forwardRef as I, useState as R } from "react";
4
- import { I as H } from "../../mui_extended/IconButton/index.4b5ce8b5.js";
5
- import { useFormContext as T, Controller as b } from "react-hook-form";
6
- import { jsx as t } from "react/jsx-runtime";
7
- const $ = v("div")(({
8
- theme: e
9
- }) => ({
10
- display: "flex",
11
- width: "100%",
12
- alignItems: "center",
13
- border: `1px solid ${e.palette.divider}`,
14
- padding: "12px 14px",
15
- borderRadius: e.spacing(1)
16
- })), P = (e) => {
17
- const {
18
- width: o,
19
- height: n
20
- } = e;
21
- return /* @__PURE__ */ t($, {
22
- children: /* @__PURE__ */ t(S, {
23
- variant: "text",
24
- width: o,
25
- height: n
26
- })
27
- });
28
- }, c = I((e, o) => {
29
- const {
30
- name: n,
31
- autoComplete: l = "off",
32
- skeletonWidth: d = "100%",
33
- skeletonHeight: s = "18px",
34
- type: r,
35
- ...i
36
- } = e, a = w(), {
37
- control: f
38
- } = T();
39
- return a ? /* @__PURE__ */ t(P, {
40
- width: d,
41
- height: s
42
- }) : /* @__PURE__ */ t(b, {
43
- name: n,
44
- control: f,
45
- render: ({
46
- field: {
47
- onChange: p,
48
- onBlur: h,
49
- value: g,
50
- name: x,
51
- ref: k
52
- },
53
- fieldState: {
54
- error: u
55
- }
56
- }) => /* @__PURE__ */ t(
57
- y,
58
- {
59
- inputRef: o,
60
- autoComplete: l,
61
- onChange: (m) => {
62
- if (r === "number" && m.target.value) {
63
- p(Number(m.target.value));
64
- return;
65
- }
66
- p(m);
67
- },
68
- onBlur: h,
69
- value: g || "",
70
- name: x,
71
- ref: k,
72
- fullWidth: !0,
73
- error: !!u,
74
- helperText: u?.message,
75
- type: r,
76
- ...i
77
- }
78
- )
79
- });
80
- });
81
- c.displayName = "RHFTextField";
82
- const M = (e) => {
83
- const {
84
- name: o,
85
- label: n,
86
- skeletonWidth: l,
87
- skeletonHeight: d
88
- } = e, [s, r] = R(!1), {
89
- host_static_assets: i,
90
- environment_assets: a
91
- } = F();
92
- return /* @__PURE__ */ t(c, {
93
- name: o,
94
- label: n,
95
- type: s ? "text" : "password",
96
- autoComplete: "on",
97
- skeletonWidth: l,
98
- skeletonHeight: d,
99
- InputProps: {
100
- endAdornment: /* @__PURE__ */ t(C, {
101
- position: "start",
102
- children: /* @__PURE__ */ t(H, {
103
- onClick: () => r(!s),
104
- src: s ? `${i}/${a}/frontend/domain/host/login/assets/icons/eye.svg` : `${i}/${a}/frontend/domain/host/login/assets/icons/eye_off.svg`
105
- })
106
- })
107
- }
108
- });
109
- };
110
- export {
111
- c as R,
112
- M as a
113
- };