carbon-react 106.7.0 → 107.1.1

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 (205) hide show
  1. package/esm/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
  2. package/esm/__internal__/click-away-wrapper/click-away-wrapper.component.js +43 -0
  3. package/esm/__internal__/click-away-wrapper/index.d.ts +2 -0
  4. package/esm/__internal__/click-away-wrapper/index.js +1 -0
  5. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  6. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  7. package/esm/components/badge/badge.style.d.ts +1 -1
  8. package/esm/components/button/button.component.d.ts +1 -3
  9. package/esm/components/button/button.component.js +1 -12
  10. package/esm/components/button/button.style.d.ts +1 -1
  11. package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
  12. package/esm/components/confirm/confirm.component.d.ts +1 -5
  13. package/esm/components/confirm/confirm.component.js +2 -14
  14. package/esm/components/confirm/confirm.d.ts +0 -2
  15. package/esm/components/date/date.component.js +19 -20
  16. package/esm/components/date/date.d.ts +10 -1
  17. package/esm/components/date/index.d.ts +1 -0
  18. package/esm/components/date-range/date-range.d.ts +3 -3
  19. package/esm/components/date-range/index.d.ts +1 -0
  20. package/esm/components/dialog-full-screen/content.style.js +4 -10
  21. package/esm/components/heading/heading.component.d.ts +27 -52
  22. package/esm/components/heading/heading.component.js +86 -170
  23. package/esm/components/heading/heading.d.ts +5 -3
  24. package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  25. package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
  26. package/esm/components/menu/__internal__/submenu/submenu.component.js +11 -17
  27. package/esm/components/menu/index.d.ts +0 -1
  28. package/esm/components/menu/index.js +0 -1
  29. package/esm/components/menu/menu-item/menu-item.component.js +0 -6
  30. package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  31. package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
  32. package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  33. package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
  34. package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  35. package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
  36. package/esm/components/popover-container/popover-container.component.js +16 -3
  37. package/esm/components/radio-button/radio-button-group.component.js +1 -1
  38. package/esm/components/select/select-list/select-list.component.js +2 -2
  39. package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
  40. package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
  41. package/esm/components/split-button/split-button.component.d.ts +1 -4
  42. package/esm/components/split-button/split-button.component.js +3 -16
  43. package/esm/components/split-button/split-button.d.ts +0 -2
  44. package/esm/components/tile/tile.component.d.ts +1 -2
  45. package/esm/components/tile/tile.component.js +1 -13
  46. package/esm/components/tile/tile.d.ts +0 -2
  47. package/esm/components/tile-select/tile-select-group.component.js +1 -1
  48. package/esm/components/toast/toast.component.d.ts +1 -4
  49. package/esm/components/toast/toast.component.js +1 -13
  50. package/esm/components/toast/toast.d.ts +0 -2
  51. package/esm/locales/en-gb.js +0 -9
  52. package/esm/locales/locale.d.ts +0 -9
  53. package/esm/locales/pl-pl.js +0 -9
  54. package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
  55. package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.js +59 -0
  56. package/lib/__internal__/click-away-wrapper/index.d.ts +2 -0
  57. package/lib/{components/menu/submenu-block → __internal__/click-away-wrapper}/index.js +2 -2
  58. package/lib/{components/scrollable-list → __internal__/click-away-wrapper}/package.json +1 -1
  59. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  60. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  61. package/lib/components/badge/badge.style.d.ts +1 -1
  62. package/lib/components/button/button.component.d.ts +1 -3
  63. package/lib/components/button/button.component.js +1 -14
  64. package/lib/components/button/button.style.d.ts +1 -1
  65. package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
  66. package/lib/components/confirm/confirm.component.d.ts +1 -5
  67. package/lib/components/confirm/confirm.component.js +2 -17
  68. package/lib/components/confirm/confirm.d.ts +0 -2
  69. package/lib/components/date/date.component.js +20 -20
  70. package/lib/components/date/date.d.ts +10 -1
  71. package/lib/components/date/index.d.ts +1 -0
  72. package/lib/components/date-range/date-range.d.ts +3 -3
  73. package/lib/components/date-range/index.d.ts +1 -0
  74. package/lib/components/dialog-full-screen/content.style.js +4 -10
  75. package/lib/components/heading/heading.component.d.ts +27 -52
  76. package/lib/components/heading/heading.component.js +86 -170
  77. package/lib/components/heading/heading.d.ts +5 -3
  78. package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  79. package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
  80. package/lib/components/menu/__internal__/submenu/submenu.component.js +12 -17
  81. package/lib/components/menu/index.d.ts +0 -1
  82. package/lib/components/menu/index.js +0 -8
  83. package/lib/components/menu/menu-item/menu-item.component.js +0 -7
  84. package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  85. package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
  86. package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  87. package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
  88. package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  89. package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
  90. package/lib/components/popover-container/popover-container.component.js +17 -3
  91. package/lib/components/radio-button/radio-button-group.component.js +1 -1
  92. package/lib/components/select/select-list/select-list.component.js +2 -2
  93. package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
  94. package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
  95. package/lib/components/split-button/split-button.component.d.ts +1 -4
  96. package/lib/components/split-button/split-button.component.js +3 -18
  97. package/lib/components/split-button/split-button.d.ts +0 -2
  98. package/lib/components/tile/tile.component.d.ts +1 -2
  99. package/lib/components/tile/tile.component.js +1 -16
  100. package/lib/components/tile/tile.d.ts +0 -2
  101. package/lib/components/tile-select/tile-select-group.component.js +1 -1
  102. package/lib/components/toast/toast.component.d.ts +1 -4
  103. package/lib/components/toast/toast.component.js +1 -16
  104. package/lib/components/toast/toast.d.ts +0 -2
  105. package/lib/locales/en-gb.js +0 -9
  106. package/lib/locales/locale.d.ts +0 -9
  107. package/lib/locales/pl-pl.js +0 -9
  108. package/package.json +1 -1
  109. package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  110. package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
  111. package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
  112. package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  113. package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
  114. package/esm/components/app-wrapper/index.d.ts +0 -1
  115. package/esm/components/app-wrapper/index.js +0 -1
  116. package/esm/components/menu/submenu-block/index.d.ts +0 -2
  117. package/esm/components/menu/submenu-block/index.js +0 -1
  118. package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  119. package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
  120. package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
  121. package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  122. package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
  123. package/esm/components/mount-in-app/__spec__.d.ts +0 -1
  124. package/esm/components/mount-in-app/__spec__.js +0 -47
  125. package/esm/components/mount-in-app/index.d.ts +0 -1
  126. package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
  127. package/esm/components/mount-in-app/mount-in-app.js +0 -90
  128. package/esm/components/mount-in-app/package.json +0 -3
  129. package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
  130. package/esm/components/multi-step-wizard/__spec__.js +0 -191
  131. package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  132. package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
  133. package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  134. package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
  135. package/esm/components/multi-step-wizard/package.json +0 -4
  136. package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  137. package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
  138. package/esm/components/multi-step-wizard/step/package.json +0 -4
  139. package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
  140. package/esm/components/multi-step-wizard/step/step.js +0 -407
  141. package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
  142. package/esm/components/multi-step-wizard/step/step.style.js +0 -138
  143. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  144. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
  145. package/esm/components/scrollable-list/index.d.ts +0 -4
  146. package/esm/components/scrollable-list/index.js +0 -4
  147. package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  148. package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
  149. package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  150. package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
  151. package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  152. package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
  153. package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  154. package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
  155. package/esm/components/scrollable-list/test-utils.d.ts +0 -2
  156. package/esm/components/scrollable-list/test-utils.js +0 -25
  157. package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  158. package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
  159. package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
  160. package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  161. package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
  162. package/lib/components/app-wrapper/index.d.ts +0 -1
  163. package/lib/components/app-wrapper/index.js +0 -15
  164. package/lib/components/app-wrapper/package.json +0 -6
  165. package/lib/components/menu/submenu-block/index.d.ts +0 -2
  166. package/lib/components/menu/submenu-block/package.json +0 -6
  167. package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  168. package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
  169. package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
  170. package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  171. package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
  172. package/lib/components/mount-in-app/__spec__.d.ts +0 -1
  173. package/lib/components/mount-in-app/__spec__.js +0 -55
  174. package/lib/components/mount-in-app/index.d.ts +0 -1
  175. package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
  176. package/lib/components/mount-in-app/mount-in-app.js +0 -105
  177. package/lib/components/mount-in-app/package.json +0 -3
  178. package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
  179. package/lib/components/multi-step-wizard/__spec__.js +0 -202
  180. package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  181. package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
  182. package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  183. package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
  184. package/lib/components/multi-step-wizard/package.json +0 -4
  185. package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  186. package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
  187. package/lib/components/multi-step-wizard/step/package.json +0 -4
  188. package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
  189. package/lib/components/multi-step-wizard/step/step.js +0 -421
  190. package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
  191. package/lib/components/multi-step-wizard/step/step.style.js +0 -162
  192. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  193. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
  194. package/lib/components/scrollable-list/index.d.ts +0 -4
  195. package/lib/components/scrollable-list/index.js +0 -31
  196. package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  197. package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
  198. package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  199. package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
  200. package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  201. package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
  202. package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  203. package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
  204. package/lib/components/scrollable-list/test-utils.d.ts +0 -2
  205. package/lib/components/scrollable-list/test-utils.js +0 -37
