@carbon/ibm-products 2.32.0 → 2.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/css/index-full-carbon.css +56 -0
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +56 -0
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +56 -0
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/ActionBar/ActionBar.js +8 -1
  14. package/es/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
  15. package/es/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
  16. package/es/components/DataSpreadsheet/DataSpreadsheet.js +36 -30
  17. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +49 -2
  18. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
  19. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +10 -3
  20. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
  21. package/es/components/Datagrid/useRowSize.js +4 -2
  22. package/es/components/DescriptionList/DescriptionList.d.ts +0 -37
  23. package/es/components/DescriptionList/DescriptionList.js +7 -12
  24. package/es/components/DescriptionList/DescriptionListBody.d.ts +2 -0
  25. package/es/components/DescriptionList/DescriptionListBody.js +39 -0
  26. package/es/components/DescriptionList/DescriptionListCell.d.ts +2 -0
  27. package/es/components/DescriptionList/DescriptionListCell.js +39 -0
  28. package/es/components/DescriptionList/DescriptionListRow.d.ts +2 -0
  29. package/es/components/DescriptionList/DescriptionListRow.js +41 -0
  30. package/es/components/DescriptionList/index.d.ts +4 -1
  31. package/es/components/FilterPanel/FilterPanel.d.ts +5 -0
  32. package/es/components/FilterPanel/FilterPanel.js +55 -0
  33. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  34. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +78 -0
  35. package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
  36. package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +63 -0
  37. package/es/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
  38. package/es/components/FilterPanel/index.d.ts +3 -0
  39. package/es/components/SidePanel/SidePanel.js +35 -68
  40. package/es/components/Tearsheet/TearsheetShell.js +9 -1
  41. package/es/components/Toolbar/ToolbarGroup.d.ts +17 -2
  42. package/es/components/Toolbar/ToolbarGroup.js +0 -1
  43. package/es/components/index.d.ts +3 -1
  44. package/es/global/js/hooks/useFocus.js +9 -2
  45. package/es/global/js/package-settings.d.ts +7 -0
  46. package/es/global/js/package-settings.js +7 -0
  47. package/es/index.js +7 -0
  48. package/es/settings.d.ts +7 -0
  49. package/lib/components/ActionBar/ActionBar.js +11 -6
  50. package/lib/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
  51. package/lib/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
  52. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +36 -30
  53. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +49 -2
  54. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
  55. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +9 -2
  56. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
  57. package/lib/components/Datagrid/useRowSize.js +4 -2
  58. package/lib/components/DescriptionList/DescriptionList.d.ts +0 -37
  59. package/lib/components/DescriptionList/DescriptionList.js +6 -11
  60. package/lib/components/DescriptionList/DescriptionListBody.d.ts +2 -0
  61. package/lib/components/DescriptionList/DescriptionListBody.js +46 -0
  62. package/lib/components/DescriptionList/DescriptionListCell.d.ts +2 -0
  63. package/lib/components/DescriptionList/DescriptionListCell.js +46 -0
  64. package/lib/components/DescriptionList/DescriptionListRow.d.ts +2 -0
  65. package/lib/components/DescriptionList/DescriptionListRow.js +48 -0
  66. package/lib/components/DescriptionList/index.d.ts +4 -1
  67. package/lib/components/FilterPanel/FilterPanel.d.ts +5 -0
  68. package/lib/components/FilterPanel/FilterPanel.js +62 -0
  69. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  70. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +85 -0
  71. package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
  72. package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +70 -0
  73. package/lib/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
  74. package/lib/components/FilterPanel/index.d.ts +3 -0
  75. package/lib/components/SidePanel/SidePanel.js +35 -68
  76. package/lib/components/Tearsheet/TearsheetShell.js +9 -1
  77. package/lib/components/Toolbar/ToolbarGroup.d.ts +17 -2
  78. package/lib/components/Toolbar/ToolbarGroup.js +0 -1
  79. package/lib/components/index.d.ts +3 -1
  80. package/lib/global/js/hooks/useFocus.js +9 -2
  81. package/lib/global/js/package-settings.d.ts +7 -0
  82. package/lib/global/js/package-settings.js +7 -0
  83. package/lib/index.js +35 -0
  84. package/lib/settings.d.ts +7 -0
  85. package/package.json +3 -3
  86. package/scss/components/FilterPanel/_carbon-imports.scss +9 -0
  87. package/scss/components/FilterPanel/_filter-panel-checkbox.scss +32 -0
  88. package/scss/components/FilterPanel/_filter-panel-label.scss +47 -0
  89. package/scss/components/FilterPanel/_filter-panel.scss +29 -0
  90. package/scss/components/FilterPanel/_index-with-carbon.scss +11 -0
  91. package/scss/components/FilterPanel/_index.scss +10 -0
  92. package/scss/components/_index-with-carbon.scss +1 -0
  93. package/scss/components/_index.scss +1 -0
