@carbon/ibm-products 2.44.0 → 2.45.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/css/index-full-carbon.css +118 -15
  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-released-only.css +203 -5
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +118 -15
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +118 -15
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Coachmark/Coachmark.js +12 -7
  18. package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  19. package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
  20. package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  21. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
  22. package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
  23. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  24. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
  25. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  26. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
  27. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
  29. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
  30. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
  31. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  34. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
  43. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
  47. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  48. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
  49. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  50. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
  51. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  52. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
  53. package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  54. package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
  55. package/es/components/ConditionBuilder/utils/util.js +1 -9
  56. package/es/components/CreateFullPage/CreateFullPage.js +2 -2
  57. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  58. package/es/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
  59. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  60. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  61. package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  62. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
  63. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  64. package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  65. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  66. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  67. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  68. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  69. package/es/components/Datagrid/types/index.d.ts +28 -6
  70. package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  71. package/es/components/Datagrid/useCustomizeColumns.js +4 -3
  72. package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
  73. package/es/components/Datagrid/useNestedRowExpander.js +1 -3
  74. package/es/components/Datagrid/useRowExpander.js +1 -3
  75. package/es/components/Datagrid/useSelectRows.js +2 -1
  76. package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
  77. package/es/components/Datagrid/useStickyColumn.js +12 -9
  78. package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
  79. package/es/components/EditInPlace/EditInPlace.js +21 -10
  80. package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  81. package/es/components/EditTearsheet/EditTearsheet.js +44 -9
  82. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  83. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  84. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  85. package/es/components/Nav/NavItem.js +12 -3
  86. package/es/components/OptionsTile/OptionsTile.js +11 -6
  87. package/es/components/PageHeader/PageHeader.js +1 -0
  88. package/es/components/SearchBar/SearchBar.d.ts +1 -1
  89. package/es/components/SearchBar/SearchBar.js +2 -2
  90. package/es/components/SidePanel/SidePanel.js +17 -21
  91. package/es/components/SidePanel/motion/variants.d.ts +4 -6
  92. package/es/components/SidePanel/motion/variants.js +10 -11
  93. package/es/components/Tearsheet/TearsheetShell.js +3 -1
  94. package/es/components/WebTerminal/WebTerminal.js +10 -12
  95. package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
  96. package/es/global/js/package-settings.d.ts +1 -1
  97. package/es/global/js/package-settings.js +1 -1
  98. package/es/settings.d.ts +1 -1
  99. package/lib/components/Coachmark/Coachmark.js +12 -7
  100. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  101. package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
  102. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  103. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
  104. package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
  105. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  106. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
  107. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  108. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
  109. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  110. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
  111. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
  112. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
  113. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
  114. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  115. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  116. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  117. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
  118. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  119. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  120. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  121. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
  122. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  123. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  124. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
  125. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
  126. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
  127. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  128. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
  129. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  130. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
  131. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  132. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
  133. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  134. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
  135. package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  136. package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
  137. package/lib/components/ConditionBuilder/utils/util.js +0 -9
  138. package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  140. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  142. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  143. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  144. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
  145. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  146. package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  147. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  148. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  149. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  150. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  151. package/lib/components/Datagrid/types/index.d.ts +28 -6
  152. package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  153. package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
  154. package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
  155. package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
  156. package/lib/components/Datagrid/useRowExpander.js +1 -3
  157. package/lib/components/Datagrid/useSelectRows.js +2 -1
  158. package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
  159. package/lib/components/Datagrid/useStickyColumn.js +12 -9
  160. package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
  161. package/lib/components/EditInPlace/EditInPlace.js +21 -10
  162. package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  163. package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
  164. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  165. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  166. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  167. package/lib/components/Nav/NavItem.js +10 -1
  168. package/lib/components/OptionsTile/OptionsTile.js +11 -6
  169. package/lib/components/PageHeader/PageHeader.js +1 -0
  170. package/lib/components/SearchBar/SearchBar.d.ts +1 -1
  171. package/lib/components/SearchBar/SearchBar.js +2 -2
  172. package/lib/components/SidePanel/SidePanel.js +16 -20
  173. package/lib/components/SidePanel/motion/variants.d.ts +4 -6
  174. package/lib/components/SidePanel/motion/variants.js +10 -11
  175. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  176. package/lib/components/WebTerminal/WebTerminal.js +10 -12
  177. package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
  178. package/lib/global/js/package-settings.d.ts +1 -1
  179. package/lib/global/js/package-settings.js +1 -1
  180. package/lib/settings.d.ts +1 -1
  181. package/package.json +4 -4
  182. package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
  183. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
  184. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
  185. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
  186. package/scss/components/Datagrid/_datagrid.scss +0 -4
  187. package/scss/components/HTTPErrors/_http-errors.scss +77 -0
  188. package/scss/components/OptionsTile/_options-tile.scss +6 -6
  189. package/scss/components/SidePanel/_side-panel.scss +1 -1
  190. package/scss/components/_index-released-only.scss +1 -0
  191. package/telemetry.yml +12 -2
  192. package/es/global/js/utils/window.d.ts +0 -2
  193. package/es/global/js/utils/window.js +0 -12
  194. package/lib/global/js/utils/window.d.ts +0 -2
  195. package/lib/global/js/utils/window.js +0 -16
