@carbon/ibm-products 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/css/index-full-carbon.css +0 -4
  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 +0 -4
  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 +0 -4
  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/AddSelect/AddSelectRow.js +1 -1
  14. package/es/components/AddSelect/AddSelectSidebar.js +1 -1
  15. package/es/components/AddSelect/add-select-utils.js +2 -2
  16. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -2
  17. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -1
  18. package/es/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +1 -1
  19. package/es/components/DataSpreadsheet/utils/checkSelectedHeaderCell.js +4 -4
  20. package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +4 -4
  21. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +2 -2
  22. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  23. package/es/components/Datagrid/Datagrid/DatagridRow.js +3 -3
  24. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +7 -7
  25. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -6
  26. package/es/components/Datagrid/useActionsColumn.js +13 -7
  27. package/es/components/Datagrid/useDisableSelectRows.js +4 -4
  28. package/es/components/Datagrid/useInlineEdit.js +2 -2
  29. package/es/components/Datagrid/useOnRowClick.js +20 -4
  30. package/es/components/Datagrid/useSortableColumns.js +35 -3
  31. package/es/components/Datagrid/useStickyColumn.js +1 -1
  32. package/es/components/ExportModal/ExportModal.js +1 -1
  33. package/es/components/NotificationsPanel/NotificationsPanel.js +6 -3
  34. package/es/components/SidePanel/SidePanel.js +3 -3
  35. package/es/components/TagSet/TagSetModal.js +3 -3
  36. package/es/global/js/utils/StoryDocsPage.js +2 -2
  37. package/es/global/js/utils/Wrap.js +1 -1
  38. package/es/global/js/utils/props-helper.js +1 -1
  39. package/es/global/js/utils/story-helper.js +3 -3
  40. package/lib/components/AddSelect/AddSelectRow.js +1 -1
  41. package/lib/components/AddSelect/AddSelectSidebar.js +1 -1
  42. package/lib/components/AddSelect/add-select-utils.js +2 -2
  43. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -2
  44. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -1
  45. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetEdit.js +1 -1
  46. package/lib/components/DataSpreadsheet/utils/checkSelectedHeaderCell.js +4 -4
  47. package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +4 -4
  48. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +2 -2
  49. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
  50. package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -3
  51. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +7 -7
  52. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +6 -6
  53. package/lib/components/Datagrid/useActionsColumn.js +13 -7
  54. package/lib/components/Datagrid/useDisableSelectRows.js +4 -4
  55. package/lib/components/Datagrid/useInlineEdit.js +2 -2
  56. package/lib/components/Datagrid/useOnRowClick.js +20 -4
  57. package/lib/components/Datagrid/useSortableColumns.js +35 -3
  58. package/lib/components/Datagrid/useStickyColumn.js +1 -1
  59. package/lib/components/ExportModal/ExportModal.js +1 -1
  60. package/lib/components/NotificationsPanel/NotificationsPanel.js +6 -3
  61. package/lib/components/SidePanel/SidePanel.js +3 -3
  62. package/lib/components/TagSet/TagSetModal.js +3 -3
  63. package/lib/global/js/utils/StoryDocsPage.js +2 -2
  64. package/lib/global/js/utils/Wrap.js +1 -1
  65. package/lib/global/js/utils/props-helper.js +1 -1
  66. package/lib/global/js/utils/story-helper.js +3 -3
  67. package/package.json +11 -11
  68. package/scss/components/Datagrid/styles/_datagrid.scss +0 -8
