@m4l/components 1.0.0 → 1.0.2

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 (95) hide show
  1. package/components/AccountPopover/{index.efc74d5c.js → index.ec031003.js} +5 -3
  2. package/components/AppBar/{index.fc126a22.js → index.1499770b.js} +4 -4
  3. package/components/DragResizeWindow/{index.46b380e1.js → index.5e316291.js} +3 -3
  4. package/components/DynamicFilter/{index.d9168c12.js → index.05e15fb8.js} +28 -211
  5. package/components/FieldLabel/{index.f9cdcc27.js → index.400a46e0.js} +4 -4
  6. package/components/GridLayout/{index.bb3b7769.js → index.7156fbc9.js} +2 -2
  7. package/components/GridLayout/subcomponents/Griditem/{index.bb23f651.js → index.8946f18e.js} +4 -4
  8. package/components/GridLayout/subcomponents/Responsive/{index.b8a2a121.js → index.3c68f0cb.js} +2 -2
  9. package/components/GridLayout/subcomponents/SizeProvider/{index.094bc6b5.js → index.a5b2190d.js} +1 -1
  10. package/components/HamburgerMenu/{index.5997af31.js → index.d57bca4c.js} +3 -3
  11. package/components/HelperText/{index.be949cdf.js → index.651a9b4b.js} +1 -1
  12. package/components/Icon/index.2e8ec5a1.js +209 -0
  13. package/components/Image/index.0d32558e.js +168 -0
  14. package/components/LoadingError/{index.9f00c83c.js → index.d137be81.js} +5 -4
  15. package/components/MFLoader/{index.402c1acc.js → index.2038aa6c.js} +3 -3
  16. package/components/ModalDialog/{index.ea9189c3.js → index.85d30f10.js} +4 -4
  17. package/components/NavLink/{index.4e548cee.js → index.badec599.js} +2 -2
  18. package/components/NoItemSelected/{index.418c8316.js → index.008154ce.js} +2 -2
  19. package/components/ObjectLogs/{index.bfa7dad3.js → index.65a6b1bc.js} +8 -7
  20. package/components/PDFViewer/{index.bb2eca5a.js → index.9677b02a.js} +2 -2
  21. package/components/Page/index.7482cf60.js +98 -0
  22. package/components/PaperForm/{index.8121e3da.js → index.e04f9f1f.js} +2 -2
  23. package/components/Period/{index.5233694b.js → index.3d695534.js} +8 -103
  24. package/components/PrintingSystem/{index.fb176a93.js → index.89493ad6.js} +15 -14
  25. package/components/PrintingSystem/subcomponents/BodyNode/{index.c1d61038.js → index.fdd8cebb.js} +1 -1
  26. package/components/PrintingSystem/subcomponents/ChartNode/{index.18bd9bad.js → index.12293a60.js} +1 -1
  27. package/components/PrintingSystem/subcomponents/DividerNode/{index.67d9f1b4.js → index.7fdad1df.js} +1 -1
  28. package/components/PrintingSystem/subcomponents/FooterNode/{index.eaee152a.js → index.fcaf9b2f.js} +1 -1
  29. package/components/PrintingSystem/subcomponents/GridNode/{index.f5f63a2a.js → index.03148990.js} +1 -1
  30. package/components/PrintingSystem/subcomponents/HeaderNode/{index.7de4e411.js → index.691b5c38.js} +1 -1
  31. package/components/PrintingSystem/subcomponents/PaperNode/{index.f9ccf22b.js → index.3699b685.js} +1 -1
  32. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.f2f2e903.js → index.bcc87da8.js} +1 -1
  33. package/components/PrintingSystem/subcomponents/SectionNode/{index.540a4b19.js → index.659f28e5.js} +1 -1
  34. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.41e7fcb0.js → index.137ebb7a.js} +1 -1
  35. package/components/PropertyValue/{index.9572c347.js → index.e31d4282.js} +3 -3
  36. package/components/Resizeable/{index.1f0c1359.js → index.8c72e36a.js} +1 -1
  37. package/components/ScrollBar/{index.adf0eade.js → index.9bfcc74f.js} +1 -1
  38. package/components/SideBar/{index.629ba840.js → index.004a2de1.js} +7 -31
  39. package/components/SplitLayout/{index.74091a81.js → index.aed78a1f.js} +1 -1
  40. package/components/ToastContainer/{index.f9b507b9.js → index.586b1194.js} +3 -3
  41. package/components/areas/constants.630a4f42.js +293 -0
  42. package/components/areas/contexts/AreasContext/{index.bb316000.js → index.81b748ec.js} +4 -4
  43. package/components/areas/{dictionary.7e74022a.js → dictionary.19b25583.js} +26 -34
  44. package/components/areas/hooks/useAreas/{index.e24bd74d.js → index.b02d5bdc.js} +1 -1
  45. package/components/hook-form/HelperError/index.fd10c3ab.js +19 -0
  46. package/components/hook-form/RHFAutocompleteAsync/index.ea3ba7a7.js +160 -0
  47. package/components/hook-form/RHFCheckbox/index.9ac452cc.js +143 -0
  48. package/components/hook-form/RHFColorPicker/index.25e4e643.js +191 -0
  49. package/components/hook-form/RHFDateTime/index.31a0537d.js +190 -0
  50. package/components/hook-form/RHFMultiCheckbox/index.437e6ba3.js +34 -0
  51. package/components/hook-form/RHFPeriod/index.c8868100.js +105 -0
  52. package/components/hook-form/RHFRadioGroup/index.11c0add8.js +35 -0
  53. package/components/hook-form/RHFSelect/index.c6c60ecc.js +29 -0
  54. package/components/hook-form/RHFTextField/index.2ae1f130.js +326 -0
  55. package/components/{Image/index.36a3d440.js → hook-form/RHFUpload/index.9eeaee0f.js} +32 -232
  56. package/components/maps/components/GpsTools/index.ef751d28.js +251 -0
  57. package/components/maps/{index.8ec46ce4.js → index.ba1ccfad.js} +21 -555
  58. package/components/modal/{WindowBase.a3ac7adc.js → WindowBase.c1e879e4.js} +4 -3
  59. package/components/modal/{WindowConfirm.e35da619.js → WindowConfirm.1a123368.js} +6 -6
  60. package/components/modal/{index.a0e30c8b.js → index.7ca17f55.js} +1 -1
  61. package/components/mui_extended/Accordion/index.391679d1.js +143 -0
  62. package/components/mui_extended/Avatar/index.3ba36655.js +63 -0
  63. package/components/mui_extended/Badge/index.3465d7fb.js +31 -0
  64. package/components/mui_extended/BoxIcon/index.d61e7ac5.js +22 -0
  65. package/components/mui_extended/Breadcrumbs/index.4a44883c.js +87 -0
  66. package/components/mui_extended/Button/index.a7dc6ef0.js +289 -0
  67. package/components/mui_extended/CheckBox/index.c5c8721c.js +76 -0
  68. package/components/mui_extended/CircularProgress/index.967e70b7.js +8 -0
  69. package/components/mui_extended/IconButton/index.87f4726c.js +120 -0
  70. package/components/{LinearProgressIndeterminate/index.de9d447c.js → mui_extended/LinearProgress/index.52edc848.js} +11 -4
  71. package/components/mui_extended/LinkWithRoute/index.288c51f3.js +15 -0
  72. package/components/{Page/index.fdf04592.js → mui_extended/Pager/index.46aec921.js} +9 -98
  73. package/components/mui_extended/Popover/index.8e5ac765.js +1041 -0
  74. package/components/mui_extended/Stack/index.fe363ca5.js +31 -0
  75. package/components/{maps/components/GpsTools/index.75880ce0.js → mui_extended/Tab/index.ad88441e.js} +674 -239
  76. package/components/mui_extended/ToggleButton/index.38ca2330.js +18 -0
  77. package/components/mui_extended/ToggleIconButton/index.7fbece74.js +24 -0
  78. package/components/mui_extended/Tooltip/index.49bb5ee1.js +40 -0
  79. package/components/mui_extended/Typography/index.2a1c68f8.js +55 -0
  80. package/components/popups/PopupsProvider/{index.18669fb4.js → index.3b43e55f.js} +1 -1
  81. package/components/popups/PopupsViewer/{index.ba354267.js → index.fb3f0c48.js} +5 -4
  82. package/contexts/ModalContext/{index.cf02e6bd.js → index.82f61407.js} +1 -1
  83. package/contexts/RHFormContext/{index.dc955a09.js → index.e942a298.js} +1 -1
  84. package/hooks/useFormAddEdit/{index.f156a2cd.js → index.fa430551.js} +2 -2
  85. package/hooks/useModal/{index.ef54bcf2.js → index.9fe41bde.js} +3 -3
  86. package/index.js +266 -239
  87. package/package.json +1 -1
  88. package/{react-draggable.5331add7.js → react-draggable.2df3b71a.js} +1 -1
  89. package/{react-resizable.37bfb965.js → react-resizable.c60f3843.js} +2 -2
  90. package/utils/{index.9ee4c99a.js → index.0660ee9c.js} +9 -62
  91. package/{vendor.a1ce6777.js → vendor.3eadfa16.js} +746 -3011
  92. package/components/Icon/index.d5fed418.js +0 -420
  93. package/components/LanguagePopover/index.e6fa2336.js +0 -184
  94. package/components/areas/constants.5387d83e.js +0 -412
  95. package/hooks/useTab/index.bce8b99e.js +0 -12
