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
@@ -82,15 +82,6 @@ declare namespace I18nProvider {
82
82
  titleSelect: PropTypes.Requireable<PropTypes.InferProps<{
83
83
  deselect: PropTypes.Requireable<(...args: any[]) => any>;
84
84
  }>>;
85
- wizards: PropTypes.Requireable<PropTypes.InferProps<{
86
- multiStep: PropTypes.Requireable<PropTypes.InferProps<{
87
- buttons: PropTypes.Requireable<PropTypes.InferProps<{
88
- submit: PropTypes.Requireable<(...args: any[]) => any>;
89
- next: PropTypes.Requireable<(...args: any[]) => any>;
90
- back: PropTypes.Requireable<(...args: any[]) => any>;
91
- }>>;
92
- }>>;
93
- }>>;
94
85
  }>>;
95
86
  export { locale_1 as locale };
96
87
  export const children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
@@ -101,15 +101,6 @@ I18nProvider.propTypes = {
101
101
  }),
102
102
  titleSelect: _propTypes.default.shape({
103
103
  deselect: _propTypes.default.func
104
- }),
105
- wizards: _propTypes.default.shape({
106
- multiStep: _propTypes.default.shape({
107
- buttons: _propTypes.default.shape({
108
- submit: _propTypes.default.func,
109
- next: _propTypes.default.func,
110
- back: _propTypes.default.func
111
- })
112
- })
113
104
  })
114
105
  }),
115
106
  children: _propTypes.default.node.isRequired
@@ -27,6 +27,8 @@ var _scrollableBlock = _interopRequireDefault(require("../../scrollable-block"))
27
27
 
28
28
  var _submenu2 = _interopRequireDefault(require("./submenu.context"));
29
29
 
30
+ var _clickAwayWrapper = _interopRequireDefault(require("../../../../__internal__/click-away-wrapper"));
31
+
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
32
34
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -209,12 +211,11 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
209
211
  }
210
212
  }
211
213
  }, [submenuFocusIndex, submenuOpen, href, menuContext, arrayOfFormattedChildren, numberOfChildren, openSubmenu, closeSubmenu, onKeyDown, characterString, restartCharacterTimeout, startCharacterTimeout]);
212
- const onClickOutside = (0, _react.useCallback)(event => {
213
- if (!_events.default.composedPath(event).includes(submenuRef.current)) {
214
- document.removeEventListener("click", onClickOutside);
215
- closeSubmenu();
216
- }
217
- }, [closeSubmenu]);
214
+
215
+ const handleClickAway = () => {
216
+ document.removeEventListener("click", handleClickAway);
217
+ closeSubmenu();
218
+ };
218
219
 
219
220
  const handleClick = event => {
220
221
  if (clickToOpen) {
@@ -233,15 +234,6 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
233
234
  } // eslint-disable-next-line react-hooks/exhaustive-deps
234
235
 
235
236
  }, [characterString]);
236
- (0, _react.useEffect)(() => {
237
- if (submenuOpen) {
238
- document.addEventListener("click", onClickOutside);
239
- }
240
-
241
- return function cleanup() {
242
- document.removeEventListener("click", onClickOutside);
243
- };
244
- }, [onClickOutside, submenuOpen]);
245
237
 
246
238
  if (inFullscreenView) {
247
239
  return /*#__PURE__*/_react.default.createElement(_submenu.StyledSubmenuWrapper, {
@@ -275,7 +267,10 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
275
267
  }, child))));
276
268
  }
277
269
 
278
- return /*#__PURE__*/_react.default.createElement(_submenu.StyledSubmenuWrapper, {
270
+ return /*#__PURE__*/_react.default.createElement(_clickAwayWrapper.default, {
271
+ handleClickAway: handleClickAway,
272
+ targets: [submenuRef]
273
+ }, /*#__PURE__*/_react.default.createElement(_submenu.StyledSubmenuWrapper, {
279
274
  "data-component": "submenu-wrapper",
280
275
  onMouseOver: !clickToOpen ? () => openSubmenu() : undefined,
281
276
  onMouseLeave: () => closeSubmenu(),
@@ -313,7 +308,7 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
313
308
  updateFocusIndex: setSubmenuFocusIndex,
314
309
  itemIndex: child.type === _menuItem2.default ? index : undefined
315
310
  }
316
- }, child))));
311
+ }, child)))));
317
312
  });
318
313
 
