carbon-react 105.0.2 → 105.1.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.
@@ -78,7 +78,7 @@ const Button = ({
78
78
  if (!deprecatedWarnTriggered && as) {
79
79
  deprecatedWarnTriggered = true;
80
80
  Logger.deprecate( // eslint-disable-next-line max-len
81
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
81
+ "The `as` prop is deprecated and will soon be removed from the `Button` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
82
82
  }
83
83
 
84
84
  const [internalRef, setInternalRef] = useState(null);
@@ -27,7 +27,7 @@ const MultiActionButton = ({
27
27
  if (!deprecatedWarnTriggered && as) {
28
28
  deprecatedWarnTriggered = true;
29
29
  Logger.deprecate( // eslint-disable-next-line max-len
30
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
30
+ "The `as` prop is deprecated and will soon be removed from the `MultiActionButton` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
31
31
  }
32
32
 
33
33
  const ref = useRef();
@@ -37,7 +37,7 @@ const SplitButton = ({
37
37
  if (!deprecatedWarnTriggered && as) {
38
38
  deprecatedWarnTriggered = true;
39
39
  Logger.deprecate( // eslint-disable-next-line max-len
40
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
40
+ "The `as` prop is deprecated and will soon be removed from the `SplitButton` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
41
41
  }
42
42
 
43
43
  const theme = useContext(ThemeContext) || baseTheme;
@@ -1,7 +1,8 @@
1
1
  export default Tile;
2
- declare function Tile({ as, p, children, orientation, width, ...props }: {
2
+ declare function Tile({ as, variant, p, children, orientation, width, ...props }: {
3
3
  [x: string]: any;
4
- as?: string | undefined;
4
+ as: any;
5
+ variant?: string | undefined;
5
6
  p?: number | undefined;
6
7
  children: any;
7
8
  orientation?: string | undefined;
@@ -4,15 +4,24 @@ import React from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import propTypes from "@styled-system/prop-types";
6
6
  import { StyledTile, TileContent } from "./tile.style.js";
7
+ import Logger from "../../__internal__/utils/logger";
8
+ let deprecatedWarnTriggered = false;
7
9
 
8
10
  const Tile = ({
9
- as = "tile",
11
+ as,
12
+ variant = "tile",
10
13
  p = 3,
11
14
  children,
12
15
  orientation = "horizontal",
13
16
  width,
14
17
  ...props
15
18
  }) => {
19
+ if (!deprecatedWarnTriggered && as) {
20
+ deprecatedWarnTriggered = true;
21
+ Logger.deprecate( // eslint-disable-next-line max-len
22
+ "The `as` prop is deprecated and will soon be removed from the `Tile` component interface. You should use the `variant` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
23
+ }
24
+
16
25
  const isHorizontal = () => orientation === "horizontal";
17
26
 
18
27
  const isVertical = () => orientation === "vertical";
@@ -41,7 +50,7 @@ const Tile = ({
41
50
  }), /*#__PURE__*/React.cloneElement(child, childProps));
42
51
  });
43
52
  return /*#__PURE__*/React.createElement(StyledTile, _extends({
44
- tileTheme: as,
53
+ tileTheme: as || variant,
45
54
  width: width,
46
55
  "data-component": "tile",
47
56
  isHorizontal: isHorizontal(orientation),
@@ -56,6 +65,9 @@ Tile.propTypes = {
56
65
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
57
66
  as: PropTypes.oneOf(["tile", "transparent"]),
58
67
 
68
+ /** Sets the theme of the tile - either 'tile' or 'transparent' */
69
+ variant: PropTypes.oneOf(["tile", "transparent"]),
70
+
59
71
  /**
60
72
  * The content to render within the tile. Each child will be wrapped with
61
73
  * a TileContent wrapper, which allows any individual child component to take a
@@ -4,6 +4,8 @@ import { SpaceProps } from "styled-system";
4
4
  export interface TileProps extends SpaceProps {
5
5
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
6
6
  as?: "tile" | "transparent";
7
+ /** Sets the theme of the tile - either 'tile' or 'transparent' */
8
+ variant?: "tile" | "transparent";
7
9
  /**
8
10
  * The content to render within the tile. Each child will be wrapped with
9
11
  * a TileContent wrapper, which allows any individual child component to take a
@@ -1,7 +1,7 @@
1
1
  export default Toast;
2
2
  declare function Toast({ as, children, className, id, isCenter, maxWidth, onDismiss, open, targetPortalId, timeout, variant, ...restProps }: {
3
3
  [x: string]: any;
4
- as?: string | undefined;
4
+ as: any;
5
5
  children: any;
6
6
  className: any;
7
7
  id: any;
@@ -11,9 +11,11 @@ import IconButton from "../icon-button";
11
11
  import ModalManager from "../modal/__internal__/modal-manager";
12
12
  import Events from "../../__internal__/utils/helpers/events";
13
13
  import useLocale from "../../hooks/__internal__/useLocale";
14
+ import Logger from "../../__internal__/utils/logger";
15
+ let deprecatedWarnTriggered = false;
14
16
 
15
17
  const Toast = ({
16
- as = "success",
18
+ as,
17
19
  children,
18
20
  className,
19
21
  id,
@@ -26,6 +28,12 @@ const Toast = ({
26
28
  variant,
27
29
  ...restProps
28
30
  }) => {
31
+ if (!deprecatedWarnTriggered && as) {
32
+ deprecatedWarnTriggered = true;
33
+ Logger.deprecate( // eslint-disable-next-line max-len
34
+ "The `as` prop is deprecated and will soon be removed from the `Toast` component interface. You should use the `variant` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
35
+ }
36
+
29
37
  const locale = useLocale();
30
38
  const toastRef = useRef();
31
39
  const timer = useRef();
@@ -74,7 +82,7 @@ const Toast = ({
74
82
  if (!open) return null;
75
83
  const toastProps = {
76
84
  isCenter,
77
- variant: variant || as,
85
+ variant: variant || as || "success",
78
86
  id,
79
87
  maxWidth
80
88
  };
@@ -99,7 +99,7 @@ const Button = ({
99
99
  deprecatedWarnTriggered = true;
100
100
 
101
101
  _logger.default.deprecate( // eslint-disable-next-line max-len
102
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
102
+ "The `as` prop is deprecated and will soon be removed from the `Button` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
103
103
  }
104
104
 
105
105
  const [internalRef, setInternalRef] = (0, _react.useState)(null);
@@ -51,7 +51,7 @@ const MultiActionButton = ({
51
51
  deprecatedWarnTriggered = true;
52
52
 
53
53
  _logger.default.deprecate( // eslint-disable-next-line max-len
54
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
54
+ "The `as` prop is deprecated and will soon be removed from the `MultiActionButton` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
55
55
  }
56
56
 
57
57
  const ref = (0, _react.useRef)();
@@ -67,7 +67,7 @@ const SplitButton = ({
67
67
  deprecatedWarnTriggered = true;
68
68
 
69
69
  _logger.default.deprecate( // eslint-disable-next-line max-len
70
- "The `as` prop is deprecated and will soon be removed. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
70
+ "The `as` prop is deprecated and will soon be removed from the `SplitButton` component interface. You should use the `buttonType` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
71
71
  }
72
72
 
73
73
  const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _themes.baseTheme;
@@ -1,7 +1,8 @@
1
1
  export default Tile;
2
- declare function Tile({ as, p, children, orientation, width, ...props }: {
2
+ declare function Tile({ as, variant, p, children, orientation, width, ...props }: {
3
3
  [x: string]: any;
4
- as?: string | undefined;
4
+ as: any;
5
+ variant?: string | undefined;
5
6
  p?: number | undefined;
6
7
  children: any;
7
8
  orientation?: string | undefined;
@@ -13,18 +13,30 @@ var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
13
13
 
14
14
  var _tileStyle = require("./tile.style.js");
15
15
 
16
+ var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
21
 
22
+ let deprecatedWarnTriggered = false;
23
+
20
24
  const Tile = ({
21
- as = "tile",
25
+ as,
26
+ variant = "tile",
22
27
  p = 3,
23
28
  children,
24
29
  orientation = "horizontal",
25
30
  width,
26
31
  ...props
27
32
  }) => {
33
+ if (!deprecatedWarnTriggered && as) {
34
+ deprecatedWarnTriggered = true;
35
+
36
+ _logger.default.deprecate( // eslint-disable-next-line max-len
37
+ "The `as` prop is deprecated and will soon be removed from the `Tile` component interface. You should use the `variant` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
38
+ }
39
+
28
40
  const isHorizontal = () => orientation === "horizontal";
29
41
 
30
42
  const isVertical = () => orientation === "vertical";
@@ -54,7 +66,7 @@ const Tile = ({
54
66
  });
55
67
 
56
68
  return /*#__PURE__*/_react.default.createElement(_tileStyle.StyledTile, _extends({
57
- tileTheme: as,
69
+ tileTheme: as || variant,
58
70
  width: width,
59
71
  "data-component": "tile",
60
72
  isHorizontal: isHorizontal(orientation),
@@ -69,6 +81,9 @@ Tile.propTypes = {
69
81
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
70
82
  as: _propTypes.default.oneOf(["tile", "transparent"]),
71
83
 
84
+ /** Sets the theme of the tile - either 'tile' or 'transparent' */
85
+ variant: _propTypes.default.oneOf(["tile", "transparent"]),
86
+
72
87
  /**
73
88
  * The content to render within the tile. Each child will be wrapped with
74
89
  * a TileContent wrapper, which allows any individual child component to take a
@@ -4,6 +4,8 @@ import { SpaceProps } from "styled-system";
4
4
  export interface TileProps extends SpaceProps {
5
5
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
6
6
  as?: "tile" | "transparent";
7
+ /** Sets the theme of the tile - either 'tile' or 'transparent' */
8
+ variant?: "tile" | "transparent";
7
9
  /**
8
10
  * The content to render within the tile. Each child will be wrapped with
9
11
  * a TileContent wrapper, which allows any individual child component to take a
@@ -1,7 +1,7 @@
1
1
  export default Toast;
2
2
  declare function Toast({ as, children, className, id, isCenter, maxWidth, onDismiss, open, targetPortalId, timeout, variant, ...restProps }: {
3
3
  [x: string]: any;
4
- as?: string | undefined;
4
+ as: any;
5
5
  children: any;
6
6
  className: any;
7
7
  id: any;
@@ -27,6 +27,8 @@ var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/e
27
27
 
28
28
  var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
29
29
 
30
+ var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
31
+
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
32
34
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -35,8 +37,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
35
37
 
36
38
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
39
 
40
+ let deprecatedWarnTriggered = false;
41
+
38
42
  const Toast = ({
39
- as = "success",
43
+ as,
40
44
  children,
41
45
  className,
42
46
  id,
@@ -49,6 +53,13 @@ const Toast = ({
49
53
  variant,
50
54
  ...restProps
51
55
  }) => {
56
+ if (!deprecatedWarnTriggered && as) {
57
+ deprecatedWarnTriggered = true;
58
+
59
+ _logger.default.deprecate( // eslint-disable-next-line max-len
60
+ "The `as` prop is deprecated and will soon be removed from the `Toast` component interface. You should use the `variant` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
61
+ }
62
+
52
63
  const locale = (0, _useLocale.default)();
53
64
  const toastRef = (0, _react.useRef)();
54
65
  const timer = (0, _react.useRef)();
@@ -100,7 +111,7 @@ const Toast = ({
100
111
  if (!open) return null;
101
112
  const toastProps = {
102
113
  isCenter,
103
- variant: variant || as,
114
+ variant: variant || as || "success",
104
115
  id,
105
116
  maxWidth
106
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "105.0.2",
3
+ "version": "105.1.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {