@m4l/components 3.1.7 → 3.1.8

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 (201) hide show
  1. package/index.js +183 -340
  2. package/node_modules-CQtkw0uG.js +7350 -0
  3. package/package.json +1 -1
  4. package/vendor-AfIOyqRr.js +24636 -0
  5. package/components/AccountPopover/index-Dm2-k-Mv.js +0 -334
  6. package/components/AppBar/index-i0rhG3J1.js +0 -93
  7. package/components/BaseModule/index-CiNNlxzS.js +0 -30
  8. package/components/CommonActions/components/ActionCancel/index-CIdpDXkr.js +0 -12
  9. package/components/CommonActions/components/ActionFormCancel/index-CpyASN3q.js +0 -56
  10. package/components/CommonActions/components/ActionFormIntro/index-7KKtcUra.js +0 -33
  11. package/components/CommonActions/components/ActionIntro/index-CqqDZZcG.js +0 -25
  12. package/components/CommonActions/components/Actions/index-CuG1pnXW.js +0 -70
  13. package/components/DataGrid/constants-8L7QgBKi.js +0 -10
  14. package/components/DataGrid/formatters/ColumnBooleanFormatter/index-CveSCbq_.js +0 -26
  15. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-CHqvieM2.js +0 -22
  16. package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
  17. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-DE6bwaKP.js +0 -23
  18. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index-BslXGK-A.js +0 -14
  19. package/components/DataGrid/formatters/ColumnPointsFormatter/index-BXGW2CsK.js +0 -10
  20. package/components/DataGrid/formatters/ColumnPriceFormatter/index-O11tBykn.js +0 -10
  21. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index-BaCawLr1.js +0 -36
  22. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index-Cq7a-jnE.js +0 -10
  23. package/components/DataGrid/formatters/index-CrZXPa0e.js +0 -13
  24. package/components/DataGrid/index-BZ-lbmuU.js +0 -908
  25. package/components/DataGrid/subcomponents/Actions/index-CHvPZ4Ru.js +0 -549
  26. package/components/DataGrid/subcomponents/editors/TextEditor/index-BIFm8akr.js +0 -80
  27. package/components/DragResizeWindow/index-D2jLYExo.js +0 -505
  28. package/components/DynamicFilter/constants-ByqmFATV.js +0 -31
  29. package/components/DynamicFilter/dictionary-PrbXU3VZ.js +0 -51
  30. package/components/DynamicFilter/index-DZiJc9h7.js +0 -116
  31. package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
  32. package/components/DynamicFilter/slots/dynamicFilterSlots-DHxelhXP.js +0 -151
  33. package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
  34. package/components/DynamicFilter/store/index-BT-eWVnJ.js +0 -254
  35. package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-B32bAzi-.js +0 -60
  36. package/components/DynamicFilter/subcomponents/AppliedFilters/index-Bha19drV.js +0 -26
  37. package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BmvzoHit.js +0 -40
  38. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-BcO3SlP5.js +0 -129
  39. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BCJhpNS8.js +0 -171
  40. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-DCNhz68u.js +0 -153
  41. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-BdypjM1Y.js +0 -146
  42. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-D-NFIVnK.js +0 -114
  43. package/components/DynamicFilter/subcomponents/FieldTypes/index-BwQHJqk9.js +0 -38
  44. package/components/DynamicFilter/subcomponents/FilterActions/index-B9UWmk07.js +0 -88
  45. package/components/DynamicFilter/subcomponents/InputFilter/index-CfGb1TfV.js +0 -188
  46. package/components/DynamicFilter/subcomponents/PopoverFilter/index-DkfRGrlO.js +0 -158
  47. package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DSegwAm2.js +0 -63
  48. package/components/FieldLabel/index-CI57EizR.js +0 -54
  49. package/components/GridLayout/index-C4HyxNYX.js +0 -1044
  50. package/components/GridLayout/subcomponents/Griditem/index-C7jT4s8t.js +0 -395
  51. package/components/GridLayout/subcomponents/Responsive/index-BKcU2OnF.js +0 -348
  52. package/components/GridLayout/subcomponents/SizeProvider/index-1aJ-e_54.js +0 -71
  53. package/components/HelperText/index-Crn_XIPF.js +0 -50
  54. package/components/Icon/index-C89MAkeH.js +0 -176
  55. package/components/Image/index-COp8vP0X.js +0 -175
  56. package/components/LanguagePopover/index-BA2Igs9L.js +0 -179
  57. package/components/LinearProgressIndeterminate/index-BwI756Mb.js +0 -55
  58. package/components/Loadable/index-BMbi9ISF.js +0 -9
  59. package/components/LoadingError/index-Cf0oGUrL.js +0 -89
  60. package/components/MFIsolationApp/index-V4R55hNU.js +0 -169
  61. package/components/MFLoader/index-BI8vQZSH.js +0 -299
  62. package/components/ModalDialog/index-CEVQBQ7W.js +0 -77
  63. package/components/NavLink/index-D1S_vtFO.js +0 -55
  64. package/components/NoItemSelected/index-B9oM26AX.js +0 -54
  65. package/components/ObjectLogs/index-CiXOJpS4.js +0 -233
  66. package/components/PDFViewer/index-GVN2rfd6.js +0 -51
  67. package/components/Page/index-DZMkYmr4.js +0 -117
  68. package/components/PaperForm/index-DwgAfjci.js +0 -59
  69. package/components/Period/index-2pJG3VmY.js +0 -238
  70. package/components/PrintingSystem/index-B2qcnfw0.js +0 -187
  71. package/components/PrintingSystem/subcomponents/BodyNode/index-Cv2aoy8S.js +0 -49
  72. package/components/PrintingSystem/subcomponents/ChartNode/index-BmJm8v_C.js +0 -105
  73. package/components/PrintingSystem/subcomponents/DividerNode/index-MpFhE-H0.js +0 -20
  74. package/components/PrintingSystem/subcomponents/FooterNode/index-ZEcWdMSM.js +0 -49
  75. package/components/PrintingSystem/subcomponents/GridNode/index-SsKax2xu.js +0 -74
  76. package/components/PrintingSystem/subcomponents/HeaderNode/index-Cs8TOOBL.js +0 -49
  77. package/components/PrintingSystem/subcomponents/PaperNode/index-DBb25Ecg.js +0 -30
  78. package/components/PrintingSystem/subcomponents/PropertyValueNode/index-CTVn7J9Q.js +0 -47
  79. package/components/PrintingSystem/subcomponents/SectionNode/index-iYPM3EaS.js +0 -49
  80. package/components/PrintingSystem/subcomponents/TextBoxNode/index-DGjXCFKJ.js +0 -24
  81. package/components/PropertyValue/index-Bh-Jnrte.js +0 -264
  82. package/components/Resizeable/index-DdP1xfE9.js +0 -20
  83. package/components/ScrollBar/index-f2URPPE2.js +0 -35
  84. package/components/ScrollToTop/index-TxORk5dB.js +0 -12
  85. package/components/SideBar/index-PUBBe0yH.js +0 -758
  86. package/components/SplitLayout/index-Bu1hcO6G.js +0 -89
  87. package/components/ToastContainer/index-DK1d8NNd.js +0 -191
  88. package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
  89. package/components/animate/LoadingScreen/index-CkVLOrMz.js +0 -70
  90. package/components/animate/MotionContainer/index-eartnWyO.js +0 -34
  91. package/components/animate/MotionLazyContainer/index-Be8osTiG.js +0 -9
  92. package/components/animate/PropagateLoader/index-Bkq8V2SN.js +0 -23
  93. package/components/animate/features-BbnE33u3.js +0 -5
  94. package/components/animate/index-BsWiJfzp.js +0 -89
  95. package/components/animate/variants/bounce-DanQqHAX.js +0 -101
  96. package/components/animate/variants/container-Dmpr6tg5.js +0 -22
  97. package/components/animate/variants/fade-CAOJNn06.js +0 -65
  98. package/components/animate/variants/index-l0sNRNKZ.js +0 -1
  99. package/components/animate/variants/transition-B9W5SWTa.js +0 -20
  100. package/components/areas/components/AreasAdmin/index-OxQU3P8Y.js +0 -699
  101. package/components/areas/components/AreasViewer/index-DQ0aPioP.js +0 -805
  102. package/components/areas/components/index-l0sNRNKZ.js +0 -1
  103. package/components/areas/constants-rqODZNZe.js +0 -6
  104. package/components/areas/contexts/AreasContext/index-BqRlA7JA.js +0 -1110
  105. package/components/areas/contexts/DynamicMFParmsContext/index-22c6E7vK.js +0 -36
  106. package/components/areas/contexts/WindowToolsMFContext/index-DkE30fhm.js +0 -12
  107. package/components/areas/contexts/index-l0sNRNKZ.js +0 -1
  108. package/components/areas/dictionary-YUsP9beq.js +0 -36
  109. package/components/areas/hooks/index-l0sNRNKZ.js +0 -1
  110. package/components/areas/hooks/useAreas/index-BSbwbJLS.js +0 -11
  111. package/components/areas/hooks/useDynamicMFParameters/index-DhbcZPs9.js +0 -12
  112. package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle-BzPD-miW.js +0 -31
  113. package/components/areas/hooks/useWindowToolsMF/index-BECQfhbC.js +0 -10
  114. package/components/areas/icons-CwFr-alN.js +0 -24
  115. package/components/areas/index-B_Odny9h.js +0 -22
  116. package/components/commercial/AppBarCommercial/index-CHq3P3GY.js +0 -28
  117. package/components/commercial/SectionCommercial/index-BeABGtdr.js +0 -56
  118. package/components/commercial/TopBar/index-F1repmti.js +0 -232
  119. package/components/commercial/index-CxDzs6Ax.js +0 -81
  120. package/components/formatters/BooleanFormatter/index-DktIidqW.js +0 -44
  121. package/components/formatters/DateFormatter/index-CGcRZ8BA.js +0 -43
  122. package/components/formatters/PointsFormatter/index-C7sR8iqk.js +0 -25
  123. package/components/formatters/PriceFormatter/index-CsvRawmc.js +0 -35
  124. package/components/formatters/UncertaintyFormatter/index-B9ESVEVp.js +0 -29
  125. package/components/formatters/index-pnJhDYKe.js +0 -109
  126. package/components/hook-form/HelperError/index-BVnmUazV.js +0 -19
  127. package/components/hook-form/RHFAutocomplete/index-BtPL16HR.js +0 -657
  128. package/components/hook-form/RHFAutocompleteAsync/index-BfzjLHG8.js +0 -226
  129. package/components/hook-form/RHFCheckbox/index-Vyttu8Vx.js +0 -132
  130. package/components/hook-form/RHFColorPicker/index-Cxxb5Wa_.js +0 -191
  131. package/components/hook-form/RHFDateTime/index-CW1Slb-f.js +0 -190
  132. package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
  133. package/components/hook-form/RHFPeriod/index-r-HeIOoZ.js +0 -98
  134. package/components/hook-form/RHFRadioGroup/index-CTD-0zKo.js +0 -52
  135. package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
  136. package/components/hook-form/RHFTextField/index-B6ufruSB.js +0 -337
  137. package/components/hook-form/RHFUpload/index-CDPbm8NR.js +0 -253
  138. package/components/maps/components/GpsTools/index-5MXlhIEt.js +0 -1948
  139. package/components/maps/components/Map/index-2Lx5ARXa.js +0 -2546
  140. package/components/maps/index-Ci-7-FHg.js +0 -7
  141. package/components/modal/WindowBase-Gd27v5FU.js +0 -44
  142. package/components/modal/WindowConfirm-u6vAMFo7.js +0 -73
  143. package/components/modal/index-CydPIpKZ.js +0 -65
  144. package/components/mui_extended/Accordion/index-DMLYJL7o.js +0 -124
  145. package/components/mui_extended/Avatar/index-ClBa-6eF.js +0 -64
  146. package/components/mui_extended/Badge/index-zI-F_Qkq.js +0 -29
  147. package/components/mui_extended/BoxIcon/index-BUTJ2tKw.js +0 -22
  148. package/components/mui_extended/Breadcrumbs/index-DTS7rOZH.js +0 -86
  149. package/components/mui_extended/Button/index-CGfZbaea.js +0 -222
  150. package/components/mui_extended/CheckBox-BXUrbonB.js +0 -76
  151. package/components/mui_extended/CircularProgress/index-Bnnti_G6.js +0 -8
  152. package/components/mui_extended/IconButton/classes/constants-ChY2jKkp.js +0 -4
  153. package/components/mui_extended/IconButton/classes/index-BxjJGAqZ.js +0 -45
  154. package/components/mui_extended/IconButton/index-CusYFjie.js +0 -97
  155. package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
  156. package/components/mui_extended/LinearProgress/index-CGgW8jq2.js +0 -9
  157. package/components/mui_extended/LinkWithRoute/index-BC2miUjR.js +0 -15
  158. package/components/mui_extended/MenuActions/MenuActions-C6CjSU6C.js +0 -149
  159. package/components/mui_extended/MenuActions/constants-BwsU9chA.js +0 -10
  160. package/components/mui_extended/MenuActions/dictionary-Dj_07puT.js +0 -11
  161. package/components/mui_extended/MenuActions/slots/MenuActionsEnum-Bu-L6eWU.js +0 -13
  162. package/components/mui_extended/MenuActions/slots/MenuActionsSlots-D65KZAKF.js +0 -46
  163. package/components/mui_extended/Pager/index-DCbxiTZA.js +0 -257
  164. package/components/mui_extended/Popover/index-DfrJAQkV.js +0 -153
  165. package/components/mui_extended/Stack/index-DzEeCYfp.js +0 -31
  166. package/components/mui_extended/Tab/index-Bu3dPidV.js +0 -129
  167. package/components/mui_extended/ToggleButton/index-C9cBkT1V.js +0 -18
  168. package/components/mui_extended/ToggleIconButton/index--0b3Td6C.js +0 -26
  169. package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
  170. package/components/mui_extended/Typography/index-Cf_4Zw8f.js +0 -54
  171. package/components/mui_extended/index-l0sNRNKZ.js +0 -1
  172. package/components/popups/PopupsProvider/index-DhSxmtfJ.js +0 -172
  173. package/components/popups/PopupsViewer/constants-DuyD7aCn.js +0 -4
  174. package/components/popups/PopupsViewer/icons-BUujqqbu.js +0 -7
  175. package/components/popups/PopupsViewer/index-BecevSns.js +0 -172
  176. package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
  177. package/components/popups/PopupsViewer/slots/popupsViewerSlots-BXH77nCF.js +0 -46
  178. package/components/popups/index-l0sNRNKZ.js +0 -1
  179. package/contexts/ModalContext/index-CPfNnfTL.js +0 -39
  180. package/contexts/RHFormContext/index-D_nK759o.js +0 -78
  181. package/hocs/withToggle/index-C1_DMZD3.js +0 -14
  182. package/hooks/useFormAddEdit/index-D9oSjUn1.js +0 -90
  183. package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
  184. package/hooks/useModal/index-BJSQOX3U.js +0 -10
  185. package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
  186. package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
  187. package/hooks/useTab/index-B_GEQFOP.js +0 -12
  188. package/react-data-grid-BfYuZ6AK.js +0 -2606
  189. package/react-draggable-DsCPdgQP.js +0 -811
  190. package/react-json-view-bhqIAaNg.js +0 -2576
  191. package/react-resizable-eBbFl2dX.js +0 -618
  192. package/react-spinners-TpKN9lZg.js +0 -123
  193. package/react-splitter-layout-C-JTsNGs.js +0 -158
  194. package/styles/DynamicFilter-CJFsIegc.js +0 -319
  195. package/styles/MenuActions-lTi-ynPM.js +0 -42
  196. package/styles/index-DKj6m8SL.js +0 -1691
  197. package/test/constants_no_mock-CF-669v-.js +0 -4
  198. package/test/getNameDataTestId-BaBTWhBr.js +0 -10
  199. package/utils/index-DiMrtgIu.js +0 -502
  200. /package/components/GridLayout/subcomponents/{Griditem → GridItem}/index.d.ts +0 -0
  201. /package/components/GridLayout/subcomponents/{Griditem → GridItem}/types.d.ts +0 -0