@@ -25,13 +25,19 @@ var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWi
25
25
  var blockClass = "".concat(pkg.prefix, "--action-bar");
26
26
  var componentName = 'ActionBar';
27
27
 
28
+ // Default values for props
29
+ var defaults = {
30
+ actions: Object.freeze([])
31
+ };
32
+
28
33
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
29
34
 
30
35
  /**
31
36
  * The ActionBar is used internally by the PageHeader to wrap ActionBarItems.
32
37
  */
33
38
  var ActionBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
34
- var actions = _ref.actions,
39
+ var _ref$actions = _ref.actions,
40
+ actions = _ref$actions === void 0 ? defaults.actions : _ref$actions,
35
41
  className = _ref.className,
36
42
  maxVisible = _ref.maxVisible,
37
43
  menuOptionsClass = _ref.menuOptionsClass,
@@ -188,6 +194,7 @@ var ActionBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
188
194
  className: cx(["".concat(blockClass, "__displayed-items"), _defineProperty({}, "".concat(blockClass, "__displayed-items--right"), rightAlign)])
189
195
  }, displayedItems));
190
196
  });
197
+ ActionBar = pkg.checkComponentEnabled(ActionBar, componentName);
191
198
  ActionBar.displayName = componentName;
192
199
  ActionBar.propTypes = {
193
200
  /**
@@ -1,2 +1,13 @@
1
- export let CreateTearsheetDivider: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2024
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
+ */
2
7
  import React from 'react';
8
+ interface CreateTearsheetDividerProps {
9
+ /** Specifies an optional className to be added to the tearsheet divider */
10
+ className?: string;
11
+ }
12
+ export declare let CreateTearsheetDivider: React.FC<CreateTearsheetDividerProps>;
13
+ export {};
@@ -27,7 +27,7 @@ var CreateTearsheetDivider = /*#__PURE__*/forwardRef(function (_ref, ref) {
27
27
  CreateTearsheetDivider = pkg.checkComponentEnabled(CreateTearsheetDivider, componentName);
28
28
  CreateTearsheetDivider.propTypes = {
29
29
  /**
30
- * Sets an optional className to be added to the tearsheet step
30
+ * Sets an optional className to be added to the tearsheet divider
31
31
  */
32
32
  className: PropTypes.string
33
33
  };
@@ -119,20 +119,24 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
119
119
  _useState18 = _slicedToArray(_useState17, 2),
120
120
  headerCellHoldActive = _useState18[0],
121
121
  setHeaderCellHoldActive = _useState18[1];
122
- var _useState19 = useState(false),
122
+ var _useState19 = useState(null),
123
123
  _useState20 = _slicedToArray(_useState19, 2),
124
- activeCellInsideSelectionArea = _useState20[0],
125
- setActiveCellInsideSelectionArea = _useState20[1];
124
+ isActiveHeaderCellChanged = _useState20[0],
125
+ setIsActiveHeaderCellChanged = _useState20[1];
126
+ var _useState21 = useState(false),
127
+ _useState22 = _slicedToArray(_useState21, 2),
128
+ activeCellInsideSelectionArea = _useState22[0],
129
+ setActiveCellInsideSelectionArea = _useState22[1];
126
130
  var previousState = usePreviousValue({
127
131
  activeCellCoordinates: activeCellCoordinates,
128
132
  isEditing: isEditing
129
133
  });
130
134
  var cellSizeValue = getCellSize(cellSize);
131
135
  var cellEditorRef = useRef();
132
- var _useState21 = useState(),
133
- _useState22 = _slicedToArray(_useState21, 2),
134
- activeCellContent = _useState22[0],
135
- setActiveCellContent = _useState22[1];
136
+ var _useState23 = useState(),
137
+ _useState24 = _slicedToArray(_useState23, 2),
138
+ activeCellContent = _useState24[0],
139
+ setActiveCellContent = _useState24[1];
136
140
  var activeCellRef = useRef();
137
141
  var cellEditorRulerRef = useRef();
138
142
  var defaultColumn = useMemo(function () {
@@ -206,6 +210,9 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
206
210
  }
207
211
  if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
208
212
  setActiveCellContent(null);
213
+ setIsActiveHeaderCellChanged(function (prev) {
214
+ return !prev;
215
+ });
209
216
  }
210
217
  }
211
218
  }, [activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, updateData, rows, isEditing, removeCellEditor, activeCellContent]);
