@carbon/ibm-products 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. package/css/index-full-carbon.css +27 -130
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +27 -130
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +2 -2
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +27 -130
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +2 -2
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/APIKeyModal/APIKeyModal.js +10 -13
  14. package/es/components/ActionBar/ActionBar.js +0 -3
  15. package/es/components/ActionBar/ActionBarItem.js +2 -6
  16. package/es/components/ActionSet/ActionSet.js +10 -12
  17. package/es/components/AddSelect/AddSelect.js +7 -5
  18. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
  19. package/es/components/ButtonMenu/ButtonMenu.js +6 -4
  20. package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
  21. package/es/components/Card/Card.js +31 -21
  22. package/es/components/Card/CardFooter.js +14 -10
  23. package/es/components/Card/CardHeader.js +8 -6
  24. package/es/components/Cascade/Cascade.js +5 -4
  25. package/es/components/ComboButton/ComboButton.js +0 -4
  26. package/es/components/ComboButton/ComboButtonItem/index.js +0 -5
  27. package/es/components/CreateFullPage/CreateFullPageStep.js +15 -8
  28. package/es/components/CreateModal/CreateModal.js +1 -4
  29. package/es/components/CreateTearsheet/CreateTearsheet.js +10 -11
  30. package/es/components/CreateTearsheet/CreateTearsheetStep.js +18 -14
  31. package/es/components/DataSpreadsheet/DataSpreadsheet.js +340 -80
  32. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +138 -0
  33. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +64 -0
  34. package/es/components/DataSpreadsheet/createActiveCellFn.js +45 -0
  35. package/es/components/DataSpreadsheet/getCellSize.js +30 -0
  36. package/es/components/EditSidePanel/EditSidePanel.js +9 -10
  37. package/es/components/EmptyStates/EmptyState.js +7 -6
  38. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
  39. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
  40. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
  41. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
  42. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
  43. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
  44. package/es/components/ExampleComponent/ExampleComponent.js +12 -13
  45. package/es/components/ExportModal/ExportModal.js +13 -9
  46. package/es/components/ExpressiveCard/ExpressiveCard.js +0 -8
  47. package/es/components/ImportModal/ImportModal.js +7 -5
  48. package/es/components/InlineEdit/InlineEdit.js +11 -13
  49. package/es/components/LoadingBar/LoadingBar.js +13 -17
  50. package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
  51. package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
  52. package/es/components/ModifiedTabs/ModifiedTabs.js +24 -18
  53. package/es/components/NotificationsPanel/NotificationsPanel.js +109 -86
  54. package/es/components/OptionsTile/OptionsTile.js +6 -9
  55. package/es/components/PageHeader/PageHeader.js +10 -7
  56. package/es/components/ProductiveCard/ProductiveCard.js +23 -12
  57. package/es/components/RemoveModal/RemoveModal.js +0 -3
  58. package/es/components/SidePanel/SidePanel.js +22 -17
  59. package/es/components/TagSet/TagSet.js +13 -9
  60. package/es/components/TagSet/TagSetModal.js +16 -12
  61. package/es/components/TagSet/TagSetOverflow.js +21 -13
  62. package/es/components/Tearsheet/Tearsheet.js +27 -18
  63. package/es/components/Tearsheet/TearsheetNarrow.js +18 -15
  64. package/es/components/Toolbar/ToolbarButton.js +0 -3
  65. package/es/components/WebTerminal/WebTerminal.js +17 -18
  66. package/es/components/index.js +0 -1
  67. package/es/global/js/hooks/index.js +1 -0
  68. package/es/global/js/hooks/useActiveElement.js +27 -0
  69. package/es/global/js/utils/Wrap.js +7 -5
  70. package/lib/components/APIKeyModal/APIKeyModal.js +10 -13
  71. package/lib/components/ActionBar/ActionBar.js +0 -3
  72. package/lib/components/ActionBar/ActionBarItem.js +2 -6
  73. package/lib/components/ActionSet/ActionSet.js +10 -12
  74. package/lib/components/AddSelect/AddSelect.js +7 -5
  75. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
  76. package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
  77. package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
  78. package/lib/components/Card/Card.js +31 -21
  79. package/lib/components/Card/CardFooter.js +14 -10
  80. package/lib/components/Card/CardHeader.js +8 -6
  81. package/lib/components/Cascade/Cascade.js +5 -4
  82. package/lib/components/ComboButton/ComboButton.js +0 -4
  83. package/lib/components/ComboButton/ComboButtonItem/index.js +0 -5
  84. package/lib/components/CreateFullPage/CreateFullPageStep.js +17 -14
  85. package/lib/components/CreateModal/CreateModal.js +1 -4
  86. package/lib/components/CreateTearsheet/CreateTearsheet.js +10 -11
  87. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +20 -20
  88. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +342 -75
  89. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +161 -0
  90. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +80 -0
  91. package/lib/components/DataSpreadsheet/createActiveCellFn.js +56 -0
  92. package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
  93. package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
  94. package/lib/components/EmptyStates/EmptyState.js +9 -8
  95. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +3 -7
  96. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +3 -7
  97. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +3 -7
  98. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +3 -7
  99. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +3 -7
  100. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +3 -7
  101. package/lib/components/ExampleComponent/ExampleComponent.js +12 -13
  102. package/lib/components/ExportModal/ExportModal.js +13 -9
  103. package/lib/components/ExpressiveCard/ExpressiveCard.js +0 -8
  104. package/lib/components/ImportModal/ImportModal.js +7 -5
  105. package/lib/components/InlineEdit/InlineEdit.js +11 -13
  106. package/lib/components/LoadingBar/LoadingBar.js +13 -17
  107. package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
  108. package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
  109. package/lib/components/ModifiedTabs/ModifiedTabs.js +24 -18
  110. package/lib/components/NotificationsPanel/NotificationsPanel.js +109 -86
  111. package/lib/components/OptionsTile/OptionsTile.js +6 -9
  112. package/lib/components/PageHeader/PageHeader.js +9 -6
  113. package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
  114. package/lib/components/RemoveModal/RemoveModal.js +0 -3
  115. package/lib/components/SidePanel/SidePanel.js +22 -17
  116. package/lib/components/TagSet/TagSet.js +13 -9
  117. package/lib/components/TagSet/TagSetModal.js +17 -13
  118. package/lib/components/TagSet/TagSetOverflow.js +24 -19
  119. package/lib/components/Tearsheet/Tearsheet.js +26 -17
  120. package/lib/components/Tearsheet/TearsheetNarrow.js +18 -15
  121. package/lib/components/Toolbar/ToolbarButton.js +0 -3
  122. package/lib/components/WebTerminal/WebTerminal.js +17 -18
  123. package/lib/components/index.js +0 -8
  124. package/lib/global/js/hooks/index.js +8 -0
  125. package/lib/global/js/hooks/useActiveElement.js +39 -0
  126. package/lib/global/js/utils/Wrap.js +7 -5
  127. package/package.json +8 -8
  128. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +26 -3
  129. package/scss/components/InlineEdit/_inline-edit.scss +5 -0
  130. package/scss/components/_index.scss +0 -1
  131. package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
  132. package/es/components/CancelableTextEdit/index.js +0 -7
  133. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
  134. package/lib/components/CancelableTextEdit/index.js +0 -13
  135. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -212
  136. package/scss/components/CancelableTextEdit/_index.scss +0 -8
  137. package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -8
