carbon-react 106.6.10 → 107.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.
Files changed (219) 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/__internal__/focus-trap/focus-trap-utils.js +25 -1
  6. package/esm/__internal__/focus-trap/focus-trap.component.d.ts +3 -1
  7. package/esm/__internal__/focus-trap/focus-trap.component.js +44 -12
  8. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  9. package/esm/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  10. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +5 -5
  11. package/esm/components/badge/badge.style.d.ts +1 -1
  12. package/esm/components/button/button.component.d.ts +1 -3
  13. package/esm/components/button/button.component.js +1 -12
  14. package/esm/components/button/button.style.d.ts +1 -1
  15. package/esm/components/button-toggle-group/button-toggle-group.component.js +1 -1
  16. package/esm/components/confirm/confirm.component.d.ts +1 -5
  17. package/esm/components/confirm/confirm.component.js +2 -14
  18. package/esm/components/confirm/confirm.d.ts +0 -2
  19. package/esm/components/date/date.component.js +19 -20
  20. package/esm/components/dialog/dialog.component.js +4 -3
  21. package/esm/components/dialog-full-screen/content.style.js +4 -10
  22. package/esm/components/dialog-full-screen/dialog-full-screen.component.js +4 -3
  23. package/esm/components/heading/heading.component.d.ts +27 -52
  24. package/esm/components/heading/heading.component.js +86 -170
  25. package/esm/components/heading/heading.d.ts +5 -3
  26. package/esm/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  27. package/esm/components/i18n-provider/i18n-provider.component.js +0 -9
  28. package/esm/components/menu/__internal__/submenu/submenu.component.js +11 -17
  29. package/esm/components/menu/index.d.ts +0 -1
  30. package/esm/components/menu/index.js +0 -1
  31. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +4 -18
  32. package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +1 -0
  33. package/esm/components/menu/menu-item/menu-item.component.js +0 -6
  34. package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  35. package/esm/components/multi-action-button/multi-action-button.component.js +1 -11
  36. package/esm/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  37. package/esm/components/navigation-bar/navigation-bar.component.js +1 -15
  38. package/esm/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  39. package/esm/components/navigation-bar/navigation-bar.style.js +0 -8
  40. package/esm/components/popover-container/popover-container.component.js +16 -3
  41. package/esm/components/radio-button/radio-button-group.component.js +1 -1
  42. package/esm/components/select/select-list/select-list.component.js +2 -2
  43. package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +3 -1
  44. package/esm/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -2
  45. package/esm/components/sidebar/sidebar.component.js +10 -3
  46. package/esm/components/simple-color-picker/simple-color-picker.component.js +1 -1
  47. package/esm/components/split-button/split-button-toggle.style.d.ts +1 -1
  48. package/esm/components/split-button/split-button.component.d.ts +1 -4
  49. package/esm/components/split-button/split-button.component.js +3 -16
  50. package/esm/components/split-button/split-button.d.ts +0 -2
  51. package/esm/components/tile/tile.component.d.ts +1 -2
  52. package/esm/components/tile/tile.component.js +1 -13
  53. package/esm/components/tile/tile.d.ts +0 -2
  54. package/esm/components/tile-select/tile-select-group.component.js +1 -1
  55. package/esm/components/toast/toast.component.d.ts +1 -4
  56. package/esm/components/toast/toast.component.js +1 -13
  57. package/esm/components/toast/toast.d.ts +0 -2
  58. package/esm/locales/en-gb.js +0 -9
  59. package/esm/locales/locale.d.ts +0 -9
  60. package/esm/locales/pl-pl.js +0 -9
  61. package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.d.ts +12 -0
  62. package/lib/__internal__/click-away-wrapper/click-away-wrapper.component.js +59 -0
  63. package/lib/__internal__/click-away-wrapper/index.d.ts +2 -0
  64. package/lib/{components/menu/submenu-block → __internal__/click-away-wrapper}/index.js +2 -2
  65. package/lib/{components/scrollable-list → __internal__/click-away-wrapper}/package.json +1 -1
  66. package/lib/__internal__/focus-trap/focus-trap-utils.js +25 -1
  67. package/lib/__internal__/focus-trap/focus-trap.component.d.ts +3 -1
  68. package/lib/__internal__/focus-trap/focus-trap.component.js +46 -12
  69. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.d.ts +0 -0
  70. package/lib/{components/radio-button → __internal__/radio-button-mapper}/radio-button-mapper.component.js +0 -0
  71. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +5 -5
  72. package/lib/components/badge/badge.style.d.ts +1 -1
  73. package/lib/components/button/button.component.d.ts +1 -3
  74. package/lib/components/button/button.component.js +1 -14
  75. package/lib/components/button/button.style.d.ts +1 -1
  76. package/lib/components/button-toggle-group/button-toggle-group.component.js +1 -1
  77. package/lib/components/confirm/confirm.component.d.ts +1 -5
  78. package/lib/components/confirm/confirm.component.js +2 -17
  79. package/lib/components/confirm/confirm.d.ts +0 -2
  80. package/lib/components/date/date.component.js +20 -20
  81. package/lib/components/dialog/dialog.component.js +4 -3
  82. package/lib/components/dialog-full-screen/content.style.js +4 -10
  83. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +4 -3
  84. package/lib/components/heading/heading.component.d.ts +27 -52
  85. package/lib/components/heading/heading.component.js +86 -170
  86. package/lib/components/heading/heading.d.ts +5 -3
  87. package/lib/components/i18n-provider/i18n-provider.component.d.ts +0 -9
  88. package/lib/components/i18n-provider/i18n-provider.component.js +0 -9
  89. package/lib/components/menu/__internal__/submenu/submenu.component.js +12 -17
  90. package/lib/components/menu/index.d.ts +0 -1
  91. package/lib/components/menu/index.js +0 -8
  92. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +3 -17
  93. package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +1 -0
  94. package/lib/components/menu/menu-item/menu-item.component.js +0 -7
  95. package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  96. package/lib/components/multi-action-button/multi-action-button.component.js +1 -14
  97. package/lib/components/navigation-bar/navigation-bar.component.d.ts +1 -6
  98. package/lib/components/navigation-bar/navigation-bar.component.js +1 -18
  99. package/lib/components/navigation-bar/navigation-bar.style.d.ts +0 -4
  100. package/lib/components/navigation-bar/navigation-bar.style.js +0 -8
  101. package/lib/components/popover-container/popover-container.component.js +17 -3
  102. package/lib/components/radio-button/radio-button-group.component.js +1 -1
  103. package/lib/components/select/select-list/select-list.component.js +2 -2
  104. package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.d.ts +3 -1
  105. package/lib/components/sidebar/__internal__/sidebar-header/sidebar-header.component.js +7 -2
  106. package/lib/components/sidebar/sidebar.component.js +11 -3
  107. package/lib/components/simple-color-picker/simple-color-picker.component.js +1 -1
  108. package/lib/components/split-button/split-button-toggle.style.d.ts +1 -1
  109. package/lib/components/split-button/split-button.component.d.ts +1 -4
  110. package/lib/components/split-button/split-button.component.js +3 -18
  111. package/lib/components/split-button/split-button.d.ts +0 -2
  112. package/lib/components/tile/tile.component.d.ts +1 -2
  113. package/lib/components/tile/tile.component.js +1 -16
  114. package/lib/components/tile/tile.d.ts +0 -2
  115. package/lib/components/tile-select/tile-select-group.component.js +1 -1
  116. package/lib/components/toast/toast.component.d.ts +1 -4
  117. package/lib/components/toast/toast.component.js +1 -16
  118. package/lib/components/toast/toast.d.ts +0 -2
  119. package/lib/locales/en-gb.js +0 -9
  120. package/lib/locales/locale.d.ts +0 -9
  121. package/lib/locales/pl-pl.js +0 -9
  122. package/package.json +1 -1
  123. package/esm/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  124. package/esm/components/app-wrapper/app-wrapper.component.js +0 -104
  125. package/esm/components/app-wrapper/app-wrapper.d.ts +0 -12
  126. package/esm/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  127. package/esm/components/app-wrapper/app-wrapper.style.js +0 -17
  128. package/esm/components/app-wrapper/index.d.ts +0 -1
  129. package/esm/components/app-wrapper/index.js +0 -1
  130. package/esm/components/menu/submenu-block/index.d.ts +0 -2
  131. package/esm/components/menu/submenu-block/index.js +0 -1
  132. package/esm/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  133. package/esm/components/menu/submenu-block/submenu-block.component.js +0 -34
  134. package/esm/components/menu/submenu-block/submenu-block.d.ts +0 -12
  135. package/esm/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  136. package/esm/components/menu/submenu-block/submenu-block.style.js +0 -16
  137. package/esm/components/mount-in-app/__spec__.d.ts +0 -1
  138. package/esm/components/mount-in-app/__spec__.js +0 -47
  139. package/esm/components/mount-in-app/index.d.ts +0 -1
  140. package/esm/components/mount-in-app/mount-in-app.d.ts +0 -12
  141. package/esm/components/mount-in-app/mount-in-app.js +0 -90
  142. package/esm/components/mount-in-app/package.json +0 -3
  143. package/esm/components/multi-step-wizard/__spec__.d.ts +0 -1
  144. package/esm/components/multi-step-wizard/__spec__.js +0 -191
  145. package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  146. package/esm/components/multi-step-wizard/multi-step-wizard.js +0 -383
  147. package/esm/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  148. package/esm/components/multi-step-wizard/multi-step-wizard.style.js +0 -10
  149. package/esm/components/multi-step-wizard/package.json +0 -4
  150. package/esm/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  151. package/esm/components/multi-step-wizard/step/__spec__.js +0 -399
  152. package/esm/components/multi-step-wizard/step/package.json +0 -4
  153. package/esm/components/multi-step-wizard/step/step.d.ts +0 -166
  154. package/esm/components/multi-step-wizard/step/step.js +0 -407
  155. package/esm/components/multi-step-wizard/step/step.style.d.ts +0 -13
  156. package/esm/components/multi-step-wizard/step/step.style.js +0 -138
  157. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  158. package/esm/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -10
  159. package/esm/components/scrollable-list/index.d.ts +0 -4
  160. package/esm/components/scrollable-list/index.js +0 -4
  161. package/esm/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  162. package/esm/components/scrollable-list/scrollable-list-item.component.js +0 -26
  163. package/esm/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  164. package/esm/components/scrollable-list/scrollable-list.component.js +0 -306
  165. package/esm/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  166. package/esm/components/scrollable-list/scrollable-list.context.js +0 -2
  167. package/esm/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  168. package/esm/components/scrollable-list/scrollable-list.style.js +0 -30
  169. package/esm/components/scrollable-list/test-utils.d.ts +0 -2
  170. package/esm/components/scrollable-list/test-utils.js +0 -25
  171. package/lib/components/app-wrapper/app-wrapper.component.d.ts +0 -25
  172. package/lib/components/app-wrapper/app-wrapper.component.js +0 -120
  173. package/lib/components/app-wrapper/app-wrapper.d.ts +0 -12
  174. package/lib/components/app-wrapper/app-wrapper.style.d.ts +0 -2
  175. package/lib/components/app-wrapper/app-wrapper.style.js +0 -28
  176. package/lib/components/app-wrapper/index.d.ts +0 -1
  177. package/lib/components/app-wrapper/index.js +0 -15
  178. package/lib/components/app-wrapper/package.json +0 -6
  179. package/lib/components/menu/submenu-block/index.d.ts +0 -2
  180. package/lib/components/menu/submenu-block/package.json +0 -6
  181. package/lib/components/menu/submenu-block/submenu-block.component.d.ts +0 -12
  182. package/lib/components/menu/submenu-block/submenu-block.component.js +0 -53
  183. package/lib/components/menu/submenu-block/submenu-block.d.ts +0 -12
  184. package/lib/components/menu/submenu-block/submenu-block.style.d.ts +0 -2
  185. package/lib/components/menu/submenu-block/submenu-block.style.js +0 -33
  186. package/lib/components/mount-in-app/__spec__.d.ts +0 -1
  187. package/lib/components/mount-in-app/__spec__.js +0 -55
  188. package/lib/components/mount-in-app/index.d.ts +0 -1
  189. package/lib/components/mount-in-app/mount-in-app.d.ts +0 -12
  190. package/lib/components/mount-in-app/mount-in-app.js +0 -105
  191. package/lib/components/mount-in-app/package.json +0 -3
  192. package/lib/components/multi-step-wizard/__spec__.d.ts +0 -1
  193. package/lib/components/multi-step-wizard/__spec__.js +0 -202
  194. package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +0 -109
  195. package/lib/components/multi-step-wizard/multi-step-wizard.js +0 -397
  196. package/lib/components/multi-step-wizard/multi-step-wizard.style.d.ts +0 -2
  197. package/lib/components/multi-step-wizard/multi-step-wizard.style.js +0 -21
  198. package/lib/components/multi-step-wizard/package.json +0 -4
  199. package/lib/components/multi-step-wizard/step/__spec__.d.ts +0 -1
  200. package/lib/components/multi-step-wizard/step/__spec__.js +0 -409
  201. package/lib/components/multi-step-wizard/step/package.json +0 -4
  202. package/lib/components/multi-step-wizard/step/step.d.ts +0 -166
  203. package/lib/components/multi-step-wizard/step/step.js +0 -421
  204. package/lib/components/multi-step-wizard/step/step.style.d.ts +0 -13
  205. package/lib/components/multi-step-wizard/step/step.style.js +0 -162
  206. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.d.ts +0 -2
  207. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +0 -21
  208. package/lib/components/scrollable-list/index.d.ts +0 -4
  209. package/lib/components/scrollable-list/index.js +0 -31
  210. package/lib/components/scrollable-list/scrollable-list-item.component.d.ts +0 -2
  211. package/lib/components/scrollable-list/scrollable-list-item.component.js +0 -42
  212. package/lib/components/scrollable-list/scrollable-list.component.d.ts +0 -52
  213. package/lib/components/scrollable-list/scrollable-list.component.js +0 -328
  214. package/lib/components/scrollable-list/scrollable-list.context.d.ts +0 -3
  215. package/lib/components/scrollable-list/scrollable-list.context.js +0 -14
  216. package/lib/components/scrollable-list/scrollable-list.style.d.ts +0 -2
  217. package/lib/components/scrollable-list/scrollable-list.style.js +0 -41
  218. package/lib/components/scrollable-list/test-utils.d.ts +0 -2
  219. package/lib/components/scrollable-list/test-utils.js +0 -37