@@ -216,23 +223,19 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
216
223
  addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
217
224
  var activeCellFullData = typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? rows[coords === null || coords === void 0 ? void 0 : coords.row].cells[coords === null || coords === void 0 ? void 0 : coords.column] : null;
218
225
  var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
219
- var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
220
- // Only create an active cell if the activeCellCoordinates have changed
221
- if ((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (coords === null || coords === void 0 ? void 0 : coords.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (coords === null || coords === void 0 ? void 0 : coords.column)) {
222
- createActiveCellFn({
223
- placementElement: placementElement,
224
- coords: coords,
225
- addToHeader: addToHeader,
226
- contextRef: spreadsheetRef,
227
- blockClass: blockClass,
228
- onActiveCellChange: onActiveCellChange,
229
- activeCellValue: activeCellValue,
230
- activeCellRef: activeCellRef,
231
- cellEditorRef: cellEditorRef,
232
- defaultColumn: defaultColumn
233
- });
234
- }
235
- }, [spreadsheetRef, rows, onActiveCellChange, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, defaultColumn]);
226
+ createActiveCellFn({
227
+ placementElement: placementElement,
228
+ coords: coords,
229
+ addToHeader: addToHeader,
230
+ contextRef: spreadsheetRef,
231
+ blockClass: blockClass,
232
+ onActiveCellChange: onActiveCellChange,
233
+ activeCellValue: activeCellValue,
234
+ activeCellRef: activeCellRef,
235
+ cellEditorRef: cellEditorRef,
236
+ defaultColumn: defaultColumn
237
+ });
238
+ }, [spreadsheetRef, rows, onActiveCellChange, defaultColumn]);
236
239
  useResetSpreadsheetFocus({
237
240
  focusedElement: focusedElement,
238
241
  removeActiveCell: removeActiveCell,
@@ -251,7 +254,9 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
251
254
  spreadsheetRef: spreadsheetRef,
252
255
  activeCellCoordinates: activeCellCoordinates,
253
256
  containerHasFocus: containerHasFocus,
254
- createActiveCell: createActiveCell
257
+ createActiveCell: createActiveCell,
258
+ activeCellContent: activeCellContent,
259
+ isActiveHeaderCellChanged: isActiveHeaderCellChanged
255
260
  });
256
261
  var handleInitialArrowPress = useCallback(function () {
257
262
  // If activeCellCoordinates is null then we need to set an initial value
@@ -299,10 +304,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
299
304
  spreadsheetRef: spreadsheetRef
300
305
  });
301
306
  }, [activeCellCoordinates, updateActiveCellCoordinates, spreadsheetRef, columns.length]);
