@carbon/ibm-products 1.8.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/css/index-full-carbon.css +270 -5656
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +6 -6
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +58 -3432
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -3
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +238 -3922
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +6 -6
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +238 -3923
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +6 -6
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelect.js +147 -53
  18. package/es/components/AddSelect/AddSelectBreadcrumbs.js +4 -4
  19. package/es/components/AddSelect/AddSelectColumn.js +195 -0
  20. package/es/components/AddSelect/AddSelectList.js +67 -8
  21. package/es/components/AddSelect/AddSelectSidebar.js +8 -15
  22. package/es/components/AddSelect/add-select-utils.js +64 -0
  23. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
  24. package/es/components/ButtonMenu/ButtonMenu.js +1 -1
  25. package/es/components/DataSpreadsheet/DataSpreadsheet.js +505 -167
  26. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +244 -17
  27. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +74 -8
  28. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +27 -0
  29. package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +28 -0
  30. package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +41 -0
  31. package/es/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +34 -0
  32. package/es/components/DataSpreadsheet/utils/createActiveCellFn.js +58 -0
  33. package/es/components/DataSpreadsheet/utils/createCellSelectionArea.js +49 -0
  34. package/es/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
  35. package/es/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
  36. package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +46 -0
  37. package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +82 -0
  38. package/es/components/DataSpreadsheet/utils/removeCellSelections.js +30 -0
  39. package/es/components/InlineEdit/InlineEdit.js +80 -39
  40. package/es/components/OptionsTile/OptionsTile.js +31 -21
  41. package/es/components/OptionsTile/index.js +1 -1
  42. package/es/components/PageHeader/PageHeader.js +26 -15
  43. package/es/components/PageHeader/PageHeaderTitle.js +2 -1
  44. package/es/components/PageHeader/PageHeaderUtils.js +24 -29
  45. package/es/components/TagSet/TagSet.js +12 -3
  46. package/es/components/UserProfileImage/UserProfileImage.js +2 -1
  47. package/es/global/js/utils/DisplayBox.js +31 -0
  48. package/es/global/js/utils/deepCloneObject.js +26 -0
  49. package/lib/components/AddSelect/AddSelect.js +150 -54
  50. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +2 -3
  51. package/lib/components/AddSelect/AddSelectColumn.js +219 -0
  52. package/lib/components/AddSelect/AddSelectList.js +65 -8
  53. package/lib/components/AddSelect/AddSelectSidebar.js +14 -15
  54. package/lib/components/AddSelect/add-select-utils.js +78 -0
  55. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
  56. package/lib/components/ButtonMenu/ButtonMenu.js +1 -1
  57. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +514 -170
  58. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +251 -18
  59. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +82 -9
  60. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +37 -0
  61. package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +39 -0
  62. package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +52 -0
  63. package/lib/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +45 -0
  64. package/lib/components/DataSpreadsheet/{createActiveCellFn.js → utils/createActiveCellFn.js} +22 -9
  65. package/lib/components/DataSpreadsheet/utils/createCellSelectionArea.js +60 -0
  66. package/lib/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
  67. package/lib/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
  68. package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +59 -0
  69. package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +92 -0
  70. package/lib/components/DataSpreadsheet/utils/removeCellSelections.js +41 -0
  71. package/lib/components/InlineEdit/InlineEdit.js +82 -40
  72. package/lib/components/OptionsTile/OptionsTile.js +30 -20
  73. package/lib/components/PageHeader/PageHeader.js +25 -15
  74. package/lib/components/PageHeader/PageHeaderTitle.js +2 -1
  75. package/lib/components/PageHeader/PageHeaderUtils.js +24 -29
  76. package/lib/components/TagSet/TagSet.js +13 -3
  77. package/lib/components/UserProfileImage/UserProfileImage.js +2 -1
  78. package/lib/global/js/utils/DisplayBox.js +46 -0
  79. package/lib/global/js/utils/deepCloneObject.js +37 -0
  80. package/package.json +17 -17
  81. package/scss/components/ActionBar/_storybook-styles.scss +8 -0
  82. package/scss/components/ActionSet/_storybook-styles.scss +1 -3
  83. package/scss/components/AddSelect/_add-select.scss +99 -14
  84. package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +7 -3
  85. package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +8 -0
  86. package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
  87. package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
  88. package/scss/components/CreateModal/_create-modal.scss +1 -0
  89. package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -1
  90. package/scss/components/CreateSidePanel/_storybook-styles.scss +1 -1
  91. package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
  92. package/scss/components/CreateTearsheetNarrow/_create-tearsheet-narrow.scss +1 -0
  93. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +42 -6
  94. package/scss/components/EditSidePanel/_edit-side-panel.scss +9 -0
  95. package/scss/components/EditSidePanel/_storybook-styles.scss +1 -1
  96. package/scss/components/InlineEdit/_inline-edit.scss +53 -43
  97. package/scss/components/InlineEdit/_storybook-styles.scss +2 -0
  98. package/scss/components/LoadingBar/_loading-bar.scss +13 -0
  99. package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -0
  100. package/scss/components/OptionsTile/_index.scss +1 -1
  101. package/scss/components/OptionsTile/_options-tile.scss +17 -17
  102. package/scss/components/OptionsTile/_storybook-styles.scss +4 -4
  103. package/scss/components/PageHeader/_page-header.scss +5 -2
  104. package/scss/components/SidePanel/_side-panel.scss +19 -12
  105. package/scss/components/StatusIcon/_status-icon.scss +1 -0
  106. package/scss/components/TagSet/_storybook-styles.scss +8 -0
  107. package/scss/components/Tearsheet/_tearsheet.scss +1 -2
  108. package/scss/components/UserProfileImage/_user-profile-image.scss +9 -0
  109. package/scss/components/WebTerminal/_web-terminal.scss +2 -0
  110. package/scss/global/styles/_display-box.scss +62 -0
  111. package/es/components/DataSpreadsheet/createActiveCellFn.js +0 -45