@@ -32,17 +32,17 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
32
32
  }).filter(function (colDef) {
33
33
  return !colDef.isAction;
34
34
  }).filter(function (colDef) {
35
- var _colDef$Header$props$2, _colDef$Header$props2, _colDef$Header$props3;
35
+ var _colDef$Header$props$2, _colDef$Header$props2;
36
36
  var sortableTitle = isTableSortable && ((_colDef$Header$props$2 = colDef.Header().props.children.props) === null || _colDef$Header$props$2 === void 0 ? void 0 : _colDef$Header$props$2.title);
37
- return filterString.length === 0 || (isTableSortable ? sortableTitle === null || sortableTitle === void 0 ? void 0 : sortableTitle.toLowerCase().includes(filterString) : (_colDef$Header$props2 = colDef.Header.props) === null || _colDef$Header$props2 === void 0 ? void 0 : (_colDef$Header$props3 = _colDef$Header$props2.title) === null || _colDef$Header$props3 === void 0 ? void 0 : _colDef$Header$props3.toLowerCase().includes(filterString)) && colDef.id !== 'spacer';
37
+ return filterString.length === 0 || (isTableSortable ? sortableTitle === null || sortableTitle === void 0 ? void 0 : sortableTitle.toLowerCase().includes(filterString) : (_colDef$Header$props2 = colDef.Header.props) === null || _colDef$Header$props2 === void 0 || (_colDef$Header$props2 = _colDef$Header$props2.title) === null || _colDef$Header$props2 === void 0 ? void 0 : _colDef$Header$props2.toLowerCase().includes(filterString)) && colDef.id !== 'spacer';
38
38
  }).map(function (colDef, i) {
39
- var _colDef$Header$props$3, _colDef$Header$props4, _colDef$Header$props5, _colDef$Header$props6, _colDef$Header$props7;
39
+ var _colDef$Header$props$3, _colDef$Header$props3, _colDef$Header$props4, _colDef$Header$props5, _colDef$Header$props6;
40
40
  var isSortableColumn = !!colDef.canSort && !!isTableSortable;
41
41
  var sortableTitle = isTableSortable && ((_colDef$Header$props$3 = colDef.Header().props.children.props) === null || _colDef$Header$props$3 === void 0 ? void 0 : _colDef$Header$props$3.title);
42
42
  var searchString = new RegExp('(' + filterString + ')');
43
43
  var res = filterString.length ? isSortableColumn ? sortableTitle.toLowerCase().split(searchString) : colDef.Header.props.title.toLowerCase().split(searchString) : null;
44
44
  var firstWord = res !== null ? res[0] === '' ? res[1].charAt(0).toUpperCase() + res[1].substring(1) : res[0].charAt(0).toUpperCase() + res[0].substring(1) : null;
45
- var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : isSortableColumn ? sortableTitle : (_colDef$Header$props4 = colDef.Header.props) === null || _colDef$Header$props4 === void 0 ? void 0 : _colDef$Header$props4.title;
45
+ var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : isSortableColumn ? sortableTitle : (_colDef$Header$props3 = colDef.Header.props) === null || _colDef$Header$props3 === void 0 ? void 0 : _colDef$Header$props3.title;
46
46
  var isFrozenColumn = !!colDef.sticky;
47
47
  var listContents = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
48
48
  wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
@@ -53,8 +53,8 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
53
53
  return onSelectColumn(colDef, checked);
54
54
  },
55
55
  id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
56
- labelText: isSortableColumn ? sortableTitle : (_colDef$Header$props5 = colDef.Header.props) === null || _colDef$Header$props5 === void 0 ? void 0 : _colDef$Header$props5.title,
57
- title: isSortableColumn ? sortableTitle : (_colDef$Header$props6 = colDef.Header.props) === null || _colDef$Header$props6 === void 0 ? void 0 : _colDef$Header$props6.title,
56
+ labelText: isSortableColumn ? sortableTitle : (_colDef$Header$props4 = colDef.Header.props) === null || _colDef$Header$props4 === void 0 ? void 0 : _colDef$Header$props4.title,
57
+ title: isSortableColumn ? sortableTitle : (_colDef$Header$props5 = colDef.Header.props) === null || _colDef$Header$props5 === void 0 ? void 0 : _colDef$Header$props5.title,
58
58
  className: "".concat(blockClass, "__customize-columns-checkbox"),
59
59
  hideLabel: true
60
60
  }), /*#__PURE__*/React.createElement("div", {
@@ -71,7 +71,7 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
71
71
  id: "dnd-datagrid-columns-".concat(colDef.id),
72
72
  type: "column-customization",
73
73
  disabled: filterString.length > 0 || isFrozenColumn,
74
- ariaLabel: isSortableColumn ? sortableTitle : (_colDef$Header$props7 = colDef.Header.props) === null || _colDef$Header$props7 === void 0 ? void 0 : _colDef$Header$props7.title,
74
+ ariaLabel: isSortableColumn ? sortableTitle : (_colDef$Header$props6 = colDef.Header.props) === null || _colDef$Header$props6 === void 0 ? void 0 : _colDef$Header$props6.title,
75
75
  onGrab: setAriaRegionText,
76
76
  isFocused: focusIndex === i,
77
77
  moveElement: moveElement,
@@ -286,7 +286,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
286
286
  });
287
287
  setInEditMode(false);
288
288
  sendFocusBackToGrid();
289
- inputProps === null || inputProps === void 0 ? void 0 : (_inputProps$onChange = inputProps.onChange) === null || _inputProps$onChange === void 0 ? void 0 : _inputProps$onChange.call(inputProps, item.selectedItem);
289
+ inputProps === null || inputProps === void 0 || (_inputProps$onChange = inputProps.onChange) === null || _inputProps$onChange === void 0 ? void 0 : _inputProps$onChange.call(inputProps, item.selectedItem);
290
290
  },