@@ -32,7 +32,7 @@ import { useSpreadsheetOutsideClick } from './hooks/useSpreadsheetOutsideClick.j
32
32
  import { useMoveActiveCell } from './hooks/useMoveActiveCell.js';
33
33
  import { useSpreadsheetEdit } from './hooks/useSpreadsheetEdit.js';
34
34
 
35
- var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
35
+ var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "disableColumnSwapping", "readOnlyTable", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
36
36
  // The block part of our conventional BEM class names (blockClass__E--M).
37
37
  var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
38
38
  var componentName = 'DataSpreadsheet';
@@ -69,6 +69,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
69
69
  onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
70
70
  renderRowHeader = _ref.renderRowHeader,
71
71
  renderRowHeaderDirection = _ref.renderRowHeaderDirection,
72
+ _ref$disableColumnSwa = _ref.disableColumnSwapping,
73
+ disableColumnSwapping = _ref$disableColumnSwa === void 0 ? false : _ref$disableColumnSwa,
74
+ _ref$readOnlyTable = _ref.readOnlyTable,
75
+ readOnlyTable = _ref$readOnlyTable === void 0 ? false : _ref$readOnlyTable,
72
76
  selectAllAriaLabel = _ref.selectAllAriaLabel,
73
77
  spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
74
78
  theme = _ref.theme,
@@ -427,8 +431,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
427
431
  }
428
432
  }, [handleInitialArrowPress, updateActiveCellCoordinates, activeCellCoordinates, columns, rows]);
