@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
@@ -22,7 +22,7 @@ import React, { useEffect, useState, useRef } from 'react'; // Other standard im
22
22
  import PropTypes from 'prop-types';
23
23
  import cx from 'classnames';
24
24
  import { pkg } from '../../settings';
25
- import { useResizeDetector } from 'react-resize-detector'; // Carbon and package components we use.
25
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver'; // Carbon and package components we use.
26
26
 
27
27
  import { Button } from '@carbon/react';
28
28
  import uuidv4 from '../../global/js/utils/uuidv4';
@@ -65,7 +65,9 @@ export var ActionBar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
65
65
  var internalId = useRef(uuidv4());
66
66
  var refDisplayedItems = useRef(null);
67
67
  var sizingRef = useRef(null);
68
- var sizes = useRef({}); // create hidden sizing items
68
+ var sizes = useRef({});
69
+ var backupRef = useRef();
70
+ var localRef = ref || backupRef; // create hidden sizing items
69
71
 
70
72
  useEffect(function () {
71
73
  // Hidden action bar and items used to calculate sizes
@@ -172,44 +174,26 @@ export var ActionBar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
172
174
 
173
175
  useEffect(function () {
174
176
  checkFullyVisibleItems(); // eslint-disable-next-line react-hooks/exhaustive-deps
175
- }, [maxVisible, hiddenSizingItems]);
176
- /* istanbul ignore next */
177
- // not sure how to fake window resize
177
+ }, [maxVisible, hiddenSizingItems]); // /* istanbul ignore next */ // not sure how to fake window resize
178
178
 
179
179
  var handleResize = function handleResize() {
180
- // width is the space available for all action bar items horizontally
181
- // the action bar items are squares so the height should be one item wide
182
-
183
- /* istanbul ignore next */
184
- // not sure how to fake window resize
185
- checkFullyVisibleItems();
186
- };
187
- /* istanbul ignore next */
188
- // not sure how to fake window resize
189
-
190
-
191
- var handleActionBarItemsResize = function handleActionBarItemsResize() {
192
180
  // when the hidden sizing items change size
193
181
 
194
182
  /* istanbul ignore next */
195
183
  // not sure how to fake window resize
196
184
  checkFullyVisibleItems();
197
- };
198
-
199
- useResizeDetector({
200
- onResize: handleActionBarItemsResize,
201
- targetRef: sizingRef
202
- });
185
+ }; // // resize of the items
203
186
 
204
- var _useResizeDetector = useResizeDetector({
205
- onResize: handleResize,
206
- targetRef: ref
207
- }),
208
- outerRef = _useResizeDetector.ref;
209
187
 
188
+ useResizeObserver(sizingRef, {
189
+ callback: handleResize
190
+ });
191
+ useResizeObserver(localRef, {
192
+ callback: handleResize
193
+ });
210
194
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
211
195
  className: cx([blockClass, className]),
