@vention/machine-ui 3.33.6 → 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
|
@@ -7790,7 +7790,7 @@ const VentionSelect = props => {
|
|
|
7790
7790
|
const menuItem = menuItemsMap.get(value);
|
|
7791
7791
|
return jsx(Box$1, {
|
|
7792
7792
|
children: menuItem && "displayNode" in menuItem ? menuItem.displayNode : menuItem.displayText
|
|
7793
|
-
}, value);
|
|
7793
|
+
}, toReactKey(value));
|
|
7794
7794
|
})
|
|
7795
7795
|
});
|
|
7796
7796
|
}
|
|
@@ -7811,7 +7811,7 @@ const VentionSelect = props => {
|
|
|
7811
7811
|
variant: typographyVariants.text,
|
|
7812
7812
|
children: item.displayText
|
|
7813
7813
|
}), "displayNode" in item && item.displayNode]
|
|
7814
|
-
}, item.value))
|
|
7814
|
+
}, toReactKey(item.value)))
|
|
7815
7815
|
})), errorText && jsxs(FormHelperText, {
|
|
7816
7816
|
error: Boolean(errorText),
|
|
7817
7817
|
classes: {
|
|
@@ -7979,6 +7979,12 @@ const getIconSize = size => {
|
|
|
7979
7979
|
return 14;
|
|
7980
7980
|
}
|
|
7981
7981
|
};
|
|
7982
|
+
/**
|
|
7983
|
+
* `undefined` is not a valid React key, so we'll format it to the string `"undefined"`
|
|
7984
|
+
*/
|
|
7985
|
+
function toReactKey(key) {
|
|
7986
|
+
return key !== null && key !== void 0 ? key : "undefined";
|
|
7987
|
+
}
|
|
7982
7988
|
|
|
7983
7989
|
const VentionStepper = props => {
|
|
7984
7990
|
const {
|
|
@@ -9954,8 +9960,7 @@ const VentionBanner = ({
|
|
|
9954
9960
|
classes
|
|
9955
9961
|
} = useStyles$6({
|
|
9956
9962
|
color,
|
|
9957
|
-
accent: _accent
|
|
9958
|
-
hasIcon: !!startAdornment
|
|
9963
|
+
accent: _accent
|
|
9959
9964
|
});
|
|
9960
9965
|
return jsxs(Box$1, {
|
|
9961
9966
|
className: classes.banner,
|
|
@@ -9984,46 +9989,75 @@ const VentionBanner = ({
|
|
|
9984
9989
|
})]
|
|
9985
9990
|
});
|
|
9986
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
|
+
};
|
|
9987
10034
|
/**
|
|
9988
10035
|
* Compute banner background and text color based on the `color` prop
|
|
9989
10036
|
*/
|
|
9990
|
-
function useBannerColorStyles(color, theme) {
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
textColor = theme.palette.common.white;
|
|
9997
|
-
break;
|
|
9998
|
-
case "positive":
|
|
9999
|
-
backgroundColor = COLORS.green[500];
|
|
10000
|
-
textColor = theme.palette.common.white;
|
|
10001
|
-
break;
|
|
10002
|
-
case "operational":
|
|
10003
|
-
backgroundColor = COLORS.blue[600];
|
|
10004
|
-
textColor = theme.palette.common.white;
|
|
10005
|
-
break;
|
|
10006
|
-
case "warning":
|
|
10007
|
-
default:
|
|
10008
|
-
backgroundColor = COLORS.amber[400];
|
|
10009
|
-
textColor = theme.palette.text.primary;
|
|
10010
|
-
break;
|
|
10011
|
-
}
|
|
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;
|
|
10012
10043
|
return {
|
|
10013
10044
|
backgroundColor,
|
|
10045
|
+
outlineColor,
|
|
10046
|
+
iconColor,
|
|
10014
10047
|
textColor
|
|
10015
10048
|
};
|
|
10016
10049
|
}
|
|
10017
10050
|
const useStyles$6 = tss.withParams().create(({
|
|
10018
10051
|
theme,
|
|
10019
10052
|
color,
|
|
10020
|
-
accent
|
|
10021
|
-
hasIcon
|
|
10053
|
+
accent
|
|
10022
10054
|
}) => {
|
|
10023
10055
|
const {
|
|
10024
10056
|
backgroundColor,
|
|
10025
|
-
|
|
10026
|
-
|
|
10057
|
+
outlineColor,
|
|
10058
|
+
textColor,
|
|
10059
|
+
iconColor
|
|
10060
|
+
} = useBannerColorStyles(color, accent, theme);
|
|
10027
10061
|
return {
|
|
10028
10062
|
banner: {
|
|
10029
10063
|
display: "flex",
|
|
@@ -10035,12 +10069,13 @@ const useStyles$6 = tss.withParams().create(({
|
|
|
10035
10069
|
padding: theme.spacing(3),
|
|
10036
10070
|
gap: theme.spacing(2),
|
|
10037
10071
|
borderRadius: theme.shape.borderRadius,
|
|
10038
|
-
outline:
|
|
10072
|
+
outline: `solid 1px ${outlineColor}`
|
|
10039
10073
|
},
|
|
10040
10074
|
bannerIconContainer: {
|
|
10041
10075
|
display: "flex",
|
|
10042
10076
|
alignItems: "center",
|
|
10043
|
-
justifyContent: "center"
|
|
10077
|
+
justifyContent: "center",
|
|
10078
|
+
color: iconColor
|
|
10044
10079
|
},
|
|
10045
10080
|
bannerTitle: {
|
|
10046
10081
|
color: textColor,
|
|
@@ -10084,7 +10119,6 @@ const VentionModalBanner = ({
|
|
|
10084
10119
|
} = useStyles$5({
|
|
10085
10120
|
color,
|
|
10086
10121
|
accent: _accent,
|
|
10087
|
-
hasIcon: !!icon,
|
|
10088
10122
|
maxWidth: _maxWidth
|
|
10089
10123
|
});
|
|
10090
10124
|
const handleOpenModal = () => setIsModalOpen(true);
|
|
@@ -10134,13 +10168,12 @@ const useStyles$5 = tss.withParams().create(({
|
|
|
10134
10168
|
theme,
|
|
10135
10169
|
color,
|
|
10136
10170
|
accent,
|
|
10137
|
-
hasIcon,
|
|
10138
10171
|
maxWidth
|
|
10139
10172
|
}) => {
|
|
10140
10173
|
const {
|
|
10141
10174
|
backgroundColor,
|
|
10142
10175
|
textColor
|
|
10143
|
-
} = useBannerColorStyles(color, theme);
|
|
10176
|
+
} = useBannerColorStyles(color, accent, theme);
|
|
10144
10177
|
return {
|
|
10145
10178
|
modal: {
|
|
10146
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
|
/**
|
|
@@ -12,7 +12,7 @@ export interface VentionSelectProps extends Omit<SelectProps, "placeholder" | "s
|
|
|
12
12
|
variant: "outlined";
|
|
13
13
|
value: string | number | string[] | number[] | undefined;
|
|
14
14
|
onChange: (event: SelectChangeEvent<VentionSelectProps["value"]>, child: ReactNode) => void;
|
|
15
|
-
menuItems: ReadonlyArray<VentionSelectMenuItem<string | number>>;
|
|
15
|
+
menuItems: ReadonlyArray<VentionSelectMenuItem<string | number | undefined>>;
|
|
16
16
|
labelText?: string;
|
|
17
17
|
isDisabled?: boolean;
|
|
18
18
|
placeholder?: string;
|