carbon-react 111.0.3 → 111.2.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.
@@ -10,6 +10,7 @@ const StyledFullScreenHeading = styled.div`
10
10
  }) => hasContent && css`
11
11
  border-bottom: 1px solid var(--colorsUtilityMajor050);
12
12
  `}
13
+ background-color: var(--colorsUtilityYang100);
13
14
  display: flex;
14
15
  justify-content: space-between;
15
16
  align-items: flex-start;
@@ -120,6 +120,7 @@ const StyledDialog = styled.div`
120
120
  }
121
121
  `;
122
122
  const StyledDialogTitle = styled.div`
123
+ background-color: var(--colorsUtilityYang100);
123
124
  padding: 23px ${HORIZONTAL_PADDING}px 0;
124
125
  border-bottom: 1px solid #ccd6db;
125
126
  ${({
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
  const SidebarHeaderStyle = styled.div`
3
- background-color: var(--colorsUtilityMajor025);
3
+ background-color: var(--colorsUtilityYang100);
4
4
  box-shadow: inset 0 -1px 0 0 var(--colorsUtilityMajor100);
5
5
  box-sizing: border-box;
6
6
  width: 100%;
@@ -25,6 +25,7 @@ const Toast = /*#__PURE__*/React.forwardRef(({
25
25
  disableAutoFocus,
26
26
  ...restProps
27
27
  }, ref) => {
28
+ const isNotice = variant === "notice";
28
29
  const locale = useLocale();
29
30
  const toastRef = useRef();
30
31
  const timer = useRef();
@@ -94,7 +95,7 @@ const Toast = /*#__PURE__*/React.forwardRef(({
94
95
  };
95
96
  return /*#__PURE__*/React.createElement(CSSTransition, {
96
97
  enter: true,
97
- classNames: "toast",
98
+ classNames: isNotice ? "toast-alternative" : "toast",
98
99
  timeout: {
99
100
  appear: 1600,
100
101
  enter: 1500,
@@ -102,14 +103,16 @@ const Toast = /*#__PURE__*/React.forwardRef(({
102
103
  },
103
104
  nodeRef: toastContentNodeRef
104
105
  }, /*#__PURE__*/React.createElement(ToastStyle, _extends({
106
+ isNotice: isNotice,
105
107
  className: componentClasses
106
108
  }, tagComponent(restProps["data-component"] || "toast", restProps), toastProps, {
107
109
  ref: toastContentNodeRef
108
- }), /*#__PURE__*/React.createElement(TypeIcon, {
110
+ }), !isNotice && /*#__PURE__*/React.createElement(TypeIcon, {
109
111
  variant: toastProps.variant
110
112
  }, /*#__PURE__*/React.createElement(Icon, {
111
113
  type: toastProps.variant
112
114
  })), /*#__PURE__*/React.createElement(ToastContentStyle, {
115
+ isNotice: isNotice,
113
116
  variant: toastProps.variant,
114
117
  isDismiss: onDismiss
115
118
  }, children), renderCloseIcon()));
@@ -117,15 +120,17 @@ const Toast = /*#__PURE__*/React.forwardRef(({
117
120
 
118
121
  return /*#__PURE__*/React.createElement(StyledPortal, {
119
122
  id: targetPortalId,
120
- isCenter: isCenter
123
+ isCenter: isCenter,
124
+ isNotice: isNotice
121
125
  }, /*#__PURE__*/React.createElement(ToastWrapper, {
122
126
  isCenter: isCenter,
123
- ref: refToPass
127
+ ref: refToPass,
128
+ isNotice: isNotice
124
129
  }, /*#__PURE__*/React.createElement(TransitionGroup, null, renderToastContent())));
125
130
  });
126
131
  Toast.propTypes = {
127
132
  /** Customizes the appearance in the DLS theme */
128
- variant: PropTypes.oneOf(["error", "info", "success", "warning"]),
133
+ variant: PropTypes.oneOf(["error", "info", "success", "warning", "notice"]),
129
134
 
130
135
  /** Custom className */
131
136
  className: PropTypes.string,
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
 
3
- type ToastVariants = "error" | "info" | "success" | "warning";
3
+ type ToastVariants = "error" | "info" | "success" | "warning" | "notice";
4
4
 
5
5
  export interface ToastPropTypes {
6
6
  /** The rendered children of the component. */
@@ -5,6 +5,7 @@ import TypeIcon from "../message/type-icon/type-icon.style";
5
5
  import StyledIconButton from "../icon-button/icon-button.style";
6
6
  import Portal from "../portal/portal";
7
7
  import baseTheme from "../../style/themes/base";
8
+ import StyledIcon from "../icon/icon.style";
8
9
  const StyledPortal = styled(Portal)`
9
10
  ${({
10
11
  theme
@@ -20,12 +21,21 @@ const StyledPortal = styled(Portal)`
20
21
  margin-left: 50%;
21
22
  transform: translateX(-50%);
22
23
  `}
24
+
25
+ ${({
26
+ isNotice
27
+ }) => isNotice && css`
28
+ bottom: 0;
29
+ top: auto;
30
+ width: 100%;
31
+ `}
23
32
  `}
24
33
  `;
25
34
  StyledPortal.defaultProps = {
26
35
  theme: baseTheme
27
36
  };
28
37
  const animationName = ".toast";
38
+ const alternativeAnimationName = ".toast-alternative";
29
39
  const ToastStyle = styled(MessageStyle)`
30
40
  ${({
31
41
  maxWidth,
@@ -39,24 +49,23 @@ const ToastStyle = styled(MessageStyle)`
39
49
  position: relative;
40
50
  margin-right: ${isCenter ? "auto" : "30px"};
41
51
  `}
42
-
43
52
 
44
53
  &${animationName}-appear,
45
54
  &${animationName}-enter {
46
55
  opacity: 0;
47
- transform: scale(0.5)};
56
+ transform: scale(0.5);
48
57
  }
49
58
 
50
- &${animationName}-appear.toast-appear-active,
51
- &${animationName}-enter.toast-enter-active {
59
+ &${animationName}-appear${animationName}-appear-active,
60
+ &${animationName}-enter${animationName}-enter-active {
52
61
  opacity: 1;
53
62
  transform: ${({
54
63
  isCenter
55
64
  }) => isCenter ? " scale(1) translateY(0)" : "scale(1)"};
56
- transition: all 300ms cubic-bezier(0.250, 0.250, 0.000, 1.500);
65
+ transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
57
66
  }
58
67
 
59
- &${animationName}-exit.toast-exit-active {
68
+ &${animationName}-exit${animationName}-exit-active {
60
69
  opacity: 0;
61
70
  margin-top: -40px;
62
71
  transition: all 150ms ease-out;
@@ -68,14 +77,64 @@ const ToastStyle = styled(MessageStyle)`
68
77
  top: 50%;
69
78
  transform: translateY(-50%);
70
79
  }
80
+
81
+ ${({
82
+ isNotice
83
+ }) => isNotice && css`
84
+ background-color: var(--colorsUtilityMajor400);
85
+ border: none;
86
+ color: var(--colorsSemanticNeutralYang100);
87
+ margin-right: 0;
88
+ max-width: 100%;
89
+
90
+ ${StyledIconButton} {
91
+ right: 55px;
92
+ }
93
+
94
+ ${StyledIconButton} ${StyledIcon} {
95
+ color: var(--colorsSemanticNeutralYang100);
96
+ }
97
+
98
+ &${alternativeAnimationName}-appear, &${alternativeAnimationName}-enter {
99
+ bottom: -40px;
100
+ opacity: 0;
101
+ }
102
+
103
+ &${alternativeAnimationName}-exit {
104
+ bottom: 0;
105
+ opacity: 1;
106
+ }
107
+
108
+ &${alternativeAnimationName}-appear${alternativeAnimationName}-appear-active,
109
+ &${alternativeAnimationName}-enter${alternativeAnimationName}-enter-active {
110
+ bottom: 0;
111
+ opacity: 1;
112
+ transition: all 400ms ease;
113
+ }
114
+
115
+ &${alternativeAnimationName}-exit${alternativeAnimationName}-exit-active {
116
+ bottom: -40px;
117
+ opacity: 0;
118
+ transition: all 200ms ease;
119
+ }
120
+ `}
71
121
  `;
72
122
  const ToastContentStyle = styled(MessageContentStyle)`
73
123
  padding: 8px 16px 8px 16px;
74
124
 
75
125
  ${({
76
- isDismiss
126
+ isNotice
127
+ }) => isNotice && css`
128
+ display: flex;
129
+ align-items: center;
130
+ padding: 11px 40px;
131
+ `}
132
+
133
+ ${({
134
+ isDismiss,
135
+ isNotice
77
136
  }) => isDismiss && css`
78
- padding-right: 48px;
137
+ padding-right: ${isNotice ? "88px" : "48px"};
79
138
  `}
80
139
  `;
81
140
  const ToastWrapper = styled.div`
@@ -88,5 +147,11 @@ const ToastWrapper = styled.div`
88
147
  justify-content: center;
89
148
  display: flex;
90
149
  `}
150
+
151
+ ${({
152
+ isNotice
153
+ }) => isNotice && css`
154
+ display: block;
155
+ `}
91
156
  `;
92
157
  export { ToastStyle, TypeIcon, ToastContentStyle, ToastWrapper, StyledPortal };
@@ -24,6 +24,7 @@ const StyledFullScreenHeading = _styledComponents.default.div`
24
24
  }) => hasContent && (0, _styledComponents.css)`
25
25
  border-bottom: 1px solid var(--colorsUtilityMajor050);
26
26
  `}