302
- var checkforReturnConditon = useCallback(function (key) {
307
+ var checkForReturnCondition = useCallback(function (key) {
303
308
  return isEditing || key === 'Meta' || key === 'Control';
304
309
  }, [isEditing]);
305
- var handleArrowkeyPress = useCallback(function (arrowKey) {
310
+ var handleArrowKeyPress = useCallback(function (arrowKey) {
306
311
  event.preventDefault();
307
312
  handleInitialArrowPress();
308
313
  var coordinatesClone = _objectSpread2({}, activeCellCoordinates);
@@ -403,7 +408,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
403
408
  var key = event.key;
404
409
  // Command keys need to be returned as there is default browser behavior with these keys
405
410
  // Needs to be returned in editing mode
406
- if (checkforReturnConditon(key)) {
411
+ if (checkForReturnCondition(key)) {
407
412
  return;
408
413
  }
409
414
 
@@ -506,11 +511,11 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
506
511
  case 'ArrowRight':
507
512
  case 'ArrowDown':
508
513
  {
509
- handleArrowkeyPress(key);
514
+ handleArrowKeyPress(key);
510
515
  }
511
516
  }
512
517
  }
513
- }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkforReturnConditon, handleArrowkeyPress]);
518
+ }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
514
519
  var startEditMode = function startEditMode() {
515
520
  setIsEditing(true);
516
521
  setClickAndHoldActive(false);
@@ -709,6 +714,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
709
714
  visibleColumns: visibleColumns,
710
715
  selectAllAriaLabel: selectAllAriaLabel
711
716
  }), /*#__PURE__*/React__default.createElement(DataSpreadsheetBody, {
717
+ activeCellRef: activeCellRef,
712
718
  activeCellCoordinates: activeCellCoordinates,
713
719
  ref: spreadsheetRef,
714
720
  clickAndHoldActive: clickAndHoldActive,
@@ -27,7 +27,8 @@ import { useSpreadsheetMouseUp } from './hooks/useSpreadsheetMouseUp.js';
27
27
  var _div;
28
28
  var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
29
29
  var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
30
- var columns = _ref.columns,
30
+ var activeCellRef = _ref.activeCellRef,
31
+ columns = _ref.columns,
31
32
  activeCellCoordinates = _ref.activeCellCoordinates,
32
33
  defaultColumn = _ref.defaultColumn,
33
34
  defaultEmptyRowCount = _ref.defaultEmptyRowCount,
@@ -196,6 +197,47 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
196
197
  }
197
198
  }
198
199
  }, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
200
+ //selectionAreas will be set when ever a selection area is made.
201
+ useEffect(function () {
202
+ removeDuplicateSelections();
203
+ }, [selectionAreas, removeDuplicateSelections]);
204
+
205
+ //this method will check for any duplicate selection area and remove.
206
+ //same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
207
+ var removeDuplicateSelections = useCallback(function () {
208
+ var uniqueAttrArray = [],
209
+ removedSelectionAreaMatcherArr = [];
210
+ ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
211
+ var _selectorEl$style = selectorEl.style,
212
+ top = _selectorEl$style.top,
213
+ left = _selectorEl$style.left,
214
+ height = _selectorEl$style.height,
215
+ width = _selectorEl$style.width;
216
+ var uniqueAttrStr = "".concat(top).concat(left).concat(height).concat(width); // eg: 20px30px70px90px
217
+ if (uniqueAttrArray.indexOf(uniqueAttrStr) == -1) {
218
+ uniqueAttrArray.push(uniqueAttrStr);
219
+ } else {
220
+ selectorEl.remove(); // this is identified as duplicate selection and hence removing.
221
+ removedSelectionAreaMatcherArr.push(selectorEl.getAttribute('data-matcher-id'));
222
+ }
223
+ });
224
+
225
+ //clean the duplicate selectionAreaData and selectionArea
226
+ if (removedSelectionAreaMatcherArr.length) {
227
+ setSelectionAreas(function (prev) {
228
+ var prevValues = deepCloneObject(prev);
229
+ return prevValues.filter(function (item) {
230
+ return !removedSelectionAreaMatcherArr.includes(item.matcher);
231
+ });
232
+ });
233
+ setSelectionAreaData(function (prev) {
234
+ var prevValues = deepCloneObject(prev);
235
+ return prevValues.filter(function (item) {
236
+ return !removedSelectionAreaMatcherArr.includes(item.selectionId);
237
+ });
238
+ });
239
+ }
240
+ }, [ref, setSelectionAreas, setSelectionAreaData]);
199
241
 
200
242
  // onClick fn for each cell in the data spreadsheet body,
201
243
  // adds the active cell highlight
@@ -250,6 +292,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
250
292
  setSelectionAreas(selectionAreaClone);
251
293
  }
252
294
  } else {
295
+ activeCellRef.current.style.display = 'none';
253
296
  setActiveCellInsideSelectionArea(false);
254
297
  setActiveCellCoordinates(activeCoordinates);
255
298
  // remove all previous cell selections
@@ -264,7 +307,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
264
307
  setSelectionAreaData([]);
265
308
  }
266
309
  };
267
- }, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea]);
310
+ }, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
268
311
  var handleBodyScroll = function handleBodyScroll() {
269
312
  var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr"));
270
313
  headerRowElement.scrollLeft = contentScrollRef.current.scrollLeft;
@@ -428,6 +471,10 @@ DataSpreadsheetBody.propTypes = {
428
471
  row: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
429
472
  column: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
430
473
  }),
