@m4l/components 0.1.11 → 0.1.13

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 (144) hide show
  1. package/assets/Logo/index.228dcb5a.js +86 -0
  2. package/commonjs.565e6834.js +12 -0
  3. package/components/CommonActions/components/ActionCancel/index.cba1b460.js +17 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +49 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +31 -0
  6. package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +18 -0
  7. package/components/CommonActions/components/Actions/index.e8148d98.js +743 -0
  8. package/components/CompanyLogo/{index.js → index.f81c179c.js} +42 -48
  9. package/components/DataGrid/index.b688877d.js +894 -0
  10. package/components/DataGrid/types.d.ts +1 -1
  11. package/components/DynamicFilter/index.82ce857e.js +1158 -0
  12. package/components/ErrorLabel/index.c8615f16.js +19 -0
  13. package/components/Icon/index.cbca79b0.js +70 -0
  14. package/components/Image/index.e790b50b.js +122 -0
  15. package/components/LanguagePopover/index.3d9611cb.js +87 -0
  16. package/components/Loadable/index.f5518558.js +15 -0
  17. package/components/ModalDialog/index.3850c053.js +168 -0
  18. package/components/NoItemSelected/{index.js → index.12f0ca67.js} +43 -50
  19. package/components/ObjectLogs/index.27ef875d.js +266 -0
  20. package/components/Page/index.6d69977e.js +35 -0
  21. package/components/Page/index.d.ts +1 -1
  22. package/components/PaperForm/index.d7c74064.js +105 -0
  23. package/components/Period/index.5e68286a.js +160 -0
  24. package/components/PropertyValue/index.ab3dd7e9.js +116 -0
  25. package/components/Resizeable/{index.js → index.45995d2b.js} +21 -19
  26. package/components/ScrollBar/index.39eeb2de.js +49 -0
  27. package/components/ScrollToTop/index.e06f98f6.js +11 -0
  28. package/components/SplitLayout/{index.js → index.4032673d.js} +35 -35
  29. package/components/animate/IconButtonAnimate/index.d.ts +1 -1
  30. package/components/animate/LoadingScreen/{index.js → index.f1cec7db.js} +29 -27
  31. package/components/animate/MotionContainer/index.8d9f9d80.js +30 -0
  32. package/components/animate/MotionLazyContainer/index.572dd012.js +15 -0
  33. package/components/animate/features.0fbf41e1.js +5 -0
  34. package/components/animate/variants/{bounce.js → bounce.784aaaaa.js} +15 -16
  35. package/components/animate/variants/container.11f82b76.js +20 -0
  36. package/components/animate/variants/fade.b561c0fc.js +59 -0
  37. package/components/animate/variants/{index.js → index.7a912140.js} +0 -0
  38. package/components/animate/variants/transition.bd46b9ce.js +15 -0
  39. package/components/formatters/BooleanFormatter/index.cca53b7f.js +42 -0
  40. package/components/formatters/DateFormatter/index.ad8d9b8e.js +57 -0
  41. package/components/formatters/index.55856d65.js +106 -0
  42. package/components/hook-form/FormProvider/index.257acd9f.js +55 -0
  43. package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +122 -0
  44. package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +153 -0
  45. package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +59 -0
  46. package/components/hook-form/RHFDateTime/index.fc5cbafe.js +68 -0
  47. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +34 -0
  48. package/components/hook-form/RHFPeriod/index.23c254e9.js +45 -0
  49. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +43 -0
  50. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +36 -0
  51. package/components/hook-form/RHFTextField/index.4c455f75.js +77 -0
  52. package/components/hook-form/RHFTextField/index.d.ts +1 -1
  53. package/components/hook-form/RHFUpload/index.ed3d739f.js +244 -0
  54. package/components/mui_extended/Accordion/index.2116e423.js +103 -0
  55. package/components/mui_extended/Avatar/index.0a2a4523.js +32 -0
  56. package/components/mui_extended/Avatar/index.d.ts +1 -1
  57. package/components/mui_extended/BoxIcon/index.e638ecc8.js +22 -0
  58. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +89 -0
  59. package/components/mui_extended/Button/index.84d8898c.js +110 -0
  60. package/components/mui_extended/IconButton/index.88f3aadb.js +98 -0
  61. package/components/mui_extended/LinkWithRoute/index.d4b263de.js +28 -0
  62. package/components/mui_extended/MenuPopover/index.488fc536.js +131 -0
  63. package/components/mui_extended/Pager/index.0576814f.js +126 -0
  64. package/components/mui_extended/Tab/index.e0653a0a.js +28 -0
  65. package/components/mui_extended/Typography/index.0c4604b3.js +22 -0
  66. package/contexts/ModalContext/index.2188b69e.js +150 -0
  67. package/hooks/useFormAddEdit/index.d4845f1a.js +26 -0
  68. package/hooks/useModal/index.6571d2d9.js +6 -0
  69. package/index.js +162 -70
  70. package/lodash.e09401f0.js +32 -0
  71. package/node_modules.168cb897.js +55 -0
  72. package/package.json +1 -1
  73. package/react-data-grid.d46d625e.js +2115 -0
  74. package/react-draggable.20e95c61.js +714 -0
  75. package/react-json-view.f56a7f8e.js +2762 -0
  76. package/react-lazy-load-image-component.45b56650.js +784 -0
  77. package/react-resizable.5277deaf.js +371 -0
  78. package/react-splitter-layout.7810ac1b.js +165 -0
  79. package/utils/index.214d9542.js +435 -0
  80. package/assets/Logo/index.js +0 -91
  81. package/commonjs.js +0 -9
  82. package/components/CommonActions/components/ActionCancel/index.js +0 -15
  83. package/components/CommonActions/components/ActionFormCancel/index.js +0 -62
  84. package/components/CommonActions/components/ActionFormIntro/index.js +0 -35
  85. package/components/CommonActions/components/ActionIntro/index.js +0 -16
  86. package/components/CommonActions/components/Actions/index.js +0 -859
  87. package/components/DataGrid/index.js +0 -1067
  88. package/components/DynamicFilter/index.js +0 -1573
  89. package/components/ErrorLabel/index.js +0 -18
  90. package/components/Icon/index.js +0 -80
  91. package/components/Image/index.js +0 -128
  92. package/components/LanguagePopover/index.js +0 -93
  93. package/components/Loadable/index.js +0 -13
  94. package/components/ModalDialog/index.js +0 -180
  95. package/components/ObjectLogs/index.js +0 -284
  96. package/components/Page/index.js +0 -36
  97. package/components/PaperForm/index.js +0 -110
  98. package/components/Period/index.js +0 -230
  99. package/components/PropertyValue/index.js +0 -142
  100. package/components/ScrollBar/index.js +0 -52
  101. package/components/ScrollToTop/index.js +0 -10
  102. package/components/animate/MotionContainer/index.js +0 -31
  103. package/components/animate/MotionLazyContainer/index.js +0 -13
  104. package/components/animate/features.js +0 -2
  105. package/components/animate/variants/container.js +0 -20
  106. package/components/animate/variants/fade.js +0 -61
  107. package/components/animate/variants/transition.js +0 -16
  108. package/components/formatters/BooleanFormatter/index.js +0 -52
  109. package/components/formatters/DateFormatter/index.js +0 -66
  110. package/components/formatters/index.js +0 -112
  111. package/components/hook-form/FormProvider/index.js +0 -61
  112. package/components/hook-form/RHFAutocomplete/index.js +0 -144
  113. package/components/hook-form/RHFAutocompleteAsync/index.js +0 -191
  114. package/components/hook-form/RHFCheckbox/index.js +0 -65
  115. package/components/hook-form/RHFDateTime/index.js +0 -79
  116. package/components/hook-form/RHFMultiCheckbox/index.js +0 -32
  117. package/components/hook-form/RHFPeriod/index.js +0 -47
  118. package/components/hook-form/RHFRadioGroup/index.js +0 -41
  119. package/components/hook-form/RHFSelect/index.js +0 -34
  120. package/components/hook-form/RHFTextField/index.js +0 -87
  121. package/components/hook-form/RHFUpload/index.js +0 -255
  122. package/components/mui_extended/Accordion/index.js +0 -105
  123. package/components/mui_extended/Avatar/index.js +0 -33
  124. package/components/mui_extended/BoxIcon/index.js +0 -20
  125. package/components/mui_extended/Breadcrumbs/index.js +0 -92
  126. package/components/mui_extended/Button/index.js +0 -131
  127. package/components/mui_extended/IconButton/index.js +0 -108
  128. package/components/mui_extended/LinkWithRoute/index.js +0 -30
  129. package/components/mui_extended/MenuPopover/index.js +0 -135
  130. package/components/mui_extended/Pager/index.js +0 -137
  131. package/components/mui_extended/Tab/index.js +0 -30
  132. package/components/mui_extended/Typography/index.js +0 -21
  133. package/contexts/ModalContext/index.js +0 -165
  134. package/hooks/useFormAddEdit/index.js +0 -42
  135. package/hooks/useModal/index.js +0 -4
  136. package/lodash.js +0 -62
  137. package/node_modules.js +0 -54
  138. package/react-data-grid.js +0 -2652
  139. package/react-draggable.js +0 -960
  140. package/react-json-view.js +0 -2764
  141. package/react-lazy-load-image-component.js +0 -792
  142. package/react-resizable.js +0 -541
  143. package/react-splitter-layout.js +0 -165
  144. package/utils/index.js +0 -572