212
- ref: outerRef
196
+ ref: localRef
213
197
  }), hiddenSizingItems, /*#__PURE__*/React.createElement("div", {
214
198
  ref: refDisplayedItems,
215
199
  className: cx(["".concat(blockClass, "__displayed-items"), _defineProperty({}, "".concat(blockClass, "__displayed-items--right"), rightAlign)])
@@ -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 = ["className", "clearFiltersText", "closeIconDescription", "columnInputPlaceholder", "defaultModifiers", "description", "filterByLabel", "globalFilterOpts", "globalFiltersLabel", "globalFiltersIconDescription", "globalFiltersPlaceholderText", "globalFiltersPrimaryButtonText", "globalFiltersSecondaryButtonText", "globalSearchLabel", "globalSearchPlaceholder", "globalSortBy", "illustrationTheme", "influencerTitle", "items", "itemsLabel", "metaIconDescription", "metaPanelTitle", "multi", "navIconDescription", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "normalizedItems", "onClose", "onCloseButtonText", "onSubmit", "onSubmitButtonText", "open", "portalTarget", "searchResultsTitle", "title", "useNormalizedItems"];
5
+ var _excluded = ["className", "clearFiltersText", "closeIconDescription", "columnInputPlaceholder", "defaultModifiers", "description", "filterByLabel", "globalFilterOpts", "globalFiltersLabel", "globalFiltersIconDescription", "globalFiltersPlaceholderText", "globalFiltersPrimaryButtonText", "globalFiltersSecondaryButtonText", "globalSearchLabel", "globalSearchPlaceholder", "globalSortBy", "illustrationTheme", "influencerTitle", "items", "itemsLabel", "metaIconDescription", "metaPanelTitle", "multi", "navIconDescription", "noResultsDescription", "noResultsTitle", "noSelectionDescription", "noSelectionTitle", "normalizedItems", "onClose", "onCloseButtonText", "onSubmit", "onSubmitButtonText", "open", "portalTarget", "searchResultsTitle", "sortByLabel", "title", "useNormalizedItems"];
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
 
@@ -72,6 +72,7 @@ export var AddSelectBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
72
  open = _ref.open,
73
73
  portalTarget = _ref.portalTarget,
74
74
  searchResultsTitle = _ref.searchResultsTitle,
75
+ sortByLabel = _ref.sortByLabel,
75
76
  title = _ref.title,
76
77
  useNormalizedItems = _ref.useNormalizedItems,
77
78
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -296,7 +297,8 @@ export var AddSelectBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
296
297
  items: itemsToDisplay,
297
298
  columnInputPlaceholder: columnInputPlaceholder,
298
299
  header: (_path$ = path[0]) === null || _path$ === void 0 ? void 0 : _path$.title,
299
- filterByLabel: filterByLabel
300
+ filterByLabel: filterByLabel,
301
+ sortByLabel: sortByLabel
300
302
  }))) : /*#__PURE__*/React.createElement("div", null, hasResults ? /*#__PURE__*/React.createElement(AddSelectList, _extends({}, commonListProps, {
301
303
  filteredItems: itemsToDisplay,
302
304
  modifiers: items.modifiers,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["columnInputPlaceholder", "filterByLabel", "header", "items", "multiSelection", "parentId", "path", "setMultiSelection", "setPath"];
5
+ var _excluded = ["columnInputPlaceholder", "filterByLabel", "header", "items", "multiSelection", "parentId", "path", "setMultiSelection", "setPath", "sortByLabel"];
6
6
  //
7
7
  // Copyright IBM Corp. 2022, 2022
8
8
  //
@@ -33,6 +33,7 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
33
33
  path = _ref.path,
34
34
  setMultiSelection = _ref.setMultiSelection,
35
35
  setPath = _ref.setPath,
36
+ sortByLabel = _ref.sortByLabel,
36
37
  props = _objectWithoutProperties(_ref, _excluded);
37
38
 
38
39
  var carbonPrefix = usePrefix();
@@ -183,7 +184,8 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
183
184
  setSortDirection: setSortDirection,
184
185
  sortAttribute: sortAttribute,
185
186
  sortDirection: sortDirection,
186
- sortBy: sortBy
187
+ sortBy: sortBy,
188
+ sortByLabel: sortByLabel
187
189
  }), filterByOpts.length > 0 && /*#__PURE__*/React.createElement(OverflowMenu, {
188
190
  renderIcon: function renderIcon(props) {
189
191
  return /*#__PURE__*/React.createElement(Filter, _extends({
@@ -192,7 +194,8 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
192
194
  },
193
195
  className: "".concat(colClass, "-overflow"),
194
196
  flipped: true,
195
- ariaLabel: filterByLabel
197
+ ariaLabel: filterByLabel,
198
+ iconDescription: filterByLabel
196
199
  }, filterByOpts.map(function (opt) {
197
200
  return /*#__PURE__*/React.createElement("div", {
198
201
  key: opt,
@@ -236,7 +239,9 @@ export var AddSelectColumn = function AddSelectColumn(_ref) {
236
239
  setMultiSelection: setMultiSelection,
237
240
  parentId: selectedItem.id,
238
241
  setPath: setPath,
239
- path: path
242
+ path: path,
243
+ sortByLabel: sortByLabel,
244
+ filterByLabel: filterByLabel
240
245
  }, props)));
241
246
  };
242
247
  AddSelectColumn.propTypes = {
@@ -248,6 +253,7 @@ AddSelectColumn.propTypes = {
248
253
  parentId: PropTypes.string,
249
254
  path: PropTypes.array,
250
255
  setMultiSelection: PropTypes.func,
251
- setPath: PropTypes.func
256
+ setPath: PropTypes.func,
257
+ sortByLabel: PropTypes.string
252
258
  };
253
259
  AddSelectColumn.displayName = componentName;
@@ -13,7 +13,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13
13
  // LICENSE file in the root directory of this source tree.
14
14
  //
15
15
  import React, { useState } from 'react';
16
- import { Button, ButtonSet, Dropdown, Search, Tag } from '@carbon/react';
16
+ import { Button, ButtonSet, Dropdown, Search, Tag, Layer } from '@carbon/react';
17
17
  import cx from 'classnames';
18
18
  import PropTypes from 'prop-types';
19
19
  import { Filter } from '@carbon/react/icons';
@@ -116,16 +116,17 @@ export var AddSelectFilter = function AddSelectFilter(_ref) {
116
116
  className: filterBtnClassnames,
117
117
  size: "md",
118
118
  tooltipPosition: "left"
119
- }), open && /*#__PURE__*/React.createElement("div", {
120
- className: blockClass
119
+ }), open && /*#__PURE__*/React.createElement(Layer, {
120
+ className: blockClass,
121
+ level: 1
121
122
  }, /*#__PURE__*/React.createElement("div", {
122
123
  className: "".concat(blockClass, "-content")
123
124
  }, /*#__PURE__*/React.createElement("p", null, filtersLabel), /*#__PURE__*/React.createElement("div", {
124
125
  className: "".concat(blockClass, "-opts")
125
126
  }, filterOpts.map(function (filterOpts) {
126
127
  return /*#__PURE__*/React.createElement(Dropdown, {
127
- id: filterOpts.id,
128
128
  key: filterOpts.id,
129
+ id: filterOpts.id,
129
130
  titleText: filterOpts.label,
130
131
  items: filterOpts.opts,
131
132
  onChange: function onChange(value) {
@@ -8,7 +8,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
8
8
  // LICENSE file in the root directory of this source tree.
9
9
  //
10
10
  import React, { useRef, useEffect, useCallback } from 'react';
11
- import { Button, Dropdown } from '@carbon/react';
11
+ import { Button, Dropdown, Layer } from '@carbon/react';
12
12
  import { ChevronRight, View } from '@carbon/react/icons';
13
13
  import PropTypes from 'prop-types';
14
14
  import cx from 'classnames';
@@ -149,7 +149,7 @@ export var AddSelectRow = function AddSelectRow(_ref) {
149
149
  item: item,
150
150
  selected: selected,
151
151
  onClick: handleMultiSelection
152
- }), hasModifiers && /*#__PURE__*/React.createElement(Dropdown, {
152
+ }), hasModifiers && /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(Dropdown, {
153
153
  id: "add-select-modifier-".concat(item.id),
154
154
  type: "inline",
155
155
  items: modifiers.options,
@@ -161,7 +161,7 @@ export var AddSelectRow = function AddSelectRow(_ref) {
161
161
  var selectedItem = _ref3.selectedItem;
162
162
  return modifierHandler(item.id, selectedItem);
163
163
  }
164
- })) : /*#__PURE__*/React.createElement(AddSelectFormControl, {
164
+ }))) : /*#__PURE__*/React.createElement(AddSelectFormControl, {
165
165
  type: "radio",
166
166
  item: item,
167
167
  selected: selected,
@@ -54,7 +54,8 @@ export var AddSelectSort = function AddSelectSort(_ref) {
54
54
  },
55
55
  className: "".concat(blockClass, "_overflow"),
56
56
  flipped: true,
57
- ariaLabel: sortByLabel
57
+ ariaLabel: sortByLabel,
58
+ iconDescription: sortByLabel
58
59
  }, sortByOpts.map(function (opt) {
59
60
  return /*#__PURE__*/React.createElement(OverflowMenuItem, {
60
61
  className: "".concat(blockClass, "_overflow-item"),
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
14
 
15
15
  //
16
- // Copyright IBM Corp. 2020, 2021
16
+ // Copyright IBM Corp. 2020, 2023
17
17
  //
18
18
  // This source code is licensed under the Apache-2.0 license found in the
19
19
  // LICENSE file in the root directory of this source tree.
@@ -23,9 +23,9 @@ import React, { useState, useEffect, useRef } from 'react'; // Other standard im
23
23
 
24
24
  import PropTypes from 'prop-types';
25
25
  import cx from 'classnames';
26
- import { useResizeDetector } from 'react-resize-detector'; // Carbon and package components we use.
26
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver'; // Carbon and package components we use.
27
27
 
28
- import { Breadcrumb, BreadcrumbItem, Link, IconButton, OverflowMenu, OverflowMenuItem, usePrefix } from '@carbon/react';
28
+ import { Breadcrumb, BreadcrumbItem, IconButton, Link, OverflowMenu, OverflowMenuItem, usePrefix } from '@carbon/react';
29
29
  import { pkg } from '../../settings';
30
30
  import { ArrowLeft, OverflowMenuHorizontal } from '@carbon/react/icons';
31
31
  import uuidv4 from '../../global/js/utils/uuidv4';
@@ -258,15 +258,6 @@ export var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
258
258
  // not sure how to test resize
259
259
  checkFullyVisibleBreadcrumbItems();
260
260
  };
261
- /* istanbul ignore next */
262
- // not sure how to test resize
263
-
264
-
265
- var handleBreadcrumbItemsResize = function handleBreadcrumbItemsResize() {
266
- /* istanbul ignore next */
267
- // not sure how to test resize
268
- checkFullyVisibleBreadcrumbItems();
269
- };
270
261
 
271
262
  var backItem = breadcrumbs[breadcrumbs.length - 1];
272
263
  /* istanbul ignore if */
@@ -274,15 +265,15 @@ export var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
274
265
 
275
266
  if (backItem.isCurrentPage) {
276
267
  backItem = breadcrumbs[breadcrumbs.length - 2];
277
- }
268
+ } // container resize
278
269
 
279
- useResizeDetector({
280
- onResize: handleBreadcrumbItemsResize,
281
- targetRef: sizingContainerRef
282
- });
283
- useResizeDetector({
284
- onResize: handleResize,
285
- targetRef: breadcrumbItemWithOverflow
270
+
271
+ useResizeObserver(sizingContainerRef, {
272
+ callback: handleResize
273
+ }); // item resize
274
+
275
+ useResizeObserver(breadcrumbItemWithOverflow, {
276
+ callback: handleResize
286
277
  });
287
278
  return /*#__PURE__*/React.createElement("div", {
288
279
  className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "__with-items"), displayedBreadcrumbItems.length > 1)),
@@ -298,8 +289,11 @@ export var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
298
289
  href: backItem.href,
299
290
  renderIcon: function renderIcon() {
300
291
  return /*#__PURE__*/React.createElement(IconButton, {
292
+ className: "".concat(blockClass, "__back__button"),
293
+ align: "right",
294
+ kind: "ghost",
301
295
  label: backItem.title || backItem.label,
302
- align: "right"
296
+ size: "sm"
303
297
  }, /*#__PURE__*/React.createElement(ArrowLeft, {
304
298
  size: 16
305
299
  }));
@@ -26,7 +26,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
26
26
  import React, { useEffect, useState, useRef } from 'react';
27
27
  import PropTypes from 'prop-types';
28
28
  import cx from 'classnames';
29
- import { useResizeDetector } from 'react-resize-detector';
29
+ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
30
30
  import { ButtonSet, Button, usePrefix } from '@carbon/react';
31
31
  import { ButtonMenu, ButtonMenuItem } from '../ButtonMenu';
32
32
  import { pkg } from '../../settings';
@@ -150,18 +150,14 @@ export var ButtonSetWithOverflow = function ButtonSetWithOverflow(_ref) {
150
150
  }, prepareProps(other, ['iconDescription', 'renderIcon'])));
151
151
  }).reverse());
152
152
  });
153
- useResizeDetector({
154
- onResize: checkFullyVisibleItems,
155
- targetRef: sizingContainerRefSet
153
+ useResizeObserver(sizingContainerRefSet, {
154
+ callback: checkFullyVisibleItems
156
155
  });
157
- useResizeDetector({
158
- onResize: checkFullyVisibleItems,
159
- targetRef: sizingContainerRefCombo
156
+ useResizeObserver(sizingContainerRefCombo, {
157
+ callback: checkFullyVisibleItems
160
158
  });
161
- useResizeDetector({
162
- onResize: checkFullyVisibleItems,
163
- targetRef: spaceAvailableRef,
164
- handleWidth: true
159
+ useResizeObserver(spaceAvailableRef, {
160
+ callback: checkFullyVisibleItems
165
161
  });
166
162
  return /*#__PURE__*/React.createElement("div", {
167
163
  className: cx([blockClass, className, _defineProperty({}, "".concat(blockClass, "--right"), rightAlign)]),
@@ -4,14 +4,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  var _excluded = ["onChange"];
6
6
 
7
- /*
8
- * Licensed Materials - Property of IBM
9
- * 5724-Q36
10
- * (c) Copyright IBM Corp. 2020, 2021
11
- * US Government Users Restricted Rights - Use, duplication or disclosure
12
- * restricted by GSA ADP Schedule Contract with IBM Corp.
7
+ /**
8
+ * Copyright IBM Corp. 2020, 2023
9
+ *
10
+ * This source code is licensed under the Apache-2.0 license found in the
11
+ * LICENSE file in the root directory of this source tree.
13
12
  */
14
- // @flow
15
13
  import React, { useEffect, useState, useLayoutEffect } from 'react';
16
14
  import PropTypes from 'prop-types';
17
15
  import cx from 'classnames';
@@ -103,7 +101,8 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
103
101
  }, props));
104
102
  },
105
103
  size: "sm",
106
- ariaLabel: allRowsLabel
104
+ ariaLabel: allRowsLabel,
105
+ menuOptionsClass: "".concat(blockClass, "__select-all-toggle-overflow")
107
106
  }, /*#__PURE__*/React.createElement(OverflowMenuItem, {
108
107
  itemText: allPageRowsLabel,
109
108
  requireTitle: true,
@@ -7,10 +7,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
7
7
  * This source code is licensed under the Apache-2.0 license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- import React, { useEffect, useState } from 'react';
10
+ import React, { useEffect, useRef, useState } from 'react';
11
11
  import { Add, OverflowMenuVertical } from '@carbon/react/icons';
12
12
  import { TableToolbar, TableBatchActions, TableBatchAction } from '@carbon/react';
13
- import { useResizeDetector } from 'react-resize-detector';
13
+ import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver';
14
14
  import { ButtonMenu, ButtonMenuItem } from '../../ButtonMenu';
15
15
  import { pkg, carbon } from '../../../settings';
16
16
  import cx from 'classnames';
@@ -134,9 +134,10 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
134
134
  };
135
135
 
136
136
  var DatagridToolbar = function DatagridToolbar(datagridState) {
137
- var _useResizeDetector = useResizeDetector(),
138
- width = _useResizeDetector.width,
139
- ref = _useResizeDetector.ref;
137
+ var ref = useRef(null);
138
+
139
+ var _useResizeObserver = useResizeObserver(ref),
140
+ width = _useResizeObserver.width;
140
141
 
141
142
  var DatagridActions = datagridState.DatagridActions,
142
143
  DatagridBatchActions = datagridState.DatagridBatchActions,
@@ -18,7 +18,7 @@ import { TableBody } from '@carbon/react';
18
18
  import { pkg } from '../../../settings';
19
19
  import DatagridHead from './DatagridHead';
20
20
  import { px } from '@carbon/layout';
21
- import { useResizeDetector } from 'react-resize-detector';
21
+ import { useResizeObserver } from '../../../global/js/hooks/useResizeObserver';
22
22
  var blockClass = "".concat(pkg.prefix, "--datagrid");
23
23
  var rowSizeMap = {
24
24
  xs: 24,
@@ -57,9 +57,8 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
57
57
  gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
58
58
  };
59
59
 
60
- useResizeDetector({
61
- onResize: handleVirtualGridResize,
62
- targetRef: gridRef
60
+ useResizeObserver(gridRef, {
61
+ callback: handleVirtualGridResize
63
62
  });
64
63
 
65
64
  var syncScroll = function syncScroll(e) {
@@ -46,9 +46,13 @@ var FilterFlyout = function FilterFlyout(_ref) {
46
46
  secondaryActionLabel = _ref$secondaryActionL === void 0 ? 'Cancel' : _ref$secondaryActionL,
47
47
  setAllFilters = _ref.setAllFilters,
48
48
  _ref$data = _ref.data,
49
- data = _ref$data === void 0 ? [] : _ref$data;
50
-
49
+ data = _ref$data === void 0 ? [] : _ref$data,
50
+ _ref$initialFilters = _ref.initialFilters,
51
+ initialFilters = _ref$initialFilters === void 0 ? [] : _ref$initialFilters;
52
+ // Save the initial filters we only need the filters once when it loads
53
+ var initialFiltersRef = useRef(initialFilters);
51
54
  /** State */
55
+
52
56
  var _useState = useState(false),
53
57
  _useState2 = _slicedToArray(_useState, 2),
54
58
  open = _useState2[0],
@@ -58,7 +62,8 @@ var FilterFlyout = function FilterFlyout(_ref) {
58
62
  updateMethod: updateMethod,
59
63
  filters: filters,
60
64
  setAllFilters: setAllFilters,
61
- variation: FLYOUT
65
+ variation: FLYOUT,
66
+ initialFilters: initialFiltersRef.current
62
67
  }),
63
68
  filtersState = _useFilters.filtersState,
64
69
  prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
@@ -208,6 +213,15 @@ FilterFlyout.propTypes = {
208
213
  */
209
214
  flyoutIconDescription: PropTypes.string,
210
215
 
216
+ /**
217
+ * Filters that should be applied on load
218
+ */
219
+ initialFilters: PropTypes.arrayOf(PropTypes.shape({
220
+ id: PropTypes.string.isRequired,
221
+ type: PropTypes.string.isRequired,
222
+ value: PropTypes.any.isRequired
223
+ })),
224
+
211
225
  /**
212
226
  * Callback when the apply button is clicked
213
227
  */
@@ -57,9 +57,13 @@ var FilterPanel = function FilterPanel(_ref) {
57
57
  _ref$searchLabelText = _ref.searchLabelText,
58
58
  searchLabelText = _ref$searchLabelText === void 0 ? 'Filter search' : _ref$searchLabelText,
59
59
  _ref$searchPlaceholde = _ref.searchPlaceholder,
60
- searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde;
61
-
60
+ searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde,
61
+ _ref$initialFilters = _ref.initialFilters,
62
+ initialFilters = _ref$initialFilters === void 0 ? [] : _ref$initialFilters;
63
+ // Save the initial filters we only need the filters once
64
+ var initialFiltersRef = useRef(initialFilters);
62
65
  /** State */
66
+
63
67
  var _useState = useState(false),
64
68
  _useState2 = _slicedToArray(_useState, 2),
65
69
  showDividerLine = _useState2[0],
@@ -69,7 +73,8 @@ var FilterPanel = function FilterPanel(_ref) {
69
73
  updateMethod: updateMethod,
70
74
  filters: filterSections,
71
75
  setAllFilters: setAllFilters,
72
- variation: PANEL
76
+ variation: PANEL,
77
+ initialFilters: initialFiltersRef.current
73
78
  }),
74
79
  filtersState = _useFilters.filtersState,
75
80
  prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
@@ -225,13 +230,14 @@ var FilterPanel = function FilterPanel(_ref) {
225
230
  height: getScrollableContainerHeight()
226
231
  },
227
232
  onScroll: onInnerContainerScroll
228
- }, filterSections.map(function (_ref2) {
233
+ }, filterSections.map(function (_ref2, index) {
229
234
  var _ref2$categoryTitle = _ref2.categoryTitle,
230
235
  categoryTitle = _ref2$categoryTitle === void 0 ? null : _ref2$categoryTitle,
231
236
  _ref2$filters = _ref2.filters,
232
237
  filters = _ref2$filters === void 0 ? [] : _ref2$filters,
233
238
  hasAccordion = _ref2.hasAccordion;
234
239
  return /*#__PURE__*/React.createElement("div", {
240
+ key: index,
235
241
  className: "".concat(componentClass, "__category")
236
242
  }, categoryTitle && /*#__PURE__*/React.createElement("div", {
237
243
  className: "".concat(componentClass, "__category-title")
@@ -253,6 +259,15 @@ FilterPanel.propTypes = {
253
259
  closeIconDescription: PropTypes.string,
254
260
  filterPanelMinHeight: PropTypes.number,
255
261
  filterSections: PropTypes.array,
262
+
263
+ /**
264
+ * Filters that should be applied on load
265
+ */
266
+ initialFilters: PropTypes.arrayOf(PropTypes.shape({
267
+ id: PropTypes.string.isRequired,
268
+ type: PropTypes.string.isRequired,
269
+ value: PropTypes.any.isRequired
270
+ })),
256
271
  onApply: PropTypes.func,
257
272
  onCancel: PropTypes.func,
258
273
  onPanelClose: PropTypes.func,
@@ -25,15 +25,16 @@ var useFilters = function useFilters(_ref) {
25
25
  _ref$filters = _ref.filters,
26
26
  filters = _ref$filters === void 0 ? [] : _ref$filters,
27
27
  setAllFilters = _ref.setAllFilters,
28
- variation = _ref.variation;
28
+ variation = _ref.variation,
29
+ initialFilters = _ref.initialFilters;
29
30
 
30
31
  /** State */
31
- var _useInitialStateFromF = useInitialStateFromFilters(filters, variation),
32
+ var _useInitialStateFromF = useInitialStateFromFilters(filters, variation, initialFilters),
32
33
  _useInitialStateFromF2 = _slicedToArray(_useInitialStateFromF, 2),
33
34
  filtersState = _useInitialStateFromF2[0],
34
35
  setFiltersState = _useInitialStateFromF2[1];
35
36
 
36
- var _useState = useState([]),
37
+ var _useState = useState(initialFilters),
37
38
  _useState2 = _slicedToArray(_useState, 2),
38
39
  filtersObjectArray = _useState2[0],
39
40
  setFiltersObjectArray = _useState2[1]; // When using batch actions we have to store the filters to then apply them later
@@ -51,8 +52,10 @@ var useFilters = function useFilters(_ref) {
51
52
  };
52
53
 
53
54
  var reset = function reset() {
54
- // Get the initial values for the filters
55
- var initialFiltersState = getInitialStateFromFilters(filters, variation);
55
+ // When we reset we want the "initialFilters" to be an empty array
56
+ var resetFiltersArray = []; // Get the initial values for the filters
57
+
58
+ var initialFiltersState = getInitialStateFromFilters(filters, variation, resetFiltersArray);
56
59
  var initialFiltersObjectArray = []; // Set the state to the initial values
57
60
 
58
61
  setFiltersState(initialFiltersState);
@@ -13,8 +13,9 @@ import { getInitialStateFromFilters } from '../utils';
13
13
 
14
14
  var useInitialStateFromFilters = function useInitialStateFromFilters(filters) {
15
15
  var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
16
+ var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
16
17
 
17
- var _useState = useState(getInitialStateFromFilters(filters, variation)),
18
+ var _useState = useState(getInitialStateFromFilters(filters, variation, initialFilters)),
18
19
  _useState2 = _slicedToArray(_useState, 2),
19
20
  state = _useState2[0],
20
21
  setState = _useState2[1];
@@ -4,10 +4,24 @@
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
- import { CHECKBOX, DATE, DROPDOWN, FLYOUT, NUMBER, PANEL, RADIO } from './constants'; // This functions takes the filters passed in and makes an object to track it's state
7
+ import { CHECKBOX, DATE, DROPDOWN, FLYOUT, NUMBER, PANEL, RADIO } from './constants';
8
+
9
+ var applyInitialFilters = function applyInitialFilters(filterState, initialFilters) {
10
+ Object.keys(filterState).forEach(function (key) {
11
+ var hasInitialFilter = initialFilters.find(function (filter) {
12
+ return filter.id === key;
13
+ });
14
+
15
+ if (hasInitialFilter) {
16
+ filterState[key].value = hasInitialFilter.value;
17
+ }
18
+ });
19
+ }; // This functions takes the filters passed in and makes an object to track it's state
20
+
8
21
 
9
22
  export var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
10
23
  var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
24
+ var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
11
25
  var initialFilterState = {};
12
26
 
13
27
  var setInitialState = function setInitialState(_ref) {
@@ -68,5 +82,9 @@ export var getInitialStateFromFilters = function getInitialStateFromFilters(filt
68
82
  console.error('No variation passed into useInitialStateFromFilters');
69
83
  }
70
84
 
85
+ if (initialFilters.length > 0) {
86
+ applyInitialFilters(initialFilterState, initialFilters);
87
+ }
88
+
71
89
  return initialFilterState;
72
90
  };
@@ -22,5 +22,6 @@ export { default as useSelectAllWithToggle } from './useSelectAllToggle';
22
22
  export { default as useColumnCenterAlign } from './useColumnCenterAlign';
23
23
  export { default as useColumnOrder } from './useColumnOrder';
24
24
  export { default as useInlineEdit } from './useInlineEdit';
25
+ export { default as useEditableCell } from './useEditableCell';
25
26
  export { default as useFiltering } from './useFiltering';
26
27
  export { getAutoSizedColumnWidth } from './utils/getAutoSizedColumnWidth';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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 useInlineEdit from './useInlineEdit';
8
+
9
+ var useEditableCell = function useEditableCell(hooks) {
10
+ useInlineEdit(hooks, 'usingEditableCell');
11
+ };
12
+
13
+ export default useEditableCell;
@@ -71,11 +71,13 @@ var useFiltering = function useFiltering(hooks) {
71
71
  setAllFilters = instance.setAllFilters,
72
72
  setFilter = instance.setFilter,
73
73
  headers = instance.headers,
74
- data = instance.data;
74
+ data = instance.data,
75
+ state = instance.state;
75
76
  var defaultProps = {
76
77
  variation: 'flyout',
77
78
  updateMethod: BATCH,
78
- panelIconDescription: 'Open filter panel'
79
+ panelIconDescription: 'Open filter panel',
80
+ initialFilters: state.filters
79
81
  };
80
82
 
81
83
  var getFilterFlyoutProps = function getFilterFlyoutProps() {