@@ -1,657 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { createElement, useMemo, useRef, useState, useEffect } from "react";
3
- import { useModuleDictionary, useModuleSkeleton, useEnvironment } from "@m4l/core";
4
- import { useFormFocus } from "../../../index.js";
5
- import { generateUtilityClasses, generateUtilityClass, Skeleton, useTheme, Autocomplete, Popper, TextField, Chip } from "@mui/material";
6
- import { useResponsiveDesktop } from "@m4l/graphics";
7
- import { useFormContext, Controller } from "react-hook-form";
8
- import { unstable_composeClasses } from "@mui/base";
9
- import { ag as WrapperOption, ah as AutocompleteRoot } from "../../../styles/index-DKj6m8SL.js";
10
- import { T as TEST_PROP_ID } from "../../../test/constants_no_mock-CF-669v-.js";
11
- import { I as Image } from "../../Image/index-COp8vP0X.js";
12
- import { T as Typography } from "../../mui_extended/Typography/index-Cf_4Zw8f.js";
13
- import { H as HelperText } from "../../HelperText/index-Crn_XIPF.js";
14
- import { F as FieldLabel } from "../../FieldLabel/index-CI57EizR.js";
15
- import { C as CircularProgress } from "../../mui_extended/CircularProgress/index-Bnnti_G6.js";
16
- import { I as IconButton } from "../../mui_extended/IconButton/index-CusYFjie.js";
17
- const componentName = "M4LRHFAutocomplete";
18
- generateUtilityClasses(
19
- componentName,
20
- [
21
- /* elements */
22
- "root",
23
- "withImage",
24
- "skeleton",
25
- "label",
26
- "popper",
27
- "skeletonRoot",
28
- "skeletonContainerText",
29
- "containerRefreshDown",
30
- "iconRefresh",
31
- "iconDown",
32
- /* states or variants of elements */
33
- "variantInfo",
34
- "isDisabled",
35
- "imageWidthDefined",
36
- "variantSuccess",
37
- "variantWarning",
38
- "variantError",
39
- "sizeSmall",
40
- "sizeMedium",
41
- "isFocus",
42
- "isTabSelected",
43
- "chip"
44
- ]
45
- );
46
- function getRHFAutocompleteClassesUtilityClass(slot) {
47
- return generateUtilityClass(componentName, slot);
48
- }
49
- const useUtilityClasses = (ownerState) => {
50
- const slots = {
51
- root: [
52
- "root",
53
- ownerState.size === "small" && "sizeSmall",
54
- ownerState.size === "medium" && "sizeMedium",
55
- ownerState.isFocus && "isFocus",
56
- ownerState.isTabSelected && "isTabSelected",
57
- ownerState.disabled && "isDisabled",
58
- ownerState.semantics === "info" && "variantInfo",
59
- ownerState.semantics === "success" && "variantSuccess",
60
- ownerState.semantics === "warning" && "variantWarning",
61
- ownerState.semantics === "error" && "variantError",
62
- ownerState.multiple && "multiple"
63
- ],
64
- skeleton: ["skeleton"],
65
- label: ["label"],
66
- popper: [
67
- "popper",
68
- ownerState.size === "small" && "sizeSmall",
69
- ownerState.size === "medium" && "sizeMedium",
70
- ownerState.imageScale && "imageScale",
71
- ownerState.imageRepeat && "imageRepeat"
72
- ],
73
- skeletonRoot: ["skeletonRoot"],
74
- skeletonContainerText: ["SkeletonContainerText"],
75
- containerRefreshDown: ["containerRefreshDown"],
76
- iconRefresh: ["iconRefresh"],
77
- iconDown: ["iconDown"],
78
- chip: [
79
- "chip",
80
- ownerState.size === "small" && "sizeSmall",
81
- ownerState.size === "medium" && "sizeMedium"
82
- ]
83
- };
84
- const composedClasses = unstable_composeClasses(slots, getRHFAutocompleteClassesUtilityClass, {});
85
- return {
86
- ...composedClasses
87
- };
88
- };
89
- const RHFAUTOCOMPLETE_PREFIX = "RHFAutocomplete";
90
- const RHFTAUTOCOMPLET_ROOT_TEST_ID = "RHFAutocomplete";
91
- const getNameDataTestId = (KEY) => {
92
- return `${RHFAUTOCOMPLETE_PREFIX}-${KEY}`;
93
- };
94
- function withRenderOption(getUrlImage, classes) {
95
- return function RenderOption(optionProps, option) {
96
- return /* @__PURE__ */ createElement(
97
- WrapperOption,
98
- {
99
- ...optionProps,
100
- key: optionProps.key,
101
- className: classes.withImage,
102
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("withImage") } : {}
103
- },
104
- /* @__PURE__ */ jsx(Image, { src: getUrlImage(option) }),
105
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: optionProps.key })
106
- );
107
- };
108
- }
109
- const SkeletonRHFAutocomplete = (props) => {
110
- const { withImage, classes, hasLabel } = props;
111
- return /* @__PURE__ */ jsxs("div", { className: classes.skeletonRoot, children: [
112
- (hasLabel || hasLabel?.length === 0) && /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "30%", height: "16px" }),
113
- /* @__PURE__ */ jsx(
114
- "div",
115
- {
116
- className: classes.skeleton,
117
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("skeleton") } : {},
118
- children: !withImage ? /* @__PURE__ */ jsxs(Fragment, { children: [
119
- /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
120
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
121
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
122
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular" }),
123
- /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
124
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
125
- ] })
126
- }
127
- )
128
- ] });
129
- };
130
- function ComponentTypeImage(props) {
131
- const {
132
- name: nameRHF,
133
- getOptionLabel,
134
- isOptionEqualToValue,
135
- label,
136
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
137
- skeletonWidth = 100,
138
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
139
- skeletonHeight = "18px",
140
- options,
141
- disabled,
142
- getOptionUrlImage,
143
- onOpen,
144
- onClose,
145
- loading,
146
- variant,
147
- helperMessage,
148
- size = "small",
149
- onChangeFilterParmsLocal,
150
- mandatory,
151
- mandatoryMessage,
152
- multiple,
153
- imageScale = true,
154
- imageRepeat,
155
- refresh,
156
- ...other
157
- } = props;
158
- const { getLabel } = useModuleDictionary();
159
- const isSkeleton = useModuleSkeleton();
160
- const withImage = useMemo(() => getOptionUrlImage !== void 0, [getOptionUrlImage]);
161
- const { host_static_assets, environment_assets } = useEnvironment();
162
- const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
163
- const autocompleteRef = useRef(null);
164
- const [open, setOpen] = useState(false);
165
- const isDesktop = useResponsiveDesktop();
166
- const onCloseLocal = (event, reason) => {
167
- setOpen(false);
168
- if (onClose) onClose(event, reason);
169
- };
170
- const onOpenLocal = (event) => {
171
- setOpen((currentState) => !currentState);
172
- if (onOpen) onOpen(event);
173
- };
174
- const getOptionLabelLocal = (option) => {
175
- if (option === void 0 || option === null) {
176
- return "";
177
- }
178
- return getOptionLabel(option);
179
- };
180
- const getOptionUrlImageLocal = (option) => {
181
- if (option === void 0 || option === null || getOptionUrlImage === void 0) {
182
- return "";
183
- }
184
- return getOptionUrlImage(option);
185
- };
186
- const isOptionEqualToValueLocal = (option, value) => {
187
- if (value === void 0 || value === null || option === null) {
188
- return false;
189
- }
190
- return isOptionEqualToValue(option, value);
191
- };
192
- const {
193
- control,
194
- formState: { errors }
195
- } = useFormContext();
196
- const [currentVariant, setCurrentVariant] = useState(
197
- null
198
- );
199
- useEffect(() => {
200
- if (errors[nameRHF]) {
201
- setCurrentVariant("error");
202
- } else if (variant) {
203
- setCurrentVariant(variant);
204
- } else {
205
- setCurrentVariant(null);
206
- }
207
- }, [errors[nameRHF], variant, control]);
208
- const ownerState = {
209
- size: !isDesktop ? "medium" : size,
210
- isFocus: !isSkeleton ? isFocus : false,
211
- isTabSelected: !isSkeleton ? isTabSelected : false,
212
- semantics: currentVariant,
213
- disabled,
214
- multiple: Boolean(multiple),
215
- imageScale: Boolean(imageScale),
216
- imageRepeat: Boolean(imageRepeat)
217
- };
218
- const classes = useUtilityClasses(ownerState);
219
- const theme = useTheme();
220
- return /* @__PURE__ */ jsx(
221
- AutocompleteRoot,
222
- {
223
- className: classes.root,
224
- tabIndex: 0,
225
- onFocus: handlerFocus,
226
- onBlur: handlerOnBlur,
227
- onKeyUp: handlerOnKeyUp,
228
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: `${RHFTAUTOCOMPLET_ROOT_TEST_ID}_${nameRHF}` } : {},
229
- children: !isSkeleton ? /* @__PURE__ */ jsx(
230
- Controller,
231
- {
232
- name: nameRHF,
233
- control,
234
- render: ({ field: { onChange, value }, fieldState: { error } }) => {
235
- const [inputValue, setInputValue] = useState(getOptionLabelLocal(value));
236
- useEffect(() => {
237
- if (!open && value === null && inputValue !== "") {
238
- setInputValue("");
239
- }
240
- if (!open && value !== null && options.length === 0) {
241
- onChangeFilterParmsLocal?.(getOptionLabelLocal(value), "reset");
242
- }
243
- }, [value]);
244
- const checkKeyDown = (e) => {
245
- if (e.code === "Enter") e.preventDefault();
246
- };
247
- return /* @__PURE__ */ jsxs(Fragment, { children: [
248
- label && /* @__PURE__ */ jsx(
249
- FieldLabel,
250
- {
251
- className: classes.label,
252
- label,
253
- mandatory,
254
- mandatoryMessage,
255
- helperMessage
256
- }
257
- ),
258
- /* @__PURE__ */ jsx(
259
- Autocomplete,
260
- {
261
- autoComplete: true,
262
- disableClearable: true,
263
- multiple,
264
- onKeyDown: checkKeyDown,
265
- size,
266
- ref: autocompleteRef,
267
- autoSelect: false,
268
- options,
269
- getOptionLabel: getOptionLabelLocal,
270
- inputValue,
271
- clearOnBlur: false,
272
- PopperComponent: (popperProps) => {
273
- return /* @__PURE__ */ jsx(
274
- Popper,
275
- {
276
- ...popperProps,
277
- className: classes.popper,
278
- placement: "bottom-start",
279
- sx: {
280
- ...theme.components?.M4LRHFAutocompletePopover?.styleOverrides
281
- }
282
- }
283
- );
284
- },
285
- onInputChange: (_event, newValue, reason) => {
286
- if (reason === "input") {
287
- setInputValue(newValue);
288
- if (onChangeFilterParmsLocal) {
289
- onChangeFilterParmsLocal(newValue, reason);
290
- }
291
- } else {
292
- onChange(null);
293
- }
294
- },
295
- isOptionEqualToValue: isOptionEqualToValueLocal,
296
- value: Array.isArray(value) ? value : multiple ? value ? [value] : [] : value || null,
297
- onOpen: onOpenLocal,
298
- onClose: onCloseLocal,
299
- open,
300
- onChange: (_e, newValue) => {
301
- if (!multiple && !Array.isArray(newValue)) {
302
- setInputValue(getOptionLabelLocal(newValue));
303
- } else {
304
- setInputValue("");
305
- }
306
- onChange(Array.isArray(newValue) ? [...newValue] : newValue);
307
- },
308
- filterOptions: onChangeFilterParmsLocal ? (x) => x : void 0,
309
- loading,
310
- loadingText: /* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel("rhf_autocomplete.loading_options") }),
311
- disabled,
312
- noOptionsText: getLabel("rhf_autocomplete.no_options"),
313
- renderOption: withRenderOption(getOptionUrlImageLocal, classes),
314
- renderInput: (params) => {
315
- return /* @__PURE__ */ jsx(
316
- TextField,
317
- {
318
- ...params,
319
- InputLabelProps: {
320
- ...params.InputLabelProps,
321
- shrink: true
322
- },
323
- fullWidth: true,
324
- size,
325
- SelectProps: { native: true },
326
- InputProps: {
327
- ...params.InputProps,
328
- startAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
329
- !multiple && withImage && value ? /* @__PURE__ */ jsx(
330
- Image,
331
- {
332
- src: getOptionUrlImageLocal(value)
333
- },
334
- "ImageTextField"
335
- ) : null,
336
- params.InputProps.startAdornment
337
- ] }),
338
- endAdornment: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "inherit", size: 18 }) : /* @__PURE__ */ jsxs("div", { className: classes.containerRefreshDown, children: [
339
- refresh && /* @__PURE__ */ jsx(
340
- IconButton,
341
- {
342
- className: classes.iconRefresh,
343
- src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/round_refresh.svg`,
344
- onClick: () => refresh(),
345
- disabled,
346
- size
347
- }
348
- ),
349
- /* @__PURE__ */ jsx(
350
- IconButton,
351
- {
352
- className: classes.iconDown,
353
- src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/chevronDown.svg`,
354
- onClick: (event) => onOpenLocal(event),
355
- disabled,
356
- size
357
- }
358
- )
359
- ] })
360
- },
361
- autoComplete: "off",
362
- error: !!error,
363
- ...other
364
- }
365
- );
366
- },
367
- ...multiple ? {
368
- renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => {
369
- const { key, ...restTagProps } = getTagProps({
370
- index
371
- });
372
- return /* @__PURE__ */ createElement(
373
- Chip,
374
- {
375
- ...restTagProps,
376
- key,
377
- label: getOptionLabelLocal(option),
378
- className: classes.chip,
379
- icon: withImage && option ? /* @__PURE__ */ jsx(
380
- Image,
381
- {
382
- src: getOptionUrlImageLocal(option)
383
- }
384
- ) : void 0,
385
- sx: {
386
- ...theme.components?.M4LRHFAutocompleteChip?.styleOverrides
387
- }
388
- }
389
- );
390
- })
391
- } : {}
392
- }
393
- ),
394
- currentVariant === "error" ? /* @__PURE__ */ jsx(HelperText, { variant: currentVariant, message: error?.message }) : null
395
- ] });
396
- }
397
- }
398
- ) : /* @__PURE__ */ jsx(SkeletonRHFAutocomplete, { withImage, classes, hasLabel: label })
399
- }
400
- );
401
- }
402
- function ComponentTypeText(props) {
403
- const {
404
- name: nameRHF,
405
- getOptionLabel,
406
- isOptionEqualToValue,
407
- label,
408
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
409
- skeletonWidth = 100,
410
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
411
- skeletonHeight = "18px",
412
- options,
413
- disabled,
414
- onOpen,
415
- onClose,
416
- loading,
417
- variant,
418
- helperMessage,
419
- size = "small",
420
- onChangeFilterParmsLocal,
421
- mandatory,
422
- mandatoryMessage,
423
- multiple,
424
- refresh,
425
- ...other
426
- } = props;
427
- const { getLabel } = useModuleDictionary();
428
- const isSkeleton = useModuleSkeleton();
429
- const { host_static_assets, environment_assets } = useEnvironment();
430
- const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
431
- const autocompleteRef = useRef(null);
432
- const [open, setOpen] = useState(false);
433
- const isDesktop = useResponsiveDesktop();
434
- const onCloseLocal = (event, reason) => {
435
- setOpen(false);
436
- if (onClose) onClose(event, reason);
437
- };
438
- const onOpenLocal = (event) => {
439
- setOpen((currentState) => !currentState);
440
- if (onOpen) onOpen(event);
441
- };
442
- const getOptionLabelLocal = (option) => {
443
- if (option === void 0 || option === null) {
444
- return "";
445
- }
446
- return getOptionLabel(option);
447
- };
448
- const isOptionEqualToValueLocal = (option, value) => {
449
- if (value === void 0 || value === null || option === null) {
450
- return false;
451
- }
452
- return isOptionEqualToValue(option, value);
453
- };
454
- const {
455
- control,
456
- formState: { errors }
457
- } = useFormContext();
458
- const [currentVariant, setCurrentVariant] = useState(
459
- null
460
- );
461
- useEffect(() => {
462
- if (errors[nameRHF]) {
463
- setCurrentVariant("error");
464
- } else if (variant) {
465
- setCurrentVariant(variant);
466
- } else {
467
- setCurrentVariant(null);
468
- }
469
- }, [errors[nameRHF], variant, control]);
470
- const ownerState = {
471
- size: !isDesktop ? "medium" : size,
472
- isFocus: !isSkeleton ? isFocus : false,
473
- isTabSelected: !isSkeleton ? isTabSelected : false,
474
- semantics: currentVariant,
475
- disabled,
476
- multiple: Boolean(multiple)
477
- };
478
- const classes = useUtilityClasses(ownerState);
479
- const theme = useTheme();
480
- return /* @__PURE__ */ jsx(
481
- AutocompleteRoot,
482
- {
483
- className: classes.root,
484
- tabIndex: 0,
485
- onFocus: handlerFocus,
486
- onBlur: handlerOnBlur,
487
- onKeyUp: handlerOnKeyUp,
488
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: `${RHFTAUTOCOMPLET_ROOT_TEST_ID}_${nameRHF}` } : {},
489
- children: !isSkeleton ? /* @__PURE__ */ jsx(
490
- Controller,
491
- {
492
- name: nameRHF,
493
- control,
494
- render: ({ field: { onChange, value }, fieldState: { error } }) => {
495
- const [inputValue, setInputValue] = useState(getOptionLabelLocal(value));
496
- useEffect(() => {
497
- if (!open && value === null && inputValue !== "") {
498
- setInputValue("");
499
- }
500
- if (!open && value !== null && options.length === 0) {
501
- onChangeFilterParmsLocal?.(getOptionLabelLocal(value), "reset");
502
- }
503
- }, [value]);
504
- const checkKeyDown = (e) => {
505
- if (e.code === "Enter") e.preventDefault();
506
- };
507
- return /* @__PURE__ */ jsxs(Fragment, { children: [
508
- label && /* @__PURE__ */ jsx(
509
- FieldLabel,
510
- {
511
- className: classes.label,
512
- label,
513
- mandatory,
514
- mandatoryMessage,
515
- helperMessage
516
- }
517
- ),
518
- /* @__PURE__ */ jsx(
519
- Autocomplete,
520
- {
521
- autoComplete: true,
522
- disableClearable: true,
523
- multiple,
524
- onKeyDown: checkKeyDown,
525
- size,
526
- ref: autocompleteRef,
527
- autoSelect: false,
528
- options,
529
- getOptionLabel: getOptionLabelLocal,
530
- inputValue,
531
- clearOnBlur: false,
532
- PopperComponent: (popperProps) => {
533
- return /* @__PURE__ */ jsx(
534
- Popper,
535
- {
536
- ...popperProps,
537
- className: classes.popper,
538
- placement: "bottom-start",
539
- sx: {
540
- ...theme.components?.M4LRHFAutocompletePopover?.styleOverrides
541
- }
542
- }
543
- );
544
- },
545
- onInputChange: (_event, newValue, reason) => {
546
- if (reason === "input") {
547
- setInputValue(newValue);
548
- if (onChangeFilterParmsLocal) {
549
- onChangeFilterParmsLocal(newValue, reason);
550
- }
551
- } else {
552
- onChange(null);
553
- }
554
- },
555
- isOptionEqualToValue: isOptionEqualToValueLocal,
556
- value: Array.isArray(value) ? value : multiple ? value ? [value] : [] : value || null,
557
- onOpen: onOpenLocal,
558
- onClose: onCloseLocal,
559
- open,
560
- onChange: (_e, newValue) => {
561
- if (!multiple && !Array.isArray(newValue)) {
562
- setInputValue(getOptionLabelLocal(newValue));
563
- } else {
564
- setInputValue("");
565
- }
566
- onChange(Array.isArray(newValue) ? [...newValue] : newValue);
567
- },
568
- filterOptions: onChangeFilterParmsLocal ? (x) => x : void 0,
569
- loading,
570
- loadingText: /* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel("rhf_autocomplete.loading_options") }),
571
- disabled,
572
- noOptionsText: getLabel("rhf_autocomplete.no_options"),
573
- renderOption: void 0,
574
- renderInput: (params) => {
575
- return /* @__PURE__ */ jsx(
576
- TextField,
577
- {
578
- ...params,
579
- InputLabelProps: {
580
- ...params.InputLabelProps,
581
- shrink: true
582
- },
583
- fullWidth: true,
584
- size,
585
- SelectProps: { native: true },
586
- InputProps: {
587
- ...params.InputProps,
588
- startAdornment: /* @__PURE__ */ jsx(Fragment, { children: params.InputProps.startAdornment }),
589
- endAdornment: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "inherit", size: 18 }) : /* @__PURE__ */ jsxs("div", { className: classes.containerRefreshDown, children: [
590
- refresh && /* @__PURE__ */ jsx(
591
- IconButton,
592
- {
593
- className: classes.iconRefresh,
594
- src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/round_refresh.svg`,
595
- onClick: () => refresh(),
596
- disabled,
597
- size
598
- }
599
- ),
600
- /* @__PURE__ */ jsx(
601
- IconButton,
602
- {
603
- className: classes.iconDown,
604
- src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/chevronDown.svg`,
605
- onClick: (event) => onOpenLocal(event),
606
- disabled,
607
- size
608
- }
609
- )
610
- ] })
611
- },
612
- autoComplete: "off",
613
- error: !!error,
614
- ...other
615
- }
616
- );
617
- },
618
- ...multiple ? {
619
- renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => {
620
- const { key, ...restTagProps } = getTagProps({
621
- index
622
- });
623
- return /* @__PURE__ */ createElement(
624
- Chip,
625
- {
626
- ...restTagProps,
627
- key,
628
- label: getOptionLabelLocal(option),
629
- className: classes.chip,
630
- icon: void 0,
631
- sx: {
632
- ...theme.components?.M4LRHFAutocompleteChip?.styleOverrides
633
- }
634
- }
635
- );
636
- })
637
- } : {}
638
- }
639
- ),
640
- currentVariant === "error" ? /* @__PURE__ */ jsx(HelperText, { variant: currentVariant, message: error?.message }) : null
641
- ] });
642
- }
643
- }
644
- ) : /* @__PURE__ */ jsx(SkeletonRHFAutocomplete, { classes, hasLabel: label })
645
- }
646
- );
647
- }
648
- function RHFAutocomplete(props) {
649
- return /* @__PURE__ */ jsx(Fragment, { children: props.type === "image" ? /* @__PURE__ */ jsx(ComponentTypeImage, { ...props }) : /* @__PURE__ */ jsx(ComponentTypeText, { ...props }) });
650
- }
651
- function getRHFAutocompleteComponentsDictionary() {
652
- return ["rhf_autocomplete"];
653
- }
654
- export {
655
- RHFAutocomplete as R,
656
- getRHFAutocompleteComponentsDictionary as g
657
- };