@@ -1,144 +0,0 @@
1
- import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
2
- import { useFormContext, Controller } from "react-hook-form";
3
- import { Skeleton, Autocomplete, TextField } from "@mui/material";
4
- import { styled } from "@mui/material/styles";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- const SKTRHFAutocompleteWrapper = styled("div")(() => ({
7
- display: "flex",
8
- width: "100%",
9
- flexDirection: "column"
10
- }));
11
- styled("div")(({
12
- theme
13
- }) => ({
14
- display: "flex",
15
- justifyContent: "flex-end",
16
- paddingRight: `${theme.spacing(2)}`,
17
- [theme.breakpoints.down("md")]: {
18
- justifyContent: "flex-start"
19
- }
20
- }));
21
- const SKTInputText = styled("div")(({
22
- theme
23
- }) => ({
24
- width: "100%",
25
- display: "grid",
26
- gridTemplateColumns: "1fr auto",
27
- gridGap: theme.spacing(2),
28
- alignItems: "center",
29
- height: `${theme.spacing(4.5)}`,
30
- border: `1px solid ${theme.palette.divider}`,
31
- borderRadius: `${theme.spacing(1)}`,
32
- padding: `0 ${theme.spacing(2)}`,
33
- [theme.breakpoints.down("md")]: {
34
- width: "100%"
35
- }
36
- }));
37
- styled("div")(() => ({
38
- display: "flex",
39
- width: "100%",
40
- "& .MuiAutocomplete-root": {
41
- width: "100%"
42
- }
43
- }));
44
- function RHFAutocomplete(props) {
45
- const {
46
- name,
47
- getOptionLabel,
48
- isOptionEqualToValue,
49
- label,
50
- skeletonProps = {},
51
- options,
52
- disabled,
53
- ...other
54
- } = props;
55
- const {
56
- width = 100,
57
- height = "18px"
58
- } = skeletonProps;
59
- const {
60
- getLabel
61
- } = useModuleDictionary();
62
- const isSkeleton = useModuleSkeleton();
63
- const {
64
- control,
65
- getValues
66
- } = useFormContext();
67
- const initialValue = getValues(name);
68
- const getOptionLabelLocal = (option) => {
69
- if (option === void 0 || option === null) {
70
- return "";
71
- }
72
- return getOptionLabel(option);
73
- };
74
- const isOptionEqualToValueLocal = (option, value) => {
75
- if (value === void 0 || value === null || option === null) {
76
- return false;
77
- }
78
- return isOptionEqualToValue(option, value);
79
- };
80
- if (isSkeleton) {
81
- return /* @__PURE__ */ jsx(SKTRHFAutocompleteWrapper, {
82
- children: /* @__PURE__ */ jsxs(SKTInputText, {
83
- children: [/* @__PURE__ */ jsx(Skeleton, {
84
- variant: "text",
85
- width,
86
- height
87
- }, "sk1"), /* @__PURE__ */ jsx(Skeleton, {
88
- variant: "circular",
89
- width: 16,
90
- height: 16
91
- }, "sk2")]
92
- })
93
- });
94
- }
95
- return /* @__PURE__ */ jsx(Controller, {
96
- name,
97
- control,
98
- render: ({
99
- field: {
100
- onChange,
101
- value
102
- },
103
- fieldState: {
104
- error
105
- }
106
- }) => {
107
- return /* @__PURE__ */ jsx(
108
- Autocomplete,
109
- {
110
- options,
111
- getOptionLabel: getOptionLabelLocal,
112
- defaultValue: initialValue,
113
- isOptionEqualToValue: isOptionEqualToValueLocal,
114
- disableClearable: true,
115
- value: value || null,
116
- onChange: (_e, val) => {
117
- onChange(val);
118
- },
119
- loadingText: "",
120
- disabled,
121
- noOptionsText: getLabel("rhf_autocomplete.component_no_options"),
122
- renderInput: (params) => {
123
- return /* @__PURE__ */ jsx(TextField, {
124
- ...params,
125
- label,
126
- fullWidth: true,
127
- SelectProps: {
128
- native: true
129
- },
130
- InputProps: {
131
- ...params.InputProps
132
- },
133
- autoComplete: "off",
134
- error: !!error,
135
- helperText: error?.message,
136
- ...other
137
- }, `tx_async_${params.id}`);
138
- }
139
- }
140
- );
141
- }
142
- });
143
- }
144
- export { RHFAutocomplete as R };
@@ -1,191 +0,0 @@
1
- import { useState, useEffect, Fragment } from "react";
2
- import { useModuleDictionary, useModuleSkeleton, useNetwork, getPropertyByString } from "@m4l/core";
3
- import { useFormContext, Controller } from "react-hook-form";
4
- import { Skeleton, Autocomplete, TextField, CircularProgress } from "@mui/material";
5
- import { styled } from "@mui/material/styles";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- const SKTRHFAutocompleteAsyncWrapper = styled("div")(() => ({
8
- display: "flex",
9
- width: "100%",
10
- flexDirection: "column"
11
- }));
12
- styled("div")(({
13
- theme
14
- }) => ({
15
- display: "flex",
16
- justifyContent: "flex-end",
17
- paddingRight: `${theme.spacing(2)}`,
18
- [theme.breakpoints.down("md")]: {
19
- justifyContent: "flex-start"
20
- }
21
- }));
22
- const SKTInputText = styled("div")(({
23
- theme
24
- }) => ({
25
- width: "100%",
26
- display: "grid",
27
- gridTemplateColumns: "1fr auto",
28
- gridGap: theme.spacing(2),
29
- alignItems: "center",
30
- height: `${theme.spacing(4.5)}`,
31
- border: `1px solid ${theme.palette.divider}`,
32
- borderRadius: `${theme.spacing(1)}`,
33
- padding: `0 ${theme.spacing(2)}`,
34
- [theme.breakpoints.down("md")]: {
35
- width: "100%"
36
- }
37
- }));
38
- function RHFAutocompleteAsync(props) {
39
- const {
40
- name,
41
- getOptionLabel,
42
- isOptionEqualToValue,
43
- label,
44
- endPoint,
45
- timeout = 5e3,
46
- parms,
47
- resultField = "data",
48
- skeletonProps = {},
49
- isRemote = true,
50
- disabled,
51
- ...other
52
- } = props;
53
- const {
54
- width = 100,
55
- height = "18px"
56
- } = skeletonProps;
57
- const {
58
- getLabel
59
- } = useModuleDictionary();
60
- const isSkeleton = useModuleSkeleton();
61
- const {
62
- control,
63
- getValues,
64
- setValue
65
- } = useFormContext();
66
- const {
67
- networkOperation
68
- } = useNetwork();
69
- const initialValue = getValues(name);
70
- const [options, setOptions] = useState(initialValue === null ? [] : [initialValue]);
71
- const [open, setOpen] = useState(false);
72
- const [optionsLoaded, setOptionsLoaded] = useState(false);
73
- const loading = open && !optionsLoaded && !!endPoint && !isSkeleton;
74
- useEffect(() => {
75
- if (optionsLoaded) {
76
- setOptionsLoaded(false);
77
- setOptions([]);
78
- setValue(name, null);
79
- }
80
- }, [parms, endPoint]);
81
- useEffect(() => {
82
- if (!optionsLoaded && initialValue) {
83
- setOptions([initialValue]);
84
- }
85
- }, [initialValue, optionsLoaded]);
86
- const getOptionLabelLocal = (option) => {
87
- if (option === void 0 || option === null) {
88
- return "";
89
- }
90
- return getOptionLabel(option);
91
- };
92
- const isOptionEqualToValueLocal = (option, value) => {
93
- if (value === void 0 || value === null || option === null) {
94
- return false;
95
- }
96
- return isOptionEqualToValue(option, value);
97
- };
98
- useEffect(() => {
99
- let mounted = true;
100
- if (!loading) {
101
- return void 0;
102
- }
103
- networkOperation({
104
- method: "GET",
105
- endPoint,
106
- timeout,
107
- parms,
108
- isRemote
109
- }).then((response) => {
110
- if (mounted) {
111
- setOptions(getPropertyByString(response, resultField));
112
- setOptionsLoaded(true);
113
- }
114
- });
115
- return () => {
116
- mounted = false;
117
- };
118
- }, [loading]);
119
- if (isSkeleton) {
120
- return /* @__PURE__ */ jsx(SKTRHFAutocompleteAsyncWrapper, {
121
- children: /* @__PURE__ */ jsxs(SKTInputText, {
122
- children: [/* @__PURE__ */ jsx(Skeleton, {
123
- variant: "text",
124
- width,
125
- height
126
- }, "sk1"), /* @__PURE__ */ jsx(Skeleton, {
127
- variant: "circular",
128
- width: 16,
129
- height: 16
130
- }, "sk2")]
131
- })
132
- });
133
- }
134
- return /* @__PURE__ */ jsx(Controller, {
135
- name,
136
- control,
137
- render: ({
138
- field: {
139
- onChange,
140
- value
141
- },
142
- fieldState: {
143
- error
144
- }
145
- }) => /* @__PURE__ */ jsx(Autocomplete, {
146
- options,
147
- getOptionLabel: getOptionLabelLocal,
148
- defaultValue: initialValue,
149
- isOptionEqualToValue: isOptionEqualToValueLocal,
150
- disableClearable: true,
151
- value: value || null,
152
- onOpen: () => {
153
- setOpen(true);
154
- },
155
- onClose: () => {
156
- setOpen(false);
157
- },
158
- onChange: (_e, val) => {
159
- onChange(val);
160
- },
161
- disabled,
162
- loading,
163
- loadingText: "",
164
- noOptionsText: getLabel("rhf_autocomplete.component_no_options"),
165
- renderInput: (params) => {
166
- return /* @__PURE__ */ jsx(TextField, {
167
- ...params,
168
- label,
169
- fullWidth: true,
170
- SelectProps: {
171
- native: true
172
- },
173
- InputProps: {
174
- ...params.InputProps,
175
- endAdornment: /* @__PURE__ */ jsxs(Fragment, {
176
- children: [loading ? /* @__PURE__ */ jsx(CircularProgress, {
177
- color: "primary",
178
- size: 20
179
- }, `cp_async${params.id}`) : null, params.InputProps.endAdornment]
180
- }, `fr_async_${params.id}`)
181
- },
182
- autoComplete: "off",
183
- error: !!error,
184
- helperText: error?.message,
185
- ...other
186
- }, `tx_async_${params.id}`);
187
- }
188
- }, "at_async")
189
- });
190
- }
191
- export { RHFAutocompleteAsync as R };
@@ -1,65 +0,0 @@
1
- import { useFormContext, Controller } from "react-hook-form";
2
- import { styled } from "@mui/material/styles";
3
- import { Skeleton, FormControlLabel, Checkbox } from "@mui/material";
4
- import { useModuleSkeleton } from "@m4l/core";
5
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
6
- const WrapperSKTRHFCheckbox = styled("div")(() => ({
7
- display: "flex",
8
- justifyContent: "center",
9
- alignItems: "center",
10
- padding: "8px"
11
- }));
12
- const SKTCheckSkeleton = styled(Skeleton)(() => ({
13
- width: "20px",
14
- height: "20px",
15
- borderRadius: "4px"
16
- }));
17
- const ErrorLabel = styled("p")(({
18
- theme
19
- }) => ({
20
- ...theme.typography.caption,
21
- color: theme.palette.error.main,
22
- marginRight: 14,
23
- marginLeft: 14
24
- }));
25
- function RHFCheckbox({
26
- name,
27
- sizeCheck = "small",
28
- ...other
29
- }) {
30
- const {
31
- control
32
- } = useFormContext();
33
- const isSkeleton = useModuleSkeleton();
34
- return /* @__PURE__ */ jsx(FormControlLabel, {
35
- control: /* @__PURE__ */ jsx(Controller, {
36
- name,
37
- control,
38
- render: ({
39
- field,
40
- fieldState: {
41
- error
42
- }
43
- }) => {
44
- if (isSkeleton) {
45
- return /* @__PURE__ */ jsx(WrapperSKTRHFCheckbox, {
46
- children: /* @__PURE__ */ jsx(SKTCheckSkeleton, {
47
- variant: "rectangular"
48
- })
49
- });
50
- }
51
- return /* @__PURE__ */ jsxs(Fragment, {
52
- children: [/* @__PURE__ */ jsx(Checkbox, {
53
- size: sizeCheck,
54
- ...field,
55
- checked: field.value
56
- }), error?.message && /* @__PURE__ */ jsx(ErrorLabel, {
57
- children: error?.message + ""
58
- })]
59
- });
60
- }
61
- }),
62
- ...other
63
- });
64
- }
65
- export { RHFCheckbox as R };
@@ -1,79 +0,0 @@
1
- import { useFormContext, Controller } from "react-hook-form";
2
- import { Skeleton, TextField } from "@mui/material";
3
- import { styled } from "@mui/material/styles";
4
- import { DateTimePicker } from "@mui/x-date-pickers";
5
- import { useModuleSkeleton, useEnvironment } from "@m4l/core";
6
- import { jsx } from "react/jsx-runtime";
7
- const SKTRHFWrapperTextField = styled("div")(({
8
- theme
9
- }) => ({
10
- display: "flex",
11
- width: "100%",
12
- alignItems: "center",
13
- border: `1px solid ${theme.palette.divider}`,
14
- padding: "12px 14px",
15
- borderRadius: theme.spacing(1)
16
- }));
17
- function RHFDateTime(props) {
18
- const {
19
- name,
20
- autoComplete = "off",
21
- skeletonProps: skeletoProps = {}
22
- } = props;
23
- const {
24
- width = "100%",
25
- height = 14
26
- } = skeletoProps;
27
- const isSkeleton = useModuleSkeleton();
28
- const {
29
- control
30
- } = useFormContext();
31
- const {
32
- dfnsFormat: {
33
- datetime_format,
34
- datetime_mask
35
- }
36
- } = useEnvironment();
37
- if (isSkeleton) {
38
- return /* @__PURE__ */ jsx(SKTRHFWrapperTextField, {
39
- children: /* @__PURE__ */ jsx(Skeleton, {
40
- variant: "text",
41
- width,
42
- height
43
- })
44
- });
45
- }
46
- return /* @__PURE__ */ jsx(Controller, {
47
- name,
48
- control,
49
- render: ({
50
- field,
51
- fieldState: {
52
- error
53
- }
54
- }) => {
55
- return /* @__PURE__ */ jsx(DateTimePicker, {
56
- ampm: false,
57
- inputFormat: datetime_format,
58
- mask: datetime_mask,
59
- label: "",
60
- value: field.value,
61
- onChange: (value) => {
62
- if (!isNaN(value)) {
63
- field.onChange(value);
64
- } else {
65
- field.onChange(void 0);
66
- }
67
- },
68
- renderInput: (params) => /* @__PURE__ */ jsx(TextField, {
69
- autoComplete,
70
- fullWidth: true,
71
- error: !!error,
72
- helperText: error?.message,
73
- ...params
74
- })
75
- });
76
- }
77
- });
78
- }
79
- export { RHFDateTime as R };
@@ -1,32 +0,0 @@
1
- import { useFormContext, Controller } from "react-hook-form";
2
- import { FormGroup, FormControlLabel, Checkbox } from "@mui/material";
3
- import { jsx } from "react/jsx-runtime";
4
- function RHFMultiCheckbox({
5
- name,
6
- options,
7
- ...other
8
- }) {
9
- const {
10
- control
11
- } = useFormContext();
12
- return /* @__PURE__ */ jsx(Controller, {
13
- name,
14
- control,
15
- render: ({
16
- field
17
- }) => {
18
- const onSelected = (option) => field.value.includes(option) ? field.value.filter((value) => value !== option) : [...field.value, option];
19
- return /* @__PURE__ */ jsx(FormGroup, {
20
- children: options.map((option) => /* @__PURE__ */ jsx(FormControlLabel, {
21
- control: /* @__PURE__ */ jsx(Checkbox, {
22
- checked: field.value.includes(option),
23
- onChange: () => field.onChange(onSelected(option))
24
- }),
25
- label: option,
26
- ...other
27
- }, option))
28
- });
29
- }
30
- });
31
- }
32
- export { RHFMultiCheckbox as R };
@@ -1,47 +0,0 @@
1
- import { styled } from "@mui/material";
2
- import { useFormContext, Controller } from "react-hook-form";
3
- import { E as ErrorLabel } from "../../ErrorLabel/index.js";
4
- import { P as Period } from "../../Period/index.js";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- const Wrapper = styled("div")(({
7
- theme
8
- }) => ({
9
- width: "100%",
10
- display: "flex",
11
- flexDirection: "column",
12
- justifyContent: "center",
13
- alignItems: "flex-start",
14
- gap: theme.spacing(1)
15
- }));
16
- const RHFPeriod = (props) => {
17
- const {
18
- name
19
- } = props;
20
- const {
21
- control
22
- } = useFormContext();
23
- return /* @__PURE__ */ jsx(Controller, {
24
- name,
25
- control,
26
- render: ({
27
- field: {
28
- onChange,
29
- value
30
- },
31
- fieldState: {
32
- error
33
- }
34
- }) => {
35
- return /* @__PURE__ */ jsxs(Wrapper, {
36
- children: [/* @__PURE__ */ jsx(Period, {
37
- value,
38
- onChange,
39
- error: !!error
40
- }), error && /* @__PURE__ */ jsx(ErrorLabel, {
41
- message: error.message || ""
42
- })]
43
- });
44
- }
45
- });
46
- };
47
- export { RHFPeriod as R };
@@ -1,41 +0,0 @@
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
- }) {
10
- const {
11
- control
12
- } = useFormContext();
13
- return /* @__PURE__ */ jsx(Controller, {
14
- name,
15
- control,
16
- render: ({
17
- field,
18
- fieldState: {
19
- error
20
- }
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
- sx: {
34
- px: 2
35
- },
36
- children: error.message
37
- })]
38
- })
39
- });
40
- }
41
- export { RHFRadioGroup as R };
@@ -1,34 +0,0 @@
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
- }) {
9
- const {
10
- control
11
- } = useFormContext();
12
- return /* @__PURE__ */ jsx(Controller, {
13
- name,
14
- control,
15
- render: ({
16
- field,
17
- fieldState: {
18
- error
19
- }
20
- }) => /* @__PURE__ */ jsx(TextField, {
21
- ...field,
22
- select: true,
23
- fullWidth: true,
24
- SelectProps: {
25
- native: true
26
- },
27
- error: !!error,
28
- helperText: error?.message,
29
- ...other,
30
- children
31
- })
32
- });
33
- }
34
- export { RHFSelect as R };