carbon-react 106.7.0 → 107.0.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.
Files changed (184) hide show
  1. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  2. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  3. package/esm/components/badge/badge.style.d.ts +1 -1
  4. package/esm/components/button/button.component.d.ts +1 -3
  5. package/esm/components/button/button.component.js +1 -12
  6. package/esm/components/button/button.style.d.ts +1 -1
  7. package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
  8. package/esm/components/confirm/confirm.component.d.ts +1 -5
  9. package/esm/components/confirm/confirm.component.js +2 -14
  10. package/esm/components/confirm/confirm.d.ts +0 -2
  11. package/esm/components/dialog-full-screen/content.style.js +4 -10
  12. package/esm/components/heading/heading.component.d.ts +27 -52
  13. package/esm/components/heading/heading.component.js +86 -170
  14. package/esm/components/heading/heading.d.ts +5 -3
  15. package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  16. package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
  17. package/esm/components/menu/index.d.ts +0 -1
  18. package/esm/components/menu/index.js +0 -1
  19. package/esm/components/menu/menu-item/menu-item.component.js +0 -6
  20. package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  21. package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
  22. package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  23. package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
  24. package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  25. package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
  26. package/esm/components/radio-button/radio-button-group.component.js +1 -1
  27. package/esm/components/select/select-list/select-list.component.js +2 -2
  28. package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
  29. package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
  30. package/esm/components/split-button/split-button.component.d.ts +1 -4
  31. package/esm/components/split-button/split-button.component.js +3 -16
  32. package/esm/components/split-button/split-button.d.ts +0 -2
  33. package/esm/components/tile/tile.component.d.ts +1 -2
  34. package/esm/components/tile/tile.component.js +1 -13
  35. package/esm/components/tile/tile.d.ts +0 -2
  36. package/esm/components/tile-select/tile-select-group.component.js +1 -1
  37. package/esm/components/toast/toast.component.d.ts +1 -4
  38. package/esm/components/toast/toast.component.js +1 -13
  39. package/esm/components/toast/toast.d.ts +0 -2
  40. package/esm/locales/en-gb.js +0 -9
  41. package/esm/locales/locale.d.ts +0 -9
  42. package/esm/locales/pl-pl.js +0 -9
  43. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  44. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  45. package/lib/components/badge/badge.style.d.ts +1 -1
  46. package/lib/components/button/button.component.d.ts +1 -3
  47. package/lib/components/button/button.component.js +1 -14
  48. package/lib/components/button/button.style.d.ts +1 -1
  49. package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
  50. package/lib/components/confirm/confirm.component.d.ts +1 -5
  51. package/lib/components/confirm/confirm.component.js +2 -17
  52. package/lib/components/confirm/confirm.d.ts +0 -2
  53. package/lib/components/dialog-full-screen/content.style.js +4 -10
  54. package/lib/components/heading/heading.component.d.ts +27 -52
  55. package/lib/components/heading/heading.component.js +86 -170
  56. package/lib/components/heading/heading.d.ts +5 -3
  57. package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  58. package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
  59. package/lib/components/menu/index.d.ts +0 -1
  60. package/lib/components/menu/index.js +0 -8
  61. package/lib/components/menu/menu-item/menu-item.component.js +0 -7
  62. package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  63. package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
  64. package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  65. package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
  66. package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  67. package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
  68. package/lib/components/radio-button/radio-button-group.component.js +1 -1
  69. package/lib/components/select/select-list/select-list.component.js +2 -2
  70. package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
  71. package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
  72. package/lib/components/split-button/split-button.component.d.ts +1 -4
  73. package/lib/components/split-button/split-button.component.js +3 -18
  74. package/lib/components/split-button/split-button.d.ts +0 -2
  75. package/lib/components/tile/tile.component.d.ts +1 -2
  76. package/lib/components/tile/tile.component.js +1 -16
  77. package/lib/components/tile/tile.d.ts +0 -2
  78. package/lib/components/tile-select/tile-select-group.component.js +1 -1
  79. package/lib/components/toast/toast.component.d.ts +1 -4
  80. package/lib/components/toast/toast.component.js +1 -16
  81. package/lib/components/toast/toast.d.ts +0 -2
  82. package/lib/locales/en-gb.js +0 -9
  83. package/lib/locales/locale.d.ts +0 -9
  84. package/lib/locales/pl-pl.js +0 -9
  85. package/package.json +1 -1
  86. package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  87. package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
  88. package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
  89. package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  90. package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
  91. package/esm/components/app-wrapper/index.d.ts +0 -1
  92. package/esm/components/app-wrapper/index.js +0 -1
  93. package/esm/components/menu/submenu-block/index.d.ts +0 -2
  94. package/esm/components/menu/submenu-block/index.js +0 -1
  95. package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  96. package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
  97. package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
  98. package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  99. package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
  100. package/esm/components/mount-in-app/__spec__.d.ts +0 -1
  101. package/esm/components/mount-in-app/__spec__.js +0 -47
  102. package/esm/components/mount-in-app/index.d.ts +0 -1
  103. package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
  104. package/esm/components/mount-in-app/mount-in-app.js +0 -90
  105. package/esm/components/mount-in-app/package.json +0 -3
  106. package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
  107. package/esm/components/multi-step-wizard/__spec__.js +0 -191
  108. package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  109. package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
  110. package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  111. package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
  112. package/esm/components/multi-step-wizard/package.json +0 -4
  113. package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  114. package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
  115. package/esm/components/multi-step-wizard/step/package.json +0 -4
  116. package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
  117. package/esm/components/multi-step-wizard/step/step.js +0 -407
  118. package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
  119. package/esm/components/multi-step-wizard/step/step.style.js +0 -138
  120. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  121. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
  122. package/esm/components/scrollable-list/index.d.ts +0 -4
  123. package/esm/components/scrollable-list/index.js +0 -4
  124. package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  125. package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
  126. package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  127. package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
  128. package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  129. package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
  130. package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  131. package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
  132. package/esm/components/scrollable-list/test-utils.d.ts +0 -2
  133. package/esm/components/scrollable-list/test-utils.js +0 -25
  134. package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  135. package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
  136. package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
  137. package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  138. package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
  139. package/lib/components/app-wrapper/index.d.ts +0 -1
  140. package/lib/components/app-wrapper/index.js +0 -15
  141. package/lib/components/app-wrapper/package.json +0 -6
  142. package/lib/components/menu/submenu-block/index.d.ts +0 -2
  143. package/lib/components/menu/submenu-block/index.js +0 -15
  144. package/lib/components/menu/submenu-block/package.json +0 -6
  145. package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  146. package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
  147. package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
  148. package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  149. package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
  150. package/lib/components/mount-in-app/__spec__.d.ts +0 -1
  151. package/lib/components/mount-in-app/__spec__.js +0 -55
  152. package/lib/components/mount-in-app/index.d.ts +0 -1
  153. package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
  154. package/lib/components/mount-in-app/mount-in-app.js +0 -105
  155. package/lib/components/mount-in-app/package.json +0 -3
  156. package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
  157. package/lib/components/multi-step-wizard/__spec__.js +0 -202
  158. package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  159. package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
  160. package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  161. package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
  162. package/lib/components/multi-step-wizard/package.json +0 -4
  163. package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  164. package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
  165. package/lib/components/multi-step-wizard/step/package.json +0 -4
  166. package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
  167. package/lib/components/multi-step-wizard/step/step.js +0 -421
  168. package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
  169. package/lib/components/multi-step-wizard/step/step.style.js +0 -162
  170. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  171. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
  172. package/lib/components/scrollable-list/index.d.ts +0 -4
  173. package/lib/components/scrollable-list/index.js +0 -31
  174. package/lib/components/scrollable-list/package.json +0 -6
  175. package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  176. package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
  177. package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  178. package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
  179. package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  180. package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
  181. package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  182. package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
  183. package/lib/components/scrollable-list/test-utils.d.ts +0 -2
  184. package/lib/components/scrollable-list/test-utils.js +0 -37
