@m4l/components 0.0.58 → 0.0.61

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.
@@ -110,7 +110,7 @@ function MenuActions(props) {
110
110
  dense: true,
111
111
  onClick: () => handleClick(menuAction),
112
112
  sx: {
113
- color: menuAction.color ? menuAction.color : "text.main"
113
+ color: menuAction.color ?? "text.main"
114
114
  },
115
115
  disabled: menuAction.disabled,
116
116
  children: [/* @__PURE__ */ jsx(Icon, {
@@ -33,7 +33,9 @@ const WrapperApplyedFilters = styled("div")(({
33
33
  theme
34
34
  }) => ({
35
35
  width: "100%",
36
- marginLeft: theme.spacing(1.5)
36
+ margin: theme.spacing(0, 1.5),
37
+ paddingLeft: theme.spacing(1.5),
38
+ borderLeft: `1px solid ${theme.palette.divider}`
37
39
  }));
38
40
  const ContainerApplyedFilters = styled("div")(({
39
41
  theme
@@ -42,7 +44,7 @@ const ContainerApplyedFilters = styled("div")(({
42
44
  display: "flex",
43
45
  justifyContent: "flex-start",
44
46
  alignItems: "center",
45
- height: theme.spacing(3.75),
47
+ height: "auto",
46
48
  gap: theme.spacing(1.5)
47
49
  }));
48
50
  const STRING_OPERATORS = ["c", "nc"];
@@ -1043,8 +1045,9 @@ const WrapperApplyedFilter = styled("div")(({
1043
1045
  display: "flex",
1044
1046
  justifyContent: "center",
1045
1047
  alignItems: "center",
1046
- height: theme.spacing(3.75),
1047
- padding: theme.spacing(1),
1048
+ height: "100%",
1049
+ minHeight: theme.spacing(3),
1050
+ padding: theme.spacing(0, 1),
1048
1051
  backgroundColor: theme.palette.action.disabledBackground,
1049
1052
  borderRadius: theme.spacing(1),
1050
1053
  "&.waf_no_setted": {
@@ -1059,7 +1062,7 @@ const AplyedFilterStyled = styled("div")(({
1059
1062
  justifyContent: "center",
1060
1063
  alignItems: "center",
1061
1064
  width: "auto",
1062
- height: theme.spacing(3.75),
1065
+ height: "100%",
1063
1066
  marginRight: theme.spacing(1),
1064
1067
  marginLeft: theme.spacing(1),
1065
1068
  whiteSpace: "nowrap"
@@ -1156,6 +1159,7 @@ function ApplyedFilters() {
1156
1159
  });
1157
1160
  }
1158
1161
  return /* @__PURE__ */ jsx(WrapperApplyedFilters, {
1162
+ className: "WrapperApplyedFilters",
1159
1163
  children: /* @__PURE__ */ jsx(ScrollBar, {
1160
1164
  children: /* @__PURE__ */ jsx(ContainerApplyedFilters, {
1161
1165
  id: "WrapperApplyedFilters",
@@ -1178,11 +1182,8 @@ const SKTClearFilters = styled$1("div")(({
1178
1182
  const WrapperClearFilters = styled$1("div")(({
1179
1183
  theme
1180
1184
  }) => ({
1181
- [theme.breakpoints.up("sm")]: {
1182
- paddingLeft: theme.spacing(1.5),
1183
- marginLeft: theme.spacing(1.5),
1184
- borderLeft: `1px solid ${theme.palette.divider}`
1185
- }
1185
+ paddingLeft: theme.spacing(0.5),
1186
+ borderLeft: `1px solid ${theme.palette.divider}`
1186
1187
  }));
1187
1188
  const ClearFilters = () => {
1188
1189
  const {
@@ -1223,7 +1224,12 @@ const SKTWrapperFilterButton = styled("div")(({
1223
1224
  height: theme.spacing(3.75),
1224
1225
  background: alpha(theme.palette.primary.main, 0.3)
1225
1226
  }));
1226
- const WrapperFilterButton = styled("div")(() => ({
1227
+ const WrapperFilterButton = styled("div")(({
1228
+ theme
1229
+ }) => ({
1230
+ paddingRight: theme.spacing(0.75),
1231
+ marginRight: theme.spacing(0.75),
1232
+ borderRight: `1px solid ${theme.palette.divider}`,
1227
1233
  "&.isDirty": {
1228
1234
  animationName: "dirtyEffect",
1229
1235
  animationDuration: "1s",
@@ -1293,11 +1299,7 @@ const WrapperInputFilter = styled("div")(({
1293
1299
  justifyContent: "center",
1294
1300
  alignItems: "center",
1295
1301
  width: "100%",
1296
- height: theme.spacing(3.75),
1297
- marginLeft: theme.spacing(1.5),
1298
- padding: theme.spacing(0, 1.5),
1299
- borderRight: `1px solid ${theme.palette.divider}`,
1300
- borderLeft: `1px solid ${theme.palette.divider}`,
1302
+ height: theme.spacing(3),
1301
1303
  [theme.breakpoints.up("sm")]: {
1302
1304
  width: theme.spacing(25)
1303
1305
  }
@@ -1309,7 +1311,6 @@ const StyledInputFilter = styled("input")(({
1309
1311
  justifyContent: "center",
1310
1312
  alignItems: "center",
1311
1313
  minWidth: theme.spacing(3.75),
1312
- height: theme.spacing(3.75),
1313
1314
  width: "100%",
1314
1315
  "&": {
1315
1316
  outline: "none",
@@ -1552,7 +1553,7 @@ const WrapperFilter = styled("div", {
1552
1553
  justifyContent: "flex-start",
1553
1554
  height: "auto",
1554
1555
  width: "100%",
1555
- padding: theme.spacing(1.5),
1556
+ padding: theme.spacing(0.5),
1556
1557
  borderRadius: theme.spacing(1),
1557
1558
  border: inEdition ? `1px solid ${theme.palette.primary.main}` : `1px solid ${theme.palette.divider}`
1558
1559
  }));
@@ -1569,10 +1570,15 @@ const WrapperFilterMobile = styled("div", {
1569
1570
  minWidth: theme.spacing(25),
1570
1571
  height: "auto",
1571
1572
  width: "100%",
1572
- padding: theme.spacing(1.5),
1573
+ padding: theme.spacing(0.5),
1573
1574
  borderRadius: theme.spacing(1),
1574
1575
  border: inEdition ? `1px solid ${theme.palette.primary.main}` : `1px solid ${theme.palette.divider}`,
1575
- gap: theme.spacing(1.5)
1576
+ gap: theme.spacing(0.75),
1577
+ "& .WrapperApplyedFilters": {
1578
+ margin: "0px",
1579
+ padding: "0px",
1580
+ border: "0px"
1581
+ }
1576
1582
  }));
1577
1583
  const ContainerFistRow = styled("div")(() => ({
1578
1584
  width: "100%",
@@ -1591,7 +1597,7 @@ const DynamicFilter = (props) => {
1591
1597
  children: ({
1592
1598
  inEdition
1593
1599
  }) => isDesktop ? /* @__PURE__ */ jsxs(WrapperFilter, {
1594
- id: "WrapperDynamicFilter",
1600
+ id: "WrapperFilter",
1595
1601
  inEdition,
1596
1602
  children: [/* @__PURE__ */ jsx(FilterButton, {}), /* @__PURE__ */ jsx(InputFilter, {}), /* @__PURE__ */ jsx(ApplyedFilters, {}), /* @__PURE__ */ jsx(PopupEditFilter, {}), /* @__PURE__ */ jsx(ClearFilters, {})]
1597
1603
  }) : /* @__PURE__ */ jsxs(WrapperFilterMobile, {
@@ -1,7 +1,9 @@
1
- import { styled, useTheme } from "@mui/material";
2
- import { useState, useMemo, useEffect } from "react";
1
+ import { styled } from "@mui/material";
2
+ import { useState, useEffect } from "react";
3
+ import { useTheme } from "@mui/material/styles";
4
+ import { g as getPaletteColor } from "../../vendor.js";
3
5
  import { jsx } from "react/jsx-runtime";
4
- const MaskIcon = styled("div", {
6
+ const DivIcon = styled("div", {
5
7
  shouldForwardProp: (props) => props !== "src" && props !== "width" && props !== "height" && props !== "bgColor"
6
8
  })((props) => ({
7
9
  maskPosition: "center!important",
@@ -9,7 +11,8 @@ const MaskIcon = styled("div", {
9
11
  width: props.width === void 0 ? "20px" : props.width,
10
12
  height: props.height === void 0 ? "20px" : props.height,
11
13
  backgroundColor: props.bgColor,
12
- mask: `url('data:image/svg+xml;base64,${props.src}')`
14
+ mask: `url('data:image/svg+xml;base64,${props.src}')`,
15
+ WebkitMask: `url('data:image/svg+xml;base64,${props.src}')`
13
16
  }));
14
17
  const WrapperPlaceHolder = styled("div", {
15
18
  shouldForwardProp: (props) => props !== "widht" && props !== "height"
@@ -29,27 +32,6 @@ function Icon(props) {
29
32
  } = props;
30
33
  const [resource, setResource] = useState(void 0);
31
34
  const theme = useTheme();
32
- const finalBgColor = useMemo(() => {
33
- if (bgColor === "active") {
34
- return theme.palette.action.active;
35
- }
36
- if (bgColor === "selected") {
37
- return theme.palette.primary.main;
38
- }
39
- if (bgColor === "info") {
40
- return theme.palette.info.main;
41
- }
42
- if (bgColor === "warning") {
43
- return theme.palette.warning.main;
44
- }
45
- if (bgColor === "error") {
46
- return theme.palette.error.main;
47
- }
48
- if (bgColor === "disabled") {
49
- return theme.palette.action.disabled;
50
- }
51
- return bgColor;
52
- }, [bgColor]);
53
35
  useEffect(() => {
54
36
  let mounted = true;
55
37
  (async function networkOperation() {
@@ -73,11 +55,11 @@ function Icon(props) {
73
55
  id: "IconReact",
74
56
  width,
75
57
  height,
76
- children: resource ? /* @__PURE__ */ jsx(MaskIcon, {
58
+ children: resource ? /* @__PURE__ */ jsx(DivIcon, {
77
59
  src: resource,
78
60
  width,
79
61
  height,
80
- bgColor: finalBgColor
62
+ bgColor: getPaletteColor(theme.palette, bgColor)
81
63
  }) : /* @__PURE__ */ jsx("img", {
82
64
  src: placeHolder,
83
65
  alt: "icon_svg"
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { WrapperPlaceHolderProps } from './types';
3
- export declare const MaskIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("./types").OwnProps & import("react").HTMLProps<HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
3
+ export declare const DivIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("./types").OwnProps & import("react").HTMLProps<HTMLDivElement>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
4
  export declare const WrapperPlaceHolder: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & WrapperPlaceHolderProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -2,7 +2,7 @@ import { Dialog, IconButton, Paper } from "@mui/material";
2
2
  import { D as Draggable } from "../../react-draggable.js";
3
3
  import { u as useModal } from "../../hooks/useModal/index.js";
4
4
  import { styled } from "@mui/material/styles";
5
- import { g as getThemeVariantColor } from "../../vendor.js";
5
+ import { a as getThemeVariantColor } from "../../vendor.js";
6
6
  import { R as Resizeable } from "../Resizeable/index.js";
7
7
  import { useResponsiveDesktop } from "@m4l/graphics";
8
8
  import { useEnvironment } from "@m4l/core";
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
7
7
  import { M as ModalDialog } from "../../components/ModalDialog/index.js";
8
8
  import { A as ActionIntro } from "../../components/CommonActions/components/ActionIntro/index.js";
9
9
  import { A as ActionCancel } from "../../components/CommonActions/components/ActionCancel/index.js";
10
- import { a as getVariantColor } from "../../vendor.js";
10
+ import { b as getVariantColor } from "../../vendor.js";
11
11
  const WrapperContentConfirm = styled("div")(() => ({
12
12
  display: "flex",
13
13
  flexDirection: "column",
@@ -1,4 +1,5 @@
1
- import { Theme } from '@mui/material/styles';
1
+ import { Palette, Theme } from '@mui/material/styles';
2
2
  import { VariantColor } from './types';
3
+ export declare const getPaletteColor: (palette: Palette, s: string) => string;
3
4
  export declare const getVariantColor: (variant: VariantColor | undefined) => "warning" | "info" | "primary" | "error";
4
5
  export declare const getThemeVariantColor: (theme: Theme, variant: VariantColor | undefined) => string;
package/dist/vendor.js CHANGED
@@ -202,6 +202,21 @@ function RHFAutocomplete(props) {
202
202
  }
203
203
  });
204
204
  }
205
+ const getPaletteColor = function(palette, s) {
206
+ s = s.replace(/\[(\w+)\]/g, ".$1");
207
+ s = s.replace(/^\./, "");
208
+ let o = palette;
209
+ const a = s.split(".");
210
+ for (let i = 0, n = a.length; i < n; ++i) {
211
+ const k = a[i];
212
+ if (k in o) {
213
+ o = o[k];
214
+ } else {
215
+ return palette.action.active;
216
+ }
217
+ }
218
+ return palette.action.active;
219
+ };
205
220
  const getVariantColor = (variant) => {
206
221
  switch (variant) {
207
222
  case "warning":
@@ -245,4 +260,4 @@ const Button = (props) => {
245
260
  ...props
246
261
  });
247
262
  };
248
- export { Button as B, RHFAutocomplete as R, getVariantColor as a, getThemeVariantColor as g };
263
+ export { Button as B, RHFAutocomplete as R, getThemeVariantColor as a, getVariantColor as b, getPaletteColor as g };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.58",
4
+ "version": "0.0.61",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -14,7 +14,7 @@
14
14
  "format": "npm run prettier:fix && npm run lint:fix"
15
15
  },
16
16
  "dependencies": {
17
- "@m4l/graphics": "^0.0.37",
17
+ "@m4l/graphics": "^0.0.39",
18
18
  "react": "^17.0.0 || 18.x",
19
19
  "react-dom": "^18.0.0",
20
20
  "react-draggable": "^4.4.5",