@carbon/ibm-products 2.41.1-canary.13 → 2.41.1-canary.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/es/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  2. package/es/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  3. package/es/components/CreateFullPage/CreateFullPageStep.js +3 -0
  4. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  5. package/es/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  6. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  7. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  8. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  9. package/es/components/DataSpreadsheet/types/index.d.ts +1 -4
  10. package/es/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  11. package/es/components/Datagrid/Datagrid/Datagrid.js +4 -4
  12. package/es/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  13. package/es/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  14. package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  15. package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -13
  16. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  17. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  18. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  19. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +10 -5
  20. package/es/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  21. package/es/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  22. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  23. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -36
  24. package/es/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  25. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  26. package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  27. package/es/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  28. package/es/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  29. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  30. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  31. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  32. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  33. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  34. package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  35. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  36. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  37. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  38. package/es/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  39. package/es/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  40. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  41. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  42. package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  43. package/es/components/Datagrid/Datagrid/index.d.ts +7 -1
  44. package/es/components/Datagrid/types/index.d.ts +208 -0
  45. package/es/components/Datagrid/useColumnOrder.d.ts +1 -0
  46. package/es/components/Datagrid/useDatagrid.d.ts +1 -1
  47. package/es/components/Datagrid/useSelectRows.js +5 -1
  48. package/es/components/FilterSummary/FilterSummary.d.ts +21 -2
  49. package/es/components/FilterSummary/FilterSummary.js +10 -11
  50. package/es/components/WebTerminal/WebTerminal.js +1 -1
  51. package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
  52. package/es/global/js/hooks/usePreviousValue.js +3 -2
  53. package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  54. package/es/global/js/hooks/useRetrieveStepData.js +5 -5
  55. package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  56. package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  57. package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
  58. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  59. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  60. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  61. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  62. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  63. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
  64. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  65. package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
  66. package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  67. package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  68. package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  69. package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
  70. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  72. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  73. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
  74. package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  75. package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  76. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  77. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
  78. package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  79. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  80. package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  81. package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  82. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  83. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  84. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  85. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  86. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  87. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  88. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  89. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  90. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  91. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  92. package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  93. package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  94. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  95. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  96. package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  97. package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
  98. package/lib/components/Datagrid/types/index.d.ts +208 -0
  99. package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
  100. package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
  101. package/lib/components/Datagrid/useSelectRows.js +5 -1
  102. package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
  103. package/lib/components/FilterSummary/FilterSummary.js +10 -11
  104. package/lib/components/WebTerminal/WebTerminal.js +1 -1
  105. package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
  106. package/lib/global/js/hooks/usePreviousValue.js +3 -2
  107. package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  108. package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
  109. package/package.json +3 -2
@@ -57,13 +57,14 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
57
57
  // the ButtonMenu