429
433
  var handleKeyPressEvent = useCallback(function (event) {
430
- handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent);
431
- }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
434
+ handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent, readOnlyTable);
435
+ }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, readOnlyTable]);
432
436
  var startEditMode = function startEditMode() {
433
437
  setIsEditing(true);
434
438
  setClickAndHoldActive(false);
@@ -499,7 +503,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
499
503
  // Go into edit mode if 'Enter' key is pressed on activeCellRef
500
504
  var handleActiveCellKeyDown = function handleActiveCellKeyDown(event) {
501
505
  var key = event.key;
502
- if (key === 'Enter' && !activeCellInsideSelectionArea) {
506
+ if (key === 'Enter' && !activeCellInsideSelectionArea && !readOnlyTable) {
503
507
  if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header') {
504
508
  startEditMode();
505
509
  }
@@ -555,8 +559,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
555
559
  };
556
560
 
557
561
  // Go into edit mode if double click is detected on activeCellRef
558
- var handleActiveCellDoubleClick = function handleActiveCellDoubleClick() {
559
- startEditMode();
562
+ var handleActiveCellDoubleClick = function handleActiveCellDoubleClick(readOnlyTable) {
563
+ if (!readOnlyTable) {
564
+ startEditMode();
565
+ }
560
566
  };
561
567
  useSpreadsheetEdit({
562
568
  isEditing: isEditing,
@@ -636,6 +642,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
636
642
  setSelectionAreas: setSelectionAreas,
637
643
  setCurrentMatcher: setCurrentMatcher,
638
644
  setSelectionAreaData: setSelectionAreaData,
645
+ disableColumnSwapping: disableColumnSwapping,
646
+ readOnlyTable: readOnlyTable,
639
647
  totalVisibleColumns: totalVisibleColumns,
640
648
  updateActiveCellCoordinates: updateActiveCellCoordinates,
641
649
  setHeaderCellHoldActive: setHeaderCellHoldActive,
@@ -684,7 +692,9 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
684
692
  onMouseUp: handleActiveCellMouseUp,
685
693
  onClick: handleActiveCellClick,
686
694
  onKeyDown: handleActiveCellKeyDown,
687
- onDoubleClick: handleActiveCellDoubleClick,
695
+ onDoubleClick: function onDoubleClick() {
696
+ return handleActiveCellDoubleClick(readOnlyTable);
697
+ },
688
698
  onMouseEnter: handleActiveCellMouseEnter,
689
699
  ref: activeCellRef,
690
700
  className: cx("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), _defineProperty({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
@@ -760,6 +770,10 @@ DataSpreadsheet.propTypes = {
760
770
  * Sets the number of empty rows to be created when there is no data provided
761
771
  */
762
772
  defaultEmptyRowCount: PropTypes.number,
773
+ /**
774
+ * Disable column swapping, default false
775
+ */
776
+ disableColumnSwapping: PropTypes.bool,
763
777
  /**
764
778
  * Check if spreadsheet is using custom row header component attached
765
779
  */
@@ -780,6 +794,10 @@ DataSpreadsheet.propTypes = {
780
794
  * The event handler that is called when the selection area values change
781
795
  */
782
796
  onSelectionAreaChange: PropTypes.func,
797
+ /**
798
+ * Read-only table
799
+ */
800
+ readOnlyTable: PropTypes.bool,
783
801
  /**
784
802
  * Component next to numbering rows
785
803
  */
@@ -16,6 +16,10 @@ interface DataSpreadsheetHeaderProps {
16
16
  * Specifies the cell height
17
17
  */
18
18
  cellSize?: Size;
19
+ /**
20
+ * Disable column swapping, default false
21
+ */
22
+ disableColumnSwapping?: boolean;
19
23
  /**
20
24
  * All of the spreadsheet columns
21
25
  */
@@ -36,6 +40,10 @@ interface DataSpreadsheetHeaderProps {
36
40
  * Headers provided from useTable hook
37
41
  */
38
42
  headerGroups?: any[];
43
+ /**
44
+ * Read-only table
45
+ */
46
+ readOnlyTable?: boolean;
39
47
  /**
40
48
  * All of the spreadsheet row data
41
49
  */
@@ -36,6 +36,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
36
36
  setActiveCellCoordinates = _ref.setActiveCellCoordinates,
37
37
  setCurrentMatcher = _ref.setCurrentMatcher,
38
38
  setSelectionAreas = _ref.setSelectionAreas,
39
+ readOnlyTable = _ref.readOnlyTable,
40
+ disableColumnSwapping = _ref.disableColumnSwapping,
39
41
  setSelectionAreaData = _ref.setSelectionAreaData,
40
42
  rows = _ref.rows,
41
43
  totalVisibleColumns = _ref.totalVisibleColumns,
@@ -194,8 +196,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
194
196
  "data-row-index": "header",
195
197
  "data-column-index": index,
196
198
  tabIndex: -1,
197
- onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
198
- onMouseUp: selectedHeader && typeof setSelectedHeaderReorderActive === 'function' ? function () {
199
+ onMouseDown: selectedHeader && !readOnlyTable && !disableColumnSwapping ? handleHeaderMouseDown(index) : undefined,
200
+ onMouseUp: selectedHeader && !readOnlyTable && !disableColumnSwapping && typeof setSelectedHeaderReorderActive === 'function' ? function () {
199
201
  return setSelectedHeaderReorderActive(false);
200
202
  } : undefined,
201
203
  onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
@@ -203,7 +205,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
203
205
  height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
204
206
  width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
205
207
  },
206
- className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
208
+ className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === index || checkActiveHeaderCell(index, selectionAreas, 'column')), "".concat(blockClass, "__th--active-header-disabledSwapping"), disableColumnSwapping || readOnlyTable), "".concat(blockClass, "__th--selected-header"), selectedHeader), "".concat(blockClass, "__th--selected-header-reorder-active"), selectedHeaderReorderActive)),
207
209
  type: "button"
208
210
  }, column.render('Header')));
209
211
  }));
@@ -239,6 +241,10 @@ DataSpreadsheetHeader.propTypes = {
239
241
  rowHeaderWidth: PropTypes.number,
240
242
  width: PropTypes.number
241
243
  }),
244
+ /**
245
+ * Disable column swapping, default false
246
+ */
247
+ disableColumnSwapping: PropTypes.bool,
242
248
  /**
243
249
  * Whether or not a click/hold is active on a header cell
244
250
  */