319
314
  Submenu.propTypes = {
@@ -1,6 +1,5 @@
1
1
  export { default as Menu } from "./menu";
2
2
  export { default as MenuItem } from "./menu-item/menu-item";
3
3
  export { default as ScrollableBlock } from "./scrollable-block/scrollable-block";
4
- export { default as SubmenuBlock } from "./submenu-block/submenu-block";
5
4
  export { default as MenuDivider } from "./menu-divider/menu-divider";
6
5
  export { default as MenuSegmentTitle } from "./menu-segment-title/menu-segment-title";
@@ -15,12 +15,6 @@ Object.defineProperty(exports, "MenuItem", {
15
15
  return _menuItem.default;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "SubmenuBlock", {
19
- enumerable: true,
20
- get: function () {
21
- return _submenuBlock.default;
22
- }
23
- });
24
18
  Object.defineProperty(exports, "MenuDivider", {
25
19
  enumerable: true,
26
20
  get: function () {
@@ -50,8 +44,6 @@ var _menu = _interopRequireDefault(require("./menu.component"));
50
44
 
51
45
  var _menuItem = _interopRequireDefault(require("./menu-item/menu-item.component"));
52
46
 
53
- var _submenuBlock = _interopRequireDefault(require("./submenu-block/submenu-block.component"));
54
-
55
47
  var _menuDivider = _interopRequireDefault(require("./menu-divider/menu-divider.component"));
56
48
 
57
49
  var _menuSegmentTitle = _interopRequireDefault(require("./menu-segment-title/menu-segment-title.component"));
@@ -25,8 +25,6 @@ var _submenu = _interopRequireDefault(require("../__internal__/submenu/submenu.c
25
25
 
26
26
  var _submenu2 = _interopRequireDefault(require("../__internal__/submenu/submenu.context"));
27
27
 
28
- var _submenuBlock = _interopRequireDefault(require("../submenu-block/submenu-block.component"));
29
-
30
28
  var _menu2 = require("../menu.style");
31
29
 
32
30
  var _search = _interopRequireDefault(require("../../search"));
@@ -71,11 +69,6 @@ const MenuItem = ({
71
69
  } = menuContext;
72
70
 
73
71
  const childrenItems = _react.default.Children.map(children, child => {
74
- if (child && child.type === _submenuBlock.default) {
75
- const childArray = Array.isArray(child.props.children) ? child.props.children : [child.props.children];
76
- return [...childArray.map(innerChild => innerChild)];
77
- }
78
-
79
72
  if ((child === null || child === void 0 ? void 0 : child.type) === _search.default) {
80
73
  isChildSearch.current = true;
81
74
  }
@@ -6,5 +6,5 @@ export interface MultiActionButtonProps extends Omit<SplitButtonProps, "buttonTy
6
6
  /** Second text child, renders under main text, only when size is "large" */
7
7
  subtext?: string;
8
8
  }
9
- export declare const MultiActionButton: ({ align, disabled, as, buttonType, size, children, text, subtext, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
9
+ export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
10
10
  export default MultiActionButton;
@@ -21,8 +21,6 @@ var _utils = require("../../style/utils");
21
21
 
22
22
  var _focusTrapUtils = require("../../__internal__/focus-trap/focus-trap-utils");
23
23
 
24
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
25
-
26
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
25
 
28
26
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -31,12 +29,9 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
31
29
 
32
30
  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); }
33
31
 
34
- let deprecatedWarnTriggered = false;
35
-
36
32
  const MultiActionButton = ({
37
33
  align = "left",
38
34
  disabled,
39
- as,
40
35
  buttonType,
41
36
  size,
42
37
  children,
@@ -46,13 +41,6 @@ const MultiActionButton = ({
46
41
  "data-role": dataRole,
47
42
  ...rest
48
43
  }) => {
49
- if (!deprecatedWarnTriggered && as) {
50
- deprecatedWarnTriggered = true;
51
-
52
- _logger.default.deprecate( // eslint-disable-next-line max-len
53
- "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");
54
- }
55
-
56
44
  const ref = (0, _react.useRef)(null);
57
45
  const buttonRef = (0, _react.useRef)(null);
58
46
  const buttonContainer = (0, _react.useRef)(null);
@@ -211,7 +199,7 @@ const MultiActionButton = ({
211
199
  onFocus: focusMainButton,
212
200
  onBlur: blurMainButton,
213
201
  onKeyDown: handleMainButtonKeyDown,
214
- buttonType: buttonType || as,
202
+ buttonType,
215
203
  size,
216
204
  subtext,
217
205
  ...(!disabled && {
@@ -306,7 +294,6 @@ MultiActionButton.propTypes = {
306
294
  "aria-valuemin": _propTypes.default.number,
307
295
  "aria-valuenow": _propTypes.default.number,
308
296
  "aria-valuetext": _propTypes.default.string,
309
- "as": _propTypes.default.oneOf(["primary", "secondary"]),
310
297
  "autoCapitalize": _propTypes.default.string,
311
298
  "autoCorrect": _propTypes.default.string,
312
299
  "autoFocus": _propTypes.default.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;
@@ -11,40 +11,25 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _navigationBar = _interopRequireDefault(require("./navigation-bar.style"));
13
13
 
14
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
18
16
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
17
 
20
- let deprecatedWarnTriggered = false;
21
-
22
18
  const NavigationBar = ({
23
19
  navigationType = "light",
24
20
  isLoading = false,
25
21
  children,
26
22
  ariaLabel,
27
- stickyOffset = "0",
28
- stickyPosition,
29
23
  position,
30
24
  offset = "0",
31
25
  orientation,
32
26
  ...props
33
27
  }) => {
34
- if (!deprecatedWarnTriggered && stickyPosition) {
35
- deprecatedWarnTriggered = true;
36
-
37
- _logger.default.deprecate( // eslint-disable-next-line max-len
38
- "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");
39
- }
40
-
41
28
  return /*#__PURE__*/_react.default.createElement(_navigationBar.default, _extends({
42
29
  role: "navigation",
43
30
  "aria-label": ariaLabel,
44
31
  navigationType: navigationType,
45
32
  "data-component": "navigation-bar",
46
- stickyOffset: stickyOffset,
47
- stickyPosition: stickyPosition,
48
33
  position: position,
49
34
  offset: offset,
50
35
  orientation: orientation
@@ -1052,9 +1037,7 @@ NavigationBar.propTypes = {
1052
1037
  "description": _propTypes.default.string,
1053
1038
  "toString": _propTypes.default.func.isRequired,
1054
1039
  "valueOf": _propTypes.default.func.isRequired
1055
- }), _propTypes.default.string]),
1056
- "stickyOffset": _propTypes.default.string,
1057
- "stickyPosition": _propTypes.default.oneOf(["bottom", "top"])
1040
+ }), _propTypes.default.string])
1058
1041
  };
1059
1042
  var _default = NavigationBar;
1060
1043
  exports.default = _default;
@@ -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 */
@@ -49,14 +49,6 @@ const StyledNavigationBar = _styledComponents.default.nav`
49
49
  margin-right: 10px;
50
50
  }
51
51
 
52
- ${({
53
- stickyPosition,
54
- stickyOffset
55
- }) => stickyPosition && (0, _styledComponents.css)`
56
- position: sticky;
57
- ${stickyPosition}: ${stickyOffset};
58
- `}
59
-
60
52
  ${({
61
53
  position,
62
54
  orientation,
@@ -21,6 +21,8 @@ var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/gui
21
21
 
22
22
  var _utils = require("../../style/utils");
23
23
 
24
+ var _clickAwayWrapper = _interopRequireDefault(require("../../__internal__/click-away-wrapper"));
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -49,6 +51,7 @@ const PopoverContainer = ({
49
51
  }) => {
50
52
  const isControlled = open !== undefined;
51
53
  const [isOpenInternal, setIsOpenInternal] = (0, _react.useState)(false);
54
+ const ref = (0, _react.useRef)();
52
55
  const closeButtonRef = (0, _react.useRef)();
53
56
  const openButtonRef = (0, _react.useRef)();
54
57
  const guid = (0, _react.useRef)((0, _guid.default)());
@@ -89,10 +92,21 @@ const PopoverContainer = ({
89
92
  ref: closeButtonRef,
90
93
  ariaLabel: closeButtonAriaLabel
91
94
  };
92
- return /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerWrapperStyle, {
95
+
96
+ const handleClickAway = e => {
97
+ if (!isControlled) setIsOpenInternal(false);
98
+ if (onClose) onClose(e);
99
+ };
100
+
101
+ return /*#__PURE__*/_react.default.createElement(_clickAwayWrapper.default, {
102
+ targets: [ref],
103
+ handleClickAway: handleClickAway,
104
+ eventTypeId: "mousedown"
105
+ }, /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerWrapperStyle, {
93
106
  "data-component": "popover-container",
94
107
  role: "region",
95
- "aria-labelledby": popoverContainerId
108
+ "aria-labelledby": popoverContainerId,
109
+ ref: ref
96
110
  }, renderOpenComponent(renderOpenComponentProps), /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, {
97
111
  in: isOpen,
98
112
  timeout: {
@@ -116,7 +130,7 @@ const PopoverContainer = ({
116
130
  }, (0, _utils.filterStyledSystemPaddingProps)(rest)), /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerHeaderStyle, null, /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerTitleStyle, {
117
131
  id: popoverContainerId,
118
132
  "data-element": "popover-container-title"
119
- }, title), renderCloseComponent(renderCloseComponentProps)), children)));
133
+ }, title), renderCloseComponent(renderCloseComponentProps)), children))));
120
134
  };
121
135
 
122
136
  PopoverContainer.propTypes = { ...paddingPropTypes,
@@ -17,7 +17,7 @@ var _fieldset = _interopRequireDefault(require("../../__internal__/fieldset"));
17
17
 
18
18
  var _radioButtonGroup = _interopRequireDefault(require("./radio-button-group.style"));
19
19
 
20
- var _radioButtonMapper = _interopRequireDefault(require("./radio-button-mapper.component"));
20
+ var _radioButtonMapper = _interopRequireDefault(require("../../__internal__/radio-button-mapper/radio-button-mapper.component"));
21
21
 
22
22
  var _useIsAboveBreakpoint = _interopRequireDefault(require("../../hooks/__internal__/useIsAboveBreakpoint"));
23
23
 
@@ -258,7 +258,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
258
258
  }
259
259
 
260
260
  setListHeight(`${newHeight}px`);
261
- }, [children, listRef.current]);
261
+ }, [children]);
262
262
  (0, _react.useEffect)(() => {
263
263
  const keyboardEvent = "keydown";
264
264
  const listElement = listRef.current;
@@ -365,7 +365,7 @@ SelectList.propTypes = {
365
365
  /** The Id of the label */
366
366
  labelId: _propTypes.default.string,
367
367
 
368
- /** Child components (such as <Option>) for the <ScrollableList> */
368
+ /** Child components (such as <Option>) */
369
369
  children: _propTypes.default.node,
370
370
 
371
371
  /** Boolean to toggle where DatePicker is rendered in relation to the Date Input */
@@ -19,7 +19,7 @@ var _fieldset = _interopRequireDefault(require("../../__internal__/fieldset"));
19
19
 
20
20
  var _simpleColor = _interopRequireDefault(require("./simple-color"));
21
21
 
22
- var _radioButtonMapper = _interopRequireDefault(require("../radio-button/radio-button-mapper.component"));
22
+ var _radioButtonMapper = _interopRequireDefault(require("../../__internal__/radio-button-mapper/radio-button-mapper.component"));
23
23
 
24
24
  var _simpleColorPicker = require("./simple-color-picker.style");
25
25
 
@@ -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 */
@@ -35,8 +35,6 @@ var _themes = require("../../style/themes");
35
35
 
36
36
  var _focusTrapUtils = require("../../__internal__/focus-trap/focus-trap-utils");
37
37
 
38
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
39
-
40
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
39
 
42
40
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -47,11 +45,9 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
47
45
 
48
46
  const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
49
47
  const CONTENT_WIDTH_RATIO = 0.75;
50
- let deprecatedWarnTriggered = false;
51
48
 
52
49
  const SplitButton = ({
53
50
  align = "left",
54
- as,
55
51
  buttonType = "secondary",
56
52
  children,
57
53
  disabled = false,
@@ -65,13 +61,6 @@ const SplitButton = ({
65
61
  "data-role": dataRole,
66
62
  ...rest
67
63
  }) => {
68
- if (!deprecatedWarnTriggered && as) {
69
- deprecatedWarnTriggered = true;
70
-
71
- _logger.default.deprecate( // eslint-disable-next-line max-len
72
- "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");
73
- }
74
-
75
64
  const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _themes.baseTheme;
76
65
 
77
66
  const isToggleButtonFocused = (0, _react.useRef)(false);
@@ -159,7 +148,6 @@ const SplitButton = ({
159
148
  onFocus: hideButtons,
160
149
  onTouchStart: hideButtons,
161
150
  iconPosition,
162
- as,
163
151
  buttonType,
164
152
  disabled,
165
153
  iconType,
@@ -180,7 +168,7 @@ const SplitButton = ({
180
168
  isToggleButtonFocused.current = false;
181
169
  },
182
170
  onKeyDown: handleToggleButtonKeyDown,
183
- buttonType: as || buttonType,
171
+ buttonType,
184
172
  size
185
173
  };
186
174
 
@@ -204,7 +192,7 @@ const SplitButton = ({
204
192
  primary: theme.colors.white,
205
193
  secondary: theme.colors.primary
206
194
  };
207
- return colorsMap[as || buttonType];
195
+ return colorsMap[buttonType];
208
196
  }
209
197
 
210
198
  function renderMainButton() {
@@ -315,9 +303,6 @@ SplitButton.propTypes = { ...marginPropTypes,
315
303
  /** Button type: "primary" | "secondary" */
316
304
  buttonType: _propTypes.default.oneOf(["primary", "secondary"]),
317
305
 
318
- /** Button type: "primary" | "secondary" for legacy theme */
319
- as: _propTypes.default.oneOf(["primary", "secondary"]),
320
-
321
306
  /** The additional button to display. */
322
307
  children: _propTypes.default.node.isRequired,
323
308
 
@@ -342,6 +327,6 @@ SplitButton.propTypes = { ...marginPropTypes,
342
327
  /** Set align of the rendered content */
343
328
  align: _propTypes.default.oneOf(["left", "right"])
344
329
  };
345
- SplitButton.safeProps = ["buttonType", "as", "disabled", "size"];
330
+ SplitButton.safeProps = ["buttonType", "disabled", "size"];
346
331
  var _default = SplitButton;
347
332
  exports.default = _default;
@@ -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;
@@ -13,16 +13,11 @@ var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
13
13
 
14
14
  var _tileStyle = require("./tile.style.js");
15
15
 
16
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
17
-
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
17
 
20
18
  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); }
21
19
 
22
- let deprecatedWarnTriggered = false;
23
-
24
20
  const Tile = ({
25
- as,
26
21
  variant = "tile",
27
22
  p = 3,
28
23
  children,
@@ -30,13 +25,6 @@ const Tile = ({
30
25
  width,
31
26
  ...props
32
27
  }) => {
33
- if (!deprecatedWarnTriggered && as) {
34
- deprecatedWarnTriggered = true;
35
-
36
- _logger.default.deprecate( // eslint-disable-next-line max-len
37
- "The `as` prop is deprecated and will soon be removed from the `Tile` component interface. You should use the `variant` prop to achieve the same styling. The following codemod is available to help with updating your code https://github.com/Sage/carbon-codemod/tree/master/transforms/rename-prop");
38
- }
39
-
40
28
  const isHorizontal = () => orientation === "horizontal";
41
29
 
42
30
  const isVertical = () => orientation === "vertical";
@@ -66,7 +54,7 @@ const Tile = ({
66
54
  });
67
55
 
68
56
  return /*#__PURE__*/_react.default.createElement(_tileStyle.StyledTile, _extends({
69
- tileTheme: as || variant,
57
+ tileTheme: variant,
70
58
  width: width,
71
59
  "data-component": "tile",
72
60
  isHorizontal: isHorizontal(orientation),
@@ -78,9 +66,6 @@ Tile.propTypes = {
78
66
  /** Styled system spacing props */
79
67
  ..._propTypes2.default.space,
80
68
 
81
- /** Sets the theme of the tile - either 'tile' or 'transparent' */
82
- as: _propTypes.default.oneOf(["tile", "transparent"]),
83
-
84
69
  /** Sets the theme of the tile - either 'tile' or 'transparent' */
85
70
  variant: _propTypes.default.oneOf(["tile", "transparent"]),
86
71
 
@@ -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
  /**
@@ -15,7 +15,7 @@ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tag
15
15
 
16
16
  var _tileSelect = _interopRequireDefault(require("./tile-select.component"));
17
17
 
18
- var _radioButtonMapper = _interopRequireDefault(require("../radio-button/radio-button-mapper.component"));
18
+ var _radioButtonMapper = _interopRequireDefault(require("../../__internal__/radio-button-mapper/radio-button-mapper.component"));
19
19
 
20
20
  var _tileSelect2 = require("./tile-select.style");
21
21
 
@@ -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 */