@@ -1,8 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _typeof from "@babel/runtime/helpers/typeof";
3
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
6
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["cellSize", "className", "columns", "data", "id", "onActiveCellChange"];
7
+ var _excluded = ["cellSize", "className", "columns", "data", "onDataUpdate", "id", "onActiveCellChange"];
6
8
 
7
9
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
10
 
@@ -15,19 +17,28 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
17
  * LICENSE file in the root directory of this source tree.
16
18
  */
17
19
  // Import portions of React that are needed.
18
- import React, { useMemo, useRef, useEffect, useState, useCallback } from 'react';
20
+ import React, { useMemo, useRef, useState, useCallback, useEffect } from 'react';
19
21
  import { useBlockLayout, useTable } from 'react-table'; // Other standard imports.
20
22
 
21
23
  import PropTypes from 'prop-types';
22
24
  import cx from 'classnames';
23
- import { getDevtoolsProps } from '../../global/js/utils/devtools';
25
+ import { TextArea } from 'carbon-components-react';
24
26
  import { pkg } from '../../settings';
25
- import { getScrollbarWidth } from '../../global/js/utils/getScrollbarWidth';
26
27
  import { DataSpreadsheetBody } from './DataSpreadsheetBody';
27
- import { getCellSize } from './getCellSize';
28
28
  import { DataSpreadsheetHeader } from './DataSpreadsheetHeader';
29
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
30
+ import { getScrollbarWidth } from '../../global/js/utils/getScrollbarWidth';
29
31
  import { useActiveElement } from '../../global/js/hooks';
30
- import { createActiveCellFn } from './createActiveCellFn'; // cspell:words rowcount colcount
32
+ import { deepCloneObject } from '../../global/js/utils/deepCloneObject';
33
+ import { usePreviousValue } from '../../global/js/hooks';
34
+ import uuidv4 from '../../global/js/utils/uuidv4';
35
+ import { useResetSpreadsheetFocus } from './hooks/useResetSpreadsheetFocus';
36
+ import { useSpreadsheetOutsideClick } from './hooks/useSpreadsheetOutsideClick';
37
+ import { useMoveActiveCell } from './hooks/useMoveActiveCell';
38
+ import { createActiveCellFn } from './utils/createActiveCellFn';
39
+ import { getCellSize } from './utils/getCellSize';
40
+ import { handleMultipleKeys } from './utils/handleMultipleKeys';
41
+ import { handleHeaderCellSelection } from './utils/handleHeaderCellSelection'; // cspell:words rowcount colcount
31
42
  // The block part of our conventional BEM class names (blockClass__E--M).
32
43
 
33
44
  var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
@@ -36,7 +47,8 @@ var componentName = 'DataSpreadsheet'; // Default values for props
36
47
  var defaults = {
37
48
  cellSize: 'standard',
38
49
  columns: Object.freeze([]),
39
- data: Object.freeze([])
50
+ data: Object.freeze([]),
51
+ onDataUpdate: Object.freeze(function () {})
40
52
  };
