@m4l/components 3.1.6 → 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 (203) hide show
  1. package/components/mui_extended/IconButton/index.d.ts +1 -1
  2. package/components/mui_extended/MenuActions/slots/MenuActionsSlots.d.ts +2 -4
  3. package/index.js +183 -339
  4. package/node_modules-CQtkw0uG.js +7350 -0
  5. package/package.json +1 -1
  6. package/vendor-AfIOyqRr.js +24636 -0
  7. package/components/AccountPopover/index-BdnzI23R.js +0 -334
  8. package/components/AppBar/index-Dvrx1jsr.js +0 -93
  9. package/components/BaseModule/index-BQ2UIUCy.js +0 -30
  10. package/components/CommonActions/components/ActionCancel/index-DSVEMl41.js +0 -12
  11. package/components/CommonActions/components/ActionFormCancel/index-DMsGH0wx.js +0 -56
  12. package/components/CommonActions/components/ActionFormIntro/index-C8zb7R3W.js +0 -33
  13. package/components/CommonActions/components/ActionIntro/index-BNIG3KAH.js +0 -25
  14. package/components/CommonActions/components/Actions/index-90JsZTzb.js +0 -70
  15. package/components/DataGrid/constants-8L7QgBKi.js +0 -10
  16. package/components/DataGrid/formatters/ColumnBooleanFormatter/index-ZsSxUL_T.js +0 -26
  17. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index-D-gZpvcm.js +0 -22
  18. package/components/DataGrid/formatters/ColumnDateFormatter/index-CKg8CJ6A.js +0 -19
  19. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index-kZGiDU5k.js +0 -23
  20. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index-BslXGK-A.js +0 -14
  21. package/components/DataGrid/formatters/ColumnPointsFormatter/index-BXGW2CsK.js +0 -10
  22. package/components/DataGrid/formatters/ColumnPriceFormatter/index-O11tBykn.js +0 -10
  23. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index-BaCawLr1.js +0 -36
  24. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index-Cq7a-jnE.js +0 -10
  25. package/components/DataGrid/formatters/index-iKq2iRoa.js +0 -13
  26. package/components/DataGrid/index-DGHnRo8z.js +0 -908
  27. package/components/DataGrid/subcomponents/Actions/index-BhBvobKS.js +0 -549
  28. package/components/DataGrid/subcomponents/editors/TextEditor/index-BIFm8akr.js +0 -80
  29. package/components/DragResizeWindow/index-D2jLYExo.js +0 -505
  30. package/components/DynamicFilter/constants-ByqmFATV.js +0 -31
  31. package/components/DynamicFilter/dictionary-D9Z9YGDb.js +0 -51
  32. package/components/DynamicFilter/index-CRmtRWlr.js +0 -116
  33. package/components/DynamicFilter/slots/SlotsEnum-cawFeNzx.js +0 -34
  34. package/components/DynamicFilter/slots/dynamicFilterSlots-CQiB8TmY.js +0 -151
  35. package/components/DynamicFilter/slots/index-l0sNRNKZ.js +0 -1
  36. package/components/DynamicFilter/store/index-DoIifWTk.js +0 -254
  37. package/components/DynamicFilter/subcomponents/AppliedFilterChip/index-DQESCg04.js +0 -60
  38. package/components/DynamicFilter/subcomponents/AppliedFilters/index-CGmflaoY.js +0 -26
  39. package/components/DynamicFilter/subcomponents/DynamicFilterBase/index-BfH6YHNi.js +0 -40
  40. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/index-Dv3KjuYK.js +0 -129
  41. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/index-BnhNICK4.js +0 -171
  42. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/index-CNN6DeHY.js +0 -153
  43. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/index-C2dNPFtM.js +0 -146
  44. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/index-B03ahaU6.js +0 -114
  45. package/components/DynamicFilter/subcomponents/FieldTypes/index-EF7A6WnZ.js +0 -38
  46. package/components/DynamicFilter/subcomponents/FilterActions/index-CQtA2ELu.js +0 -88
  47. package/components/DynamicFilter/subcomponents/InputFilter/index-EXbXDSZA.js +0 -188
  48. package/components/DynamicFilter/subcomponents/PopoverFilter/index-BX8YCh9v.js +0 -158
  49. package/components/DynamicFilter/subcomponents/PopoverMenuFields/index-DvAYf5-a.js +0 -63
  50. package/components/FieldLabel/index-C8od8D0w.js +0 -54
  51. package/components/GridLayout/index-EPw3AYiQ.js +0 -1044
  52. package/components/GridLayout/subcomponents/Griditem/index-B8Q7iMhr.js +0 -395
  53. package/components/GridLayout/subcomponents/Responsive/index-D6BbBdVx.js +0 -348
  54. package/components/GridLayout/subcomponents/SizeProvider/index-OhbtnEN4.js +0 -71
  55. package/components/HelperText/index-sLK3dYG0.js +0 -50
  56. package/components/Icon/index-BJF_0F6d.js +0 -176
  57. package/components/Image/index-BxphCFC7.js +0 -175
  58. package/components/LanguagePopover/index-CkKie1Ph.js +0 -179
  59. package/components/LinearProgressIndeterminate/index-CTvXOPRx.js +0 -55
  60. package/components/Loadable/index-BMbi9ISF.js +0 -9
  61. package/components/LoadingError/index-BaaPhmyF.js +0 -89
  62. package/components/MFIsolationApp/index-BfHLGDcN.js +0 -169
  63. package/components/MFLoader/index-B8FmSpE7.js +0 -299
  64. package/components/ModalDialog/index-WSVr5sZr.js +0 -77
  65. package/components/NavLink/index-CKgi5l5M.js +0 -55
  66. package/components/NoItemSelected/index-BKsZKc_f.js +0 -54
  67. package/components/ObjectLogs/index-BJkjYQaa.js +0 -233
  68. package/components/PDFViewer/index-Cnbioqzo.js +0 -51
  69. package/components/Page/index-DSSwuNSp.js +0 -117
  70. package/components/PaperForm/index-C1OKDnuY.js +0 -59
  71. package/components/Period/index-DYE7Bj45.js +0 -238
  72. package/components/PrintingSystem/index-BkfHXcTV.js +0 -187
  73. package/components/PrintingSystem/subcomponents/BodyNode/index-Btg2zXVQ.js +0 -49
  74. package/components/PrintingSystem/subcomponents/ChartNode/index-GLjhqKd2.js +0 -105
  75. package/components/PrintingSystem/subcomponents/DividerNode/index-D9T1MWQd.js +0 -20
  76. package/components/PrintingSystem/subcomponents/FooterNode/index-C3LET1ZY.js +0 -49
  77. package/components/PrintingSystem/subcomponents/GridNode/index-BPz7lGvC.js +0 -74
  78. package/components/PrintingSystem/subcomponents/HeaderNode/index-DY4Yci1r.js +0 -49
  79. package/components/PrintingSystem/subcomponents/PaperNode/index-BYoGJll5.js +0 -30
  80. package/components/PrintingSystem/subcomponents/PropertyValueNode/index-vFZ5Skyl.js +0 -47
  81. package/components/PrintingSystem/subcomponents/SectionNode/index-BNqGWpcj.js +0 -49
  82. package/components/PrintingSystem/subcomponents/TextBoxNode/index-wgdfWbfF.js +0 -24
  83. package/components/PropertyValue/index-dwO3Qo0Y.js +0 -264
  84. package/components/Resizeable/index-CHseEYjL.js +0 -20
  85. package/components/ScrollBar/index-BYMy_qJE.js +0 -35
  86. package/components/ScrollToTop/index-TxORk5dB.js +0 -12
  87. package/components/SideBar/index-DqKD_S9_.js +0 -758
  88. package/components/SplitLayout/index-D4lxi0ig.js +0 -89
  89. package/components/ToastContainer/index-jnQcIcV1.js +0 -191
  90. package/components/WrapperComponent/index-BHV-CsDU.js +0 -14
  91. package/components/animate/LoadingScreen/index-CTGGa4Yt.js +0 -70
  92. package/components/animate/MotionContainer/index-eartnWyO.js +0 -34
  93. package/components/animate/MotionLazyContainer/index-Be8osTiG.js +0 -9
  94. package/components/animate/PropagateLoader/index-Bkq8V2SN.js +0 -23
  95. package/components/animate/features-BbnE33u3.js +0 -5
  96. package/components/animate/index-9dC9NmWv.js +0 -89
  97. package/components/animate/variants/bounce-DanQqHAX.js +0 -101
  98. package/components/animate/variants/container-Dmpr6tg5.js +0 -22
  99. package/components/animate/variants/fade-CAOJNn06.js +0 -65
  100. package/components/animate/variants/index-l0sNRNKZ.js +0 -1
  101. package/components/animate/variants/transition-B9W5SWTa.js +0 -20
  102. package/components/areas/components/AreasAdmin/index-BU9AX60_.js +0 -699
  103. package/components/areas/components/AreasViewer/index-CPlZxIzK.js +0 -805
  104. package/components/areas/components/index-l0sNRNKZ.js +0 -1
  105. package/components/areas/constants-rqODZNZe.js +0 -6
  106. package/components/areas/contexts/AreasContext/index-DGguLxcX.js +0 -1110
  107. package/components/areas/contexts/DynamicMFParmsContext/index-22c6E7vK.js +0 -36
  108. package/components/areas/contexts/WindowToolsMFContext/index-DkE30fhm.js +0 -12
  109. package/components/areas/contexts/index-l0sNRNKZ.js +0 -1
  110. package/components/areas/dictionary-YUsP9beq.js +0 -36
  111. package/components/areas/hooks/index-l0sNRNKZ.js +0 -1
  112. package/components/areas/hooks/useAreas/index-DBXtbtIu.js +0 -11
  113. package/components/areas/hooks/useDynamicMFParameters/index-DhbcZPs9.js +0 -12
  114. package/components/areas/hooks/useSetWindowsTitle/useSetWindowsTitle-BzPD-miW.js +0 -31
  115. package/components/areas/hooks/useWindowToolsMF/index-BECQfhbC.js +0 -10
  116. package/components/areas/icons-CwFr-alN.js +0 -24
  117. package/components/areas/index-B_Odny9h.js +0 -22
  118. package/components/commercial/AppBarCommercial/index-faX1fxjn.js +0 -28
  119. package/components/commercial/SectionCommercial/index-Dspd2Hd7.js +0 -56
  120. package/components/commercial/TopBar/index-zACdM_C0.js +0 -232
  121. package/components/commercial/index-9P0yOdH4.js +0 -81
  122. package/components/formatters/BooleanFormatter/index-PoFZ3r_m.js +0 -44
  123. package/components/formatters/DateFormatter/index-CGcRZ8BA.js +0 -43
  124. package/components/formatters/PointsFormatter/index-C7sR8iqk.js +0 -25
  125. package/components/formatters/PriceFormatter/index-CsvRawmc.js +0 -35
  126. package/components/formatters/UncertaintyFormatter/index-B9ESVEVp.js +0 -29
  127. package/components/formatters/index-CEJ6VCMb.js +0 -109
  128. package/components/hook-form/HelperError/index-DRvAkpwm.js +0 -19
  129. package/components/hook-form/RHFAutocomplete/index-DS57m8AX.js +0 -657
  130. package/components/hook-form/RHFAutocompleteAsync/index-Bu6NYmG_.js +0 -226
  131. package/components/hook-form/RHFCheckbox/index-BsB42rRc.js +0 -132
  132. package/components/hook-form/RHFColorPicker/index-Dox0FPrV.js +0 -191
  133. package/components/hook-form/RHFDateTime/index-ef19Az1N.js +0 -190
  134. package/components/hook-form/RHFMultiCheckbox/index-BARudV1A.js +0 -34
  135. package/components/hook-form/RHFPeriod/index-DyRLTD0w.js +0 -98
  136. package/components/hook-form/RHFRadioGroup/index-pgTLVF9t.js +0 -52
  137. package/components/hook-form/RHFSelect/index-LdwRuFz-.js +0 -29
  138. package/components/hook-form/RHFTextField/index-BgsElxUF.js +0 -337
  139. package/components/hook-form/RHFUpload/index-B6m3ypzh.js +0 -253
  140. package/components/maps/components/GpsTools/index-CeLi75XZ.js +0 -1948
  141. package/components/maps/components/Map/index-D4B8Lfgv.js +0 -2545
  142. package/components/maps/index-Ci-7-FHg.js +0 -7
  143. package/components/modal/WindowBase-CkftshqR.js +0 -44
  144. package/components/modal/WindowConfirm-C5YnzF-B.js +0 -73
  145. package/components/modal/index-CydPIpKZ.js +0 -65
  146. package/components/mui_extended/Accordion/index-jF2uxSmi.js +0 -124
  147. package/components/mui_extended/Avatar/index-CHmsrmfc.js +0 -64
  148. package/components/mui_extended/Badge/index-B_BGIjkQ.js +0 -29
  149. package/components/mui_extended/BoxIcon/index-BUTJ2tKw.js +0 -22
  150. package/components/mui_extended/Breadcrumbs/index-DTS7rOZH.js +0 -86
  151. package/components/mui_extended/Button/index-CgvCim_g.js +0 -222
  152. package/components/mui_extended/CheckBox-H73kpinr.js +0 -76
  153. package/components/mui_extended/CircularProgress/index-Bnnti_G6.js +0 -8
  154. package/components/mui_extended/IconButton/classes/constants-ChY2jKkp.js +0 -4
  155. package/components/mui_extended/IconButton/classes/index-BxjJGAqZ.js +0 -45
  156. package/components/mui_extended/IconButton/index-B8lOMybH.js +0 -117
  157. package/components/mui_extended/IconButton/styledIconButton-fAsbGoFS.js +0 -7
  158. package/components/mui_extended/IconButton/types-l0sNRNKZ.js +0 -1
  159. package/components/mui_extended/LinearProgress/index-CGgW8jq2.js +0 -9
  160. package/components/mui_extended/LinkWithRoute/index-BC2miUjR.js +0 -15
  161. package/components/mui_extended/MenuActions/MenuActions-DA_aS7o5.js +0 -149
  162. package/components/mui_extended/MenuActions/constants-BwsU9chA.js +0 -10
  163. package/components/mui_extended/MenuActions/dictionary-Dj_07puT.js +0 -11
  164. package/components/mui_extended/MenuActions/slots/MenuActionsEnum-Bu-L6eWU.js +0 -13
  165. package/components/mui_extended/MenuActions/slots/MenuActionsSlots-BVp0M8fu.js +0 -47
  166. package/components/mui_extended/Pager/index-Dtk4aUiU.js +0 -257
  167. package/components/mui_extended/Popover/index-Dl1PwIS2.js +0 -153
  168. package/components/mui_extended/Stack/index-CRzpVi2a.js +0 -31
  169. package/components/mui_extended/Tab/index-DmrsMLOq.js +0 -129
  170. package/components/mui_extended/ToggleButton/index-CAnHC1N-.js +0 -18
  171. package/components/mui_extended/Tooltip/index-B8QUytCK.js +0 -42
  172. package/components/mui_extended/Typography/index-DXq1fG8k.js +0 -54
  173. package/components/mui_extended/index-l0sNRNKZ.js +0 -1
  174. package/components/popups/PopupsProvider/index-DhSxmtfJ.js +0 -172
  175. package/components/popups/PopupsViewer/constants-DuyD7aCn.js +0 -4
  176. package/components/popups/PopupsViewer/icons-BUujqqbu.js +0 -7
  177. package/components/popups/PopupsViewer/index-CMI1SK_O.js +0 -172
  178. package/components/popups/PopupsViewer/slots/index-B98CiRLa.js +0 -14
  179. package/components/popups/PopupsViewer/slots/popupsViewerSlots-DOkmuvnx.js +0 -46
  180. package/components/popups/index-l0sNRNKZ.js +0 -1
  181. package/contexts/ModalContext/index-Bp_s1qUm.js +0 -39
  182. package/contexts/RHFormContext/index-BQ0XWrpK.js +0 -78
  183. package/hocs/withToggle/index-C1_DMZD3.js +0 -14
  184. package/hooks/useFormAddEdit/index-dLVQB7hC.js +0 -90
  185. package/hooks/useFormReadyForUpdate/index-B3HygFCM.js +0 -20
  186. package/hooks/useModal/index-69rbrQ0v.js +0 -10
  187. package/hooks/useSizeContainer/index-D4hDjM1P.js +0 -37
  188. package/hooks/useStateRef/index-C3P6ZK3m.js +0 -15
  189. package/hooks/useTab/index-DYRxOmMI.js +0 -12
  190. package/react-data-grid-BfYuZ6AK.js +0 -2606
  191. package/react-draggable-DsCPdgQP.js +0 -811
  192. package/react-json-view-bhqIAaNg.js +0 -2576
  193. package/react-resizable-eBbFl2dX.js +0 -618
  194. package/react-spinners-TpKN9lZg.js +0 -123
  195. package/react-splitter-layout-C-JTsNGs.js +0 -158
  196. package/styles/DynamicFilter-CJFsIegc.js +0 -319
  197. package/styles/MenuActions-lTi-ynPM.js +0 -42
  198. package/styles/index-CqpubQQr.js +0 -1691
  199. package/test/constants_no_mock-CF-669v-.js +0 -4
  200. package/test/getNameDataTestId-BaBTWhBr.js +0 -10
  201. package/utils/index-DiMrtgIu.js +0 -502
  202. /package/components/GridLayout/subcomponents/{Griditem → GridItem}/index.d.ts +0 -0
  203. /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-CqpubQQr.js";
10
- import { T as TEST_PROP_ID } from "../../../test/constants_no_mock-CF-669v-.js";
11
- import { I as Image } from "../../Image/index-BxphCFC7.js";
12
- import { T as Typography } from "../../mui_extended/Typography/index-DXq1fG8k.js";
13
- import { H as HelperText } from "../../HelperText/index-sLK3dYG0.js";
14
- import { F as FieldLabel } from "../../FieldLabel/index-C8od8D0w.js";
15
- import { C as CircularProgress } from "../../mui_extended/CircularProgress/index-Bnnti_G6.js";
16
- import { I as IconButton } from "../../mui_extended/IconButton/index-B8lOMybH.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
- };