@@ -1,5 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowDirection", "overflowTags", "showAllTagsLabel"];
3
6
  //
4
7
  // Copyright IBM Corp. 2021, 2021
5
8
  //
@@ -13,15 +16,25 @@ import { Link, Tag, Tooltip } from 'carbon-components-react';
13
16
  import { pkg } from '../../settings';
14
17
  import { noop } from '../../global/js/utils/pconsole';
15
18
  var componentName = 'TagSetOverflow';
16
- var blockClass = "".concat(pkg.prefix, "--tag-set-overflow");
19
+ var blockClass = "".concat(pkg.prefix, "--tag-set-overflow"); // Default values for props
20
+
21
+ var defaults = {
22
+ allTagsModalSearchThreshold: 10,
23
+ overflowAlign: 'center',
24
+ overflowDirection: 'bottom'
25
+ };
17
26
  export var TagSetOverflow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
18
- var className = _ref.className,
19
- overflowTags = _ref.overflowTags,
27
+ var _ref$allTagsModalSear = _ref.allTagsModalSearchThreshold,
28
+ allTagsModalSearchThreshold = _ref$allTagsModalSear === void 0 ? defaults.allTagsModalSearchThreshold : _ref$allTagsModalSear,
29
+ className = _ref.className,
20
30
  onShowAllClick = _ref.onShowAllClick,
