@carbon/ibm-products 2.0.0-rc.27 → 2.0.0-rc.29

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/config.css +3 -0
  2. package/css/config.css.map +1 -0
  3. package/css/index-full-carbon.css +126 -355
  4. package/css/index-full-carbon.css.map +1 -1
  5. package/css/index-full-carbon.min.css +6 -6
  6. package/css/index-full-carbon.min.css.map +1 -1
  7. package/css/index-without-carbon-released-only.css +196 -252
  8. package/css/index-without-carbon-released-only.css.map +1 -1
  9. package/css/index-without-carbon-released-only.min.css +4 -4
  10. package/css/index-without-carbon-released-only.min.css.map +1 -1
  11. package/css/index-without-carbon.css +126 -355
  12. package/css/index-without-carbon.css.map +1 -1
  13. package/css/index-without-carbon.min.css +6 -6
  14. package/css/index-without-carbon.min.css.map +1 -1
  15. package/css/index.css +126 -355
  16. package/css/index.css.map +1 -1
  17. package/css/index.min.css +6 -6
  18. package/css/index.min.css.map +1 -1
  19. package/es/components/AboutModal/AboutModal.js +44 -66
  20. package/es/components/ActionBar/ActionBar.js +13 -29
  21. package/es/components/AddSelect/AddSelectBody.js +4 -2
  22. package/es/components/AddSelect/AddSelectColumn.js +11 -5
  23. package/es/components/AddSelect/AddSelectFilter.js +5 -4
  24. package/es/components/AddSelect/AddSelectRow.js +3 -3
  25. package/es/components/AddSelect/AddSelectSort.js +2 -1
  26. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +15 -21
  27. package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
  28. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +7 -8
  29. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +6 -5
  30. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
  31. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
  32. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +19 -4
  33. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -5
  34. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
  35. package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +19 -1
  36. package/es/components/Datagrid/index.js +1 -0
  37. package/es/components/Datagrid/useEditableCell.js +13 -0
  38. package/es/components/Datagrid/useFiltering.js +4 -2
  39. package/es/components/Datagrid/useInlineEdit.js +16 -11
  40. package/es/components/Datagrid/useOnRowClick.js +11 -1
  41. package/es/components/Datagrid/useSelectRows.js +2 -0
  42. package/es/components/{InlineEditV2/InlineEditV2.js → EditInPlace/EditInPlace.js} +92 -30
  43. package/es/components/{InlineEdit → EditInPlace}/index.js +1 -1
  44. package/es/components/ExampleComponent/ExampleDeprecatedComponent.js +24 -0
  45. package/es/components/PageHeader/PageHeader.js +36 -35
  46. package/es/components/PageHeader/PageHeaderTitle.js +18 -18
  47. package/es/components/SidePanel/SidePanel.js +25 -26
  48. package/es/components/TagSet/TagSet.js +5 -7
  49. package/es/components/Tearsheet/Tearsheet.js +5 -0
  50. package/es/components/Tearsheet/TearsheetShell.js +4 -6
  51. package/es/components/index.js +1 -2
  52. package/es/global/js/hooks/useResizeObserver.js +79 -0
  53. package/es/global/js/hooks/useWindowResize.js +6 -0
  54. package/es/global/js/hooks/useWindowScroll.js +7 -0
  55. package/es/global/js/package-settings.js +4 -6
  56. package/es/settings.js +40 -20
  57. package/lib/components/AboutModal/AboutModal.js +43 -66
  58. package/lib/components/ActionBar/ActionBar.js +13 -29
  59. package/lib/components/AddSelect/AddSelectBody.js +4 -2
  60. package/lib/components/AddSelect/AddSelectColumn.js +11 -5
  61. package/lib/components/AddSelect/AddSelectFilter.js +4 -3
  62. package/lib/components/AddSelect/AddSelectRow.js +2 -2
  63. package/lib/components/AddSelect/AddSelectSort.js +2 -1
  64. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +13 -19
  65. package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +7 -11
  66. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +2 -1
  67. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +5 -4
  68. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +3 -4
  69. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +17 -3
  70. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +19 -4
  71. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +8 -5
  72. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useInitialStateFromFilters.js +2 -1
  73. package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +18 -1
  74. package/lib/components/Datagrid/index.js +8 -0
  75. package/lib/components/Datagrid/useEditableCell.js +23 -0
  76. package/lib/components/Datagrid/useFiltering.js +4 -2
  77. package/lib/components/Datagrid/useInlineEdit.js +22 -11
  78. package/lib/components/Datagrid/useOnRowClick.js +11 -1
  79. package/lib/components/Datagrid/useSelectRows.js +2 -0
  80. package/lib/components/{InlineEditV2/InlineEditV2.js → EditInPlace/EditInPlace.js} +100 -34
  81. package/lib/components/{InlineEdit → EditInPlace}/index.js +3 -3
  82. package/lib/components/ExampleComponent/ExampleDeprecatedComponent.js +38 -0
  83. package/lib/components/PageHeader/PageHeader.js +36 -35
  84. package/lib/components/PageHeader/PageHeaderTitle.js +19 -19
  85. package/lib/components/SidePanel/SidePanel.js +25 -26
  86. package/lib/components/TagSet/TagSet.js +5 -7
  87. package/lib/components/Tearsheet/Tearsheet.js +5 -0
  88. package/lib/components/Tearsheet/TearsheetShell.js +4 -6
  89. package/lib/components/index.js +7 -15
  90. package/lib/global/js/hooks/useResizeObserver.js +91 -0
  91. package/lib/global/js/hooks/useWindowScroll.js +6 -0
  92. package/lib/global/js/package-settings.js +4 -6
  93. package/lib/settings.js +43 -21
  94. package/package.json +3 -4
  95. package/scss/components/AboutModal/_about-modal.scss +34 -53
  96. package/scss/components/AboutModal/_storybook-styles.scss +10 -4
  97. package/scss/components/AddSelect/_add-select.scss +7 -3
  98. package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +10 -1
  99. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -1
  100. package/scss/components/Datagrid/styles/_useSelectAllToggle.scss +11 -7
  101. package/scss/components/{InlineEditV2/_inline-edit-v2.scss → EditInPlace/_edit-in-place.scss} +56 -14
  102. package/scss/components/{InlineEditV1 → EditInPlace}/_index-with-carbon.scss +1 -1
  103. package/scss/components/{InlineEditV2 → EditInPlace}/_index.scss +1 -1
  104. package/scss/components/{InlineEditV1 → EditInPlace}/_storybook-styles.scss +3 -15
  105. package/scss/components/PageHeader/_page-header.scss +1 -7
  106. package/scss/components/_index-released-only-with-carbon.scss +1 -1
  107. package/scss/components/_index-released-only.scss +1 -1
  108. package/scss/components/_index-with-carbon.scss +1 -3
  109. package/scss/components/_index.scss +1 -3
  110. package/scss/config.scss +1 -0
  111. package/es/components/InlineEdit/InlineEdit.js +0 -47
  112. package/es/components/InlineEditV1/InlineEditV1.js +0 -442
  113. package/es/components/InlineEditV1/index.js +0 -7
  114. package/es/components/InlineEditV2/index.js +0 -7
  115. package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -34
  116. package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -47
  117. package/es/components/ModifiedTabs/ModifiedTabs.js +0 -141
  118. package/es/components/ModifiedTabs/index.js +0 -1
  119. package/lib/components/InlineEdit/InlineEdit.js +0 -63
  120. package/lib/components/InlineEditV1/InlineEditV1.js +0 -459
  121. package/lib/components/InlineEditV1/index.js +0 -13
  122. package/lib/components/InlineEditV2/index.js +0 -13
  123. package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -50
  124. package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -63
  125. package/lib/components/ModifiedTabs/ModifiedTabs.js +0 -164
  126. package/lib/components/ModifiedTabs/index.js +0 -13
  127. package/scss/components/InlineEditV1/_carbon-imports.scss +0 -6
  128. package/scss/components/InlineEditV1/_index.scss +0 -8
  129. package/scss/components/InlineEditV1/_inline-edit-v1.scss +0 -269
  130. package/scss/components/InlineEditV2/_index-with-carbon.scss +0 -9
  131. package/scss/components/InlineEditV2/_storybook-styles.scss +0 -9
  132. package/scss/components/ModifiedTabs/_carbon-imports.scss +0 -10
  133. package/scss/components/ModifiedTabs/_index-with-carbon.scss +0 -9
  134. package/scss/components/ModifiedTabs/_index.scss +0 -8
  135. package/scss/components/ModifiedTabs/_modified-tabs.scss +0 -89
  136. package/scss/components/ModifiedTabs/_storybook-styles.scss +0 -6
  137. /package/scss/components/{InlineEditV2 → EditInPlace}/_carbon-imports.scss +0 -0