27
+ background-color: var(--colorsUtilityYang100);
27
28
  display: flex;
28
29
  justify-content: space-between;
29
30
  align-items: flex-start;
@@ -141,6 +141,7 @@ const StyledDialog = _styledComponents.default.div`
141
141
  `;
142
142
  exports.StyledDialog = StyledDialog;
143
143
  const StyledDialogTitle = _styledComponents.default.div`
144
+ background-color: var(--colorsUtilityYang100);
144
145
  padding: 23px ${_dialog.HORIZONTAL_PADDING}px 0;
145
146
  border-bottom: 1px solid #ccd6db;
146
147
  ${({
@@ -10,7 +10,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  const SidebarHeaderStyle = _styledComponents.default.div`
13
- background-color: var(--colorsUtilityMajor025);
13
+ background-color: var(--colorsUtilityYang100);
14
14
  box-shadow: inset 0 -1px 0 0 var(--colorsUtilityMajor100);
15
15
  box-sizing: border-box;
16
16
  width: 100%;
@@ -49,6 +49,7 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
49
49
  disableAutoFocus,
50
50
  ...restProps
51
51
  }, ref) => {
52
+ const isNotice = variant === "notice";
52
53
  const locale = (0, _useLocale.default)();
53
54
  const toastRef = (0, _react.useRef)();
54
55
  const timer = (0, _react.useRef)();
@@ -118,7 +119,7 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
118
119
  };