474
+ /**
475
+ *This is the ref of the button input, which is the active cell element
476
+ */
477
+ activeCellRef: PropTypes.object,
431
478
  /**
432
479
  * Is the user clicking and holding in the data spreadsheet body
433
480
  */
@@ -1,6 +1,8 @@
1
- export function useMoveActiveCell({ spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell, }: {
1
+ export function useMoveActiveCell({ spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell, activeCellContent, isActiveHeaderCellChanged, }: {
2
2
  spreadsheetRef: any;
3
3
  activeCellCoordinates: any;
4
4
  containerHasFocus: any;
5
5
  createActiveCell: any;
6
+ activeCellContent: any;
7
+ isActiveHeaderCellChanged: any;
6
8
  }): void;
@@ -5,15 +5,22 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { useEffect } from 'react';
8
+ import { useEffect, useCallback } from 'react';
9
9
 
10
10
  // Moves the placement of the active cell
11
11
  var useMoveActiveCell = function useMoveActiveCell(_ref) {
12
12
  var spreadsheetRef = _ref.spreadsheetRef,
13
13
  activeCellCoordinates = _ref.activeCellCoordinates,
14
14
  containerHasFocus = _ref.containerHasFocus,
15
- createActiveCell = _ref.createActiveCell;
15
+ createActiveCell = _ref.createActiveCell,
16
+ activeCellContent = _ref.activeCellContent,
17
+ isActiveHeaderCellChanged = _ref.isActiveHeaderCellChanged;
18
+ //new active cell is created when the activeCellContent changes or navigate through headers
19
+ // Otherwise new active cell will display the old value in a glance
16
20
  useEffect(function () {
21
+ performCreateActiveCell();
22
+ }, [activeCellContent, performCreateActiveCell, isActiveHeaderCellChanged]);
23
+ var performCreateActiveCell = useCallback(function () {
17
24
  var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
18
25
  var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
19
26
  var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
@@ -24,7 +31,7 @@ var useMoveActiveCell = function useMoveActiveCell(_ref) {
24
31
  addToHeader: shouldPlaceActiveCellInHeader
25
32
  });
26
33
  }
27
- }, [activeCellCoordinates, spreadsheetRef, createActiveCell, containerHasFocus]);
34
+ }, [spreadsheetRef, activeCellCoordinates, containerHasFocus, createActiveCell]);
28
35
  };
29
36
 
30
37
  export { useMoveActiveCell };
@@ -15,7 +15,6 @@ var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
15
15
  var RowSizeRadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
16
  var rowSizes = _ref.rowSizes,
17
17
  selectedOption = _ref.selectedOption,
18
- datagridName = _ref.datagridName,
19
18
  onChange = _ref.onChange,
20
19
  legendText = _ref.legendText,
21
20
  _ref$rowSizeLabels = _ref.rowSizeLabels,
@@ -25,7 +24,8 @@ var RowSizeRadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
25
24
  md: 'Medium',
26
25
  sm: 'Small',
27
26
  xs: 'Extra small'
28
- } : _ref$rowSizeLabels;
27
+ } : _ref$rowSizeLabels,
28
+ tableId = _ref.tableId;
29
29
  return /*#__PURE__*/React__default.createElement("div", {
30
30
  className: "".concat(blockClass, "-dropdown"),
31
31
  role: "presentation",
@@ -48,7 +48,7 @@ var RowSizeRadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
48
48
  key: option.value,
49
49
  labelText: labelText,
50
50
  value: option.value,
51
- id: "".concat(datagridName || 'datagrid', "--row-density--").concat(option.value)
51
+ id: "".concat(tableId || 'datagrid', "--row-density--").concat(option.value)
52
52
  });
53
53
  })));
54
54
  });
@@ -78,12 +78,12 @@ RowSizeRadioGroup.defaultProps = {
78
78
  selectedOption: 'lg'
79
79
  };
80
80
  RowSizeRadioGroup.propTypes = {
81
- datagridName: PropTypes.string,
82
81
  legendText: PropTypes.string,
83
82
  onChange: PropTypes.func.isRequired,
84
83
  rowSizeLabels: PropTypes.object,
85
84
  rowSizes: PropTypes.array.isRequired,
86
- selectedOption: PropTypes.string.isRequired
85
+ selectedOption: PropTypes.string.isRequired,
86
+ tableId: PropTypes.string.isRequired
87
87
  };
