@carbon/ibm-products 1.6.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/css/index-full-carbon.css +224 -143
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +1 -2
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +178 -142
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +178 -142
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/APIKeyModal/APIKeyModal.js +10 -13
  18. package/es/components/ActionBar/ActionBar.js +0 -3
  19. package/es/components/ActionBar/ActionBarItem.js +2 -6
  20. package/es/components/ActionSet/ActionSet.js +11 -13
  21. package/es/components/AddSelect/AddSelect.js +121 -25
  22. package/es/components/AddSelect/AddSelectBreadcrumbs.js +5 -5
  23. package/es/components/AddSelect/AddSelectColumn.js +21 -0
  24. package/es/components/AddSelect/AddSelectList.js +68 -9
  25. package/es/components/AddSelect/AddSelectSidebar.js +43 -5
  26. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
  27. package/es/components/ButtonMenu/ButtonMenu.js +6 -4
  28. package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
  29. package/es/components/Card/Card.js +31 -21
  30. package/es/components/Card/CardFooter.js +14 -10
  31. package/es/components/Card/CardHeader.js +8 -6
  32. package/es/components/Cascade/Cascade.js +5 -4
  33. package/es/components/ComboButton/ComboButton.js +0 -4
  34. package/es/components/ComboButton/ComboButtonItem/index.js +0 -5
  35. package/es/components/CreateFullPage/CreateFullPageStep.js +15 -8
  36. package/es/components/CreateModal/CreateModal.js +1 -4
  37. package/es/components/CreateTearsheet/CreateTearsheet.js +10 -11
  38. package/es/components/CreateTearsheet/CreateTearsheetStep.js +18 -14
  39. package/es/components/DataSpreadsheet/DataSpreadsheet.js +454 -0
  40. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +322 -0
  41. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +64 -0
  42. package/es/components/DataSpreadsheet/createActiveCellFn.js +45 -0
  43. package/es/components/DataSpreadsheet/createCellSelectionArea.js +45 -0
  44. package/es/components/DataSpreadsheet/generateData.js +47 -0
  45. package/es/components/DataSpreadsheet/getCellSize.js +30 -0
  46. package/es/components/{CancelableTextEdit → DataSpreadsheet}/index.js +2 -2
  47. package/es/components/EditSidePanel/EditSidePanel.js +9 -10
  48. package/es/components/EmptyStates/EmptyState.js +7 -6
  49. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
  50. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
  51. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
  52. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
  53. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
  54. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
  55. package/es/components/ExampleComponent/ExampleComponent.js +12 -13
  56. package/es/components/ExportModal/ExportModal.js +13 -9
  57. package/es/components/ExpressiveCard/ExpressiveCard.js +0 -8
  58. package/es/components/ImportModal/ImportModal.js +7 -5
  59. package/es/components/InlineEdit/InlineEdit.js +51 -46
  60. package/es/components/LoadingBar/LoadingBar.js +13 -17
  61. package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
  62. package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
  63. package/es/components/ModifiedTabs/ModifiedTabs.js +24 -18
  64. package/es/components/NotificationsPanel/NotificationsPanel.js +109 -86
  65. package/es/components/OptionsTile/OptionsTile.js +6 -9
  66. package/es/components/PageHeader/PageHeader.js +10 -7
  67. package/es/components/ProductiveCard/ProductiveCard.js +23 -12
  68. package/es/components/RemoveModal/RemoveModal.js +0 -3
  69. package/es/components/SidePanel/SidePanel.js +22 -17
  70. package/es/components/TagSet/TagSet.js +13 -9
  71. package/es/components/TagSet/TagSetModal.js +16 -12
  72. package/es/components/TagSet/TagSetOverflow.js +21 -13
  73. package/es/components/Tearsheet/Tearsheet.js +27 -18
  74. package/es/components/Tearsheet/TearsheetNarrow.js +18 -15
  75. package/es/components/Tearsheet/TearsheetShell.js +3 -4
  76. package/es/components/Toolbar/ToolbarButton.js +0 -3
  77. package/es/components/WebTerminal/WebTerminal.js +17 -18
  78. package/es/components/index.js +2 -2
  79. package/es/global/js/hooks/index.js +1 -0
  80. package/es/global/js/hooks/useActiveElement.js +27 -0
  81. package/es/global/js/package-settings.js +2 -1
  82. package/es/global/js/utils/DisplayBox.js +31 -0
  83. package/es/global/js/utils/Wrap.js +7 -5
  84. package/es/global/js/utils/deepCloneObject.js +26 -0
  85. package/es/global/js/utils/getScrollbarWidth.js +14 -0
  86. package/lib/components/APIKeyModal/APIKeyModal.js +10 -13
  87. package/lib/components/ActionBar/ActionBar.js +0 -3
  88. package/lib/components/ActionBar/ActionBarItem.js +2 -6
  89. package/lib/components/ActionSet/ActionSet.js +11 -13
  90. package/lib/components/AddSelect/AddSelect.js +119 -24
  91. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +3 -4
  92. package/lib/components/AddSelect/AddSelectColumn.js +37 -0
  93. package/lib/components/AddSelect/AddSelectList.js +66 -9
  94. package/lib/components/AddSelect/AddSelectSidebar.js +43 -4
  95. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
  96. package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
  97. package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
  98. package/lib/components/Card/Card.js +31 -21
  99. package/lib/components/Card/CardFooter.js +14 -10
  100. package/lib/components/Card/CardHeader.js +8 -6
  101. package/lib/components/Cascade/Cascade.js +5 -4
  102. package/lib/components/ComboButton/ComboButton.js +0 -4
  103. package/lib/components/ComboButton/ComboButtonItem/index.js +0 -5
  104. package/lib/components/CreateFullPage/CreateFullPageStep.js +17 -14
  105. package/lib/components/CreateModal/CreateModal.js +1 -4
  106. package/lib/components/CreateTearsheet/CreateTearsheet.js +10 -11
  107. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +20 -20
  108. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +478 -0
  109. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +349 -0
  110. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +80 -0
  111. package/lib/components/DataSpreadsheet/createActiveCellFn.js +56 -0
  112. package/lib/components/DataSpreadsheet/createCellSelectionArea.js +56 -0
  113. package/lib/components/DataSpreadsheet/generateData.js +58 -0
  114. package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
  115. package/lib/components/DataSpreadsheet/index.js +13 -0
  116. package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
  117. package/lib/components/EmptyStates/EmptyState.js +9 -8
  118. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +3 -7
  119. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +3 -7
  120. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +3 -7
  121. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +3 -7
  122. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +3 -7
  123. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +3 -7
  124. package/lib/components/ExampleComponent/ExampleComponent.js +12 -13
  125. package/lib/components/ExportModal/ExportModal.js +13 -9
  126. package/lib/components/ExpressiveCard/ExpressiveCard.js +0 -8
  127. package/lib/components/ImportModal/ImportModal.js +7 -5
  128. package/lib/components/InlineEdit/InlineEdit.js +51 -46
  129. package/lib/components/LoadingBar/LoadingBar.js +13 -17
  130. package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
  131. package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
  132. package/lib/components/ModifiedTabs/ModifiedTabs.js +24 -18
  133. package/lib/components/NotificationsPanel/NotificationsPanel.js +109 -86
  134. package/lib/components/OptionsTile/OptionsTile.js +6 -9
  135. package/lib/components/PageHeader/PageHeader.js +9 -6
  136. package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
  137. package/lib/components/RemoveModal/RemoveModal.js +0 -3
  138. package/lib/components/SidePanel/SidePanel.js +22 -17
  139. package/lib/components/TagSet/TagSet.js +13 -9
  140. package/lib/components/TagSet/TagSetModal.js +17 -13
  141. package/lib/components/TagSet/TagSetOverflow.js +24 -19
  142. package/lib/components/Tearsheet/Tearsheet.js +26 -17
  143. package/lib/components/Tearsheet/TearsheetNarrow.js +18 -15
  144. package/lib/components/Tearsheet/TearsheetShell.js +2 -3
  145. package/lib/components/Toolbar/ToolbarButton.js +0 -3
  146. package/lib/components/WebTerminal/WebTerminal.js +17 -18
  147. package/lib/components/index.js +8 -8
  148. package/lib/global/js/hooks/index.js +8 -0
  149. package/lib/global/js/hooks/useActiveElement.js +39 -0
  150. package/lib/global/js/package-settings.js +2 -1
  151. package/lib/global/js/utils/DisplayBox.js +46 -0
  152. package/lib/global/js/utils/Wrap.js +7 -5
  153. package/lib/global/js/utils/deepCloneObject.js +37 -0
  154. package/lib/global/js/utils/getScrollbarWidth.js +23 -0
  155. package/package.json +18 -16
  156. package/scss/components/{CancelableTextEdit → ActionBar}/_storybook-styles.scss +2 -2
  157. package/scss/components/ActionSet/_storybook-styles.scss +1 -3
  158. package/scss/components/AddSelect/_add-select.scss +77 -1
  159. package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +8 -0
  160. package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
  161. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +120 -0
  162. package/scss/components/{CancelableTextEdit → DataSpreadsheet}/_index.scss +2 -2
  163. package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
  164. package/scss/components/InlineEdit/_inline-edit.scss +22 -8
  165. package/scss/components/InlineEdit/_storybook-styles.scss +1 -0
  166. package/scss/components/TagSet/_storybook-styles.scss +8 -0
  167. package/scss/components/Tearsheet/_tearsheet.scss +1 -2
  168. package/scss/components/_index.scss +1 -1
  169. package/scss/global/styles/_display-box.scss +62 -0
  170. package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
  171. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
  172. package/lib/components/CancelableTextEdit/index.js +0 -13
  173. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -212