21
- overflowAlign = _ref.overflowAlign,
22
- overflowDirection = _ref.overflowDirection,
31
+ _ref$overflowAlign = _ref.overflowAlign,
32
+ overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
33
+ _ref$overflowDirectio = _ref.overflowDirection,
34
+ overflowDirection = _ref$overflowDirectio === void 0 ? defaults.overflowDirection : _ref$overflowDirectio,
35
+ overflowTags = _ref.overflowTags,
23
36
  showAllTagsLabel = _ref.showAllTagsLabel,
24
- allTagsModalSearchThreshold = _ref.allTagsModalSearchThreshold;
37
+ rest = _objectWithoutProperties(_ref, _excluded);
25
38
 
26
39
  var _useState = useState(false),
27
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -42,11 +55,11 @@ export var TagSetOverflow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
42
55
  onShowAllClick();
43
56
  };
44
57
 
45
- return /*#__PURE__*/React.createElement("span", {
58
+ return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
46
59
  "aria-hidden": overflowTags.length === 0,
47
60
  className: cx("".concat(blockClass), _defineProperty({}, "".concat(blockClass, "--hidden"), overflowTags.length === 0)),
48
61
  ref: ref
49
- }, /*#__PURE__*/React.createElement(Tooltip, {
62
+ }), /*#__PURE__*/React.createElement(Tooltip, {
50
63
  align: overflowAlign,
51
64
  className: cx(className, "".concat(blockClass, "__tooltip")),
52
65
  direction: overflowDirection,
@@ -113,9 +126,4 @@ TagSetOverflow.propTypes = {
113
126
  * label for the overflow show all tags link
114
127
  */
115
128
  showAllTagsLabel: PropTypes.string
116
- };
117
- TagSetOverflow.defaultProps = {
118
- allTagsModalSearchThreshold: 10,
119
- overflowAlign: 'center',
120
- overflowDirection: 'bottom'
121
129
  };
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["influencerPosition", "influencerWidth", "verticalPosition"];
3
4
 
4
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
6
 
@@ -16,14 +17,20 @@ import React from 'react'; // Other standard imports.
16
17
 
17
18
  import PropTypes from 'prop-types';
18
19
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
19
- import { allPropTypes, prepareProps } from '../../global/js/utils/props-helper';
20
+ import { allPropTypes } from '../../global/js/utils/props-helper';
20
21
  import { pkg } from '../../settings'; // Carbon and package components we use.
21
22
 
22
23
  import { Button } from 'carbon-components-react';
23
24
  import { ActionSet } from '../ActionSet';
24
25
  import { tearsheetHasCloseIcon, TearsheetShell } from './TearsheetShell';
25
26
  var componentName = 'Tearsheet'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
27
+ // Default values for props
26
28
 
29
+ var defaults = {
30
+ influencerPosition: 'left',
31
+ influencerWidth: 'narrow',
32
+ verticalPosition: 'lower'
33
+ };
27
34
  /**
28
35
  * A tearsheet is a mostly full-screen type of dialog that keeps users
29
36
  * in-context and focused by bringing actionable content front and center while
@@ -37,11 +44,22 @@ var componentName = 'Tearsheet'; // NOTE: the component SCSS is not imported her
37
44
  * action buttons.
38
45
  */
39
46
 
40
- export var Tearsheet = /*#__PURE__*/React.forwardRef(function (props, ref) {
41
- return /*#__PURE__*/React.createElement(TearsheetShell, _extends({}, getDevtoolsProps(componentName), prepareProps(props, [], {
47
+ export var Tearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
48
+ var _ref$influencerPositi = _ref.influencerPosition,
49
+ influencerPosition = _ref$influencerPositi === void 0 ? defaults.influencerPosition : _ref$influencerPositi,
50
+ _ref$influencerWidth = _ref.influencerWidth,
51
+ influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
52
+ _ref$verticalPosition = _ref.verticalPosition,
53
+ verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
54
+ rest = _objectWithoutProperties(_ref, _excluded);
55
+
56
+ return /*#__PURE__*/React.createElement(TearsheetShell, _objectSpread(_objectSpread(_objectSpread({}, getDevtoolsProps(componentName)), rest), {}, {
57
+ influencerPosition: influencerPosition,
58
+ influencerWidth: influencerWidth,
59
+ verticalPosition: verticalPosition,
42
60
  ref: ref,
43
61
  size: 'wide'
44
- })));
62
+ }));
45
63
  }); // Return a placeholder if not released and not enabled by feature flag
46
64
 
47
65
  Tearsheet = pkg.checkComponentEnabled(Tearsheet, componentName); // The display name of the component, used by React. Note that displayName
@@ -100,9 +118,9 @@ Tearsheet.propTypes = _objectSpread({
100
118
  * **Note:** This prop is only required if a close icon is shown, i.e. if
101
119
  * there are a no navigation actions and/or hasCloseIcon is true.
102
120
  */
103
- closeIconDescription: PropTypes.string.isRequired.if(function (_ref) {
104
- var actions = _ref.actions,
105
- hasCloseIcon = _ref.hasCloseIcon;
121
+ closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
122
+ var actions = _ref2.actions,
123
+ hasCloseIcon = _ref2.hasCloseIcon;
106
124
  return tearsheetHasCloseIcon(actions, hasCloseIcon);
107
125
  }),
108
126
 
@@ -168,13 +186,4 @@ Tearsheet.propTypes = _objectSpread({
168
186
  * The main title of the tearsheet, displayed in the header area.
169
187
  */
170
188
  title: PropTypes.node
171
- }, deprecatedProps); // Default values for component props. Default values are not required for
172
- // props that are required, nor for props where the component can apply
173
- // 'undefined' values reasonably. Default values should be provided when the
174
- // component needs to make a choice or assumption when a prop is not supplied.
175
-
176
- Tearsheet.defaultProps = {
177
- influencerPosition: 'left',
178
- influencerWidth: 'narrow',
179
- verticalPosition: 'lower'
180
- };
189
+ }, deprecatedProps);
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["verticalPosition"];
3
4
 
4
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
6
 
@@ -23,7 +24,11 @@ import { Button } from 'carbon-components-react';
23
24
  import { ActionSet } from '../ActionSet';
24
25
  import { tearsheetHasCloseIcon, TearsheetShell, tearsheetShellWideProps as blocked } from './TearsheetShell';
25
26
  var componentName = 'TearsheetNarrow'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
27
+ // Default values for props
26
28
 
29
+ var defaults = {
30
+ verticalPosition: 'lower'
31
+ };
27
32
  /**
28
33
  * A narrow tearsheet is a slimmer variant of the tearsheet, providing a dialog
29
34
  * that keeps users in-context and focused by bringing actionable content front
@@ -33,11 +38,16 @@ var componentName = 'TearsheetNarrow'; // NOTE: the component SCSS is not import
33
38
  * main content area, and a set of action buttons.
34
39
  */
35
40
 
36
- export var TearsheetNarrow = /*#__PURE__*/React.forwardRef(function (props, ref) {
37
- return /*#__PURE__*/React.createElement(TearsheetShell, _extends({}, getDevtoolsProps(componentName), prepareProps(props, blocked, {
41
+ export var TearsheetNarrow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
42
+ var _ref$verticalPosition = _ref.verticalPosition,
43
+ verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
44
+ rest = _objectWithoutProperties(_ref, _excluded);
45
+
46
+ return /*#__PURE__*/React.createElement(TearsheetShell, _objectSpread(_objectSpread(_objectSpread({}, getDevtoolsProps(componentName)), prepareProps(rest, blocked)), {}, {
47
+ verticalPosition: verticalPosition,
38
48
  ref: ref,
39
49
  size: 'narrow'
40
- })));
50
+ }));
41
51
  }); // Return a placeholder if not released and not enabled by feature flag
42
52
 
43
53
  TearsheetNarrow = pkg.checkComponentEnabled(TearsheetNarrow, componentName); // The display name of the component, used by React. Note that displayName
@@ -96,9 +106,9 @@ TearsheetNarrow.propTypes = _objectSpread({
96
106
  * **Note:** This prop is only required if a close icon is shown, i.e. if
97
107
  * there are a no navigation actions and/or hasCloseIcon is true.
98
108
  */
99
- closeIconDescription: PropTypes.string.isRequired.if(function (_ref) {
100
- var actions = _ref.actions,
101
- hasCloseIcon = _ref.hasCloseIcon;
109
+ closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
110
+ var actions = _ref2.actions,
111
+ hasCloseIcon = _ref2.hasCloseIcon;
102
112
  return tearsheetHasCloseIcon(actions, hasCloseIcon);
103
113
  }),
104
114
 
@@ -138,11 +148,4 @@ TearsheetNarrow.propTypes = _objectSpread({
138
148
  * The main title of the tearsheet, displayed in the header area.
139
149
  */
140
150
  title: PropTypes.node
141
- }, deprecatedProps); // Default values for component props. Default values are not required for
142
- // props that are required, nor for props where the component can apply
143
- // 'undefined' values reasonably. Default values should be provided when the
144
- // component needs to make a choice or assumption when a prop is not supplied.
145
-
146
- TearsheetNarrow.defaultProps = {
147
- verticalPosition: 'lower'
148
- };
151
+ }, deprecatedProps);
@@ -50,8 +50,5 @@ ToolbarButton.propTypes = {
50
50
  /** Provide an optional class to be applied to the containing node */
51
51
  className: string
52
52
  };
53
- ToolbarButton.defaultProps = {
54
- caret: false
55
- };
56
53
  ToolbarButton = pkg.checkComponentEnabled(ToolbarButton, componentName);
57
54
  export { blockClass, ToolbarButton };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["children", "className", "closeTerminal", "documentationLinks", "documentationLinksIconDescription", "open", "actions", "closeIconDescription"];
5
+ var _excluded = ["actions", "children", "className", "closeIconDescription", "closeTerminal", "documentationLinks", "documentationLinksIconDescription", "open"];
6
6
 
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
8
 
@@ -25,18 +25,27 @@ import { Close16 as Close, Help16 as Help } from '@carbon/icons-react';
25
25
  import { Button, OverflowMenu, OverflowMenuItem } from 'carbon-components-react'; // The block part of our conventional BEM class names (blockClass__E--M).
26
26
 
27
27
  var componentName = 'WebTerminal';
28
- var blockClass = "".concat(pkg.prefix, "--web-terminal");
28
+ var blockClass = "".concat(pkg.prefix, "--web-terminal"); // Default values for props
29
+
30
+ var defaults = {
31
+ actions: Object.freeze([]),
32
+ documentationLinks: Object.freeze([]),
33
+ documentationLinksIconDescription: 'Show documentation links'
34
+ };
29
35
  export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
30
36
  var _ref2;
31
37
 
32
- var children = _ref.children,
38
+ var _ref$actions = _ref.actions,
39
+ actions = _ref$actions === void 0 ? defaults.actions : _ref$actions,
40
+ children = _ref.children,
33
41
  className = _ref.className,
42
+ closeIconDescription = _ref.closeIconDescription,
34
43
  closeTerminal = _ref.closeTerminal,
35
- documentationLinks = _ref.documentationLinks,
36
- documentationLinksIconDescription = _ref.documentationLinksIconDescription,
44
+ _ref$documentationLin = _ref.documentationLinks,
45
+ documentationLinks = _ref$documentationLin === void 0 ? defaults.documentationLinks : _ref$documentationLin,
46
+ _ref$documentationLin2 = _ref.documentationLinksIconDescription,
47
+ documentationLinksIconDescription = _ref$documentationLin2 === void 0 ? defaults.documentationLinksIconDescription : _ref$documentationLin2,
37
48
  open = _ref.open,
38
- actions = _ref.actions,
39
- closeIconDescription = _ref.closeIconDescription,
40
49
  rest = _objectWithoutProperties(_ref, _excluded);
41
50
 
42
51
  var _useState = useState(open),
@@ -61,7 +70,7 @@ export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
61
70
 
62
71
  return shouldRender ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
63
72
  ref: ref,
64
- className: cx([blockClass, (_ref2 = {}, _defineProperty(_ref2, "".concat(blockClass, "--open"), open), _defineProperty(_ref2, "".concat(blockClass, "--closed"), !open), _defineProperty(_ref2, className, className), _ref2)]),
73
+ className: cx([className, blockClass, (_ref2 = {}, _defineProperty(_ref2, "".concat(blockClass, "--open"), open), _defineProperty(_ref2, "".concat(blockClass, "--closed"), !open), _ref2)]),
65
74
  style: {
66
75
  animation: "".concat(open ? 'web-terminal-entrance 250ms' : 'web-terminal-exit 250ms')
67
76
  },
@@ -155,14 +164,4 @@ WebTerminal.propTypes = {
155
164
  * Boolean that determines if the web terminal is opened or closed
156
165
  */
157
166
  open: PropTypes.bool.isRequired
158
- }; // Default values for component props. Default values are not required for
159
- // props that are required, nor for props where the component can apply
160
- // 'undefined' values reasonably. Default values should be provided when the
161
- // component needs to make a choice or assumption when a prop is not supplied.
162
-
163
- WebTerminal.defaultProps = {
164
- actions: [],
165
- documentationLinks: [],
166
- documentationLinksIconDescription: 'Show documentation links',
167
- className: ''
168
167
  };
@@ -36,6 +36,5 @@ export { UserProfileImage } from './UserProfileImage';
36
36
  export { WebTerminal } from './WebTerminal';
37
37
  export { EditSidePanel } from './EditSidePanel';
38
38
  export { OptionsTile } from './OptionsTile';
39
- export { CancelableTextEdit } from './CancelableTextEdit';
40
39
  export { InlineEdit } from './InlineEdit';
41
40
  export { DataSpreadsheet } from './DataSpreadsheet';
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ export { useActiveElement } from './useActiveElement';
7
8
  export { useNearestScroll, useWindowScroll } from './useWindowScroll';
8
9
  export { useWindowResize } from './useWindowResize';
9
10
  export { useClickOutside } from './useClickOutside';
@@ -0,0 +1,27 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /**
4
+ * Copyright IBM Corp. 2022, 2022
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import { useState, useEffect } from 'react';
10
+ export var useActiveElement = function useActiveElement() {
11
+ var _useState = useState(document.activeElement),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ active = _useState2[0],
14
+ setActive = _useState2[1];
15
+
16
+ var handleFocusIn = function handleFocusIn() {
17
+ setActive(document.activeElement);
18
+ };
19
+
20
+ useEffect(function () {
21
+ document.addEventListener('focusin', handleFocusIn);
22
+ return function () {
23
+ document.removeEventListener('focusin', handleFocusIn);
24
+ };
25
+ }, []);
26
+ return active;
27
+ };
@@ -25,6 +25,11 @@ var isEmpty = function isEmpty(children) {
25
25
  }
26
26
  });
27
27
  return result;
28
+ }; // Default values for props
29
+
30
+
31
+ var defaults = {
32
+ element: 'div'
28
33
  };
29
34
  /**
30
35
  * A simple conditional wrapper that encloses its children in a <div> (or other
@@ -37,11 +42,11 @@ var isEmpty = function isEmpty(children) {
37
42
  * remain undefined if it does not render.
38
43
  */
39
44
 
40
-
41
45
  export var Wrap = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
42
46
  var alwaysRender = _ref.alwaysRender,
43
47
  children = _ref.children,
44
- Wrapper = _ref.element,
48
+ _ref$element = _ref.element,
49
+ Wrapper = _ref$element === void 0 ? defaults.element : _ref$element,
45
50
  neverRender = _ref.neverRender,
46
51
  rest = _objectWithoutProperties(_ref, _excluded);
47
52
 
@@ -79,7 +84,4 @@ Wrap.propTypes = {
79
84
  * content will be rendered.
80
85
  */
81
86
  neverRender: PropTypes.bool
82
- };
83
- Wrap.defaultProps = {
84
- element: 'div'
85
87
  };
@@ -51,18 +51,25 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
51
51
 
52
52
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
53
53
 
54
- var componentName = 'APIKeyModal';
54
+ var componentName = 'APIKeyModal'; // Default values for props
55
+
56
+ var defaults = {
57
+ apiKeyName: '',
58
+ customSteps: Object.freeze([])
59
+ };
55
60
  var APIKeyModal = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
56
61
  var apiKey = _ref.apiKey,
57
62
  apiKeyLabel = _ref.apiKeyLabel,
58
- apiKeyName = _ref.apiKeyName,
63
+ _ref$apiKeyName = _ref.apiKeyName,
64
+ apiKeyName = _ref$apiKeyName === void 0 ? defaults.apiKeyName : _ref$apiKeyName,
59
65
  body = _ref.body,
60
66
  className = _ref.className,
61
67
  closeButtonText = _ref.closeButtonText,
62
68
  copyButtonText = _ref.copyButtonText,
63
69
  copyErrorText = _ref.copyErrorText,
64
70
  copyIconDescription = _ref.copyIconDescription,
65
- customSteps = _ref.customSteps,
71
+ _ref$customSteps = _ref.customSteps,
72
+ customSteps = _ref$customSteps === void 0 ? defaults.customSteps : _ref$customSteps,
66
73
  downloadBodyText = _ref.downloadBodyText,
67
74
  downloadFileName = _ref.downloadFileName,
68
75
  downloadFileType = _ref.downloadFileType,
@@ -602,14 +609,4 @@ APIKeyModal.propTypes = {
602
609
  */
603
610
  showAPIKeyLabel: _propTypes.default.string
604
611
  };
605
- APIKeyModal.defaultProps = {
606
- apiKeyName: '',
607
- customSteps: [],
608
- error: false,
609
- hasAPIKeyVisibilityToggle: false,
610
- hasDownloadLink: false,
611
- loading: false,
612
- nameRequired: false,
613
- open: false
614
- };
615
612
  APIKeyModal.displayName = componentName;
@@ -291,7 +291,4 @@ ActionBar.propTypes = {
291
291
  * align tags to right of available space
292
292
  */
293
293
  rightAlign: _propTypes.default.bool
294
- };
295
- ActionBar.defaultProps = {
296
- rightAlign: false
297
294
  };
@@ -56,14 +56,11 @@ exports.ActionBarItem = ActionBarItem = _settings.pkg.checkComponentEnabled(Acti
56
56
 
57
57
  var reservedProps = ['hasIconOnly', 'kind', 'size', 'tooltipPosition', 'tooltipAlignment', 'type']; // Base props on Carbon Button
58
58
 
59
- var propTypes = _objectSpread({}, _carbonComponentsReact.Button.propTypes);
60
-
61
- var defaultProps = _objectSpread({}, _carbonComponentsReact.Button.defaultProps); // Remove reserved props
59
+ var propTypes = _objectSpread({}, _carbonComponentsReact.Button.propTypes); // Remove reserved props
62
60
 
63
61
 
64
62
  reservedProps.forEach(function (prop) {
65
63
  delete propTypes[prop];
66
- delete defaultProps[prop];
67
64
  });
68
65
  ActionBarItem.displayName = componentName;
69
66
  ActionBarItem.propTypes = _objectSpread(_objectSpread({}, propTypes), {}, {
@@ -103,5 +100,4 @@ ActionBarItem.propTypes = _objectSpread(_objectSpread({}, propTypes), {}, {
103
100
  * (inherited from Carbon Button)
104
101
  */
105
102
  renderIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
106
- });
107
- ActionBarItem.defaultProps = _objectSpread({}, defaultProps);
103
+ });
@@ -25,7 +25,7 @@ var _propsHelper = require("../../global/js/utils/props-helper");
25
25
 
26
26
  var _carbonComponentsReact = require("carbon-components-react");
27
27
 
28
- var _excluded = ["className", "disabled", "kind", "label", "loading", "onClick", "size"],
28
+ var _excluded = ["className", "disabled", "kind", "label", "loading"],
29
29
  _excluded2 = ["actions", "buttonSize", "className", "size"];
30
30
 
31
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -41,17 +41,13 @@ var ActionSetButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
41
41
  kind = _ref.kind,
42
42
  label = _ref.label,
43
43
  loading = _ref.loading,
44
- onClick = _ref.onClick,
45
- size = _ref.size,
46
44
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
47
45
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, rest, {
48
46
  isExpressive: true,
49
47
  className: (0, _classnames.default)(className, ["".concat(blockClass, "__action-button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__action-button--ghost"), kind === 'ghost' || kind === 'danger--ghost')]),
50
48
  disabled: disabled || loading || false,
51
49
  kind: kind,
52
- onClick: onClick,
53
- ref: ref,
54
- size: size
50
+ ref: ref
55
51
  }), label, loading && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.InlineLoading, null));