88
88
  var RowSizeRadioGroup$1 = RowSizeRadioGroup;
89
89
 
@@ -18,7 +18,8 @@ var useRowSize = function useRowSize(hooks) {
18
18
  var rowSizeProps = instance.rowSizeProps,
19
19
  rowSizes = instance.rowSizes,
20
20
  rowSize = instance.rowSize,
21
- onRowSizeChange = instance.onRowSizeChange;
21
+ onRowSizeChange = instance.onRowSizeChange,
22
+ tableId = instance.tableId;
22
23
  var _ref = rowSizeProps || {},
23
24
  labels = _ref.labels;
24
25
  Object.assign(instance, {
@@ -32,7 +33,8 @@ var useRowSize = function useRowSize(hooks) {
32
33
  if (typeof onRowSizeChange === 'function') {
33
34
  onRowSizeChange(value);
34
35
  }
35
- }
36
+ },
37
+ tableId: tableId
36
38
  }),
37
39
  RowSizeDropdown: RowSizeDropdown
38
40
  });
@@ -2,41 +2,4 @@
2
2
  * Type layouts provide an orderly layout of terms and definitions.
3
3
  */
4
4
  export let DescriptionList: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
- export function DescriptionListBody({ children, className, ...rest }: {
6
- [x: string]: any;
7
- children: any;
8
- className: any;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- export namespace DescriptionListBody {
11
- export namespace propTypes {
12
- let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
13
- let className: PropTypes.Requireable<string>;
14
- }
15
- export { componentNameBody as displayName };
16
- }
17
- export function DescriptionListRow({ children, className, ...other }: {
18
- [x: string]: any;
19
- children: any;
20
- className: any;
21
- }): import("react/jsx-runtime").JSX.Element;
22
- export namespace DescriptionListRow {
23
- export namespace propTypes_1 { }
24
- export { propTypes_1 as propTypes };
25
- export { componentNameRow as displayName };
26
- }
27
- export function DescriptionListCell({ children, className, ...rest }: {
28
- [x: string]: any;
29
- children: any;
30
- className: any;
31
- }): import("react/jsx-runtime").JSX.Element;
32
- export namespace DescriptionListCell {
33
- export namespace propTypes_2 { }
34
- export { propTypes_2 as propTypes };
35
- export { componentNameCell as displayName };
36
- }
37
5
  import React from 'react';
38
- import PropTypes from 'prop-types';
39
- declare const componentNameBody: "DescriptionListBody";
40
- declare const componentNameRow: "DescriptionListRow";
41
- declare const componentNameCell: "DescriptionListCell";
42
- export {};
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
@@ -65,24 +65,19 @@ DescriptionList = pkg.checkComponentEnabled(DescriptionList, componentName);
65
65
  // The display name of the component, used by React. Note that displayName
66
66
  // is used in preference to relying on function.name.
67
67
  DescriptionList.displayName = componentName;
68
- var propTypes = {
69
- /** Provide the contents of the node */
70
- children: PropTypes.node,
71
- /** Provide an optional class to be applied to the containing node */
72
- className: PropTypes.string
73
- };
74
68
 
75
69
  // The types and DocGen commentary for the component props,
76
70
  // in alphabetical order (for consistency).
77
71
  // See https://www.npmjs.com/package/prop-types#usage.
78
- DescriptionList.propTypes = _objectSpread2(_objectSpread2({}, propTypes), {}, {
72
+ DescriptionList.propTypes = {
79
73
  /** Specify if the type layout has a border */
80
74
  border: PropTypes.bool,
75
+ /** Provide the contents of the node */
76
+ children: PropTypes.node,
77
+ /** Provide an optional class to be applied to the containing node */
78
+ className: PropTypes.string,
81
79
  /** Specify the size of the type layout, from a list of available sizes */
82
80
  size: PropTypes.oneOf(Object.values(DescriptionListSize))
83
- });
84
- _objectSpread2({}, propTypes);
85
- _objectSpread2({}, propTypes);
86
- _objectSpread2({}, propTypes);
81
+ };
87
82
 
88
83
  export { DescriptionList };
@@ -0,0 +1,2 @@
1
+ export let DescriptionListBody: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ import React from 'react';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { StructuredListBody } from '@carbon/react';
15
+
16
+ var _excluded = ["children", "className"];
17
+
18
+ // The block part of our conventional BEM class names (blockClass__E--M).
19
+ var blockClass = "".concat(pkg.prefix, "--description-list__body");
20
+ var componentName = 'DescriptionListBody';
21
+ var DescriptionListBody = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
22
+ var children = _ref.children,
23
+ className = _ref.className,
24
+ rest = _objectWithoutProperties(_ref, _excluded);
25
+ return /*#__PURE__*/React__default.createElement(StructuredListBody, _extends({
26
+ className: cx(blockClass, className),
27
+ ref: ref
28
+ }, getDevtoolsProps(componentName), rest), children);
29
+ });
30
+ DescriptionListBody.propTypes = {
31
+ /** Provide the contents of the node */
32
+ children: PropTypes.node,
33
+ /** Provide an optional class to be applied to the containing node */
34
+ className: PropTypes.string
35
+ };
36
+ DescriptionListBody = pkg.checkComponentEnabled(DescriptionListBody, componentName);
37
+ DescriptionListBody.displayName = componentName;
38
+
39
+ export { DescriptionListBody };
@@ -0,0 +1,2 @@
1
+ export let DescriptionListCell: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ import React from 'react';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { StructuredListCell } from '@carbon/react';
15
+
16
+ var _excluded = ["children", "className"];
17
+
18
+ // The block part of our conventional BEM class names (blockClass__E--M).
19
+ var blockClass = "".concat(pkg.prefix, "--description-list__cell");
20
+ var componentName = 'DescriptionListCell';
21
+ var DescriptionListCell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
22
+ var children = _ref.children,
23
+ className = _ref.className,
24
+ rest = _objectWithoutProperties(_ref, _excluded);
25
+ return /*#__PURE__*/React__default.createElement(StructuredListCell, _extends({
26
+ className: cx(blockClass, className),
27
+ ref: ref
28
+ }, getDevtoolsProps(componentName), rest), children);
29
+ });
30
+ DescriptionListCell.propTypes = {
31
+ /** Provide the contents of the node */
32
+ children: PropTypes.node,
33
+ /** Provide an optional class to be applied to the containing node */
34
+ className: PropTypes.string
35
+ };
36
+ DescriptionListCell = pkg.checkComponentEnabled(DescriptionListCell, componentName);
37
+ DescriptionListCell.displayName = componentName;
38
+
39
+ export { DescriptionListCell };
@@ -0,0 +1,2 @@
1
+ export let DescriptionListRow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ import React from 'react';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { StructuredListRow } from '@carbon/react';
15
+
16
+ var _excluded = ["children", "className"];
17
+
18
+ // The block part of our conventional BEM class names (blockClass__E--M).
19
+ var blockClass = "".concat(pkg.prefix, "--description-list__row");
20
+ var componentName = 'DescriptionListRow';
21
+ var DescriptionListRow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
22
+ var children = _ref.children,
23
+ className = _ref.className,
24
+ rest = _objectWithoutProperties(_ref, _excluded);
25
+ return /*#__PURE__*/React__default.createElement(StructuredListRow, _extends({
26
+ className: cx(blockClass, className)
27
+ // role="row"
28
+ ,
29
+ ref: ref
30
+ }, getDevtoolsProps(componentName), rest), children);
31
+ });
32
+ DescriptionListRow.propTypes = {
33
+ /** Provide the contents of the node */
34
+ children: PropTypes.node,
35
+ /** Provide an optional class to be applied to the containing node */
36
+ className: PropTypes.string
37
+ };
38
+ DescriptionListRow = pkg.checkComponentEnabled(DescriptionListRow, componentName);
39
+ DescriptionListRow.displayName = componentName;
40
+
41
+ export { DescriptionListRow };
@@ -1 +1,4 @@
1
- export { DescriptionList, DescriptionListBody, DescriptionListRow, DescriptionListCell } from "./DescriptionList";
1
+ export { DescriptionList } from "./DescriptionList";
2
+ export { DescriptionListBody } from "./DescriptionListBody";
3
+ export { DescriptionListCell } from "./DescriptionListCell";
4
+ export { DescriptionListRow } from "./DescriptionListRow";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The container for filter panel subcomponents.
3
+ */
4
+ export let FilterPanel: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';