@m4l/components 0.2.15 → 0.2.16

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 (133) hide show
  1. package/@types/export.d.ts +16 -4
  2. package/{commonjs.565e6834.js → commonjs.333e55c7.js} +5 -0
  3. package/components/AccountPopover/{index.da84c424.js → index.34362031.js} +2 -4
  4. package/components/AccountPopover/index.d.ts +1 -0
  5. package/components/AppBar/AppBar.d.ts +24 -0
  6. package/components/AppBar/classes/index.d.ts +2 -0
  7. package/components/AppBar/classes/types.d.ts +2 -0
  8. package/components/AppBar/{index.46f2db0a.js → index.c64b66ee.js} +26 -5
  9. package/components/AppBar/types.d.ts +14 -0
  10. package/components/CommonActions/components/ActionCancel/{index.06365996.js → index.106c5327.js} +1 -1
  11. package/components/CommonActions/components/ActionFormCancel/{index.2c1fff45.js → index.6d00f737.js} +4 -13
  12. package/components/CommonActions/components/ActionFormIntro/{index.885f49af.js → index.9ee7df17.js} +1 -1
  13. package/components/CommonActions/components/ActionIntro/{index.b97cfeec.js → index.bd2a14b2.js} +1 -1
  14. package/components/DataGrid/formatters/columnPointsFormatter/{index.5e645334.js → index.a19b7b90.js} +1 -1
  15. package/components/DataGrid/{index.e127cac8.js → index.e5b552a2.js} +7 -7
  16. package/components/DataGrid/subcomponents/Actions/{index.5947f820.js → index.2f58e034.js} +8 -8
  17. package/components/DragResizeWindow/{index.67aa1e22.js → index.b5206081.js} +4 -4
  18. package/components/DynamicFilter/classes/index.d.ts +1 -1
  19. package/components/DynamicFilter/classes/types.d.ts +1 -0
  20. package/components/DynamicFilter/{index.068ca09c.js → index.73258cb8.js} +14 -10
  21. package/components/GridLayout/{index.367e44f9.js → index.4d26c328.js} +2 -2
  22. package/components/GridLayout/subcomponents/Griditem/{index.b3c79b77.js → index.25e9f332.js} +3 -3
  23. package/components/GridLayout/subcomponents/Responsive/{index.4234d9f3.js → index.3839890b.js} +1 -1
  24. package/components/GridLayout/subcomponents/SizeProvider/{index.0676f896.js → index.a751962f.js} +1 -1
  25. package/components/Icon/index.282c5b58.js +248 -0
  26. package/components/Icon/types.d.ts +1 -0
  27. package/components/Image/{index.d5fed0ab.js → index.8915f577.js} +46 -4
  28. package/components/Image/types.d.ts +2 -2
  29. package/components/LanguagePopover/{index.02987c68.js → index.5e1d85a9.js} +2 -2
  30. package/components/LoadingError/{index.991393ca.js → index.d95e6efb.js} +2 -2
  31. package/components/MFLoader/{index.b928e361.js → index.cc563716.js} +1 -1
  32. package/components/ModalDialog/{index.a30831c9.js → index.690c82a4.js} +3 -3
  33. package/components/NoItemSelected/{index.1ddc6a38.js → index.5246b204.js} +1 -1
  34. package/components/ObjectLogs/{index.546bf5bf.js → index.f2b5f7d9.js} +7 -7
  35. package/components/PDFViewer/PDFViewer.d.ts +2 -0
  36. package/components/PDFViewer/classes/constants.d.ts +1 -0
  37. package/components/PDFViewer/classes/index.d.ts +7 -0
  38. package/components/PDFViewer/classes/types.d.ts +7 -0
  39. package/components/PDFViewer/index.51e4f1b2.js +63 -0
  40. package/components/PDFViewer/index.d.ts +1 -0
  41. package/components/PDFViewer/types.d.ts +3 -0
  42. package/components/Page/{index.c3767243.js → index.f4aedd2d.js} +1 -1
  43. package/components/PaperForm/{index.27dafbcc.js → index.30f68f0f.js} +1 -1
  44. package/components/Period/{index.288a0ec2.js → index.8e118051.js} +1 -1
  45. package/components/PopupsProvider/{index.ae1bd010.js → index.c9400f03.js} +1 -1
  46. package/components/PrintingSystem/{index.b69edc07.js → index.9dc25af9.js} +14 -42
  47. package/components/PrintingSystem/subcomponents/BodyNode/{index.81da2c9c.js → index.6c1cf8f5.js} +1 -1
  48. package/components/PrintingSystem/subcomponents/ChartNode/{index.1863bcf1.js → index.fdb01c74.js} +4 -4
  49. package/components/PrintingSystem/subcomponents/DividerNode/{index.0e6e76ad.js → index.46c5eb9e.js} +1 -1
  50. package/components/PrintingSystem/subcomponents/FooterNode/{index.5af68fd5.js → index.18aa1ddd.js} +1 -1
  51. package/components/PrintingSystem/subcomponents/GridNode/{index.07d4f9a4.js → index.f4b4ffca.js} +4 -4
  52. package/components/PrintingSystem/subcomponents/HeaderNode/{index.dbf08ab4.js → index.9afcd686.js} +1 -1
  53. package/components/PrintingSystem/subcomponents/PaperNode/{index.d81d2f30.js → index.a3967d23.js} +4 -4
  54. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.4c20215d.js → index.e1c05641.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/QRImageNode/index.d.ts +2 -0
  56. package/components/PrintingSystem/subcomponents/QRImageNode/types.d.ts +3 -0
  57. package/components/PrintingSystem/subcomponents/SectionNode/{index.72cb64b8.js → index.c5588090.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.41c261f4.js → index.7792384b.js} +3 -3
  59. package/components/PrintingSystem/types.d.ts +10 -1
  60. package/components/PropertyValue/classes/index.d.ts +1 -1
  61. package/components/PropertyValue/classes/types.d.ts +4 -1
  62. package/components/PropertyValue/index.d61c943c.js +206 -0
  63. package/components/PropertyValue/types.d.ts +5 -7
  64. package/components/Resizeable/{index.e4f47710.js → index.18c86aff.js} +1 -1
  65. package/components/ScrollBar/{index.65bb2930.js → index.010f1b9d.js} +5 -1
  66. package/components/SideBar/classes/index.d.ts +1 -1
  67. package/components/SideBar/{index.e4d2ee53.js → index.f5aecd41.js} +11 -11
  68. package/components/SideBar/types.d.ts +3 -3
  69. package/components/SplitLayout/{index.9ef430f6.js → index.30fd5861.js} +1 -1
  70. package/components/ToastContainer/ToastContainer.d.ts +2 -0
  71. package/components/ToastContainer/classes/constants.d.ts +1 -0
  72. package/components/ToastContainer/classes/index.d.ts +8 -0
  73. package/components/ToastContainer/classes/types.d.ts +9 -0
  74. package/components/ToastContainer/index.83304f62.js +87 -0
  75. package/components/ToastContainer/index.d.ts +2 -0
  76. package/components/ToastContainer/subcomponents/ToastMessage/index.d.ts +2 -0
  77. package/components/ToastContainer/subcomponents/ToastMessage/types.d.ts +5 -0
  78. package/components/ToastContainer/types.d.ts +4 -0
  79. package/components/areas/components/AreasAdmin/{index.8426755c.js → index.c55d5c24.js} +10 -10
  80. package/components/areas/components/AreasViewer/{index.6b310068.js → index.2bec316e.js} +12 -12
  81. package/components/areas/contexts/AreasContext/{index.1e3974e1.js → index.827ee1e5.js} +4 -4
  82. package/components/areas/hooks/useAreas/{index.21fa4ab1.js → index.71bc8f19.js} +1 -1
  83. package/components/formatters/BooleanFormatter/{index.fcc47dfd.js → index.b21353a5.js} +2 -2
  84. package/components/formatters/PointsFormatter/{index.80a4e414.js → index.5c94c5e8.js} +2 -2
  85. package/components/formatters/PointsFormatter/index.d.ts +1 -1
  86. package/components/formatters/{index.7d5cbac9.js → index.7b216229.js} +1 -1
  87. package/components/hook-form/RHFAutocomplete/classes/types.d.ts +2 -0
  88. package/components/hook-form/RHFAutocomplete/{index.ea720b8f.js → index.210ee73f.js} +26 -35
  89. package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/index.d.ts +1 -1
  90. package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/types.d.ts +1 -2
  91. package/components/hook-form/RHFAutocomplete/types.d.ts +8 -3
  92. package/components/hook-form/RHFAutocompleteAsync/{index.1609eaf0.js → index.e5935f63.js} +1 -1
  93. package/components/hook-form/RHFColorPicker/classes/constants.d.ts +1 -0
  94. package/components/hook-form/RHFColorPicker/classes/index.d.ts +11 -0
  95. package/components/hook-form/RHFColorPicker/classes/types.d.ts +11 -0
  96. package/components/hook-form/RHFColorPicker/index.bcc1eced.js +150 -0
  97. package/components/hook-form/RHFColorPicker/index.d.ts +6 -0
  98. package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.d.ts +1 -0
  99. package/components/hook-form/RHFColorPicker/types.d.ts +5 -0
  100. package/components/hook-form/RHFDateTime/{index.8bd9e41e.js → index.fa80a8cb.js} +1 -1
  101. package/components/hook-form/RHFDateTime/types.d.ts +0 -1
  102. package/components/hook-form/RHFPeriod/{index.89bebd60.js → index.d320e56f.js} +1 -1
  103. package/components/hook-form/RHFTextField/{index.2c8d4613.js → index.ab689d7d.js} +1 -1
  104. package/components/hook-form/RHFUpload/{index.55e495bb.js → index.e251c9b6.js} +4 -4
  105. package/components/index.d.ts +2 -0
  106. package/components/maps/components/GpsTools/{index.1b6d82bc.js → index.03998a42.js} +14 -14
  107. package/components/maps/components/Map/{index.f38df83e.js → index.b79ceae4.js} +3 -3
  108. package/components/modal/{WindowBase.a4534b0b.js → WindowBase.779aa7a5.js} +3 -3
  109. package/components/modal/{WindowConfirm.7a79bfa5.js → WindowConfirm.ec73ba4f.js} +5 -5
  110. package/components/mui_extended/Accordion/{index.f1289de0.js → index.e15e10d9.js} +2 -2
  111. package/components/mui_extended/Button/classes/types.d.ts +2 -0
  112. package/components/mui_extended/Button/{index.007f5a6e.js → index.5c68764a.js} +3 -3
  113. package/components/mui_extended/IconButton/{index.b705c196.js → index.a719445f.js} +1 -1
  114. package/components/mui_extended/LoadingButton/classes/constants.d.ts +1 -1
  115. package/components/mui_extended/MenuActions/{index.aa43c4f2.js → index.62359120.js} +2 -2
  116. package/components/mui_extended/Pager/{index.9928807e.js → index.fa5f5ded.js} +1 -1
  117. package/components/mui_extended/ToggleButton/{index.b053aa70.js → index.5aa6ea58.js} +1 -1
  118. package/components/mui_extended/ToggleIconButton/{index.80d38bf4.js → index.47ddefd4.js} +1 -1
  119. package/contexts/ModalContext/{index.054af5d8.js → index.6085b148.js} +1 -1
  120. package/hooks/useFormAddEdit/{index.b4348b6a.js → index.59821a33.js} +2 -2
  121. package/hooks/useModal/{index.acc61361.js → index.1c88654a.js} +1 -1
  122. package/index.js +95 -80
  123. package/node_modules.bb836860.js +6921 -0
  124. package/package.json +5 -1
  125. package/{react-draggable.2bc0e647.js → react-draggable.312ab17d.js} +3 -3
  126. package/{react-json-view.57125fcf.js → react-json-view.5636414a.js} +1 -1
  127. package/{react-resizable.53094455.js → react-resizable.f2c58a4c.js} +4 -4
  128. package/{react-splitter-layout.8b1655c8.js → react-splitter-layout.c5d98bf7.js} +3 -3
  129. package/components/Icon/index.aa9949f0.js +0 -147
  130. package/components/PrintingSystem/utils/getEvalValue/index.d.ts +0 -1
  131. package/components/PropertyValue/index.92ccdf7a.js +0 -220
  132. package/components/PropertyValue/skeleton.d.ts +0 -2
  133. package/components/hook-form/RHFColorPicker/index.259b6f38.js +0 -61
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "license": "UNLICENSED",
5
5
  "dependencies": {
6
6
  "@emotion/react": "^11.9.0",
@@ -27,12 +27,16 @@
27
27
  "lodash.throttle": "^4.1.1",
28
28
  "npm": "^9.6.2",
29
29
  "react-colorful": "^5.6.1",
30
+ "qrcode.react": "^3.1.0",
30
31
  "react-dnd": "^16.0.1",
31
32
  "react-dnd-html5-backend": "^16.0.1",
32
33
  "react-helmet-async": "^1.3.0",
33
34
  "react-hook-form": "^7.33.1",
34
35
  "react-leaflet": "^4.2.1",
35
36
  "react-leaflet-arrowheads": "^1.1.0",
37
+ "react-toastify": "9.0.5",
38
+ "react-chartjs-2": "^5.2.0",
39
+ "react-color": "^2.19.3",
36
40
  "react-router-dom": "6.3.0",
37
41
  "react-spinners": "^0.13.8",
38
42
  "simplebar-react": "2.4.1",
@@ -1,5 +1,5 @@
1
1
  import React__default from "react";
2
- import require$$1 from "prop-types";
2
+ import PropTypes from "prop-types";
3
3
  import require$$2 from "react-dom";
4
4
  import clsx from "clsx";
5
5
  import { d as domFns, s as shims, l as log, p as positionFns } from "./utils/index.9ad3909a.js";
@@ -11,7 +11,7 @@ Object.defineProperty(DraggableCore$2, "__esModule", {
11
11
  });
12
12
  DraggableCore$2.default = void 0;
13
13
  var React = _interopRequireWildcard(React__default);
14
- var _propTypes = _interopRequireDefault(require$$1);
14
+ var _propTypes = _interopRequireDefault(PropTypes);
15
15
  var _reactDom = _interopRequireDefault(require$$2);
16
16
  var _domFns = domFns;
17
17
  var _positionFns = positionFns;
@@ -316,7 +316,7 @@ _defineProperty(DraggableCore$1, "defaultProps", {
316
316
  });
317
317
  exports.default = void 0;
318
318
  var React2 = _interopRequireWildcard2(React__default);
319
- var _propTypes2 = _interopRequireDefault2(require$$1);
319
+ var _propTypes2 = _interopRequireDefault2(PropTypes);
320
320
  var _reactDom2 = _interopRequireDefault2(require$$2);
321
321
  var _clsx = _interopRequireDefault2(clsx);
322
322
  var _domFns2 = domFns;
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./commonjs.565e6834.js";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./commonjs.333e55c7.js";
2
2
  import React__default from "react";
3
3
  var main = { exports: {} };
4
4
  (function(module, exports) {
@@ -1,13 +1,13 @@
1
1
  import React__default from "react";
2
- import { c as cjs } from "./react-draggable.2bc0e647.js";
2
+ import { c as cjs } from "./react-draggable.312ab17d.js";
3
3
  import { u as utils } from "./utils/index.9ad3909a.js";
4
- import require$$1 from "prop-types";
4
+ import PropTypes from "prop-types";
5
5
  var reactResizable = { exports: {} };
6
6
  var Resizable$2 = {};
7
7
  var propTypes = {};
8
8
  propTypes.__esModule = true;
9
9
  propTypes.resizableProps = void 0;
10
- var _propTypes$2 = _interopRequireDefault$1(require$$1);
10
+ var _propTypes$2 = _interopRequireDefault$1(PropTypes);
11
11
  function _interopRequireDefault$1(obj) {
12
12
  return obj && obj.__esModule ? obj : { default: obj };
13
13
  }
@@ -364,7 +364,7 @@ var ResizableBox$2 = {};
364
364
  ResizableBox$2.__esModule = true;
365
365
  ResizableBox$2.default = void 0;
366
366
  var React = _interopRequireWildcard(React__default);
367
- var _propTypes = _interopRequireDefault(require$$1);
367
+ var _propTypes = _interopRequireDefault(PropTypes);
368
368
  var _Resizable = _interopRequireDefault(Resizable$2);
369
369
  var _propTypes2 = propTypes;
370
370
  var _excluded = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
@@ -1,10 +1,10 @@
1
- import { g as getDefaultExportFromCjs } from "./commonjs.565e6834.js";
2
- import require$$1 from "prop-types";
1
+ import { g as getDefaultExportFromCjs } from "./commonjs.333e55c7.js";
2
+ import PropTypes from "prop-types";
3
3
  import React__default from "react";
4
4
  var lib = { exports: {} };
5
5
  (function(module, exports) {
6
6
  !function(e, t) {
7
- module.exports = t(require$$1, React__default);
7
+ module.exports = t(PropTypes, React__default);
8
8
  }(window, function(e, t) {
9
9
  return function(e2) {
10
10
  var t2 = {};
@@ -1,147 +0,0 @@
1
- import { useEnvironment } from "@m4l/core";
2
- import { styled, generateUtilityClasses, generateUtilityClass, Skeleton } from "@mui/material";
3
- import { u as useSideBar, g as getNameDataTestId$1 } from "../SideBar/index.e4d2ee53.js";
4
- import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
5
- import { jsx } from "react/jsx-runtime";
6
- import { useState, useEffect } from "react";
7
- import { unstable_composeClasses } from "@mui/base";
8
- import clsx from "clsx";
9
- import { useResponsiveDesktop } from "@m4l/graphics";
10
- const IconRoot = styled("div")(({
11
- theme
12
- }) => ({
13
- ...theme.components?.M4LIcon?.styleOverrides
14
- }));
15
- const DivIcon = styled("div", {
16
- shouldForwardProp: (props) => props !== "src" && props !== "rotationAngle"
17
- })(({
18
- src,
19
- rotationAngle
20
- }) => ({
21
- maskPosition: "center",
22
- maskRepeat: "no-repeat",
23
- maskSize: "cover",
24
- WebkitMaskRepeat: "no-repeat",
25
- mask: `url('data:image/svg+xml;base64,${src}')`,
26
- WebkitMask: `url('data:image/svg+xml;base64,${src}')`,
27
- WebkitMaskSize: "cover",
28
- ...rotationAngle && {
29
- transform: `rotate(${rotationAngle}deg)`
30
- }
31
- }));
32
- const componentName = "M4LIcon";
33
- generateUtilityClasses(componentName, [
34
- "root",
35
- "icon",
36
- "variantSkeleton",
37
- "sizeExtraSmall",
38
- "sizeSmall",
39
- "sizeMedium",
40
- "sizeLarge",
41
- "sizeExtraLarge",
42
- "rotationAngle"
43
- ]);
44
- function getIconClassesUtilityClass(slot) {
45
- return generateUtilityClass(componentName, slot);
46
- }
47
- const useUtilityClasses = (ownerState) => {
48
- const slots = {
49
- root: ["root"],
50
- icon: ["icon", ownerState.size === "extraSmall" && "sizeExtraSmall", ownerState.size === "small" && "sizeSmall", ownerState.size === "medium" && "sizeMedium", ownerState.size === "large" && "sizeLarge", ownerState.size === "extraLarge" && "sizeExtraLarge", ownerState.rotationAngle ? "rotationAngle" : ""],
51
- variantSkeleton: ["variantSkeleton", ownerState.size === "extraSmall" && "sizeExtraSmall", ownerState.size === "small" && "sizeSmall", ownerState.size === "medium" && "sizeMedium", ownerState.size === "large" && "sizeLarge", ownerState.size === "extraLarge" && "sizeExtraLarge"]
52
- };
53
- const composedClasses = unstable_composeClasses(slots, getIconClassesUtilityClass, {});
54
- return {
55
- ...composedClasses
56
- };
57
- };
58
- const ICON_PREFIX = "Icon";
59
- const getNameDataTestId = (KEY) => {
60
- return `${ICON_PREFIX}-${KEY}`;
61
- };
62
- function Icon(props) {
63
- const {
64
- src,
65
- size = "small",
66
- rotationAngle,
67
- testingProps,
68
- className
69
- } = props;
70
- const [resource, setResource] = useState(testingProps?.resource || void 0);
71
- const isDesktop = useResponsiveDesktop();
72
- useEffect(() => {
73
- let mounted = true;
74
- (async function networkOperation() {
75
- await fetch(src).then((response) => {
76
- return response.text() || "";
77
- }).then((xml) => {
78
- xml = xml.match(
79
- /(<svg\b[^>]*\s*(viewBox="(\b[^"]*)").*?>([\s\S]*?)<\/svg>|<svg>([\s\S]*?)<\/svg>)/g
80
- )?.toString() || "";
81
- if (mounted) {
82
- setResource(window.btoa(xml));
83
- }
84
- }).catch((_err) => {
85
- });
86
- })();
87
- return function clenUp() {
88
- mounted = false;
89
- };
90
- }, [src]);
91
- const ownerState = {
92
- size: isDesktop ? size : "medium",
93
- rotationAngle
94
- };
95
- const classes = useUtilityClasses(ownerState);
96
- return /* @__PURE__ */ jsx(IconRoot, {
97
- className: clsx(classes.root, className),
98
- ...process.env.NODE_ENV !== "production" ? {
99
- [TEST_PROP_ID]: getNameDataTestId("root")
100
- } : {},
101
- children: resource ? /* @__PURE__ */ jsx(DivIcon, {
102
- className: classes.icon,
103
- src: resource,
104
- rotationAngle,
105
- ...process.env.NODE_ENV !== "production" ? {
106
- [TEST_PROP_ID]: getNameDataTestId("icon")
107
- } : {}
108
- }) : /* @__PURE__ */ jsx(Skeleton, {
109
- variant: "rectangular",
110
- className: classes.variantSkeleton,
111
- ...process.env.NODE_ENV !== "production" ? {
112
- [TEST_PROP_ID]: getNameDataTestId("variantSkeleton")
113
- } : {}
114
- })
115
- });
116
- }
117
- const ArrowIconRoot = styled("div")(() => ({
118
- display: "flex",
119
- alignSelf: "center",
120
- lineHeight: 0
121
- }));
122
- function ArrowIcon(props) {
123
- const {
124
- openState
125
- } = props;
126
- const {
127
- host_static_assets,
128
- environment_assets
129
- } = useEnvironment();
130
- const {
131
- classes
132
- } = useSideBar();
133
- return /* @__PURE__ */ jsx(ArrowIconRoot, {
134
- className: classes.arrowIconRoot,
135
- ...process.env.NODE_ENV !== "production" ? {
136
- [TEST_PROP_ID]: getNameDataTestId$1("arrowIconRoot")
137
- } : {},
138
- children: /* @__PURE__ */ jsx(Icon, {
139
- src: `${host_static_assets}/${environment_assets}/frontend/components/sidebar/assets/icons/ChevronRight.svg`,
140
- rotationAngle: openState ? 90 : 0
141
- })
142
- });
143
- }
144
- export {
145
- ArrowIcon as A,
146
- Icon as I
147
- };
@@ -1 +0,0 @@
1
- export declare const getEvalValue: (sourceData: any, key: string) => string | Array<any>;
@@ -1,220 +0,0 @@
1
- import { styled } from "@mui/material/styles";
2
- import { Skeleton, generateUtilityClasses, generateUtilityClass } from "@mui/material";
3
- import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
4
- import { g as getNameDataTestId } from "../../test/getNameDataTestId.14875ec7.js";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- import { useResponsiveDesktop } from "@m4l/graphics";
7
- import { useModuleSkeleton } from "@m4l/core";
8
- import { unstable_composeClasses } from "@mui/base";
9
- import clsx from "clsx";
10
- import { useState } from "react";
11
- const PropertyValueRoot = styled("div", {
12
- shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
13
- })(({
14
- propertyWidth,
15
- isForm,
16
- theme
17
- }) => ({
18
- display: "grid",
19
- gridTemplateColumns: "1fr",
20
- alignItems: "flex-start",
21
- width: "100%",
22
- padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
23
- borderBottom: isForm ? "none" : `1px solid ${theme.palette.divider}`,
24
- flexDirection: "column",
25
- [theme.breakpoints.up("sm")]: {
26
- gridTemplateColumns: propertyWidth ? `${propertyWidth}px 1fr` : "150px 1fr",
27
- gap: theme.spacing(2),
28
- alignItems: "center"
29
- },
30
- ...theme.components?.M4LPropertyValue?.styleOverrides
31
- }));
32
- const Property = styled("div", {
33
- shouldForwardProp: (prop) => prop !== "propertyWidth" && prop !== "propertyHeight" && prop !== "isForm"
34
- })(({
35
- propertyWidth,
36
- isForm,
37
- theme
38
- }) => ({
39
- width: "100%",
40
- minWidth: "100%",
41
- ...theme.typography.body,
42
- color: theme.palette.text.primary,
43
- height: "100%",
44
- display: "flex",
45
- alignItems: "center",
46
- justifyContent: "flex-start",
47
- position: "relative",
48
- [theme.breakpoints.up("sm")]: {
49
- borderRight: isForm ? "none" : `1px solid ${theme.palette.divider}`,
50
- paddingRight: theme.spacing(2),
51
- textAlign: "right",
52
- width: propertyWidth || "150px",
53
- minWidth: propertyWidth || "150px",
54
- justifyContent: "flex-end"
55
- },
56
- overflow: "hidden",
57
- overflowWrap: "break-word"
58
- }));
59
- const Value = styled("div", {
60
- shouldForwardProp: (prop) => prop !== "valueWidth" && prop !== "valueHeight" && prop !== "withGrid"
61
- })(({
62
- valueWidth,
63
- valueHeight,
64
- theme
65
- }) => ({
66
- flexGrow: "1",
67
- ...theme.typography.body,
68
- color: theme.palette.text.secondary,
69
- overflow: "hidden",
70
- textOverflow: "ellipsis",
71
- position: "relative",
72
- padding: "1px",
73
- maxWidth: `${valueWidth}%`,
74
- width: `${valueWidth}%`,
75
- height: valueHeight,
76
- marginTop: theme.spacing(1),
77
- [theme.breakpoints.up("sm")]: {
78
- marginTop: "0px"
79
- },
80
- overflowWrap: "break-word"
81
- }));
82
- const SKTWrapperProperty = styled("div")(() => ({
83
- display: "flex",
84
- justifyContent: "flex-end"
85
- }));
86
- const COMPONENT_PREFIX = "m4l-property-value";
87
- const TEST_PROPS_DATA = `${COMPONENT_PREFIX}-data`;
88
- function SKTProperty(props) {
89
- const {
90
- className,
91
- dataTestId = ""
92
- } = props;
93
- return /* @__PURE__ */ jsx(SKTWrapperProperty, {
94
- className,
95
- ...process.env.NODE_ENV !== "production" ? {
96
- [TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "skeletonProperty", dataTestId)
97
- } : {},
98
- children: /* @__PURE__ */ jsx(Skeleton, {
99
- variant: "text",
100
- width: 68,
101
- height: 14
102
- })
103
- });
104
- }
105
- const componentName = "M4LPropertyValue";
106
- generateUtilityClasses(componentName, [
107
- "root",
108
- "property",
109
- "value",
110
- "skeletonProperty",
111
- "isDisabled",
112
- "isFocus"
113
- ]);
114
- function getPropertyValueUtilityClass(slot) {
115
- return generateUtilityClass(componentName, slot);
116
- }
117
- const propertyValueUtilityClasses = (ownerState) => {
118
- const slots = {
119
- root: ["root", ownerState.disabled && "isDisabled", ownerState.focus && "isFocus"],
120
- property: ["property"],
121
- value: ["value"],
122
- skeletonProperty: ["skeletonProperty"]
123
- };
124
- const composedClasses = unstable_composeClasses(slots, getPropertyValueUtilityClass, {});
125
- return {
126
- ...composedClasses
127
- };
128
- };
129
- function PropertyValue(props) {
130
- const {
131
- property,
132
- value,
133
- propertyWidth = 200,
134
- valueHeight = "auto",
135
- valueWidth = "100",
136
- valueWidthMobile,
137
- isForm,
138
- className,
139
- dataTestId = "",
140
- disabled = false
141
- } = props;
142
- const isDesktop = useResponsiveDesktop();
143
- const isSkeleton = useModuleSkeleton();
144
- const [isFocus, setIsFocus] = useState(false);
145
- console.log("Estado de focus: ", isFocus);
146
- const getValueW = () => {
147
- if (valueWidthMobile && !isDesktop) {
148
- return valueWidthMobile;
149
- }
150
- if (valueWidth === 75 && isDesktop) {
151
- return 75;
152
- } else if (valueWidth === 75 && !isDesktop) {
153
- return 100;
154
- }
155
- if (valueWidth === 50 && isDesktop) {
156
- return 50;
157
- } else if (valueWidth === 50 && !isDesktop) {
158
- return 100;
159
- }
160
- if (valueWidth === 25 && isDesktop || valueWidth === 12.5 && isDesktop) {
161
- return valueWidth;
162
- }
163
- if (valueWidth === 25 && !isDesktop) {
164
- return 50;
165
- }
166
- if (valueWidth === 12.5 && !isDesktop) {
167
- return 25;
168
- }
169
- return 100;
170
- };
171
- const handlerFocus = () => {
172
- setIsFocus(true);
173
- };
174
- const handlerOnBlur = () => {
175
- setIsFocus(false);
176
- };
177
- const ownerState = {
178
- disabled,
179
- focus: disabled === false ? isFocus : false
180
- };
181
- const classes = propertyValueUtilityClasses(ownerState);
182
- return /* @__PURE__ */ jsxs(PropertyValueRoot, {
183
- tabIndex: 0,
184
- className: clsx(classes.root, className),
185
- isForm,
186
- propertyWidth,
187
- onClick: handlerFocus,
188
- onBlur: handlerOnBlur,
189
- ...process.env.NODE_ENV !== "production" ? {
190
- [TEST_PROPS_DATA]: JSON.stringify([{
191
- property: property ? true : false,
192
- value: value ? true : false
193
- }]),
194
- [TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
195
- } : {},
196
- children: [/* @__PURE__ */ jsx(Property, {
197
- className: classes.property,
198
- isForm,
199
- propertyWidth,
200
- ...process.env.NODE_ENV !== "production" ? {
201
- [TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "property", dataTestId)
202
- } : {},
203
- children: isSkeleton ? /* @__PURE__ */ jsx(SKTProperty, {
204
- className: classes.skeletonProperty,
205
- dataTestId
206
- }) : property
207
- }), /* @__PURE__ */ jsx(Value, {
208
- className: classes.value,
209
- valueWidth: getValueW(),
210
- valueHeight,
211
- ...process.env.NODE_ENV !== "production" ? {
212
- [TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "value", dataTestId)
213
- } : {},
214
- children: value
215
- })]
216
- });
217
- }
218
- export {
219
- PropertyValue as P
220
- };
@@ -1,2 +0,0 @@
1
- import { SKTPropertyProps } from './types';
2
- export declare function SKTProperty(props: SKTPropertyProps): import("react/jsx-runtime").JSX.Element;
@@ -1,61 +0,0 @@
1
- import { useState } from "react";
2
- import { useFormContext, Controller } from "react-hook-form";
3
- import { Popover, Box, Button } from "@mui/material";
4
- import { HexColorPicker } from "react-colorful";
5
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
6
- const RHFColorPicker = (props) => {
7
- const {
8
- name
9
- } = props;
10
- const {
11
- control
12
- } = useFormContext();
13
- const [anchorEl, setAnchorEl] = useState(null);
14
- const handleApprove = () => {
15
- setAnchorEl(null);
16
- };
17
- return /* @__PURE__ */ jsx(Controller, {
18
- name,
19
- control,
20
- defaultValue: "",
21
- render: ({
22
- field
23
- }) => /* @__PURE__ */ jsxs(Fragment, {
24
- children: [/* @__PURE__ */ jsx("div", {
25
- onClick: (event) => setAnchorEl(event.currentTarget),
26
- style: {
27
- backgroundColor: field.value,
28
- width: "20px",
29
- height: "20px",
30
- cursor: "pointer"
31
- }
32
- }), /* @__PURE__ */ jsx(Popover, {
33
- open: Boolean(anchorEl),
34
- anchorEl,
35
- onClose: () => setAnchorEl(null),
36
- anchorOrigin: {
37
- vertical: "bottom",
38
- horizontal: "left"
39
- },
40
- transformOrigin: {
41
- vertical: "top",
42
- horizontal: "left"
43
- },
44
- children: /* @__PURE__ */ jsxs(Box, {
45
- p: 2,
46
- children: [/* @__PURE__ */ jsx(HexColorPicker, {
47
- ...field,
48
- color: field.value
49
- }), /* @__PURE__ */ jsx(Button, {
50
- variant: "contained",
51
- onClick: handleApprove,
52
- children: "Aprobar"
53
- })]
54
- })
55
- })]
56
- })
57
- });
58
- };
59
- export {
60
- RHFColorPicker as R
61
- };