@m4l/components 0.0.60 → 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.
- package/dist/components/CommonActions/components/Actions/index.js +1 -1
- package/dist/components/Icon/index.js +7 -26
- package/dist/components/Icon/styles.d.ts +1 -1
- package/dist/components/ModalDialog/index.js +1 -1
- package/dist/contexts/ModalContext/index.js +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/vendor.js +16 -1
- package/package.json +2 -2
|
@@ -110,7 +110,7 @@ function MenuActions(props) {
|
|
|
110
110
|
dense: true,
|
|
111
111
|
onClick: () => handleClick(menuAction),
|
|
112
112
|
sx: {
|
|
113
|
-
color: menuAction.color
|
|
113
|
+
color: menuAction.color ?? "text.main"
|
|
114
114
|
},
|
|
115
115
|
disabled: menuAction.disabled,
|
|
116
116
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { styled
|
|
2
|
-
import { useState,
|
|
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
|
|
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",
|
|
@@ -30,27 +32,6 @@ function Icon(props) {
|
|
|
30
32
|
} = props;
|
|
31
33
|
const [resource, setResource] = useState(void 0);
|
|
32
34
|
const theme = useTheme();
|
|
33
|
-
const finalBgColor = useMemo(() => {
|
|
34
|
-
if (bgColor === "active") {
|
|
35
|
-
return theme.palette.action.active;
|
|
36
|
-
}
|
|
37
|
-
if (bgColor === "selected") {
|
|
38
|
-
return theme.palette.primary.main;
|
|
39
|
-
}
|
|
40
|
-
if (bgColor === "info") {
|
|
41
|
-
return theme.palette.info.main;
|
|
42
|
-
}
|
|
43
|
-
if (bgColor === "warning") {
|
|
44
|
-
return theme.palette.warning.main;
|
|
45
|
-
}
|
|
46
|
-
if (bgColor === "error") {
|
|
47
|
-
return theme.palette.error.main;
|
|
48
|
-
}
|
|
49
|
-
if (bgColor === "disabled") {
|
|
50
|
-
return theme.palette.action.disabled;
|
|
51
|
-
}
|
|
52
|
-
return bgColor;
|
|
53
|
-
}, [bgColor, theme]);
|
|
54
35
|
useEffect(() => {
|
|
55
36
|
let mounted = true;
|
|
56
37
|
(async function networkOperation() {
|
|
@@ -74,11 +55,11 @@ function Icon(props) {
|
|
|
74
55
|
id: "IconReact",
|
|
75
56
|
width,
|
|
76
57
|
height,
|
|
77
|
-
children: resource ? /* @__PURE__ */ jsx(
|
|
58
|
+
children: resource ? /* @__PURE__ */ jsx(DivIcon, {
|
|
78
59
|
src: resource,
|
|
79
60
|
width,
|
|
80
61
|
height,
|
|
81
|
-
bgColor:
|
|
62
|
+
bgColor: getPaletteColor(theme.palette, bgColor)
|
|
82
63
|
}) : /* @__PURE__ */ jsx("img", {
|
|
83
64
|
src: placeHolder,
|
|
84
65
|
alt: "icon_svg"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WrapperPlaceHolderProps } from './types';
|
|
3
|
-
export declare const
|
|
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 {
|
|
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 {
|
|
10
|
+
import { b as getVariantColor } from "../../vendor.js";
|
|
11
11
|
const WrapperContentConfirm = styled("div")(() => ({
|
|
12
12
|
display: "flex",
|
|
13
13
|
flexDirection: "column",
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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,
|
|
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.
|
|
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.
|
|
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",
|