@carbon/ibm-products 2.41.1-canary.8 → 2.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) 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 +210 -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/useFocusRowExpander.js +1 -1
  48. package/es/components/Datagrid/useInfiniteScroll.d.ts +8 -1
  49. package/es/components/Datagrid/useInfiniteScroll.js +10 -9
  50. package/es/components/Datagrid/useSelectRows.js +5 -1
  51. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
  52. package/es/components/FilterSummary/FilterSummary.d.ts +21 -2
  53. package/es/components/FilterSummary/FilterSummary.js +10 -11
  54. package/es/components/Guidebanner/Guidebanner.js +7 -2
  55. package/es/components/ProductiveCard/ProductiveCard.d.ts +115 -2
  56. package/es/components/ProductiveCard/ProductiveCard.js +9 -9
  57. package/es/components/WebTerminal/WebTerminal.js +1 -1
  58. package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
  59. package/es/global/js/hooks/usePreviousValue.js +3 -2
  60. package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  61. package/es/global/js/hooks/useRetrieveStepData.js +5 -5
  62. package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  63. package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  64. package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
  65. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  66. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  67. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  68. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  69. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  70. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
  71. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  72. package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
  73. package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  74. package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  75. package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  76. package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
  77. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  78. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  79. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  80. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
  81. package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  82. package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  83. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  84. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
  85. package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  86. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  87. package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  88. package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  89. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  90. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  91. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  92. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  93. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  94. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  95. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  96. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  97. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  98. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  99. package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  100. package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  101. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  102. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  103. package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  104. package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
  105. package/lib/components/Datagrid/types/index.d.ts +210 -0
  106. package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
  107. package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
  108. package/lib/components/Datagrid/useFocusRowExpander.js +1 -1
  109. package/lib/components/Datagrid/useInfiniteScroll.d.ts +8 -1
  110. package/lib/components/Datagrid/useInfiniteScroll.js +10 -9
  111. package/lib/components/Datagrid/useSelectRows.js +5 -1
  112. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +4 -3
  113. package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
  114. package/lib/components/FilterSummary/FilterSummary.js +10 -11
  115. package/lib/components/Guidebanner/Guidebanner.js +7 -2
  116. package/lib/components/ProductiveCard/ProductiveCard.d.ts +115 -2
  117. package/lib/components/ProductiveCard/ProductiveCard.js +9 -9
  118. package/lib/components/WebTerminal/WebTerminal.js +1 -1
  119. package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
  120. package/lib/global/js/hooks/usePreviousValue.js +3 -2
  121. package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  122. package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
  123. package/package.json +5 -4
  124. package/telemetry.yml +67 -6
@@ -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;
@@ -45,37 +45,48 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
45
45
  /* istanbul ignore next */
46
46
  var handleVirtualGridResize = function handleVirtualGridResize() {
47
47
  var gridRefElement = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current;
48
- gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 ? void 0 : gridRefElement.clientWidth;
48
+ if (gridRefElement) {
49
+ var _gridRefElement$clien;
50
+ gridRefElement.style.width = gridRefElement === null || gridRefElement === void 0 || (_gridRefElement$clien = gridRefElement.clientWidth) === null || _gridRefElement$clien === void 0 ? void 0 : _gridRefElement$clien.toString();
51
+ }
49
52
  };
50
53
  useResizeObserver(gridRef, handleVirtualGridResize);
51
54
  useEffect(function () {
52
- handleResize();
55
+ handleResize === null || handleResize === void 0 || handleResize();
53
56
  }, [handleResize]);
54
57
  var rowHeight = rowSize && rowSizeMap[rowSize] || defaultRowHeight;
55
- if (listRef && listRef.current) {
56
- listRef.current.resetAfterIndex(0);
57
- }
58
+ useEffect(function () {
59
+ if (listRef && listRef.current) {
60
+ listRef.current.resetAfterIndex(0);
61
+ }
62
+ }, [listRef]);
58
63
  var visibleRows = DatagridPagination && page || rows;