@@ -247,6 +253,10 @@ DataSpreadsheetHeader.propTypes = {
247
253
  * Headers provided from useTable hook
248
254
  */
249
255
  headerGroups: PropTypes.arrayOf(PropTypes.object),
256
+ /**
257
+ * Read-only table
258
+ */
259
+ readOnlyTable: PropTypes.bool,
250
260
  /**
251
261
  * All of the spreadsheet row data
252
262
  */
@@ -16,10 +16,6 @@ export interface DatagridProps {
16
16
  * The data grid state, much of it being supplied by the useDatagrid hook
17
17
  */
18
18
  datagridState: DataGridState;
19
- /**
20
- * Table title
21
- */
22
- title?: string;
23
19
  }
24
20
  /**
25
21
  * The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
@@ -16,7 +16,7 @@ import { DatagridContent } from './DatagridContent.js';
16
16
  import { FilterProvider } from './addons/Filtering/FilterProvider.js';
17
17
  import { InlineEditProvider } from './addons/InlineEdit/InlineEditContext/InlineEditContext.js';
18
18
 
19
- var _excluded = ["datagridState", "title", "ariaToolbarLabel"];
19
+ var _excluded = ["datagridState", "ariaToolbarLabel"];
20
20
  var blockClass = "".concat(pkg.prefix, "--datagrid");
21
21
  var componentName = 'Datagrid';
22
22
  /**
@@ -24,7 +24,6 @@ var componentName = 'Datagrid';
24
24
  */
25
25
  var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
26
26
  var datagridState = _ref.datagridState,
27
- title = _ref.title,
28
27
  ariaToolbarLabel = _ref.ariaToolbarLabel,
29
28
  rest = _objectWithoutProperties(_ref, _excluded);
30
29
  if (!datagridState) {
@@ -40,7 +39,6 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
40
39
  state = datagridState.state;
41
40
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
42
41
  var props = {
43
- title: title,
44
42
  datagridState: datagridState,
45
43
  ariaToolbarLabel: ariaToolbarLabel
46
44
  };
@@ -73,11 +71,7 @@ Datagrid.propTypes = {
73
71
  * The data grid state, much of it being supplied by the useDatagrid hook
74
72
  */
75
73
  /**@ts-ignore */
76
- datagridState: PropTypes.object.isRequired,
77
- /**
78
- * Table title
79
- */
80
- title: PropTypes.string
74
+ datagridState: PropTypes.object.isRequired
81
75
  };
82
76
 
83
77
  export { Datagrid };
@@ -23,10 +23,8 @@ var _excluded = ["className"],
23
23
  var blockClass = "".concat(pkg.prefix, "--datagrid");
24
24
  var getAccessibilityProps = function getAccessibilityProps(header) {
25
25
  var props = {};
26
- var title = getNodeTextContent(header.Header);
27
- if (title) {
28
- props.title = title;
29
- } else {
26
+ var content = getNodeTextContent(header.Header);
27
+ if (!content) {
30
28
  props['aria-hidden'] = true;
31
29
  }
32
30
  return props;
@@ -82,6 +80,7 @@ var ResizeHeader = function ResizeHeader(_ref) {
82
80
  "aria-label": resizerAriaLabel || 'Resize column',
83
81
  disabled: isFetching
84
82
  })), /*#__PURE__*/React__default.createElement("span", {
83
+ role: "separator",
85
84
  className: "".concat(blockClass, "__col-resize-indicator")
86
85
  }));
87
86
  };
@@ -136,7 +135,9 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
136
135
  }
137
136
  onMouseDown === null || onMouseDown === void 0 || onMouseDown(event);
138
137
  };
139
- var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
138
+ var _headerGroup$getHeade = headerGroup.getHeaderGroupProps({
139
+ role: undefined
140
+ }),
140
141
  headerGroupClassName = _headerGroup$getHeade.className,
141
142
  headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
142
143
  var renderSlug = function renderSlug(slug) {
@@ -185,9 +186,13 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
185
186
  var _ref5 = columnResizing || {},
186
187
  columnWidths = _ref5.columnWidths;
187
188
  var originalCol = visibleColumns[index];
188
- var _header$getHeaderProp = header.getHeaderProps(),
189
+ var _header$getHeaderProp = header.getHeaderProps({
190
+ role: undefined
191
+ }),
189
192
  headerProps = _extends({}, (_objectDestructuringEmpty(_header$getHeaderProp), _header$getHeaderProp));
190
- var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
193
+ var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header, {
194
+ role: undefined
195
+ });
191
196
  var headerStyle = headerProps === null || headerProps === void 0 ? void 0 : headerProps.style;
192
197
  var lastVisibleIndex = withActionsColumn ? 2 : 1;