291
291
  downshiftProps: {
292
292
  onStateChange: function onStateChange(downshiftState) {
@@ -324,9 +324,9 @@ export var InlineEditCell = function InlineEditCell(_ref) {
324
324
  var renderDateCell = function renderDateCell() {
325
325
  var _config$inputProps, _outerButtonElement$c;
326
326
  var datePickerPreparedProps = prepareProps(config.inputProps, ['datePickerInputProps']);
327
- var datePickerInputProps = config === null || config === void 0 ? void 0 : (_config$inputProps = config.inputProps) === null || _config$inputProps === void 0 ? void 0 : _config$inputProps.datePickerInputProps;
327
+ var datePickerInputProps = config === null || config === void 0 || (_config$inputProps = config.inputProps) === null || _config$inputProps === void 0 ? void 0 : _config$inputProps.datePickerInputProps;
328
328
  return /*#__PURE__*/React.createElement(DatePicker, _extends({}, datePickerPreparedProps, {
329
- appendTo: outerButtonElement === null || outerButtonElement === void 0 ? void 0 : (_outerButtonElement$c = outerButtonElement.current) === null || _outerButtonElement$c === void 0 ? void 0 : _outerButtonElement$c.parentElement,
329
+ appendTo: outerButtonElement === null || outerButtonElement === void 0 || (_outerButtonElement$c = outerButtonElement.current) === null || _outerButtonElement$c === void 0 ? void 0 : _outerButtonElement$c.parentElement,
330
330
  ref: datePickerRef,
331
331
  style: {
332
332
  width: cell.column.totalWidth
@@ -336,7 +336,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
336
336
  onChange: function onChange(newDate) {
337
337
  var _datePickerPreparedPr;
338
338
  var newDateObj = newDate[0];
339
- datePickerPreparedProps === null || datePickerPreparedProps === void 0 ? void 0 : (_datePickerPreparedPr = datePickerPreparedProps.onChange) === null || _datePickerPreparedPr === void 0 ? void 0 : _datePickerPreparedPr.call(datePickerPreparedProps, newDateObj, cell);
339
+ datePickerPreparedProps === null || datePickerPreparedProps === void 0 || (_datePickerPreparedPr = datePickerPreparedProps.onChange) === null || _datePickerPreparedPr === void 0 ? void 0 : _datePickerPreparedPr.call(datePickerPreparedProps, newDateObj, cell);
340
340
  var newCellId = getNewCellId('Enter');
341
341
  saveCellData(newDateObj);
342
342
  setCellValue(newDateObj);
@@ -368,7 +368,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
368
368
  };
369
369
  var buildDate = function buildDate(value) {
370
370
  var _config$inputProps2;
371
- var dateFormat = config === null || config === void 0 ? void 0 : (_config$inputProps2 = config.inputProps) === null || _config$inputProps2 === void 0 ? void 0 : _config$inputProps2.dateFormat;
371
+ var dateFormat = config === null || config === void 0 || (_config$inputProps2 = config.inputProps) === null || _config$inputProps2 === void 0 ? void 0 : _config$inputProps2.dateFormat;
372
372
  if (value instanceof Date) {
373
373
  var maskedFullYear = value.getFullYear();
374
374
  var maskedMonth = padTo2Digits(value.getMonth() + 1);
@@ -440,7 +440,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
440
440
  "data-inline-type": type,
441
441
  onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
442
442
  onKeyDown: !nonEditCell ? handleKeyDown : null,
443
- className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), (_cx3 = {}, _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 ? void 0 : (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)), _cx3))
443
+ className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), (_cx3 = {}, _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), _defineProperty(_cx3, "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)), _cx3))
444
444
  }, !inEditMode && /*#__PURE__*/React.createElement(InlineEditButton, {
445
445
  isActiveCell: cellId === activeCellId,
446
446
  renderIcon: setRenderIcon(),
@@ -24,7 +24,16 @@ var useActionsColumn = function useActionsColumn(hooks) {
24
24
  var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
25
25
  var rowActions = instance.rowActions,
26
26
  isFetching = instance.isFetching,
27
- selectedFlatRows = instance.selectedFlatRows;
27
+ selectedRowIds = instance.state.selectedRowIds;
28
+ var getDisabledState = function getDisabledState(rowIndex) {
29
+ var selectedRowIndexes = Object.keys(selectedRowIds).map(function (n) {
30
+ return Number(n);
31
+ });
32
+ if (selectedRowIndexes.includes(rowIndex)) {
33
+ return true;
34
+ }
35
+ return false;
36
+ };
28
37
  if (rowActions && Array.isArray(rowActions)) {
29
38
  var addActionsMenu = function addActionsMenu(props, cellData) {
30
39
  var cell = cellData.cell;
@@ -53,11 +62,8 @@ var useActionsColumn = function useActionsColumn(hooks) {
53
62
  if (hidden) {
54
63
  return null;
55
64
  }
56
- var selectedRowId = selectedFlatRows === null || selectedFlatRows === void 0 ? void 0 : selectedFlatRows.filter(function (item) {
57
- return item.id === row.id ? item.id : null;
58
- });
59
65
  return /*#__PURE__*/React.createElement("div", {
60
- className: cx("".concat(blockClass, "__actions-column-button"), _defineProperty({}, "".concat(blockClass, "__disabled-row-action-button"), selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length)),
66
+ className: cx("".concat(blockClass, "__actions-column-button"), _defineProperty({}, "".concat(blockClass, "__disabled-row-action-button"), getDisabledState(row.index))),
61
67
  key: "".concat(itemText, "__").concat(index)
62
68
  }, /*#__PURE__*/React.createElement(OverflowMenu, _extends({}, rest, {
63
69
  renderIcon: icon,
@@ -65,9 +71,9 @@ var useActionsColumn = function useActionsColumn(hooks) {
65
71
  light: true,
66
72
  iconDescription: itemText,
67
73
  kind: "ghost",
68
- className: cx(_defineProperty({}, "".concat(blockClass, "__disabled-row-action"), selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length)),
74
+ className: cx(_defineProperty({}, "".concat(blockClass, "__disabled-row-action"), getDisabledState(row.index))),
69
75
  onClick: function onClick(e) {
70
- if (selectedFlatRows && selectedFlatRows.length && selectedRowId && selectedRowId.length) {
76
+ if (getDisabledState(row.index)) {
71
77
  // Row actions should be disabled if row is selected and batchActions toolbar is active
72
78
  return;
73
79
  }
@@ -20,7 +20,7 @@ var useDisableSelectRows = function useDisableSelectRows(hooks) {
20
20
  };
21
21
  var updateSelectAll = function updateSelectAll(hooks) {
22
22
  var getToggleAllRowsSelectedProps = function getToggleAllRowsSelectedProps(props, _ref2) {
23
- var _instance$disableSele, _instance$disableSele2;
23
+ var _instance$disableSele;
24
24
  var instance = _ref2.instance;
25
25
  var selectableRows = instance.rows.filter(function (row) {
26
26
  return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
@@ -40,7 +40,7 @@ var updateSelectAll = function updateSelectAll(hooks) {
40
40
  },
41
41
  checked: isAllRowsSelected,
42
42
  disabled: instance.disableSelectAll,
43
- title: (instance === null || instance === void 0 ? void 0 : (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 ? void 0 : (_instance$disableSele2 = _instance$disableSele.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
43
+ title: (instance === null || instance === void 0 || (_instance$disableSele = instance.disableSelectRowsProps) === null || _instance$disableSele === void 0 || (_instance$disableSele = _instance$disableSele.labels) === null || _instance$disableSele === void 0 ? void 0 : _instance$disableSele.toggleAllRowsLabel) || 'Toggle All Rows Selected',
44
44
  indeterminate: Boolean(!isAllRowsSelected && Object.keys(instance.state.selectedRowIds).length)
45
45
  }];
46
46
  };
@@ -48,7 +48,7 @@ var updateSelectAll = function updateSelectAll(hooks) {
48
48
  };
49
49
  var updatePageSelectAll = function updatePageSelectAll(hooks) {
50
50
  var getToggleAllPageRowsSelectedProps = function getToggleAllPageRowsSelectedProps(props, _ref4) {
51
- var _instance$disableSele3, _instance$disableSele4;
51
+ var _instance$disableSele2;
52
52
  var instance = _ref4.instance;
53
53
  var selectableRows = instance.page.filter(function (row) {
54
54
  return !(instance.shouldDisableSelectRow && instance.shouldDisableSelectRow(row));
@@ -68,7 +68,7 @@ var updatePageSelectAll = function updatePageSelectAll(hooks) {
68
68
  },
69
69
  checked: isAllRowsSelected,
70
70
  disabled: instance.disableSelectAll,
71
- title: (instance === null || instance === void 0 ? void 0 : (_instance$disableSele3 = instance.disableSelectRowsProps) === null || _instance$disableSele3 === void 0 ? void 0 : (_instance$disableSele4 = _instance$disableSele3.labels) === null || _instance$disableSele4 === void 0 ? void 0 : _instance$disableSele4.toggleAllRowsLabel) || 'Toggle All Rows Selected',
71
+ title: (instance === null || instance === void 0 || (_instance$disableSele2 = instance.disableSelectRowsProps) === null || _instance$disableSele2 === void 0 || (_instance$disableSele2 = _instance$disableSele2.labels) === null || _instance$disableSele2 === void 0 ? void 0 : _instance$disableSele2.toggleAllRowsLabel) || 'Toggle All Rows Selected',
72
72
  indeterminate: Boolean(!isAllRowsSelected && instance.page.some(function (_ref6) {
73
73
  var id = _ref6.id;
74
74
  return instance.state.selectedRowIds[id];
@@ -21,11 +21,11 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
21
21
  }
22
22
  }, [usingEditableCell]);
23
23
  var addInlineEdit = function addInlineEdit(props, _ref) {
24
- var _cell$column, _cell$column$inlineEd, _instance$columns$fil;
24
+ var _cell$column, _instance$columns$fil;
25
25
  var cell = _ref.cell,
26
26
  instance = _ref.instance;
27
27
  var columnInlineEditConfig = cell.column.inlineEdit;
28
- var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : (_cell$column$inlineEd = _cell$column.inlineEdit) === null || _cell$column$inlineEd === void 0 ? void 0 : _cell$column$inlineEd.type;
28
+ var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 || (_cell$column = _cell$column.inlineEdit) === null || _cell$column === void 0 ? void 0 : _cell$column.type;
29
29
  var totalInlineEditColumns = (_instance$columns$fil = instance.columns.filter(function (item) {
30
30
  return item.inlineEdit;
31
31
  })) === null || _instance$columns$fil === void 0 ? void 0 : _instance$columns$fil.length;
@@ -6,6 +6,7 @@
6
6
  * restricted by GSA ADP Schedule Contract with IBM Corp.
7
7
  */
8
8
 
9
+ import { pkg, carbon } from '../../settings';
9
10
  var useOnRowClick = function useOnRowClick(hooks) {
10
11
  var useInstance = function useInstance(rowInstance) {
11
12
  var onRowClick = rowInstance.onRowClick;
@@ -15,13 +16,28 @@ var useOnRowClick = function useOnRowClick(hooks) {
15
16
  instance = datagridState.instance;
16
17
  var id = row.id,
17
18
  toggleRowSelected = row.toggleRowSelected;
19
+ var withSelectRows = instance.withSelectRows,
20
+ tableId = instance.tableId;
18
21
  var onClick = function onClick(event) {
19
22
  if (!isFetching && onRowClick) {
20
23
  onRowClick(row, event);
21
- instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
22
- return toggleRow.toggleRowSelected(false);
23
- });
24
- toggleRowSelected(id, true);
24
+ // We do not want to change the list of selected rows if using the useSelectedRows hook, otherwise clicking on an entire row will mark the row as checked
25
+
26
+ // Remove selected class from all other clickable rows as only one clickable row can be selected at a time
27
+ var clickableSelectedRows = document.querySelectorAll("#".concat(tableId, ".").concat(pkg.prefix, "--datagrid .").concat(carbon.prefix, "--data-table--selected:not(.").concat(pkg.prefix, "--datagrid__active-row)"));
28
+ if (clickableSelectedRows.length) {
29
+ Array.from(clickableSelectedRows).forEach(function (row) {
30
+ row.classList.remove("".concat(carbon.prefix, "--data-table--selected"));
31
+ });
32
+ }
33
+ var closestRow = event.target.closest(".".concat(pkg.prefix, "--datagrid__carbon-row"));
34
+ closestRow.classList.add("".concat(carbon.prefix, "--data-table--selected"));
35
+ if (!withSelectRows) {
36
+ instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
37
+ return toggleRow.toggleRowSelected(false);
38
+ });
39
+ toggleRowSelected(id, true);
40
+ }
25
41
  }
26
42
  };
27
43
  var onKeyDown = function onKeyDown(event) {
@@ -21,11 +21,37 @@ var ordering = {
21
21
  DESC: 'DESC',
22
22
  NONE: 'NONE'
23
23
  };
24
+ var getAriaSortValue = function getAriaSortValue(col, _ref) {
25
+ var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
26
+ descendingSortableLabelText = _ref.descendingSortableLabelText,
27
+ defaultSortableLabelText = _ref.defaultSortableLabelText;
28
+ var isSorted = col.isSorted,
29
+ isSortedDesc = col.isSortedDesc;
30
+ if (!isSorted) {
31
+ return defaultSortableLabelText || 'none';
32
+ }
33
+ if (isSorted && !isSortedDesc) {
34
+ return ascendingSortableLabelText || 'ascending';
35
+ }
36
+ if (isSorted && isSortedDesc) {
37
+ return descendingSortableLabelText || 'descending';
38
+ }
39
+ };
40
+ var getAriaPressedValue = function getAriaPressedValue(col) {
41
+ var isSorted = col.isSorted;
42
+ if (isSorted) {
43
+ return 'true';
44
+ }
45
+ return 'false';
46
+ };
24
47
  var useSortableColumns = function useSortableColumns(hooks) {
25
- var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref) {
48
+ var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref2) {
26
49
  var _instance$customizeCo;
27
- var instance = _ref.instance;
28
- var onSort = instance.onSort;
50
+ var instance = _ref2.instance;
51
+ var onSort = instance.onSort,
52
+ ascendingSortableLabelText = instance.ascendingSortableLabelText,
53
+ descendingSortableLabelText = instance.descendingSortableLabelText,
54
+ defaultSortableLabelText = instance.defaultSortableLabelText;
29
55
  var onSortClick = function onSortClick(column) {
30
56
  var key = column.id;
31
57
  var sortDesc = column.isSortedDesc;
@@ -70,6 +96,12 @@ var useSortableColumns = function useSortableColumns(hooks) {
70
96
  var Header = function Header(headerProp) {
71
97
  var _cx;
72
98
  return column.disableSortBy === true ? column.Header : /*#__PURE__*/React.createElement(Button, {
99
+ "aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
100
+ ascendingSortableLabelText: ascendingSortableLabelText,
101
+ descendingSortableLabelText: descendingSortableLabelText,
102
+ defaultSortableLabelText: defaultSortableLabelText
103
+ }),
104
+ "aria-pressed": getAriaPressedValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column),
73
105
  onClick: function onClick() {
74
106
  return onSortClick(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column);
75
107
  },
@@ -149,7 +149,7 @@ var changeProps = function changeProps(elementName, headerCellRef, windowSize, p
149
149
  if (column.sticky === 'left') {
150
150
  var _data$instance, _cx2;
151
151
  return [props, _objectSpread({
152
- className: cx((_cx2 = {}, _defineProperty(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), _defineProperty(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 ? void 0 : (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671), _cx2))
152
+ className: cx((_cx2 = {}, _defineProperty(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), _defineProperty(_cx2, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 || (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671), _cx2))
153
153
  }, headerCellRef && {
154
154
  ref: headerCellRef
155
155
  })];
@@ -76,7 +76,7 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
76
76
  useEffect(function () {
77
77
  var _preformattedExtensio;
78
78
  setName(filename);
79
- setExtension(preformattedExtensions === null || preformattedExtensions === void 0 ? void 0 : (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
79
+ setExtension(preformattedExtensions === null || preformattedExtensions === void 0 || (_preformattedExtensio = preformattedExtensions[0]) === null || _preformattedExtensio === void 0 ? void 0 : _preformattedExtensio.extension);
80
80
  }, [filename, preformattedExtensions, open]);
81
81
  var onNameChangeHandler = function onNameChangeHandler(evt) {
82
82
  setName(evt.target.value);
@@ -297,10 +297,10 @@ export var NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, re
297
297
  nowText: nowText
298
298
  })), /*#__PURE__*/React.createElement("h6", {
299
299
  className: notificationHeaderClassName
300
- }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/React.createElement(Link, {
300
+ }, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/React.createElement(Link, _extends({
301
301
  href: notification.link.url,
302
302
  className: "".concat(blockClass, "__notifications-link")
303
- }, notification.link.text)), /*#__PURE__*/React.createElement(IconButton, {
303
+ }, notification.link.optional), notification.link.text)), /*#__PURE__*/React.createElement(IconButton, {
304
304
  align: "left",
305
305
  kind: "ghost",
306
306
  size: "sm",
@@ -420,7 +420,10 @@ NotificationsPanel.propTypes = {
420
420
  description: PropTypes.string,
421
421
  link: PropTypes.shape({
422
422
  url: PropTypes.string,
423
- text: PropTypes.string
423
+ text: PropTypes.string,
424
+ optional: PropTypes.shape({
425
+ // Add optional props here
426
+ })
424
427
  }),
425
428
  unread: PropTypes.bool,
426
429
  onNotificationClick: PropTypes.func
@@ -121,7 +121,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
121
121
  if ((previousState === null || previousState === void 0 ? void 0 : previousState.size) !== size) {
122
122
  var _sidePanelOuter$style;
123
123
  scrollableSection.scrollTop = 0;
124
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 ? void 0 : _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
124
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 ? void 0 : _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
125
125
  }
126
126
  }
127
127
  }, [currentStep, ref, size, previousState === null || previousState === void 0 ? void 0 : previousState.size]);
@@ -152,7 +152,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
152
152
  var actionsContainer = getActionsContainerElement();
153
153
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
154
154
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
155
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 ? void 0 : _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
155
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 ? void 0 : _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
156
156
  }
157
157
  }, [actions, condensedActions, open, animationComplete]);
158
158
 
@@ -173,7 +173,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
173
173
  var actionsContainer = getActionsContainerElement();
174
174
  var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
175
175
  actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
176
- sidePanelOuter === null || sidePanelOuter === void 0 ? void 0 : (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 ? void 0 : _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
176
+ sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 ? void 0 : _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
177
177
  };
178
178
  var getActionsContainerElement = function getActionsContainerElement() {
179
179
  var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
@@ -53,9 +53,9 @@ export var TagSetModal = function TagSetModal(_ref) {
53
53
  } else {
54
54
  var lCaseSearch = search.toLocaleLowerCase();
55
55
  allTags.forEach(function (tag) {
56
- var _tag$dataSearch, _tag$dataSearch$toLoc, _tag$label, _tag$label$toLocaleLo;
57
- var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 ? void 0 : (_tag$dataSearch$toLoc = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch$toLoc === void 0 ? void 0 : _tag$dataSearch$toLoc.indexOf(lCaseSearch);
58
- var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 ? void 0 : (_tag$label$toLocaleLo = _tag$label.toLocaleLowerCase()) === null || _tag$label$toLocaleLo === void 0 ? void 0 : _tag$label$toLocaleLo.indexOf(lCaseSearch);
56
+ var _tag$dataSearch, _tag$label;
57
+ var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 || (_tag$dataSearch = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch === void 0 ? void 0 : _tag$dataSearch.indexOf(lCaseSearch);
58
+ var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.indexOf(lCaseSearch);
59
59
  if (dataSearch > -1 || labelSearch > -1) {
60
60
  newFilteredModalTags.push(tag);
61
61
  }
@@ -69,7 +69,7 @@ var processBlocks = function processBlocks(blocks, stories, omitUnreferencedStor
69
69
  * @returns
70
70
  */
71
71
  export var StoryDocsPage = function StoryDocsPage(_ref2) {
72
- var _csfFile$meta, _csfFile$meta$paramet, _processedBlocks$filt;
72
+ var _csfFile$meta, _processedBlocks$filt;
73
73
  var altTitle = _ref2.altTitle,
74
74
  altDescription = _ref2.altDescription,
75
75
  altGuidelinesHref = _ref2.altGuidelinesHref,
@@ -80,7 +80,7 @@ export var StoryDocsPage = function StoryDocsPage(_ref2) {
80
80
  csfFile = _useOf.csfFile;
81
81
  var storyInfo = storyDocsPageInfo(csfFile);
82
82
  var guidelinesHref = altGuidelinesHref !== null && altGuidelinesHref !== void 0 ? altGuidelinesHref : storyInfo.guidelinesHref;
83
- var isFullScreen = (csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : (_csfFile$meta$paramet = _csfFile$meta.parameters) === null || _csfFile$meta$paramet === void 0 ? void 0 : _csfFile$meta$paramet.layout) === 'fullscreen' || false;
83
+ var isFullScreen = (csfFile === null || csfFile === void 0 || (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 || (_csfFile$meta = _csfFile$meta.parameters) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.layout) === 'fullscreen' || false;
84
84
  var storyHelperClass = isFullScreen ? 'c4p--story-docs-page--fullscreen' : '';
85
85
  var processedBlocks = processBlocks(blocks, csfFile.stories, omitUnreferencedStories);
86
86
  console.log(processBlocks);
@@ -22,7 +22,7 @@ var isEmpty = function isEmpty(children) {
22
22
  React.Children.forEach(children, function (child) {
23
23
  if (child) {
24
24
  var _child$type, _child$props;
25
- result && (result = (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Wrap' && isEmpty(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children));
25
+ result && (result = (child === null || child === void 0 || (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Wrap' && isEmpty(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children));
26
26
  }
27
27
  });
28
28
  return result;
@@ -151,7 +151,7 @@ export var getDeprecatedArgTypes = function getDeprecatedArgTypes(deprecatedProp
151
151
  export var extractShapesArray = function extractShapesArray(items) {
152
152
  var _items$, _items$2;
153
153
  // unwrap if items or the first index looks like a React element or fragment
154
- if (items && (items !== null && items !== void 0 && (_items$ = items[0]) !== null && _items$ !== void 0 && _items$.props || (items === null || items === void 0 ? void 0 : (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.type) === React.Fragment || items.type === React.Fragment)) {
154
+ if (items && (items !== null && items !== void 0 && (_items$ = items[0]) !== null && _items$ !== void 0 && _items$.props || (items === null || items === void 0 || (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.type) === React.Fragment || items.type === React.Fragment)) {
155
155
  var unwrappedItems = unwrapIfFragment(items);
156
156
  return unwrappedItems.map(function (item) {
157
157
  return _objectSpread({
@@ -107,7 +107,7 @@ StackblitzLink.propTypes = {
107
107
  };
108
108
  export var palUsageHref = function palUsageHref(csfFile) {
109
109
  var _csfFile$meta;
110
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.title;
110
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.title;
111
111
  var _title$split = title.split('/'),
112
112
  _title$split2 = _slicedToArray(_title$split, 3),
113
113
  _pkg = _title$split2[0],
@@ -119,7 +119,7 @@ export var palUsageHref = function palUsageHref(csfFile) {
119
119
  };
120
120
  export var storyDocsPageTitle = function storyDocsPageTitle(csfFile) {
121
121
  var _csfFile$meta2;
122
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta2 = csfFile.meta) === null || _csfFile$meta2 === void 0 ? void 0 : _csfFile$meta2.title;
122
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta2 = csfFile.meta) === null || _csfFile$meta2 === void 0 ? void 0 : _csfFile$meta2.title;
123
123
  var _title$split3 = title.split('/'),
124
124
  _title$split4 = _toArray(_title$split3),
125
125
  _pkg = _title$split4[0],
@@ -148,7 +148,7 @@ export var storyDocsPageTitle = function storyDocsPageTitle(csfFile) {
148
148
  };
149
149
  export var storyDocsPageInfo = function storyDocsPageInfo(csfFile) {
150
150
  var _csfFile$meta3;
151
- var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta3 = csfFile.meta) === null || _csfFile$meta3 === void 0 ? void 0 : _csfFile$meta3.title;
151
+ var title = csfFile === null || csfFile === void 0 || (_csfFile$meta3 = csfFile.meta) === null || _csfFile$meta3 === void 0 ? void 0 : _csfFile$meta3.title;
152
152
  var _title$split5 = title.split('/'),
153
153
  _title$split6 = _toArray(_title$split5),
154
154
  pkg = _title$split6[0],
@@ -127,7 +127,7 @@ var AddSelectRow = function AddSelectRow(_ref) {
127
127
  var isInMetaPanel = function isInMetaPanel(id) {
128
128
  return id === (displayMetalPanel === null || displayMetalPanel === void 0 ? void 0 : displayMetalPanel.id);
129
129
  };
130
- var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
130
+ var hasModifiers = (modifiers === null || modifiers === void 0 || (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
131
131
  var tabIndex = getTabIndex();
132
132
  var selected = isSelected();
133
133
  var expanded = parentSelected === item.id;
@@ -34,7 +34,7 @@ var AddSelectSidebar = function AddSelectSidebar(_ref) {
34
34
  noSelectionDescription = _ref.noSelectionDescription,
35
35
  noSelectionTitle = _ref.noSelectionTitle,
36
36
  setDisplayMetaPanel = _ref.setDisplayMetaPanel;
37
- var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
37
+ var hasModifiers = (modifiers === null || modifiers === void 0 || (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
38
38
  var hasSelections = multiSelection.length > 0;
39
39
  var getNewItem = function getNewItem(item) {
40
40
  // certain properties should not be displayed in the sidebar
@@ -114,14 +114,14 @@ var getFilteredItems = function getFilteredItems(useNormalizedItems, normalizedI
114
114
  */
115
115
  if (path.length > 1) {
116
116
  return path.reduce(function (prev, cur, curIdx) {
117
- var _prev$find, _prev$find$children;
117
+ var _prev$find;
118
118
  // because the root of the path never changes we can skip it
119
119
  if (curIdx === 0) {
120
120
  return prev;
121
121
  }
122
122
  var item = (_prev$find = prev.find(function (item) {
123
123
  return item.id === cur.id;
124
- })) === null || _prev$find === void 0 ? void 0 : (_prev$find$children = _prev$find.children) === null || _prev$find$children === void 0 ? void 0 : _prev$find$children.entries;
124
+ })) === null || _prev$find === void 0 || (_prev$find = _prev$find.children) === null || _prev$find === void 0 ? void 0 : _prev$find.entries;
125
125
  return item;
126
126
  }, items.entries);
127
127
  }
@@ -86,7 +86,7 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
86
86
  (0, _react.useEffect)(function () {
87
87
  if (selectionAreaData.length) {
88
88
  var _previousState$select;
89
- if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || (previousState === null || previousState === void 0 ? void 0 : (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length)) {
89
+ if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || (previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length)) {
90
90
  onSelectionAreaChange(selectionAreaData);
91
91
  }
92
92
  }
@@ -396,7 +396,7 @@ var DataSpreadsheetBody = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
396
396
  role: "gridcell",
397
397
  style: _objectSpread(_objectSpread({}, cell.getCellProps().style), {}, {
398
398
  display: 'grid',
399
- minWidth: (cell === null || cell === void 0 ? void 0 : (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
399
+ minWidth: (cell === null || cell === void 0 || (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
400
400
  })
401
401
  }), /*#__PURE__*/_react.default.createElement("button", {
402
402
  id: "".concat(blockClass, "__cell--").concat(cell.row.index, "--").concat(index),
@@ -65,7 +65,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
65
65
  (0, _react.useEffect)(function () {
66
66
  if ((previousState === null || previousState === void 0 ? void 0 : previousState.cellSize) !== cellSize) {
67
67
  var _ref$current;
68
- var scrollContainer = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(".".concat(blockClass, "__list--container"));
68
+ var scrollContainer = ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(".".concat(blockClass, "__list--container"));
69
69
  var hasScrollBar = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollHeight) > (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientHeight);
70
70
  var scrollBarValue = hasScrollBar ? 0 : scrollBarSize;
71
71
  setScrollBarSizeValue(scrollBarValue);
@@ -54,7 +54,7 @@ var useSpreadsheetEdit = function useSpreadsheetEdit(_ref) {
54
54
  cellEditorRef.current.style.display = 'block';
55
55
  cellEditorRef.current.style.height = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.height;
56
56
  cellEditorRef.current.style.paddingTop = "".concat((parseInt(activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.height) - 16) / 2 - 1, "px"); // calculate paddingTop based on cellHeight which could be variable depending on the cellSize prop
57
- cellEditorRef.current.style.textAlign = (cellProps === null || cellProps === void 0 ? void 0 : (_cellProps$column = cellProps.column) === null || _cellProps$column === void 0 ? void 0 : _cellProps$column.placement) === 'right' ? 'right' : 'left';
57
+ cellEditorRef.current.style.textAlign = (cellProps === null || cellProps === void 0 || (_cellProps$column = cellProps.column) === null || _cellProps$column === void 0 ? void 0 : _cellProps$column.placement) === 'right' ? 'right' : 'left';
58
58
  (_cellEditorRef$curren = cellEditorRef.current) === null || _cellEditorRef$curren === void 0 ? void 0 : _cellEditorRef$curren.focus();
59
59
  if (rulerWidth < cellEditorCurrentWidth) {
60
60
  var _visibleColumns$nextI;
@@ -17,10 +17,10 @@ var checkSelectedHeaderCell = function checkSelectedHeaderCell(headerIndex, sele
17
17
  var isSelectedHeader = areasCloned.some(function (area) {
18
18
  var _area$point, _area$point2, _area$point3, _area$point4, _area$point5, _area$point6, _area$point7, _area$point8;
19
19
  var oppositeType = headerType === 'column' ? 'row' : 'column';
20
- var minOppositeSelection = Math.min(area === null || area === void 0 ? void 0 : (_area$point = area.point1) === null || _area$point === void 0 ? void 0 : _area$point[oppositeType], area === null || area === void 0 ? void 0 : (_area$point2 = area.point2) === null || _area$point2 === void 0 ? void 0 : _area$point2[oppositeType]);
21
- var maxOppositeSelection = Math.max(area === null || area === void 0 ? void 0 : (_area$point3 = area.point1) === null || _area$point3 === void 0 ? void 0 : _area$point3[oppositeType], area === null || area === void 0 ? void 0 : (_area$point4 = area.point2) === null || _area$point4 === void 0 ? void 0 : _area$point4[oppositeType]);
22
- var minSelection = Math.min(area === null || area === void 0 ? void 0 : (_area$point5 = area.point1) === null || _area$point5 === void 0 ? void 0 : _area$point5[headerType], area === null || area === void 0 ? void 0 : (_area$point6 = area.point2) === null || _area$point6 === void 0 ? void 0 : _area$point6[headerType]);
23
- var maxSelection = Math.max(area === null || area === void 0 ? void 0 : (_area$point7 = area.point1) === null || _area$point7 === void 0 ? void 0 : _area$point7[headerType], area === null || area === void 0 ? void 0 : (_area$point8 = area.point2) === null || _area$point8 === void 0 ? void 0 : _area$point8[headerType]);
20
+ var minOppositeSelection = Math.min(area === null || area === void 0 || (_area$point = area.point1) === null || _area$point === void 0 ? void 0 : _area$point[oppositeType], area === null || area === void 0 || (_area$point2 = area.point2) === null || _area$point2 === void 0 ? void 0 : _area$point2[oppositeType]);
21
+ var maxOppositeSelection = Math.max(area === null || area === void 0 || (_area$point3 = area.point1) === null || _area$point3 === void 0 ? void 0 : _area$point3[oppositeType], area === null || area === void 0 || (_area$point4 = area.point2) === null || _area$point4 === void 0 ? void 0 : _area$point4[oppositeType]);
22
+ var minSelection = Math.min(area === null || area === void 0 || (_area$point5 = area.point1) === null || _area$point5 === void 0 ? void 0 : _area$point5[headerType], area === null || area === void 0 || (_area$point6 = area.point2) === null || _area$point6 === void 0 ? void 0 : _area$point6[headerType]);
23
+ var maxSelection = Math.max(area === null || area === void 0 || (_area$point7 = area.point1) === null || _area$point7 === void 0 ? void 0 : _area$point7[headerType], area === null || area === void 0 || (_area$point8 = area.point2) === null || _area$point8 === void 0 ? void 0 : _area$point8[headerType]);
24
24
  var isTrueSelectedState = (items === null || items === void 0 ? void 0 : items.length) - 1 === maxOppositeSelection && minOppositeSelection === 0;
25
25
  // console.log({minSelection, maxSelection});
26
26
  // Iterate over all columns included in the selection area
@@ -32,10 +32,10 @@ var handleCellDeletion = function handleCellDeletion(_ref) {
32
32
  return item.matcher === currentMatcher;
33
33
  });
34
34
  var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
35
- var lowestColumnIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty === void 0 ? void 0 : _selectionAreaToEmpty.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty2 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty2 === void 0 ? void 0 : _selectionAreaToEmpty2.column);
36
- var greatestColumnIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty3 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty3 === void 0 ? void 0 : _selectionAreaToEmpty3.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty4 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty4 === void 0 ? void 0 : _selectionAreaToEmpty4.column);
37
- var lowestRowIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty5 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty5 === void 0 ? void 0 : _selectionAreaToEmpty5.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty6 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty6 === void 0 ? void 0 : _selectionAreaToEmpty6.row);
38
- var greatestRowIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty7 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty7 === void 0 ? void 0 : _selectionAreaToEmpty7.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 ? void 0 : (_selectionAreaToEmpty8 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty8 === void 0 ? void 0 : _selectionAreaToEmpty8.row);
35
+ var lowestColumnIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty === void 0 ? void 0 : _selectionAreaToEmpty.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty2 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty2 === void 0 ? void 0 : _selectionAreaToEmpty2.column);
36
+ var greatestColumnIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty3 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty3 === void 0 ? void 0 : _selectionAreaToEmpty3.column, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty4 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty4 === void 0 ? void 0 : _selectionAreaToEmpty4.column);
37
+ var lowestRowIndex = Math.min(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty5 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty5 === void 0 ? void 0 : _selectionAreaToEmpty5.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty6 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty6 === void 0 ? void 0 : _selectionAreaToEmpty6.row);
38
+ var greatestRowIndex = Math.max(selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty7 = selectionAreaToEmptyContents.point1) === null || _selectionAreaToEmpty7 === void 0 ? void 0 : _selectionAreaToEmpty7.row, selectionAreaToEmptyContents === null || selectionAreaToEmptyContents === void 0 || (_selectionAreaToEmpty8 = selectionAreaToEmptyContents.point2) === null || _selectionAreaToEmpty8 === void 0 ? void 0 : _selectionAreaToEmpty8.row);
39
39
  (0, _rangeWithCallback.rangeWithCallback)(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
40
40
  (0, _rangeWithCallback.rangeWithCallback)(lowestRowIndex, greatestRowIndex, function (rowIndex) {
41
41
  var cellProps = rows[rowIndex].cells[columnIndex];
@@ -98,7 +98,7 @@ var handleHeaderCellSelection = function handleHeaderCellSelection(_ref2) {
98
98
  return [].concat((0, _toConsumableArray2.default)(prev), [newSelectionArea]);
99
99
  }
100
100
  if (isHoldingShiftKey) {
101
- var _selectionAreasClone$, _selectionAreasClone$2;
101
+ var _selectionAreasClone$;
102
102
  var _selectionsFromHeaderCell = selectionsClone.filter(function (item) {
103
103
  var _item$header3;
104
104
  return (_item$header3 = item.header) === null || _item$header3 === void 0 ? void 0 : _item$header3.type;
@@ -118,7 +118,7 @@ var handleHeaderCellSelection = function handleHeaderCellSelection(_ref2) {
118
118
  return item.matcher === currentMatcher;
119
119
  });
120
120
  var newIndexList = getSelectedItemIndexList({
121
- indexList: ((_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$ === void 0 ? void 0 : (_selectionAreasClone$2 = _selectionAreasClone$.header) === null || _selectionAreasClone$2 === void 0 ? void 0 : _selectionAreasClone$2.selectedIndexList) || [type === 'column' ? columnValue : rowValue],
121
+ indexList: ((_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) === null || _selectionAreasClone$ === void 0 || (_selectionAreasClone$ = _selectionAreasClone$.header) === null || _selectionAreasClone$ === void 0 ? void 0 : _selectionAreasClone$.selectedIndexList) || [type === 'column' ? columnValue : rowValue],
122
122
  newIndex: newIndexValue,
123
123
  activeCellIndex: activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates[type]
124
124
  });
@@ -42,7 +42,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
42
42
  return /*#__PURE__*/_react.default.createElement(_react2.TableHeader, (0, _extends2.default)({}, header.getHeaderProps({
43
43
  role: false
44
44
  }), {
45
- className: (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__sortableColumn"), header.canSort), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
45
+ className: (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
46
46
  key: header.id
47
47
  }), header.render('Header'), header.getResizerProps && /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, header.getResizerProps(), {
48
48
  className: "".concat(blockClass, "__resizer")