41
53
  /**
42
54
  * DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
@@ -50,10 +62,14 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
50
62
  columns = _ref$columns === void 0 ? defaults.columns : _ref$columns,
51
63
  _ref$data = _ref.data,
52
64
  data = _ref$data === void 0 ? defaults.data : _ref$data,
65
+ _ref$onDataUpdate = _ref.onDataUpdate,
66
+ onDataUpdate = _ref$onDataUpdate === void 0 ? defaults.onDataUpdate : _ref$onDataUpdate,
53
67
  id = _ref.id,
54
68
  onActiveCellChange = _ref.onActiveCellChange,
55
69
  rest = _objectWithoutProperties(_ref, _excluded);
56
70
 
71
+ var localRef = useRef();
72
+ var spreadsheetRef = ref || localRef;
57
73
  var focusedElement = useActiveElement();
58
74
 
59
75
  var _useState = useState(false),
@@ -66,7 +82,39 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
66
82
  activeCellCoordinates = _useState4[0],
67
83
  setActiveCellCoordinates = _useState4[1];
68
84
 
85
+ var _useState5 = useState([]),
86
+ _useState6 = _slicedToArray(_useState5, 2),
87
+ selectionAreas = _useState6[0],
88
+ setSelectionAreas = _useState6[1];
89
+
90
+ var _useState7 = useState(false),
91
+ _useState8 = _slicedToArray(_useState7, 2),
92
+ clickAndHoldActive = _useState8[0],
93
+ setClickAndHoldActive = _useState8[1];
94
+
95
+ var _useState9 = useState(''),
96
+ _useState10 = _slicedToArray(_useState9, 2),
97
+ currentMatcher = _useState10[0],
98
+ setCurrentMatcher = _useState10[1];
99
+
100
+ var _useState11 = useState(false),
101
+ _useState12 = _slicedToArray(_useState11, 2),
102
+ isEditing = _useState12[0],
103
+ setIsEditing = _useState12[1];
104
+
105
+ var _useState13 = useState(''),
106
+ _useState14 = _slicedToArray(_useState13, 2),
107
+ cellEditorValue = _useState14[0],
108
+ setCellEditorValue = _useState14[1];
109
+
110
+ var previousState = usePreviousValue({
111
+ activeCellCoordinates: activeCellCoordinates
112
+ });
69
113
  var cellSizeValue = getCellSize(cellSize);
114
+ var cellEditorRef = useRef();
115
+ var currentMatcherRef = useRef();
116
+ var activeKeys = useRef([]);
117
+ var activeCellRef = useRef();
70
118
  var defaultColumn = useMemo(function () {
71
119
  return {
72
120
  width: 150,
@@ -88,44 +136,63 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
88
136
  headerGroups = _useTable.headerGroups,
89
137
  rows = _useTable.rows,
90
138
  totalColumnsWidth = _useTable.totalColumnsWidth,
91
- prepareRow = _useTable.prepareRow; // Reset everything when spreadsheet loses focus
139
+ prepareRow = _useTable.prepareRow; // Update the spreadsheet data after editing a cell
92
140
 
93
141
 
94
- useEffect(function () {
95
- if (!focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
96
- setContainerHasFocus(false);
97
- removeActiveCell();
98
- }
142
+ var updateData = useCallback(function (rowIndex, columnId) {
143
+ onDataUpdate(function (prev) {
144
+ return prev.map(function (row, index) {
145
+ if (index === rowIndex) {
146
+ return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, _defineProperty({}, columnId, cellEditorValue));
147
+ }
99
148
 
100
- if (focusedElement.classList.contains(blockClass) || focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
101
- setContainerHasFocus(true);
102
- }
103
- }, [focusedElement, removeActiveCell]); // Removes the active cell element
149
+ return row;
150
+ });
151
+ });
152
+ }, [cellEditorValue, onDataUpdate]); // Removes the active cell element
104
153
 
105
154
  var removeActiveCell = useCallback(function () {
106
155
  var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
107
156
 
108
157
  if (activeCellHighlight) {
109
- activeCellHighlight.remove();
158
+ activeCellHighlight.style.display = 'none';
110
159
  }
111
- }, [spreadsheetRef]); // Click outside useEffect
112
-
113
- useEffect(function () {
114
- var handleOutsideClick = function handleOutsideClick(event) {
115
- if (!spreadsheetRef.current || spreadsheetRef.current.contains(event.target) || event.target.classList.contains("".concat(blockClass, "__active-cell--highlight"))) {
116
- return;
160
+ }, [spreadsheetRef]);
161
+ var removeCellEditor = useCallback(function () {
162
+ setCellEditorValue('');
163
+ setIsEditing(false);
164
+ cellEditorRef.current.style.display = 'none';
165
+ }, []); // Removes the cell selection elements
166
+
167
+ var removeCellSelections = useCallback(function (matcher) {
168
+ if (matcher && typeof matcher === 'string') {
169
+ var selectionToRemove = spreadsheetRef.current.querySelector("[data-matcher-id=\"".concat(matcher, "\"]"));
170
+
171
+ if (selectionToRemove) {
172
+ selectionToRemove.remove();
117
173
  }
174
+ } else {
175
+ var cellSelections = spreadsheetRef.current.querySelectorAll(".".concat(blockClass, "__selection-area--element"));
118
176
 
119
- removeActiveCell();
120
- setContainerHasFocus(false);
121
- setActiveCellCoordinates(null);
122
- };
177
+ _toConsumableArray(cellSelections).forEach(function (element) {
178
+ return element.remove();
179
+ });
180
+ }
181
+ }, [spreadsheetRef]); // Remove cell editor if the active cell coordinates change and save with new cell data, this will
182
+ // happen if you click on another cell while isEditing is true
123
183
 
124
- document.addEventListener('click', handleOutsideClick);
125
- return function () {
126
- document.removeEventListener('click', handleOutsideClick);
127
- };
128
- }, [spreadsheetRef, removeActiveCell]);
184
+ useEffect(function () {
185
+ var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
186
+
187
+ 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) {
188
+ var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
189
+ removeCellEditor();
190
+ updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id);
191
+ }
192
+ }, [activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, updateData, rows, isEditing, removeCellEditor]);
193
+ var handleActiveCellMouseEnter = useCallback(function () {
194
+ handleActiveCellMouseEnterCallback(selectionAreas, clickAndHoldActive);
195
+ }, [clickAndHoldActive, selectionAreas, handleActiveCellMouseEnterCallback]);
129
196
  var createActiveCell = useCallback(function (_ref2) {
130
197
  var placementElement = _ref2.placementElement,
131
198
  coords = _ref2.coords,
@@ -133,16 +200,45 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
133
200
  addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
134
201
  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;
135
202
  var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
136
- createActiveCellFn({
137
- placementElement: placementElement,
138
- coords: coords,
139
- addToHeader: addToHeader,
140
- contextRef: spreadsheetRef,
141
- blockClass: blockClass,
142
- onActiveCellChange: onActiveCellChange,
143
- activeCellValue: activeCellValue
144
- });
145
- }, [spreadsheetRef, rows, onActiveCellChange]);
203
+ var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates; // Only create an active cell if the activeCellCoordinates have changed
204
+
205
+ if ((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (coords === null || coords === void 0 ? void 0 : coords.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (coords === null || coords === void 0 ? void 0 : coords.column)) {
206
+ createActiveCellFn({
207
+ placementElement: placementElement,
208
+ coords: coords,
209
+ addToHeader: addToHeader,
210
+ contextRef: spreadsheetRef,
211
+ blockClass: blockClass,
212
+ onActiveCellChange: onActiveCellChange,
213
+ activeCellValue: activeCellValue,
214
+ activeCellRef: activeCellRef,
215
+ cellEditorRef: cellEditorRef,
216
+ defaultColumn: defaultColumn
217
+ });
218
+ }
219
+ }, [spreadsheetRef, rows, onActiveCellChange, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, defaultColumn]);
220
+ useResetSpreadsheetFocus({
221
+ activeKeys: activeKeys,
222
+ focusedElement: focusedElement,
223
+ removeActiveCell: removeActiveCell,
224
+ setContainerHasFocus: setContainerHasFocus
225
+ });
226
+ useSpreadsheetOutsideClick({
227
+ spreadsheetRef: spreadsheetRef,
228
+ setActiveCellCoordinates: setActiveCellCoordinates,
229
+ setSelectionAreas: setSelectionAreas,
230
+ removeActiveCell: removeActiveCell,
231
+ removeCellSelections: removeCellSelections,
232
+ setContainerHasFocus: setContainerHasFocus,
233
+ activeKeys: activeKeys,
234
+ removeCellEditor: removeCellEditor
235
+ });
236
+ useMoveActiveCell({
237
+ spreadsheetRef: spreadsheetRef,
238
+ activeCellCoordinates: activeCellCoordinates,
239
+ containerHasFocus: containerHasFocus,
240
+ createActiveCell: createActiveCell
241
+ });
146
242
  var handleInitialArrowPress = useCallback(function () {
147
243
  // If activeCellCoordinates is null then we need to set an initial value
148
244
  // which will place the activeCell on the select all cell/button
@@ -155,189 +251,390 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
155
251
 
156
252
  return;
157
253
  }, [activeCellCoordinates]);
158
-
159
- var updateActiveCellCoordinates = function updateActiveCellCoordinates(_ref3) {
254
+ var updateActiveCellCoordinates = useCallback(function (_ref3) {
160
255
  var coords = _ref3.coords,
161
256
  updatedValue = _ref3.updatedValue;
162
- setActiveCellCoordinates(_objectSpread(_objectSpread({}, coords), updatedValue));
163
- };
164
257
 
258
+ var newActiveCell = _objectSpread(_objectSpread({}, coords), updatedValue);
259
+
260
+ setActiveCellCoordinates(newActiveCell); // Only run if the active cell is _not_ a header cell. This will add a point1 object
261
+ // to selectionAreas every time the active cell changes, allowing us to create cell
262
+ // selections using keyboard
263
+
264
+ if (newActiveCell.row !== 'header' && newActiveCell.column !== 'header') {
265
+ var tempMatcher = uuidv4();
266
+ setSelectionAreas([{
267
+ point1: newActiveCell,
268
+ matcher: tempMatcher
269
+ }]);
270
+ setCurrentMatcher(tempMatcher);
271
+ }
272
+ }, []);
165
273
  var handleKeyPress = useCallback(function (event) {
166
- var keyCode = event.keyCode; // Command keys need to be returned as there is default browser behavior with these keys
274
+ var _activeKeys$current, _activeKeys$current2;
167
275
 
168
- if (keyCode === 91 || keyCode === 93) {
276
+ var key = event.key; // Command keys need to be returned as there is default browser behavior with these keys
277
+
278
+ if (key === 'Meta' || key === 'Control') {
169
279
  return;
170
280
  } // Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
171
281
 
172
282
 
173
- if ([35, 36, 37, 38, 39, 40].indexOf(keyCode) > -1) {
283
+ if (['End', 'Home', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1 && !isEditing) {
174
284
  event.preventDefault();
175
285
  }
176
286
 
177
- switch (keyCode) {
178
- // Tab
179
- case 9:
180
- {
181
- removeActiveCell();
182
- setContainerHasFocus(false);
183
- setActiveCellCoordinates(null);
184
- break;
185
- }
186
- // Left
287
+ if (['Tab'].indexOf(key) > -1 && isEditing) {
288
+ return;
289
+ } // Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
290
+
291
+
292
+ if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
293
+ if (isEditing) {
294
+ return;
295
+ }
296
+
297
+ if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && key !== 'Shift' && !activeKeys.current.includes('Shift')) {
298
+ setSelectionAreas([]);
299
+ removeCellSelections({
300
+ spreadsheetRef: spreadsheetRef
301
+ });
302
+ }
303
+ } // Update list of activeKeys
187
304
 
188
- case 37:
189
- {
190
- handleInitialArrowPress();
191
305
 
192
- var coordinatesClone = _objectSpread({}, activeCellCoordinates);
306
+ if (!((_activeKeys$current = activeKeys.current) !== null && _activeKeys$current !== void 0 && _activeKeys$current.includes(key))) {
307
+ var activeClone = _toConsumableArray(activeKeys.current);
193
308
 
194
- if (coordinatesClone.column === 'header') {
195
- return;
309
+ activeKeys.current = [].concat(_toConsumableArray(activeClone), [key]);
310
+ }
311
+
312
+ if (((_activeKeys$current2 = activeKeys.current) === null || _activeKeys$current2 === void 0 ? void 0 : _activeKeys$current2.length) > 1) {
313
+ handleMultipleKeys({
314
+ activeKeys: activeKeys,
315
+ selectionAreas: selectionAreas,
316
+ currentMatcher: currentMatcher,
317
+ rows: rows,
318
+ setSelectionAreas: setSelectionAreas,
319
+ columns: columns
320
+ });
321
+ } // Allow arrow key navigation if there are less than two activeKeys OR
322
+ // if one of the activeCellCoordinates is in a header position
323
+
324
+
325
+ if (!activeKeys.current.includes('Shift') || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
326
+ switch (key) {
327
+ // Tab
328
+ case 'Tab':
329
+ {
330
+ setSelectionAreas([]);
331
+ removeActiveCell();
332
+ removeCellEditor();
333
+ setContainerHasFocus(false);
334
+ setActiveCellCoordinates(null);
335
+ break;
196
336
  }
337
+ // Left
338
+
339
+ case 'ArrowLeft':
340
+ {
341
+ handleInitialArrowPress();
342
+
343
+ var coordinatesClone = _objectSpread({}, activeCellCoordinates);
344
+
345
+ if (coordinatesClone.column === 'header') {
346
+ return;
347
+ }
348
+
349
+ if (typeof coordinatesClone.column === 'number') {
350
+ if (coordinatesClone.column === 0) {
351
+ updateActiveCellCoordinates({
352
+ coords: coordinatesClone,
353
+ updatedValue: {
354
+ column: 'header'
355
+ }
356
+ });
357
+ return;
358
+ }
197
359
 
198
- if (typeof coordinatesClone.column === 'number') {
199
- if (coordinatesClone.column === 0) {
200
360
  updateActiveCellCoordinates({
201
361
  coords: coordinatesClone,
202
362
  updatedValue: {
203
- column: 'header'
363
+ column: coordinatesClone.column - 1
204
364
  }
205
365
  });
206
- return;
207
366
  }
208
367
 
209
- updateActiveCellCoordinates({
210
- coords: coordinatesClone,
211
- updatedValue: {
212
- column: coordinatesClone.column - 1
213
- }
214
- });
368
+ break;
215
369
  }
370
+ // Up
216
371
 
217
- break;
218
- }
219
- // Up
372
+ case 'ArrowUp':
373
+ {
374
+ handleInitialArrowPress();
220
375
 
221
- case 38:
222
- {
223
- handleInitialArrowPress();
376
+ var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
224
377
 
225
- var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
378
+ if (_coordinatesClone.row === 'header') {
379
+ return;
380
+ }
381
+
382
+ if (typeof _coordinatesClone.row === 'number') {
383
+ // set row back to header if we are at index 0
384
+ if (_coordinatesClone.row === 0) {
385
+ updateActiveCellCoordinates({
386
+ coords: _coordinatesClone,
387
+ updatedValue: {
388
+ row: 'header'
389
+ }
390
+ });
391
+ return;
392
+ } // if we are at any other index than 0, subtract 1 from current row index
226
393
 
227
- if (_coordinatesClone.row === 'header') {
228
- return;
229
- }
230
394
 
231
- if (typeof _coordinatesClone.row === 'number') {
232
- // set row back to header if we are at index 0
233
- if (_coordinatesClone.row === 0) {
234
395
  updateActiveCellCoordinates({
235
396
  coords: _coordinatesClone,
236
397
  updatedValue: {
237
- row: 'header'
398
+ row: _coordinatesClone.row - 1
238
399
  }
239
400
  });
240
- return;
241
- } // if we are at any other index than 0, subtract 1 from current row index
242
-
401
+ }
243
402
 
244
- updateActiveCellCoordinates({
245
- coords: _coordinatesClone,
246
- updatedValue: {
247
- row: _coordinatesClone.row - 1
248
- }
249
- });
403
+ break;
250
404
  }
405
+ // Right
251
406
 
252
- break;
253
- }
254
- // Right
407
+ case 'ArrowRight':
408
+ {
409
+ handleInitialArrowPress();
255
410
 
256
- case 39:
257
- {
258
- handleInitialArrowPress();
411
+ var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
259
412
 
260
- var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
413
+ if (_coordinatesClone2.column === 'header') {
414
+ updateActiveCellCoordinates({
415
+ coords: _coordinatesClone2,
416
+ updatedValue: {
417
+ column: 0
418
+ }
419
+ });
420
+ }
261
421
 
262
- if (_coordinatesClone2.column === 'header') {
263
- updateActiveCellCoordinates({
264
- coords: _coordinatesClone2,
265
- updatedValue: {
266
- column: 0
422
+ if (typeof _coordinatesClone2.column === 'number') {
423
+ // Prevent active cell coordinates from updating if the active
424
+ // cell is in the last column, ie we can't go any further to the right
425
+ if (columns.length - 1 === _coordinatesClone2.column) {
426
+ return;
267
427
  }
268
- });
269
- }
270
428
 
271
- if (typeof _coordinatesClone2.column === 'number') {
272
- // Prevent active cell coordinates from updating if the active
273
- // cell is in the last column, ie we can't go any further to the right
274
- if (columns.length - 1 === _coordinatesClone2.column) {
275
- return;
429
+ updateActiveCellCoordinates({
430
+ coords: _coordinatesClone2,
431
+ updatedValue: {
432
+ column: _coordinatesClone2.column + 1
433
+ }
434
+ });
276
435
  }
277
436
 
278
- updateActiveCellCoordinates({
279
- coords: _coordinatesClone2,
280
- updatedValue: {
281
- column: _coordinatesClone2.column + 1
282
- }
283
- });
437
+ break;
284
438
  }
439
+ // Down
285
440
 
286
- break;
287
- }
288
- // Down
441
+ case 'ArrowDown':
442
+ {
443
+ handleInitialArrowPress();
289
444
 
290
- case 40:
291
- {
292
- handleInitialArrowPress();
445
+ var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
293
446
 
294
- var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
447
+ if (_coordinatesClone3.row === 'header') {
448
+ updateActiveCellCoordinates({
449
+ coords: _coordinatesClone3,
450
+ updatedValue: {
451
+ row: 0
452
+ }
453
+ });
454
+ }
295
455
 
296
- if (_coordinatesClone3.row === 'header') {
297
- updateActiveCellCoordinates({
298
- coords: _coordinatesClone3,
299
- updatedValue: {
300
- row: 0
456
+ if (typeof _coordinatesClone3.row === 'number') {
457
+ // Prevent active cell coordinates from updating if the active
458
+ // cell is in the last row, ie we can't go any further down since
459
+ // we are in the last row
460
+ if (rows.length - 1 === _coordinatesClone3.row) {
461
+ return;
301
462
  }
302
- });
303
- }
304
463
 
305
- if (typeof _coordinatesClone3.row === 'number') {
306
- // Prevent active cell coordinates from updating if the active
307
- // cell is in the last row, ie we can't go any further down since
308
- // we are in the last row
309
- if (rows.length - 1 === _coordinatesClone3.row) {
310
- return;
464
+ updateActiveCellCoordinates({
465
+ coords: _coordinatesClone3,
466
+ updatedValue: {
467
+ row: _coordinatesClone3.row + 1
468
+ }
469
+ });
311
470
  }
312
471
 
313
- updateActiveCellCoordinates({
314
- coords: _coordinatesClone3,
315
- updatedValue: {
316
- row: _coordinatesClone3.row + 1
317
- }
318
- });
472
+ break;
319
473
  }
474
+ }
475
+ }
476
+ }, [updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, removeCellSelections, selectionAreas]);
320
477
 
321
- break;
478
+ var startEditMode = function startEditMode() {
479
+ setIsEditing(true);
480
+ var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
481
+ var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
482
+ setCellEditorValue(activeCellValue);
483
+ }; // Go into edit mode if 'Enter' key is pressed on activeCellRef
484
+
485
+
486
+ var handleActiveCellKeyDown = function handleActiveCellKeyDown(event) {
487
+ var key = event.key;
488
+
489
+ if (key === 'Enter') {
490
+ if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header') {
491
+ startEditMode();
492
+ }
493
+
494
+ if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
495
+ var handleHeaderCellProps = {
496
+ activeCellCoordinates: activeCellCoordinates,
497
+ rows: rows,
498
+ columns: columns,
499
+ setActiveCellCoordinates: setActiveCellCoordinates,
500
+ setCurrentMatcher: setCurrentMatcher,
501
+ setSelectionAreas: setSelectionAreas,
502
+ spreadsheetRef: spreadsheetRef,
503
+ isKeyboard: true
504
+ }; // Select an entire column
505
+
506
+ if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header') {
507
+ handleHeaderCellSelection(_objectSpread({
508
+ type: 'column'
509
+ }, handleHeaderCellProps));
510
+ } // Select an entire row
511
+
512
+
513
+ if ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
514
+ handleHeaderCellSelection(_objectSpread({
515
+ type: 'row'
516
+ }, handleHeaderCellProps));
322
517
  }
518
+ }
519
+ }
520
+ }; // Go into edit mode if double click is detected on activeCellRef
521
+
522
+
523
+ var handleActiveCellDoubleClick = function handleActiveCellDoubleClick() {
524
+ startEditMode();
525
+ }; // Update the data
526
+
527
+
528
+ var handleEditSubmit = function handleEditSubmit(event) {
529
+ var key = event.key;
530
+
531
+ var submitEditChanges = function submitEditChanges() {
532
+ var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
533
+ var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
534
+ removeCellEditor();
535
+ updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id);
536
+ };
537
+
538
+ if (key === 'Enter') {
539
+ submitEditChanges();
540
+ setActiveCellCoordinates(function (prev) {
541
+ return _objectSpread(_objectSpread({}, prev), {}, {
542
+ row: prev.row === rows.length - 1 ? prev.row : prev.row + 1 // do not move to next cell below if we're already in the last row
543
+
544
+ });
545
+ });
546
+ }
547
+
548
+ if (key === 'Tab') {
549
+ event.preventDefault();
550
+ submitEditChanges();
551
+ setActiveCellCoordinates(function (prev) {
552
+ return _objectSpread(_objectSpread({}, prev), {}, {
553
+ column: prev.column === columns.length - 1 ? prev.column : prev.column + 1 // do not move to next cell below if we're already in the last column
554
+
555
+ });
556
+ });
557
+ }
558
+
559
+ return;
560
+ }; // Only update if there are cell selection areas
561
+ // Find point object that matches currentMatcher and remove the second point
562
+ // because hovering over the active cell while clicking and holding should
563
+ // remove the previously existing selection area
564
+
565
+
566
+ var handleActiveCellMouseEnterCallback = useCallback(function (areas, clickHold) {
567
+ var freshMatcherValue = currentMatcherRef.current;
568
+
569
+ if (!freshMatcherValue) {
570
+ return;
323
571
  }
324
- }, [handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns.length, rows.length]); // Adds active cell highlight to correct cell onKeyDown
325
572
 
573
+ if (areas && areas.length && clickHold && freshMatcherValue) {
574
+ setSelectionAreas(function (prev) {
575
+ var selectionAreaClone = deepCloneObject(prev);
576
+ var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
577
+ return item.matcher === freshMatcherValue;
578
+ });
579
+
580
+ if (indexOfItemToUpdate === -1) {
581
+ return prev;
582
+ }
583
+
584
+ if (_typeof(selectionAreaClone[indexOfItemToUpdate].point2) === 'object' && selectionAreaClone[indexOfItemToUpdate].areaCreated) {
585
+ selectionAreaClone[indexOfItemToUpdate].point2 = null;
586
+ selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
587
+ removeCellSelections({
588
+ matcher: freshMatcherValue,
589
+ spreadsheetRef: spreadsheetRef
590
+ });
591
+ return selectionAreaClone;
592
+ }
593
+
594
+ return prev;
595
+ });
596
+ }
597
+ }, [spreadsheetRef, removeCellSelections]);
326
598
  useEffect(function () {
327
- var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
328
- var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
329
- var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
330
-
331
- if (containerHasFocus) {
332
- createActiveCell({
333
- placementElement: activeCellCoordinates ? activeCellPlacementElement : selectAllElement,
334
- coords: activeCellCoordinates,
335
- addToHeader: shouldPlaceActiveCellInHeader
599
+ if (isEditing) {
600
+ var _rows$activeCellCoord, _cellProps$column, _cellEditorRef$curren;
601
+
602
+ var cellProps = (_rows$activeCellCoord = rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row]) === null || _rows$activeCellCoord === void 0 ? void 0 : _rows$activeCellCoord.cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column];
603
+ var activeCellLeftPosition = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.left;
604
+ var activeCellTopPosition = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.top;
605
+ cellEditorRef.current.style.left = activeCellLeftPosition;
606
+ cellEditorRef.current.style.top = activeCellTopPosition;
607
+ cellEditorRef.current.style.display = 'block';
608
+ cellEditorRef.current.style.width = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.width;
609
+ cellEditorRef.current.style.height = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.height;
610
+ cellEditorRef.current.style.paddingTop = "".concat((parseInt(activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current.style.height) - 16) / 2, "px"); // calculate paddingTop based on cellHeight which could be variable depending on the cellSize prop
611
+
612
+ cellEditorRef.current.style.textAlign = (cellProps === null || cellProps === void 0 ? void 0 : (_cellProps$column = cellProps.column) === null || _cellProps$column === void 0 ? void 0 : _cellProps$column.placement) === 'right' ? 'right' : 'left';
613
+ (_cellEditorRef$curren = cellEditorRef.current) === null || _cellEditorRef$curren === void 0 ? void 0 : _cellEditorRef$curren.focus();
614
+ }
615
+
616
+ if (!isEditing) {
617
+ cellEditorRef.current.style.display = 'none';
618
+ cellEditorRef.current.blur();
619
+ activeCellRef.current.focus();
620
+ }
621
+ }, [isEditing, activeCellCoordinates, rows]);
622
+
623
+ var handleKeyUp = function handleKeyUp(event) {
624
+ var _activeKeys$current3;
625
+
626
+ var key = event.key; // Remove key from active keys array on key up
627
+
628
+ if ((_activeKeys$current3 = activeKeys.current) !== null && _activeKeys$current3 !== void 0 && _activeKeys$current3.includes(key)) {
629
+ var activeKeysClone = _toConsumableArray(activeKeys.current);
630
+
631
+ var filteredKeysClone = activeKeysClone.filter(function (item) {
632
+ return item !== key;
336
633
  });
634
+ activeKeys.current = filteredKeysClone;
337
635
  }
338
- }, [activeCellCoordinates, spreadsheetRef, createActiveCell, containerHasFocus]);
339
- var localRef = useRef();
340
- var spreadsheetRef = ref || localRef;
636
+ };
637
+
341
638
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, getTableProps(), getDevtoolsProps(componentName), {
342
639
  className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus)),
343
640
  ref: spreadsheetRef,
@@ -346,14 +643,32 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
346
643
  "aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
347
644
  "aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
348
645
  onKeyDown: handleKeyPress,
646
+ onKeyUp: handleKeyUp,
349
647
  onFocus: function onFocus() {
350
648
  return setContainerHasFocus(true);
351
649
  }
352
650
  }), /*#__PURE__*/React.createElement(DataSpreadsheetHeader, {
651
+ ref: spreadsheetRef,
652
+ activeCellCoordinates: activeCellCoordinates,
353
653
  cellSizeValue: cellSizeValue,
654
+ columns: columns,
354
655
  defaultColumn: defaultColumn,
355
- headerGroups: headerGroups
656
+ headerGroups: headerGroups,
657
+ rows: rows,
658
+ selectionAreas: selectionAreas,
659
+ setActiveCellCoordinates: setActiveCellCoordinates,
660
+ setSelectionAreas: setSelectionAreas,
661
+ setCurrentMatcher: setCurrentMatcher
356
662
  }), /*#__PURE__*/React.createElement(DataSpreadsheetBody, {
663
+ activeCellCoordinates: activeCellCoordinates,
664
+ ref: spreadsheetRef,
665
+ clickAndHoldActive: clickAndHoldActive,
666
+ setClickAndHoldActive: setClickAndHoldActive,
667
+ currentMatcher: currentMatcher,
668
+ setCurrentMatcher: setCurrentMatcher,
669
+ setContainerHasFocus: setContainerHasFocus,
670
+ selectionAreas: selectionAreas,
671
+ setSelectionAreas: setSelectionAreas,
357
672
  cellSize: cellSize,
358
673
  defaultColumn: defaultColumn,
359
674
  getTableBodyProps: getTableBodyProps,
@@ -363,7 +678,25 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
363
678
  setActiveCellCoordinates: setActiveCellCoordinates,
364
679
  scrollBarSize: scrollBarSize,
365
680
  totalColumnsWidth: totalColumnsWidth,
366
- id: id
681
+ id: id,
682
+ columns: columns
683
+ }), /*#__PURE__*/React.createElement("button", {
684
+ onKeyDown: handleActiveCellKeyDown,
685
+ onMouseEnter: handleActiveCellMouseEnter,
686
+ onDoubleClick: handleActiveCellDoubleClick,
687
+ ref: activeCellRef,
688
+ className: cx("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight")),
689
+ type: "button"
690
+ }), /*#__PURE__*/React.createElement(TextArea, {
691
+ value: cellEditorValue,
692
+ onKeyDown: handleEditSubmit,
693
+ onChange: function onChange(event) {
694
+ return setCellEditorValue(event.target.value);
695
+ },
696
+ ref: cellEditorRef,
697
+ labelText: "",
698
+ "aria-labelledby": activeCellCoordinates ? "[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]") : null,
699
+ className: cx("".concat(blockClass, "__cell-editor"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__cell-editor--").concat(cellSize), _defineProperty({}, "".concat(blockClass, "__cell-editor--active"), isEditing))
367
700
  }));
368
701
  }); // Return a placeholder if not released and not enabled by feature flag
369
702
 
@@ -408,7 +741,12 @@ DataSpreadsheet.propTypes = {
408
741
  /**
409
742
  * The event handler that is called when the active cell changes
410
743
  */
411
- onActiveCellChange: PropTypes.func
744
+ onActiveCellChange: PropTypes.func,
745
+
746
+ /**
747
+ * The setter fn for the data prop
748
+ */
749
+ onDataUpdate: PropTypes.func
412
750
  /* TODO: add types and DocGen for all props. */
413
751
 
414
752
  };