193
198
  var lastVisibleFlexStyle = index === visibleColumns.length - lastVisibleIndex ? '1 1 0' : '0 0 auto';
@@ -108,7 +108,9 @@ var DatagridRow = function DatagridRow(datagridState) {
108
108
  }
109
109
  return {};
110
110
  };
111
- var _row$getRowProps = row.getRowProps(),
111
+ var _row$getRowProps = row.getRowProps({
112
+ role: undefined
113
+ }),
112
114
  className = _row$getRowProps.className,
113
115
  rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
114
116
  var foundAIRow = rows.some(function (r) {
@@ -136,8 +138,10 @@ var DatagridRow = function DatagridRow(datagridState) {
136
138
  })) : /*#__PURE__*/React__default.createElement("td", {
137
139
  className: "".concat(blockClass, "__table-row-ai-spacer")
138
140
  }) : null, row.cells.map(function (cell, index) {
139
- var _cell$column, _cell$column2, _content$props, _associatedHeader$;
140
- var cellProps = cell.getCellProps();
141
+ var _cell$column, _cell$column2, _associatedHeader$;
142
+ var cellProps = cell.getCellProps({
143
+ role: undefined
144
+ });
141
145
  // eslint-disable-next-line no-unused-vars
142
146
  var _ref2 = cellProps,
143
147
  style = _ref2.style,
@@ -151,7 +155,6 @@ var DatagridRow = function DatagridRow(datagridState) {
151
155
  key: cell.column.id
152
156
  });
153
157
  }
154
- var title = content === null || content === void 0 || (_content$props = content.props) === null || _content$props === void 0 || (_content$props = _content$props.children[0]) === null || _content$props === void 0 || (_content$props = _content$props.props) === null || _content$props === void 0 ? void 0 : _content$props.value;
155
158
  var associatedHeader = headers === null || headers === void 0 ? void 0 : headers.filter(function (h) {
156
159
  return h.id === cell.column.id;
157
160
  });
@@ -164,8 +167,7 @@ var DatagridRow = function DatagridRow(datagridState) {
164
167
  className: cx("".concat(blockClass, "__cell"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), row.canExpand && index === 0), "".concat(blockClass, "__expandable-row-cell--is-expanded"), row.isExpanded && index === 0), "".concat(blockClass, "__slug--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/isValidElement((_associatedHeader$ = associatedHeader[0]) === null || _associatedHeader$ === void 0 ? void 0 : _associatedHeader$.slug)), columnClassname)
165
168
  }, restProps, {
166
169
  style: style,
167
- key: cell.column.id,
168
- title: title
170
+ key: cell.column.id
169
171
  }), content);
170
172
  })), (renderExpandedRow === null || renderExpandedRow === void 0 ? void 0 : renderExpandedRow()) || undefined);
171
173
  };
@@ -16,11 +16,12 @@ var _excluded = ["onChange"];
16
16
  var blockClass = "".concat(pkg.prefix, "--datagrid");
