@m4l/components 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/components/AccountPopover/{index.62b1290b.js → index.f22ad364.js} +4 -4
  2. package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
  3. package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
  6. package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
  7. package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
  8. package/components/DataGrid/constants.e334cd50.js +10 -0
  9. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
  10. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
  11. package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
  12. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
  13. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
  14. package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
  15. package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
  16. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
  17. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
  18. package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
  19. package/components/DataGrid/index.68e19254.js +915 -0
  20. package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
  21. package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
  22. package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
  23. package/components/DynamicFilter/constants.1dddd09c.js +31 -0
  24. package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
  25. package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
  26. package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
  27. package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
  28. package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
  29. package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
  30. package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
  31. package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
  32. package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
  33. package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
  34. package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
  35. package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
  36. package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
  37. package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
  38. package/components/LanguagePopover/index.921efd11.js +188 -0
  39. package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
  40. package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
  41. package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
  42. package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
  43. package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
  44. package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
  45. package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
  46. package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
  47. package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
  48. package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
  49. package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
  50. package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
  51. package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
  52. package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
  53. package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
  54. package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
  56. package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
  57. package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
  59. package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
  60. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
  61. package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
  62. package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
  63. package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
  64. package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
  65. package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
  66. package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
  67. package/components/animate/variants/index.7a912140.js +1 -0
  68. package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
  69. package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
  70. package/components/areas/components/index.558684b3.js +1 -0
  71. package/components/areas/constants.66529246.js +6 -0
  72. package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
  73. package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
  74. package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
  75. package/components/areas/contexts/index.24025b97.js +1 -0
  76. package/components/areas/dictionary.08cfc4c9.js +36 -0
  77. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  78. package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
  79. package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
  80. package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
  81. package/components/areas/icons.8266ccc8.js +26 -0
  82. package/components/areas/index.4cc6a221.js +22 -0
  83. package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
  84. package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
  85. package/components/commercial/TopBar/index.410fffa8.js +234 -0
  86. package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
  87. package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
  88. package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
  89. package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
  90. package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
  91. package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
  92. package/components/formatters/index.63a3e08e.js +117 -0
  93. package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
  94. package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
  95. package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
  96. package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
  97. package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
  98. package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
  99. package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
  100. package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
  101. package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
  102. package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
  103. package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
  104. package/components/maps/index.13bb982c.js +7 -0
  105. package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
  106. package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
  107. package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
  108. package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
  109. package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
  110. package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
  111. package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
  112. package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
  113. package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
  114. package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
  115. package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
  116. package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
  117. package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
  118. package/components/mui_extended/Tab/index.e911930f.js +135 -0
  119. package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
  120. package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
  121. package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
  122. package/components/mui_extended/index.b606cd9d.js +1 -0
  123. package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
  124. package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
  125. package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
  126. package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
  127. package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
  128. package/hooks/useModal/index.2003c854.js +11 -0
  129. package/hooks/useTab/index.8d1a6e63.js +12 -0
  130. package/index.js +328 -273
  131. package/package.json +1 -1
  132. package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
  133. package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
  134. package/test/constants_no_mock.86c553a9.js +4 -0
  135. package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
  136. package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
  137. package/components/CommonActions/index.19f39dca.js +0 -170
  138. package/components/areas/constants.0d3ba950.js +0 -289
  139. package/components/areas/dictionary.6168209a.js +0 -266
  140. package/components/areas/icons.504ec098.js +0 -83
  141. package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
  142. package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
  143. package/hooks/useModal/index.d14c7e46.js +0 -67
  144. package/vendor.5b266106.js +0 -3952
