@sproutsocial/racine 12.12.0 → 12.13.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/CHANGELOG.md +13 -0
- package/__flow__/Banner/index.js +47 -41
- package/__flow__/Banner/index.stories.js +2 -2
- package/__flow__/Banner/index.test.js +10 -1
- package/__flow__/themes/dark/theme.js +3 -0
- package/__flow__/themes/light/theme.js +3 -0
- package/__flow__/types/theme.colors.flow.js +3 -0
- package/commonjs/Banner/index.js +64 -78
- package/commonjs/themes/dark/theme.js +6 -0
- package/commonjs/themes/light/theme.js +6 -0
- package/lib/Banner/index.js +67 -78
- package/lib/themes/dark/theme.js +6 -0
- package/lib/themes/light/theme.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 12.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c8566fd: **Deprecation notice:**
|
|
8
|
+
|
|
9
|
+
The `danger` type for the `Banner` component has been **deprecated** in favor of the `error` type. A couple of changes will be required to comply with this deprecation:
|
|
10
|
+
|
|
11
|
+
- Any code using the `danger` type for the `Banner` component should be migrated to use the `error` type instead.
|
|
12
|
+
- Any styles using `danger` props from the theme should be migrated to use `error` instead.
|
|
13
|
+
|
|
14
|
+
Use of the `danger` type for the `Banner` component and `danger` props in the theme will be fully removed in a future release.
|
|
15
|
+
|
|
3
16
|
## 12.12.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/__flow__/Banner/index.js
CHANGED
|
@@ -4,60 +4,66 @@ import Icon from "../Icon";
|
|
|
4
4
|
import Container from "./styles";
|
|
5
5
|
import Box from "../Box";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
* Use banner type "error" instead of "danger"
|
|
10
|
+
*/
|
|
11
|
+
type EnumDeprecatedBannerType = "danger";
|
|
12
|
+
|
|
13
|
+
type EnumValidBannerType =
|
|
8
14
|
| "success"
|
|
9
15
|
| "info"
|
|
10
|
-
| "danger"
|
|
11
16
|
| "error"
|
|
12
17
|
| "warning"
|
|
13
18
|
| "opportunity";
|
|
14
19
|
|
|
20
|
+
export type EnumBannerType = EnumValidBannerType | EnumDeprecatedBannerType;
|
|
21
|
+
|
|
15
22
|
type TypeProps = {
|
|
16
23
|
text: React.Node,
|
|
17
24
|
/** Type of banner. "danger" is deprecated in favor of "error" */
|
|
18
25
|
type: EnumBannerType,
|
|
19
26
|
};
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
case "warning":
|
|
36
|
-
return <Icon name="triangle" className="Icon" fixedWidth />;
|
|
37
|
-
case "opportunity":
|
|
38
|
-
return <Icon name="sparkles" className="Icon" fixedWidth />;
|
|
39
|
-
default:
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
28
|
+
const getBannerIcon = (type: EnumValidBannerType) => {
|
|
29
|
+
switch (type) {
|
|
30
|
+
case "success":
|
|
31
|
+
return <Icon name="circle-check-no-fill" className="Icon" fixedWidth />;
|
|
32
|
+
case "info":
|
|
33
|
+
return <Icon name="info-white" className="Icon" fixedWidth />;
|
|
34
|
+
case "error":
|
|
35
|
+
return <Icon name="triangle" className="Icon" fixedWidth />;
|
|
36
|
+
case "warning":
|
|
37
|
+
return <Icon name="triangle" className="Icon" fixedWidth />;
|
|
38
|
+
case "opportunity":
|
|
39
|
+
return <Icon name="sparkles" className="Icon" fixedWidth />;
|
|
40
|
+
default:
|
|
41
|
+
return;
|
|
42
42
|
}
|
|
43
|
+
};
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type={type === "danger" ? "error" : type}
|
|
50
|
-
data-qa-alert={""}
|
|
51
|
-
data-qa-alert-type={type}
|
|
52
|
-
data-qa-alert-text={text}
|
|
53
|
-
// $FlowIssue - upgrade v0.112.0
|
|
54
|
-
{...rest}
|
|
55
|
-
>
|
|
56
|
-
<Box display="flex" alignItems="center" width={1}>
|
|
57
|
-
{this.getBannerIcon()}
|
|
58
|
-
{text}
|
|
59
|
-
</Box>
|
|
60
|
-
</Container>
|
|
45
|
+
const Banner = ({ type = "error", text, ...rest }: TypeProps) => {
|
|
46
|
+
const bannerType: EnumValidBannerType = type === "danger" ? "error" : type;
|
|
47
|
+
if (type === "danger") {
|
|
48
|
+
console.warn(
|
|
49
|
+
"Warning: The `danger` type has been deprecated on the Banner component. Please use `error` instead."
|
|
61
50
|
);
|
|
62
51
|
}
|
|
63
|
-
|
|
52
|
+
return (
|
|
53
|
+
<Container
|
|
54
|
+
type={bannerType}
|
|
55
|
+
data-qa-alert={""}
|
|
56
|
+
data-qa-alert-type={bannerType}
|
|
57
|
+
data-qa-alert-text={text}
|
|
58
|
+
// $FlowIssue - upgrade v0.112.0
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
<Box display="flex" alignItems="center" width={1}>
|
|
62
|
+
{getBannerIcon(bannerType)}
|
|
63
|
+
{text}
|
|
64
|
+
</Box>
|
|
65
|
+
</Container>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default Banner;
|
|
@@ -18,7 +18,7 @@ export const permutations = () => (
|
|
|
18
18
|
width="500px"
|
|
19
19
|
/>
|
|
20
20
|
<Banner text={text("Info", "Info message")} type="info" width="500px" />
|
|
21
|
-
<Banner text={text("Error", "Error message")} type="
|
|
21
|
+
<Banner text={text("Error", "Error message")} type="error" width="500px" />
|
|
22
22
|
<Banner
|
|
23
23
|
text={text("Warning", "Warning message")}
|
|
24
24
|
type="warning"
|
|
@@ -45,7 +45,7 @@ export const Info = () => (
|
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
export const Error = () => (
|
|
48
|
-
<Banner text={text("text", "Error message")} type="
|
|
48
|
+
<Banner text={text("text", "Error message")} type="error" />
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
export const Warning = () => (
|
|
@@ -21,7 +21,16 @@ describe("Banner", () => {
|
|
|
21
21
|
expect(getByDataQaLabel({ icon: "info-white" })).toBeTruthy();
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it("should render with
|
|
24
|
+
it("should render with error type", () => {
|
|
25
|
+
const { getByText, getByDataQaLabel } = render(
|
|
26
|
+
<Banner text="Banner Text" type="error" />
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(getByText("Banner Text")).toBeTruthy();
|
|
30
|
+
expect(getByDataQaLabel({ icon: "triangle" })).toBeTruthy();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should render with deprecated danger type", () => {
|
|
25
34
|
const { getByText, getByDataQaLabel } = render(
|
|
26
35
|
<Banner text="Banner Text" type="danger" />
|
|
27
36
|
);
|
|
@@ -44,6 +44,7 @@ const colors = {
|
|
|
44
44
|
error: red.background,
|
|
45
45
|
info: blue.background,
|
|
46
46
|
opportunity: purple.background,
|
|
47
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
47
48
|
danger: red.background,
|
|
48
49
|
decorative: {
|
|
49
50
|
green: green.background,
|
|
@@ -68,6 +69,7 @@ const colors = {
|
|
|
68
69
|
success: green.highlight,
|
|
69
70
|
warning: yellow.highlight,
|
|
70
71
|
error: red.highlight,
|
|
72
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
71
73
|
danger: red.highlight,
|
|
72
74
|
info: blue.highlight,
|
|
73
75
|
opportunity: purple.highlight,
|
|
@@ -191,6 +193,7 @@ const colors = {
|
|
|
191
193
|
success: green.foreground,
|
|
192
194
|
warning: yellow.foreground,
|
|
193
195
|
error: red.foreground,
|
|
196
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
194
197
|
danger: red.foreground,
|
|
195
198
|
info: blue.foreground,
|
|
196
199
|
opportunity: purple.foreground,
|
|
@@ -45,6 +45,7 @@ const colors = {
|
|
|
45
45
|
error: red.background,
|
|
46
46
|
info: blue.background,
|
|
47
47
|
opportunity: purple.background,
|
|
48
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
48
49
|
danger: red.background,
|
|
49
50
|
decorative: {
|
|
50
51
|
green: green.background,
|
|
@@ -69,6 +70,7 @@ const colors = {
|
|
|
69
70
|
success: green.highlight,
|
|
70
71
|
warning: yellow.highlight,
|
|
71
72
|
error: red.highlight,
|
|
73
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
72
74
|
danger: red.highlight,
|
|
73
75
|
info: blue.highlight,
|
|
74
76
|
opportunity: purple.highlight,
|
|
@@ -192,6 +194,7 @@ const colors = {
|
|
|
192
194
|
success: green.foreground,
|
|
193
195
|
warning: yellow.foreground,
|
|
194
196
|
error: red.foreground,
|
|
197
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
195
198
|
danger: red.foreground,
|
|
196
199
|
info: blue.foreground,
|
|
197
200
|
opportunity: purple.foreground,
|
|
@@ -20,6 +20,7 @@ type TypeContainerColors = {|
|
|
|
20
20
|
error: string,
|
|
21
21
|
info: string,
|
|
22
22
|
opportunity: string,
|
|
23
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
23
24
|
danger: string,
|
|
24
25
|
decorative: {
|
|
25
26
|
green: string,
|
|
@@ -44,6 +45,7 @@ type TypeContainerColors = {|
|
|
|
44
45
|
success: string,
|
|
45
46
|
warning: string,
|
|
46
47
|
error: string,
|
|
48
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
47
49
|
danger: string,
|
|
48
50
|
info: string,
|
|
49
51
|
opportunity: string,
|
|
@@ -179,6 +181,7 @@ type TypeIconColors = {|
|
|
|
179
181
|
success: string,
|
|
180
182
|
warning: string,
|
|
181
183
|
error: string,
|
|
184
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
182
185
|
danger: string,
|
|
183
186
|
info: string,
|
|
184
187
|
opportunity: string,
|
package/commonjs/Banner/index.js
CHANGED
|
@@ -23,86 +23,72 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
23
23
|
|
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
var getBannerIcon = function getBannerIcon(type) {
|
|
27
|
+
switch (type) {
|
|
28
|
+
case "success":
|
|
29
|
+
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
30
|
+
name: "circle-check-no-fill",
|
|
31
|
+
className: "Icon",
|
|
32
|
+
fixedWidth: true
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
case "info":
|
|
36
|
+
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
37
|
+
name: "info-white",
|
|
38
|
+
className: "Icon",
|
|
39
|
+
fixedWidth: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
case "error":
|
|
43
|
+
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
44
|
+
name: "triangle",
|
|
45
|
+
className: "Icon",
|
|
46
|
+
fixedWidth: true
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
case "warning":
|
|
50
|
+
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
51
|
+
name: "triangle",
|
|
52
|
+
className: "Icon",
|
|
53
|
+
fixedWidth: true
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
case "opportunity":
|
|
57
|
+
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
58
|
+
name: "sparkles",
|
|
59
|
+
className: "Icon",
|
|
60
|
+
fixedWidth: true
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
default:
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
27
67
|
|
|
28
|
-
|
|
68
|
+
var Banner = function Banner(_ref) {
|
|
69
|
+
var _ref$type = _ref.type,
|
|
70
|
+
type = _ref$type === void 0 ? "error" : _ref$type,
|
|
71
|
+
text = _ref.text,
|
|
72
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
73
|
|
|
30
|
-
var
|
|
31
|
-
_inheritsLoose(Banner, _React$Component);
|
|
74
|
+
var bannerType = type === "danger" ? "error" : type;
|
|
32
75
|
|
|
33
|
-
|
|
34
|
-
|
|
76
|
+
if (type === "danger") {
|
|
77
|
+
console.warn("Warning: The `danger` type has been deprecated on the Banner component. Please use `error` instead.");
|
|
35
78
|
}
|
|
36
79
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fixedWidth: true
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
case "danger":
|
|
56
|
-
case "error":
|
|
57
|
-
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
58
|
-
name: "triangle",
|
|
59
|
-
className: "Icon",
|
|
60
|
-
fixedWidth: true
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
case "warning":
|
|
64
|
-
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
65
|
-
name: "triangle",
|
|
66
|
-
className: "Icon",
|
|
67
|
-
fixedWidth: true
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
case "opportunity":
|
|
71
|
-
return /*#__PURE__*/React.createElement(_Icon.default, {
|
|
72
|
-
name: "sparkles",
|
|
73
|
-
className: "Icon",
|
|
74
|
-
fixedWidth: true
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
default:
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
_proto.render = function render() {
|
|
83
|
-
var _this$props = this.props,
|
|
84
|
-
type = _this$props.type,
|
|
85
|
-
text = _this$props.text,
|
|
86
|
-
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
87
|
-
|
|
88
|
-
return /*#__PURE__*/React.createElement(_styles.default // danger needs to be properly deprecated and removed DS-1094
|
|
89
|
-
, _extends({
|
|
90
|
-
type: type === "danger" ? "error" : type,
|
|
91
|
-
"data-qa-alert": "",
|
|
92
|
-
"data-qa-alert-type": type,
|
|
93
|
-
"data-qa-alert-text": text // $FlowIssue - upgrade v0.112.0
|
|
94
|
-
|
|
95
|
-
}, rest), /*#__PURE__*/React.createElement(_Box.default, {
|
|
96
|
-
display: "flex",
|
|
97
|
-
alignItems: "center",
|
|
98
|
-
width: 1
|
|
99
|
-
}, this.getBannerIcon(), text));
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return Banner;
|
|
103
|
-
}(React.Component);
|
|
104
|
-
|
|
105
|
-
exports.default = Banner;
|
|
106
|
-
Banner.defaultProps = {
|
|
107
|
-
type: "danger"
|
|
108
|
-
};
|
|
80
|
+
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
81
|
+
type: bannerType,
|
|
82
|
+
"data-qa-alert": "",
|
|
83
|
+
"data-qa-alert-type": bannerType,
|
|
84
|
+
"data-qa-alert-text": text // $FlowIssue - upgrade v0.112.0
|
|
85
|
+
|
|
86
|
+
}, rest), /*#__PURE__*/React.createElement(_Box.default, {
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
width: 1
|
|
90
|
+
}, getBannerIcon(bannerType), text));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var _default = Banner;
|
|
94
|
+
exports.default = _default;
|
|
@@ -42,6 +42,8 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
42
42
|
error: _decorativePalettes.red.background,
|
|
43
43
|
info: _decorativePalettes.blue.background,
|
|
44
44
|
opportunity: _decorativePalettes.purple.background,
|
|
45
|
+
|
|
46
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
45
47
|
danger: _decorativePalettes.red.background,
|
|
46
48
|
decorative: {
|
|
47
49
|
green: _decorativePalettes.green.background,
|
|
@@ -66,6 +68,8 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
66
68
|
success: _decorativePalettes.green.highlight,
|
|
67
69
|
warning: _decorativePalettes.yellow.highlight,
|
|
68
70
|
error: _decorativePalettes.red.highlight,
|
|
71
|
+
|
|
72
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
69
73
|
danger: _decorativePalettes.red.highlight,
|
|
70
74
|
info: _decorativePalettes.blue.highlight,
|
|
71
75
|
opportunity: _decorativePalettes.purple.highlight,
|
|
@@ -189,6 +193,8 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
189
193
|
success: _decorativePalettes.green.foreground,
|
|
190
194
|
warning: _decorativePalettes.yellow.foreground,
|
|
191
195
|
error: _decorativePalettes.red.foreground,
|
|
196
|
+
|
|
197
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
192
198
|
danger: _decorativePalettes.red.foreground,
|
|
193
199
|
info: _decorativePalettes.blue.foreground,
|
|
194
200
|
opportunity: _decorativePalettes.purple.foreground,
|
|
@@ -47,6 +47,8 @@ var colors = _extends({
|
|
|
47
47
|
error: _decorativePalettes.red.background,
|
|
48
48
|
info: _decorativePalettes.blue.background,
|
|
49
49
|
opportunity: _decorativePalettes.purple.background,
|
|
50
|
+
|
|
51
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
50
52
|
danger: _decorativePalettes.red.background,
|
|
51
53
|
decorative: {
|
|
52
54
|
green: _decorativePalettes.green.background,
|
|
@@ -71,6 +73,8 @@ var colors = _extends({
|
|
|
71
73
|
success: _decorativePalettes.green.highlight,
|
|
72
74
|
warning: _decorativePalettes.yellow.highlight,
|
|
73
75
|
error: _decorativePalettes.red.highlight,
|
|
76
|
+
|
|
77
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
74
78
|
danger: _decorativePalettes.red.highlight,
|
|
75
79
|
info: _decorativePalettes.blue.highlight,
|
|
76
80
|
opportunity: _decorativePalettes.purple.highlight,
|
|
@@ -194,6 +198,8 @@ var colors = _extends({
|
|
|
194
198
|
success: _decorativePalettes.green.foreground,
|
|
195
199
|
warning: _decorativePalettes.yellow.foreground,
|
|
196
200
|
error: _decorativePalettes.red.foreground,
|
|
201
|
+
|
|
202
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
197
203
|
danger: _decorativePalettes.red.foreground,
|
|
198
204
|
info: _decorativePalettes.blue.foreground,
|
|
199
205
|
opportunity: _decorativePalettes.purple.foreground,
|
package/lib/Banner/index.js
CHANGED
|
@@ -4,91 +4,80 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
7
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
-
|
|
11
7
|
import * as React from "react";
|
|
12
8
|
import Icon from "../Icon";
|
|
13
9
|
import Container from "./styles";
|
|
14
10
|
import Box from "../Box";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
* Use banner type "error" instead of "danger"
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var getBannerIcon = function getBannerIcon(type) {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "success":
|
|
19
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
20
|
+
name: "circle-check-no-fill",
|
|
21
|
+
className: "Icon",
|
|
22
|
+
fixedWidth: true
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
case "info":
|
|
26
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
27
|
+
name: "info-white",
|
|
28
|
+
className: "Icon",
|
|
29
|
+
fixedWidth: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
case "error":
|
|
33
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
name: "triangle",
|
|
35
|
+
className: "Icon",
|
|
36
|
+
fixedWidth: true
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
case "warning":
|
|
40
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
41
|
+
name: "triangle",
|
|
42
|
+
className: "Icon",
|
|
43
|
+
fixedWidth: true
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
case "opportunity":
|
|
47
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
48
|
+
name: "sparkles",
|
|
49
|
+
className: "Icon",
|
|
50
|
+
fixedWidth: true
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
default:
|
|
54
|
+
return;
|
|
21
55
|
}
|
|
56
|
+
};
|
|
22
57
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
29
|
-
name: "circle-check-no-fill",
|
|
30
|
-
className: "Icon",
|
|
31
|
-
fixedWidth: true
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
case "info":
|
|
35
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
36
|
-
name: "info-white",
|
|
37
|
-
className: "Icon",
|
|
38
|
-
fixedWidth: true
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
case "danger":
|
|
42
|
-
case "error":
|
|
43
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
44
|
-
name: "triangle",
|
|
45
|
-
className: "Icon",
|
|
46
|
-
fixedWidth: true
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
case "warning":
|
|
50
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
51
|
-
name: "triangle",
|
|
52
|
-
className: "Icon",
|
|
53
|
-
fixedWidth: true
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
case "opportunity":
|
|
57
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
58
|
-
name: "sparkles",
|
|
59
|
-
className: "Icon",
|
|
60
|
-
fixedWidth: true
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
default:
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
_proto.render = function render() {
|
|
69
|
-
var _this$props = this.props,
|
|
70
|
-
type = _this$props.type,
|
|
71
|
-
text = _this$props.text,
|
|
72
|
-
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
73
|
-
|
|
74
|
-
return /*#__PURE__*/React.createElement(Container // danger needs to be properly deprecated and removed DS-1094
|
|
75
|
-
, _extends({
|
|
76
|
-
type: type === "danger" ? "error" : type,
|
|
77
|
-
"data-qa-alert": "",
|
|
78
|
-
"data-qa-alert-type": type,
|
|
79
|
-
"data-qa-alert-text": text // $FlowIssue - upgrade v0.112.0
|
|
58
|
+
var Banner = function Banner(_ref) {
|
|
59
|
+
var _ref$type = _ref.type,
|
|
60
|
+
type = _ref$type === void 0 ? "error" : _ref$type,
|
|
61
|
+
text = _ref.text,
|
|
62
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
80
63
|
|
|
81
|
-
|
|
82
|
-
display: "flex",
|
|
83
|
-
alignItems: "center",
|
|
84
|
-
width: 1
|
|
85
|
-
}, this.getBannerIcon(), text));
|
|
86
|
-
};
|
|
64
|
+
var bannerType = type === "danger" ? "error" : type;
|
|
87
65
|
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
if (type === "danger") {
|
|
67
|
+
console.warn("Warning: The `danger` type has been deprecated on the Banner component. Please use `error` instead.");
|
|
68
|
+
}
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
71
|
+
type: bannerType,
|
|
72
|
+
"data-qa-alert": "",
|
|
73
|
+
"data-qa-alert-type": bannerType,
|
|
74
|
+
"data-qa-alert-text": text // $FlowIssue - upgrade v0.112.0
|
|
75
|
+
|
|
76
|
+
}, rest), /*#__PURE__*/React.createElement(Box, {
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
width: 1
|
|
80
|
+
}, getBannerIcon(bannerType), text));
|
|
93
81
|
};
|
|
94
|
-
|
|
82
|
+
|
|
83
|
+
export default Banner;
|
package/lib/themes/dark/theme.js
CHANGED
|
@@ -27,6 +27,8 @@ var colors = _extends({}, lightTheme.colors, {
|
|
|
27
27
|
error: red.background,
|
|
28
28
|
info: blue.background,
|
|
29
29
|
opportunity: purple.background,
|
|
30
|
+
|
|
31
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
30
32
|
danger: red.background,
|
|
31
33
|
decorative: {
|
|
32
34
|
green: green.background,
|
|
@@ -51,6 +53,8 @@ var colors = _extends({}, lightTheme.colors, {
|
|
|
51
53
|
success: green.highlight,
|
|
52
54
|
warning: yellow.highlight,
|
|
53
55
|
error: red.highlight,
|
|
56
|
+
|
|
57
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
54
58
|
danger: red.highlight,
|
|
55
59
|
info: blue.highlight,
|
|
56
60
|
opportunity: purple.highlight,
|
|
@@ -174,6 +178,8 @@ var colors = _extends({}, lightTheme.colors, {
|
|
|
174
178
|
success: green.foreground,
|
|
175
179
|
warning: yellow.foreground,
|
|
176
180
|
error: red.foreground,
|
|
181
|
+
|
|
182
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
177
183
|
danger: red.foreground,
|
|
178
184
|
info: blue.foreground,
|
|
179
185
|
opportunity: purple.foreground,
|
|
@@ -28,6 +28,8 @@ var colors = _extends({
|
|
|
28
28
|
error: red.background,
|
|
29
29
|
info: blue.background,
|
|
30
30
|
opportunity: purple.background,
|
|
31
|
+
|
|
32
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
31
33
|
danger: red.background,
|
|
32
34
|
decorative: {
|
|
33
35
|
green: green.background,
|
|
@@ -52,6 +54,8 @@ var colors = _extends({
|
|
|
52
54
|
success: green.highlight,
|
|
53
55
|
warning: yellow.highlight,
|
|
54
56
|
error: red.highlight,
|
|
57
|
+
|
|
58
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
55
59
|
danger: red.highlight,
|
|
56
60
|
info: blue.highlight,
|
|
57
61
|
opportunity: purple.highlight,
|
|
@@ -175,6 +179,8 @@ var colors = _extends({
|
|
|
175
179
|
success: green.foreground,
|
|
176
180
|
warning: yellow.foreground,
|
|
177
181
|
error: red.foreground,
|
|
182
|
+
|
|
183
|
+
/** @deprecated Use "error" instead of "danger" */
|
|
178
184
|
danger: red.foreground,
|
|
179
185
|
info: blue.foreground,
|
|
180
186
|
opportunity: purple.foreground,
|