119
120
  return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
120
121
  enter: true,
121
- classNames: "toast",
122
+ classNames: isNotice ? "toast-alternative" : "toast",
122
123
  timeout: {
123
124
  appear: 1600,
124
125
  enter: 1500,
@@ -126,14 +127,16 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
126
127
  },
127
128
  nodeRef: toastContentNodeRef
128
129
  }, /*#__PURE__*/_react.default.createElement(_toast.ToastStyle, _extends({
130
+ isNotice: isNotice,
129
131
  className: componentClasses
130
132
  }, (0, _tags.default)(restProps["data-component"] || "toast", restProps), toastProps, {
131
133
  ref: toastContentNodeRef
132
- }), /*#__PURE__*/_react.default.createElement(_toast.TypeIcon, {
134
+ }), !isNotice && /*#__PURE__*/_react.default.createElement(_toast.TypeIcon, {
133
135
  variant: toastProps.variant
134
136
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
135
137
  type: toastProps.variant
136
138
  })), /*#__PURE__*/_react.default.createElement(_toast.ToastContentStyle, {
139
+ isNotice: isNotice,
137
140
  variant: toastProps.variant,
138
141
  isDismiss: onDismiss
139
142
  }, children), renderCloseIcon()));
@@ -141,16 +144,18 @@ const Toast = /*#__PURE__*/_react.default.forwardRef(({
141
144
 
142
145
  return /*#__PURE__*/_react.default.createElement(_toast.StyledPortal, {
143
146
  id: targetPortalId,
144
- isCenter: isCenter
147
+ isCenter: isCenter,
148
+ isNotice: isNotice
145
149
  }, /*#__PURE__*/_react.default.createElement(_toast.ToastWrapper, {
146
150
  isCenter: isCenter,
147
- ref: refToPass
151
+ ref: refToPass,
152
+ isNotice: isNotice
148
153
  }, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, renderToastContent())));
149
154
  });