58
58
  React.useEffect(function () {
59
59
  if (totalSelected === 1 && !receivedInitialWidth) {
60
- var batchActionListWidth = ref.current.querySelector(".".concat(settings.carbon.prefix, "--action-list")).offsetWidth;
60
+ var _ref$current;
61
+ var batchActionListWidth = ref === null || ref === void 0 || (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(".".concat(settings.carbon.prefix, "--action-list")).offsetWidth;
61
62
  setInitialListWidth(batchActionListWidth);
62
63
  setReceivedInitialWidth(true);
63
64
  }
64
65
  }, [totalSelected, receivedInitialWidth, ref]);
65
66
  React.useEffect(function () {
66
- var summaryWidth = ref.current.querySelector(".".concat(settings.carbon.prefix, "--batch-summary")).offsetWidth;
67
+ var summaryWidth = ref === null || ref === void 0 ? void 0 : ref.current.querySelector(".".concat(settings.carbon.prefix, "--batch-summary")).offsetWidth;
67
68
  if (width < summaryWidth + initialListWidth + 32) {
68
69
  setDisplayAllInMenu(true);
69
70
  } else {
@@ -88,7 +89,7 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
88
89
  var minWidthBeforeOverflowIcon = 380;
89
90
  // Do not render ButtonMenu when there are 3 or less items
90
91
  // and if there is enough available space to render all the items
91
- if ((toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 && !displayAllInMenu) {
92
+ if (toolbarBatchActions && (toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.length) <= 3 && !displayAllInMenu) {
92
93
  return;
93
94
  }
94
95
  var renderItem = function renderItem(batchAction, index) {
@@ -103,7 +104,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
103
104
  return /*#__PURE__*/React__default["default"].createElement(react.MenuButton, {
104
105
  label: batchActionMenuButtonLabelText,
105
106
  className: cx__default["default"]([menuClass, _rollupPluginBabelHelpers.defineProperty({}, "".concat(menuClass, "-icon-only"), width <= minWidthBeforeOverflowIcon)]),
106
- tabIndex: totalSelected > 0 ? 0 : -1
107
+ tabIndex: totalSelected > 0 ? 0 : -1,
108
+ menuAlignment: "bottom"
107
109
  }, toolbarBatchActions === null || toolbarBatchActions === void 0 ? void 0 : toolbarBatchActions.map(function (batchAction, index) {
108
110
  var hidden = index < 2 && !displayAllInMenu;
109
111
  if (!hidden) {
@@ -122,10 +124,11 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
122
124
  dispatch: dispatch,
123
125
  rows: [],
124
126
  getRowId: getRowId,
125
- isChecked: false
127
+ isChecked: false,
128
+ indeterminate: undefined
126
129
  });
127
130
  toggleAllRowsSelected(false);
128
- setGlobalFilter(null);
131
+ setGlobalFilter === null || setGlobalFilter === void 0 || setGlobalFilter(null);
129
132
  };
130
133
  var onSelectAllHandler = function onSelectAllHandler() {
131
134
  toggleAllRowsSelected(true);
@@ -133,7 +136,9 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
133
136
  stateReducer.handleSelectAllRowData({
134
137
  dispatch: dispatch,
135
138
  rows: rows,
136
- getRowId: getRowId
139
+ getRowId: getRowId,
140
+ indeterminate: undefined,
141
+ isChecked: undefined
137
142
  });
138
143
  };
139
144
 
@@ -177,15 +182,14 @@ var DatagridToolbar = function DatagridToolbar(_ref2) {
177
182
  className: cx__default["default"]([blockClass, "".concat(blockClass, "--").concat(getRowHeight)])
178
183
  }, /*#__PURE__*/React__default["default"].createElement(react.TableToolbar, {
179
184
  "aria-label": ariaToolbarLabel
180
- }, DatagridActions && /*#__PURE__*/React__default["default"].createElement(DatagridActions, datagridState), DatagridBatchActionsToolbar && DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/React__default["default"].createElement("div", {
185
+ }, DatagridActions && /*#__PURE__*/React__default["default"].createElement(DatagridActions, datagridState), DatagridBatchActionsToolbar === null || DatagridBatchActionsToolbar === void 0 ? void 0 : DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/React__default["default"].createElement("div", {
181
186
  className: blockClass
182
187
  }, /*#__PURE__*/React__default["default"].createElement(react.TableToolbar, {
183
188
  "aria-label": ariaToolbarLabel
184
- }, DatagridActions && /*#__PURE__*/React__default["default"].createElement(DatagridActions, datagridState), DatagridBatchActions && DatagridBatchActions(datagridState))) : null;
189
+ }, DatagridActions && /*#__PURE__*/React__default["default"].createElement(DatagridActions, datagridState), DatagridBatchActions === null || DatagridBatchActions === void 0 ? void 0 : DatagridBatchActions(datagridState))) : null;
185
190
  };
186
191
  DatagridToolbar.propTypes = {
187
192
  ariaToolbarLabel: index["default"].string
188
193
  };
189
- var DatagridToolbar$1 = DatagridToolbar;
190
194
 
191
- exports["default"] = DatagridToolbar$1;
195
+ exports["default"] = DatagridToolbar;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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 { DataGridState } from '../types';
8
+ declare const DatagridVirtualBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
9
  export default DatagridVirtualBody;
2
- declare function DatagridVirtualBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
@@ -53,37 +53,48 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
53
53
  /* istanbul ignore next */
54
54
  var handleVirtualGridResize = function handleVirtualGridResize() {
55
55
  var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
56
- gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
56
+ if (gridRefElement) {
57
+ var _gridRefElement$clien;
58
+ gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 || (_gridRefElement$clien = gridRefElement.clientWidth) === null || _gridRefElement$clien === void 0 ? void 0 : _gridRefElement$clien.toString();
59
+ }
57
60
  };
58
61
  useResizeObserver.useResizeObserver(gridRef, handleVirtualGridResize);
59
62
  React.useEffect(function () {
60
- handleResize();
63
+ handleResize === null || handleResize === void 0 || handleResize();
61
64
  }, [handleResize]);
62
65
  var rowHeight = rowSize && rowSizeMap[rowSize] || defaultRowHeight;
63
- if (listRef && listRef.current) {
64
- listRef.current.resetAfterIndex(0);
65
- }
66
+ React.useEffect(function () {
67
+ if (listRef && listRef.current) {
68
+ listRef.current.resetAfterIndex(0);
69
+ }
70
+ }, [listRef]);
66
71
  var visibleRows = DatagridPagination && page || rows;
67
- var testRef = React.useRef();
72
+ var testRef = React.useRef(null);
68
73
 
69
74
  // Sync the scrollLeft position of the virtual body to the table header
70
75
  React.useEffect(function () {
71
76
  function handleScroll(event) {
77
+ var _document;
72
78
  var virtualBody = event.target;
73
- document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
79
+ var headWrapEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap"));
80
+ if (headWrapEl) {
81
+ headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
82
+ }
74
83
  var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
75
- spacerColumn.style.width = layout.px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
84
+ if (spacerColumn) {
85
+ spacerColumn.style.width = layout.px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
86
+ }
76
87
  }
77
- var testRefValue = testRef.current;
78
- testRefValue.addEventListener('scroll', handleScroll);
88
+ var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
89
+ testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
79
90
  return function () {
80
- testRefValue.removeEventListener('scroll', handleScroll);
91
+ testRefValue === null || testRefValue === void 0 || testRefValue.removeEventListener('scroll', handleScroll);
81
92
  };
82
93
  });
83
94
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
84
95
  className: "".concat(blockClass, "__head-wrap"),
85
96
  style: {
86
- width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
97
+ width: gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
87
98
  overflow: 'hidden'
88
99
  }
89
100
  }, /*#__PURE__*/React__default["default"].createElement(DatagridHead["default"], datagridState)), /*#__PURE__*/React__default["default"].createElement(react.TableBody, _rollupPluginBabelHelpers["extends"]({}, getTableBodyProps({
@@ -94,7 +105,8 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
94
105
  height: virtualHeight || tableHeight,
95
106
  itemCount: visibleRows.length,
96
107
  itemSize: function itemSize(index) {
97
- return visibleRows[index].isExpanded ? (visibleRows[index].expandedContentHeight || 0) + rowHeight : rowHeight;
108
+ var _visibleRows$index;
109
+ return (_visibleRows$index = visibleRows[index]) !== null && _visibleRows$index !== void 0 && _visibleRows$index.isExpanded ? (visibleRows[index].expandedContentHeight || 0) + rowHeight : rowHeight;
98
110
  },
99
111
  estimatedItemSize: rowHeight,
100
112
  onScroll: onScroll,
@@ -106,9 +118,10 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
106
118
  ref: listRef,
107
119
  className: "".concat(blockClass, "__virtual-scrollbar"),
108
120
  style: {
109
- width: (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
121
+ width: gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
110
122
  }
111
123
  }, function (_ref) {
124
+ var _row$RowRenderer;
112
125
  var index = _ref.index,
113
126
  style = _ref.style;
114
127
  var row = visibleRows[index];
@@ -117,12 +130,11 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
117
130
  key = _row$getRowProps.key;
118
131
  return /*#__PURE__*/React__default["default"].createElement("div", {
119
132
  style: _rollupPluginBabelHelpers.objectSpread2({}, style)
120
- }, row.RowRenderer(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, datagridState), {}, {
133
+ }, row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, datagridState), {}, {
121
134
  row: row,
122
135
  key: key
123
136
  })));
124
137
  })));
125
138
  };
126
- var DatagridVirtualBody$1 = DatagridVirtualBody;
127
139
 
128
- exports["default"] = DatagridVirtualBody$1;
140
+ exports["default"] = DatagridVirtualBody;
@@ -1,22 +1,24 @@
1
- export default DraggableElement;
2
- declare function DraggableElement({ id, children, classList, disabled, ariaLabel, isSticky, selected, }: {
3
- id: any;
4
- children: any;
5
- classList: any;
6
- disabled: any;
7
- ariaLabel: any;
8
- isSticky: any;
9
- selected: any;
10
- }): import("react/jsx-runtime").JSX.Element;
11
- declare namespace DraggableElement {
12
- namespace propTypes {
13
- let ariaLabel: PropTypes.Validator<string>;
14
- let children: PropTypes.Validator<PropTypes.ReactElementLike>;
15
- let classList: PropTypes.Requireable<string>;
16
- let disabled: PropTypes.Requireable<boolean>;
17
- let id: PropTypes.Validator<string>;
18
- let isSticky: PropTypes.Requireable<boolean>;
19
- let selected: PropTypes.Requireable<boolean>;
20
- }
21
- }
1
+ import { PropsWithChildren, ReactNode } from 'react';
22
2
  import PropTypes from 'prop-types';
3
+ interface DraggableElementProps extends PropsWithChildren {
4
+ ariaLabel: string;
5
+ children: ReactNode;
6
+ classList?: string;
7
+ disabled?: boolean;
8
+ id: string;
9
+ isSticky?: boolean;
10
+ selected?: boolean;
11
+ }
12
+ declare const DraggableElement: {
13
+ ({ id, children, classList, disabled, ariaLabel, isSticky, selected, }: DraggableElementProps): import("react/jsx-runtime").JSX.Element;
14
+ propTypes: {
15
+ ariaLabel: PropTypes.Validator<string>;
16
+ children: PropTypes.Validator<PropTypes.ReactElementLike>;
17
+ classList: PropTypes.Requireable<string>;
18
+ disabled: PropTypes.Requireable<boolean>;
19
+ id: PropTypes.Validator<string>;
20
+ isSticky: PropTypes.Requireable<boolean>;
21
+ selected: PropTypes.Requireable<boolean>;
22
+ };
23
+ };
24
+ export default DraggableElement;
@@ -53,7 +53,7 @@ var DraggableElement = function DraggableElement(_ref) {
53
53
  size: 16
54
54
  }))), children);