17
17
  var SelectAll = function SelectAll(datagridState) {
18
18
  var _columns$;
19
- var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
19
+ var _useState = useState(),
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  windowSize = _useState2[0],
22
22
  setWindowSize = _useState2[1];
23
23
  useLayoutEffect(function () {
24
+ setWindowSize(window.innerWidth);
24
25
  /* istanbul ignore next */
25
26
  function updateSize() {
26
27
  setWindowSize(window.innerWidth);
@@ -43,11 +43,12 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
43
43
  onSelectAllRows(isAllRowsSelected && selectAllMode === SELECT_ALL_ROWS);
44
44
  }
45
45
  }, [isAllRowsSelected, selectAllMode, onSelectAllRows]);
46
- var _useState3 = useState(window.innerWidth),
46
+ var _useState3 = useState(),
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
48
  windowSize = _useState4[0],
49
49
  setWindowSize = _useState4[1];
50
50
  useLayoutEffect(function () {
51
+ setWindowSize(window.innerWidth);
51
52
  function updateSize() {
52
53
  setWindowSize(window.innerWidth);
53
54
  }
@@ -68,7 +69,7 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
68
69
  var isFirstColumnStickyLeft = (columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
69
70
  return /*#__PURE__*/React__default.createElement("th", {
70
71
  scope: "col",
71
- className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
72
+ className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && (windowSize !== null && windowSize !== void 0 ? windowSize : 0) > 671))
72
73
  }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, selectProps, {
73
74
  name: "".concat(tableId, "-select-all-checkbox-name"),
74
75
  onClick: function onClick(e) {
@@ -62,7 +62,7 @@ var clearSingleFilter = function clearSingleFilter(_ref, setAllFilters, state) {
62
62
  This checks if all the checkboxes are selected = false and removes it from the array
63
63
  */
64
64
  var valueIndex = filterValues.findIndex(function (val) {
65
- return val.id === value;
65
+ return val.value === value;
66
66
  });
67
67
  filterValues[valueIndex].selected = false;
68
68
  var updatedFilterObject = _objectSpread2(_objectSpread2({}, f), {}, {
@@ -27,8 +27,7 @@ var InlineEditButton = function InlineEditButton(_ref) {
27
27
  tabIndex: isActiveCell ? 0 : -1,
28
28
  "data-disabled": disabledCell,
29
29
  "aria-disabled": disabledCell,
30
- role: "button",
31
- title: label
30
+ role: "button"
32
31
  }, LabelIcon && /*#__PURE__*/React__default.createElement("div", {
33
32
  className: "".concat(blockClass, "__label-icon")
34
33
  }, /*#__PURE__*/React__default.createElement(LabelIcon, null)), label !== '' ? /*#__PURE__*/React__default.createElement("span", {
@@ -6,7 +6,7 @@ import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonG
6
6
  import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
7
7
  import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
8
8
  import React, { CSSProperties, ComponentType, FunctionComponent, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
- import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
9
+ import { Cell, Column, ColumnInstance, FilterValue, Filters, HeaderGroup, Meta, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsOptions, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseSortByOptions, UseTableHooks } from 'react-table';
10
10
  import { CarbonIconType } from '@carbon/react/icons';
11
11
  import { IconButton, type ButtonProps } from '@carbon/react';
12
12
  import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
@@ -59,6 +59,18 @@ interface Labels {
59
59
  allPageRows?: object;
60
60
  allRows?: object;
61
61
  }
62
+ interface ColumnLabels {
63
+ findColumnPlaceholderLabel?: string;
64
+ resetToDefaultLabel?: string;
65
+ customizeTearsheetHeadingLabel?: string;
66
+ primaryButtonTextLabel?: string;
67
+ secondaryButtonTextLabel?: string;
68
+ instructionsLabel?: string;
69
+ iconTooltipLabel?: string;
70
+ assistiveTextInstructionsLabel?: string;
71
+ assistiveTextDisabledInstructionsLabel?: string;
72
+ selectAllLabel?: string;
73
+ }
62
74
  interface Section {
63
75
  categoryTitle?: string;
64
76
  filters?: DataGridFilter[];
@@ -85,7 +97,7 @@ export interface DataGridToggleAllRowsProps extends TableToggleAllRowsSelectedPr
85
97
  }
86
98
  export interface DatagridTableHooks<T extends object = any> extends UseTableHooks<T> {
87
99
  }
88
- export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T> {
100
+ export interface DatagridColumn<T extends object = any> extends ColumnInstance<T>, UseSortByOptions<T>, Partial<UseResizeColumnsColumnProps<T>>, UseResizeColumnsOptions<T> {
89
101
  sticky?: 'left' | 'right';
90
102
  className?: string;
91
103
  rightAlignedColumn?: boolean;
@@ -112,15 +124,13 @@ export interface DataGridHeader<T extends object = any> extends ColumnInstance,
112
124
  }
113
125
  export interface DataGridHeaderGroup<T extends object = any> extends HeaderGroup<T>, UseResizeColumnsColumnProps<T> {
114
126
  }
115
- export interface TableProps {
116
- className?: string;
117
- role?: string;
118
- style?: CSSStyleDeclaration;
127
+ export interface DataGridTableProps extends TableCommonProps {
119
128
  }
120
129
  interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectState<any> {
121
130
  filters: Filters<DataGridFilter>;
122
131
  }
123
132
  export interface DataGridTableInstance<T extends object = any> extends TableInstance<T> {
133
+ withSelectRows?: boolean;
124
134
  }
125
135
  export interface RowAction {
126
136
  id?: string;
@@ -210,11 +220,23 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
210
220
  expandedRowIds?: object;
211
221
  onRowClick?: (row: any, event: any) => void;
212
222
  onSort?: boolean;
223
+ customizeColumnsProps?: {
224
+ onSaveColumnPrefs?: (args: any) => void;
225
+ labels?: ColumnLabels;
226
+ isTearsheetOpen?: boolean;
227
+ setIsTearsheetOpen?: (args: boolean) => void;
228
+ };
229
+ CustomizeColumnsButton?: (args: any) => ReactNode;
213
230
  column?: DatagridColumn;
214
231
  expandedContentHeight?: number;
215
232
  onRowExpand?: (row: DatagridRow, event: React.MouseEvent<HTMLElement>) => void;
216
233
  ExpandedRowContentComponent?: JSXElementConstructor<any>;
217
234
  }
235
+ export interface DataGridData {
236
+ instance?: DataGridTableInstance;
237
+ column?: DatagridColumn;
238
+ cell?: DataGridCell;
239
+ }
218
240
  export interface ResizeHeaderProps {
219
241
  resizerProps?: ResizerProps;
220
242
  header: DataGridHeader;
@@ -1,2 +1,9 @@
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
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useCustomizeColumns: (hooks: Hooks) => void;
1
9
  export default useCustomizeColumns;
2
- declare function useCustomizeColumns(hooks: any): void;
@@ -16,9 +16,10 @@ var useCustomizeColumns = function useCustomizeColumns(hooks) {
16
16
  isTearsheetOpen = _React$useState2[0],
17
17
  setIsTearsheetOpen = _React$useState2[1];
18
18
  hooks.useInstance.push(function (instance) {
19
- var customizeColumnsProps = instance.customizeColumnsProps;
20
- var _ref = customizeColumnsProps || {},
21
- labels = _ref.labels;
19
+ var _ref = instance,
20
+ customizeColumnsProps = _ref.customizeColumnsProps;
21
+ var _ref2 = customizeColumnsProps || {},
22
+ labels = _ref2.labels;
22
23
  Object.assign(instance, {
23
24
  customizeColumnsProps: _objectSpread2(_objectSpread2({}, customizeColumnsProps), {}, {
24
25
  isTearsheetOpen: isTearsheetOpen,
@@ -21,7 +21,6 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
21
21
  var HeaderRenderer = function HeaderRenderer(header, slug) {
22
22
  return /*#__PURE__*/React__default.createElement("div", {
23
23
  className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--slug"), slug && /*#__PURE__*/React__default.isValidElement(slug))),
24
- title: typeof header === 'string' ? header : '',
25
24
  key: typeof header === 'string' ? header : ''
26
25
  }, header);
27
26
  };
@@ -48,9 +48,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
48
48
  type: "button",
49
49
  "aria-label": expanderTitle,
50
50
  className: cx("".concat(blockClass, "__row-expander"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--ghost"))
51
- }, expanderButtonProps, {
52
- title: expanderTitle
53
- }), /*#__PURE__*/React__default.createElement(ChevronRight, {
51
+ }, expanderButtonProps), /*#__PURE__*/React__default.createElement(ChevronRight, {
54
52
  className: cx("".concat(blockClass, "__expander-icon"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), "".concat(blockClass, "__expander-icon--open"), row.isExpanded))
55
53
  }));
56
54
  },
@@ -50,9 +50,7 @@ var useRowExpander = function useRowExpander(hooks) {
50
50
  type: "button",
51
51
  "aria-label": expanderTitle,
52
52
  className: cx("".concat(blockClass, "__row-expander"), "".concat(carbon.prefix, "--btn"), "".concat(carbon.prefix, "--btn--ghost"))
53
- }, expanderButtonProps, {
54
- title: expanderTitle
55
- }), row.isExpanded ? /*#__PURE__*/React__default.createElement(ChevronUp, {
53
+ }, expanderButtonProps), row.isExpanded ? /*#__PURE__*/React__default.createElement(ChevronUp, {
56
54
  className: "".concat(blockClass, "__row-expander--icon")
57
55
  }) : /*#__PURE__*/React__default.createElement(ChevronDown, {
58
56
  className: "".concat(blockClass, "__row-expander--icon")
@@ -81,11 +81,12 @@ var SelectRow = function SelectRow(datagridState) {
81
81
  withStickyColumn = datagridState.withStickyColumn,
82
82
  dispatch = datagridState.dispatch,
83
83
  getRowId = datagridState.getRowId;
84
- var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
84
+ var _useState = useState(),
85
85
  _useState2 = _slicedToArray(_useState, 2),
86
86
  windowSize = _useState2[0],
87
87
  setWindowSize = _useState2[1];
88
88
  useLayoutEffect(function () {
89
+ setWindowSize(window.innerWidth);
89
90
  function updateSize() {
90
91
  setWindowSize(window.innerWidth);
91
92
  }
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useStickyColumn: (hooks: Hooks) => void;
1
9
  export default useStickyColumn;
2
- declare function useStickyColumn(hooks: any): void;
@@ -18,12 +18,13 @@ var OFFSET_SCROLL_CLASS = "".concat(styleClassPrefix, "-offset-scroll");
18
18
  var useStickyColumn = function useStickyColumn(hooks) {
19
19
  var tableBodyRef = useRef();
20
20
  var stickyHeaderCellRef = useRef();
21
- var _useState = useState(null),
21
+ var _useState = useState(),
22
22
  _useState2 = _slicedToArray(_useState, 2),
23
23
  windowSize = _useState2[0],
24
24
  setWindowSize = _useState2[1];
25
25
  useEffect(function () {
26
- setWindowSize(window.innerWidth);
26
+ var _window;
27
+ setWindowSize((_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth);
27
28
  }, []);
28
29
  useLayoutEffect(function () {
29
30
  /* istanbul ignore next */
@@ -49,10 +50,11 @@ var useStickyColumn = function useStickyColumn(hooks) {
49
50
  var useEventListener = function useEventListener(instance) {
50
51
  useEffect(function () {
51
52
  var tableBodyElement = tableBodyRef.current;
52
- var headerCellElement = stickyHeaderCellRef.current;
53
+ var headerCellElement = stickyHeaderCellRef === null || stickyHeaderCellRef === void 0 ? void 0 : stickyHeaderCellRef.current;
53
54
  /* istanbul ignore next */
54
55
  if (hasVertScroll(tableBodyElement) && headerCellElement) {
55
- headerCellElement.classList.add(OFFSET_SCROLL_CLASS);
56
+ var _headerCellElement$cl;
57
+ headerCellElement === null || headerCellElement === void 0 || (_headerCellElement$cl = headerCellElement.classList) === null || _headerCellElement$cl === void 0 || _headerCellElement$cl.add(OFFSET_SCROLL_CLASS);
56
58
  }
57
59
  var boundListener = debounce(onBodyResize.bind(null, tableBodyElement, headerCellElement), 250);
58
60
  /* istanbul ignore next */
@@ -74,7 +76,7 @@ var useStickyColumn = function useStickyColumn(hooks) {
74
76
  };
75
77
  toggleStickyShadow(tableBodyElement, headerCellElement);
76
78
  if (tableBodyElement) {
77
- tableBodyElement.addEventListener('scroll', listener);
79
+ tableBodyElement === null || tableBodyElement === void 0 || tableBodyElement.addEventListener('scroll', listener);
78
80
  }
79
81
  return function () {
80
82
  if (tableBodyElement) {
@@ -138,18 +140,19 @@ var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
138
140
  }];
139
141
  };
140
142
  var changeProps = function changeProps(elementName, headerCellRef, windowSize, props, data) {
141
- var column = data.column || data.cell.column;
142
- if (column.sticky === 'right') {
143
+ var _data$cell;
144
+ var column = data.column || ((_data$cell = data.cell) === null || _data$cell === void 0 ? void 0 : _data$cell.column);
145
+ if ((column === null || column === void 0 ? void 0 : column.sticky) === 'right') {
143
146
  return [props, _objectSpread2({
144
147
  className: cx(_defineProperty(_defineProperty(_defineProperty({}, "".concat(styleClassPrefix, "-").concat(elementName), true), "".concat(blockClass, "__resizableColumn"), false), "".concat(blockClass, "__sortableColumn"), false))
145
148
  }, headerCellRef && {
146
149
  ref: headerCellRef
147
150
  })];
148
151
  }
149
- if (column.sticky === 'left') {
152
+ if ((column === null || column === void 0 ? void 0 : column.sticky) === 'left') {
150
153
  var _data$instance;
151
154
  return [props, _objectSpread2({
152
- className: cx(_defineProperty(_defineProperty({}, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), windowSize > 671), "".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))
155
+ className: cx(_defineProperty(_defineProperty({}, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), windowSize && windowSize > 671), "".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 && windowSize > 671))
153
156
  }, headerCellRef && {
154
157
  ref: headerCellRef
155
158
  })];
@@ -50,6 +50,10 @@ interface EditInplaceProps extends PropsWithChildren {
50
50
  * Provide the text that will be read by a screen reader when visiting this control
51
51
  */
52
52
  labelText: string;
53
+ /**
54
+ * handler to add custom onBlur event
55
+ */
56
+ onBlur?: (value: string) => void;
53
57
  /**
54
58
  * handler that is called when the cancel button is pressed or when the user removes focus from the input and there is no new value
55
59
  */