150
155
 
151
156
  Toast.propTypes = {
152
157
  /** Customizes the appearance in the DLS theme */
153
- variant: _propTypes.default.oneOf(["error", "info", "success", "warning"]),
158
+ variant: _propTypes.default.oneOf(["error", "info", "success", "warning", "notice"]),
154
159
 
155
160
  /** Custom className */
156
161
  className: _propTypes.default.string,
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
 
3
- type ToastVariants = "error" | "info" | "success" | "warning";
3
+ type ToastVariants = "error" | "info" | "success" | "warning" | "notice";
4
4
 
5
5
  export interface ToastPropTypes {
6
6
  /** The rendered children of the component. */
@@ -25,6 +25,8 @@ var _portal = _interopRequireDefault(require("../portal/portal"));
25
25
 
26
26
  var _base = _interopRequireDefault(require("../../style/themes/base"));
27
27
 
28
+ var _icon = _interopRequireDefault(require("../icon/icon.style"));
29
+
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
31
 
30
32
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -46,6 +48,14 @@ const StyledPortal = (0, _styledComponents.default)(_portal.default)`
46
48
  margin-left: 50%;
47
49
  transform: translateX(-50%);
48
50
  `}
51
+
52
+ ${({
53
+ isNotice
54
+ }) => isNotice && (0, _styledComponents.css)`
55
+ bottom: 0;
56
+ top: auto;
57
+ width: 100%;
58
+ `}
49
59
  `}
50
60
  `;
51
61
  exports.StyledPortal = StyledPortal;
@@ -53,6 +63,7 @@ StyledPortal.defaultProps = {
53
63
  theme: _base.default
54
64
  };
55
65
  const animationName = ".toast";
66
+ const alternativeAnimationName = ".toast-alternative";
56
67
  const ToastStyle = (0, _styledComponents.default)(_message.default)`
57
68
  ${({
58
69
  maxWidth,
@@ -66,24 +77,23 @@ const ToastStyle = (0, _styledComponents.default)(_message.default)`
66
77
  position: relative;
67
78
  margin-right: ${isCenter ? "auto" : "30px"};
68
79
  `}
69
-
70
80
 
71
81
  &${animationName}-appear,
72
82
  &${animationName}-enter {
73
83
  opacity: 0;
74
- transform: scale(0.5)};
84
+ transform: scale(0.5);
75
85
  }
76
86
 
77
- &${animationName}-appear.toast-appear-active,
78
- &${animationName}-enter.toast-enter-active {
87
+ &${animationName}-appear${animationName}-appear-active,
88
+ &${animationName}-enter${animationName}-enter-active {
79
89
  opacity: 1;
80
90
  transform: ${({
81
91
  isCenter
82
92
  }) => isCenter ? " scale(1) translateY(0)" : "scale(1)"};
83
- transition: all 300ms cubic-bezier(0.250, 0.250, 0.000, 1.500);
93
+ transition: all 300ms cubic-bezier(0.25, 0.25, 0, 1.5);
84
94
  }
85
95
 
86
- &${animationName}-exit.toast-exit-active {
96
+ &${animationName}-exit${animationName}-exit-active {
87
97
  opacity: 0;
88
98
  margin-top: -40px;
89
99
  transition: all 150ms ease-out;
@@ -95,15 +105,65 @@ const ToastStyle = (0, _styledComponents.default)(_message.default)`
95
105
  top: 50%;
96
106
  transform: translateY(-50%);
97
107
  }