55
55
  var style = {
56
- transform: !disabled ? utilities.CSS.Transform.toString(transform) : {},
56
+ transform: !disabled ? utilities.CSS.Transform.toString(transform) : undefined,
57
57
  transition: transition
58
58
  };
59
59
  return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
@@ -62,7 +62,6 @@ var DraggableElement = function DraggableElement(_ref) {
62
62
  ref: setNodeRef,
63
63
  style: style
64
64
  }, attributes, listeners, {
65
- disabled: disabled,
66
65
  "aria-selected": selected,
67
66
  role: "option"
68
67
  }), /*#__PURE__*/React__default["default"].createElement("span", {
@@ -80,6 +79,5 @@ DraggableElement.propTypes = {
80
79
  isSticky: index["default"].bool,
81
80
  selected: index["default"].bool
82
81
  };
83
- var DraggableElement$1 = DraggableElement;
84
82
 
85
- exports["default"] = DraggableElement$1;
83
+ exports["default"] = DraggableElement;
@@ -41,7 +41,7 @@ declare namespace FilterPanel {
41
41
  let searchLabelText: PropTypes.Requireable<string>;
42
42
  let searchPlaceholder: PropTypes.Requireable<string>;
43
43
  let secondaryActionLabel: PropTypes.Requireable<string>;
44
- let setAllFilters: PropTypes.Validator<(...args: any[]) => any>;
44
+ let setAllFilters: PropTypes.Requireable<(...args: any[]) => any>;
45
45
  let showFilterSearch: PropTypes.Requireable<boolean>;
46
46
  let title: PropTypes.Requireable<string>;
47
47
  let updateMethod: PropTypes.Requireable<string>;
@@ -292,7 +292,7 @@ FilterPanel.propTypes = {
292
292
  searchLabelText: index["default"].string,
293
293
  searchPlaceholder: index["default"].string,
294
294
  secondaryActionLabel: index["default"].string,
295
- setAllFilters: index["default"].func.isRequired,
295
+ setAllFilters: index["default"].func,
296
296
  showFilterSearch: index["default"].bool,
297
297
  title: index["default"].string,
298
298
  updateMethod: index["default"].oneOf([constants.BATCH, constants.INSTANT])
@@ -1,2 +1,12 @@
1
- export const DatagridSlug: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from 'react';
1
+ /**
2
+ * Copyright IBM Corp. 2024, 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 React, { ReactNode } from 'react';
8
+ interface DatagridSlugProps {
9
+ slug?: ReactNode;
10
+ }
11
+ export declare const DatagridSlug: React.ForwardRefExoticComponent<DatagridSlugProps & React.RefAttributes<HTMLDivElement>>;
12
+ export {};
@@ -1 +1,7 @@
1
- export { Datagrid } from "./Datagrid";
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2022
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
+ export { Datagrid } from './Datagrid';
@@ -0,0 +1,208 @@
1
+ /// <reference path="../../../../src/custom-typings/index.d.ts" />
2
+ import { MultiSelectProps } from '@carbon/react/lib/components/MultiSelect/MultiSelect';
3
+ import { FormGroupProps } from '@carbon/react/lib/components/FormGroup/FormGroup';
4
+ import { RadioButtonProps } from '@carbon/react/lib/components/RadioButton/RadioButton';
5
+ import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup';
6
+ import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
7
+ import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
8
+ import { CSSProperties, JSXElementConstructor, MutableRefObject, ReactNode, TouchEventHandler } from 'react';
9
+ import { Cell, ColumnInstance, FilterValue, Filters, HeaderGroup, Row, TableCommonProps, TableDispatch, TableInstance, TableToggleAllRowsSelectedProps, UseExpandedRowProps, UseFiltersInstanceProps, UsePaginationInstanceProps, UseResizeColumnsColumnProps, UseResizeColumnsState, UseRowSelectInstanceProps, UseRowSelectRowProps, UseRowSelectState, UseSortByColumnProps, UseTableHooks } from 'react-table';
10
+ import { CarbonIconType } from '@carbon/react/icons';
11
+ import { type ButtonProps } from '@carbon/react';
12
+ import { TableBatchActionsProps } from '@carbon/react/lib/components/DataTable/TableBatchActions';
13
+ export type Size = 'xs' | 'sm' | 'md' | 'lg';
14
+ export interface ResizerProps {
15
+ draggable?: boolean;
16
+ onMouseDown?: (evt: any) => void;
17
+ onTouchStart?: TouchEventHandler<HTMLElement>;
18
+ role?: string;
19
+ style?: CSSProperties;
20
+ }
21
+ export type DataGridFilter = ({
22
+ column?: string;
23
+ } & {
24
+ type: 'date';
25
+ props: {
26
+ DatePicker?: any;
27
+ DatePickerInput?: any;
28
+ };
29
+ }) | {
30
+ type: 'number';
31
+ props: {
32
+ NumberInput?: NumberInputProps;
33
+ };
34
+ } | {
35
+ type: 'checkbox';
36
+ props: {
37
+ FormGroup?: FormGroupProps;
38
+ Checkbox?: CheckboxProps[];
39
+ };
40
+ } | {
41
+ type: 'radio';
42
+ props: {
43
+ FormGroup?: FormGroupProps;
44
+ RadioButton?: RadioButtonProps[];
45
+ RadioButtonGroup?: RadioButtonGroupProps;
46
+ };
47
+ } | {
48
+ type: 'multiSelect';
49
+ props: {
50
+ MultiSelect?: MultiSelectProps<any>;
51
+ };
52
+ };
53
+ export interface ReactTableFiltersState {
54
+ id: string;
55
+ type: string;
56
+ value: string;
57
+ }
58
+ interface Labels {
59
+ allPageRows?: object;
60
+ allRows?: object;
61
+ }
62
+ interface Section {
63
+ categoryTitle?: string;
64
+ filters?: DataGridFilter[];
65
+ }
66
+ export interface FilterFlyoutProps {
67
+ data?: any;
68
+ filters?: DataGridFilter[];
69
+ flyoutIconDescription?: string;
70
+ onFlyoutClose?: () => void;
71
+ onFlyoutOpen?: () => void;
72
+ panelIconDescription?: string;
73
+ primaryActionLabel?: string;
74
+ reactTableFiltersState?: ReactTableFiltersState[];
75
+ renderLabel?: () => void;
76
+ secondaryActionLabel?: string;
77
+ updateMethod?: string;
78
+ variation?: string;
79
+ panelTitle?: string;
80
+ sections?: Section[];
81
+ autoHideFilters: boolean;
82
+ }
83
+ export interface DataGridToggleAllRowsProps extends TableToggleAllRowsSelectedProps {
84
+ disabled?: boolean;
85
+ }
86
+ export interface DatagridTableHooks<T extends object = any> extends UseTableHooks<T> {
87
+ }
88
+ export interface DatagridColumn<T extends object = any> extends ColumnInstance<T> {
89
+ sticky?: 'left' | 'right';
90
+ className?: string;
91
+ }
92
+ export interface DataGridCell<T extends object = any> extends Omit<Cell<T>, 'column'> {
93
+ column: DatagridColumn<any>;
94
+ }
95
+ export interface DatagridRow<T extends object = any> extends Omit<Row<T>, 'cells'>, UseExpandedRowProps<T>, UseRowSelectRowProps<T> {
96
+ expandedContentHeight?: number;
97
+ RowRenderer?: (state?: DataGridState) => ReactNode;
98
+ RowExpansionRenderer?: (state?: DataGridState) => void;
99
+ cells: Array<DataGridCell>;
100
+ isSkeleton?: boolean;
101
+ }
102
+ export interface DataGridHeader<T extends object = any> extends ColumnInstance, UseResizeColumnsColumnProps<T>, UseSortByColumnProps<T> {
103
+ className(className: any, arg1: {
104
+ [x: string]: any;
105
+ }): unknown;
106
+ isAction?: boolean;
107
+ slug?: any;
108
+ }
109
+ export interface DataGridHeaderGroup<T extends object = any> extends HeaderGroup<T>, UseResizeColumnsColumnProps<T> {
110
+ }
111
+ export interface TableProps {
112
+ className?: string;
113
+ role?: string;
114
+ style?: CSSStyleDeclaration;
115
+ }
116
+ interface DataGridTableState extends UseResizeColumnsState<any>, UseRowSelectState<any> {
117
+ filters: Filters<DataGridFilter>;
118
+ }
119
+ export interface DataGridTableInstance<T extends object = any> extends TableInstance<T> {
120
+ }
121
+ export interface DataGridState<T extends object = any> extends TableCommonProps, UsePaginationInstanceProps<T>, Omit<TableInstance<T>, 'state' | 'headers' | 'rows' | 'columns'>, Omit<UseFiltersInstanceProps<T>, 'rows'>, UseRowSelectInstanceProps<T>, Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'> {
122
+ withVirtualScroll?: boolean;
123
+ DatagridPagination?: JSXElementConstructor<any>;
124
+ isFetching?: boolean;
125
+ tableId?: string;
126
+ filterProps?: FilterFlyoutProps;
127
+ state: DataGridTableState;
128
+ getFilterFlyoutProps?: () => FilterFlyoutProps;
129
+ DatagridActions?: JSXElementConstructor<any>;
130
+ CustomizeColumnsTearsheet?: JSXElementConstructor<any>;
131
+ fullHeightDatagrid?: boolean;
132
+ variableRowHeight?: boolean;
133
+ useDenseHeader?: boolean;
134
+ withInlineEdit?: boolean;
135
+ verticalAlign?: string;
136
+ gridTitle?: ReactNode;
137
+ gridDescription?: ReactNode;
138
+ gridRef?: MutableRefObject<HTMLDivElement>;
139
+ DatagridBatchActions?: (args: any) => ReactNode;
140
+ batchActions?: boolean;
141
+ row: DatagridRow;
142
+ rows: Array<DatagridRow<any>>;
143
+ columns: Array<DatagridColumn>;
144
+ key?: any;
145
+ rowSize?: Size;
146
+ headers?: Array<DataGridHeader<T>>;
147
+ headRef?: MutableRefObject<HTMLDivElement>;
148
+ HeaderRow?: (state?: object, ref?: MutableRefObject<HTMLDivElement>, group?: HeaderGroup<any>) => ReactNode;
149
+ withStickyColumn?: boolean;
150
+ emptyStateTitle?: string | ReactNode;
151
+ emptyStateDescription?: string;
152
+ emptyStateSize?: 'lg' | 'sm';
153
+ emptyStateType?: string;
154
+ illustrationTheme?: 'light' | 'dark';
155
+ emptyStateAction: {
156
+ kind?: 'primary' | 'secondary' | 'tertiary';
157
+ renderIcon?: CarbonIconType;
158
+ onClick?: ButtonProps<any>['onClick'];
159
+ text?: string;
160
+ };
161
+ emptyStateLink?: {
162
+ text?: string | ReactNode;
163
+ href?: string;
164
+ };
165
+ isTableSortable?: boolean;
166
+ resizerAriaLabel?: string;
167
+ onColResizeEnd?: () => void;
168
+ withNestedRows?: boolean;
169
+ withExpandedRows?: boolean;
170
+ withMouseHover?: boolean;
171
+ setMouseOverRowIndex?: (arg: any) => void;
172
+ hideSelectAll?: boolean;
173
+ radio?: boolean;
174
+ onAllRowSelect: (rows: DatagridRow[], evt: any) => void;
175
+ selectAllToggle?: {
176
+ onSelectAllRows?: (args: any) => void;
177
+ labels?: Labels;
178
+ };
179
+ allPageRowsLabel?: string | object;
180
+ allRowsLabel: string | object;
181
+ onSelectAllRows?: (val?: boolean) => void;
182
+ toolbarBatchActions?: ButtonProps<any>[];
183
+ setGlobalFilter?: (filterValue: FilterValue) => void;
184
+ batchActionMenuButtonLabel?: string;
185
+ translateWithIdBatchActions?: TableBatchActionsProps['translateWithId'];
186
+ onScroll?: (evt?: any) => void;
187
+ innerListRef?: MutableRefObject<HTMLDivElement>;
188
+ tableHeight?: number;
189
+ virtualHeight?: number;
190
+ listRef?: MutableRefObject<any>;
191
+ handleResize?: () => void;
192
+ onVirtualScroll?: (evt?: boolean) => void;
193
+ }
194
+ export interface ResizeHeaderProps {
195
+ resizerProps?: ResizerProps;
196
+ header: DataGridHeader;
197
+ originalCol?: DatagridColumn;
198
+ handleOnMouseDownResize?: (evt?: any, props?: ResizerProps) => void;
199
+ columnWidths?: any[];
200
+ datagridState: DataGridState;
201
+ incrementAmount: number;
202
+ minWidth?: number;
203
+ dispatch?: TableDispatch<any>;
204
+ onColResizeEnd?: () => void;
205
+ resizerAriaLabel?: string;
206
+ isFetching?: boolean;
207
+ }
208
+ export {};
@@ -1 +1,2 @@
1
1
  export default useColumnOrder;
2
+ import { useColumnOrder } from 'react-table';
@@ -1,2 +1,2 @@
1
1
  export default useDatagrid;
2
- declare function useDatagrid(params: any, ...plugins: any[]): any;
2
+ declare function useDatagrid(params: any, ...plugins: any[]): import("react-table").TableInstance<any>;
@@ -128,7 +128,11 @@ var SelectRow = function SelectRow(datagridState) {
128
128
  var cellProps = cell.getCellProps();
129
129
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
130
130
  var rowId = "".concat(tableId, "-").concat(row.id, "-").concat(row.index);
131
- return /*#__PURE__*/React__default["default"].createElement(react.TableSelectRow, _rollupPluginBabelHelpers["extends"]({}, cellProps, selectProps, {
131
+ var key = cellProps.key,
132
+ _cellProps = cellProps._cellProps;
133
+ return /*#__PURE__*/React__default["default"].createElement(react.TableSelectRow, _rollupPluginBabelHelpers["extends"]({
134
+ key: key
135
+ }, _cellProps, selectProps, {
132
136
  radio: radio,
133
137
  onSelect: onSelectHandler,
134
138
  id: rowId,
@@ -1,3 +1,22 @@
1
- export default FilterSummary;
2
- declare let FilterSummary: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
1
+ /**
2
+ * Copyright IBM Corp. 2022, 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
+ */
3
7
  import React from 'react';
8
+ export interface Filter {
9
+ key: string;
10
+ value: string;
11
+ }
12
+ interface FilterSummaryProps {
13
+ className?: string;
14
+ clearButtonInline?: boolean;
15
+ clearFilters: () => void;
16
+ clearFiltersText?: string;
17
+ filters: Filter[];
18
+ overflowType?: 'default' | 'tag';
19
+ renderLabel?: (key: any, value: any) => void;
20
+ }
21
+ declare const FilterSummary: React.ForwardRefExoticComponent<FilterSummaryProps & React.RefAttributes<HTMLDivElement>>;
22
+ export default FilterSummary;
@@ -42,8 +42,7 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
42
42
  clearFiltersText = _ref$clearFiltersText === void 0 ? 'Clear filters' : _ref$clearFiltersText,
43
43
  clearFilters = _ref.clearFilters,
44
44
  filters = _ref.filters,
45
- _ref$renderLabel = _ref.renderLabel,
46
- renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
45
+ renderLabel = _ref.renderLabel,
47
46
  _ref$overflowType = _ref.overflowType,
48
47
  overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
49
48
  _ref$clearButtonInlin = _ref.clearButtonInline,
@@ -60,9 +59,9 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
60
59
  label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
61
60
  });
62
61
  });
63
- var filterSummaryClearButton = React.useRef();
64
- var viewAllButtonRef = React.useRef();
65
- var filterSummaryRef = React.useRef();
62
+ var filterSummaryClearButton = React.useRef(null);
63
+ var viewAllButtonRef = React.useRef(null);
64
+ var filterSummaryRef = React.useRef(null);
66
65
  var localRef = filterSummaryRef || ref;
67
66
  var _useState = React.useState(0),
68
67
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
@@ -74,7 +73,7 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
74
73
  setMultiline = _useState4[1];
75
74
  var previousState = usePreviousValue.usePreviousValue({
76
75
  multiline: multiline
77
- });
76
+ }) || {};
78
77
  var handleViewAll = function handleViewAll() {
79
78
  if (overflowCount === 0) {
80
79
  setMultiline(false);
@@ -85,7 +84,7 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
85
84
  });
86
85
  };
87
86
  var viewAllWidth = typeof (viewAllButtonRef === null || viewAllButtonRef === void 0 || (_viewAllButtonRef$cur = viewAllButtonRef.current) === null || _viewAllButtonRef$cur === void 0 ? void 0 : _viewAllButtonRef$cur.offsetWidth) === 'undefined' ? 0 : overflowCount > 0 ? 48 : 0;
88
- var measurementOffset = (filterSummaryClearButton === null || filterSummaryClearButton === void 0 || (_filterSummaryClearBu = filterSummaryClearButton.current) === null || _filterSummaryClearBu === void 0 ? void 0 : _filterSummaryClearBu.offsetWidth) + viewAllWidth;
87
+ var measurementOffset = ((filterSummaryClearButton === null || filterSummaryClearButton === void 0 || (_filterSummaryClearBu = filterSummaryClearButton.current) === null || _filterSummaryClearBu === void 0 ? void 0 : _filterSummaryClearBu.offsetWidth) || 0) + viewAllWidth;
89
88
  var renderTagSet = function renderTagSet(type) {
90
89
  return /*#__PURE__*/React__default["default"].createElement(framerMotion.motion.div, {
91
90
  key: type,
@@ -116,15 +115,15 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
116
115
  containingElementRef: localRef,
117
116
  measurementOffset: measurementOffset,
118
117
  onOverflowTagChange: function onOverflowTagChange(overflowTags) {
119
- return setOverflowCount(overflowTags.length);
118
+ return setOverflowCount(overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length);
120
119
  },
121
120
  multiline: multiline
122
121
  }));
123
122
  };
124
123
  useWindowResize.useWindowResize(function () {
125
124
  var handleFilterSummaryResize = function handleFilterSummaryResize() {
126
- var _localRef$current;
127
- if (multiline && (localRef === null || localRef === void 0 || (_localRef$current = localRef.current) === null || _localRef$current === void 0 ? void 0 : _localRef$current.offsetHeight) <= 50) {
125
+ var _localRef$current, _localRef$current2;
126
+ if (multiline && localRef !== null && localRef !== void 0 && (_localRef$current = localRef.current) !== null && _localRef$current !== void 0 && _localRef$current.offsetHeight && (localRef === null || localRef === void 0 || (_localRef$current2 = localRef.current) === null || _localRef$current2 === void 0 ? void 0 : _localRef$current2.offsetHeight) <= 50) {
128
127
  setMultiline(false);
129
128
  }
130
129
  };
@@ -137,7 +136,6 @@ var FilterSummary = /*#__PURE__*/React__default["default"].forwardRef(function (
137
136
  ref: localRef,
138
137
  className: cx__default["default"]([blockClass, className], _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__expanded"), multiline))
139
138
  }), /*#__PURE__*/React__default["default"].createElement(framerMotion.AnimatePresence, {
140
- mode: "wait",
141
139
  exitBeforeEnter: true
142
140
  }, !multiline && renderTagSet('single'), multiline && renderTagSet('multiline')), /*#__PURE__*/React__default["default"].createElement(react.Button, {
143
141
  kind: "ghost",
@@ -166,6 +164,7 @@ FilterSummary.propTypes = {
166
164
  clearButtonInline: index["default"].bool,
167
165
  clearFilters: index["default"].func.isRequired,
168
166
  clearFiltersText: index["default"].string,
167
+ /**@ts-ignore */
169
168
  filters: index["default"].arrayOf(index["default"].object).isRequired,
170
169
  overflowType: index["default"].oneOf(['default', 'tag']),
171
170
  renderLabel: index["default"].func
@@ -69,7 +69,7 @@ exports.WebTerminal = /*#__PURE__*/React__default["default"].forwardRef(function
69
69
  matches: true
70
70
  },
71
71
  prefersReducedMotion = _ref2.matches;
72
- var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit', " ").concat(carbonMotion.moderate02);
72
+ var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit forwards', " ").concat(carbonMotion.moderate02);
73
73
  var showDocumentationLinks = React.useMemo(function () {
74
74
  return documentationLinks.length > 0;
75
75
  }, [documentationLinks]);
@@ -1 +1 @@
1
- export function usePreviousValue(value: object): undefined;
1
+ export function usePreviousValue(value: object): T | undefined;