59
- var testRef = useRef();
64
+ var testRef = useRef(null);
60
65
 
61
66
  // Sync the scrollLeft position of the virtual body to the table header
62
67
  useEffect(function () {
63
68
  function handleScroll(event) {
69
+ var _document;
64
70
  var virtualBody = event.target;
65
- document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap")).scrollLeft = virtualBody.scrollLeft;
71
+ var headWrapEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap"));
72
+ if (headWrapEl) {
73
+ headWrapEl.scrollLeft = virtualBody === null || virtualBody === void 0 ? void 0 : virtualBody.scrollLeft;
74
+ }
66
75
  var spacerColumn = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head-wrap thead th:last-child"));
67
- spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
76
+ if (spacerColumn) {
77
+ spacerColumn.style.width = px(32 + (virtualBody.offsetWidth - virtualBody.clientWidth)); // scrollbar width to header column to fix header alignment
78
+ }
68
79
  }
69
- var testRefValue = testRef.current;
70
- testRefValue.addEventListener('scroll', handleScroll);
80
+ var testRefValue = testRef === null || testRef === void 0 ? void 0 : testRef.current;
81
+ testRefValue === null || testRefValue === void 0 || testRefValue.addEventListener('scroll', handleScroll);
71
82
  return function () {
72
- testRefValue.removeEventListener('scroll', handleScroll);
83
+ testRefValue === null || testRefValue === void 0 || testRefValue.removeEventListener('scroll', handleScroll);
73
84
  };
74
85
  });
75
86
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
76
87
  className: "".concat(blockClass, "__head-wrap"),
77
88
  style: {
78
- width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
89
+ width: gridRef === null || gridRef === void 0 || (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
79
90
  overflow: 'hidden'
80
91
  }
81
92
  }, /*#__PURE__*/React__default.createElement(DatagridHead, datagridState)), /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
@@ -86,7 +97,8 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
86
97
  height: virtualHeight || tableHeight,
87
98
  itemCount: visibleRows.length,
88
99
  itemSize: function itemSize(index) {
89
- return visibleRows[index].isExpanded ? (visibleRows[index].expandedContentHeight || 0) + rowHeight : rowHeight;
100
+ var _visibleRows$index;
101
+ return (_visibleRows$index = visibleRows[index]) !== null && _visibleRows$index !== void 0 && _visibleRows$index.isExpanded ? (visibleRows[index].expandedContentHeight || 0) + rowHeight : rowHeight;
90
102
  },
91
103
  estimatedItemSize: rowHeight,
92
104
  onScroll: onScroll,
@@ -98,9 +110,10 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
98
110
  ref: listRef,
99
111
  className: "".concat(blockClass, "__virtual-scrollbar"),
100
112
  style: {
101
- width: (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
113
+ width: gridRef === null || gridRef === void 0 || (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.clientWidth
102
114
  }
103
115
  }, function (_ref) {
116
+ var _row$RowRenderer;
104
117
  var index = _ref.index,
105
118
  style = _ref.style;
106
119
  var row = visibleRows[index];
@@ -109,12 +122,11 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
109
122
  key = _row$getRowProps.key;
110
123
  return /*#__PURE__*/React__default.createElement("div", {
111
124
  style: _objectSpread2({}, style)
112
- }, row.RowRenderer(_objectSpread2(_objectSpread2({}, datagridState), {}, {
125
+ }, row === null || row === void 0 || (_row$RowRenderer = row.RowRenderer) === null || _row$RowRenderer === void 0 ? void 0 : _row$RowRenderer.call(row, _objectSpread2(_objectSpread2({}, datagridState), {}, {
113
126
  row: row,
114
127
  key: key
115
128
  })));
116
129
  })));
117
130
  };
118
- var DatagridVirtualBody$1 = DatagridVirtualBody;
119
131
 
