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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) 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/FilterSummary/FilterSummary.d.ts +21 -2
  52. package/es/components/FilterSummary/FilterSummary.js +10 -11
  53. package/es/components/Guidebanner/Guidebanner.js +7 -2
  54. package/es/components/WebTerminal/WebTerminal.js +1 -1
  55. package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
  56. package/es/global/js/hooks/usePreviousValue.js +3 -2
  57. package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  58. package/es/global/js/hooks/useRetrieveStepData.js +5 -5
  59. package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  60. package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  61. package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
  62. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  63. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  64. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  65. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  66. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  67. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
  68. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  69. package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
  70. package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  72. package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  73. package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
  74. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  75. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  76. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  77. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
  78. package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  79. package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  80. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  81. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
  82. package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  83. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  84. package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  85. package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  86. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  87. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  88. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  89. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  90. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  91. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  92. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  93. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  94. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  95. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  96. package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  97. package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  98. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  99. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  100. package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  101. package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
  102. package/lib/components/Datagrid/types/index.d.ts +210 -0
  103. package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
  104. package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
  105. package/lib/components/Datagrid/useFocusRowExpander.js +1 -1
  106. package/lib/components/Datagrid/useInfiniteScroll.d.ts +8 -1
  107. package/lib/components/Datagrid/useInfiniteScroll.js +10 -9
  108. package/lib/components/Datagrid/useSelectRows.js +5 -1
  109. package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
  110. package/lib/components/FilterSummary/FilterSummary.js +10 -11
  111. package/lib/components/Guidebanner/Guidebanner.js +7 -2
  112. package/lib/components/WebTerminal/WebTerminal.js +1 -1
  113. package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
  114. package/lib/global/js/hooks/usePreviousValue.js +3 -2
  115. package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  116. package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
  117. package/package.json +5 -4
  118. package/telemetry.yml +67 -6
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
- export declare const StepsContext: React.Context<null>;
8
+ import { StepsContextType } from '../CreateTearsheet/CreateTearsheet';
9
+ export declare const StepsContext: React.Context<StepsContextType | null>;
9
10
  export declare const StepNumberContext: React.Context<number>;