@@ -21,7 +21,7 @@ import { motion, AnimatePresence } from 'framer-motion'; // Other standard impor
21
21
 
22
22
  import PropTypes from 'prop-types';
23
23
  import cx from 'classnames';
24
- import { useResizeDetector } from 'react-resize-detector';
24
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
25
25
  import { moderate02 } from '@carbon/motion';
26
26
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
27
27
  import { allPropTypes } from '../../global/js/utils/props-helper';
@@ -51,7 +51,7 @@ var defaults = {
51
51
  */
52
52
 
53
53
  export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
54
- var _window, _ref4, _cx4;
54
+ var _window, _ref5, _cx4;
55
55
 
56
56
  var actionToolbarButtons = _ref.actionToolbarButtons,
57
57
  actions = _ref.actions,
@@ -172,9 +172,10 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
172
172
  }, [labelText, title]);
173
173
  /* istanbul ignore next */
174
174
 
175
- var handleResize = function handleResize(width, height) {
175
+ var handleResize = function handleResize(_ref2) {
176
176
  var _sidePanelOuter$style3;
177
177
 
178
+ var height = _ref2.height;
178
179
  setPanelHeight(height);
179
180
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
180
181
  var actionsContainer = getActionsContainerElement();
@@ -371,9 +372,9 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
371
372
 
372
373
  /* istanbul ignore next */
373
374
 
374
- var handleBlur = function handleBlur(_ref2) {
375
- var oldActiveNode = _ref2.target,
376
- currentActiveNode = _ref2.relatedTarget;
375
+ var handleBlur = function handleBlur(_ref3) {
376
+ var oldActiveNode = _ref3.target,
377
+ currentActiveNode = _ref3.relatedTarget;
377
378
 
378
379
  // focus trap should only be set if the side panel is a `slideOver` type
379
380
  if (open && sidePanelInnerRef && !slideIn) {
@@ -388,7 +389,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
388
389
  };
389
390
 
390
391
  var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container-condensed"), condensedActions)]);
391
- var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref4 = {}, _defineProperty(_ref4, "".concat(blockClass, "__container-right-placement"), placement === 'right'), _defineProperty(_ref4, "".concat(blockClass, "__container-left-placement"), placement === 'left'), _defineProperty(_ref4, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), _defineProperty(_ref4, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), _defineProperty(_ref4, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref4)]);
392
+ var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (_ref5 = {}, _defineProperty(_ref5, "".concat(blockClass, "__container-right-placement"), placement === 'right'), _defineProperty(_ref5, "".concat(blockClass, "__container-left-placement"), placement === 'left'), _defineProperty(_ref5, "".concat(blockClass, "__container-with-action-toolbar"), actionToolbarButtons && actionToolbarButtons.length), _defineProperty(_ref5, "".concat(blockClass, "__container-without-overlay"), !includeOverlay && !slideIn), _defineProperty(_ref5, "".concat(blockClass, "__container-is-animating"), !animationComplete || !open), _ref5)]);
392
393
 