120
- export { DatagridVirtualBody$1 as default };
132
+ export { DatagridVirtualBody as default };
@@ -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;
@@ -44,7 +44,7 @@ var DraggableElement = function DraggableElement(_ref) {
44
44
  size: 16
45
45
  }))), children);
46
46
  var style = {
47
- transform: !disabled ? CSS.Transform.toString(transform) : {},
47
+ transform: !disabled ? CSS.Transform.toString(transform) : undefined,
48
48
  transition: transition
49
49
  };
50
50
  return /*#__PURE__*/React__default.createElement("li", _extends({
@@ -53,7 +53,6 @@ var DraggableElement = function DraggableElement(_ref) {
53
53
  ref: setNodeRef,
54
54
  style: style
55
55
  }, attributes, listeners, {
56
- disabled: disabled,
57
56
  "aria-selected": selected,
58
57
  role: "option"
59
58
  }), /*#__PURE__*/React__default.createElement("span", {
@@ -71,6 +70,5 @@ DraggableElement.propTypes = {
71
70
  isSticky: PropTypes.bool,
72
71
  selected: PropTypes.bool
73
72
  };
74
- var DraggableElement$1 = DraggableElement;
75
73
 
76
- export { DraggableElement$1 as default };
74
+ export { DraggableElement as default };
@@ -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>;
@@ -283,7 +283,7 @@ FilterPanel.propTypes = {
283
283
  searchLabelText: PropTypes.string,
284
284
  searchPlaceholder: PropTypes.string,
285
285
  secondaryActionLabel: PropTypes.string,
286
- setAllFilters: PropTypes.func.isRequired,
286
+ setAllFilters: PropTypes.func,
287
287
  showFilterSearch: PropTypes.bool,
288
288
  title: PropTypes.string,
289
289
  updateMethod: PropTypes.oneOf([BATCH, 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,210 @@
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
+ fetchMoreData?: () => void;
194
+ loadMoreThreshold?: number;
195
+ }
196
+ export interface ResizeHeaderProps {
197
+ resizerProps?: ResizerProps;
198
+ header: DataGridHeader;
199
+ originalCol?: DatagridColumn;
200
+ handleOnMouseDownResize?: (evt?: any, props?: ResizerProps) => void;
201
+ columnWidths?: any[];
202
+ datagridState: DataGridState;
203
+ incrementAmount: number;
204
+ minWidth?: number;
205
+ dispatch?: TableDispatch<any>;
206
+ onColResizeEnd?: () => void;
207
+ resizerAriaLabel?: string;
208
+ isFetching?: boolean;
209
+ }
210
+ 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>;
@@ -34,7 +34,7 @@ var useFocusRowExpander = function useFocusRowExpander(_ref) {
34
34
  });
35
35
  if (activeRow.length) {
36
36
  var rowExpander = activeRow[0].querySelector(".".concat(blockClass, "__row-expander"));
37
- rowExpander.focus();
37
+ rowExpander === null || rowExpander === void 0 || rowExpander.focus();
38
38
  }
39
39
  }, [instance === null || instance === void 0 ? void 0 : instance.tableId, instance === null || instance === void 0 ? void 0 : instance.expandedRows, lastExpandedRowIndex, blockClass, activeElement]);
40
40
  };
@@ -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 { Hooks } from 'react-table';
8
+ declare const useInfiniteScroll: (hooks: Hooks) => void;
1
9
  export default useInfiniteScroll;
2
- declare function useInfiniteScroll(hooks: any): void;
@@ -15,12 +15,13 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
15
15
  useResizeTable(hooks);
16
16
  var useInstance = function useInstance(instance) {
17
17
  var _tableElement;
18
- var isFetching = instance.isFetching,
19
- tableHeight = instance.tableHeight,
20
- innerListRef = instance.innerListRef,
21
- fetchMoreData = instance.fetchMoreData,
22
- tableId = instance.tableId,
23
- loadMoreThreshold = instance.loadMoreThreshold;
18
+ var _ref = instance,
19
+ isFetching = _ref.isFetching,
20
+ tableHeight = _ref.tableHeight,
21
+ innerListRef = _ref.innerListRef,
22
+ fetchMoreData = _ref.fetchMoreData,
23
+ tableId = _ref.tableId,
24
+ loadMoreThreshold = _ref.loadMoreThreshold;
24
25
  var tableElement;
25
26
  if (typeof document !== 'undefined') {
26
27
  tableElement = document.querySelector("#".concat(tableId));
@@ -33,9 +34,9 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
33
34
  leading: true,
34
35
  trailing: false
35
36
  }), [fetchMoreData]);
36
- var onScroll = function onScroll(_ref) {
37
- var scrollDirection = _ref.scrollDirection,
38
- scrollOffset = _ref.scrollOffset;
37
+ var onScroll = function onScroll(_ref2) {
38
+ var scrollDirection = _ref2.scrollDirection,
39
+ scrollOffset = _ref2.scrollOffset;
39
40
  if (innerListRef && innerListRef.current) {
40
41
  if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThresholdValue) {
41
42
  if (fetchMoreData) {
@@ -119,7 +119,11 @@ var SelectRow = function SelectRow(datagridState) {
119
119
  var cellProps = cell.getCellProps();
120
120
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
121
121
  var rowId = "".concat(tableId, "-").concat(row.id, "-").concat(row.index);
122
- return /*#__PURE__*/React__default.createElement(TableSelectRow, _extends({}, cellProps, selectProps, {
122
+ var key = cellProps.key,
123
+ _cellProps = cellProps._cellProps;
124
+ return /*#__PURE__*/React__default.createElement(TableSelectRow, _extends({
125
+ key: key
126
+ }, _cellProps, selectProps, {
123
127
  radio: radio,
124
128
  onSelect: onSelectHandler,
125
129
  id: rowId,
@@ -14,6 +14,7 @@ type ActionIcon = {
14
14
  iconDescription: string;
15
15
  href?: string;
16
16
  };
17
+ type PlacementType = 'top' | 'bottom';
17
18
  interface EditUpdateCardsProps {
18
19
  /**
19
20
  * Icons that are displayed on card. Refer to design documentation for implementation guidelines
@@ -22,7 +23,7 @@ interface EditUpdateCardsProps {
22
23
  /**
23
24
  * Determines if the action icons are on the top or bottom of the card
24
25
  */
25
- actionsPlacement?: 'top' | 'bottom';
26
+ actionsPlacement?: PlacementType;
26
27
  /**
27
28
  * Optional label for the top of the card.
28
29
  */
@@ -66,7 +67,7 @@ interface EditUpdateCardsProps {
66
67
  /**
67
68
  * Determines if the primary button is on the top or bottom of the card
68
69
  */
69
- primaryButtonPlacement?: 'top' | 'bottom';
70
+ primaryButtonPlacement?: PlacementType;
70
71
  /**
71
72
  * The text that's displayed in the primary button
72
73
  */
@@ -86,7 +87,7 @@ interface EditUpdateCardsProps {
86
87
  /**
87
88
  * Determines if the secondary button is on the top or bottom of the card
88
89
  */
89
- secondaryButtonPlacement?: 'top' | 'bottom';
90
+ secondaryButtonPlacement?: PlacementType;
90
91
  /**
91
92
  * The text that's displayed in the secondary button
92
93
  */
@@ -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;
@@ -32,8 +32,7 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
32
32
  clearFiltersText = _ref$clearFiltersText === void 0 ? 'Clear filters' : _ref$clearFiltersText,
33
33
  clearFilters = _ref.clearFilters,
34
34
  filters = _ref.filters,
35
- _ref$renderLabel = _ref.renderLabel,
36
- renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
35
+ renderLabel = _ref.renderLabel,
37
36
  _ref$overflowType = _ref.overflowType,
38
37
  overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
39
38
  _ref$clearButtonInlin = _ref.clearButtonInline,
@@ -50,9 +49,9 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
50
49
  label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
51
50
  });
52
51
  });
53
- var filterSummaryClearButton = useRef();
54
- var viewAllButtonRef = useRef();
55
- var filterSummaryRef = useRef();
52
+ var filterSummaryClearButton = useRef(null);
53
+ var viewAllButtonRef = useRef(null);
54
+ var filterSummaryRef = useRef(null);
56
55
  var localRef = filterSummaryRef || ref;
57
56
  var _useState = useState(0),
58
57
  _useState2 = _slicedToArray(_useState, 2),
@@ -64,7 +63,7 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
64
63
  setMultiline = _useState4[1];
65
64
  var previousState = usePreviousValue({
66
65
  multiline: multiline
67
- });
66
+ }) || {};
68
67
  var handleViewAll = function handleViewAll() {
69
68
  if (overflowCount === 0) {
70
69
  setMultiline(false);
@@ -75,7 +74,7 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
75
74
  });
76
75
  };
77
76
  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;
78
- var measurementOffset = (filterSummaryClearButton === null || filterSummaryClearButton === void 0 || (_filterSummaryClearBu = filterSummaryClearButton.current) === null || _filterSummaryClearBu === void 0 ? void 0 : _filterSummaryClearBu.offsetWidth) + viewAllWidth;
77
+ var measurementOffset = ((filterSummaryClearButton === null || filterSummaryClearButton === void 0 || (_filterSummaryClearBu = filterSummaryClearButton.current) === null || _filterSummaryClearBu === void 0 ? void 0 : _filterSummaryClearBu.offsetWidth) || 0) + viewAllWidth;
79
78
  var renderTagSet = function renderTagSet(type) {
80
79
  return /*#__PURE__*/React__default.createElement(motion.div, {
81
80
  key: type,
@@ -106,15 +105,15 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
106
105
  containingElementRef: localRef,
107
106
  measurementOffset: measurementOffset,
108
107
  onOverflowTagChange: function onOverflowTagChange(overflowTags) {
109
- return setOverflowCount(overflowTags.length);
108
+ return setOverflowCount(overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length);
110
109
  },
111
110
  multiline: multiline
112
111
  }));
113
112
  };
114
113
  useWindowResize(function () {
115
114
  var handleFilterSummaryResize = function handleFilterSummaryResize() {
116
- var _localRef$current;
117
- if (multiline && (localRef === null || localRef === void 0 || (_localRef$current = localRef.current) === null || _localRef$current === void 0 ? void 0 : _localRef$current.offsetHeight) <= 50) {
115
+ var _localRef$current, _localRef$current2;
116
+ 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) {
118
117
  setMultiline(false);
119
118
  }
120
119
  };
@@ -127,7 +126,6 @@ var FilterSummary = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
127
126
  ref: localRef,
128
127
  className: cx([blockClass, className], _defineProperty({}, "".concat(blockClass, "__expanded"), multiline))
129
128
  }), /*#__PURE__*/React__default.createElement(AnimatePresence, {
130
- mode: "wait",
131
129
  exitBeforeEnter: true
132
130
  }, !multiline && renderTagSet('single'), multiline && renderTagSet('multiline')), /*#__PURE__*/React__default.createElement(Button, {
133
131
  kind: "ghost",
@@ -156,6 +154,7 @@ FilterSummary.propTypes = {
156
154
  clearButtonInline: PropTypes.bool,
157
155
  clearFilters: PropTypes.func.isRequired,
158
156
  clearFiltersText: PropTypes.string,
157
+ /**@ts-ignore */
159
158
  filters: PropTypes.arrayOf(PropTypes.object).isRequired,
160
159
  overflowType: PropTypes.oneOf(['default', 'tag']),
161
160
  renderLabel: PropTypes.func