56
52
  });
57
53
 
@@ -65,6 +61,11 @@ var defaultKind = 'primary';
65
61
 
66
62
  var willStack = function willStack(size, numberOfActions) {
67
63
  return size === 'xs' || size === 'sm' || size === 'md' && numberOfActions > 2;
64
+ }; // Default values for props
65
+
66
+
67
+ var defaults = {
68
+ size: 'md'
68
69
  };
69
70
  /**
70
71
  * An ActionSet presents a set of action buttons, constructed from bundles
@@ -79,14 +80,14 @@ var willStack = function willStack(size, numberOfActions) {
79
80
  * right.
80
81
  */
81
82
 
82
-
83
83
  var ActionSet = /*#__PURE__*/_react.default.forwardRef(function (_ref3, ref) {
84
84
  var _actions$slice, _cx;
85
85
 
86
86
  var actions = _ref3.actions,
87
87
  buttonSize = _ref3.buttonSize,
88
88
  className = _ref3.className,
89
- size = _ref3.size,
89
+ _ref3$size = _ref3.size,
90
+ size = _ref3$size === void 0 ? defaults.size : _ref3$size,
90
91
  rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
91
92
  var buttons = actions && ((_actions$slice = actions.slice) === null || _actions$slice === void 0 ? void 0 : _actions$slice.call(actions, 0)) || []; // We stack the buttons in a xs/sm set, or if there are three or more in a md set.
92
93
 
@@ -147,7 +148,7 @@ ActionSet.validateActions = function (sizeFn) {
147
148
  var problems = [];
148
149
 
149
150
  if (actions > 0) {
150
- var size = sizeFn ? sizeFn(props) : props.size;
151
+ var size = sizeFn ? sizeFn(props) : props.size || defaults.size;
151
152
  var stacking = willStack(size, actions);
152
153
 
153
154
  var countActions = function countActions(kind) {
@@ -211,7 +212,4 @@ ActionSet.propTypes = {
211
212
  * different sizes, to make best use of the available space.
212
213
  */
213
214
  size: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg', 'xlg', 'max'])
214
- };
215
- ActionSet.defaultProps = {
216
- size: 'md'
217
215
  };
@@ -43,7 +43,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
43
43
 
44
44
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
45
 
46
- var componentName = 'AddSelect';
46
+ var componentName = 'AddSelect'; // Default values for props
47
+
48
+ var defaults = {
49
+ items: Object.freeze([])
50
+ };
47
51
  var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
48
52
  var _cx;
49
53
 
@@ -51,7 +55,8 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
51
55
  description = _ref.description,
52
56
  influencerTitle = _ref.influencerTitle,
53
57
  inputPlaceholder = _ref.inputPlaceholder,
54
- items = _ref.items,
58
+ _ref$items = _ref.items,
59
+ items = _ref$items === void 0 ? defaults.items : _ref$items,
55
60
  itemsLabel = _ref.itemsLabel,
56
61
  multi = _ref.multi,
57
62
  noResultsDescription = _ref.noResultsDescription,
@@ -224,7 +229,4 @@ AddSelect.propTypes = {
224
229
  textInputLabel: _propTypes.default.string,
225
230
  title: _propTypes.default.string
226
231
  };
227
- AddSelect.defaultProps = {
228
- items: []
229
- };
230
232
  AddSelect.displayName = componentName;
@@ -367,7 +367,4 @@ BreadcrumbWithOverflow.propTypes = {
367
367
  return breadcrumbs.length > 1;
368
368
  })
369
369
  };
370
- BreadcrumbWithOverflow.defaultProps = {
371
- noTrailingSlash: false
372
- };
373
370
  BreadcrumbWithOverflow.displayName = componentName;
@@ -25,7 +25,11 @@ var _excluded = ["children", "className", "iconDescription", "label", "menuOptio
25
25
  // The block part of our conventional BEM class names (blockClass__E--M).
26
26
  var blockClass = "".concat(_settings.pkg.prefix, "--button-menu");
27
27
  var componentName = 'ButtonMenu'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
28
+ // Default values for props
28
29
 
30
+ var defaults = {
31
+ size: 'default'
32
+ };
29
33
  /**
30
34
  * Combining a standard button with an overflow menu, this component appears
31
35
  * as a button and has all the usual carbon Button props and rendering, but
@@ -41,7 +45,8 @@ var ButtonMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
41
45
  label = _ref.label,
42
46
  menuOptionsClass = _ref.menuOptionsClass,
43
47
  Icon = _ref.renderIcon,
44
- size = _ref.size,
48
+ _ref$size = _ref.size,
49
+ size = _ref$size === void 0 ? defaults.size : _ref$size,
45
50
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
46
51
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.OverflowMenu, (0, _extends2.default)({}, rest, {
47
52
  className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
@@ -109,7 +114,4 @@ ButtonMenu.propTypes = {
109
114
  * value for the carbon Button component 'size' prop.
110
115
  */
111
116
  size: _carbonComponentsReact.Button.propTypes.size
112
- };
113
- ButtonMenu.defaultProps = {
114
- size: 'default'
115
117
  };
@@ -40,5 +40,4 @@ var ButtonMenuItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref
40
40
 
41
41
  exports.ButtonMenuItem = ButtonMenuItem;
42
42
  exports.ButtonMenuItem = ButtonMenuItem = _settings.pkg.checkComponentEnabled(ButtonMenuItem, componentName);
43
- ButtonMenuItem.propTypes = _carbonComponentsReact.OverflowMenuItem.propTypes;
44
- ButtonMenuItem.defaultProps = _carbonComponentsReact.OverflowMenuItem.defaultProps;
43
+ ButtonMenuItem.propTypes = _carbonComponentsReact.OverflowMenuItem.propTypes;