@@ -1,420 +0,0 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { generateUtilityClasses, generateUtilityClass, Skeleton, Tooltip, IconButton as IconButton$1, Box, styled as styled$1, SvgIcon } from "@mui/material";
3
- import clsx from "clsx";
4
- import { unstable_composeClasses } from "@mui/base";
5
- import { s as componentName, I as ICON_PREFIX, T as TEST_PROP_ID, t as componentName$1, L as LABEL_BK_COLOR_DEFAULT, u as LABEL_COLOR_DEFAULT } from "../areas/constants.5387d83e.js";
6
- import { w as withToggle } from "../../hocs/withToggle/index.548aeace.js";
7
- import { useMemo, useState } from "react";
8
- import { useModuleDictionary, useModuleSkeleton, useEnvironment } from "@m4l/core";
9
- import { styled } from "@mui/material/styles";
10
- import { useResponsiveDesktop } from "@m4l/graphics";
11
- import { Marker } from "react-leaflet";
12
- import L__default from "leaflet";
13
- import { m as mapClasses } from "../maps/index.8ec46ce4.js";
14
- import { u as useSideBar, g as getNameDataTestId$1 } from "../SideBar/index.629ba840.js";
15
- const IconRoot = styled("div")(({ theme }) => ({
16
- ...theme.components?.M4LIcon?.styleOverrides
17
- }));
18
- const DivIcon = styled("div", {
19
- shouldForwardProp: (props) => props !== "src" && props !== "rotationAngle"
20
- })(({ src, rotationAngle }) => ({
21
- maskPosition: "center",
22
- maskRepeat: "no-repeat",
23
- maskSize: "cover",
24
- WebkitMaskRepeat: "no-repeat",
25
- mask: `url(${src})`,
26
- WebkitMask: `url(${src})`,
27
- WebkitMaskSize: "cover",
28
- ...rotationAngle && {
29
- transform: `rotate(${rotationAngle}deg)`
30
- }
31
- }));
32
- generateUtilityClasses(componentName, [
33
- "root",
34
- "icon",
35
- "variantSkeleton",
36
- "sizeExtraSmall",
37
- "sizeSmall",
38
- "sizeMedium",
39
- "sizeLarge",
40
- "sizeExtraLarge",
41
- "rotationAngle"
42
- ]);
43
- function getIconClassesUtilityClass(slot) {
44
- return generateUtilityClass(componentName, slot);
45
- }
46
- const useUtilityClasses$1 = (ownerState) => {
47
- const slots = {
48
- root: ["root"],
49
- icon: [
50
- "icon",
51
- ownerState.size === "extraSmall" && "sizeExtraSmall",
52
- ownerState.size === "small" && "sizeSmall",
53
- ownerState.size === "medium" && "sizeMedium",
54
- ownerState.size === "large" && "sizeLarge",
55
- ownerState.size === "extraLarge" && "sizeExtraLarge",
56
- ownerState.rotationAngle ? "rotationAngle" : ""
57
- ],
58
- variantSkeleton: [
59
- "variantSkeleton",
60
- ownerState.size === "extraSmall" && "sizeExtraSmall",
61
- ownerState.size === "small" && "sizeSmall",
62
- ownerState.size === "medium" && "sizeMedium",
63
- ownerState.size === "large" && "sizeLarge",
64
- ownerState.size === "extraLarge" && "sizeExtraLarge"
65
- ]
66
- };
67
- const composedClasses = unstable_composeClasses(slots, getIconClassesUtilityClass, {});
68
- return {
69
- ...composedClasses
70
- };
71
- };
72
- const getNameDataTestId = (KEY) => {
73
- return `${ICON_PREFIX}-${KEY}`;
74
- };
75
- function Icon(props) {
76
- const { src, size = "small", rotationAngle, className } = props;
77
- const isDesktop = useResponsiveDesktop();
78
- const ownerState = {
79
- size: isDesktop ? size : "medium",
80
- rotationAngle
81
- };
82
- const classes = useUtilityClasses$1(ownerState);
83
- return /* @__PURE__ */ jsx(
84
- IconRoot,
85
- {
86
- className: clsx(classes.root, className),
87
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
88
- children: /* @__PURE__ */ jsx(
89
- DivIcon,
90
- {
91
- className: classes.icon,
92
- src,
93
- rotationAngle,
94
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("icon") } : {}
95
- }
96
- )
97
- }
98
- );
99
- }
100
- const SkeletonIconButton = (props) => {
101
- const { classes } = props;
102
- return /* @__PURE__ */ jsx(
103
- Skeleton,
104
- {
105
- variant: "rectangular",
106
- className: classes.skeleton,
107
- "data-testid": "SkeletonIconButton"
108
- }
109
- );
110
- };
111
- const IconButtonRoot = styled("div")(({ theme }) => ({
112
- ...theme.components?.M4LIconButton?.styleOverrides
113
- }));
114
- const iconButtonClasses = generateUtilityClasses(componentName$1, [
115
- "root",
116
- "skeleton",
117
- "sizemSall",
118
- "sizeMedium",
119
- "variantPrimary",
120
- "variantSecondary",
121
- "variantLine",
122
- "isFocus",
123
- "isDisabled",
124
- "togglePressed",
125
- "toggleNotPressed"
126
- ]);
127
- function getIconButtonUtilityClass(slot) {
128
- return generateUtilityClass(componentName$1, slot);
129
- }
130
- const useUtilityClasses = (ownerState) => {
131
- const slots = {
132
- root: [
133
- "root",
134
- ownerState.size === "small" && "sizeSmall",
135
- ownerState.size === "medium" && "sizeMedium",
136
- ownerState.variant === "primary" && ownerState.isSkeleton !== true && "variantPrimary",
137
- ownerState.variant === "secondary" && ownerState.isSkeleton !== true && "variantSecondary",
138
- ownerState.variant === "line" && ownerState.isSkeleton !== true && "variantLine",
139
- ownerState.isFocus && !ownerState.isDisabled && "isFocus",
140
- ownerState.isDisabled && "isDisabled"
141
- ],
142
- skeleton: ["skeleton"]
143
- };
144
- const composedClasses = unstable_composeClasses(slots, getIconButtonUtilityClass, {});
145
- return {
146
- ...composedClasses
147
- };
148
- };
149
- const IconButton = (props) => {
150
- const {
151
- src,
152
- tooltip,
153
- size = "small",
154
- dictionaryTooltipId,
155
- rotationAngle,
156
- variant = "line",
157
- disabled,
158
- className,
159
- onClick,
160
- ...other
161
- } = props;
162
- const { getLabel } = useModuleDictionary();
163
- const isDesktop = useResponsiveDesktop();
164
- const isSkeleton = useModuleSkeleton();
165
- const finalTooltip = useMemo(() => {
166
- if (disabled) {
167
- return void 0;
168
- }
169
- if (tooltip && tooltip !== "") {
170
- return tooltip;
171
- }
172
- if (dictionaryTooltipId && getLabel) {
173
- return getLabel(dictionaryTooltipId);
174
- }
175
- return void 0;
176
- }, [tooltip, dictionaryTooltipId, getLabel, disabled]);
177
- const [isfocus] = useState(false);
178
- const ownerState = {
179
- variant,
180
- size: isDesktop ? size : "medium",
181
- isSkeleton,
182
- isFocus: disabled ? false : isfocus,
183
- isDisabled: disabled
184
- };
185
- const classes = useUtilityClasses(ownerState);
186
- return /* @__PURE__ */ jsx(IconButtonRoot, { className: clsx(classes.root, className), "data-testid": "IconButtonRoot", children: !isSkeleton ? /* @__PURE__ */ jsx(Fragment, { children: finalTooltip ? /* @__PURE__ */ jsx(Tooltip, { title: finalTooltip || "", children: /* @__PURE__ */ jsx(
187
- IconButton$1,
188
- {
189
- ...other,
190
- onClick,
191
- disableRipple: true,
192
- disabled,
193
- children: /* @__PURE__ */ jsx(Icon, { src, size })
194
- }
195
- ) }) : /* @__PURE__ */ jsx(
196
- IconButton$1,
197
- {
198
- ...other,
199
- onClick,
200
- disableRipple: true,
201
- disabled,
202
- children: /* @__PURE__ */ jsx(Icon, { src, size: isDesktop ? size : "medium", rotationAngle })
203
- }
204
- ) }) : /* @__PURE__ */ jsx(SkeletonIconButton, { classes }) });
205
- };
206
- function BoxIcon({ src, sx }) {
207
- return /* @__PURE__ */ jsx(
208
- Box,
209
- {
210
- component: "span",
211
- sx: {
212
- width: 20,
213
- height: 20,
214
- display: "inline-block",
215
- bgcolor: "currentColor",
216
- mask: `url(${src}) no-repeat center / contain`,
217
- WebkitMask: `url(${src}) no-repeat center / contain`,
218
- ...sx
219
- }
220
- }
221
- );
222
- }
223
- const ArrowStyle = styled$1("span")(({ arrowType, theme }) => {
224
- const SIZE = 12;
225
- const POSITION = -(SIZE / 2);
226
- const borderStyle = `solid 1px ${theme.vars.palette.state.borderDens}`;
227
- const topStyle = {
228
- borderRadius: "0 0 3px 0",
229
- top: POSITION,
230
- borderBottom: borderStyle,
231
- borderRight: borderStyle
232
- };
233
- const bottomStyle = {
234
- borderRadius: "3px 0 0 0",
235
- bottom: POSITION,
236
- borderTop: borderStyle,
237
- borderLeft: borderStyle
238
- };
239
- const leftStyle = {
240
- borderRadius: "0 3px 0 0",
241
- left: POSITION,
242
- borderTop: borderStyle,
243
- borderRight: borderStyle
244
- };
245
- const rightStyle = {
246
- borderRadius: "0 0 0 3px",
247
- right: POSITION,
248
- borderBottom: borderStyle,
249
- borderLeft: borderStyle
250
- };
251
- return {
252
- display: "none",
253
- [theme.breakpoints.up("sm")]: {
254
- width: SIZE,
255
- height: SIZE,
256
- content: "''",
257
- position: "absolute",
258
- display: "block",
259
- transform: "rotate(-135deg)",
260
- background: theme.vars.palette.background.default
261
- },
262
- ...arrowType === "top-left" && { ...topStyle, left: 20 },
263
- ...arrowType === "top-center" && { ...topStyle, left: 0, right: 0, margin: "auto" },
264
- ...arrowType === "top-right" && { ...topStyle, right: 20 },
265
- ...arrowType === "bottom-left" && { ...bottomStyle, left: 20 },
266
- ...arrowType === "bottom-center" && { ...bottomStyle, left: 0, right: 0, margin: "auto" },
267
- ...arrowType === "bottom-right" && { ...bottomStyle, right: 20 },
268
- ...arrowType === "left-top" && { ...leftStyle, top: 20 },
269
- ...arrowType === "left-center" && { ...leftStyle, top: 0, bottom: 0, margin: "auto" },
270
- ...arrowType === "left-bottom" && { ...leftStyle, bottom: 20 },
271
- ...arrowType === "right-top" && { ...rightStyle, top: 20 },
272
- ...arrowType === "right-center" && { ...rightStyle, top: 0, bottom: 0, margin: "auto" },
273
- ...arrowType === "right-bottom" && { ...rightStyle, bottom: 20 }
274
- };
275
- });
276
- const ToggleAbleIconButton = ({
277
- onToggle,
278
- isToggled,
279
- ...props
280
- }) => {
281
- return /* @__PURE__ */ jsx(
282
- IconButton,
283
- {
284
- onClick: onToggle,
285
- ...props,
286
- className: clsx(
287
- onToggle ? iconButtonClasses.togglePressed : iconButtonClasses.toggleNotPressed
288
- )
289
- }
290
- );
291
- };
292
- const ToggleIconButton = withToggle(ToggleAbleIconButton);
293
- function CheckboxIcon(props) {
294
- return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm0 2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2z" }) });
295
- }
296
- function CheckboxCheckedIcon(props) {
297
- return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.372 4.972a1.006 1.006 0 00-.928.388l-3.78 5-1.63-2.08a1.001 1.001 0 00-1.58 1.23l2.44 3.11a1 1 0 001.58-.01l4.57-6v-.03a1.006 1.006 0 00-.672-1.608z" }) });
298
- }
299
- function CheckboxIndeterminateIcon(props) {
300
- return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.75 8h-6.5a.75.75 0 00-.75.75v.5c0 .414.336.75.75.75h6.5a.75.75 0 00.75-.75v-.5a.75.75 0 00-.75-.75z" }) });
301
- }
302
- const FeatureDivIconLabel = (props) => {
303
- const {
304
- label,
305
- iconSrc,
306
- iconScale: scale = 1,
307
- iconRotate,
308
- labelBkColor: bkColor = LABEL_BK_COLOR_DEFAULT,
309
- labelColor: color = LABEL_COLOR_DEFAULT,
310
- iconWidth = 24,
311
- iconHeight = 24,
312
- offsetLeftTop = [24, 0]
313
- } = props;
314
- let html = label ? `<div class="${mapClasses.featureLabel}"
315
- style="background-color:${bkColor}; color:${color};left:${offsetLeftTop[0]}px;top:${offsetLeftTop[1]}px;">${label}</div>` : "";
316
- if (iconSrc) {
317
- html = `<div class="${mapClasses.markerLayerIcon}" style="transform: rotate(${iconRotate}deg) scale(${scale}); transform-origin: center center;">
318
- <img src=${iconSrc}></img>
319
- </div>` + html;
320
- }
321
- return L__default.divIcon({
322
- className: clsx(mapClasses.markerLayerRoot, ""),
323
- iconSize: [iconWidth, iconHeight],
324
- html
325
- });
326
- };
327
- const MarkerIconLabel = (props) => {
328
- const {
329
- position,
330
- draggable = true,
331
- iconSrc,
332
- iconRotate,
333
- iconScale: scale,
334
- className,
335
- label,
336
- markerColor,
337
- labelBkColor: bkColor,
338
- labelColor: color,
339
- iconWidth,
340
- iconHeight,
341
- offsetLeftTop,
342
- ...properties
343
- } = props;
344
- const makerIcon = FeatureDivIconLabel({
345
- iconSrc,
346
- iconRotate,
347
- iconScale: scale,
348
- label,
349
- iconWidth,
350
- iconHeight,
351
- labelBkColor: bkColor,
352
- labelColor: color,
353
- offsetLeftTop
354
- });
355
- return /* @__PURE__ */ jsx(
356
- Marker,
357
- {
358
- position,
359
- draggable,
360
- riseOnHover: true,
361
- icon: makerIcon,
362
- ...properties
363
- },
364
- Math.random()
365
- );
366
- };
367
- const ArrowIconRoot$1 = styled$1("div")(() => ({
368
- display: "flex",
369
- alignSelf: "center",
370
- lineHeight: 0
371
- }));
372
- function ArrowIcon$1(props) {
373
- const { openState } = props;
374
- const { host_static_assets, environment_assets } = useEnvironment();
375
- const { classes } = useSideBar();
376
- return /* @__PURE__ */ jsx(
377
- ArrowIconRoot$1,
378
- {
379
- className: classes.arrowIconRoot,
380
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1("arrowIconRoot") } : {},
381
- children: /* @__PURE__ */ jsx(
382
- Icon,
383
- {
384
- src: `${host_static_assets}/${environment_assets}/frontend/components/sidebar/assets/icons/ChevronRight.svg`,
385
- rotationAngle: openState ? 90 : 0
386
- }
387
- )
388
- }
389
- );
390
- }
391
- const ArrowIconRoot = styled$1("div")(() => ({
392
- display: "flex",
393
- alignSelf: "center",
394
- lineHeight: 0
395
- }));
396
- function ArrowIcon(props) {
397
- const { openState } = props;
398
- const { host_static_assets, environment_assets } = useEnvironment();
399
- return /* @__PURE__ */ jsx(ArrowIconRoot, { className: "", children: /* @__PURE__ */ jsx(
400
- Icon,
401
- {
402
- src: `${host_static_assets}/${environment_assets}/frontend/components/sidebar/assets/icons/ChevronRight.svg`,
403
- rotationAngle: openState ? 270 : 90,
404
- size: "medium"
405
- }
406
- ) });
407
- }
408
- export {
409
- ArrowIcon$1 as A,
410
- BoxIcon as B,
411
- CheckboxIcon as C,
412
- Icon as I,
413
- MarkerIconLabel as M,
414
- ToggleIconButton as T,
415
- IconButton as a,
416
- ArrowStyle as b,
417
- CheckboxCheckedIcon as c,
418
- CheckboxIndeterminateIcon as d,
419
- ArrowIcon as e
420
- };
@@ -1,184 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { generateUtilityClasses, generateUtilityClass, Stack, MenuItem } from "@mui/material";
4
- import { a as ImageButton, I as Image } from "../Image/index.36a3d440.js";
5
- import { useLocales } from "@m4l/graphics";
6
- import { styled } from "@mui/material/styles";
7
- import { useEnvironment, useNetwork } from "@m4l/core";
8
- import { unstable_composeClasses } from "@mui/base";
9
- import { E as componentName, F as LANGUAGEPOPOVER_PREFIX, T as TEST_PROP_ID } from "../areas/constants.5387d83e.js";
10
- import { P as Popover, C as CircularProgress } from "../../vendor.a1ce6777.js";
11
- const LanguagePopoverRoot = styled("div")(({ theme }) => ({
12
- ...theme.components?.M4LanguagePopover?.styleOverrides
13
- }));
14
- const LabelItem = styled("div")(({ theme }) => ({
15
- marginLeft: theme.spacing(1)
16
- }));
17
- const ContainerProgress = styled("div")(({ theme }) => ({
18
- padding: theme.spacing(0.75, 0),
19
- margin: theme.spacing(0, 1.25)
20
- }));
21
- const ContainerMenuItems = styled("div")(() => ({
22
- display: "flex",
23
- flexDirection: "column"
24
- }));
25
- const ContainerImage = styled("div")(() => ({
26
- display: "flex",
27
- gap: "4px",
28
- width: "16px",
29
- height: "16px"
30
- }));
31
- generateUtilityClasses(
32
- componentName,
33
- [
34
- "root",
35
- "containerItems",
36
- "containerProgress",
37
- "labelItem",
38
- "imageButton"
39
- ]
40
- );
41
- function getM4LanguagePopoverClassesUtilityClass(slot) {
42
- return generateUtilityClass(componentName, slot);
43
- }
44
- const useUtilityClasses = () => {
45
- const slots = {
46
- root: ["root"],
47
- containerItems: ["containerItems"],
48
- containerProgress: ["containerProgress"],
49
- labelItem: ["labelItem"]
50
- };
51
- const composedClasses = unstable_composeClasses(slots, getM4LanguagePopoverClassesUtilityClass, {});
52
- return {
53
- ...composedClasses
54
- };
55
- };
56
- const getNameDataTestId = (KEY) => {
57
- return `${LANGUAGEPOPOVER_PREFIX}-${KEY}`;
58
- };
59
- function LanguagePopover(props) {
60
- const { testingProps } = props;
61
- const { currentLocale, onChangeLocale } = useLocales();
62
- const { domain_token } = useEnvironment();
63
- const { networkOperation } = useNetwork();
64
- const [open, setOpen] = useState(testingProps?.open || null);
65
- const [loading, setLoading] = useState(testingProps?.loading || false);
66
- const [allLocales, setAllLocales] = useState(
67
- testingProps?.allLocales || []
68
- );
69
- const handleOpen = (event) => {
70
- setOpen(event.currentTarget);
71
- };
72
- const handleClose = () => {
73
- setOpen(null);
74
- };
75
- useEffect(() => {
76
- let mounted = true;
77
- if (open === null || loading || allLocales.length > 0) {
78
- return;
79
- }
80
- setLoading(true);
81
- networkOperation({
82
- method: "GET",
83
- endPoint: `na/locales`,
84
- parms: { domain_token }
85
- }).then((response) => {
86
- if (mounted) {
87
- !testingProps && setAllLocales(response.data);
88
- }
89
- }).finally(() => {
90
- setLoading(false);
91
- });
92
- return function cleanUp() {
93
- mounted = false;
94
- };
95
- }, [open]);
96
- const classes = useUtilityClasses();
97
- return /* @__PURE__ */ jsxs(
98
- LanguagePopoverRoot,
99
- {
100
- className: classes.root,
101
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
102
- children: [
103
- /* @__PURE__ */ jsx(
104
- ImageButton,
105
- {
106
- className: classes.imageButton,
107
- onClick: handleOpen,
108
- sx: {
109
- width: 28,
110
- height: 28,
111
- ...open && { bgcolor: "action.selected" }
112
- },
113
- src: currentLocale?.url_icon || "",
114
- alt: currentLocale?.name,
115
- width: "24px",
116
- height: "24px",
117
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("imageButton") } : {}
118
- }
119
- ),
120
- /* @__PURE__ */ jsx(
121
- Popover,
122
- {
123
- arrowType: "top-right",
124
- open: Boolean(open),
125
- anchorEl: open,
126
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
127
- onClose: handleClose,
128
- sx: {
129
- mt: 1.5,
130
- ml: 0.75,
131
- width: 180,
132
- rowGap: "100px",
133
- "& .MuiMenuItem-root": { px: 1, typography: "body2", borderRadius: 0.75 }
134
- },
135
- children: /* @__PURE__ */ jsxs(
136
- ContainerMenuItems,
137
- {
138
- className: classes.containerItems,
139
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("containerItems") } : {},
140
- children: [
141
- allLocales.length === 0 && /* @__PURE__ */ jsx(
142
- ContainerProgress,
143
- {
144
- className: classes.containerProgress,
145
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("containerProgress") } : {},
146
- children: /* @__PURE__ */ jsx(CircularProgress, { size: "20px" })
147
- }
148
- ),
149
- allLocales.length > 0 && /* @__PURE__ */ jsx(Stack, { spacing: 0.75, children: allLocales.map((option) => /* @__PURE__ */ jsxs(
150
- MenuItem,
151
- {
152
- selected: option.lang === currentLocale?.lang && option?.script === currentLocale?.script && option?.region === currentLocale?.region,
153
- onClick: () => {
154
- onChangeLocale(option);
155
- handleClose();
156
- },
157
- children: [
158
- /* @__PURE__ */ jsx(ContainerImage, { children: /* @__PURE__ */ jsx(Image, { alt: option.name, src: option.url_icon, ratio: "1:1" }) }),
159
- /* @__PURE__ */ jsx(
160
- LabelItem,
161
- {
162
- className: classes.labelItem,
163
- ...process.env.NODE_ENV !== "production" ? {
164
- [TEST_PROP_ID]: getNameDataTestId("labelItem")
165
- } : {},
166
- children: option.name
167
- }
168
- )
169
- ]
170
- },
171
- option.lang || option.script || option.region
172
- )) })
173
- ]
174
- }
175
- )
176
- }
177
- )
178
- ]
179
- }
180
- );
181
- }
182
- export {
183
- LanguagePopover as L
184
- };