carbon-react 106.6.1 → 106.6.4

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 (108) hide show
  1. package/esm/__spec_helper__/expect.d.ts +8 -1
  2. package/esm/__spec_helper__/expect.js +1 -5
  3. package/esm/__spec_helper__/test-utils.d.ts +71 -33
  4. package/esm/__spec_helper__/test-utils.js +63 -65
  5. package/esm/components/action-popover/action-popover-context.d.ts +7 -2
  6. package/esm/components/action-popover/action-popover-context.js +1 -1
  7. package/esm/components/action-popover/action-popover-divider/action-popover-divider.component.d.ts +1 -1
  8. package/esm/components/action-popover/action-popover-item/action-popover-item.component.d.ts +28 -41
  9. package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +99 -118
  10. package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +35 -2
  11. package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +42 -53
  12. package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +20 -18
  13. package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +13 -5
  14. package/esm/components/action-popover/action-popover-test.stories.js +76 -0
  15. package/esm/components/action-popover/action-popover.component.d.ts +30 -53
  16. package/esm/components/action-popover/action-popover.component.js +205 -67
  17. package/esm/components/action-popover/action-popover.style.d.ts +17 -11
  18. package/esm/components/action-popover/action-popover.style.js +20 -26
  19. package/esm/components/action-popover/index.d.ts +9 -5
  20. package/esm/components/box/box.component.d.ts +12 -1
  21. package/esm/components/box/box.component.js +12 -23
  22. package/esm/components/box/box.config.d.ts +10 -12
  23. package/esm/components/box/index.d.ts +2 -1
  24. package/esm/components/button-bar/button-bar-test.stories.js +122 -0
  25. package/esm/components/button-bar/button-bar.component.d.ts +12 -15
  26. package/esm/components/button-bar/button-bar.component.js +331 -33
  27. package/esm/components/button-bar/button-bar.config.d.ts +2 -2
  28. package/esm/components/button-bar/button-bar.style.d.ts +4 -4
  29. package/esm/components/button-bar/button-bar.style.js +18 -33
  30. package/esm/components/button-bar/index.d.ts +2 -1
  31. package/esm/components/dismissible-box/dismissible-box.style.d.ts +1 -2
  32. package/esm/components/drawer/drawer.style.d.ts +1 -2
  33. package/esm/components/duelling-picklist/picklist/picklist.style.d.ts +2 -3
  34. package/esm/components/flat-table/flat-table.style.d.ts +1 -2
  35. package/esm/components/form/form.component.js +2 -1
  36. package/esm/components/link/link.component.js +1 -5
  37. package/esm/components/menu/__internal__/spec-helper/index.js +2 -1
  38. package/esm/components/menu/__internal__/submenu/submenu.component.js +21 -4
  39. package/esm/components/menu/menu.component.js +2 -1
  40. package/esm/components/menu/scrollable-block/scrollable-block.component.js +4 -2
  41. package/esm/components/modal/modal.component.js +3 -60
  42. package/esm/components/toast/toast.component.js +3 -13
  43. package/esm/hooks/__internal__/useModalManager/index.d.ts +1 -0
  44. package/esm/hooks/__internal__/useModalManager/index.js +1 -0
  45. package/esm/hooks/__internal__/useModalManager/useModalManager.d.ts +3 -0
  46. package/esm/hooks/__internal__/useModalManager/useModalManager.js +66 -0
  47. package/lib/__spec_helper__/expect.d.ts +8 -1
  48. package/lib/__spec_helper__/expect.js +2 -4
  49. package/lib/__spec_helper__/test-utils.d.ts +71 -33
  50. package/lib/__spec_helper__/test-utils.js +63 -65
  51. package/lib/components/action-popover/action-popover-context.d.ts +7 -2
  52. package/lib/components/action-popover/action-popover-context.js +1 -1
  53. package/lib/components/action-popover/action-popover-divider/action-popover-divider.component.d.ts +1 -1
  54. package/lib/components/action-popover/action-popover-item/action-popover-item.component.d.ts +28 -41
  55. package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +100 -119
  56. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +35 -2
  57. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +44 -55
  58. package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +20 -18
  59. package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +13 -5
  60. package/lib/components/action-popover/action-popover-test.stories.js +95 -0
  61. package/lib/components/action-popover/action-popover.component.d.ts +30 -53
  62. package/lib/components/action-popover/action-popover.component.js +206 -71
  63. package/lib/components/action-popover/action-popover.style.d.ts +17 -11
  64. package/lib/components/action-popover/action-popover.style.js +21 -28
  65. package/lib/components/action-popover/index.d.ts +9 -5
  66. package/lib/components/box/box.component.d.ts +12 -1
  67. package/lib/components/box/box.component.js +13 -26
  68. package/lib/components/box/box.config.d.ts +10 -12
  69. package/lib/components/box/index.d.ts +2 -1
  70. package/lib/components/button-bar/button-bar-test.stories.js +145 -0
  71. package/lib/components/button-bar/button-bar.component.d.ts +12 -15
  72. package/lib/components/button-bar/button-bar.component.js +336 -35
  73. package/lib/components/button-bar/button-bar.config.d.ts +2 -2
  74. package/lib/components/button-bar/button-bar.style.d.ts +4 -4
  75. package/lib/components/button-bar/button-bar.style.js +18 -35
  76. package/lib/components/button-bar/index.d.ts +2 -1
  77. package/lib/components/dismissible-box/dismissible-box.style.d.ts +1 -2
  78. package/lib/components/drawer/drawer.style.d.ts +1 -2
  79. package/lib/components/duelling-picklist/picklist/picklist.style.d.ts +2 -3
  80. package/lib/components/flat-table/flat-table.style.d.ts +1 -2
  81. package/lib/components/form/form.component.js +2 -1
  82. package/lib/components/link/link.component.js +1 -5
  83. package/lib/components/menu/__internal__/spec-helper/index.js +2 -1
  84. package/lib/components/menu/__internal__/submenu/submenu.component.js +21 -4
  85. package/lib/components/menu/menu.component.js +2 -1
  86. package/lib/components/menu/scrollable-block/scrollable-block.component.js +4 -2
  87. package/lib/components/modal/modal.component.js +3 -62
  88. package/lib/components/toast/toast.component.js +4 -17
  89. package/lib/hooks/__internal__/useModalManager/index.d.ts +1 -0
  90. package/lib/hooks/__internal__/useModalManager/index.js +15 -0
  91. package/lib/hooks/__internal__/useModalManager/package.json +6 -0
  92. package/lib/hooks/__internal__/useModalManager/useModalManager.d.ts +3 -0
  93. package/lib/hooks/__internal__/useModalManager/useModalManager.js +79 -0
  94. package/package.json +5 -1
  95. package/esm/components/action-popover/action-popover-divider/action-popover-divider.d.ts +0 -12
  96. package/esm/components/action-popover/action-popover-item/action-popover-item.d.ts +0 -26
  97. package/esm/components/action-popover/action-popover-menu/action-popover-menu.d.ts +0 -33
  98. package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.d.ts +0 -13
  99. package/esm/components/action-popover/action-popover.d.ts +0 -39
  100. package/esm/components/box/box.d.ts +0 -31
  101. package/esm/components/button-bar/button-bar.d.ts +0 -24
  102. package/lib/components/action-popover/action-popover-divider/action-popover-divider.d.ts +0 -12
  103. package/lib/components/action-popover/action-popover-item/action-popover-item.d.ts +0 -26
  104. package/lib/components/action-popover/action-popover-menu/action-popover-menu.d.ts +0 -33
  105. package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.d.ts +0 -13
  106. package/lib/components/action-popover/action-popover.d.ts +0 -39
  107. package/lib/components/box/box.d.ts +0 -31
  108. package/lib/components/button-bar/button-bar.d.ts +0 -24