@@ -3,7 +3,7 @@ import Icon from "../icon";
3
3
  declare const StyledBadgeWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  declare const StyledCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  declare const StyledButton: import("styled-components").StyledComponent<{
6
- ({ size, subtext, as, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: import("../button").ButtonProps): JSX.Element;
6
+ ({ size, subtext, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: import("../button").ButtonProps): JSX.Element;
7
7
  displayName: string;
8
8
  }, any, {}, never>;
9
9
  declare const StyledCrossIcon: import("styled-components").StyledComponent<typeof Icon, any, {}, never>;
@@ -10,8 +10,6 @@ export interface ButtonProps extends SpaceProps {
10
10
  * This is required to comply with WCAG 4.1.2 - Buttons must have discernible text
11
11
  */
12
12
  "aria-label"?: string;
13
- /** [Legacy] Button types for legacy theme: "primary" | "secondary" */
14
- as?: ButtonTypes;
15
13
  /** Color variants for new business themes: "primary" | "secondary" | "tertiary" | "darkBackground" */
16
14
  buttonType?: ButtonTypes;
17
15
  /** The text the button displays */
@@ -60,7 +58,7 @@ export interface ButtonProps extends SpaceProps {
60
58
  rel?: string;
61
59
  }
62
60
  declare const Button: {
63
- ({ size, subtext, as, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: ButtonProps): JSX.Element;
61
+ ({ size, subtext, children, forwardRef, "aria-label": ariaLabel, disabled, destructive, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, fullWidth, ...rest }: ButtonProps): JSX.Element;
64
62
  displayName: string;
65
63
  };
66
64
  declare const ButtonWithForwardRef: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -7,7 +7,6 @@ import Icon from "../icon";
7
7
  import StyledButton, { StyledButtonSubtext } from "./button.style";
8
8
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
9
9
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
10
- import Logger from "../../__internal__/utils/logger";
11
10
 
12
11
  function renderChildren({
13
12
  /* eslint-disable react/prop-types */
@@ -74,12 +73,10 @@ renderChildren.propTypes = {
74
73
  }
75
74
  }
76
75
  };
77
- let deprecatedWarnTriggered = false;
78
76
 
79
77
  const Button = ({
80
78
  size = "medium",
81
79
  subtext = "",
82
- as,
83
80
  children,
84
81
  forwardRef,
85
82
  "aria-label": ariaLabel,
@@ -99,12 +96,6 @@ const Button = ({
99
96
  fullWidth = false,
100
97
  ...rest
101
98
  }) => {
102
- if (!deprecatedWarnTriggered && as) {
103
- deprecatedWarnTriggered = true;
104
- Logger.deprecate( // eslint-disable-next-line max-len
105
- "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");
106
- }
107
-
108
99
  invariant(!!(children || iconType), "Either prop `iconType` must be defined or this node must have children.");
109
100
 
110
101
  if (subtext) {
@@ -112,7 +103,7 @@ const Button = ({
112
103
  }
113
104
 
114
105
  const [internalRef, setInternalRef] = useState();
115
- const buttonType = as || buttonTypeProp;
106
+ const buttonType = buttonTypeProp;
116
107
  let paddingX;
117
108
 
118
109
  const handleLinkKeyDown = event => {
@@ -182,7 +173,6 @@ const Button = ({
182
173
 
183
174
  Button.propTypes = {
184
175
  "aria-label": PropTypes.string,
185
- "as": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
186
176
  "buttonType": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
187
177
  "children": PropTypes.node,
188
178
  "destructive": PropTypes.bool,
@@ -522,7 +512,6 @@ const ButtonWithForwardRef = /*#__PURE__*/React.forwardRef((props, ref) => /*#__
522
512
  }, props)));
523
513
  ButtonWithForwardRef.propTypes = {
524
514
  "aria-label": PropTypes.string,
525
- "as": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
526
515
  "buttonType": PropTypes.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
527
516
  "children": PropTypes.node,
528
517
  "destructive": PropTypes.bool,
@@ -1,6 +1,6 @@
1
1
  import { SpaceProps } from "styled-system";
2
2
  import { ButtonProps } from "./button.component";
3
- declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<ButtonProps, "as"> & {
3
+ declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & ButtonProps & {
4
4
  iconOnly?: boolean | undefined;
5
5
  }, never>;
6
6
  export declare const StyledButtonSubtext: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -6,7 +6,7 @@ import styledSystemPropTypes from "@styled-system/prop-types";
6
6
  import FormField from "../../__internal__/form-field";
7
7
  import ButtonToggleGroupStyle from "./button-toggle-group.style";
8
8
  import ButtonToggle from "../button-toggle";
9
- import RadioButtonMapper from "../radio-button/radio-button-mapper.component";
9
+ import RadioButtonMapper from "../../__internal__/radio-button-mapper/radio-button-mapper.component";
10
10
  import ValidationIcon from "../../__internal__/validations/validation-icon.component";
11
11
  import { InputGroupBehaviour } from "../../__internal__/input-behaviour";
12
12
  import { filterStyledSystemMarginProps } from "../../style/utils";
@@ -1,12 +1,11 @@
1
1
  export default Confirm;
2
- declare function Confirm({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, open, children, destructive, cancelButtonDestructive, confirmButtonDestructive, cancelButtonType, confirmButtonType, cancelButtonIconType, cancelButtonIconPosition, confirmButtonIconType, confirmButtonIconPosition, cancelLabel, onCancel, disableCancel, onConfirm, isLoadingConfirm, disableConfirm, confirmLabel, iconType, subtitle, title, ...rest }: {
2
+ declare function Confirm({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, open, children, cancelButtonDestructive, confirmButtonDestructive, cancelButtonType, confirmButtonType, cancelButtonIconType, cancelButtonIconPosition, confirmButtonIconType, confirmButtonIconPosition, cancelLabel, onCancel, disableCancel, onConfirm, isLoadingConfirm, disableConfirm, confirmLabel, iconType, subtitle, title, ...rest }: {
3
3
  [x: string]: any;
4
4
  "aria-labelledby": any;
5
5
  "aria-describedby": any;
6
6
  "aria-label": any;
7
7
  open: any;
8
8
  children: any;
9
- destructive: any;
10
9
  cancelButtonDestructive: any;
11
10
  confirmButtonDestructive: any;
12
11
  cancelButtonType: any;
@@ -30,7 +29,6 @@ declare namespace Confirm {
30
29
  namespace defaultProps {
31
30
  const size: string;
32
31
  const showCloseIcon: boolean;
33
- const destructive: boolean;
34
32
  const cancelButtonDestructive: boolean;
35
33
  const confirmButtonDestructive: boolean;
36
34
  const iconType: null;
@@ -81,8 +79,6 @@ declare namespace Confirm {
81
79
  confirmLabel: PropTypes.Requireable<string>;
82
80
  /** Customise the cancel button label */
83
81
  cancelLabel: PropTypes.Requireable<string>;
84
- /** Apply destructive style to the buttons */
85
- destructive: PropTypes.Requireable<boolean>;
86
82
  /** Apply destructive style to the cancel button */
87
83
  cancelButtonDestructive: PropTypes.Requireable<boolean>;
88
84
  /** Apply destructive style to the confirm button */
@@ -3,7 +3,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React, { useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import createGuid from "../../__internal__/utils/helpers/guid";
6
- import Logger from "../../__internal__/utils/logger";
7
6
  import Heading from "../heading";
8
7
  import Dialog from "../dialog";
9
8
  import { StyledConfirmButtons, StyledConfirmHeading } from "./confirm.style";
@@ -11,7 +10,6 @@ import Button from "../button/button.component";
11
10
  import Icon from "../icon";
12
11
  import Loader from "../loader";
13
12
  import useLocale from "../../hooks/__internal__/useLocale";
14
- let deprecatedWarnTriggered = false;
15
13
 
16
14
  const Confirm = ({
17
15
  "aria-labelledby": ariaLabelledBy,
@@ -19,7 +17,6 @@ const Confirm = ({
19
17
  "aria-label": ariaLabel,
20
18
  open,
21
19
  children,
22
- destructive,
23
20
  cancelButtonDestructive,
24
21
  confirmButtonDestructive,
25
22
  cancelButtonType,
@@ -40,11 +37,6 @@ const Confirm = ({
40
37
  title,
41
38
  ...rest
42
39
  }) => {
43
- if (!deprecatedWarnTriggered && destructive) {
44
- deprecatedWarnTriggered = true;
45
- Logger.deprecate("`destructive` prop is deprecated and will soon be removed. Please use `cancelButtonDestructive` and `confirmButtonDestructive` props.");
46
- }
47
-
48
40
  const l = useLocale();
49
41
  const {
50
42
  current: titleId
@@ -72,7 +64,7 @@ const Confirm = ({
72
64
  onClick: onCancel,
73
65
  "data-element": "cancel",
74
66
  buttonType: cancelButtonType,
75
- destructive: destructive || cancelButtonDestructive,
67
+ destructive: cancelButtonDestructive,
76
68
  disabled: disableCancel,
77
69
  iconType: cancelButtonIconType,
78
70
  iconPosition: cancelButtonIconPosition
@@ -83,7 +75,7 @@ const Confirm = ({
83
75
  onClick: onConfirm,
84
76
  "data-element": "confirm",
85
77
  buttonType: confirmButtonType,
86
- destructive: destructive || confirmButtonDestructive,
78
+ destructive: confirmButtonDestructive,
87
79
  disabled: isLoadingConfirm || disableConfirm,
88
80
  ml: 2,
89
81
  iconType: confirmButtonIconType,
@@ -127,7 +119,6 @@ const Confirm = ({
127
119
  Confirm.defaultProps = {
128
120
  size: "extra-small",
129
121
  showCloseIcon: false,
130
- destructive: false,
131
122
  cancelButtonDestructive: false,
132
123
  confirmButtonDestructive: false,
133
124
  iconType: null,
@@ -195,9 +186,6 @@ Confirm.propTypes = {
195
186
  /** Customise the cancel button label */
196
187
  cancelLabel: PropTypes.string,
197
188
 
198
- /** Apply destructive style to the buttons */
199
- destructive: PropTypes.bool,
200
-
201
189
  /** Apply destructive style to the cancel button */
202
190
  cancelButtonDestructive: PropTypes.bool,
203
191
 
@@ -21,8 +21,6 @@ export interface ConfirmProps extends DialogProps {
21
21
  cancelLabel?: string;
22
22
  /** Customise the confirm button label */
23
23
  confirmLabel?: string;
24
- /** Apply destructive style to the buttons */
25
- destructive?: boolean;
26
24
  /** Apply destructive style to the cancel button */
27
25
  cancelButtonDestructive?: boolean;
28
26
  /** Apply destructive style to the confirm button */
@@ -80,15 +80,9 @@ const StyledContent = styled.div`
80
80
 
81
81
  ${({
82
82
  hasHeader
83
- }) => !hasHeader && `
84
- padding-top: 0;
85
- margin-top: -25px;
86
-
87
- .carbon-app-wrapper {
88
- max-width: 100%;
89
- padding: 0;
90
- height: 70px;
91
- }
92
- `}
83
+ }) => !hasHeader && css`
84
+ padding-top: 0;
85
+ margin-top: -25px;
86
+ `}
93
87
  `;
94
88
  export default StyledContent;
@@ -1,64 +1,44 @@
1
1
  export default Heading;
2
- declare class Heading extends React.Component<any, any, any> {
3
- constructor(props: any);
4
- constructor(props: any, context: any);
5
- get help(): JSX.Element | null;
6
- get back(): JSX.Element | null;
7
- get subheader(): JSX.Element | null;
8
- get separator(): JSX.Element | null;
9
- get divider(): JSX.Element | null;
10
- get pills(): JSX.Element | null;
11
- render(): JSX.Element | null;
12
- }
2
+ declare function Heading({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, title, titleId, ...rest }: {
3
+ [x: string]: any;
4
+ children: any;
5
+ backLink: any;
6
+ divider?: boolean | undefined;
7
+ help: any;
8
+ helpAriaLabel: any;
9
+ helpLink: any;
10
+ pills: any;
11
+ separator?: boolean | undefined;
12
+ subheader: any;
13
+ subtitleId: any;
14
+ title: any;
15
+ titleId: any;
16
+ }): JSX.Element | null;
13
17
  declare namespace Heading {
14
18
  const propTypes: {
15
- /**
16
- * Children elements
17
- */
19
+ /** Child elements */
18
20
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
19
- /**
20
- * Defines the title for the heading.
21
- */
21
+ /** Defines the title for the heading. */
22
22
  title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
- /**
24
- * Defines the title id for the heading.
25
- */
23
+ /** Defines the title id for the heading. */
26
24
  titleId: PropTypes.Requireable<string>;
27
- /**
28
- * Defines the subheader for the heading.
29
- */
25
+ /** Defines the subheader for the heading. */
30
26
  subheader: PropTypes.Requireable<PropTypes.ReactNodeLike>;
31
- /**
32
- * Defines the subtitle id for the heading.
33
- */
27
+ /** Defines the subtitle id for the heading. */
34
28
  subtitleId: PropTypes.Requireable<string>;
35
- /**
36
- * Defines the help text for the heading.
37
- */
29
+ /** Defines the help text for the heading. */
38
30
  help: PropTypes.Requireable<string>;
39
- /**
40
- * Defines the help link for the heading.
41
- */
31
+ /** Defines the help link for the heading. */
42
32
  helpLink: PropTypes.Requireable<string>;
43
- /**
44
- * Defines the a href for the back link.
45
- */
33
+ /** Defines the a href for the back link. */
46
34
  backLink: PropTypes.Requireable<string | ((...args: any[]) => any)>;
47
- /**
48
- * Adds a divider below the heading and the content.
49
- */
35
+ /** Adds a divider below the heading and the content. */
50
36
  divider: PropTypes.Requireable<boolean>;
51
- /**
52
- * Adds a separator between the title and the subheader.
53
- */
37
+ /** Adds a separator between the title and the subheader. */
54
38
  separator: PropTypes.Requireable<boolean>;
55
- /**
56
- * Pills that will be added after the title.
57
- */
39
+ /** Pills that will be added after the title. */
58
40
  pills: PropTypes.Requireable<PropTypes.ReactNodeLike>;
59
- /**
60
- * Aria label for rendered help component
61
- */
41
+ /** Aria label for rendered help component */
62
42
  helpAriaLabel: PropTypes.Requireable<string>;
63
43
  marginBottom?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
64
44
  margin?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
@@ -75,10 +55,5 @@ declare namespace Heading {
75
55
  marginY?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
76
56
  my?: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
77
57
  };
78
- namespace defaultProps {
79
- const divider: boolean;
80
- const separator: boolean;
81
- }
82
58
  }
83
- import React from "react";
84
59
  import PropTypes from "prop-types";
@@ -1,25 +1,5 @@
1
1
  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); }
2
2
 
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
-
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
-
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
-
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
16
-
17
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
-
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
-
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
-
23
3
  import React from "react";
24
4
  import PropTypes from "prop-types";
25
5
  import styledSystemPropTypes from "@styled-system/prop-types";
@@ -28,181 +8,117 @@ import tagComponent from "../../__internal__/utils/helpers/tags/tags";
28
8
  import { StyledHeading, StyledHeadingIcon, StyledSubHeader, StyledHeader, StyledSeparator, StyledHeaderHelp, StyledHeadingTitle, StyledDivider, StyledHeaderContent, StyledHeadingBackButton, StyledHeadingPills } from "./heading.style";
29
9
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
30
10
 
31
- let Heading = /*#__PURE__*/function (_React$Component) {
32
- _inherits(Heading, _React$Component);
33
-
34
- var _super = _createSuper(Heading);
35
-
36
- function Heading() {
37
- _classCallCheck(this, Heading);
38
-
39
- return _super.apply(this, arguments);
40
- }
41
-
42
- _createClass(Heading, [{
43
- key: "help",
44
- get: function () {
45
- if (!this.props.help && !this.props.helpLink) {
46
- return null;
47
- }
48
-
49
- return /*#__PURE__*/React.createElement(StyledHeaderHelp, {
50
- "data-element": "help",
51
- tooltipPosition: "right",
52
- href: this.props.helpLink,
53
- ariaLabel: this.props.helpAriaLabel
54
- }, this.props.help);
55
- }
56
- }, {
57
- key: "back",
58
- get: function () {
59
- if (!this.props.backLink) {
60
- return null;
61
- }
62
-
63
- let props;
64
-
65
- if (typeof this.props.backLink === "string") {
66
- props = {
67
- href: this.props.backLink
68
- };
69
- } else {
70
- props = {
71
- onClick: this.props.backLink
72
- };
73
- }
74
-
75
- return /*#__PURE__*/React.createElement(StyledHeadingBackButton // this event allows an element to be focusable on click event on IE
76
- , _extends({
77
- onMouseDown: e => e.currentTarget.focus(),
78
- "data-element": "back"
79
- }, props), /*#__PURE__*/React.createElement(StyledHeadingIcon, {
80
- type: "chevron_left",
81
- divider: this.props.divider
82
- }));
83
- }
84
- }, {
85
- key: "subheader",
86
- get: function () {
87
- if (!this.props.subheader) {
88
- return null;
89
- }
90
-
91
- return /*#__PURE__*/React.createElement(StyledSubHeader, {
92
- "data-element": "subtitle",
93
- id: this.props.subtitleId,
94
- hasBackLink: !!this.props.backLink,
95
- hasSeparator: this.props.separator
96
- }, this.props.subheader);
97
- }
98
- }, {
99
- key: "separator",
100
- get: function () {
101
- return this.props.separator ? /*#__PURE__*/React.createElement(StyledSeparator, null) : null;
102
- }
103
- }, {
104
- key: "divider",
105
- get: function () {
106
- return this.props.divider ? /*#__PURE__*/React.createElement(StyledDivider, {
107
- "data-element": "divider"
108
- }) : null;
109
- }
110
- }, {
111
- key: "pills",
112
- get: function () {
113
- return this.props.pills ? /*#__PURE__*/React.createElement(StyledHeadingPills, {
114
- "data-element": "pills"
115
- }, this.props.pills) : null;
116
- }
117
- }, {
118
- key: "render",
119
- value: function render() {
120
- if (!this.props.title) {
121
- return null;
122
- }
123
-
124
- const marginProps = filterStyledSystemMarginProps(this.props);
125
- return /*#__PURE__*/React.createElement(StyledHeading, _extends({}, tagComponent("heading", this.props), marginProps), /*#__PURE__*/React.createElement(StyledHeader, {
126
- "data-element": "header-container",
127
- divider: this.props.divider,
128
- subheader: this.props.subheader,
129
- hasBackLink: !!this.props.backLink
130
- }, this.back, /*#__PURE__*/React.createElement(StyledHeaderContent, null, /*#__PURE__*/React.createElement(StyledHeadingTitle, {
131
- withMargin: this.props.pills || this.props.help,
132
- variant: "h1",
133
- "data-element": "title",
134
- id: this.props.titleId
135
- }, this.props.title), this.help, this.pills), this.separator, this.subheader), this.divider, this.props.children);
136
- }
137
- }]);
138
-
139
- return Heading;
140
- }(React.Component);
11
+ const Heading = ({
12
+ children,
13
+ backLink,
14
+ divider = true,
15
+ help,
16
+ helpAriaLabel,
17
+ helpLink,
18
+ pills,
19
+ separator = false,
20
+ subheader,
21
+ subtitleId,
22
+ title,
23
+ titleId,
24
+ ...rest
25
+ }) => {
26
+ const getHelp = () => {
27
+ return /*#__PURE__*/React.createElement(StyledHeaderHelp, {
28
+ "data-element": "help",
29
+ tooltipPosition: "right",
30
+ href: helpLink,
31
+ ariaLabel: helpAriaLabel
32
+ }, help);
33
+ };
34
+
35
+ const getBackButton = () => {
36
+ const backButtonProps = typeof backLink === "string" ? {
37
+ href: backLink
38
+ } : {
39
+ onClick: backLink
40
+ };
41
+ return /*#__PURE__*/React.createElement(StyledHeadingBackButton // this event allows an element to be focusable on click event on IE
42
+ , _extends({
43
+ onMouseDown: e => e.currentTarget.focus(),
44
+ "data-element": "back"
45
+ }, backButtonProps), /*#__PURE__*/React.createElement(StyledHeadingIcon, {
46
+ type: "chevron_left",
47
+ divider: divider
48
+ }));
49
+ };
50
+
51
+ const getSubheader = () => {
52
+ return /*#__PURE__*/React.createElement(StyledSubHeader, {
53
+ "data-element": "subtitle",
54
+ id: subtitleId,
55
+ hasBackLink: !!backLink,
56
+ hasSeparator: separator
57
+ }, subheader);
58
+ };
59
+
60
+ const getPills = () => {
61
+ return /*#__PURE__*/React.createElement(StyledHeadingPills, {
62
+ "data-element": "pills"
63
+ }, pills);
64
+ };
65
+
66
+ const marginProps = filterStyledSystemMarginProps(rest);
67
+ const dataAttributes = {
68
+ "data-element": rest["data-element"],
69
+ "data-role": rest["data-role"]
70
+ };
71
+ return title ? /*#__PURE__*/React.createElement(StyledHeading, _extends({}, tagComponent("heading", dataAttributes), marginProps), /*#__PURE__*/React.createElement(StyledHeader, {
72
+ "data-element": "header-container",
73
+ divider: divider,
74
+ subheader: subheader,
75
+ hasBackLink: !!backLink
76
+ }, backLink && getBackButton(), /*#__PURE__*/React.createElement(StyledHeaderContent, null, /*#__PURE__*/React.createElement(StyledHeadingTitle, {
77
+ withMargin: pills || help,
78
+ variant: "h1",
79
+ "data-element": "title",
80
+ id: titleId
81
+ }, title), (help || helpLink) && getHelp(), pills && getPills()), separator && /*#__PURE__*/React.createElement(StyledSeparator, null), subheader && getSubheader()), divider && /*#__PURE__*/React.createElement(StyledDivider, {
82
+ "data-element": "divider"
83
+ }), children) : null;
84
+ };
141
85
 
142
86
  Heading.propTypes = { ...marginPropTypes,
143
87
 
144
- /**
145
- * Children elements
146
- */
88
+ /** Child elements */
147
89
  children: PropTypes.node,
148
90
 
149
- /**
150
- * Defines the title for the heading.
151
- */
91
+ /** Defines the title for the heading. */
152
92
  title: PropTypes.node,
153
93
 
154
- /**
155
- * Defines the title id for the heading.
156
- */
94
+ /** Defines the title id for the heading. */
157
95
  titleId: PropTypes.string,
158
96
 
159
- /**
160
- * Defines the subheader for the heading.
161
- */
97
+ /** Defines the subheader for the heading. */
162
98
  subheader: PropTypes.node,
163
99
 
164
- /**
165
- * Defines the subtitle id for the heading.
166
- */
100
+ /** Defines the subtitle id for the heading. */
167
101
  subtitleId: PropTypes.string,
168
102
 
169
- /**
170
- * Defines the help text for the heading.
171
- */
103
+ /** Defines the help text for the heading. */
172
104
  help: PropTypes.string,
173
105
 
174
- /**
175
- * Defines the help link for the heading.
176
- */
106
+ /** Defines the help link for the heading. */
177
107
  helpLink: PropTypes.string,
178
108
 
179
- /**
180
- * Defines the a href for the back link.
181
- */
109
+ /** Defines the a href for the back link. */
182
110
  backLink: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
183
111
 
184
- /**
185
- * Adds a divider below the heading and the content.
186
- */
112
+ /** Adds a divider below the heading and the content. */
187
113
  divider: PropTypes.bool,
188
114
 
189
- /**
190
- * Adds a separator between the title and the subheader.
191
- */
115
+ /** Adds a separator between the title and the subheader. */
192
116
  separator: PropTypes.bool,
193
117
 
194
- /**
195
- * Pills that will be added after the title.
196
- */
118
+ /** Pills that will be added after the title. */
197
119
  pills: PropTypes.node,
198
120
 
199
- /**
200
- * Aria label for rendered help component
201
- */
121
+ /** Aria label for rendered help component */
202
122
  helpAriaLabel: PropTypes.string
203
123
  };
204
- Heading.defaultProps = {
205
- divider: true,
206
- separator: false
207
- };
208
124
  export default Heading;