@@ -6,7 +6,7 @@ import styledSystemPropTypes from "@styled-system/prop-types";
6
6
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
7
7
  import Fieldset from "../../__internal__/fieldset";
8
8
  import RadioButtonGroupStyle from "./radio-button-group.style";
9
- import RadioButtonMapper from "./radio-button-mapper.component";
9
+ import RadioButtonMapper from "../../__internal__/radio-button-mapper/radio-button-mapper.component";
10
10
  import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
11
11
  import { filterStyledSystemMarginProps } from "../../style/utils";
12
12
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
@@ -228,7 +228,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
228
228
  }
229
229
 
230
230
  setListHeight(`${newHeight}px`);
231
- }, [children, listRef.current]);
231
+ }, [children]);
232
232
  useEffect(() => {
233
233
  const keyboardEvent = "keydown";
234
234
  const listElement = listRef.current;
@@ -334,7 +334,7 @@ SelectList.propTypes = {
334
334
  /** The Id of the label */
335
335
  labelId: PropTypes.string,
336
336
 
337
- /** Child components (such as <Option>) for the <ScrollableList> */
337
+ /** Child components (such as <Option>) */
338
338
  children: PropTypes.node,
339
339
 
340
340
  /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
@@ -7,7 +7,7 @@ import Events from "../../__internal__/utils/helpers/events";
7
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
8
  import Fieldset from "../../__internal__/fieldset";
9
9
  import SimpleColor from "./simple-color";
10
- import RadioButtonMapper from "../radio-button/radio-button-mapper.component";
10
+ import RadioButtonMapper from "../../__internal__/radio-button-mapper/radio-button-mapper.component";
11
11
  import { StyledContent, StyledColorOptions } from "./simple-color-picker.style";
12
12
  import ValidationIcon from "../../__internal__/validations/validation-icon.component";
13
13
  import { InputGroupContext } from "../../__internal__/input-behaviour";
@@ -1,4 +1,4 @@
1
1
  export default StyledSplitButtonToggle;
2
- declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("../button").ButtonProps, "as"> & {
2
+ declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("../button").ButtonProps & {
3
3
  iconOnly?: boolean | undefined;
4
4
  }, never>;
@@ -1,8 +1,7 @@
1
1
  export default SplitButton;
2
- declare function SplitButton({ align, as, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, ...rest }: {
2
+ declare function SplitButton({ align, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, ...rest }: {
3
3
  [x: string]: any;
4
4
  align?: string | undefined;
5
- as: any;
6
5
  buttonType?: string | undefined;
7
6
  children: any;
8
7
  disabled?: boolean | undefined;
@@ -19,8 +18,6 @@ declare namespace SplitButton {
19
18
  const propTypes: {
20
19
  /** Button type: "primary" | "secondary" */
21
20
  buttonType: PropTypes.Requireable<string>;
22
- /** Button type: "primary" | "secondary" for legacy theme */
23
- as: PropTypes.Requireable<string>;
24
21
  /** The additional button to display. */
25
22
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
26
23
  /** A custom value for the data-element attribute */
@@ -15,14 +15,11 @@ import Popover from "../../__internal__/popover";
15
15
  import { filterStyledSystemMarginProps, filterOutStyledSystemSpacingProps } from "../../style/utils";
16
16
  import { baseTheme } from "../../style/themes";
17
17
  import { defaultFocusableSelectors } from "../../__internal__/focus-trap/focus-trap-utils";
18
- import Logger from "../../__internal__/utils/logger";
19
18
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
20
19
  const CONTENT_WIDTH_RATIO = 0.75;
21
- let deprecatedWarnTriggered = false;
22
20
 
23
21
  const SplitButton = ({
24
22
  align = "left",
25
- as,
26
23
  buttonType = "secondary",
27
24
  children,
28
25
  disabled = false,
@@ -36,12 +33,6 @@ const SplitButton = ({
36
33
  "data-role": dataRole,
37
34
  ...rest
38
35
  }) => {
39
- if (!deprecatedWarnTriggered && as) {
40
- deprecatedWarnTriggered = true;
41
- Logger.deprecate( // eslint-disable-next-line max-len
42
- "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");
43
- }
44
-
45
36
  const theme = useContext(ThemeContext) || baseTheme;
46
37
  const isToggleButtonFocused = useRef(false);
47
38
  const isFocusedAfterClosing = useRef(false);
@@ -126,7 +117,6 @@ const SplitButton = ({
126
117
  onFocus: hideButtons,
127
118
  onTouchStart: hideButtons,
128
119
  iconPosition,
129
- as,
130
120
  buttonType,
131
121
  disabled,
132
122
  iconType,
@@ -147,7 +137,7 @@ const SplitButton = ({
147
137
  isToggleButtonFocused.current = false;
148
138
  },
149
139
  onKeyDown: handleToggleButtonKeyDown,
150
- buttonType: as || buttonType,
140
+ buttonType,
151
141
  size
152
142
  };
153
143
 
@@ -171,7 +161,7 @@ const SplitButton = ({
171
161
  primary: theme.colors.white,
172
162
  secondary: theme.colors.primary
173
163
  };
174
- return colorsMap[as || buttonType];
164
+ return colorsMap[buttonType];
175
165
  }
176
166
 
177
167
  function renderMainButton() {
@@ -282,9 +272,6 @@ SplitButton.propTypes = { ...marginPropTypes,
282
272
  /** Button type: "primary" | "secondary" */
283
273
  buttonType: PropTypes.oneOf(["primary", "secondary"]),
284
274
 
285
- /** Button type: "primary" | "secondary" for legacy theme */
286
- as: PropTypes.oneOf(["primary", "secondary"]),
287
-
288
275
  /** The additional button to display. */
289
276
  children: PropTypes.node.isRequired,
290
277
 
@@ -309,5 +296,5 @@ SplitButton.propTypes = { ...marginPropTypes,
309
296
  /** Set align of the rendered content */
310
297
  align: PropTypes.oneOf(["left", "right"])
311
298
  };
312
- SplitButton.safeProps = ["buttonType", "as", "disabled", "size"];
299
+ SplitButton.safeProps = ["buttonType", "disabled", "size"];
313
300
  export default SplitButton;
@@ -6,8 +6,6 @@ export interface SplitButtonProps
6
6
  MarginProps {
7
7
  /** Set align of the rendered content */
8
8
  align?: "left" | "right";
9
- /** Button type: "primary" | "secondary" for legacy theme */
10
- as?: "primary" | "secondary";
11
9
  /** Button type: "primary" | "secondary" */
12
10
  buttonType?: "primary" | "secondary";
13
11
  /** The additional button to display. */
@@ -1,7 +1,6 @@
1
1
  export default Tile;
2
- declare function Tile({ as, variant, p, children, orientation, width, ...props }: {
2
+ declare function Tile({ variant, p, children, orientation, width, ...props }: {
3
3
  [x: string]: any;
4
- as: any;
5
4
  variant?: string | undefined;
6
5
  p?: number | undefined;
7
6
  children: any;
@@ -4,11 +4,8 @@ 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;
9
7
 
10
8
  const Tile = ({
11
- as,
12
9
  variant = "tile",
13
10
  p = 3,
14
11
  children,
@@ -16,12 +13,6 @@ const Tile = ({
16
13
  width,
17
14
  ...props
18
15
  }) => {
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
-
25
16
  const isHorizontal = () => orientation === "horizontal";
26
17
 
27
18
  const isVertical = () => orientation === "vertical";
@@ -50,7 +41,7 @@ const Tile = ({
50
41
  }), /*#__PURE__*/React.cloneElement(child, childProps));
51
42
  });
52
43
  return /*#__PURE__*/React.createElement(StyledTile, _extends({
53
- tileTheme: as || variant,
44
+ tileTheme: variant,
54
45
  width: width,
55
46
  "data-component": "tile",
56
47
  isHorizontal: isHorizontal(orientation),
@@ -62,9 +53,6 @@ Tile.propTypes = {
62
53
  /** Styled system spacing props */
63
54
  ...propTypes.space,
64
55
 
65
- /** Sets the theme of the tile - either 'tile' or 'transparent' */
66
- as: PropTypes.oneOf(["tile", "transparent"]),
67
-
68
56
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
69
57
  variant: PropTypes.oneOf(["tile", "transparent"]),
70
58
 
@@ -2,8 +2,6 @@ import * as React from "react";
2
2
  import { SpaceProps } from "styled-system";
3
3
 
4
4
  export interface TileProps extends SpaceProps {
5
- /** Sets the theme of the tile - either 'tile' or 'transparent' */
6
- as?: "tile" | "transparent";
7
5
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
8
6
  variant?: "tile" | "transparent";
9
7
  /**
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
5
5
  import styledSystemPropTypes from "@styled-system/prop-types";
6
6
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
7
7
  import TileSelect from "./tile-select.component";
8
- import RadioButtonMapper from "../radio-button/radio-button-mapper.component";
8
+ import RadioButtonMapper from "../../__internal__/radio-button-mapper/radio-button-mapper.component";
9
9
  import { StyledTileSelectFieldset, StyledGroupDescription } from "./tile-select.style";
10
10
  import { filterStyledSystemMarginProps } from "../../style/utils";
11
11
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
@@ -1,7 +1,6 @@
1
1
  export default Toast;
2
- declare function Toast({ as, children, className, id, isCenter, maxWidth, onDismiss, open, targetPortalId, timeout, variant, ...restProps }: {
2
+ declare function Toast({ children, className, id, isCenter, maxWidth, onDismiss, open, targetPortalId, timeout, variant, ...restProps }: {
3
3
  [x: string]: any;
4
- as: any;
5
4
  children: any;
6
5
  className: any;
7
6
  id: any;
@@ -17,8 +16,6 @@ declare namespace Toast {
17
16
  const propTypes: {
18
17
  /** Customizes the appearance in the DLS theme */
19
18
  variant: PropTypes.Requireable<string>;
20
- /** Customizes the appearance in a legacy theme through colour (see the 'iconColorSets' for possible values) */
21
- as: PropTypes.Requireable<string>;
22
19
  /** Custom className */
23
20
  className: PropTypes.Requireable<string>;
24
21
  /** Custom id */
@@ -11,11 +11,8 @@ import IconButton from "../icon-button";
11
11
  import Events from "../../__internal__/utils/helpers/events";
12
12
  import useLocale from "../../hooks/__internal__/useLocale";
13
13
  import useModalManager from "../../hooks/__internal__/useModalManager";
14
- import Logger from "../../__internal__/utils/logger";
15
- let deprecatedWarnTriggered = false;
16
14
 
17
15
  const Toast = ({
18
- as,
19
16
  children,
20
17
  className,
21
18
  id,
@@ -28,12 +25,6 @@ const Toast = ({
28
25
  variant,
29
26
  ...restProps
30
27
  }) => {
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
-
37
28
  const locale = useLocale();
38
29
  const toastRef = useRef();
39
30
  const timer = useRef();
@@ -73,7 +64,7 @@ const Toast = ({
73
64
  if (!open) return null;
74
65
  const toastProps = {
75
66
  isCenter,
76
- variant: variant || as || "success",
67
+ variant: variant || "success",
77
68
  id,
78
69
  maxWidth
79
70
  };
@@ -113,9 +104,6 @@ Toast.propTypes = {
113
104
  /** Customizes the appearance in the DLS theme */
114
105
  variant: PropTypes.oneOf(["error", "info", "success", "warning"]),
115
106
 
116
- /** Customizes the appearance in a legacy theme through colour (see the 'iconColorSets' for possible values) */
117
- as: PropTypes.oneOf(["error", "info", "success", "warning"]),
118
-
119
107
  /** Custom className */
120
108
  className: PropTypes.string,
121
109
 
@@ -7,8 +7,6 @@ export interface ToastPropTypes {
7
7
  children: React.ReactNode;
8
8
  /** Customizes the appearance in the DLS theme */
9
9
  variant?: ToastVariants;
10
- /** Customizes the appearance in a legacy theme through colour (see the 'iconColorSets' for possible values) */
11
- as?: ToastVariants;
12
10
  /** Custom className */
13
11
  className?: string;
14
12
  /** Custom id */
@@ -118,15 +118,6 @@ const enGB = {
118
118
  ariaLabels: {
119
119
  close: () => "Close"
120
120
  }
121
- },
122
- wizards: {
123
- multiStep: {
124
- buttons: {
125
- submit: () => "Submit",
126
- next: () => "Next",
127
- back: () => "Back"
128
- }
129
- }
130
121
  }
131
122
  };
132
123
  export default enGB;
@@ -92,14 +92,5 @@ interface Locale {
92
92
  close: () => string;
93
93
  };
94
94
  };
95
- wizards: {
96
- multiStep: {
97
- buttons: {
98
- submit: () => string;
99
- next: () => string;
100
- back: () => string;
101
- };
102
- };
103
- };
104
95
  }
105
96
  export default Locale;
@@ -116,15 +116,6 @@ const plPL = {
116
116
  ariaLabels: {
117
117
  close: () => "Zamknij"
118
118
  }
119
- },
120
- wizards: {
121
- multiStep: {
122
- buttons: {
123
- submit: () => "Wyślij",
124
- next: () => "Następny",
125
- back: () => "Wstecz"
126
- }
127
- }
128
119
  }
129
120
  };
130
121
  export default plPL;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export interface ClickAwayWrapperProps {
3
+ children: React.ReactNode;
4
+ handleClickAway: (ev: CustomEvent) => void;
5
+ eventTypeId?: "mousedown" | "click";
6
+ targets: React.RefObject<HTMLElement>[];
7
+ }
8
+ declare const ClickAwayWrapper: {
9
+ ({ children, handleClickAway, eventTypeId, targets, }: ClickAwayWrapperProps): JSX.Element;
10
+ displayName: string;
11
+ };
12
+ export default ClickAwayWrapper;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _events = _interopRequireDefault(require("../utils/helpers/events"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
17
+
18
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ const ClickAwayWrapper = ({
21
+ children,
22
+ handleClickAway,
23
+ eventTypeId = "click",
24
+ targets
25
+ }) => {
26
+ (0, _react.useEffect)(() => {
27
+ const fnClickAway = ev => {
28
+ const clickedElements = targets.filter(ref => (ref === null || ref === void 0 ? void 0 : ref.current) && _events.default.composedPath(ev).includes(ref.current));
29
+
30
+ if (!clickedElements || !clickedElements.length) {
31
+ handleClickAway(ev);
32
+ }
33
+ };
34
+
35
+ document.addEventListener(eventTypeId, fnClickAway);
36
+ return function cleanup() {
37
+ document.removeEventListener(eventTypeId, fnClickAway);
38
+ };
39
+ }, [handleClickAway, targets, eventTypeId]);
40
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
41
+ };
42
+
43
+ ClickAwayWrapper.propTypes = {
44
+ "children": _propTypes.default.node,
45
+ "eventTypeId": _propTypes.default.oneOf(["click", "mousedown"]),
46
+ "handleClickAway": _propTypes.default.func.isRequired,
47
+ "targets": _propTypes.default.arrayOf(_propTypes.default.shape({
48
+ "current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
49
+ if (props[propName] == null) {
50
+ return new Error("Prop '" + propName + "' is required but wasn't specified");
51
+ } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
52
+ return new Error("Expected prop '" + propName + "' to be of type Element");
53
+ }
54
+ }]).isRequired
55
+ })).isRequired
56
+ };
57
+ ClickAwayWrapper.displayName = "ClickAwayWrapper";
58
+ var _default = ClickAwayWrapper;
59
+ exports.default = _default;
@@ -0,0 +1,2 @@
1
+ export { default } from "./click-away-wrapper.component";
2
+ export type { ClickAwayWrapperProps } from "./click-away-wrapper.component";
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _submenuBlock.default;
9
+ return _clickAwayWrapper.default;
10
10
  }
11
11
  });
12
12
 
13
- var _submenuBlock = _interopRequireDefault(require("./submenu-block.component"));
13
+ var _clickAwayWrapper = _interopRequireDefault(require("./click-away-wrapper.component"));
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sideEffects": false,
3
- "module": "../../../esm/components/scrollable-list/index.js",
3
+ "module": "../../../esm/__internal__/click-away-wrapper/index.js",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts"
6
6
  }
@@ -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>>;
@@ -19,8 +19,6 @@ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tag
19
19
 
20
20
  var _tooltipProvider = require("../../__internal__/tooltip-provider");
21
21
 
22
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
23
-
24
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
23
 
26
24
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -94,12 +92,10 @@ renderChildren.propTypes = {
94
92
  }
95
93
  }
96
94
  };
97
- let deprecatedWarnTriggered = false;
98
95
 
99
96
  const Button = ({
100
97
  size = "medium",
101
98
  subtext = "",
102
- as,
103
99
  children,
104
100
  forwardRef,
105
101
  "aria-label": ariaLabel,
@@ -119,13 +115,6 @@ const Button = ({
119
115
  fullWidth = false,
120
116
  ...rest
121
117
  }) => {
122
- if (!deprecatedWarnTriggered && as) {
123
- deprecatedWarnTriggered = true;
124
-
125
- _logger.default.deprecate( // eslint-disable-next-line max-len
126
- "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");
127
- }
128
-
129
118
  (0, _invariant.default)(!!(children || iconType), "Either prop `iconType` must be defined or this node must have children.");
130
119
 
131
120
  if (subtext) {
@@ -133,7 +122,7 @@ const Button = ({
133
122
  }
134
123
 
135
124
  const [internalRef, setInternalRef] = (0, _react.useState)();
136
- const buttonType = as || buttonTypeProp;
125
+ const buttonType = buttonTypeProp;
137
126
  let paddingX;
138
127
 
139
128
  const handleLinkKeyDown = event => {
@@ -203,7 +192,6 @@ const Button = ({
203
192
 
204
193
  Button.propTypes = {
205
194
  "aria-label": _propTypes.default.string,
206
- "as": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
207
195
  "buttonType": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
208
196
  "children": _propTypes.default.node,
209
197
  "destructive": _propTypes.default.bool,
@@ -546,7 +534,6 @@ const ButtonWithForwardRef = /*#__PURE__*/_react.default.forwardRef((props, ref)
546
534
  exports.ButtonWithForwardRef = ButtonWithForwardRef;
547
535
  ButtonWithForwardRef.propTypes = {
548
536
  "aria-label": _propTypes.default.string,
549
- "as": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
550
537
  "buttonType": _propTypes.default.oneOf(["darkBackground", "dashed", "primary", "secondary", "tertiary"]),
551
538
  "children": _propTypes.default.node,
552
539
  "destructive": _propTypes.default.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>;
@@ -17,7 +17,7 @@ var _buttonToggleGroup = _interopRequireDefault(require("./button-toggle-group.s
17
17
 
18
18
  var _buttonToggle = _interopRequireDefault(require("../button-toggle"));
19
19
 
20
- var _radioButtonMapper = _interopRequireDefault(require("../radio-button/radio-button-mapper.component"));
20
+ var _radioButtonMapper = _interopRequireDefault(require("../../__internal__/radio-button-mapper/radio-button-mapper.component"));
21
21
 
22
22
  var _validationIcon = _interopRequireDefault(require("../../__internal__/validations/validation-icon.component"));
23
23
 
@@ -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 */