@@ -50,6 +50,7 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
50
50
  asPassiveItem,
51
51
  onSubmenuOpen,
52
52
  onSubmenuClose,
53
+ onClick,
53
54
  ...rest
54
55
  }, ref) => {
55
56
  const [blockDoubleFocus, setBlockDoubleFocus] = (0, _react.useState)(false);
@@ -214,6 +215,17 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
214
215
  closeSubmenu();
215
216
  }
216
217
  }, [closeSubmenu]);
218
+
219
+ const handleClick = event => {
220
+ if (clickToOpen) {
221
+ openSubmenu();
222
+ }
223
+
224
+ if (onClick) {
225
+ onClick(event);
226
+ }
227
+ };
228
+
217
229
  (0, _react.useEffect)(() => {
218
230
  if (characterString !== "") {
219
231
  const nextIndex = (0, _keyboardNavigation.characterNavigation)(characterString, _react.default.Children.toArray(formattedChildren), submenuFocusIndex);
@@ -267,7 +279,6 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
267
279
  "data-component": "submenu-wrapper",
268
280
  onMouseOver: !clickToOpen ? () => openSubmenu() : undefined,
269
281
  onMouseLeave: () => closeSubmenu(),
270
- onClick: clickToOpen ? () => openSubmenu() : undefined,
271
282
  ref: submenuRef,
272
283
  isSubmenuOpen: submenuOpen
273
284
  }, /*#__PURE__*/_react.default.createElement(_menuItem.default, _extends({}, rest, {
@@ -282,14 +293,17 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
282
293
  hasSubmenu: true,
283
294
  showDropdownArrow: showDropdownArrow,
284
295
  onKeyDown: handleKeyDown,
296
+ onClick: handleClick,
285
297
  clickToOpen: clickToOpen,
286
298
  href: href,
287
- maxWidth: maxWidth
299
+ maxWidth: maxWidth,
300
+ "aria-expanded": submenuOpen
288
301
  }), title), submenuOpen && /*#__PURE__*/_react.default.createElement(_submenu.StyledSubmenu, {
289
302
  "data-component": "submenu",
290
303
  submenuDirection: submenuDirection,
291
304
  variant: variant,
292
- menuType: menuContext.menuType
305
+ menuType: menuContext.menuType,
306
+ role: "list"
293
307
  }, _react.default.Children.map(children, (child, index) => /*#__PURE__*/_react.default.createElement(_submenu2.default.Provider, {
294
308
  value: {
295
309
  isFocused: !blockDoubleFocus && submenuFocusIndex === index,
@@ -347,7 +361,10 @@ Submenu.propTypes = {
347
361
  onSubmenuOpen: _propTypes.default.func,
348
362
 
349
363
  /** Callback triggered when submenu closes. Only valid with submenu prop */
350
- onSubmenuClose: _propTypes.default.func
364
+ onSubmenuClose: _propTypes.default.func,
365
+
366
+ /** Callback triggered when the top-level menu item is clicked */
367
+ onClick: _propTypes.default.func
351
368
  };
352
369
  var _default = Submenu;
353
370
  exports.default = _default;
@@ -61,7 +61,8 @@ const Menu = ({
61
61
  "data-component": "menu",
62
62
  menuType: menuType
63
63
  }, rest, {
64
- ref: ref
64
+ ref: ref,
65
+ role: "list"
65
66
  }), _react.default.Children.map(children, (child, index) => {
66
67
  const isFocused = focusedItemIndex === index;
67
68
  return /*#__PURE__*/_react.default.createElement(_menu2.default.Provider, {
@@ -47,12 +47,14 @@ const ScrollableBlock = ({
47
47
  return /*#__PURE__*/_react.default.createElement(_scrollableBlock.default, _extends({
48
48
  "data-component": "submenu-scrollable-block",
49
49
  menuType: menuContext.menuType,
50
- variant: variant
50
+ variant: variant,
51
+ role: "presentation"
51
52
  }, rest), /*#__PURE__*/_react.default.createElement(_box.default, {
52
53
  overflowY: "scroll",
53
54
  scrollVariant: scrollVariants[menuContext.menuType],
54
55
  height: height,
55
- p: 0
56
+ p: 0,
57
+ role: "presentation"
56
58
  }, _react.default.Children.map(children, (child, index) => {
57
59
  let isFocused = false;
58
60
  const blockItemFocused = focusIndex >= blockIndex;
@@ -17,7 +17,7 @@ var _portal = _interopRequireDefault(require("../portal"));
17
17
 
18
18
  var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
19
19
 
20
- var _modalManager = _interopRequireDefault(require("./__internal__/modal-manager"));
20
+ var _useModalManager = _interopRequireDefault(require("../../hooks/__internal__/useModalManager"));
21
21
 
22
22
  var _modal = require("./modal.style");
23
23
 
@@ -46,8 +46,6 @@ const Modal = ({
46
46
  const ref = (0, _react.useRef)();
47
47
  const backgroundNodeRef = (0, _react.useRef)();
48
48
  const contentNodeRef = (0, _react.useRef)();
49
- const listenerAdded = (0, _react.useRef)(false);
50
- const modalRegistered = (0, _react.useRef)(false);
51
49
  const [isAnimationComplete, setAnimationComplete] = (0, _react.useState)(false);
52
50
  const [triggerRefocusFlag, setTriggerRefocusFlag] = (0, _react.useState)(false);
53
51
  const {
@@ -73,69 +71,12 @@ const Modal = ({
73
71
  };
74
72
  }, [allowScroll, enableBackgroundUI]);
75
73
  const closeModal = (0, _react.useCallback)(ev => {
76
- const isTopmost = _modalManager.default.isTopmost(ref.current);
77
-
78
- if (onCancel && !disableClose && !disableEscKey && _events.default.isEscKey(ev) && isTopmost) {
74
+ if (onCancel && !disableClose && !disableEscKey && _events.default.isEscKey(ev)) {
79
75
  ev.stopImmediatePropagation();
80
76
  onCancel(ev);
81
77
  }
82
78
  }, [disableClose, disableEscKey, onCancel]);
83
- const addListener = (0, _react.useCallback)(() => {
84
- /* istanbul ignore else */
85
- if (!listenerAdded.current) {
86
- document.addEventListener("keyup", closeModal);
87
- listenerAdded.current = true;
88
- }
89
- }, [closeModal]);
90
- const removeListener = (0, _react.useCallback)(() => {
91
- if (listenerAdded.current) {
92
- document.removeEventListener("keyup", closeModal);
93
- listenerAdded.current = false;
94
- }
95
- }, [closeModal]);
96
- (0, _react.useEffect)(() => {
97
- if (open) {
98
- addListener();
99
- }
100
-
101
- if (!open) {
102
- removeListener();
103
- }
104
- }, [addListener, open, removeListener]);
105
- (0, _react.useEffect)(() => {
106
- return () => {
107
- removeListener();
108
- };
109
- }, [removeListener]);
110
- const registerModal = (0, _react.useCallback)(() => {
111
- /* istanbul ignore else */
112
- if (!modalRegistered.current) {
113
- _modalManager.default.addModal(ref.current, setTriggerRefocusFlag);
114
-
115
- modalRegistered.current = true;
116
- }
117
- }, []);
118
- const unregisterModal = (0, _react.useCallback)(() => {
119
- if (modalRegistered.current) {
120
- _modalManager.default.removeModal(ref.current);
121
-
122
- modalRegistered.current = false;
123
- }
124
- }, []);
125
- (0, _react.useEffect)(() => {
126
- if (open) {
127
- registerModal();
128
- }
129
-
130
- if (!open) {
131
- unregisterModal();
132
- }
133
- }, [open, registerModal, unregisterModal]);
134
- (0, _react.useEffect)(() => {
135
- return () => {
136
- unregisterModal();
137
- };
138
- }, [unregisterModal]);
79
+ (0, _useModalManager.default)(open, closeModal, ref, setTriggerRefocusFlag);
139
80
  let background;
140
81
  let content;
141
82
 
@@ -21,12 +21,12 @@ var _toast = require("./toast.style");
21
21
 
22
22
  var _iconButton = _interopRequireDefault(require("../icon-button"));
23
23
 
24
- var _modalManager = _interopRequireDefault(require("../modal/__internal__/modal-manager"));
25
-
26
24
  var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
27
25
 
28
26
  var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
29
27
 
28
+ var _useModalManager = _interopRequireDefault(require("../../hooks/__internal__/useModalManager"));
29
+
30
30
  var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -68,25 +68,12 @@ const Toast = ({
68
68
  return (0, _classnames.default)(className);
69
69
  }, [className]);
70
70
  const dismissToast = (0, _react.useCallback)(ev => {
71
- const isTopmost = _modalManager.default.isTopmost(toastRef.current);
72
-
73
- if (onDismiss && _events.default.isEscKey(ev) && isTopmost) {
71
+ if (onDismiss && _events.default.isEscKey(ev)) {
74
72
  ev.stopImmediatePropagation();
75
73
  onDismiss(ev);
76
74
  }
77
75
  }, [onDismiss]);
78
- (0, _react.useEffect)(() => {
79
- const currentElement = toastRef.current;
80
-
81
- _modalManager.default.addModal(currentElement);
82
-
83
- document.addEventListener("keyup", dismissToast);
84
- return () => {
85
- _modalManager.default.removeModal(currentElement);
86
-
87
- document.removeEventListener("keyup", dismissToast);
88
- };
89
- }, [dismissToast]);
76
+ (0, _useModalManager.default)(open, dismissToast, toastRef);
90
77
  (0, _react.useEffect)(() => {
91
78
  clearTimeout(timer.current);
92
79
 
@@ -0,0 +1 @@
1
+ export { default } from "./useModalManager";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useModalManager.default;
10
+ }
11
+ });
12
+
13
+ var _useModalManager = _interopRequireDefault(require("./useModalManager"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../../../../esm/hooks/__internal__/useModalManager/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const useModalManager: (open: boolean, closeModal: (e: KeyboardEvent) => void, modalRef: React.RefObject<HTMLElement>, setTriggerRefocusFlag?: ((flag: boolean) => void) | undefined) => void;
3
+ export default useModalManager;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _modalManager = _interopRequireDefault(require("../../../components/modal/__internal__/modal-manager"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const useModalManager = (open, closeModal, modalRef, setTriggerRefocusFlag) => {
15
+ const listenerAdded = (0, _react.useRef)(false);
16
+ const modalRegistered = (0, _react.useRef)(false);
17
+ const handleClose = (0, _react.useCallback)(ev => {
18
+ const isTopmost = _modalManager.default.isTopmost(modalRef.current);
19
+
20
+ if (isTopmost) {
21
+ closeModal(ev);
22
+ }
23
+ }, [modalRef, closeModal]);
24
+ const addListener = (0, _react.useCallback)(() => {
25
+ /* istanbul ignore else */
26
+ if (!listenerAdded.current) {
27
+ document.addEventListener("keyup", handleClose);
28
+ listenerAdded.current = true;
29
+ }
30
+ }, [handleClose]);
31
+ const removeListener = (0, _react.useCallback)(() => {
32
+ if (listenerAdded.current) {
33
+ document.removeEventListener("keyup", handleClose);
34
+ listenerAdded.current = false;
35
+ }
36
+ }, [handleClose]);
37
+ (0, _react.useEffect)(() => {
38
+ if (open) {
39
+ addListener();
40
+ } else {
41
+ removeListener();
42
+ }
43
+ }, [addListener, open, removeListener]);
44
+ (0, _react.useEffect)(() => {
45
+ return () => {
46
+ removeListener();
47
+ };
48
+ }, [removeListener]);
49
+ const registerModal = (0, _react.useCallback)(() => {
50
+ /* istanbul ignore else */
51
+ if (!modalRegistered.current) {
52
+ _modalManager.default.addModal(modalRef.current, setTriggerRefocusFlag);
53
+
54
+ modalRegistered.current = true;
55
+ }
56
+ }, [modalRef, setTriggerRefocusFlag]);
57
+ const unregisterModal = (0, _react.useCallback)(() => {
58
+ if (modalRegistered.current) {
59
+ _modalManager.default.removeModal(modalRef.current);
60
+
61
+ modalRegistered.current = false;
62
+ }
63
+ }, [modalRef]);
64
+ (0, _react.useEffect)(() => {
65
+ if (open) {
66
+ registerModal();
67
+ } else {
68
+ unregisterModal();
69
+ }
70
+ }, [open, registerModal, unregisterModal]);
71
+ (0, _react.useEffect)(() => {
72
+ return () => {
73
+ unregisterModal();
74
+ };
75
+ }, [unregisterModal]);
76
+ };
77
+
78
+ var _default = useModalManager;
79
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "106.6.1",
3
+ "version": "106.6.4",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -98,6 +98,7 @@
98
98
  "@types/react": "16.9.56",
99
99
  "@types/react-dom": "16.9.8",
100
100
  "@types/react-test-renderer": "^17.0.1",
101
+ "@types/sprintf-js": "^1.1.2",
101
102
  "@types/styled-components": "^5.1.9",
102
103
  "@types/uuid": "^8.3.3",
103
104
  "@typescript-eslint/eslint-plugin": "^5.4.0",
@@ -112,6 +113,7 @@
112
113
  "conventional-changelog-conventionalcommits": "^4.5.0",
113
114
  "core-js": "^3.20.3",
114
115
  "cross-env": "^5.2.0",
116
+ "css-loader": "4.0.0",
115
117
  "cypress": "^9.6.0",
116
118
  "cypress-axe": "^0.14.0",
117
119
  "cypress-cucumber-preprocessor": "^4.3.1",
@@ -138,6 +140,7 @@
138
140
  "eslint-plugin-react-hooks": "^4.2.0",
139
141
  "events": "~1.1.1",
140
142
  "fast-glob": "^3.2.7",
143
+ "file-loader": "^6.2.0",
141
144
  "fs-extra": "^10.0.0",
142
145
  "husky": "^4.3.6",
143
146
  "jest": "^26.6.3",
@@ -159,6 +162,7 @@
159
162
  "ts-node": "^10.4.0",
160
163
  "typescript": "^4.6.2",
161
164
  "typescript-to-proptypes": "^2.2.1",
165
+ "url-loader": "^4.1.1",
162
166
  "uuid": "^8.3.2",
163
167
  "webpack-dev-server": "^4.0.0"
164
168
  },
@@ -1,12 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
-
3
- declare function ActionPopoverDivider(
4
- attrs: StyledComponentProps<
5
- "div",
6
- Record<string, unknown>,
7
- Record<string, unknown>,
8
- ""
9
- >
10
- ): JSX.Element;
11
-
12
- export default ActionPopoverDivider;
@@ -1,26 +0,0 @@
1
- import { IconType } from "components/icon/icon";
2
- import * as React from "react";
3
- import { ActionPopoverMenuProps } from "../action-popover-menu/action-popover-menu";
4
-
5
- export interface ActionPopoverItemProps {
6
- /** The text label to display for this Item */
7
- children: string;
8
- /** Flag to indicate if item is disabled */
9
- disabled?: boolean;
10
- /** allows to provide download prop that works dependent with href */
11
- download?: boolean;
12
- /** allows to provide href prop */
13
- href?: string;
14
- /** The name of the icon to display next to the label */
15
- icon?: IconType;
16
- /** Callback to run when item is clicked */
17
- onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
18
- /** Submenu component for item */
19
- submenu?: React.ReactElement<ActionPopoverMenuProps>;
20
- }
21
-
22
- declare function MenuItem(props: ActionPopoverItemProps): JSX.Element;
23
- declare function ActionPopoverItem(props: ActionPopoverItemProps): JSX.Element;
24
-
25
- export { MenuItem };
26
- export default ActionPopoverItem;
@@ -1,33 +0,0 @@
1
- import * as React from "react";
2
- import ActionPopoverDivider from "../action-popover-divider/action-popover-divider";
3
- import { ActionPopoverItemProps } from "../action-popover-item/action-popover-item";
4
-
5
- type ActionPopoverChild =
6
- | React.ReactElement<ActionPopoverItemProps>
7
- | typeof ActionPopoverDivider
8
- | boolean
9
- | null
10
- | undefined;
11
-
12
- export interface ActionPopoverMenuProps {
13
- /** Children for the menu */
14
- children?: ActionPopoverChild | ActionPopoverChild[];
15
- /** Index to control which item is focused */
16
- focusIndex?: number;
17
- /** Flag to indicate whether a menu should open */
18
- isOpen?: boolean;
19
- /** A unique ID for the menu */
20
- menuID?: string;
21
- /** Callback to set the index of the focused item */
22
- setFocusIndex?: (args: number) => any;
23
- /** Callback to set the isOpen flag */
24
- setOpen?: (args: boolean) => any;
25
- /** Unique ID for the menu's parent */
26
- parentID?: string;
27
- }
28
-
29
- declare function ActionPopoverMenu(
30
- props: ActionPopoverMenuProps & React.RefAttributes<HTMLDivElement>
31
- ): JSX.Element;
32
-
33
- export default ActionPopoverMenu;
@@ -1,13 +0,0 @@
1
- export interface ActionPopoverMenuButtonProps {
2
- children?: string;
3
- buttonType?: string;
4
- iconType?: string;
5
- iconPosition?: string;
6
- size?: string;
7
- }
8
-
9
- declare function ActionPopoverMenuButton(
10
- props: ActionPopoverMenuButtonProps
11
- ): JSX.Element;
12
-
13
- export default ActionPopoverMenuButton;
@@ -1,39 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
- import ActionPopoverDivider from "./action-popover-divider/action-popover-divider";
4
- import { ActionPopoverItemProps } from "./action-popover-item/action-popover-item";
5
-
6
- export interface RenderButtonProps {
7
- tabIndex: number;
8
- "data-element": string;
9
- }
10
-
11
- type ActionPopoverChild =
12
- | React.ReactElement<ActionPopoverItemProps>
13
- | typeof ActionPopoverDivider
14
- | boolean
15
- | null
16
- | undefined;
17
-
18
- export interface ActionPopoverProps extends MarginProps {
19
- /** Children for popover component */
20
- children?: ActionPopoverChild | ActionPopoverChild[];
21
- /** Horizontal alignment of menu items content */
22
- horizontalAlignment?: "left" | "right";
23
- /** Unique ID */
24
- id?: string;
25
- /** Callback to be called on menu open */
26
- onOpen?: () => void;
27
- /** Callback to be called on menu close */
28
- onClose?: () => void;
29
- /** Set whether the menu should open above or below the button */
30
- placement?: "bottom" | "top";
31
- /** Render a custom menu button to override default ellipsis icon */
32
- renderButton?: (buttonProps: RenderButtonProps) => React.ReactNode;
33
- /** Boolean to control whether menu should align to right */
34
- rightAlignMenu?: boolean;
35
- }
36
-
37
- declare function ActionPopover(props: ActionPopoverProps): JSX.Element;
38
-
39
- export default ActionPopover;
@@ -1,31 +0,0 @@
1
- import * as React from "react";
2
- import { StyledComponentProps } from "styled-components";
3
- import {
4
- ColorProps,
5
- FlexboxProps,
6
- LayoutProps,
7
- SpaceProps,
8
- } from "styled-system";
9
-
10
- export interface BoxProps
11
- extends SpaceProps,
12
- ColorProps,
13
- LayoutProps,
14
- FlexboxProps {
15
- as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
16
- overflowWrap?: "break-word" | "anywhere";
17
- scrollVariant?: "light" | "dark";
18
- }
19
-
20
- /**
21
- * HTML color prop have to be removed from the StyledComponentProps
22
- * as it's type conflicts with StyledSystem color prop
23
- */
24
- type PropsWithoutColor = Omit<
25
- StyledComponentProps<"div", Record<string, unknown>, BoxProps, "">,
26
- "color"
27
- >;
28
-
29
- declare function Box(attrs: PropsWithoutColor & ColorProps): JSX.Element;
30
-
31
- export default Box;
@@ -1,24 +0,0 @@
1
- import Button from "components/button/button";
2
- import IconButton from "components/icon-button";
3
- import { SpaceProps } from "styled-system";
4
-
5
- type ButtonBarChild =
6
- | typeof Button
7
- | typeof IconButton
8
- | boolean
9
- | null
10
- | undefined;
11
-
12
- export interface ButtonBarProps extends SpaceProps {
13
- children: ButtonBarChild | ButtonBarChild[];
14
- /** Apply fullWidth style to the button bar */
15
- fullWidth?: boolean;
16
- /** Defines an Icon position for buttons: "before" | "after" */
17
- iconPosition?: "before" | "after";
18
- /** Assigns a size to the buttons: "small" | "medium" | "large" */
19
- size?: "small" | "medium" | "large";
20
- }
21
-
22
- declare function ButtonBar(props: ButtonBarProps): JSX.Element;
23
-
24
- export default ButtonBar;
@@ -1,12 +0,0 @@
1
- import { StyledComponentProps } from "styled-components";
2
-
3
- declare function ActionPopoverDivider(
4
- attrs: StyledComponentProps<
5
- "div",
6
- Record<string, unknown>,
7
- Record<string, unknown>,
8
- ""
9
- >
10
- ): JSX.Element;
11
-
12
- export default ActionPopoverDivider;
@@ -1,26 +0,0 @@
1
- import { IconType } from "components/icon/icon";
2
- import * as React from "react";
3
- import { ActionPopoverMenuProps } from "../action-popover-menu/action-popover-menu";
4
-
5
- export interface ActionPopoverItemProps {
6
- /** The text label to display for this Item */
7
- children: string;
8
- /** Flag to indicate if item is disabled */
9
- disabled?: boolean;
10
- /** allows to provide download prop that works dependent with href */
11
- download?: boolean;
12
- /** allows to provide href prop */
13
- href?: string;
14
- /** The name of the icon to display next to the label */
15
- icon?: IconType;
16
- /** Callback to run when item is clicked */
17
- onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
18
- /** Submenu component for item */
19
- submenu?: React.ReactElement<ActionPopoverMenuProps>;
20
- }
21
-
22
- declare function MenuItem(props: ActionPopoverItemProps): JSX.Element;
23
- declare function ActionPopoverItem(props: ActionPopoverItemProps): JSX.Element;
24
-
25
- export { MenuItem };
26
- export default ActionPopoverItem;
@@ -1,33 +0,0 @@
1
- import * as React from "react";
2
- import ActionPopoverDivider from "../action-popover-divider/action-popover-divider";
3
- import { ActionPopoverItemProps } from "../action-popover-item/action-popover-item";
4
-
5
- type ActionPopoverChild =
6
- | React.ReactElement<ActionPopoverItemProps>
7
- | typeof ActionPopoverDivider
8
- | boolean
9
- | null
10
- | undefined;
11
-
12
- export interface ActionPopoverMenuProps {
13
- /** Children for the menu */
14
- children?: ActionPopoverChild | ActionPopoverChild[];
15
- /** Index to control which item is focused */
16
- focusIndex?: number;
17
- /** Flag to indicate whether a menu should open */
18
- isOpen?: boolean;
19
- /** A unique ID for the menu */
20
- menuID?: string;
21
- /** Callback to set the index of the focused item */
22
- setFocusIndex?: (args: number) => any;
23
- /** Callback to set the isOpen flag */
24
- setOpen?: (args: boolean) => any;
25
- /** Unique ID for the menu's parent */
26
- parentID?: string;
27
- }
28
-
29
- declare function ActionPopoverMenu(
30
- props: ActionPopoverMenuProps & React.RefAttributes<HTMLDivElement>
31
- ): JSX.Element;
32
-
33
- export default ActionPopoverMenu;
@@ -1,13 +0,0 @@
1
- export interface ActionPopoverMenuButtonProps {
2
- children?: string;
3
- buttonType?: string;
4
- iconType?: string;
5
- iconPosition?: string;
6
- size?: string;
7
- }
8
-
9
- declare function ActionPopoverMenuButton(
10
- props: ActionPopoverMenuButtonProps
11
- ): JSX.Element;
12
-
13
- export default ActionPopoverMenuButton;