@vention/machine-ui 6.0.3 → 6.0.5
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
|
@@ -4771,6 +4771,7 @@ const useStyles$L = tss.withParams().create(({
|
|
|
4771
4771
|
const getDefaultProps = (severity, setVisible) => {
|
|
4772
4772
|
return {
|
|
4773
4773
|
size: "medium",
|
|
4774
|
+
appearance: "subtle",
|
|
4774
4775
|
leftIcon: getAlertIcon(severity),
|
|
4775
4776
|
onCloseButtonClick: () => setVisible(false)
|
|
4776
4777
|
};
|
|
@@ -4870,24 +4871,25 @@ function getRootMaxWidth(isSingleLine, isFullWidth) {
|
|
|
4870
4871
|
if (isSingleLine) return "inherit";
|
|
4871
4872
|
return "560px";
|
|
4872
4873
|
}
|
|
4874
|
+
function getLeftIconMarginRight(size, appearance) {
|
|
4875
|
+
if (appearance === "elevated") return "16px";
|
|
4876
|
+
return size === "small" ? "8px" : "12px";
|
|
4877
|
+
}
|
|
4873
4878
|
const useStyles$K = tss.withParams().create(({
|
|
4874
4879
|
isSingleLine,
|
|
4875
4880
|
severity,
|
|
4876
4881
|
size,
|
|
4877
4882
|
isFullWidth,
|
|
4883
|
+
appearance,
|
|
4878
4884
|
theme,
|
|
4879
4885
|
hasControlProps
|
|
4880
4886
|
}) => {
|
|
4881
4887
|
const {
|
|
4882
|
-
backgroundColor,
|
|
4883
|
-
borderColor,
|
|
4884
4888
|
iconColor
|
|
4885
4889
|
} = getAlertColors(severity, theme);
|
|
4886
4890
|
const textSize = getFontSize$1(size);
|
|
4887
4891
|
return {
|
|
4888
|
-
root: {
|
|
4889
|
-
backgroundColor: backgroundColor,
|
|
4890
|
-
border: `${size === "large" ? 2 : 1}px solid var(--Border-Default-border-default, ${borderColor})`,
|
|
4892
|
+
root: Object.assign(Object.assign({}, getSurfaceStyles(appearance, severity, size, theme)), {
|
|
4891
4893
|
display: "flex",
|
|
4892
4894
|
justifyContent: "center",
|
|
4893
4895
|
alignItems: "center",
|
|
@@ -4899,12 +4901,11 @@ const useStyles$K = tss.withParams().create(({
|
|
|
4899
4901
|
width: isFullWidth ? "100%" : "fit-content",
|
|
4900
4902
|
minWidth: "inherit",
|
|
4901
4903
|
maxWidth: getRootMaxWidth(isSingleLine, isFullWidth),
|
|
4902
|
-
borderRadius: "4px",
|
|
4903
4904
|
padding: getAlertPadding({
|
|
4904
4905
|
isSingleLine,
|
|
4905
4906
|
size
|
|
4906
4907
|
})
|
|
4907
|
-
},
|
|
4908
|
+
}),
|
|
4908
4909
|
alertGridContainer: {
|
|
4909
4910
|
flexWrap: "nowrap",
|
|
4910
4911
|
lineHeight: "0px",
|
|
@@ -4957,7 +4958,7 @@ const useStyles$K = tss.withParams().create(({
|
|
|
4957
4958
|
item: true,
|
|
4958
4959
|
size: size === "small" ? 16 : 24,
|
|
4959
4960
|
width: "fit-content",
|
|
4960
|
-
marginRight: size
|
|
4961
|
+
marginRight: getLeftIconMarginRight(size, appearance),
|
|
4961
4962
|
alignSelf: isSingleLine ? "center" : "normal"
|
|
4962
4963
|
},
|
|
4963
4964
|
rightIcon: {
|
|
@@ -4986,6 +4987,25 @@ const getRootHeight = alertProps => {
|
|
|
4986
4987
|
};
|
|
4987
4988
|
return heights[alertProps.size];
|
|
4988
4989
|
};
|
|
4990
|
+
const getSurfaceStyles = (appearance, severity, size, theme) => {
|
|
4991
|
+
if (appearance === "elevated") {
|
|
4992
|
+
return {
|
|
4993
|
+
backgroundColor: theme.palette.background.surface1,
|
|
4994
|
+
border: `1px solid ${theme.palette.border.default}`,
|
|
4995
|
+
borderRadius: "8px",
|
|
4996
|
+
boxShadow: theme.shadows[4]
|
|
4997
|
+
};
|
|
4998
|
+
}
|
|
4999
|
+
const {
|
|
5000
|
+
backgroundColor,
|
|
5001
|
+
borderColor
|
|
5002
|
+
} = getAlertColors(severity, theme);
|
|
5003
|
+
return {
|
|
5004
|
+
backgroundColor,
|
|
5005
|
+
border: `${size === "large" ? 2 : 1}px solid var(--Border-Default-border-default, ${borderColor})`,
|
|
5006
|
+
borderRadius: "4px"
|
|
5007
|
+
};
|
|
5008
|
+
};
|
|
4989
5009
|
const getAlertColors = (severity, theme) => {
|
|
4990
5010
|
switch (severity) {
|
|
4991
5011
|
case "warn":
|
package/package.json
CHANGED
|
@@ -18,5 +18,6 @@ export interface VentionAlertProps {
|
|
|
18
18
|
isCloseable?: boolean;
|
|
19
19
|
isSingleLine?: boolean;
|
|
20
20
|
isFullWidth?: boolean;
|
|
21
|
+
appearance?: "subtle" | "elevated";
|
|
21
22
|
}
|
|
22
23
|
export declare function getGapSpaceForContent(isSingleLine: boolean, size: VentionAlertProps["size"]): "0px" | "12px" | "8px";
|