10
11
  interface HeaderBreadcrumbs {
11
12
  /** breadcrumb item key */
@@ -1,2 +1,71 @@
1
- export let CreateFullPageStep: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from 'react';
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 React, { PropsWithChildren, ReactNode } from 'react';
8
+ interface CreateFullPageStepBaseProps extends PropsWithChildren {
9
+ /**
10
+ * Sets an optional className to be added to the CreateFullPage step
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Sets an optional description on the progress step component
15
+ */
16
+ description?: ReactNode;
17
+ /**
18
+ * This will conditionally disable the submit button in the multi step CreateFullPage
19
+ */
20
+ disableSubmit?: boolean;
21
+ /**
22
+ * This optional prop will render your form content inside of a fieldset html element
23
+ */
24
+ hasFieldset: boolean;
25
+ /**
26
+ * This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
27
+ * steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
28
+ */
29
+ includeStep?: boolean;
30
+ /**
31
+ * This prop can be used on the first step to mark it as an intro step, which will not render the progress indicator steps
32
+ */
33
+ introStep?: boolean;
34
+ /**
35
+ * This optional prop will indicate an error icon on the progress indicator step item
36
+ */
37
+ invalid?: boolean;
38
+ /**
39
+ * Optional function to be called on initial mount of a step.
40
+ * For example, this can be used to fetch data that is required on a particular step.
41
+ */
42
+ onMount?: () => void;
43
+ /**
44
+ * Optional function to be called on a step change.
45
+ * For example, this can be used to validate input fields before proceeding to the next step.
46
+ * This function can _optionally_ return a promise that is either resolved or rejected and the CreateFullPage will handle the submitting state of the next button.
47
+ */
48
+ onNext?: () => void | Promise<any>;
49
+ /**
50
+ * Sets the optional secondary label on the progress step component
51
+ */
52
+ secondaryLabel?: string;
53
+ /**
54
+ * Sets an optional subtitle on the progress step component
55
+ */
56
+ subtitle?: string;
57
+ /**
58
+ * Sets the title text for a create full page step
59
+ */
60
+ title: ReactNode;
61
+ }
62
+ type CreateFullPageStepFieldsetProps = {
63
+ hasFieldset: false;
64
+ fieldsetLegendText?: string;
65
+ } | {
66
+ hasFieldset?: true;
67
+ fieldsetLegendText: string;
68
+ };
69
+ type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
70
+ export declare let CreateFullPageStep: React.ForwardRefExoticComponent<CreateFullPageStepProps & React.RefAttributes<HTMLDivElement>>;
71
+ export {};
@@ -134,10 +134,12 @@ CreateFullPageStep.propTypes = {
134
134
  /**
135
135
  * This will conditionally disable the submit button in the multi step CreateFullPage
136
136
  */
137
+ /**@ts-ignore */
137
138
  disableSubmit: PropTypes.bool,
138
139
  /**
139
140
  * This is the legend text that appears above a fieldset html element for accessibility purposes. It is required when the optional `hasFieldset` prop is provided to a FullPageStep.
140
141
  */
142
+ /**@ts-ignore */
141
143
  fieldsetLegendText: PropTypes.string.isRequired.if(function (_ref2) {
142
144
  var hasFieldset = _ref2.hasFieldset;
143
145
  return hasFieldset === true;
@@ -145,6 +147,7 @@ CreateFullPageStep.propTypes = {
145
147
  /**
146
148
  * This optional prop will render your form content inside of a fieldset html element
147
149
  */
150
+ /**@ts-ignore */
148
151
  hasFieldset: PropTypes.bool,
149
152
  /**
150
153
  * This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import { Column, Size, Theme } from './types';
8
+ import { Column } from 'react-table';
9
+ import { Size, Theme } from './types';
9
10
  interface DataSpreadsheetProps {
10
11
  /**
11
12
  * Specifies the cell height
@@ -18,7 +19,7 @@ interface DataSpreadsheetProps {
18
19
  /**
19
20
  * The data that will build the column headers
20
21
  */
21
- columns?: readonly Column[];
22
+ columns?: readonly Column<object>[];
22
23
  /**
23
24
  * The spreadsheet data that will be rendered in the body of the spreadsheet component
24
25
  */
@@ -126,7 +126,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
126
126
  }) || {};
127
127
  var cellSizeValue = getCellSize(cellSize);
128
128
  var cellEditorRef = useRef();
129
- var _useState23 = useState(null),
129
+ var _useState23 = useState(),
130
130
  _useState24 = _slicedToArray(_useState23, 2),
131
131
  activeCellContent = _useState24[0],
132
132
  setActiveCellContent = _useState24[1];
@@ -149,19 +149,19 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
149
149
  var scrollBarSize = useMemo(function () {
150
150
  return getScrollbarWidth();
151
151
  }, []);
152
- var _useTable = useTable({
152
+ var _ref2 = useTable({
153
153
  columns: columns,
154
154
  data: data,
155
155
  defaultColumn: defaultColumn
156
156
  }, useBlockLayout, useColumnOrder),
157
- getTableProps = _useTable.getTableProps,
158
- getTableBodyProps = _useTable.getTableBodyProps,
159
- headerGroups = _useTable.headerGroups,
160
- rows = _useTable.rows,
161
- totalColumnsWidth = _useTable.totalColumnsWidth,
162
- prepareRow = _useTable.prepareRow,
163
- setColumnOrder = _useTable.setColumnOrder,
164
- visibleColumns = _useTable.visibleColumns;
157
+ getTableProps = _ref2.getTableProps,
158
+ getTableBodyProps = _ref2.getTableBodyProps,
159
+ headerGroups = _ref2.headerGroups,
160
+ rows = _ref2.rows,
161
+ totalColumnsWidth = _ref2.totalColumnsWidth,
162
+ prepareRow = _ref2.prepareRow,
163
+ setColumnOrder = _ref2.setColumnOrder,
164
+ visibleColumns = _ref2.visibleColumns;
165
165
 
166
166
  // Update the spreadsheet data after editing a cell
167
167
  var updateData = useCallback(function (rowIndex, columnId, newValue) {
@@ -196,7 +196,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
196
196
  useEffect(function () {
197
197
  var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
198
198
  if (((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) && isEditing) {
199
- var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
199
+ var cellProps = rows[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row)].cells[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column)];
200
200
  removeCellEditor();
201
201
  updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id, undefined);
202
202
  if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
@@ -217,11 +217,11 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
217
217
  }
218
218
  }
219
219
  }, [activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, updateData, rows, isEditing, removeCellEditor, activeCellContent]);
220
- var createActiveCell = useCallback(function (_ref2) {
221
- var placementElement = _ref2.placementElement,
222
- coords = _ref2.coords,
223
- _ref2$addToHeader = _ref2.addToHeader,
224
- addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
220
+ var createActiveCell = useCallback(function (_ref3) {
221
+ var placementElement = _ref3.placementElement,
222
+ coords = _ref3.coords,
223
+ _ref3$addToHeader = _ref3.addToHeader,
224
+ addToHeader = _ref3$addToHeader === void 0 ? false : _ref3$addToHeader;
225
225
  var activeCellFullData = typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? rows[coords === null || coords === void 0 ? void 0 : coords.row].cells[coords === null || coords === void 0 ? void 0 : coords.column] : null;
226
226
  var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
227
227
  createActiveCellFn({
@@ -270,12 +270,12 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
270
270
  }
271
271
  return;
272
272
  }, [activeCellCoordinates]);
273
- var updateActiveCellCoordinates = useCallback(function (_ref3) {
274
- var _ref3$coords = _ref3.coords,
275
- coords = _ref3$coords === void 0 ? _objectSpread2({}, activeCellCoordinates) : _ref3$coords,
276
- updatedValue = _ref3.updatedValue,
277
- _ref3$optOutOfSelecti = _ref3.optOutOfSelectionAreaUpdate,
278
- optOutOfSelectionAreaUpdate = _ref3$optOutOfSelecti === void 0 ? false : _ref3$optOutOfSelecti;
273
+ var updateActiveCellCoordinates = useCallback(function (_ref4) {
274
+ var _ref4$coords = _ref4.coords,
275
+ coords = _ref4$coords === void 0 ? _objectSpread2({}, activeCellCoordinates) : _ref4$coords,
276
+ updatedValue = _ref4.updatedValue,
277
+ _ref4$optOutOfSelecti = _ref4.optOutOfSelectionAreaUpdate,
278
+ optOutOfSelectionAreaUpdate = _ref4$optOutOfSelecti === void 0 ? false : _ref4$optOutOfSelecti;
279
279
  var newActiveCell = _objectSpread2(_objectSpread2({}, coords), updatedValue);
280
280
  setActiveCellCoordinates(newActiveCell);
281
281
  // Only run if the active cell is _not_ a header cell. This will add a point1 object
@@ -291,8 +291,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
291
291
  setCurrentMatcher(tempMatcher);
292
292
  }
293
293
  }, [activeCellCoordinates]);
294
- var handleHomeEndKey = useCallback(function (_ref4) {
295
- var type = _ref4.type;
294
+ var handleHomeEndKey = useCallback(function (_ref5) {
295
+ var type = _ref5.type;
296
296
  var coordinatesClone = _objectSpread2({}, activeCellCoordinates);
297
297
  updateActiveCellCoordinates({
298
298
  coords: coordinatesClone,
@@ -490,10 +490,10 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
490
490
  }
491
491
  }
492
492
  };
493
- var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref5) {
494
- var isKeyboard = _ref5.isKeyboard,
495
- _ref5$index = _ref5.index,
496
- index = _ref5$index === void 0 ? -1 : _ref5$index;
493
+ var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref6) {
494
+ var isKeyboard = _ref6.isKeyboard,
495
+ _ref6$index = _ref6.index,
496
+ index = _ref6$index === void 0 ? -1 : _ref6$index;
497
497
  var handleHeaderCellProps = {
498
498
  activeCellCoordinates: activeCellCoordinates,
499
499
  rows: rows,
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, SetStateAction, MutableRefObject } from 'react';
8
- import { ActiveCellCoordinates, Column } from './types';
8
+ import { ActiveCellCoordinates, SpreadsheetColumn } from './types';
9
+ import { Column, IdType, TableBodyPropGetter, TableBodyProps } from 'react-table';
9
10
  interface DataSpreadsheetBodyProps {
10
11
  /**
11
12
  * Object containing the active cell coordinates
@@ -22,7 +23,7 @@ interface DataSpreadsheetBodyProps {
22
23
  /**
23
24
  * All of the spreadsheet columns
24
25
  */
25
- columns?: readonly Column[];
26
+ columns?: readonly Column<object>[];
26
27
  /**
27
28
  * This represents the id of the current cell selection area
28
29
  */
@@ -30,7 +31,7 @@ interface DataSpreadsheetBodyProps {
30
31
  /**
31
32
  * Default spreadsheet sizing values
32
33
  */
33
- defaultColumn?: Column;
34
+ defaultColumn?: SpreadsheetColumn;
34
35
  /**
35
36
  * Sets the number of empty rows to be created when there is no data provided
36
37
  */
@@ -38,9 +39,7 @@ interface DataSpreadsheetBodyProps {
38
39
  /**
39
40
  * Function to set table body prop values
40
41
  */
41
- getTableBodyProps?: () => {
42
- data: any;
43
- };
42
+ getTableBodyProps: (propGetter?: TableBodyPropGetter<any>) => TableBodyProps;
44
43
  /**
45
44
  * Headers provided from useTable hook
46
45
  */
@@ -100,7 +99,7 @@ interface DataSpreadsheetBodyProps {
100
99
  /**
101
100
  * Setter fn for column ordering, provided from react-table
102
101
  */
103
- setColumnOrder?: () => void;
102
+ setColumnOrder?: (updater: ((columnOrder: Array<IdType<any>>) => Array<IdType<any>>) | Array<IdType<any>>) => void;
104
103
  /**
105
104
  * Setter fn for containerHasFocus state value
106
105
  */
@@ -133,7 +132,7 @@ interface DataSpreadsheetBodyProps {
133
132
  /**
134
133
  * Prop from react-table used to reorder columns
135
134
  */
136
- visibleColumns?: [];
135
+ visibleColumns?: Column<object>[];
137
136
  }
138
137
  export declare const DataSpreadsheetBody: React.ForwardRefExoticComponent<DataSpreadsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
139
138
  export {};
@@ -423,6 +423,7 @@ DataSpreadsheetBody.propTypes = {
423
423
  /**
424
424
  * Function to set table body prop values
425
425
  */
426
+ /**@ts-ignore */
426
427
  getTableBodyProps: PropTypes.func,
427
428
  /**
428
429
  * Headers provided from useTable hook
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, SetStateAction } from 'react';
8
- import { ActiveCellCoordinates, Column, ItemType, Size } from './types';
8
+ import { ActiveCellCoordinates, ItemType, Size, SpreadsheetColumn } from './types';
9
+ import { Column } from 'react-table';
9
10
  interface DataSpreadsheetHeaderProps {
10
11
  /**
11
12
  * Object containing the active cell coordinates
@@ -26,7 +27,7 @@ interface DataSpreadsheetHeaderProps {
26
27
  /**
27
28
  * Default spreadsheet sizing values
28
29
  */
29
- defaultColumn?: Column;
30
+ defaultColumn?: SpreadsheetColumn;
30
31
  /**
31
32
  * Whether or not a click/hold is active on a header cell
32
33
  */
@@ -83,7 +84,7 @@ interface DataSpreadsheetHeaderProps {
83
84
  /**
84
85
  * Array of visible columns provided by react-table useTable hook
85
86
  */
86
- visibleColumns?: [];
87
+ visibleColumns?: Column<object>[];
87
88
  }
88
89
  export declare const DataSpreadsheetHeader: React.ForwardRefExoticComponent<DataSpreadsheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
89
90
  export {};
@@ -1,9 +1,6 @@
1
1
  export type Size = 'xs' | 'sm' | 'md' | 'lg';
2
2
  export type Theme = 'light' | 'dark';
3
- export interface Column {
4
- Header?: string;
5
- accessor?: string | (() => void);
6
- Cell?: () => void;
3
+ export interface SpreadsheetColumn {
7
4
  rowHeight?: number;
8
5
  rowHeaderWidth?: number;
9
6
  width?: number;
@@ -1,5 +1,27 @@
1
1
  /**
2
- * 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.
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.
3
6
  */
4
- export let Datagrid: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
7
  import React from 'react';
8
+ import { DataGridState } from '../types';
9
+ export interface DatagridProps {
10
+ /**
11
+ * Specify a label to be read by screen readers on the container node
12
+ * 'aria-label' of the TableToolbar component.
13
+ */
14
+ ariaToolbarLabel?: string;
15
+ /**
16
+ * The data grid state, much of it being supplied by the useDatagrid hook
17
+ */
18
+ datagridState: DataGridState;
19
+ /**
20
+ * Table title
21
+ */
22
+ title?: string;
23
+ }
24
+ /**
25
+ * 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.
26
+ */
27
+ export declare let Datagrid: React.ForwardRefExoticComponent<DatagridProps & React.RefAttributes<HTMLDivElement>>;
@@ -19,7 +19,6 @@ import { InlineEditProvider } from './addons/InlineEdit/InlineEditContext/Inline
19
19
  var _excluded = ["datagridState", "title", "ariaToolbarLabel"];
20
20
  var blockClass = "".concat(pkg.prefix, "--datagrid");
21
21
  var componentName = 'Datagrid';
22
-
23
22
  /**
24
23
  * 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.
25
24
  */
@@ -30,7 +29,7 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
30
29
  rest = _objectWithoutProperties(_ref, _excluded);
31
30
  if (!datagridState) {
32
31
  pconsole.warn('Datagrid was not passed datagridState which is required to render this component.');
33
- return null;
32
+ return;
34
33
  }
35
34
  var withVirtualScroll = datagridState.withVirtualScroll,
36
35
  DatagridPagination = datagridState.DatagridPagination,
@@ -38,7 +37,7 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
38
37
  tableId = datagridState.tableId,
39
38
  filterProps = datagridState.filterProps,
40
39
  className = datagridState.className,
41
- filters = datagridState.state.filters;
40
+ state = datagridState.state;
42
41
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
43
42
  var props = {
44
43
  title: title,
@@ -46,7 +45,7 @@ var Datagrid = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
46
45
  ariaToolbarLabel: ariaToolbarLabel
47
46
  };
48
47
  return /*#__PURE__*/React__default.createElement(FilterProvider, {
49
- filters: filters,
48
+ filters: state === null || state === void 0 ? void 0 : state.filters,
50
49
  filterProps: filterProps
51
50
  }, /*#__PURE__*/React__default.createElement(InlineEditProvider, null, /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
52
51
  id: tableId,
@@ -72,6 +71,7 @@ Datagrid.propTypes = {
72
71
  /**
73
72
  * The data grid state, much of it being supplied by the useDatagrid hook
74
73
  */
74
+ /**@ts-ignore */
75
75
  datagridState: PropTypes.object.isRequired,
76
76
  /**
77
77
  * Table title
@@ -1,2 +1,3 @@
1
+ import { DataGridState } from '../types';
2
+ declare const DatagridBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
3
  export default DatagridBody;
2
- declare function DatagridBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
@@ -28,6 +28,5 @@ var DatagridBody = function DatagridBody(datagridState) {
28
28
  }
29
29
  return /*#__PURE__*/React__default.createElement(DatagridSimpleBody, datagridState);
30
30
  };
31
- var DatagridBody$1 = DatagridBody;
32
31
 
33
- export { DatagridBody$1 as default };
32
+ export { DatagridBody as default };
@@ -1,12 +1,15 @@
1
- export function DatagridContent({ datagridState, title, ariaToolbarLabel }: {
2
- datagridState: any;
3
- title: any;
4
- ariaToolbarLabel: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export namespace DatagridContent {
7
- namespace propTypes {
8
- let ariaToolbarLabel: PropTypes.Requireable<string>;
9
- let datagridState: PropTypes.Requireable<PropTypes.InferProps<{
1
+ import PropTypes from 'prop-types';
2
+ import { DataGridState } from '../types';
3
+ interface DatagridContentProps {
4
+ ariaToolbarLabel?: string;
5
+ datagridState: DataGridState;
6
+ title?: string;
7
+ }
8
+ export declare const DatagridContent: {
9
+ ({ datagridState, ariaToolbarLabel, title, }: DatagridContentProps): import("react/jsx-runtime").JSX.Element;
10
+ propTypes: {
11
+ ariaToolbarLabel: PropTypes.Requireable<string>;
12
+ datagridState: PropTypes.Requireable<PropTypes.InferProps<{
10
13
  getTableProps: PropTypes.Requireable<(...args: any[]) => any>;
11
14
  getFilterFlyoutProps: PropTypes.Requireable<(...args: any[]) => any>;
12
15
  withVirtualScroll: PropTypes.Requireable<boolean>;
@@ -32,7 +35,7 @@ export namespace DatagridContent {
32
35
  getFilterProps: PropTypes.Requireable<(...args: any[]) => any>;
33
36
  state: PropTypes.Requireable<object>;
34
37
  }>>;
35
- let title: PropTypes.Requireable<string>;
36
- }
37
- }
38
- import PropTypes from 'prop-types';
38
+ title: PropTypes.Requireable<string>;
39
+ };
40
+ };
41
+ export {};
@@ -31,8 +31,8 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
31
31
  var gcClass = "".concat(blockClass, "__grid-container");
32
32
  var DatagridContent = function DatagridContent(_ref) {
33
33
  var datagridState = _ref.datagridState,
34
- title = _ref.title,
35
- ariaToolbarLabel = _ref.ariaToolbarLabel;
34
+ ariaToolbarLabel = _ref.ariaToolbarLabel,
35
+ title = _ref.title;
36
36
  var _useContext = useContext(InlineEditContext),
37
37
  inlineEditState = _useContext.state,
38
38
  dispatch = _useContext.dispatch;
@@ -69,8 +69,8 @@ var DatagridContent = function DatagridContent(_ref) {
69
69
  rows = datagridState.rows;
70
70
  var columnResizing = state.columnResizing;
71
71
  var contentRows = DatagridPagination && page || rows;
72
- var gridAreaRef = useRef();
73
- var multiKeyTrackingRef = useRef();
72
+ var gridAreaRef = useRef(null);
73
+ var multiKeyTrackingRef = useRef(null);
74
74
  var enableEditableCell = useFeatureFlag('enable-datagrid-useEditableCell');
75
75
  var enableInlineEdit = useFeatureFlag('enable-datagrid-useInlineEdit');
76
76
  var enableCustomizeCols = useFeatureFlag('enable-datagrid-useCustomizeColumns');
@@ -105,13 +105,11 @@ var DatagridContent = function DatagridContent(_ref) {
105
105
  });
106
106
  });
107
107
  var renderTable = function renderTable() {
108
- var _getTableProps;
109
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Table, _extends({}, getTableProps(), {
110
- className: cx(withVirtualScroll ? "".concat(blockClass, "__table-virtual-scroll") : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.isResizingColumn) === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
108
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Table, _extends({}, getTableProps === null || getTableProps === void 0 ? void 0 : getTableProps(), {
109
+ className: cx(withVirtualScroll ? "".concat(blockClass, "__table-virtual-scroll") : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.isResizingColumn) === 'string'), getTableProps === null || getTableProps === void 0 ? void 0 : getTableProps().className),
111
110
  role: withInlineEdit ? 'grid' : undefined,
112
111
  tabIndex: withInlineEdit ? 0 : -1,
113
- onKeyDown: /* istanbul ignore next */
114
- withInlineEdit && function (event) {
112
+ onKeyDown: withInlineEdit && function (event) {
115
113
  return handleGridKeyPress({
116
114
  event: event,
117
115
  dispatch: dispatch,
@@ -140,14 +138,15 @@ var DatagridContent = function DatagridContent(_ref) {
140
138
 
141
139
  // Provides a width for the region outline for useInlineEdit
142
140
  useEffect(function () {
141
+ var _gridElement$style;
143
142
  if (!withInlineEdit) {
144
143
  return;
145
144
  }
146
145
  var gridElement = document.querySelector("#".concat(tableId));
147
146
  var tableHeader = gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector(".".concat(carbon.prefix, "--data-table-header"));
148
- gridElement.style.setProperty("--".concat(blockClass, "--grid-width"), px(totalColumnsWidth + 32));
147
+ gridElement === null || gridElement === void 0 || (_gridElement$style = gridElement.style) === null || _gridElement$style === void 0 || _gridElement$style.setProperty("--".concat(blockClass, "--grid-width"), px((totalColumnsWidth || 0) + 32));
149
148
  if (gridActive) {
150
- gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), px((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
149
+ gridElement === null || gridElement === void 0 || gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), px((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
151
150
  }
152
151
  }, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
153
152
  useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
@@ -160,7 +159,7 @@ var DatagridContent = function DatagridContent(_ref) {
160
159
  clearFilters: function clearFilters() {
161
160
  return EventEmitter.dispatch(CLEAR_FILTERS);
162
161
  },
163
- renderLabel: filterProps.renderLabel,
162
+ renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
164
163
  overflowType: "tag"
165
164
  });
166
165
  };
@@ -178,7 +177,7 @@ var DatagridContent = function DatagridContent(_ref) {
178
177
  })), /*#__PURE__*/React__default.createElement("div", {
179
178
  className: cx("".concat(blockClass, "__table-container"), _defineProperty({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
180
179
  ref: gridAreaRef
181
- }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React__default.createElement(FilterPanel, _extends({}, getFilterFlyoutProps(), {
180
+ }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React__default.createElement(FilterPanel, _extends({}, getFilterFlyoutProps === null || getFilterFlyoutProps === void 0 ? void 0 : getFilterFlyoutProps(), {
182
181
  title: filterProps.panelTitle,
183
182
  filterSections: filterProps.sections,
184
183
  autoHideFilters: filterProps.autoHideFilters,
@@ -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 DatagridEmptyBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
9
  export default DatagridEmptyBody;
2
- declare function DatagridEmptyBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
@@ -38,13 +38,12 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
38
38
  return /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
39
39
  role: undefined
40
40
  }), {
41
- "aria-live": null,
41
+ "aria-live": "off",
42
42
  className: "".concat(blockClass, "__empty-state-body")
43
43
  }), /*#__PURE__*/React__default.createElement(TableRow, null, /*#__PURE__*/React__default.createElement(TableCell, {
44
- colSpan: headers.length,
44
+ colSpan: headers === null || headers === void 0 ? void 0 : headers.length,
45
45
  className: "".concat(blockClass, "__empty-state-cell")
46
46
  }, validEmptyStates.includes(emptyStateType) ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, emptyStateType === 'error' && /*#__PURE__*/React__default.createElement(ErrorEmptyState, emptyStateProps), emptyStateType === 'noData' && /*#__PURE__*/React__default.createElement(NoDataEmptyState, emptyStateProps), emptyStateType === 'notFound' && /*#__PURE__*/React__default.createElement(NotFoundEmptyState, emptyStateProps)) : /*#__PURE__*/React__default.createElement(EmptyState, emptyStateProps))));
47
47
  };
48
- var DatagridEmptyBody$1 = DatagridEmptyBody;
49
48
 
50
- export { DatagridEmptyBody$1 as default };
49
+ export { DatagridEmptyBody as default };
@@ -1,2 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { JSXElementConstructor } from 'react';
8
+ import { DataGridState } from '../types';
9
+ declare const DatagridExpandedRow: (ExpandedRowContentComponent: JSXElementConstructor<any>) => (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
10
  export default DatagridExpandedRow;
2
- declare function DatagridExpandedRow(ExpandedRowContentComponent: any): (datagridState: any) => import("react/jsx-runtime").JSX.Element;
@@ -5,11 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { isValidElement } from 'react';
10
10
  import { pkg } from '../../../settings.js';
11
11
  import cx from 'classnames';
12
12
 
13
+ var _excluded = ["key"];
13
14
  var blockClass = "".concat(pkg.prefix, "--datagrid");
14
15
 
15
16
  // eslint-disable-next-line react/prop-types
@@ -18,8 +19,9 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
18
19
  var _row$original;
19
20
  var row = datagridState.row;
20
21
  var expandedContentHeight = row.expandedContentHeight;
21
- var toggleParentHoverClass = function toggleParentHoverClass(event, eventType) {
22
+ var toggleParentHoverClass = function toggleParentHoverClass(event) {
22
23
  var _event$target;
24
+ var eventType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
23
25
  /* istanbul ignore else */
24
26
  if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && _event$target.closest('tr').previousElementSibling) {
25
27
  var _event$target2;
@@ -31,6 +33,8 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
31
33
  }
32
34
  }
33
35
  };
36
+ var key = datagridState.key,
37
+ _state = _objectWithoutProperties(datagridState, _excluded);
34
38
  return /*#__PURE__*/React__default.createElement("tr", {
35
39
  className: cx("".concat(blockClass, "__expanded-row"), _defineProperty({}, "".concat(blockClass, "__slug--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug))),
36
40
  onMouseEnter: function onMouseEnter(event) {
@@ -46,9 +50,10 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
46
50
  style: {
47
51
  height: expandedContentHeight && expandedContentHeight
48
52
  }
49
- }, /*#__PURE__*/React__default.createElement(ExpandedRowContentComponent, datagridState))));
53
+ }, /*#__PURE__*/React__default.createElement(ExpandedRowContentComponent, _extends({
54
+ key: key
55
+ }, _state)))));
50
56
  };
51
57
  };
52
- var DatagridExpandedRow$1 = DatagridExpandedRow;
53
58
 
54
- export { DatagridExpandedRow$1 as default };
59
+ export { DatagridExpandedRow as default };