@@ -0,0 +1,35 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { getPropertyByString } from "@m4l/core";
3
+ import { useFormatter } from "@m4l/graphics";
4
+ import { W as WrapperComponent } from "../../WrapperComponent/index.57964195.js";
5
+ function getFormatPrice(obProps, fieldValue, currency, decimalDigits) {
6
+ let result = "";
7
+ const value = getPropertyByString(obProps, fieldValue);
8
+ try {
9
+ result = Number(value).toLocaleString(navigator.language, {
10
+ currency,
11
+ style: "currency",
12
+ currencyDisplay: "symbol",
13
+ useGrouping: true,
14
+ maximumFractionDigits: decimalDigits
15
+ }) || "";
16
+ } catch (error) {
17
+ result = Number(value).toLocaleString("en-US", {
18
+ style: "currency",
19
+ currency: "USD",
20
+ currencyDisplay: "symbol",
21
+ useGrouping: true,
22
+ maximumFractionDigits: decimalDigits
23
+ }) || "";
24
+ }
25
+ return result;
26
+ }
27
+ function PriceFormatter(props) {
28
+ const { obProps, fieldValue, Component = WrapperComponent } = props;
29
+ const { currencyFormatter } = useFormatter();
30
+ return /* @__PURE__ */ jsx(Component, { children: getFormatPrice(obProps, fieldValue, currencyFormatter.code, currencyFormatter.decimalDigits) });
31
+ }
32
+ export {
33
+ PriceFormatter as P,
34
+ getFormatPrice as g
35
+ };
@@ -0,0 +1,29 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { getPropertyByString } from "@m4l/core";
3
+ import { W as WrapperComponent } from "../../WrapperComponent/index.57964195.js";
4
+ function getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit) {
5
+ let result = "";
6
+ const ranges = getPropertyByString(obProps, fieldValue);
7
+ const symbol = getPropertyByString(obProps, fieldSymbol);
8
+ const unit = getPropertyByString(obProps, fieldUnit);
9
+ if (ranges === void 0 || ranges === null || !Array.isArray(ranges) || typeof symbol !== "string" || typeof unit !== "string") {
10
+ return "[]";
11
+ }
12
+ ranges.map((obj, idx) => {
13
+ const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
14
+ const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
15
+ result = result.concat(
16
+ `${idx > 0 ? " " : ""}`,
17
+ obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} \xB1 ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} \xB1 ${obj.cmc_uncertainty}]`
18
+ );
19
+ });
20
+ return result;
21
+ }
22
+ function UncertaintyFormatter(props) {
23
+ const { obProps, fieldValue, fieldSymbol, fieldUnit, Component = WrapperComponent } = props;
24
+ return /* @__PURE__ */ jsx(Component, { children: getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit) });
25
+ }
26
+ export {
27
+ UncertaintyFormatter as U,
28
+ getUncertaintyFormat as g
29
+ };
@@ -0,0 +1,117 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { generateUtilityClasses, styled } from "@mui/material";
3
+ import "@mui/base";
4
+ import { W as WrapperComponent } from "../WrapperComponent/index.57964195.js";
5
+ import { useModuleDictionary } from "@m4l/core";
6
+ import { a as BOOLEAN_FORMATTER_DICTIONARY_KEY } from "./BooleanFormatter/index.cbf9cd6e.js";
7
+ const COMPONENT_CLASS_NAME = "M4LFormatter";
8
+ const formatterClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
9
+ "root",
10
+ "booleanFormatterIcon",
11
+ "booleanFormatterCheck"
12
+ ]);
13
+ const FormatterRootContainer = styled("div")(({ theme }) => ({
14
+ ...theme.components?.M4LFormatter?.styleOverrides
15
+ }));
16
+ const FormatterRoot = (props) => {
17
+ const { children } = props;
18
+ return /* @__PURE__ */ jsx(FormatterRootContainer, { className: formatterClasses.root, children });
19
+ };
20
+ function getFormatConcatenated(values, separator) {
21
+ const returnSymbol = "";
22
+ if (values === null)
23
+ return returnSymbol;
24
+ if (!Array.isArray(values)) {
25
+ return values.toString();
26
+ } else {
27
+ if (values.length == 0)
28
+ return returnSymbol;
29
+ else {
30
+ const result = values.map((value) => {
31
+ if (value === null || value === void 0)
32
+ return returnSymbol;
33
+ else {
34
+ if (typeof value === "string" || typeof value === "number") {
35
+ return value.toString();
36
+ } else {
37
+ return returnSymbol;
38
+ }
39
+ }
40
+ });
41
+ const output = result.join(separator.toString());
42
+ return output.trim();
43
+ }
44
+ }
45
+ }
46
+ function ConcatenatedFormatter(props) {
47
+ const { values = [], separator = " ", Component = WrapperComponent } = props;
48
+ return /* @__PURE__ */ jsx(Component, { children: getFormatConcatenated(values, separator) });
49
+ }
50
+ const PERIOD_FORMATTER_DICTIONARY_KEY = `period_formatter`;
51
+ const dictionary = {
52
+ LABEL_YEARS: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_years`,
53
+ LABEL_YEAR: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_year`,
54
+ LABEL_MONTHS: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_months`,
55
+ LABEL_MONTH: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_month`,
56
+ LABEL_DAYS: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_days`,
57
+ LABEL_DAY: `${PERIOD_FORMATTER_DICTIONARY_KEY}.label_day`
58
+ };
59
+ function getFormatPeriod(years, months, days) {
60
+ const { getLabel } = useModuleDictionary();
61
+ let period = "";
62
+ const separator = ", ";
63
+ switch (years) {
64
+ case 0:
65
+ break;
66
+ case 1:
67
+ period = "1 " + getLabel(dictionary.LABEL_YEAR);
68
+ break;
69
+ default:
70
+ period = years.toString() + " " + getLabel(dictionary.LABEL_YEARS);
71
+ }
72
+ switch (months) {
73
+ case 0:
74
+ break;
75
+ case 1:
76
+ if (years > 0)
77
+ period += separator;
78
+ period += "1 " + getLabel(dictionary.LABEL_MONTH);
79
+ break;
80
+ default:
81
+ if (years > 0)
82
+ period += separator;
83
+ period += months.toString() + " " + getLabel(dictionary.LABEL_MONTHS);
84
+ }
85
+ switch (days) {
86
+ case 0:
87
+ break;
88
+ case 1:
89
+ if (years > 0 || months > 0)
90
+ period += separator;
91
+ period += "1 " + getLabel(dictionary.LABEL_DAY);
92
+ break;
93
+ default:
94
+ if (years > 0 || months > 0)
95
+ period += separator;
96
+ period += days.toString() + " " + getLabel(dictionary.LABEL_DAYS);
97
+ }
98
+ if (period == "")
99
+ period = "-";
100
+ return period;
101
+ }
102
+ function PeriodFormatter(props) {
103
+ const { years = 0, months = 0, days = 0, Component = WrapperComponent } = props;
104
+ return /* @__PURE__ */ jsx(Component, { children: getFormatPeriod(years, months, days) });
105
+ }
106
+ function getFormattersComponentsDictionary() {
107
+ return [BOOLEAN_FORMATTER_DICTIONARY_KEY, PERIOD_FORMATTER_DICTIONARY_KEY];
108
+ }
109
+ export {
110
+ ConcatenatedFormatter as C,
111
+ FormatterRoot as F,
112
+ PeriodFormatter as P,
113
+ getFormatPeriod as a,
114
+ getFormattersComponentsDictionary as b,
115
+ formatterClasses as f,
116
+ getFormatConcatenated as g
117
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useFormContext, useController } from "react-hook-form";
3
- import { H as HelperText } from "../../HelperText/index.ebb53dac.js";
3
+ import { H as HelperText } from "../../HelperText/index.09e80920.js";
4
4
  function HelperError(props) {
5
5
  const { name } = props;
6
6
  const { control } = useFormContext();
@@ -0,0 +1,404 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useRef, useState, useEffect, createElement } from "react";
3
+ import { useModuleDictionary, useModuleSkeleton, useEnvironment } from "@m4l/core";
4
+ import { useFormContext, Controller } from "react-hook-form";
5
+ import { Skeleton, generateUtilityClasses, generateUtilityClass, useTheme, Autocomplete, Popper, TextField, Chip } from "@mui/material";
6
+ import { styled } from "@mui/material/styles";
7
+ import { I as Image } from "../../Image/index.19aa7ff5.js";
8
+ import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.86c553a9.js";
9
+ import { T as Typography } from "../../mui_extended/Typography/index.642798f1.js";
10
+ import { unstable_composeClasses } from "@mui/base";
11
+ import { H as HelperText } from "../../HelperText/index.09e80920.js";
12
+ import { useResponsiveDesktop } from "@m4l/graphics";
13
+ import { useFormFocus } from "../../../index.js";
14
+ import { F as FieldLabel } from "../../FieldLabel/index.6b6f708e.js";
15
+ import { C as CircularProgress } from "../../mui_extended/CircularProgress/index.967e70b7.js";
16
+ import { I as IconButton } from "../../mui_extended/IconButton/index.b4532b85.js";
17
+ const AutocompleteRoot = styled("div")(({ theme }) => ({
18
+ ...theme.components?.M4LRHFAutocomplete?.styleOverrides
19
+ }));
20
+ const WrapperOption = styled("li")(({ theme }) => ({
21
+ "& .m4l_image": {
22
+ marginRight: theme.spacing(1.5)
23
+ }
24
+ }));
25
+ const RHFAUTOCOMPLETE_PREFIX = "RHFAutocomplete";
26
+ const RHFTAUTOCOMPLET_ROOT_TEST_ID = "RHFAutocomplete";
27
+ const getNameDataTestId = (KEY) => {
28
+ return `${RHFAUTOCOMPLETE_PREFIX}-${KEY}`;
29
+ };
30
+ function withRenderOption(getUrlImage, classes, imageWidth) {
31
+ return function RenderOption(optionProps, option) {
32
+ return /* @__PURE__ */ jsxs(
33
+ WrapperOption,
34
+ {
35
+ ...optionProps,
36
+ className: classes.withImage,
37
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("withImage") } : {},
38
+ children: [
39
+ /* @__PURE__ */ jsx(Image, { src: getUrlImage(option), width: imageWidth, height: "100%" }),
40
+ /* @__PURE__ */ jsx(Typography, { variant: "body", children: optionProps.key })
41
+ ]
42
+ }
43
+ );
44
+ };
45
+ }
46
+ const SkeletonRHFAutocomplete = (props) => {
47
+ const { withImage, classes, hasLabel } = props;
48
+ return /* @__PURE__ */ jsxs("div", { className: classes.skeletonRoot, children: [
49
+ (hasLabel || hasLabel?.length === 0) && /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "30%", height: "16px" }),
50
+ /* @__PURE__ */ jsx(
51
+ "div",
52
+ {
53
+ className: classes.skeleton,
54
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("skeleton") } : {},
55
+ children: !withImage ? /* @__PURE__ */ jsxs(Fragment, { children: [
56
+ /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
57
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
58
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
59
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circular" }),
60
+ /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
61
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
62
+ ] })
63
+ }
64
+ )
65
+ ] });
66
+ };
67
+ const componentName = "M4LRHFAutocomplete";
68
+ generateUtilityClasses(
69
+ componentName,
70
+ [
71
+ "root",
72
+ "withImage",
73
+ "skeleton",
74
+ "label",
75
+ "popper",
76
+ "skeletonRoot",
77
+ "skeletonContainerText",
78
+ "iconDown",
79
+ "variantInfo",
80
+ "variantImage",
81
+ "isDisabled",
82
+ "imageWidthDefined",
83
+ "variantSuccess",
84
+ "variantWarning",
85
+ "variantError",
86
+ "sizeSmall",
87
+ "sizeMedium",
88
+ "isFocus",
89
+ "isTabSelected",
90
+ "chip"
91
+ ]
92
+ );
93
+ function getRHFAutocompleteClassesUtilityClass(slot) {
94
+ return generateUtilityClass(componentName, slot);
95
+ }
96
+ const useUtilityClasses = (ownerState) => {
97
+ const slots = {
98
+ root: [
99
+ "root",
100
+ ownerState.size === "small" && "sizeSmall",
101
+ ownerState.size === "medium" && "sizeMedium",
102
+ ownerState.isFocus && "isFocus",
103
+ ownerState.isTabSelected && "isTabSelected",
104
+ ownerState.disabled && "isDisabled",
105
+ ownerState.semantics === "info" && "variantInfo",
106
+ ownerState.semantics === "success" && "variantSuccess",
107
+ ownerState.semantics === "warning" && "variantWarning",
108
+ ownerState.semantics === "error" && "variantError",
109
+ ownerState.imageWidthDefined && "imageWidthDefined",
110
+ ownerState.multiple && "multiple"
111
+ ],
112
+ withImage: ["withImage"],
113
+ skeleton: ["skeleton"],
114
+ label: ["label"],
115
+ popper: [
116
+ "popper",
117
+ ownerState.size === "small" && "sizeSmall",
118
+ ownerState.size === "medium" && "sizeMedium",
119
+ ownerState.imageWidthDefined && "imageWidthDefined"
120
+ ],
121
+ skeletonRoot: ["skeletonRoot"],
122
+ skeletonContainerText: ["SkeletonContainerText"],
123
+ iconDown: ["iconDown"],
124
+ chip: [
125
+ "chip",
126
+ ownerState.size === "small" && "sizeSmall",
127
+ ownerState.size === "medium" && "sizeMedium"
128
+ ]
129
+ };
130
+ const composedClasses = unstable_composeClasses(slots, getRHFAutocompleteClassesUtilityClass, {});
131
+ return {
132
+ ...composedClasses
133
+ };
134
+ };
135
+ function RHFAutocomplete(props) {
136
+ const {
137
+ name: nameRHF,
138
+ getOptionLabel,
139
+ isOptionEqualToValue,
140
+ label,
141
+ skeletonWidth = 100,
142
+ skeletonHeight = "18px",
143
+ options,
144
+ disabled,
145
+ getOptionUrlImage,
146
+ onOpen,
147
+ onClose,
148
+ loading,
149
+ variant,
150
+ helperMessage,
151
+ size = "small",
152
+ onChangeFilterParmsLocal,
153
+ imageWidth,
154
+ imageHeight,
155
+ mandatory,
156
+ mandatoryMessage,
157
+ multiple,
158
+ ...other
159
+ } = props;
160
+ const { getLabel } = useModuleDictionary();
161
+ const isSkeleton = useModuleSkeleton();
162
+ const withImage = useMemo(() => getOptionUrlImage !== void 0, [getOptionUrlImage]);
163
+ const { host_static_assets, environment_assets } = useEnvironment();
164
+ const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
165
+ const autocompleteRef = useRef(null);
166
+ const [open, setOpen] = useState(false);
167
+ const isDesktop = useResponsiveDesktop();
168
+ const onCloseLocal = (event, reason) => {
169
+ setOpen(false);
170
+ if (onClose)
171
+ onClose(event, reason);
172
+ };
173
+ const onOpenLocal = (event) => {
174
+ setOpen(true);
175
+ if (onOpen)
176
+ onOpen(event);
177
+ };
178
+ const getOptionLabelLocal = (option) => {
179
+ if (option === void 0 || option === null) {
180
+ return "";
181
+ }
182
+ return getOptionLabel(option);
183
+ };
184
+ const getOptionUrlImageLocal = (option) => {
185
+ if (option === void 0 || option === null || getOptionUrlImage === void 0) {
186
+ return "";
187
+ }
188
+ return getOptionUrlImage(option);
189
+ };
190
+ const isOptionEqualToValueLocal = (option, value) => {
191
+ if (value === void 0 || value === null || option === null) {
192
+ return false;
193
+ }
194
+ return isOptionEqualToValue(option, value);
195
+ };
196
+ const {
197
+ control,
198
+ formState: { errors }
199
+ } = useFormContext();
200
+ const [currentVariant, setCurrentVariant] = useState(
201
+ null
202
+ );
203
+ useEffect(() => {
204
+ if (errors[nameRHF]) {
205
+ setCurrentVariant("error");
206
+ } else if (variant) {
207
+ setCurrentVariant(variant);
208
+ } else {
209
+ setCurrentVariant(null);
210
+ }
211
+ }, [errors[nameRHF], variant, control]);
212
+ const ownerState = {
213
+ size: !isDesktop ? "medium" : size,
214
+ isFocus: !isSkeleton ? isFocus : false,
215
+ isTabSelected: !isSkeleton ? isTabSelected : false,
216
+ semantics: currentVariant,
217
+ disabled,
218
+ imageWidthDefined: Boolean(imageWidth),
219
+ multiple: Boolean(multiple)
220
+ };
221
+ const classes = useUtilityClasses(ownerState);
222
+ const theme = useTheme();
223
+ return /* @__PURE__ */ jsx(
224
+ AutocompleteRoot,
225
+ {
226
+ className: classes.root,
227
+ tabIndex: 0,
228
+ onFocus: handlerFocus,
229
+ onBlur: handlerOnBlur,
230
+ onKeyUp: handlerOnKeyUp,
231
+ ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: `${RHFTAUTOCOMPLET_ROOT_TEST_ID}_${nameRHF}` } : {},
232
+ children: !isSkeleton ? /* @__PURE__ */ jsx(
233
+ Controller,
234
+ {
235
+ name: nameRHF,
236
+ control,
237
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
238
+ const [inputValue, setInputValue] = useState(getOptionLabelLocal(value));
239
+ useEffect(() => {
240
+ if (!open && value === null && inputValue !== "") {
241
+ setInputValue("");
242
+ }
243
+ if (!open && value !== null && options.length === 0) {
244
+ onChangeFilterParmsLocal?.(getOptionLabelLocal(value), "reset");
245
+ }
246
+ }, [value]);
247
+ const checkKeyDown = (e) => {
248
+ if (e.code === "Enter")
249
+ e.preventDefault();
250
+ };
251
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
252
+ label && /* @__PURE__ */ jsx(
253
+ FieldLabel,
254
+ {
255
+ className: classes.label,
256
+ label,
257
+ mandatory,
258
+ mandatoryMessage,
259
+ helperMessage
260
+ }
261
+ ),
262
+ /* @__PURE__ */ jsx(
263
+ Autocomplete,
264
+ {
265
+ autoComplete: true,
266
+ disableClearable: true,
267
+ multiple,
268
+ onKeyDown: checkKeyDown,
269
+ size,
270
+ ref: autocompleteRef,
271
+ autoSelect: false,
272
+ options,
273
+ getOptionLabel: getOptionLabelLocal,
274
+ inputValue,
275
+ clearOnBlur: false,
276
+ PopperComponent: (popperProps) => {
277
+ return /* @__PURE__ */ jsx(
278
+ Popper,
279
+ {
280
+ ...popperProps,
281
+ className: classes.popper,
282
+ placement: "bottom-start",
283
+ sx: {
284
+ ...theme.components?.M4LRHFAutocompletePopover?.styleOverrides
285
+ }
286
+ }
287
+ );
288
+ },
289
+ onInputChange: (_event, newValue, reason) => {
290
+ if (reason === "input") {
291
+ setInputValue(newValue);
292
+ if (onChangeFilterParmsLocal) {
293
+ onChangeFilterParmsLocal(newValue, reason);
294
+ }
295
+ } else {
296
+ onChange(null);
297
+ }
298
+ },
299
+ isOptionEqualToValue: isOptionEqualToValueLocal,
300
+ value: Array.isArray(value) ? value : multiple ? value ? [value] : [] : value || null,
301
+ onOpen: onOpenLocal,
302
+ onClose: onCloseLocal,
303
+ open,
304
+ onChange: (_e, newValue) => {
305
+ if (!multiple && !Array.isArray(newValue)) {
306
+ setInputValue(getOptionLabelLocal(newValue));
307
+ } else {
308
+ setInputValue("");
309
+ }
310
+ onChange(Array.isArray(newValue) ? [...newValue] : newValue);
311
+ },
312
+ filterOptions: onChangeFilterParmsLocal ? (x) => x : void 0,
313
+ loading,
314
+ loadingText: /* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel("rhf_autocomplete.loading_options") }),
315
+ disabled,
316
+ noOptionsText: getLabel("rhf_autocomplete.no_options"),
317
+ renderOption: withImage ? withRenderOption(getOptionUrlImageLocal, classes, imageWidth) : void 0,
318
+ renderInput: (params) => {
319
+ return /* @__PURE__ */ jsx(
320
+ TextField,
321
+ {
322
+ ...params,
323
+ InputLabelProps: {
324
+ ...params.InputLabelProps,
325
+ shrink: true
326
+ },
327
+ fullWidth: true,
328
+ size,
329
+ SelectProps: { native: true },
330
+ InputProps: {
331
+ ...params.InputProps,
332
+ startAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
333
+ !multiple && withImage && value ? /* @__PURE__ */ jsx(
334
+ Image,
335
+ {
336
+ src: getOptionUrlImageLocal(value),
337
+ width: imageWidth,
338
+ height: "100%"
339
+ },
340
+ "ImageTextField"
341
+ ) : null,
342
+ params.InputProps.startAdornment
343
+ ] }),
344
+ endAdornment: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "inherit", size: 18 }) : /* @__PURE__ */ jsx(
345
+ IconButton,
346
+ {
347
+ className: classes.iconDown,
348
+ src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/chevronDown.svg`,
349
+ onClick: (event) => onOpenLocal(event),
350
+ disabled,
351
+ size
352
+ }
353
+ )
354
+ },
355
+ autoComplete: "off",
356
+ error: !!error,
357
+ ...other
358
+ }
359
+ );
360
+ },
361
+ ...multiple ? {
362
+ renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => {
363
+ const { key, ...restTagProps } = getTagProps({
364
+ index
365
+ });
366
+ return /* @__PURE__ */ createElement(
367
+ Chip,
368
+ {
369
+ ...restTagProps,
370
+ key,
371
+ label: getOptionLabelLocal(option),
372
+ className: classes.chip,
373
+ icon: withImage && option ? /* @__PURE__ */ jsx(
374
+ Image,
375
+ {
376
+ src: getOptionUrlImageLocal(option),
377
+ width: imageWidth,
378
+ height: imageHeight ?? "100%"
379
+ }
380
+ ) : void 0,
381
+ sx: {
382
+ ...theme.components?.M4LRHFAutocompleteChip?.styleOverrides
383
+ }
384
+ }
385
+ );
386
+ })
387
+ } : {}
388
+ }
389
+ ),
390
+ currentVariant === "error" ? /* @__PURE__ */ jsx(HelperText, { variant: currentVariant, message: error?.message }) : null
391
+ ] });
392
+ }
393
+ }
394
+ ) : /* @__PURE__ */ jsx(SkeletonRHFAutocomplete, { withImage, classes, hasLabel: label })
395
+ }
396
+ );
397
+ }
398
+ function getRHFAutocompleteComponentsDictionary() {
399
+ return ["rhf_autocomplete"];
400
+ }
401
+ export {
402
+ RHFAutocomplete as R,
403
+ getRHFAutocompleteComponentsDictionary as g
404
+ };
@@ -5,9 +5,8 @@ import debounce from "lodash/debounce";
5
5
  import { styled } from "@mui/material/styles";
6
6
  import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
7
7
  import { unstable_composeClasses } from "@mui/base";
8
- import { T as TEST_PROP_ID } from "../../areas/constants.0d3ba950.js";
9
- import { R as RHFAutocomplete } from "../../../vendor.5b266106.js";
10
- import { e as getRHFAutocompleteComponentsDictionary } from "../../areas/dictionary.6168209a.js";
8
+ import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.86c553a9.js";
9
+ import { R as RHFAutocomplete, g as getRHFAutocompleteComponentsDictionary } from "../RHFAutocomplete/index.2991d444.js";
11
10
  styled("div")(() => ({
12
11
  display: "flex",
13
12
  width: "100%",
@@ -3,12 +3,12 @@ import { useFormContext, Controller } from "react-hook-form";
3
3
  import { styled } from "@mui/material/styles";
4
4
  import { Skeleton, generateUtilityClasses, generateUtilityClass } from "@mui/material";
5
5
  import { unstable_composeClasses } from "@mui/base";
6
- import { H as HelperText } from "../../HelperText/index.ebb53dac.js";
7
- import { T as TEST_PROP_ID } from "../../areas/constants.0d3ba950.js";
6
+ import { H as HelperText } from "../../HelperText/index.09e80920.js";
7
+ import { T as TEST_PROP_ID } from "../../../test/constants_no_mock.86c553a9.js";
8
8
  import { useResponsiveDesktop } from "@m4l/graphics";
9
9
  import { useModuleSkeleton } from "@m4l/core";
10
- import { c as useFormFocus } from "../../../vendor.5b266106.js";
11
- import { C as CheckBox } from "../../mui_extended/CheckBox/index.01218423.js";
10
+ import { useFormFocus } from "../../../index.js";
11
+ import { C as CheckBox } from "../../mui_extended/CheckBox.21c25705.js";
12
12
  const RHFCheckboxRoot = styled("div")(({ theme }) => ({
13
13
  ...theme.components?.M4LRHFCheckbox?.styleOverrides
14
14
  }));
@@ -3,16 +3,16 @@ import { useState } from "react";
3
3
  import { useFormContext, useWatch, Controller } from "react-hook-form";
4
4
  import { useModuleSkeleton, useEnvironment, useModuleDictionary } from "@m4l/core";
5
5
  import { SketchPicker } from "react-color";
6
- import { H as HelperText } from "../../HelperText/index.ebb53dac.js";
6
+ import { H as HelperText } from "../../HelperText/index.09e80920.js";
7
7
  import { generateUtilityClasses, generateUtilityClass, styled, Skeleton } from "@mui/material";
8
8
  import { unstable_composeClasses } from "@mui/base";
9
9
  import { useTheme } from "@mui/material/styles";
10
10
  import { useResponsiveDesktop } from "@m4l/graphics";
11
- import { c as useFormFocus } from "../../../vendor.5b266106.js";
12
- import { F as FieldLabel } from "../../FieldLabel/index.1577ac9c.js";
13
- import { P as Popover } from "../../mui_extended/Popover/index.146ded9e.js";
14
- import { I as Icon } from "../../Icon/index.8ecfb193.js";
15
- import { B as Button } from "../../mui_extended/Button/index.52852c42.js";
11
+ import { useFormFocus } from "../../../index.js";
12
+ import { F as FieldLabel } from "../../FieldLabel/index.6b6f708e.js";
13
+ import { P as Popover } from "../../mui_extended/Popover/index.2348fc4f.js";
14
+ import { I as Icon } from "../../Icon/index.83867398.js";
15
+ import { B as Button } from "../../mui_extended/Button/index.d742e9ee.js";
16
16
  const componentName = "M4LRHFColorPicker";
17
17
  const colorPickerClasses = generateUtilityClasses(componentName, [
18
18
  "root",
@@ -7,11 +7,11 @@ import { useFormatter, useResponsiveDesktop } from "@m4l/graphics";
7
7
  import { useState, useEffect } from "react";
8
8
  import { unstable_composeClasses } from "@mui/base";
9
9
  import clsx from "clsx";
10
- import { H as HelperText } from "../../HelperText/index.ebb53dac.js";
11
- import { T as TEST_PROP_ID } from "../../areas/constants.0d3ba950.js";
12
- import { c as useFormFocus } from "../../../vendor.5b266106.js";
13
- import { F as FieldLabel } from "../../FieldLabel/index.1577ac9c.js";
14
- import { I as Icon } from "../../Icon/index.8ecfb193.js";
10
+ import { H as HelperText } from "../../HelperText/index.09e80920.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.6b6f708e.js";
14
+ import { I as Icon } from "../../Icon/index.83867398.js";
15
15
  const SkeletonRHFDateTime = (props) => {
16
16
  const { skeletonWidth, skeletonHeight, className, label } = props;
17
17
  return /* @__PURE__ */ jsxs(Fragment, { children: [