@vention/machine-ui 3.33.7 → 3.34.0
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/index.esm.js
CHANGED
|
@@ -9960,8 +9960,7 @@ const VentionBanner = ({
|
|
|
9960
9960
|
classes
|
|
9961
9961
|
} = useStyles$6({
|
|
9962
9962
|
color,
|
|
9963
|
-
accent: _accent
|
|
9964
|
-
hasIcon: !!startAdornment
|
|
9963
|
+
accent: _accent
|
|
9965
9964
|
});
|
|
9966
9965
|
return jsxs(Box$1, {
|
|
9967
9966
|
className: classes.banner,
|
|
@@ -9990,46 +9989,75 @@ const VentionBanner = ({
|
|
|
9990
9989
|
})]
|
|
9991
9990
|
});
|
|
9992
9991
|
};
|
|
9992
|
+
const colorConfig = {
|
|
9993
|
+
warning: {
|
|
9994
|
+
strong: {
|
|
9995
|
+
bg: COLORS.amber[400]
|
|
9996
|
+
},
|
|
9997
|
+
medium: {
|
|
9998
|
+
bg: COLORS.amber[50],
|
|
9999
|
+
icon: COLORS.amber[500],
|
|
10000
|
+
outline: COLORS.amber[300]
|
|
10001
|
+
}
|
|
10002
|
+
},
|
|
10003
|
+
negative: {
|
|
10004
|
+
strong: {
|
|
10005
|
+
bg: COLORS.red[500]
|
|
10006
|
+
},
|
|
10007
|
+
medium: {
|
|
10008
|
+
bg: COLORS.red[50],
|
|
10009
|
+
icon: COLORS.red[500],
|
|
10010
|
+
outline: COLORS.red[400]
|
|
10011
|
+
}
|
|
10012
|
+
},
|
|
10013
|
+
positive: {
|
|
10014
|
+
strong: {
|
|
10015
|
+
bg: COLORS.green[500]
|
|
10016
|
+
},
|
|
10017
|
+
medium: {
|
|
10018
|
+
bg: COLORS.green[50],
|
|
10019
|
+
icon: COLORS.green[500],
|
|
10020
|
+
outline: COLORS.green[400]
|
|
10021
|
+
}
|
|
10022
|
+
},
|
|
10023
|
+
operational: {
|
|
10024
|
+
strong: {
|
|
10025
|
+
bg: COLORS.blue[600]
|
|
10026
|
+
},
|
|
10027
|
+
medium: {
|
|
10028
|
+
bg: COLORS.blue[50],
|
|
10029
|
+
icon: COLORS.blue[600],
|
|
10030
|
+
outline: COLORS.blue[300]
|
|
10031
|
+
}
|
|
10032
|
+
}
|
|
10033
|
+
};
|
|
9993
10034
|
/**
|
|
9994
10035
|
* Compute banner background and text color based on the `color` prop
|
|
9995
10036
|
*/
|
|
9996
|
-
function useBannerColorStyles(color, theme) {
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
textColor = theme.palette.common.white;
|
|
10003
|
-
break;
|
|
10004
|
-
case "positive":
|
|
10005
|
-
backgroundColor = COLORS.green[500];
|
|
10006
|
-
textColor = theme.palette.common.white;
|
|
10007
|
-
break;
|
|
10008
|
-
case "operational":
|
|
10009
|
-
backgroundColor = COLORS.blue[600];
|
|
10010
|
-
textColor = theme.palette.common.white;
|
|
10011
|
-
break;
|
|
10012
|
-
case "warning":
|
|
10013
|
-
default:
|
|
10014
|
-
backgroundColor = COLORS.amber[400];
|
|
10015
|
-
textColor = theme.palette.text.primary;
|
|
10016
|
-
break;
|
|
10017
|
-
}
|
|
10037
|
+
function useBannerColorStyles(color, accent, theme) {
|
|
10038
|
+
const config = colorConfig[color];
|
|
10039
|
+
const outlineColor = accent === "medium" ? config[accent].outline : "transparent";
|
|
10040
|
+
const backgroundColor = config[accent].bg;
|
|
10041
|
+
const textColor = color === "warning" || accent === "medium" ? theme.palette.text.primary : theme.palette.common.white;
|
|
10042
|
+
const iconColor = accent === "medium" ? config[accent].icon : color === "warning" ? theme.palette.text.primary : theme.palette.common.white;
|
|
10018
10043
|
return {
|
|
10019
10044
|
backgroundColor,
|
|
10045
|
+
outlineColor,
|
|
10046
|
+
iconColor,
|
|
10020
10047
|
textColor
|
|
10021
10048
|
};
|
|
10022
10049
|
}
|
|
10023
10050
|
const useStyles$6 = tss.withParams().create(({
|
|
10024
10051
|
theme,
|
|
10025
10052
|
color,
|
|
10026
|
-
accent
|
|
10027
|
-
hasIcon
|
|
10053
|
+
accent
|
|
10028
10054
|
}) => {
|
|
10029
10055
|
const {
|
|
10030
10056
|
backgroundColor,
|
|
10031
|
-
|
|
10032
|
-
|
|
10057
|
+
outlineColor,
|
|
10058
|
+
textColor,
|
|
10059
|
+
iconColor
|
|
10060
|
+
} = useBannerColorStyles(color, accent, theme);
|
|
10033
10061
|
return {
|
|
10034
10062
|
banner: {
|
|
10035
10063
|
display: "flex",
|
|
@@ -10041,12 +10069,13 @@ const useStyles$6 = tss.withParams().create(({
|
|
|
10041
10069
|
padding: theme.spacing(3),
|
|
10042
10070
|
gap: theme.spacing(2),
|
|
10043
10071
|
borderRadius: theme.shape.borderRadius,
|
|
10044
|
-
outline:
|
|
10072
|
+
outline: `solid 1px ${outlineColor}`
|
|
10045
10073
|
},
|
|
10046
10074
|
bannerIconContainer: {
|
|
10047
10075
|
display: "flex",
|
|
10048
10076
|
alignItems: "center",
|
|
10049
|
-
justifyContent: "center"
|
|
10077
|
+
justifyContent: "center",
|
|
10078
|
+
color: iconColor
|
|
10050
10079
|
},
|
|
10051
10080
|
bannerTitle: {
|
|
10052
10081
|
color: textColor,
|
|
@@ -10090,7 +10119,6 @@ const VentionModalBanner = ({
|
|
|
10090
10119
|
} = useStyles$5({
|
|
10091
10120
|
color,
|
|
10092
10121
|
accent: _accent,
|
|
10093
|
-
hasIcon: !!icon,
|
|
10094
10122
|
maxWidth: _maxWidth
|
|
10095
10123
|
});
|
|
10096
10124
|
const handleOpenModal = () => setIsModalOpen(true);
|
|
@@ -10140,13 +10168,12 @@ const useStyles$5 = tss.withParams().create(({
|
|
|
10140
10168
|
theme,
|
|
10141
10169
|
color,
|
|
10142
10170
|
accent,
|
|
10143
|
-
hasIcon,
|
|
10144
10171
|
maxWidth
|
|
10145
10172
|
}) => {
|
|
10146
10173
|
const {
|
|
10147
10174
|
backgroundColor,
|
|
10148
10175
|
textColor
|
|
10149
|
-
} = useBannerColorStyles(color, theme);
|
|
10176
|
+
} = useBannerColorStyles(color, accent, theme);
|
|
10150
10177
|
return {
|
|
10151
10178
|
modal: {
|
|
10152
10179
|
display: "flex",
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Theme } from "@mui/material";
|
|
2
3
|
import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
|
|
3
4
|
export interface VentionBannerProps {
|
|
4
5
|
size?: StrictExtract<Sizes, "large">;
|
|
5
|
-
accent?: "strong";
|
|
6
|
+
accent?: "medium" | "strong";
|
|
6
7
|
color: "warning" | "negative" | "positive" | "operational";
|
|
7
8
|
startAdornment?: React.ReactNode;
|
|
8
9
|
title: string;
|
|
@@ -14,7 +15,9 @@ export declare const VentionBanner: ({ size, accent, color, startAdornment, titl
|
|
|
14
15
|
/**
|
|
15
16
|
* Compute banner background and text color based on the `color` prop
|
|
16
17
|
*/
|
|
17
|
-
export declare function useBannerColorStyles(color: "
|
|
18
|
+
export declare function useBannerColorStyles(color: VentionBannerProps["color"], accent: VentionBannerProps["accent"], theme: Theme): {
|
|
18
19
|
backgroundColor: string;
|
|
20
|
+
outlineColor: string;
|
|
21
|
+
iconColor: string;
|
|
19
22
|
textColor: string;
|
|
20
23
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Sizes, StrictExtract } from "../../theme/machine-ui-theme";
|
|
1
|
+
import { VentionBannerProps } from "../vention-banner/vention-banner";
|
|
3
2
|
export interface VentionModalBannerProps {
|
|
4
|
-
size?:
|
|
5
|
-
accent?: "
|
|
6
|
-
color: "
|
|
7
|
-
icon?:
|
|
8
|
-
title:
|
|
9
|
-
description:
|
|
10
|
-
endAdornment?:
|
|
3
|
+
size?: VentionBannerProps["size"];
|
|
4
|
+
accent?: VentionBannerProps["accent"];
|
|
5
|
+
color: VentionBannerProps["color"];
|
|
6
|
+
icon?: VentionBannerProps["startAdornment"];
|
|
7
|
+
title: VentionBannerProps["title"];
|
|
8
|
+
description: VentionBannerProps["description"];
|
|
9
|
+
endAdornment?: VentionBannerProps["endAdornment"];
|
|
11
10
|
maxWidth?: number;
|
|
12
11
|
}
|
|
13
12
|
/**
|