393
394
  var renderHeader = function renderHeader() {
394
395
  var _cx, _cx2;
@@ -427,17 +428,17 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
427
428
  className: cx("".concat(blockClass, "__subtitle-text"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation"), !animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !animateTitle && (!actionToolbarButtons || !actionToolbarButtons.length)), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-text-is-animating"), !animationComplete && animateTitle), _defineProperty(_cx2, "".concat(blockClass, "__subtitle-without-title"), !title), _cx2))
428
429
  }, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/React.createElement("div", {
429
430
  className: cx("".concat(blockClass, "__action-toolbar"), _defineProperty({}, "".concat(blockClass, "__action-toolbar-no-animation"), !animateTitle))
430
- }, actionToolbarButtons.map(function (_ref5) {
431
- var label = _ref5.label,
432
- kind = _ref5.kind,
433
- icon = _ref5.icon,
434
- tooltipPosition = _ref5.tooltipPosition,
435
- tooltipAlignment = _ref5.tooltipAlignment,
436
- leading = _ref5.leading,
437
- disabled = _ref5.disabled,
438
- className = _ref5.className,
439
- onClick = _ref5.onClick,
440
- rest = _objectWithoutProperties(_ref5, _excluded2);
431
+ }, actionToolbarButtons.map(function (_ref6) {
432
+ var label = _ref6.label,
433
+ kind = _ref6.kind,
434
+ icon = _ref6.icon,
435
+ tooltipPosition = _ref6.tooltipPosition,
436
+ tooltipAlignment = _ref6.tooltipAlignment,
437
+ leading = _ref6.leading,
438
+ disabled = _ref6.disabled,
439
+ className = _ref6.className,
440
+ onClick = _ref6.onClick,
441
+ rest = _objectWithoutProperties(_ref6, _excluded2);
441
442
 
442
443
  return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
443
444
  key: label,
@@ -468,10 +469,8 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
468
469
  };
469
470
 
470
471
  var contentRef = ref || sidePanelRef;
471
- useResizeDetector({
472
- handleHeight: true,
473
- onResize: handleResize,
474
- targetRef: contentRef
472
+ useResizeObserver(contentRef, {
473
+ callback: handleResize
475
474
  });
476
475
  return /*#__PURE__*/React.createElement(AnimatePresence, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
477
476
  id: "".concat(blockClass, "-outer"),
@@ -640,8 +639,8 @@ SidePanel.propTypes = {
640
639
  * This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
641
640
  * This prop is required when using the `slideIn` variant of the side panel.
642
641
  */
643
- selectorPageContent: PropTypes.string.isRequired.if(function (_ref7) {
644
- var slideIn = _ref7.slideIn;
642
+ selectorPageContent: PropTypes.string.isRequired.if(function (_ref8) {
643
+ var slideIn = _ref8.slideIn;
645
644
  return slideIn;
646
645
  }),
647
646
 
@@ -669,8 +668,8 @@ SidePanel.propTypes = {
669
668
  /**
670
669
  * Sets the title text
671
670
  */
672
- title: PropTypes.string.isRequired.if(function (_ref8) {
673
- var labelText = _ref8.labelText;
671
+ title: PropTypes.string.isRequired.if(function (_ref9) {
672
+ var labelText = _ref9.labelText;
674
673
  return labelText;
675
674
  })
676
675
  };
@@ -23,7 +23,7 @@ import cx from 'classnames';
23
23
  import { TagSetOverflow } from './TagSetOverflow';
24
24
  import { TagSetModal } from './TagSetModal';
25
25
  import { Tag } from '@carbon/react';
26
- import { useResizeDetector } from 'react-resize-detector';
26
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
27
27
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
28
28
  import { prepareProps, isRequiredIf } from '../../global/js/utils/props-helper';
29
29
  import { pkg } from '../../settings';
@@ -222,13 +222,11 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
222
222
  setShowAllModalOpen(false);
223
223
  };
224
224
 
225
- useResizeDetector({
226
- onResize: handleSizerTagsResize,
227
- targetRef: sizingContainerRef
225
+ useResizeObserver(sizingContainerRef, {
226
+ callback: handleSizerTagsResize
228
227
  });
229
- useResizeDetector({
230
- onResize: handleResize,
231
- targetRef: tagSetRef
228
+ useResizeObserver(tagSetRef, {
229
+ callback: handleResize
232
230
  });
233
231
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
234
232
  className: cx([blockClass, className]),
@@ -187,6 +187,11 @@ Tearsheet.propTypes = _objectSpread({
187
187
  */
188
188
  portalTarget: PropTypes.node,
189
189
 
190
+ /**
191
+ * Specify a CSS selector that matches the DOM element that should be focused when the Modal opens
192
+ */
193
+ selectorPrimaryFocus: PropTypes.string,
194
+
190
195
  /**
191
196
  * The main title of the tearsheet, displayed in the header area.
192
197
  */
@@ -17,7 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
17
  // Import portions of React that are needed.
18
18
  import React, { useEffect, useState, useRef } from 'react';
19
19
  import { createPortal } from 'react-dom';
20
- import { useResizeDetector } from 'react-resize-detector'; // Other standard imports.
20
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver'; // Other standard imports.
21
21
 
22
22
  import PropTypes from 'prop-types';
23
23
  import cx from 'classnames';
@@ -91,13 +91,11 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
91
91
  }
92
92
  }, [portalTargetIn]);
93
93
  var localRef = useRef();
94
+ var resizer = useRef(null);
94
95
  var modalRef = ref || localRef;
95
96
 
96
- var _useResizeDetector = useResizeDetector({
97
- handleHeight: false
98
- }),
99
- width = _useResizeDetector.width,
100
- resizer = _useResizeDetector.ref;
97
+ var _useResizeObserver = useResizeObserver(resizer),
98
+ width = _useResizeObserver.width;
101
99
 
102
100
  var wide = size === 'wide'; // Keep track of the stack depth and our position in it (1-based, 0=closed)
103
101
 
@@ -18,7 +18,6 @@ export { ExportModal } from './ExportModal';
18
18
  export { ExpressiveCard } from './ExpressiveCard';
19
19
  export { HTTPError403, HTTPError404, HTTPErrorOther } from './HTTPErrors';
20
20
  export { ImportModal } from './ImportModal';
21
- export { ModifiedTabs } from './ModifiedTabs';
22
21
  export { MultiAddSelect } from './MultiAddSelect';
23
22
  export { NotificationsPanel } from './NotificationsPanel';
24
23
  export { PageHeader } from './PageHeader';
@@ -35,7 +34,7 @@ export { UserProfileImage } from './UserProfileImage';
35
34
  export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProvider } from './WebTerminal';
36
35
  export { EditSidePanel } from './EditSidePanel';
37
36
  export { OptionsTile } from './OptionsTile';
38
- export { InlineEdit } from './InlineEdit';
37
+ export { EditInPlace } from './EditInPlace';
39
38
  export { DataSpreadsheet } from './DataSpreadsheet';
40
39
  export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useFiltering, getAutoSizedColumnWidth } from './Datagrid';
41
40
  export { EditTearsheet } from './EditTearsheet';
@@ -0,0 +1,79 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /**
4
+ * Copyright IBM Corp. 2023, 2023
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 { useRef, useState, useLayoutEffect } from 'react';
10
+ export var useResizeObserver = function useResizeObserver(ref) {
11
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
12
+ callback: null,
13
+ throttleInterval: 0
14
+ };
15
+ var callback = options.callback,
16
+ throttleInterval = options.throttleInterval;
17
+
18
+ var _useState = useState(0),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ width = _useState2[0],
21
+ setWidth = _useState2[1];
22
+
23
+ var _useState3 = useState(0),
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ height = _useState4[0],
26
+ setHeight = _useState4[1];
27
+
28
+ var throttleTimeout = useRef(null);
29
+ var entriesToHandle = useRef(null);
30
+ useLayoutEffect(function () {
31
+ if (!(ref !== null && ref !== void 0 && ref.current)) {
32
+ return;
33
+ }
34
+
35
+ var doCallbacks = function doCallbacks() {
36
+ if (!(ref !== null && ref !== void 0 && ref.current) || !Array.isArray(entriesToHandle === null || entriesToHandle === void 0 ? void 0 : entriesToHandle.current)) {
37
+ return;
38
+ }
39
+
40
+ var entry = entriesToHandle.current[0];
41
+ setWidth(entry.contentRect.width);
42
+ setHeight(entry.contentRect.height);
43
+ throttleTimeout.current = null;
44
+ callback && callback(entry.contentRect);
45
+ };
46
+
47
+ var observer = new ResizeObserver(function (entries) {
48
+ // always update entriesToHandle
49
+ entriesToHandle.current = entries;
50
+
51
+ if (throttleInterval) {
52
+ // if a throttleInterval check for running timeout
53
+ if (throttleTimeout.current === null) {
54
+ // no live timeout set entries to handle and move on
55
+ // set up throttle
56
+ throttleTimeout.current = setTimeout(function () {
57
+ // do callbacks
58
+ doCallbacks(); // reset throttle
59
+
60
+ throttleTimeout.current = null;
61
+ }, throttleInterval);
62
+ }
63
+ } else {
64
+ // no throttle do callbacks every time
65
+ doCallbacks();
66
+ }
67
+ }); // observe all refs passed
68
+
69
+ observer.observe(ref.current);
70
+ return function () {
71
+ observer.disconnect();
72
+ observer = null;
73
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, [ref, options]);
75
+ return {
76
+ width: width,
77
+ height: height
78
+ };
79
+ };
@@ -5,6 +5,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
 
6
6
  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) { _defineProperty(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; }
7
7
 
8
+ /**
9
+ * Copyright IBM Corp. 2022, 2023
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
8
14
  import { useRef, useLayoutEffect } from 'react';
9
15
  var windowExists = (typeof window === "undefined" ? "undefined" : _typeof(window)) !== "undefined";
10
16
 
@@ -1,4 +1,11 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
+
3
+ /**
4
+ * Copyright IBM Corp. 2022, 2023
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
+ */
2
9
  import { useRef, useLayoutEffect } from 'react';
3
10
  import { scrollableAncestor } from '../utils/scrollableAncestor';
4
11
  var windowExists = (typeof window === "undefined" ? "undefined" : _typeof(window)) !== "undefined";
@@ -27,6 +27,7 @@ var defaults = {
27
27
  CreateTearsheet: true,
28
28
  CreateTearsheetStep: true,
29
29
  CreateTearsheetDivider: true,
30
+ EditInPlace: true,
30
31
  EmptyState: true,
31
32
  ErrorEmptyState: true,
32
33
  ExportModal: true,
@@ -35,8 +36,6 @@ var defaults = {
35
36
  HTTPError404: true,
36
37
  HTTPErrorOther: true,
37
38
  ImportModal: true,
38
- InlineEdit: true,
39
- InlineEditV1: true,
40
39
  MultiAddSelect: true,
41
40
  NotificationsPanel: true,
42
41
  NoDataEmptyState: true,
@@ -60,7 +59,6 @@ var defaults = {
60
59
  WebTerminalContentWrapper: true,
61
60
  WebTerminalProvider: true,
62
61
  // other public components not yet reviewed and released:
63
- ModifiedTabs: false,
64
62
  Toolbar: false,
65
63
  ToolbarButton: false,
66
64
  ToolbarGroup: false,
@@ -71,8 +69,7 @@ var defaults = {
71
69
  EditTearsheet: false,
72
70
  EditTearsheetNarrow: false,
73
71
  EditFullPage: false,
74
- EditUpdateCards: false,
75
- InlineEditV2: false
72
+ EditUpdateCards: false
76
73
  /* new component flags here - comment used by generate CLI */
77
74
 
78
75
  },
@@ -80,7 +77,8 @@ var defaults = {
80
77
  feature: {
81
78
  'a-new-feature': false,
82
79
  'default-portal-target-body': true,
83
- 'Datagrid.useInfiniteScroll': false
80
+ 'Datagrid.useInfiniteScroll': false,
81
+ 'Datagrid.useInlineEdit': false
84
82
  }
85
83
  };
86
84
 
package/es/settings.js CHANGED
@@ -2,32 +2,51 @@ import { Canary } from './components/_Canary';
2
2
  import pkgSettings from './global/js/package-settings';
3
3
  import React from 'react';
4
4
  import { themes } from '@carbon/themes';
5
+ import pconsole from './global/js/utils/pconsole';
5
6
  export var carbon = {
6
7
  get themes() {
7
8
  return themes;
8
9
  },
9
10
 
10
11
  prefix: 'cds'
12
+ };
13
+
14
+ var componentDeprecatedWarning = function componentDeprecatedWarning(name, details) {
15
+ return "Carbon for IBM Products (WARNING): Component \"".concat(name, "\" is deprecated. ").concat(details);
16
+ };
17
+
18
+ pkgSettings.logDeprecated = function (component, name) {
19
+ if (component !== null && component !== void 0 && component.deprecated) {
20
+ var _pconsole$level;
21
+
22
+ var _component$deprecated = component.deprecated,
23
+ level = _component$deprecated.level,
24
+ details = _component$deprecated.details;
25
+ var logUsing = (_pconsole$level = pconsole === null || pconsole === void 0 ? void 0 : pconsole[level]) !== null && _pconsole$level !== void 0 ? _pconsole$level : pconsole.error;
26
+ logUsing(componentDeprecatedWarning(name || component.displayName, details));
27
+ }
11
28
  }; // Check that a component is enabled. This function returns a stub which checks
12
29
  // the component status on first use and then renders as the component or as
13
30
  // a Canary placeholder initialized with the name of the replaced component.
14
31
  // Note that the returned stub carries any other properties which had already
15
32
  // been assigned (eg propTypes, displayName, etc).
16
33
 
34
+
17
35
  pkgSettings.checkComponentEnabled = function (component, name) {
18
36
  if (component.render) {
19
37
  // The component is a forward-ref, so make a stub forward-ref.
20
38
  var forward = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
- return (// Replace the stub's render fn so this test only happens once.
22
- (forward.render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
23
- // replace the stub's render fn with the component's render fn.
24
- component.render : // Note that Canary is a direct render fn (not a forward-ref) and
25
- // will ignore the passed props and ref (if any)
26
- Canary.bind(undefined, {
27
- componentName: name
28
- }))( // Call it now (after this it will be directly called).
29
- props, ref)
30
- );
39
+ pkgSettings.logDeprecated(component, name); // may log don't care about result
40
+ // Replace the stub's render fn so this test only happens once.
41
+
42
+ return (forward.render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
43
+ // replace the stub's render fn with the component's render fn.
44
+ component.render : // Note that Canary is a direct render fn (not a forward-ref) and
45
+ // will ignore the passed props and ref (if any)
46
+ Canary.bind(undefined, {
47
+ componentName: name
48
+ }))( // Call it now (after this it will be directly called).
49
+ props, ref);
31
50
  }); // Transfer object properties already assigned (eg propTypes, displayName)
32
51
  // then merge in the stub forward-ref which checks the component status
33
52
  // when first used.
@@ -36,16 +55,17 @@ pkgSettings.checkComponentEnabled = function (component, name) {
36
55
  } else {
37
56
  // The component is a direct render fn, so make a stub render fn.
38
57
  var _render = function render(props) {
39
- return (// Replace the stub render fn so this test only happens once.
40
- (_render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
41
- // replace the stub render fn with the component render fn.
42
- component : // Replace the stub render fn with the Canary render fn, which will
43
- // ignore the passed props.
44
- Canary.bind(undefined, {
45
- componentName: name
46
- }))( // Call it now (after this it will be directly called).
47
- props)
48
- );
58
+ pkgSettings.logDeprecated(component, name); // may log don't care about result
59
+ // Replace the stub render fn so this test only happens once.
60
+
61
+ return (_render = pkgSettings.isComponentEnabled(name) || !pkgSettings.isComponentPublic(name) ? // If the component is enabled, or if it's not a public component,
62
+ // replace the stub render fn with the component render fn.
63
+ component : // Replace the stub render fn with the Canary render fn, which will
64
+ // ignore the passed props.
65
+ Canary.bind(undefined, {
66
+ componentName: name
67
+ }))( // Call it now (after this it will be directly called).
68
+ props);
49
69
  }; // Transfer object properties already assigned (eg propTypes, displayName)
50
70
  // to a function which calls the stub render fn which checks the component
51
71
  // status when first used.
@@ -19,7 +19,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
- var _reactResizeDetector = require("react-resize-detector");
22
+ var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
23
23
 
24
24
  var _propTypes = _interopRequireDefault(require("prop-types"));
25
25
 
@@ -33,9 +33,7 @@ var _devtools = require("../../global/js/utils/devtools");
33
33
 
34
34
  var _react2 = require("@carbon/react");
35
35
 
36
- var _propsHelper = require("../../global/js/utils/props-helper");
37
-
38
- var _excluded = ["additionalInfo", "className", "closeIconDescription", "content", "copyrightText", "legalText", "links", "logo", "modalAriaLabel", "onClose", "open", "tabListAriaLabel", "title"];
36
+ var _excluded = ["additionalInfo", "className", "closeIconDescription", "copyrightText", "content", "links", "logo", "modalAriaLabel", "onClose", "open", "title", "version"];
39
37
 
40
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
39
 
@@ -61,16 +59,15 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
61
59
  var additionalInfo = _ref.additionalInfo,
62
60
  className = _ref.className,
63
61
  closeIconDescription = _ref.closeIconDescription,
64
- content = _ref.content,
65
62
  copyrightText = _ref.copyrightText,
66
- legalText = _ref.legalText,
63
+ content = _ref.content,
67
64
  links = _ref.links,
68
65
  logo = _ref.logo,
69
66
  modalAriaLabel = _ref.modalAriaLabel,
70
67
  onClose = _ref.onClose,
71
68
  open = _ref.open,
72
- tabListAriaLabel = _ref.tabListAriaLabel,
73
69
  title = _ref.title,
70
+ version = _ref.version,
74
71
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
75
72
 
76
73
  var _useState = (0, _react.useState)(true),
@@ -94,14 +91,13 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
94
91
  bodyRef.current = contentRef.current.parentElement;
95
92
  }, [bodyRef]); // Detect resize of the ModalBody to recalculate whether scrolling is enabled
96
93
 
97
- (0, _reactResizeDetector.useResizeDetector)({
98
- onResize: handleResize,
99
- targetRef: bodyRef
94
+ (0, _useResizeObserver.useResizeObserver)(bodyRef, {
95
+ callback: handleResize
100
96
  });
101
97
  return /*#__PURE__*/_react.default.createElement(_react2.ComposedModal, (0, _extends2.default)({}, rest, {
102
98
  className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
103
- className, // Apply any supplied class names to the main HTML element.
104
- (0, _defineProperty2.default)({}, "".concat(blockClass, "--with-tabs"), additionalInfo && additionalInfo.length > 1)),
99
+ className // Apply any supplied class names to the main HTML element.
100
+ ),
105
101
  "aria-label": modalAriaLabel
106
102
  }, _objectSpread({
107
103
  onClose: onClose,
@@ -124,59 +120,42 @@ var AboutModal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
124
120
  className: "".concat(blockClass, "__body-content"),
125
121
  ref: contentRef,
126
122
  id: contentId
127
- }, content, /*#__PURE__*/_react.default.createElement("div", {
123
+ }, /*#__PURE__*/_react.default.createElement("div", {
124
+ className: "".concat(blockClass, "__version")
125
+ }, version), links && links.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
128
126
  className: "".concat(blockClass, "__links-container")
129
- }, links && links.length > 0 && links.map(function (link, i) {
127
+ }, links.map(function (link, i) {
130
128
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
131
129
  key: i
132
130
  }, link);
133
- })), legalText && /*#__PURE__*/_react.default.createElement("p", {
134
- className: "".concat(blockClass, "__legal-text")
135
- }, legalText), copyrightText && /*#__PURE__*/_react.default.createElement("p", {
131
+ })), content && /*#__PURE__*/_react.default.createElement("p", {
132
+ className: "".concat(blockClass, "__content")
133
+ }, content), copyrightText && /*#__PURE__*/_react.default.createElement("p", {
136
134
  className: "".concat(blockClass, "__copyright-text")
137
- }, copyrightText))), /*#__PURE__*/_react.default.createElement(_react2.ModalFooter, {
135
+ }, copyrightText))), additionalInfo && additionalInfo.length > 0 && /*#__PURE__*/_react.default.createElement(_react2.Theme, {
136
+ theme: "g100"
137
+ }, /*#__PURE__*/_react.default.createElement(_react2.ModalFooter, {
138
138
  className: "".concat(blockClass, "__footer")
139
- }, additionalInfo && additionalInfo.length > 0 && (additionalInfo.length === 1 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
140
- className: "".concat(blockClass, "__version-label")
139
+ }, /*#__PURE__*/_react.default.createElement("p", {
140
+ className: "".concat(blockClass, "__footer-label")
141
141
  }, additionalInfo[0].label), /*#__PURE__*/_react.default.createElement("p", {
142
- className: "".concat(blockClass, "__version-number")
143
- }, additionalInfo[0].content)) : /*#__PURE__*/_react.default.createElement("div", {
144
- className: "".concat(blockClass, "__tab-container")
145
- }, /*#__PURE__*/_react.default.createElement(_react2.Tabs, null, /*#__PURE__*/_react.default.createElement(_react2.TabList, {
146
- "aria-label": tabListAriaLabel
147
- }, additionalInfo.map(function (tab, index) {
148
- return /*#__PURE__*/_react.default.createElement(_react2.Tab, {
149
- key: index
150
- }, tab.label);
151
- })), /*#__PURE__*/_react.default.createElement(_react2.TabPanels, null, additionalInfo.map(function (tab, index) {
152
- return /*#__PURE__*/_react.default.createElement(_react2.TabPanel, {
153
- key: index
154
- }, tab.content);
155
- })))))));
142
+ className: "".concat(blockClass, "__footer-content")
143
+ }, additionalInfo[0].content))));
156
144
  }); // Return a placeholder if not released and not enabled by feature flag