@@ -8,13 +8,10 @@ import Events from "../../__internal__/utils/helpers/events";
8
8
  import Popover from "../../__internal__/popover";
9
9
  import { filterStyledSystemMarginProps, filterOutStyledSystemSpacingProps } from "../../style/utils";
10
10
  import { defaultFocusableSelectors } from "../../__internal__/focus-trap/focus-trap-utils";
11
- import Logger from "../../__internal__/utils/logger";
12
- let deprecatedWarnTriggered = false;
13
11
 
14
12
  const MultiActionButton = ({
15
13
  align = "left",
16
14
  disabled,
17
- as,
18
15
  buttonType,
19
16
  size,
20
17
  children,
@@ -24,12 +21,6 @@ const MultiActionButton = ({
24
21
  "data-role": dataRole,
25
22
  ...rest
26
23
  }) => {
27
- if (!deprecatedWarnTriggered && as) {
28
- deprecatedWarnTriggered = true;
29
- Logger.deprecate( // eslint-disable-next-line max-len
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
- }
32
-
33
24
  const ref = useRef(null);
34
25
  const buttonRef = useRef(null);
35
26
  const buttonContainer = useRef(null);
@@ -188,7 +179,7 @@ const MultiActionButton = ({
188
179
  onFocus: focusMainButton,
189
180
  onBlur: blurMainButton,
190
181
  onKeyDown: handleMainButtonKeyDown,
191
- buttonType: buttonType || as,
182
+ buttonType,
192
183
  size,
193
184
  subtext,
194
185
  ...(!disabled && {
@@ -282,7 +273,6 @@ MultiActionButton.propTypes = {
282
273
  "aria-valuemin": PropTypes.number,
283
274
  "aria-valuenow": PropTypes.number,
284
275
  "aria-valuetext": PropTypes.string,
285
- "as": PropTypes.oneOf(["primary", "secondary"]),
286
276
  "autoCapitalize": PropTypes.string,
287
277
  "autoCorrect": PropTypes.string,
288
278
  "autoFocus": PropTypes.bool,
@@ -3,7 +3,6 @@ import { PaddingProps, FlexboxProps } from "styled-system";
3
3
  export declare type Position = "sticky" | "fixed";
4
4
  export declare type Orientation = "top" | "bottom";
5
5
  export declare type NavigationType = "light" | "dark" | "white" | "black";
6
- export declare type StickyPosition = "top" | "bottom";
7
6
  export interface NavigationBarProps extends PaddingProps, FlexboxProps {
8
7
  children?: React.ReactNode;
9
8
  ariaLabel?: string;
@@ -11,10 +10,6 @@ export interface NavigationBarProps extends PaddingProps, FlexboxProps {
11
10
  navigationType?: NavigationType;
12
11
  /** If 'true' the children will not be visible */
13
12
  isLoading?: boolean;
14
- /** Defines the position of sticky navigation bar */
15
- stickyPosition?: StickyPosition;
16
- /** Defines the offset of sticky navigation bar */
17
- stickyOffset?: string;
18
13
  /** Defines whether the navigation bar should be positioned fixed or sticky */
19
14
  position?: Position;
20
15
  /** Defines the offset of navigation bar */
@@ -22,5 +17,5 @@ export interface NavigationBarProps extends PaddingProps, FlexboxProps {
22
17
  /** Defines whether the navigation bar should be positioned top or bottom */
23
18
  orientation?: Orientation;
24
19
  }
25
- export declare const NavigationBar: ({ navigationType, isLoading, children, ariaLabel, stickyOffset, stickyPosition, position, offset, orientation, ...props }: NavigationBarProps) => JSX.Element;
20
+ export declare const NavigationBar: ({ navigationType, isLoading, children, ariaLabel, position, offset, orientation, ...props }: NavigationBarProps) => JSX.Element;
26
21
  export default NavigationBar;
@@ -3,34 +3,22 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import StyledNavigationBar from "./navigation-bar.style";
6
- import Logger from "../../__internal__/utils/logger";
7
- let deprecatedWarnTriggered = false;
8
6
 
9
7
  const NavigationBar = ({
10
8
  navigationType = "light",
11
9
  isLoading = false,
12
10
  children,
13
11
  ariaLabel,
14
- stickyOffset = "0",
15
- stickyPosition,
16
12
  position,
17
13
  offset = "0",
18
14
  orientation,
19
15
  ...props
20
16
  }) => {
21
- if (!deprecatedWarnTriggered && stickyPosition) {
22
- deprecatedWarnTriggered = true;
23
- Logger.deprecate( // eslint-disable-next-line max-len
24
- "The `stickyPosition` and `stickyOffset` props are deprecated and will soon be removed. You should use the `position`, `offset` and `orientation` props to achieve the same layout. The following codemods are available to help with updating your code: https://github.com/Sage/carbon-codemod/tree/master/transforms/remove-prop and https://github.com/Sage/carbon-codemod/tree/master/transforms/add-prop");
25
- }
26
-
27
17
  return /*#__PURE__*/React.createElement(StyledNavigationBar, _extends({
28
18
  role: "navigation",
29
19
  "aria-label": ariaLabel,
30
20
  navigationType: navigationType,
31
21
  "data-component": "navigation-bar",
32
- stickyOffset: stickyOffset,
33
- stickyPosition: stickyPosition,
34
22
  position: position,
35
23
  offset: offset,
36
24
  orientation: orientation
@@ -1037,9 +1025,7 @@ NavigationBar.propTypes = {
1037
1025
  "description": PropTypes.string,
1038
1026
  "toString": PropTypes.func.isRequired,
1039
1027
  "valueOf": PropTypes.func.isRequired
1040
- }), PropTypes.string]),
1041
- "stickyOffset": PropTypes.string,
1042
- "stickyPosition": PropTypes.oneOf(["bottom", "top"])
1028
+ }), PropTypes.string])
1043
1029
  };
1044
1030
  export { NavigationBar };
1045
1031
  export default NavigationBar;
@@ -3,10 +3,6 @@ import { Position, Orientation, NavigationType } from "./navigation-bar.componen
3
3
  declare const StyledNavigationBar: import("styled-components").StyledComponent<"nav", any, PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
4
4
  /** Color scheme of navigation component */
5
5
  navigationType?: NavigationType | undefined;
6
- /** Defines the position of sticky navigation bar */
7
- stickyPosition?: Orientation | undefined;
8
- /** Defines the offset of sticky navigation bar */
9
- stickyOffset?: string | undefined;
10
6
  /** Defines whether the navigation bar should be positioned fixed or sticky */
11
7
  position?: Position | undefined;
12
8
  /** Defines the offset of navigation bar */
@@ -35,14 +35,6 @@ const StyledNavigationBar = styled.nav`
35
35
  margin-right: 10px;
36
36
  }
37
37
 
38
- ${({
39
- stickyPosition,
40
- stickyOffset
41
- }) => stickyPosition && css`
42
- position: sticky;
43
- ${stickyPosition}: ${stickyOffset};
44
- `}
45
-
46
38
  ${({
47
39
  position,
48
40
  orientation,
@@ -8,6 +8,7 @@ import { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverConta
8
8
  import Icon from "../icon";
9
9
  import createGuid from "../../__internal__/utils/helpers/guid";
10
10
  import { filterStyledSystemPaddingProps } from "../../style/utils";
11
+ import ClickAwayWrapper from "../../__internal__/click-away-wrapper";
11
12
  const paddingPropTypes = filterStyledSystemPaddingProps(styledSystemPropTypes.space);
12
13
 
13
14
  const PopoverContainer = ({
@@ -28,6 +29,7 @@ const PopoverContainer = ({
28
29
  }) => {
29
30
  const isControlled = open !== undefined;
30
31
  const [isOpenInternal, setIsOpenInternal] = useState(false);
32
+ const ref = useRef();
31
33
  const closeButtonRef = useRef();
32
34
  const openButtonRef = useRef();
33
35
  const guid = useRef(createGuid());
@@ -68,10 +70,21 @@ const PopoverContainer = ({
68
70
  ref: closeButtonRef,
69
71
  ariaLabel: closeButtonAriaLabel
70
72
  };
71
- return /*#__PURE__*/React.createElement(PopoverContainerWrapperStyle, {
73
+
74
+ const handleClickAway = e => {
75
+ if (!isControlled) setIsOpenInternal(false);
76
+ if (onClose) onClose(e);
77
+ };
78
+
79
+ return /*#__PURE__*/React.createElement(ClickAwayWrapper, {
80
+ targets: [ref],
81
+ handleClickAway: handleClickAway,
82
+ eventTypeId: "mousedown"
83
+ }, /*#__PURE__*/React.createElement(PopoverContainerWrapperStyle, {
72
84
  "data-component": "popover-container",
73
85
  role: "region",
74
- "aria-labelledby": popoverContainerId
86
+ "aria-labelledby": popoverContainerId,
87
+ ref: ref
75
88
  }, renderOpenComponent(renderOpenComponentProps), /*#__PURE__*/React.createElement(Transition, {
76
89
  in: isOpen,
77
90
  timeout: {
@@ -95,7 +108,7 @@ const PopoverContainer = ({
95
108
  }, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(PopoverContainerHeaderStyle, null, /*#__PURE__*/React.createElement(PopoverContainerTitleStyle, {
96
109
  id: popoverContainerId,
97
110
  "data-element": "popover-container-title"
98
- }, title), renderCloseComponent(renderCloseComponentProps)), children)));
111
+ }, title), renderCloseComponent(renderCloseComponentProps)), children))));
99
112
  };
100
113
 
101
114
  PopoverContainer.propTypes = { ...paddingPropTypes,
@@ -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 */
@@ -1,13 +1,15 @@
1
1
  export default SidebarHeader;
2
- declare function SidebarHeader({ className, children, ...props }: {
2
+ declare function SidebarHeader({ className, children, id, ...props }: {
3
3
  [x: string]: any;
4
4
  className: any;
5
5
  children: any;
6
+ id: any;
6
7
  }): JSX.Element;
7
8
  declare namespace SidebarHeader {
8
9
  namespace propTypes {
9
10
  const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
10
11
  const className: PropTypes.Requireable<string>;
12
+ const id: PropTypes.Requireable<string>;
11
13
  }
12
14
  }
13
15
  import PropTypes from "prop-types";
@@ -8,9 +8,11 @@ import SidebarHeaderStyle from "./sidebar-header.style";
8
8
  const SidebarHeader = ({
9
9
  className,
10
10
  children,
11
+ id,
11
12
  ...props
12
13
  }) => /*#__PURE__*/React.createElement(SidebarHeaderStyle, _extends({
13
- className: className
14
+ className: className,
15
+ id: id
14
16
  }, tagComponent("sidebar-header", props)), children);
15
17
 
16
18
  SidebarHeader.propTypes = {
@@ -18,6 +20,9 @@ SidebarHeader.propTypes = {
18
20
  children: PropTypes.node,
19
21
 
20
22
  /** A custom class name. */
21
- className: PropTypes.string
23
+ className: PropTypes.string,
24
+
25
+ /** A custom id. */
26
+ id: PropTypes.string
22
27
  };
23
28
  export default SidebarHeader;
@@ -10,6 +10,7 @@ import FocusTrap from "../../__internal__/focus-trap";
10
10
  import SidebarHeader from "./__internal__/sidebar-header";
11
11
  import Box from "../box";
12
12
  import { SIDEBAR_SIZES, SIDEBAR_ALIGNMENTS } from "./sidebar.config";
13
+ import createGuid from "../../__internal__/utils/helpers/guid";
13
14
  import useLocale from "../../hooks/__internal__/useLocale";
14
15
  export const SidebarContext = /*#__PURE__*/React.createContext({});
15
16
  const Sidebar = /*#__PURE__*/React.forwardRef(({
@@ -28,6 +29,9 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
28
29
  ...rest
29
30
  }, ref) => {
30
31
  const locale = useLocale();
32
+ const {
33
+ current: titleId
34
+ } = useRef(createGuid());
31
35
  let sidebarRef = useRef();
32
36
  if (ref) sidebarRef = ref;
33
37
 
@@ -51,14 +55,16 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
51
55
  "aria-modal": !enableBackgroundUI,
52
56
  "aria-describedby": ariaDescribedBy,
53
57
  "aria-label": ariaLabel,
54
- "aria-labelledby": ariaLabelledBy,
58
+ "aria-labelledby": !ariaLabelledBy && !ariaLabel ? titleId : ariaLabelledBy,
55
59
  ref: sidebarRef,
56
60
  position: position,
57
61
  size: size,
58
62
  "data-element": "sidebar",
59
63
  onCancel: onCancel,
60
64
  role: role
61
- }, closeIcon(), header && /*#__PURE__*/React.createElement(SidebarHeader, null, header), /*#__PURE__*/React.createElement(Box, {
65
+ }, header && /*#__PURE__*/React.createElement(SidebarHeader, {
66
+ id: titleId
67
+ }, header), closeIcon(), /*#__PURE__*/React.createElement(Box, {
62
68
  "data-element": "sidebar-content",
63
69
  p: 4,
64
70
  pt: "27px",
@@ -77,7 +83,8 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
77
83
  enableBackgroundUI: enableBackgroundUI,
78
84
  className: "carbon-sidebar"
79
85
  }, componentTags), enableBackgroundUI ? sidebar : /*#__PURE__*/React.createElement(FocusTrap, {
80
- wrapperRef: sidebarRef
86
+ wrapperRef: sidebarRef,
87
+ isOpen: open
81
88
  }, sidebar));
82
89
  });
83
90
  Sidebar.propTypes = {
@@ -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;