@m4l/components 0.2.36 → 1.0.0
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.
- package/components/AccountPopover/{index.a9dc9f92.js → index.efc74d5c.js} +3 -5
- package/components/AppBar/{index.7dee7427.js → index.fc126a22.js} +6 -5
- package/components/AppBar/styles.d.ts +1 -1
- package/components/CommonActions/components/Actions/styles.d.ts +1 -1
- package/components/DataGrid/styles.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +7 -7
- package/components/DragResizeWindow/{index.a9f25040.js → index.46b380e1.js} +3 -6
- package/components/DynamicFilter/dynamicFilterSlots.d.ts +76 -101
- package/components/DynamicFilter/{index.48d809e2.js → index.d9168c12.js} +22 -96
- package/components/FieldLabel/{index.2622ee40.js → index.f9cdcc27.js} +4 -4
- package/components/GridLayout/{index.b9c47a4c.js → index.bb3b7769.js} +23 -46
- package/components/GridLayout/subcomponents/Griditem/{index.69bc14e5.js → index.bb23f651.js} +4 -3
- package/components/GridLayout/subcomponents/Responsive/{index.094c1d09.js → index.b8a2a121.js} +2 -1
- package/components/GridLayout/subcomponents/SizeProvider/{index.e1d2df80.js → index.094bc6b5.js} +1 -1
- package/components/{commercial/index.b90488db.js → HamburgerMenu/index.5997af31.js} +4 -6
- package/components/HelperText/{index.81c5d349.js → index.be949cdf.js} +3 -2
- package/components/HelperText/styles.d.ts +1 -1
- package/components/Icon/index.d5fed418.js +420 -0
- package/components/Icon/styles.d.ts +2 -2
- package/components/{hook-form/RHFUpload/index.c5e5c61c.js → Image/index.36a3d440.js} +233 -32
- package/components/Image/styles.d.ts +1 -1
- package/components/LanguagePopover/{index.72f316fc.js → index.e6fa2336.js} +5 -8
- package/components/LanguagePopover/styles.d.ts +5 -5
- package/components/LinearProgressIndeterminate/{index.2ecd571e.js → index.de9d447c.js} +2 -4
- package/components/Loadable/{index.97fe63f9.js → index.e83cdb4e.js} +1 -1
- package/components/LoadingError/{index.7aaba1cf.js → index.9f00c83c.js} +8 -12
- package/components/LoadingError/styles.d.ts +1 -1
- package/components/MFLoader/{index.40c419c0.js → index.402c1acc.js} +4 -8
- package/components/ModalDialog/{index.42349189.js → index.ea9189c3.js} +5 -14
- package/components/NavLink/{index.9e847eb5.js → index.4e548cee.js} +4 -4
- package/components/NavLink/styles.d.ts +1 -1
- package/components/NoItemSelected/{index.5a8160fd.js → index.418c8316.js} +6 -15
- package/components/NoItemSelected/styles.d.ts +4 -4
- package/components/ObjectLogs/{index.6955149e.js → index.bfa7dad3.js} +10 -27
- package/components/ObjectLogs/styles.d.ts +3 -3
- package/components/PDFViewer/{index.47bb0928.js → index.bb2eca5a.js} +2 -2
- package/components/{mui_extended/Pager/index.1ba2d52b.js → Page/index.fdf04592.js} +134 -26
- package/components/PaperForm/{index.9f6fd02d.js → index.8121e3da.js} +8 -7
- package/components/PaperForm/styles.d.ts +6 -6
- package/components/Period/{index.c6d1a95a.js → index.5233694b.js} +157 -22
- package/components/Period/styles.d.ts +5 -5
- package/components/PrintingSystem/{index.f51a00f8.js → index.fb176a93.js} +14 -14
- package/components/PrintingSystem/subcomponents/BodyNode/{index.6792c353.js → index.c1d61038.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.eec6b4cd.js → index.18bd9bad.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.e58467c9.js → index.67d9f1b4.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.920b75c9.js → index.eaee152a.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.6c1ad53c.js → index.f5f63a2a.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.e8b151ad.js → index.7de4e411.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.bf199422.js → index.f9ccf22b.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.44d436b9.js → index.f2f2e903.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.879cf13d.js → index.540a4b19.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.eb6af0ca.js → index.41e7fcb0.js} +1 -1
- package/components/PropertyValue/{index.5e59580c.js → index.9572c347.js} +4 -7
- package/components/Resizeable/{index.5e8e48b1.js → index.1f0c1359.js} +7 -7
- package/components/ResizeableWindow/styles.d.ts +1 -1
- package/components/ScrollBar/{index.4b965665.js → index.adf0eade.js} +2 -4
- package/components/SideBar/classes/index.d.ts +1 -1
- package/components/SideBar/{index.5d1f4a23.js → index.629ba840.js} +24 -26
- package/components/SideBar/styles.d.ts +2 -2
- package/components/SideBar/subcomponents/ContentGroups/styles.d.ts +3 -3
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/styles.d.ts +1 -1
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/styles.d.ts +2 -18
- package/components/SplitLayout/{index.15756f0f.js → index.74091a81.js} +1 -3
- package/components/ToastContainer/{index.dbd78941.js → index.f9b507b9.js} +3 -3
- package/components/animate/LoadingScreen/{index.1a83615a.js → index.779690a7.js} +3 -5
- package/components/animate/PropagateLoader/{index.76d7ea70.js → index.a9da8d00.js} +3 -2
- package/components/animate/PropagateLoader/syles.d.ts +1 -1
- package/components/animate/{index.87296638.js → index.b8497385.js} +3 -2
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/styles.d.ts +3 -3
- package/components/areas/constants.5387d83e.js +412 -0
- package/components/areas/contexts/AreasContext/{index.19c7b906.js → index.bb316000.js} +5 -6
- package/components/areas/contexts/DynamicMFParmsContext/{index.3d9ad0ad.js → index.37d1d444.js} +2 -2
- package/components/areas/contexts/WindowToolsMFContext/{index.992ae7a3.js → index.69d95c15.js} +2 -2
- package/components/areas/dictionary.7e74022a.js +286 -0
- package/components/areas/hooks/useAreas/{index.cedd30ee.js → index.e24bd74d.js} +1 -1
- package/components/areas/hooks/useDynamicMFParameters/{index.9e09e1e3.js → index.03ce6078.js} +1 -1
- package/components/areas/hooks/useWindowToolsMF/{index.2fbae9dc.js → index.09801b66.js} +1 -1
- package/components/areas/icons.504ec098.js +83 -0
- package/components/commercial/HamburgerMenu/styles.d.ts +1 -1
- package/components/commercial/SectionCommercial/styles.d.ts +4 -9
- package/components/hook-form/RHFAutocomplete/classes/index.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/styles.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/styles.d.ts +4 -4
- package/components/hook-form/RHFCheckbox/styles.d.ts +2 -10
- package/components/hook-form/RHFPeriod/styles.d.ts +1 -1
- package/components/hook-form/RHFTextField/styles.d.ts +2 -2
- package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +2 -2
- package/components/hook-form/RHFTextFieldPassword/styles.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/styles.d.ts +1 -1
- package/components/maps/components/GpsTools/{index.4ea69dd1.js → index.75880ce0.js} +14 -136
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/styles.d.ts +4 -9
- package/components/maps/{components/Map/index.62b7d09b.js → index.8ec46ce4.js} +19 -194
- package/components/modal/{WindowBase.2414cd02.js → WindowBase.a3ac7adc.js} +3 -4
- package/components/modal/{WindowConfirm.48140481.js → WindowConfirm.e35da619.js} +6 -10
- package/components/modal/{index.81eb6def.js → index.a0e30c8b.js} +1 -5
- package/components/mui_extended/Accordion/styles.d.ts +3 -3
- package/components/mui_extended/Badge/styles.d.ts +1 -1
- package/components/mui_extended/Button/styles.d.ts +2 -10
- package/components/mui_extended/IconButton/styles.d.ts +1 -1
- package/components/mui_extended/ImageButton/styles.d.ts +1 -1
- package/components/mui_extended/MenuActions/styles.d.ts +2 -27
- package/components/mui_extended/Pager/styles.d.ts +1 -1
- package/components/mui_extended/Stack/styles.d.ts +2 -9
- package/components/mui_extended/Tab/styles.d.ts +2 -2
- package/components/mui_extended/Tabs/styles.d.ts +3 -58
- package/components/mui_extended/Typography/styles.d.ts +1 -1
- package/components/popups/PopupsProvider/{index.8fb6232a.js → index.18669fb4.js} +1 -1
- package/components/popups/PopupsViewer/{index.813854e4.js → index.ba354267.js} +5 -10
- package/contexts/ModalContext/{index.45c275cd.js → index.cf02e6bd.js} +1 -1
- package/contexts/RHFormContext/{index.bf3a2812.js → index.dc955a09.js} +2 -6
- package/hooks/useFormAddEdit/{index.9b27ca02.js → index.f156a2cd.js} +4 -8
- package/hooks/useModal/index.ef54bcf2.js +66 -0
- package/hooks/useTab/{index.f7973779.js → index.bce8b99e.js} +1 -1
- package/index.d.ts +0 -1
- package/index.js +276 -360
- package/package.json +3 -2
- package/{react-draggable.79b4c69a.js → react-draggable.5331add7.js} +1 -1
- package/{react-resizable.af1f31c1.js → react-resizable.37bfb965.js} +3 -5
- package/test/{getNameDataTestId.0faeade8.js → getNameDataTestId.aee44365.js} +2 -2
- package/test/index.6d4b98b9.js +4 -0
- package/utils/{index.0718eeac.js → index.9ee4c99a.js} +113 -3
- package/vendor.a1ce6777.js +6352 -0
- package/assets/Logo/index.109a182d.js +0 -38
- package/assets/Logo.d.ts +0 -6
- package/components/CommonActions/components/ActionCancel/index.46f636e9.js +0 -12
- package/components/CommonActions/components/ActionFormCancel/index.2b0bd50d.js +0 -56
- package/components/CommonActions/components/ActionFormIntro/index.4f212c39.js +0 -33
- package/components/CommonActions/components/ActionIntro/index.7406bd47.js +0 -25
- package/components/CommonActions/components/Actions/index.273645af.js +0 -70
- package/components/DataGrid/constants.e334cd50.js +0 -10
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index.cee6b676.js +0 -26
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.708f3fb5.js +0 -22
- package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +0 -19
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.c064bb07.js +0 -23
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +0 -14
- package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +0 -10
- package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +0 -10
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +0 -36
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +0 -10
- package/components/DataGrid/formatters/index.2c2f0ae4.js +0 -1
- package/components/DataGrid/index.304437ee.js +0 -917
- package/components/DataGrid/subcomponents/Actions/index.f14590d2.js +0 -595
- package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +0 -76
- package/components/Icon/index.ee7b85c9.js +0 -192
- package/components/Image/index.8cc036b1.js +0 -168
- package/components/Page/index.c1d4a319.js +0 -114
- package/components/animate/variants/index.7a912140.js +0 -1
- package/components/areas/components/AreasAdmin/index.f239c717.js +0 -733
- package/components/areas/components/AreasViewer/index.61e0538b.js +0 -1071
- package/components/areas/components/index.558684b3.js +0 -1
- package/components/areas/constants.66529246.js +0 -6
- package/components/areas/contexts/index.24025b97.js +0 -1
- package/components/areas/dictionary.08cfc4c9.js +0 -36
- package/components/areas/hooks/index.d9dc1e21.js +0 -1
- package/components/areas/icons.8266ccc8.js +0 -26
- package/components/areas/index.4cc6a221.js +0 -22
- package/components/commercial/AppBarCommercial/index.9f654f8e.js +0 -28
- package/components/commercial/SectionCommercial/index.3df4685b.js +0 -57
- package/components/commercial/TopBar/index.7aeb6ec0.js +0 -234
- package/components/formatters/BooleanFormatter/index.0c2d8e35.js +0 -44
- package/components/formatters/DateFormatter/index.2ef6f261.js +0 -43
- package/components/formatters/PointsFormatter/index.d8a4ee54.js +0 -25
- package/components/formatters/PriceFormatter/index.97f75b4b.js +0 -35
- package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +0 -29
- package/components/formatters/index.b816c6b6.js +0 -117
- package/components/hook-form/HelperError/index.c8b046b7.js +0 -19
- package/components/hook-form/RHFAutocomplete/index.ea2ac2b1.js +0 -408
- package/components/hook-form/RHFAutocompleteAsync/index.98dcf0de.js +0 -158
- package/components/hook-form/RHFCheckbox/index.c32278fa.js +0 -142
- package/components/hook-form/RHFColorPicker/index.8c939bfd.js +0 -191
- package/components/hook-form/RHFDateTime/index.ac27deab.js +0 -190
- package/components/hook-form/RHFMultiCheckbox/index.437e6ba3.js +0 -34
- package/components/hook-form/RHFPeriod/index.70cfc422.js +0 -104
- package/components/hook-form/RHFRadioGroup/index.11c0add8.js +0 -35
- package/components/hook-form/RHFSelect/index.c6c60ecc.js +0 -29
- package/components/hook-form/RHFTextField/index.fa97889a.js +0 -325
- package/components/maps/index.13bb982c.js +0 -7
- package/components/mui_extended/Accordion/index.d08a0361.js +0 -142
- package/components/mui_extended/Avatar/index.fb9ad158.js +0 -63
- package/components/mui_extended/Badge/index.2a3aef2c.js +0 -30
- package/components/mui_extended/BoxIcon/index.d61e7ac5.js +0 -22
- package/components/mui_extended/Breadcrumbs/index.4a44883c.js +0 -87
- package/components/mui_extended/Button/index.5395d101.js +0 -213
- package/components/mui_extended/CheckBox.256169f0.js +0 -76
- package/components/mui_extended/CircularProgress/index.967e70b7.js +0 -8
- package/components/mui_extended/IconButton/index.b0ee4965.js +0 -119
- package/components/mui_extended/LinearProgress/index.4092bb69.js +0 -9
- package/components/mui_extended/LinkWithRoute/index.288c51f3.js +0 -15
- package/components/mui_extended/MenuActions/index.d92ed0d6.js +0 -175
- package/components/mui_extended/Popover/index.4e7340b4.js +0 -142
- package/components/mui_extended/Stack/index.fe363ca5.js +0 -31
- package/components/mui_extended/Tab/index.c5ad86e2.js +0 -134
- package/components/mui_extended/ToggleButton/index.7fbc8614.js +0 -18
- package/components/mui_extended/ToggleIconButton/index.0cd347b4.js +0 -24
- package/components/mui_extended/Tooltip/index.49bb5ee1.js +0 -40
- package/components/mui_extended/Typography/index.a1e774a2.js +0 -54
- package/components/mui_extended/index.b606cd9d.js +0 -1
- package/hooks/useModal/index.30674bb7.js +0 -11
- package/style.css +0 -65
- package/test/constants_no_mock.86c553a9.js +0 -4
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { styled, Skeleton, generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
4
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
5
|
-
import { H as HelperText } from "../../HelperText/index.81c5d349.js";
|
|
6
|
-
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.86c553a9.js";
|
|
7
|
-
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
8
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
9
|
-
import { useFormFocus } from "../../../index.js";
|
|
10
|
-
import { C as CheckBox } from "../../mui_extended/CheckBox.256169f0.js";
|
|
11
|
-
const RHFCheckboxRoot = styled("div")(({ theme }) => ({
|
|
12
|
-
...theme.components?.M4LRHFCheckbox?.styleOverrides
|
|
13
|
-
}));
|
|
14
|
-
styled("div")(() => ({
|
|
15
|
-
display: "flex",
|
|
16
|
-
justifyContent: "center",
|
|
17
|
-
alignItems: "center",
|
|
18
|
-
padding: "8px"
|
|
19
|
-
}));
|
|
20
|
-
styled(Skeleton)(() => ({
|
|
21
|
-
width: "20px",
|
|
22
|
-
height: "20px",
|
|
23
|
-
borderRadius: "4px"
|
|
24
|
-
}));
|
|
25
|
-
const ContainerCheckTypography = styled("div")(() => ({
|
|
26
|
-
display: "flex",
|
|
27
|
-
alignItems: "center"
|
|
28
|
-
}));
|
|
29
|
-
generateUtilityClasses("M4LRHFCheckbox", [
|
|
30
|
-
"root",
|
|
31
|
-
"checkTypography",
|
|
32
|
-
"skeleton",
|
|
33
|
-
"small",
|
|
34
|
-
"medium",
|
|
35
|
-
"stateDisabled",
|
|
36
|
-
"stateError",
|
|
37
|
-
"isFocus",
|
|
38
|
-
"isTabSelected"
|
|
39
|
-
]);
|
|
40
|
-
function getRHFCheckboxUtilityClass(slot) {
|
|
41
|
-
return generateUtilityClass("M4LRHFCheckbox", slot);
|
|
42
|
-
}
|
|
43
|
-
const useUtilityClasses = (ownerState) => {
|
|
44
|
-
const slots = {
|
|
45
|
-
root: [
|
|
46
|
-
"root",
|
|
47
|
-
ownerState.isFocus && "isFocus",
|
|
48
|
-
ownerState.isTabSelected && "isTabSelected",
|
|
49
|
-
ownerState.sizeCheck === "small" && "small",
|
|
50
|
-
ownerState.sizeCheck === "medium" && "medium",
|
|
51
|
-
ownerState.disabled && "stateDisabled",
|
|
52
|
-
ownerState.error && "stateError"
|
|
53
|
-
],
|
|
54
|
-
skeleton: ["skeleton"],
|
|
55
|
-
checkTypography: [
|
|
56
|
-
"checkTypography",
|
|
57
|
-
ownerState.sizeCheck === "small" ? "small" : "medium",
|
|
58
|
-
ownerState.disabled && "stateDisabled"
|
|
59
|
-
]
|
|
60
|
-
};
|
|
61
|
-
const composedClasses = unstable_composeClasses(slots, getRHFCheckboxUtilityClass, {});
|
|
62
|
-
return {
|
|
63
|
-
...composedClasses
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
const RHFCHEKCBOX_PREFIX = "RHFCheckbox";
|
|
67
|
-
const getNameDataTestId = (KEY, NAME) => {
|
|
68
|
-
return `${RHFCHEKCBOX_PREFIX}-${NAME}-${KEY}`;
|
|
69
|
-
};
|
|
70
|
-
function RHFCheckbox(props) {
|
|
71
|
-
const {
|
|
72
|
-
name,
|
|
73
|
-
sizeCheck = "small",
|
|
74
|
-
label,
|
|
75
|
-
disabled = false,
|
|
76
|
-
mandatory,
|
|
77
|
-
mandatoryMessage,
|
|
78
|
-
helperMessage
|
|
79
|
-
} = props;
|
|
80
|
-
const {
|
|
81
|
-
control,
|
|
82
|
-
formState: { errors }
|
|
83
|
-
} = useFormContext();
|
|
84
|
-
const isSkeleton = useModuleSkeleton();
|
|
85
|
-
const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
|
|
86
|
-
const isDesktop = useResponsiveDesktop();
|
|
87
|
-
const ownerState = {
|
|
88
|
-
isFocus: !isSkeleton ? isFocus : false,
|
|
89
|
-
isTabSelected: !isSkeleton ? isTabSelected : false,
|
|
90
|
-
sizeCheck: !isDesktop ? "medium" : sizeCheck,
|
|
91
|
-
disabled,
|
|
92
|
-
error: errors[name] ? true : false
|
|
93
|
-
};
|
|
94
|
-
const classes = useUtilityClasses(ownerState);
|
|
95
|
-
return /* @__PURE__ */ jsx(
|
|
96
|
-
RHFCheckboxRoot,
|
|
97
|
-
{
|
|
98
|
-
className: classes.root,
|
|
99
|
-
onFocus: handlerFocus,
|
|
100
|
-
onBlur: handlerOnBlur,
|
|
101
|
-
onKeyUp: handlerOnKeyUp,
|
|
102
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root", name) } : {},
|
|
103
|
-
children: /* @__PURE__ */ jsx(
|
|
104
|
-
Controller,
|
|
105
|
-
{
|
|
106
|
-
name,
|
|
107
|
-
control,
|
|
108
|
-
render: ({ field: { onChange, value }, fieldState: { error } }) => {
|
|
109
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
-
ContainerCheckTypography,
|
|
112
|
-
{
|
|
113
|
-
className: classes.checkTypography,
|
|
114
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("checkTypography", name) } : {},
|
|
115
|
-
children: /* @__PURE__ */ jsx(
|
|
116
|
-
CheckBox,
|
|
117
|
-
{
|
|
118
|
-
size: sizeCheck,
|
|
119
|
-
onChange,
|
|
120
|
-
checked: value,
|
|
121
|
-
disabled: disabled ? true : false,
|
|
122
|
-
disableRipple: true,
|
|
123
|
-
label,
|
|
124
|
-
mandatory,
|
|
125
|
-
mandatoryMessage,
|
|
126
|
-
helperMessage,
|
|
127
|
-
htmlFor: name
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
),
|
|
132
|
-
error?.message && /* @__PURE__ */ jsx(HelperText, { variant: "error", message: error?.message + "" })
|
|
133
|
-
] });
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
export {
|
|
141
|
-
RHFCheckbox as R
|
|
142
|
-
};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useFormContext, useWatch, Controller } from "react-hook-form";
|
|
4
|
-
import { useModuleSkeleton, useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
5
|
-
import { SketchPicker } from "react-color";
|
|
6
|
-
import { H as HelperText } from "../../HelperText/index.81c5d349.js";
|
|
7
|
-
import { generateUtilityClasses, generateUtilityClass, styled, Skeleton } from "@mui/material";
|
|
8
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
9
|
-
import { useTheme } from "@mui/material/styles";
|
|
10
|
-
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
11
|
-
import { useFormFocus } from "../../../index.js";
|
|
12
|
-
import { F as FieldLabel } from "../../FieldLabel/index.2622ee40.js";
|
|
13
|
-
import { P as Popover } from "../../mui_extended/Popover/index.4e7340b4.js";
|
|
14
|
-
import { I as Icon } from "../../Icon/index.ee7b85c9.js";
|
|
15
|
-
import { B as Button } from "../../mui_extended/Button/index.5395d101.js";
|
|
16
|
-
const componentName = "M4LRHFColorPicker";
|
|
17
|
-
const colorPickerClasses = generateUtilityClasses(componentName, [
|
|
18
|
-
"root",
|
|
19
|
-
"popoverRoot",
|
|
20
|
-
"containerFieldColor",
|
|
21
|
-
"fieldColor",
|
|
22
|
-
"containerPicker",
|
|
23
|
-
"skeleton",
|
|
24
|
-
"sizeSmall",
|
|
25
|
-
"sizeMedium",
|
|
26
|
-
"isFocus",
|
|
27
|
-
"isTabSelected"
|
|
28
|
-
]);
|
|
29
|
-
function getRHFColorPickerUtilityClass(slot) {
|
|
30
|
-
return generateUtilityClass(componentName, slot);
|
|
31
|
-
}
|
|
32
|
-
const useUtilityClasses = (owmerState) => {
|
|
33
|
-
const slots = {
|
|
34
|
-
root: [
|
|
35
|
-
"root",
|
|
36
|
-
owmerState.isFocus && "isFocus",
|
|
37
|
-
owmerState.isTabSelected && "isTabSelected",
|
|
38
|
-
owmerState.size === "small" && "sizeSmall",
|
|
39
|
-
owmerState.size === "medium" && "sizeMedium"
|
|
40
|
-
],
|
|
41
|
-
popoverRoot: ["popoverRoot"],
|
|
42
|
-
containerFieldColor: ["containerFieldColor"],
|
|
43
|
-
fieldColor: ["boxColor"],
|
|
44
|
-
containerPicker: ["containerPicker"],
|
|
45
|
-
skeleton: ["skeleton"]
|
|
46
|
-
};
|
|
47
|
-
const composedClasses = unstable_composeClasses(slots, getRHFColorPickerUtilityClass, {});
|
|
48
|
-
return {
|
|
49
|
-
...composedClasses
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
const RHFColorPickerRoot = styled("div")(({ theme }) => ({
|
|
53
|
-
...theme.components?.M4LRHFColorPicker?.styleOverrides
|
|
54
|
-
}));
|
|
55
|
-
const RHFColorPickerSkeleton = (props) => {
|
|
56
|
-
const { label } = props;
|
|
57
|
-
return /* @__PURE__ */ jsxs("div", { className: colorPickerClasses.skeleton, children: [
|
|
58
|
-
label && /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "30%", height: "14px" }),
|
|
59
|
-
/* @__PURE__ */ jsx(
|
|
60
|
-
Skeleton,
|
|
61
|
-
{
|
|
62
|
-
className: colorPickerClasses.skeleton,
|
|
63
|
-
variant: "rectangular",
|
|
64
|
-
width: 20,
|
|
65
|
-
height: 20
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
] });
|
|
69
|
-
};
|
|
70
|
-
const RHFColorPicker = (props) => {
|
|
71
|
-
const { name, size = "small", label, mandatory, mandatoryMessage, helperMessage } = props;
|
|
72
|
-
const { control, setValue, trigger } = useFormContext();
|
|
73
|
-
const isSkeleton = useModuleSkeleton();
|
|
74
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
75
|
-
const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
|
|
76
|
-
const theme = useTheme();
|
|
77
|
-
const currentColor = useWatch({
|
|
78
|
-
name,
|
|
79
|
-
control
|
|
80
|
-
});
|
|
81
|
-
const isDesktop = useResponsiveDesktop();
|
|
82
|
-
const [tempColor, setTempColor] = useState(() => currentColor || "#ffffff");
|
|
83
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
84
|
-
const { getLabel } = useModuleDictionary();
|
|
85
|
-
const handleColorChange = (color) => {
|
|
86
|
-
setTempColor(color.hex);
|
|
87
|
-
};
|
|
88
|
-
const handleApprove = () => {
|
|
89
|
-
setAnchorEl(null);
|
|
90
|
-
if (tempColor !== currentColor) {
|
|
91
|
-
setValue(name, tempColor);
|
|
92
|
-
trigger(name);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const ownerState = {
|
|
96
|
-
isFocus: !isSkeleton ? isFocus : false,
|
|
97
|
-
isTabSelected: !isSkeleton ? isTabSelected : false,
|
|
98
|
-
size: isDesktop ? size : "medium"
|
|
99
|
-
};
|
|
100
|
-
const classes = useUtilityClasses(ownerState);
|
|
101
|
-
return /* @__PURE__ */ jsx(
|
|
102
|
-
RHFColorPickerRoot,
|
|
103
|
-
{
|
|
104
|
-
className: classes.root,
|
|
105
|
-
tabIndex: 0,
|
|
106
|
-
onFocus: handlerFocus,
|
|
107
|
-
onBlur: handlerOnBlur,
|
|
108
|
-
onKeyUp: handlerOnKeyUp,
|
|
109
|
-
children: !isSkeleton ? /* @__PURE__ */ jsx(
|
|
110
|
-
Controller,
|
|
111
|
-
{
|
|
112
|
-
name,
|
|
113
|
-
control,
|
|
114
|
-
defaultValue: "",
|
|
115
|
-
render: ({ field: { value }, fieldState: { error } }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
-
label && /* @__PURE__ */ jsx(
|
|
117
|
-
FieldLabel,
|
|
118
|
-
{
|
|
119
|
-
label,
|
|
120
|
-
mandatory,
|
|
121
|
-
mandatoryMessage,
|
|
122
|
-
helperMessage
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
/* @__PURE__ */ jsxs(
|
|
126
|
-
"div",
|
|
127
|
-
{
|
|
128
|
-
role: "button",
|
|
129
|
-
tabIndex: 0,
|
|
130
|
-
className: classes.containerFieldColor,
|
|
131
|
-
onClick: (event) => setAnchorEl(event.currentTarget),
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ jsx(
|
|
134
|
-
"div",
|
|
135
|
-
{
|
|
136
|
-
className: classes.fieldColor,
|
|
137
|
-
style: {
|
|
138
|
-
backgroundColor: value
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
/* @__PURE__ */ jsx(
|
|
143
|
-
Icon,
|
|
144
|
-
{
|
|
145
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/rhfcolorpicker/assets/icons/chevron_right.svg`
|
|
146
|
-
}
|
|
147
|
-
)
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
error?.message && /* @__PURE__ */ jsx(HelperText, { variant: "error", message: error?.message + "" }),
|
|
152
|
-
/* @__PURE__ */ jsx(
|
|
153
|
-
Popover,
|
|
154
|
-
{
|
|
155
|
-
open: Boolean(anchorEl),
|
|
156
|
-
arrowType: "top-center",
|
|
157
|
-
className: classes.popoverRoot,
|
|
158
|
-
anchorEl,
|
|
159
|
-
onClose: () => setAnchorEl(null),
|
|
160
|
-
anchorOrigin: {
|
|
161
|
-
vertical: "bottom",
|
|
162
|
-
horizontal: "center"
|
|
163
|
-
},
|
|
164
|
-
transformOrigin: {
|
|
165
|
-
vertical: "top",
|
|
166
|
-
horizontal: "center"
|
|
167
|
-
},
|
|
168
|
-
sx: {
|
|
169
|
-
mt: "12px",
|
|
170
|
-
ml: -1.25,
|
|
171
|
-
...theme.components?.M4LRHFColorPickerPopoverRoot?.styleOverrides
|
|
172
|
-
},
|
|
173
|
-
children: /* @__PURE__ */ jsxs("div", { className: classes.containerPicker, children: [
|
|
174
|
-
/* @__PURE__ */ jsx(SketchPicker, { color: tempColor, onChange: handleColorChange, disableAlpha: true }),
|
|
175
|
-
/* @__PURE__ */ jsx(Button, { variant: "contained", onClick: handleApprove, children: getLabel("rhfcolorpicker.accept") })
|
|
176
|
-
] })
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
] })
|
|
180
|
-
}
|
|
181
|
-
) : /* @__PURE__ */ jsx(RHFColorPickerSkeleton, { label })
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
function getRHFColorPickerComponentsDictionary() {
|
|
186
|
-
return ["rhfcolorpicker"];
|
|
187
|
-
}
|
|
188
|
-
export {
|
|
189
|
-
RHFColorPicker as R,
|
|
190
|
-
getRHFColorPickerComponentsDictionary as g
|
|
191
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { DateTimePicker } from "@mui/x-date-pickers";
|
|
4
|
-
import { useEnvironment, useModuleSkeleton } from "@m4l/core";
|
|
5
|
-
import { Skeleton, generateUtilityClasses, generateUtilityClass, styled } from "@mui/material";
|
|
6
|
-
import { useFormatter, useResponsiveDesktop } from "@m4l/graphics";
|
|
7
|
-
import { useState, useEffect } from "react";
|
|
8
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
9
|
-
import clsx from "clsx";
|
|
10
|
-
import { H as HelperText } from "../../HelperText/index.81c5d349.js";
|
|
11
|
-
import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.86c553a9.js";
|
|
12
|
-
import { useFormFocus } from "../../../index.js";
|
|
13
|
-
import { F as FieldLabel } from "../../FieldLabel/index.2622ee40.js";
|
|
14
|
-
import { I as Icon } from "../../Icon/index.ee7b85c9.js";
|
|
15
|
-
const SkeletonRHFDateTime = (props) => {
|
|
16
|
-
const { skeletonWidth, skeletonHeight, className, label } = props;
|
|
17
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
-
label && /* @__PURE__ */ jsx(Skeleton, { variant: "text", height: "14px", width: "30%" }),
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: className.skeleton, children: [
|
|
20
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", width: skeletonWidth, height: skeletonHeight }),
|
|
21
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "circular" })
|
|
22
|
-
] })
|
|
23
|
-
] });
|
|
24
|
-
};
|
|
25
|
-
const componentName = "M4LRHFDateTime";
|
|
26
|
-
generateUtilityClasses(componentName, [
|
|
27
|
-
"root",
|
|
28
|
-
"skeleton",
|
|
29
|
-
"small",
|
|
30
|
-
"medium",
|
|
31
|
-
"isFocus",
|
|
32
|
-
"isTabSelected",
|
|
33
|
-
"isDisabled",
|
|
34
|
-
"variantInfo",
|
|
35
|
-
"variantSuccess",
|
|
36
|
-
"variantWarning",
|
|
37
|
-
"variantError"
|
|
38
|
-
]);
|
|
39
|
-
function getRHFCheckboxUtilityClass(slot) {
|
|
40
|
-
return generateUtilityClass(componentName, slot);
|
|
41
|
-
}
|
|
42
|
-
const useUtilityClasses = (ownerState) => {
|
|
43
|
-
const slots = {
|
|
44
|
-
root: [
|
|
45
|
-
"root",
|
|
46
|
-
ownerState.size === "small" && "small",
|
|
47
|
-
ownerState.size === "medium" && "medium",
|
|
48
|
-
ownerState.isFocus && "isFocus",
|
|
49
|
-
ownerState.isTabSelected && "isTabSelected",
|
|
50
|
-
ownerState.disabled && "isDisabled",
|
|
51
|
-
ownerState.variant === "info" && "variantInfo",
|
|
52
|
-
ownerState.variant === "success" && "variantSuccess",
|
|
53
|
-
ownerState.variant === "warning" && "variantWarning",
|
|
54
|
-
ownerState.variant === "error" && "variantError"
|
|
55
|
-
],
|
|
56
|
-
skeleton: ["skeleton"]
|
|
57
|
-
};
|
|
58
|
-
const composedClasses = unstable_composeClasses(slots, getRHFCheckboxUtilityClass, {});
|
|
59
|
-
return {
|
|
60
|
-
...composedClasses
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const RHFDateTimeRoot = styled("div")(({ theme }) => ({
|
|
64
|
-
...theme.components?.M4LRHFDateTime?.styleOverrides
|
|
65
|
-
}));
|
|
66
|
-
const RHFDATETIME_PREFIX = "RHFDateTime";
|
|
67
|
-
const getNameRHFDateTimeDataTestId = (KEY) => {
|
|
68
|
-
return `${RHFDATETIME_PREFIX}-${KEY}`;
|
|
69
|
-
};
|
|
70
|
-
function RHFDateTime(props) {
|
|
71
|
-
const {
|
|
72
|
-
name: nameRHF,
|
|
73
|
-
disabled,
|
|
74
|
-
size = "small",
|
|
75
|
-
variant,
|
|
76
|
-
skeletonWidth = "50%",
|
|
77
|
-
skeletonHeight = 14,
|
|
78
|
-
className,
|
|
79
|
-
label,
|
|
80
|
-
helperMessage,
|
|
81
|
-
mandatory,
|
|
82
|
-
mandatoryMessage
|
|
83
|
-
} = props;
|
|
84
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
85
|
-
const resourceIcon = () => {
|
|
86
|
-
return /* @__PURE__ */ jsx(
|
|
87
|
-
Icon,
|
|
88
|
-
{
|
|
89
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/rhfdate/ended_at.svg`
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
const [currentVariant, setCurrentVariant] = useState(void 0);
|
|
94
|
-
const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
|
|
95
|
-
const {
|
|
96
|
-
control,
|
|
97
|
-
formState: { errors }
|
|
98
|
-
} = useFormContext();
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
if (errors[nameRHF]) {
|
|
101
|
-
setCurrentVariant("error");
|
|
102
|
-
} else if (variant) {
|
|
103
|
-
setCurrentVariant(variant);
|
|
104
|
-
} else {
|
|
105
|
-
setCurrentVariant(void 0);
|
|
106
|
-
}
|
|
107
|
-
}, [errors[nameRHF], variant, control]);
|
|
108
|
-
const isSkeleton = useModuleSkeleton();
|
|
109
|
-
const {
|
|
110
|
-
dateFormatter: { datetimeFormat }
|
|
111
|
-
} = useFormatter();
|
|
112
|
-
const isDesktop = useResponsiveDesktop();
|
|
113
|
-
const ownerState = {
|
|
114
|
-
isFocus: !isSkeleton ? isFocus : false,
|
|
115
|
-
isTabSelected: !isSkeleton ? isTabSelected : false,
|
|
116
|
-
disabled,
|
|
117
|
-
size: isDesktop ? size : "medium",
|
|
118
|
-
variant: currentVariant
|
|
119
|
-
};
|
|
120
|
-
const classes = useUtilityClasses(ownerState);
|
|
121
|
-
return /* @__PURE__ */ jsx(
|
|
122
|
-
RHFDateTimeRoot,
|
|
123
|
-
{
|
|
124
|
-
className: clsx(classes.root, className),
|
|
125
|
-
tabIndex: 0,
|
|
126
|
-
onFocus: handlerFocus,
|
|
127
|
-
onBlur: handlerOnBlur,
|
|
128
|
-
onKeyUp: handlerOnKeyUp,
|
|
129
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameRHFDateTimeDataTestId("root") } : {},
|
|
130
|
-
children: !isSkeleton ? /* @__PURE__ */ jsx(
|
|
131
|
-
Controller,
|
|
132
|
-
{
|
|
133
|
-
name: nameRHF,
|
|
134
|
-
control,
|
|
135
|
-
render: ({ field: { value, onChange, ref }, fieldState: { error } }) => {
|
|
136
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
137
|
-
label && /* @__PURE__ */ jsx(
|
|
138
|
-
FieldLabel,
|
|
139
|
-
{
|
|
140
|
-
label,
|
|
141
|
-
mandatory,
|
|
142
|
-
mandatoryMessage,
|
|
143
|
-
helperMessage
|
|
144
|
-
}
|
|
145
|
-
),
|
|
146
|
-
/* @__PURE__ */ jsx(
|
|
147
|
-
DateTimePicker,
|
|
148
|
-
{
|
|
149
|
-
sx: {
|
|
150
|
-
"& .MuiTouchRipple-root": {
|
|
151
|
-
display: "none"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
inputRef: ref,
|
|
155
|
-
ampm: true,
|
|
156
|
-
value,
|
|
157
|
-
onChange: (newValue) => {
|
|
158
|
-
onChange(newValue);
|
|
159
|
-
},
|
|
160
|
-
slots: {
|
|
161
|
-
openPickerIcon: resourceIcon
|
|
162
|
-
},
|
|
163
|
-
slotProps: {
|
|
164
|
-
textField: {
|
|
165
|
-
onFocus: handlerFocus,
|
|
166
|
-
onBlur: handlerOnBlur
|
|
167
|
-
},
|
|
168
|
-
field: { format: datetimeFormat }
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
),
|
|
172
|
-
error?.message && /* @__PURE__ */ jsx(HelperText, { variant: "error", message: error?.message + "" })
|
|
173
|
-
] });
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
) : /* @__PURE__ */ jsx(
|
|
177
|
-
SkeletonRHFDateTime,
|
|
178
|
-
{
|
|
179
|
-
skeletonWidth,
|
|
180
|
-
skeletonHeight,
|
|
181
|
-
className: classes,
|
|
182
|
-
label
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
export {
|
|
189
|
-
RHFDateTime as R
|
|
190
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { FormGroup, FormControlLabel, Checkbox } from "@mui/material";
|
|
4
|
-
function RHFMultiCheckbox({ name, options, ...other }) {
|
|
5
|
-
const { control } = useFormContext();
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
-
Controller,
|
|
8
|
-
{
|
|
9
|
-
name,
|
|
10
|
-
control,
|
|
11
|
-
render: ({ field }) => {
|
|
12
|
-
const onSelected = (option) => field.value.includes(option) ? field.value.filter((value) => value !== option) : [...field.value, option];
|
|
13
|
-
return /* @__PURE__ */ jsx(FormGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
|
|
14
|
-
FormControlLabel,
|
|
15
|
-
{
|
|
16
|
-
control: /* @__PURE__ */ jsx(
|
|
17
|
-
Checkbox,
|
|
18
|
-
{
|
|
19
|
-
checked: field.value.includes(option),
|
|
20
|
-
onChange: () => field.onChange(onSelected(option))
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
label: option,
|
|
24
|
-
...other
|
|
25
|
-
},
|
|
26
|
-
option
|
|
27
|
-
)) });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
RHFMultiCheckbox as R
|
|
34
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { styled, generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
3
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
-
import { H as HelperText } from "../../HelperText/index.81c5d349.js";
|
|
5
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
6
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
7
|
-
import { useFormFocus } from "../../../index.js";
|
|
8
|
-
import { F as FieldLabel } from "../../FieldLabel/index.2622ee40.js";
|
|
9
|
-
import { P as Period } from "../../Period/index.c6d1a95a.js";
|
|
10
|
-
const RHFPeriodRoot = styled("div")(({ theme }) => ({
|
|
11
|
-
width: "100%",
|
|
12
|
-
display: "flex",
|
|
13
|
-
flexDirection: "column",
|
|
14
|
-
justifyContent: "center",
|
|
15
|
-
alignItems: "flex-start",
|
|
16
|
-
gap: theme.spacing(1),
|
|
17
|
-
...theme.components?.M4LRHFPeriod?.styleOverrides
|
|
18
|
-
}));
|
|
19
|
-
const componentName = "M4LRHFPeriod";
|
|
20
|
-
generateUtilityClasses(componentName, [
|
|
21
|
-
"root",
|
|
22
|
-
"isFocus",
|
|
23
|
-
"isTabSelected"
|
|
24
|
-
]);
|
|
25
|
-
function getRHFPeriodUtilityClass(slot) {
|
|
26
|
-
return generateUtilityClass(componentName, slot);
|
|
27
|
-
}
|
|
28
|
-
const RHFPeriodUtilityClasses = (ownerState) => {
|
|
29
|
-
const slots = {
|
|
30
|
-
root: ["root", ownerState.isFocus && "isFocus", ownerState.isTabSelected && "isTabSelected"]
|
|
31
|
-
};
|
|
32
|
-
const composedClasses = unstable_composeClasses(slots, getRHFPeriodUtilityClass, {});
|
|
33
|
-
return {
|
|
34
|
-
...composedClasses
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const RHFPeriod = (props) => {
|
|
38
|
-
const {
|
|
39
|
-
name,
|
|
40
|
-
readOnly,
|
|
41
|
-
skeletonWidth,
|
|
42
|
-
skeletonHeight,
|
|
43
|
-
state,
|
|
44
|
-
label,
|
|
45
|
-
mandatory,
|
|
46
|
-
mandatoryMessage,
|
|
47
|
-
helperMessage,
|
|
48
|
-
size
|
|
49
|
-
} = props;
|
|
50
|
-
const { control } = useFormContext();
|
|
51
|
-
const isSkeleton = useModuleSkeleton();
|
|
52
|
-
const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
|
|
53
|
-
const ownerState = {
|
|
54
|
-
isFocus: !isSkeleton ? isFocus : false,
|
|
55
|
-
isTabSelected: !isSkeleton ? isTabSelected : false
|
|
56
|
-
};
|
|
57
|
-
const classes = RHFPeriodUtilityClasses(ownerState);
|
|
58
|
-
return /* @__PURE__ */ jsx(
|
|
59
|
-
RHFPeriodRoot,
|
|
60
|
-
{
|
|
61
|
-
className: classes.root,
|
|
62
|
-
tabIndex: 0,
|
|
63
|
-
onFocus: handlerFocus,
|
|
64
|
-
onBlur: handlerOnBlur,
|
|
65
|
-
onKeyUp: handlerOnKeyUp,
|
|
66
|
-
children: /* @__PURE__ */ jsx(
|
|
67
|
-
Controller,
|
|
68
|
-
{
|
|
69
|
-
name,
|
|
70
|
-
control,
|
|
71
|
-
render: ({ field: { onChange, value }, fieldState: { error } }) => {
|
|
72
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
-
label && /* @__PURE__ */ jsx(
|
|
74
|
-
FieldLabel,
|
|
75
|
-
{
|
|
76
|
-
label,
|
|
77
|
-
mandatory,
|
|
78
|
-
mandatoryMessage,
|
|
79
|
-
helperMessage
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ jsx(
|
|
83
|
-
Period,
|
|
84
|
-
{
|
|
85
|
-
value,
|
|
86
|
-
onChange,
|
|
87
|
-
state: !!error === true ? "error" : state,
|
|
88
|
-
readOnly,
|
|
89
|
-
skeletonWidth,
|
|
90
|
-
skeletonHeight,
|
|
91
|
-
size
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
error && /* @__PURE__ */ jsx(HelperText, { variant: "error", message: error.message || "" })
|
|
95
|
-
] });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
export {
|
|
103
|
-
RHFPeriod as R
|
|
104
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { RadioGroup, FormControlLabel, Radio, FormHelperText } from "@mui/material";
|
|
4
|
-
function RHFRadioGroup({
|
|
5
|
-
name,
|
|
6
|
-
options,
|
|
7
|
-
getOptionLabel,
|
|
8
|
-
getOptionValue,
|
|
9
|
-
...other
|
|
10
|
-
}) {
|
|
11
|
-
const { control } = useFormContext();
|
|
12
|
-
return /* @__PURE__ */ jsx(
|
|
13
|
-
Controller,
|
|
14
|
-
{
|
|
15
|
-
name,
|
|
16
|
-
control,
|
|
17
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsxs("div", { children: [
|
|
18
|
-
/* @__PURE__ */ jsx(RadioGroup, { ...field, row: true, ...other, children: options.map((option) => /* @__PURE__ */ jsx(
|
|
19
|
-
FormControlLabel,
|
|
20
|
-
{
|
|
21
|
-
defaultValue: field.value,
|
|
22
|
-
value: getOptionValue(option),
|
|
23
|
-
control: /* @__PURE__ */ jsx(Radio, {}),
|
|
24
|
-
label: getOptionLabel(option)
|
|
25
|
-
},
|
|
26
|
-
getOptionValue(option)
|
|
27
|
-
)) }),
|
|
28
|
-
!!error && /* @__PURE__ */ jsx(FormHelperText, { error: true, sx: { px: 2 }, children: error.message })
|
|
29
|
-
] })
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
RHFRadioGroup as R
|
|
35
|
-
};
|