157
145
 
158
146
 
159
147
  exports.AboutModal = AboutModal;
160
148
  exports.AboutModal = AboutModal = _settings.pkg.checkComponentEnabled(AboutModal, componentName);
161
- AboutModal.displayName = componentName;
162
-
163
- var tabListAriaLabelRequiredProps = function tabListAriaLabelRequiredProps(type) {
164
- return (0, _propsHelper.isRequiredIf)(type, function (_ref2) {
165
- var additionalInfo = _ref2.additionalInfo;
166
- return additionalInfo === null || additionalInfo === void 0 ? void 0 : additionalInfo.length;
167
- });
168
- }; // The types and DocGen commentary for the component props,
149
+ AboutModal.displayName = componentName; // The types and DocGen commentary for the component props,
169
150
  // in alphabetical order (for consistency).
170
151
  // See https://www.npmjs.com/package/prop-types#usage.
171
152
 
172
-
173
153
  AboutModal.propTypes = {
174
154
  /**
175
- * Additional information to be displayed in the footer. Can be used for
176
- * version information and/or a set of tabs with various contents. If only
177
- * one set of additional information is provided then no tabs are
178
- * displayed and the label and content are just displayed one above the
179
- * other in the footer.
155
+ * If you are legally required to display logos of technologies used
156
+ * to build your product you can provide this in the additionalInfo.
157
+ * Additional information will be displayed in the footer. The label
158
+ * and content are displayed one above the other in the footer (optional)
180
159
  */
181
160
  additionalInfo: _propTypes.default.arrayOf(_propTypes.default.shape({
182
161
  label: _propTypes.default.string,
@@ -194,26 +173,21 @@ AboutModal.propTypes = {
194
173
  closeIconDescription: _propTypes.default.string.isRequired,
195
174
 
196
175
  /**
197
- * A summary that appears immediately beneath the title, and might
198
- * include information such as: version name, server name,
199
- * user name, user role, browser version, browser OS etc.
200
- */
201
- content: _propTypes.default.node.isRequired,
202
-
203
- /**
204
- * Trademark and copyright information. Suggested format for copyright -
205
- * "Copyright © 2018 Company".
176
+ * Subhead text providing any relevant product disclaimers including
177
+ * legal information (optional)
206
178
  */
207
- copyrightText: _propTypes.default.node,
179
+ content: _propTypes.default.node,
208
180
 
209
181
  /**
210
- * Text providing legal information.
182
+ * Trademark and copyright information. Displays first year of
183
+ * product release to current year.
211
184
  */
212
- legalText: _propTypes.default.node,
185
+ copyrightText: _propTypes.default.string.isRequired,
213
186
 
214
187
  /**
215
- * An array of Carbon `Link` components that contain links to additional
216
- * information.
188
+ * An array of Carbon `Link` component if there are additional information
189
+ * to call out within the card. The about modal should be used to display
190
+ * the product information and not where users go to find help (optional)
217
191
  */
218
192
  links: _propTypes.default.arrayOf(_propTypes.default.element),
219
193
 
@@ -239,12 +213,15 @@ AboutModal.propTypes = {
239
213
  open: _propTypes.default.bool,
240
214
 
241
215
  /**
242
- * Specifies the tab list aria label
216
+ * Header text that provides the product name. The IBM Services logo
217
+ * consists of two discrete, but required, elements: the iconic
218
+ * IBM 8-bar logo represented alongside the IBM Services logotype.
219
+ * Please follow these guidelines to ensure proper execution.
243
220
  */
244
- tabListAriaLabel: tabListAriaLabelRequiredProps(_propTypes.default.string),
221
+ title: _propTypes.default.node.isRequired,
245
222
 
246
223
  /**
247
- * The title of the AboutModal is usually the product or service name.
224
+ * Text that provides information on the version number of your product.
248
225
  */
249
- title: _propTypes.default.node.isRequired
226
+ version: _propTypes.default.string.isRequired
250
227
  };