@@ -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);
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
15
  * LICENSE file in the root directory of this source tree.
16
16
  */
17
17
  // Import portions of React that are needed.
18
- import React, { useEffect, useLayoutEffect, useState, useRef } from 'react';
18
+ import React, { useEffect, useState, useRef } from 'react';
19
19
  import { useResizeDetector } from 'react-resize-detector'; // Other standard imports.
20
20
 
21
21
  import PropTypes from 'prop-types';
@@ -120,10 +120,9 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
120
120
  setTimeout(function () {
121
121
  return element.focus();
122
122
  }, 1);
123
- }; // Hook called whenever the tearsheet mounts, unmounts, or 'open' changes.
123
+ };
124
124
 
125
-
126
- useLayoutEffect(function () {
125
+ useEffect(function () {
127
126
  var notify = function notify() {
128
127
  return stack.all.forEach(function (handler) {
129
128
  handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
@@ -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,5 +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
- export { InlineEdit } from './InlineEdit';
39
+ export { InlineEdit } from './InlineEdit';
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
+ };
@@ -63,7 +63,8 @@ var defaults = {
63
63
  EditSidePanel: false,
64
64
  OptionsTile: false,
65
65
  CancelableTextEdit: false,
66
- InlineEdit: false
66
+ InlineEdit: false,
67
+ DataSpreadsheet: false
67
68
  /* new component flags here - comment used by generate CLI */
68
69
 
69
70
  },
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ import cx from 'classnames';
10
+ var blockClass = 'ccs-sb--display-box';
11
+ export var DisplayBox = function DisplayBox(_ref) {
12
+ var children = _ref.children,
13
+ className = _ref.className,
14
+ msg = _ref.msg;
15
+ return /*#__PURE__*/React.createElement("div", {
16
+ className: cx(blockClass, className)
17
+ }, /*#__PURE__*/React.createElement("div", {
18
+ className: "".concat(blockClass, "__indicator")
19
+ }, /*#__PURE__*/React.createElement("div", {
20
+ className: "".concat(blockClass, "__message")
21
+ }, msg || /*#__PURE__*/React.createElement(React.Fragment, null, "width available to component", /*#__PURE__*/React.createElement("br", null), "(use containerWidth control to adjust)")), /*#__PURE__*/React.createElement("div", {
22
+ className: "".concat(blockClass, "__indicator--left")
23
+ }), /*#__PURE__*/React.createElement("div", {
24
+ className: "".concat(blockClass, "__indicator--right")
25
+ })), children);
26
+ };
27
+ DisplayBox.propTypes = {
28
+ children: PropTypes.node,
29
+ className: PropTypes.string,
30
+ msg: PropTypes.node
31
+ };
@@ -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
  };
@@ -0,0 +1,26 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
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
+ // Utility to return a deep clone of a nested object or array.
10
+ export var deepCloneObject = function deepCloneObject(objectToClone) {
11
+ // Return the value if objectToClone is not an object
12
+ if (_typeof(objectToClone) !== 'object' || objectToClone === null) {
13
+ return objectToClone;
14
+ } // Create a new array/object to hold the values
15
+
16
+
17
+ var clonedObject = Array.isArray(objectToClone) ? [] : {};
18
+
19
+ for (var key in objectToClone) {
20
+ var value = objectToClone[key]; // Recursively check for nested objects/arrays
21
+
22
+ clonedObject[key] = deepCloneObject(value);
23
+ }
24
+
25
+ return clonedObject;
26
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export var getScrollbarWidth = function getScrollbarWidth() {
8
+ var scrollDiv = document.createElement('div');
9
+ scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll; position:absolute; top:-9999px;');
10
+ document.body.appendChild(scrollDiv);
11
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
12
+ document.body.removeChild(scrollDiv);
13
+ return scrollbarWidth;
14
+ };
@@ -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
 
@@ -61,10 +57,15 @@ ActionSetButton.propTypes = _objectSpread(_objectSpread({}, _carbonComponentsRea
61
57
  label: _propTypes.default.string,
62
58
  loading: _propTypes.default.bool
63
59
  });
64
- var defaultKind = _carbonComponentsReact.Button.defaultProps.kind;
60
+ 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
  };