108
+
109
+ ${({
110
+ isNotice
111
+ }) => isNotice && (0, _styledComponents.css)`
112
+ background-color: var(--colorsUtilityMajor400);
113
+ border: none;
114
+ color: var(--colorsSemanticNeutralYang100);
115
+ margin-right: 0;
116
+ max-width: 100%;
117
+
118
+ ${_iconButton.default} {
119
+ right: 55px;
120
+ }
121
+
122
+ ${_iconButton.default} ${_icon.default} {
123
+ color: var(--colorsSemanticNeutralYang100);
124
+ }
125
+
126
+ &${alternativeAnimationName}-appear, &${alternativeAnimationName}-enter {
127
+ bottom: -40px;
128
+ opacity: 0;
129
+ }
130
+
131
+ &${alternativeAnimationName}-exit {
132
+ bottom: 0;
133
+ opacity: 1;
134
+ }
135
+
136
+ &${alternativeAnimationName}-appear${alternativeAnimationName}-appear-active,
137
+ &${alternativeAnimationName}-enter${alternativeAnimationName}-enter-active {
138
+ bottom: 0;
139
+ opacity: 1;
140
+ transition: all 400ms ease;
141
+ }
142
+
143
+ &${alternativeAnimationName}-exit${alternativeAnimationName}-exit-active {
144
+ bottom: -40px;
145
+ opacity: 0;
146
+ transition: all 200ms ease;
147
+ }
148
+ `}
98
149
  `;
99
150
  exports.ToastStyle = ToastStyle;
100
151
  const ToastContentStyle = (0, _styledComponents.default)(_messageContent.default)`
101
152
  padding: 8px 16px 8px 16px;
102
153
 
103
154
  ${({
104
- isDismiss
155
+ isNotice
156
+ }) => isNotice && (0, _styledComponents.css)`
157
+ display: flex;
158
+ align-items: center;
159
+ padding: 11px 40px;
160
+ `}
161
+
162
+ ${({
163
+ isDismiss,
164
+ isNotice
105
165
  }) => isDismiss && (0, _styledComponents.css)`
106
- padding-right: 48px;
166
+ padding-right: ${isNotice ? "88px" : "48px"};
107
167
  `}
108
168
  `;
109
169
  exports.ToastContentStyle = ToastContentStyle;
@@ -117,5 +177,11 @@ const ToastWrapper = _styledComponents.default.div`
117
177
  justify-content: center;
118
178
  display: flex;
119
179
  `}
180
+
181
+ ${({
182
+ isNotice
183
+ }) => isNotice && (0, _styledComponents.css)`
184
+ display: block;
185
+ `}
120
186
  `;
121
187
  exports.ToastWrapper = ToastWrapper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "111.0.3",
3
+ "version": "111.2.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -109,7 +109,7 @@
109
109
  "core-js": "^3.20.3",
110
110
  "cross-env": "^5.2.0",
111
111
  "css-loader": "4.0.0",
112
- "cypress": "10.8.0",
112
+ "cypress": "10.9.0",
113
113
  "cypress-axe": "^1.0.0",
114
114
  "cypress-each": "^1.11.0",
115
115
  "cypress-plugin-tab": "^1.0.5",
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable no-console */
2
+ /* istanbul ignore file */
2
3
  const fetch = require("node-fetch");
3
4
  const dotenv = require("dotenv");
4
5
  const chalk = require("chalk");
@@ -9,7 +10,7 @@ dotenv.config();
9
10
  const majorVersion = version.split(".")[0];
10
11
 
11
12
  const checkCarbonVersion = () => {
12
- if (ci.BITRISE) {
13
+ if (ci.isCI && process.env.NODE_ENV !== "test") {
13
14
  return;
14
15
  }
15
16
 
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable no-console */
2
+ /* istanbul ignore file */
2
3
  const { Octokit } = require("@octokit/rest");
3
4
  const dotenv = require("dotenv");
4
5
  const chalk = require("chalk");
@@ -34,7 +35,7 @@ const getOpenRfcs = async () => {
34
35
  const getRfcTitle = (rfc) => rfc.title.split(": ")[1];
35
36
 
36
37
  const checkRfcs = async () => {
37
- if (ci.BITRISE) {
38
+ if (ci.isCI && process.env.NODE_ENV !== "test") {
38
39
  return;
39
40
  }
40
41