@carbon/ibm-products 2.33.0 → 2.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. package/css/index-full-carbon.css +303 -11
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +303 -11
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +303 -11
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
  14. package/es/components/CreateSidePanel/CreateSidePanel.js +5 -2
  15. package/es/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
  16. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
  17. package/es/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
  18. package/es/components/DataSpreadsheet/utils/commonEventHandlers.js +304 -0
  19. package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -1
  20. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
  21. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
  22. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
  23. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +6 -2
  24. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
  25. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
  26. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
  27. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
  28. package/es/components/EditSidePanel/EditSidePanel.d.ts +92 -2
  29. package/es/components/EditSidePanel/EditSidePanel.js +8 -10
  30. package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
  31. package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +83 -0
  32. package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
  33. package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +94 -0
  34. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +3 -1
  35. package/es/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
  36. package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
  37. package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +157 -0
  38. package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
  39. package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +72 -0
  40. package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
  41. package/es/components/FilterPanel/index.d.ts +4 -0
  42. package/es/components/OptionsTile/OptionsTile.d.ts +77 -3
  43. package/es/components/OptionsTile/OptionsTile.js +9 -20
  44. package/es/components/RemoveModal/RemoveModal.d.ts +81 -7
  45. package/es/components/RemoveModal/RemoveModal.js +1 -0
  46. package/es/components/ScrollGradient/ScrollGradient.d.ts +5 -0
  47. package/es/components/ScrollGradient/ScrollGradient.js +156 -0
  48. package/es/components/ScrollGradient/constants.d.ts +15 -0
  49. package/es/components/ScrollGradient/constants.js +121 -0
  50. package/es/components/ScrollGradient/index.d.ts +1 -0
  51. package/es/components/SidePanel/SidePanel.d.ts +144 -2
  52. package/es/components/SidePanel/SidePanel.js +57 -48
  53. package/es/components/StatusIcon/StatusIcon.d.ts +34 -2
  54. package/es/components/StatusIcon/StatusIcon.js +97 -95
  55. package/es/components/TruncatedList/TruncatedList.js +5 -3
  56. package/es/components/UserAvatar/UserAvatar.js +3 -2
  57. package/es/components/index.d.ts +2 -1
  58. package/es/global/js/package-settings.d.ts +5 -0
  59. package/es/global/js/package-settings.js +5 -0
  60. package/es/index.js +5 -0
  61. package/es/settings.d.ts +5 -0
  62. package/lib/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
  63. package/lib/components/CreateSidePanel/CreateSidePanel.js +5 -2
  64. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
  65. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
  66. package/lib/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
  67. package/lib/components/DataSpreadsheet/utils/commonEventHandlers.js +311 -0
  68. package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
  69. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
  70. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
  72. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
  73. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
  74. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
  75. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
  76. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
  77. package/lib/components/EditSidePanel/EditSidePanel.d.ts +92 -2
  78. package/lib/components/EditSidePanel/EditSidePanel.js +8 -10
  79. package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
  80. package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +90 -0
  81. package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
  82. package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +101 -0
  83. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +3 -1
  84. package/lib/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
  85. package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
  86. package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +164 -0
  87. package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
  88. package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +79 -0
  89. package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
  90. package/lib/components/FilterPanel/index.d.ts +4 -0
  91. package/lib/components/OptionsTile/OptionsTile.d.ts +77 -3
  92. package/lib/components/OptionsTile/OptionsTile.js +9 -20
  93. package/lib/components/RemoveModal/RemoveModal.d.ts +81 -7
  94. package/lib/components/RemoveModal/RemoveModal.js +1 -0
  95. package/lib/components/ScrollGradient/ScrollGradient.d.ts +5 -0
  96. package/lib/components/ScrollGradient/ScrollGradient.js +163 -0
  97. package/lib/components/ScrollGradient/constants.d.ts +15 -0
  98. package/lib/components/ScrollGradient/constants.js +128 -0
  99. package/lib/components/ScrollGradient/index.d.ts +1 -0
  100. package/lib/components/SidePanel/SidePanel.d.ts +144 -2
  101. package/lib/components/SidePanel/SidePanel.js +57 -48
  102. package/lib/components/StatusIcon/StatusIcon.d.ts +34 -2
  103. package/lib/components/StatusIcon/StatusIcon.js +97 -95
  104. package/lib/components/TruncatedList/TruncatedList.js +5 -3
  105. package/lib/components/UserAvatar/UserAvatar.js +3 -2
  106. package/lib/components/index.d.ts +2 -1
  107. package/lib/global/js/package-settings.d.ts +5 -0
  108. package/lib/global/js/package-settings.js +5 -0
  109. package/lib/index.js +25 -0
  110. package/lib/settings.d.ts +5 -0
  111. package/package.json +3 -3
  112. package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +56 -0
  113. package/scss/components/FilterPanel/_filter-panel-accordion.scss +6 -0
  114. package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +62 -0
  115. package/scss/components/FilterPanel/_filter-panel-checkbox.scss +25 -3
  116. package/scss/components/FilterPanel/_filter-panel-group.scss +39 -0
  117. package/scss/components/FilterPanel/_filter-panel-label.scss +0 -8
  118. package/scss/components/FilterPanel/_filter-panel.scss +2 -0
  119. package/scss/components/FilterPanel/_index-with-carbon.scss +4 -0
  120. package/scss/components/FilterPanel/_index.scss +4 -0
  121. package/scss/components/ScrollGradient/_carbon-imports.scss +9 -0
  122. package/scss/components/ScrollGradient/_index-with-carbon.scss +9 -0
  123. package/scss/components/ScrollGradient/_index.scss +8 -0
  124. package/scss/components/ScrollGradient/_scroll-gradient.scss +102 -0
  125. package/scss/components/UserAvatar/_user-avatar.scss +37 -4
  126. package/scss/components/_index-with-carbon.scss +1 -0
  127. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,304 @@
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
+
8
+ import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import { pkg } from '../../../settings.js';
10
+ import { checkForHoldingKey } from './checkForHoldingKey.js';
11
+ import { deepCloneObject } from '../../../global/js/utils/deepCloneObject.js';
12
+ import uuidv4 from '../../../global/js/utils/uuidv4.js';
13
+ import { removeCellSelections } from './removeCellSelections.js';
14
+ import { handleHeaderCellSelection } from './handleHeaderCellSelection.js';
15
+ import { includesShift, handleMultipleKeys, includesResourceKey } from './handleMultipleKeys.js';
16
+ import { handleActiveCellInSelectionEnter } from './handleActiveCellInSelectionEnter.js';
17
+ import { handleActiveCellInSelectionTab } from './handleActiveCellInSelectionTab.js';
18
+ import { handleCellDeletion } from './handleCellDeletion.js';
19
+
20
+ var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
21
+
22
+ // onClick fn for each cell in the data spreadsheet body,
23
+ // adds the active cell highlight
24
+
25
+ var handleBodyCellClick = function handleBodyCellClick(cell, columnIndex, event) {
26
+ for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
27
+ rest[_key - 3] = arguments[_key];
28
+ }
29
+ var currentMatcher = rest[0],
30
+ activeCellCoordinates = rest[1],
31
+ selectionAreas = rest[2],
32
+ setActiveCellCoordinates = rest[3],
33
+ setSelectionAreas = rest[4],
34
+ setContainerHasFocus = rest[5],
35
+ setClickAndHoldActive = rest[6],
36
+ setCurrentMatcher = rest[7],
37
+ ref = rest[8],
38
+ setSelectionAreaData = rest[9],
39
+ setActiveCellInsideSelectionArea = rest[10],
40
+ activeCellRef = rest[11],
41
+ setValidStartingPoint = rest[12];
42
+ event.preventDefault();
43
+ var closestBodyCell = event.target.closest(".".concat(blockClass, "__body--td"));
44
+ var isValidSelectionAreaStart = closestBodyCell.classList.contains("".concat(blockClass, "__body--td"));
45
+ setValidStartingPoint(isValidSelectionAreaStart);
46
+ var isHoldingCommandKey = checkForHoldingKey(event, 'cmd');
47
+ var isHoldingShiftKey = checkForHoldingKey(event, 'shiftKey');
48
+ setContainerHasFocus(true);
49
+ var activeCoordinates = {
50
+ row: cell.row.index,
51
+ column: columnIndex
52
+ };
53
+ var tempMatcher = uuidv4();
54
+ setClickAndHoldActive(true);
55
+
56
+ // prevent multiple selections unless cmd key is held
57
+ // meaning that selectionAreas should only have one item by default
58
+ if (isHoldingCommandKey) {
59
+ var activeCellElement = ref.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
60
+ activeCellElement.setAttribute('data-selection-id', tempMatcher);
61
+ setActiveCellInsideSelectionArea(true);
62
+ setActiveCellCoordinates(activeCoordinates);
63
+ setCurrentMatcher(tempMatcher);
64
+ setSelectionAreas(function (prev) {
65
+ return [].concat(_toConsumableArray(prev), [{
66
+ point1: activeCoordinates,
67
+ matcher: tempMatcher
68
+ }]);
69
+ });
70
+ } else if (isHoldingShiftKey) {
71
+ setContainerHasFocus(true);
72
+ var selectionAreaClone = deepCloneObject(selectionAreas);
73
+ var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
74
+ return item.matcher === currentMatcher;
75
+ });
76
+ if (indexOfItemToUpdate === -1) {
77
+ // There is always a selectionArea with a point1 object that updates
78
+ // whenever the activeCellCoordinates update, we should always be able
79
+ // to find an index, but if we do not for some reason we should return
80
+ // at this point.
81
+ return;
82
+ } else {
83
+ // Update the selectionArea that was found, do not update currentMatcher
84
+ selectionAreaClone[indexOfItemToUpdate].point1 = activeCellCoordinates;
85
+ selectionAreaClone[indexOfItemToUpdate].point2 = activeCoordinates;
86
+ selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
87
+ selectionAreaClone[indexOfItemToUpdate].matcher = currentMatcher;
88
+ setSelectionAreas(selectionAreaClone);
89
+ }
90
+ } else {
91
+ activeCellRef.current.style.display = 'none';
92
+ setActiveCellInsideSelectionArea(false);
93
+ setActiveCellCoordinates(activeCoordinates);
94
+ // remove all previous cell selections
95
+ removeCellSelections({
96
+ spreadsheetRef: ref
97
+ });
98
+ setSelectionAreas([{
99
+ point1: activeCoordinates,
100
+ matcher: tempMatcher
101
+ }]);
102
+ setCurrentMatcher(tempMatcher);
103
+ setSelectionAreaData([]);
104
+ }
105
+ };
106
+ var handleBodyCellHover = function handleBodyCellHover(cell, columnIndex) {
107
+ for (var _len2 = arguments.length, rest = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
108
+ rest[_key2 - 2] = arguments[_key2];
109
+ }
110
+ var clickAndHoldActive = rest[0],
111
+ currentMatcher = rest[1],
112
+ setSelectionAreas = rest[2];
113
+ if (clickAndHoldActive) {
114
+ var cellCoordinates = {
115
+ row: cell.row.index,
116
+ column: columnIndex
117
+ };
118
+ setSelectionAreas(function (prev) {
119
+ var _selectionAreaClone$i, _selectionAreaClone$i2;
120
+ var selectionAreaClone = deepCloneObject(prev);
121
+ var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
122
+ return item.matcher === currentMatcher;
123
+ });
124
+ // No items in the array match up with the currentMatcher value
125
+ if (indexOfItemToUpdate === -1) {
126
+ return prev;
127
+ }
128
+ // Do not update state if you're still hovering on the same cell
129
+ if (((_selectionAreaClone$i = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i === void 0 ? void 0 : _selectionAreaClone$i.row) === cellCoordinates.row && ((_selectionAreaClone$i2 = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i2 === void 0 ? void 0 : _selectionAreaClone$i2.column) === cellCoordinates.column) {
130
+ return prev;
131
+ }
132
+ selectionAreaClone[indexOfItemToUpdate].point2 = cellCoordinates;
133
+ selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
134
+ return selectionAreaClone;
135
+ });
136
+ }
137
+ };
138
+ var handleRowHeaderClick = function handleRowHeaderClick(index, event) {
139
+ for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
140
+ rest[_key3 - 2] = arguments[_key3];
141
+ }
142
+ var columns = rest[0],
143
+ ref = rest[1],
144
+ setSelectionAreas = rest[2],
145
+ setCurrentMatcher = rest[3],
146
+ setActiveCellCoordinates = rest[4],
147
+ activeCellCoordinates = rest[5],
148
+ rows = rest[6],
149
+ setSelectionAreaData = rest[7];
150
+ var isHoldingCommandKey = checkForHoldingKey(event, 'cmd');
151
+ handleHeaderCellSelection({
152
+ type: 'row',
153
+ activeCellCoordinates: activeCellCoordinates,
154
+ rows: rows,
155
+ columns: columns,
156
+ setActiveCellCoordinates: setActiveCellCoordinates,
157
+ setCurrentMatcher: setCurrentMatcher,
158
+ setSelectionAreas: setSelectionAreas,
159
+ spreadsheetRef: ref,
160
+ index: index,
161
+ setSelectionAreaData: setSelectionAreaData,
162
+ isHoldingCommandKey: isHoldingCommandKey
163
+ });
164
+ };
165
+ var handleKeyPress = function handleKeyPress(event) {
166
+ for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
167
+ rest[_key4 - 1] = arguments[_key4];
168
+ }
169
+ var activeCellInsideSelectionArea = rest[0],
170
+ updateActiveCellCoordinates = rest[1],
171
+ activeCellCoordinates = rest[2],
172
+ removeActiveCell = rest[3],
173
+ columns = rest[4],
174
+ rows = rest[5],
175
+ spreadsheetRef = rest[6],
176
+ currentMatcher = rest[7],
177
+ removeCellEditor = rest[8],
178
+ selectionAreas = rest[9],
179
+ handleHomeEndKey = rest[10],
180
+ keysPressedList = rest[11],
181
+ usingMac = rest[12],
182
+ updateData = rest[13],
183
+ checkForReturnCondition = rest[14],
184
+ handleArrowKeyPress = rest[15],
185
+ setSelectionAreas = rest[16],
186
+ setSelectionAreaData = rest[17],
187
+ setCurrentMatcher = rest[18],
188
+ activeCellRef = rest[19],
189
+ setActiveCellCoordinates = rest[20],
190
+ setContainerHasFocus = rest[21],
191
+ setActiveCellContent = rest[22];
192
+ var key = event.key;
193
+ // Command keys need to be returned as there is default browser behavior with these keys
194
+ // Needs to be returned in editing mode
195
+ if (checkForReturnCondition(key)) {
196
+ return;
197
+ }
198
+
199
+ // Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
200
+ if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
201
+ if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && keysPressedList.length < 2 && !includesShift(keysPressedList)) {
202
+ setSelectionAreas([]);
203
+ setSelectionAreaData([]);
204
+ removeCellSelections({
205
+ spreadsheetRef: spreadsheetRef
206
+ });
207
+ }
208
+ }
209
+ if ((keysPressedList === null || keysPressedList === void 0 ? void 0 : keysPressedList.length) > 1) {
210
+ handleMultipleKeys({
211
+ activeCellCoordinates: activeCellCoordinates,
212
+ event: event,
213
+ keysPressedList: keysPressedList,
214
+ selectionAreas: selectionAreas,
215
+ currentMatcher: currentMatcher,
216
+ rows: rows,
217
+ setSelectionAreas: setSelectionAreas,
218
+ columns: columns,
219
+ updateActiveCellCoordinates: updateActiveCellCoordinates,
220
+ spreadsheetRef: spreadsheetRef,
221
+ removeCellSelections: removeCellSelections,
222
+ blockClass: blockClass,
223
+ setCurrentMatcher: setCurrentMatcher,
224
+ usingMac: usingMac
225
+ });
226
+ }
227
+
228
+ // Allow arrow key navigation if there are less than two activeKeys OR
229
+ // if one of the activeCellCoordinates is in a header position
230
+ // Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
231
+
232
+ if (keysPressedList.length < 2 && !includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
233
+ switch (key) {
234
+ case 'Backspace':
235
+ case 'Delete':
236
+ {
237
+ var deleteParams = {
238
+ selectionAreas: selectionAreas,
239
+ currentMatcher: currentMatcher,
240
+ rows: rows,
241
+ setActiveCellContent: setActiveCellContent,
242
+ updateData: updateData,
243
+ activeCellCoordinates: activeCellCoordinates
244
+ };
245
+ handleCellDeletion(deleteParams);
246
+ break;
247
+ }
248
+ // Enter
249
+ case 'Enter':
250
+ {
251
+ handleActiveCellInSelectionEnter({
252
+ activeCellInsideSelectionArea: activeCellInsideSelectionArea,
253
+ activeCellCoordinates: activeCellCoordinates,
254
+ activeCellRef: activeCellRef,
255
+ selectionAreas: selectionAreas,
256
+ updateActiveCellCoordinates: updateActiveCellCoordinates
257
+ });
258
+ break;
259
+ }
260
+ // HOME
261
+ case 'Home':
262
+ case 'End':
263
+ {
264
+ event.preventDefault();
265
+ if (includesResourceKey(keysPressedList, usingMac)) {
266
+ return;
267
+ }
268
+ handleHomeEndKey({
269
+ type: key
270
+ });
271
+ break;
272
+ }
273
+ // Tab
274
+ case 'Tab':
275
+ {
276
+ if (activeCellInsideSelectionArea) {
277
+ event.preventDefault();
278
+ return handleActiveCellInSelectionTab({
279
+ activeCellInsideSelectionArea: activeCellInsideSelectionArea,
280
+ activeCellCoordinates: activeCellCoordinates,
281
+ activeCellRef: activeCellRef,
282
+ selectionAreas: selectionAreas,
283
+ updateActiveCellCoordinates: updateActiveCellCoordinates
284
+ });
285
+ }
286
+ setSelectionAreas([]);
287
+ removeActiveCell();
288
+ removeCellEditor();
289
+ setContainerHasFocus(false);
290
+ setActiveCellCoordinates(null);
291
+ break;
292
+ }
293
+ case 'ArrowLeft':
294
+ case 'ArrowUp':
295
+ case 'ArrowRight':
296
+ case 'ArrowDown':
297
+ {
298
+ handleArrowKeyPress(key);
299
+ }
300
+ }
301
+ }
302
+ };
303
+
304
+ export { handleBodyCellClick, handleBodyCellHover, handleKeyPress, handleRowHeaderClick };
@@ -98,7 +98,8 @@ var DatagridContent = function DatagridContent(_ref) {
98
98
  instance: datagridState,
99
99
  keysPressedList: keysPressedList,
100
100
  state: inlineEditState,
101
- usingMac: usingMac
101
+ usingMac: usingMac,
102
+ ref: multiKeyTrackingRef
102
103
  });
103
104
  },
104
105
  onFocus: withInlineEdit && function () {
@@ -35,7 +35,10 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
35
35
  link: emptyStateLink
36
36
  };
37
37
  var validEmptyStates = ['error', 'noData', 'notFound'];
38
- return /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps(), {
38
+ return /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
39
+ role: undefined
40
+ }), {
41
+ "aria-live": null,
39
42
  className: "".concat(blockClass, "__empty-state-body")
40
43
  }), /*#__PURE__*/React__default.createElement(TableRow, null, /*#__PURE__*/React__default.createElement(TableCell, {
41
44
  colSpan: headers.length,
@@ -20,7 +20,9 @@ var DatagridRefBody = function DatagridRefBody(datagridState) {
20
20
  var getTableBodyProps = datagridState.getTableBodyProps,
21
21
  rows = datagridState.rows,
22
22
  prepareRow = datagridState.prepareRow;
23
- return /*#__PURE__*/React__default.createElement("tbody", _extends({}, getTableBodyProps(), {
23
+ return /*#__PURE__*/React__default.createElement("tbody", _extends({}, getTableBodyProps({
24
+ role: undefined
25
+ }), {
24
26
  className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
25
27
  }), rows.map(function (row) {
26
28
  prepareRow(row);
@@ -16,7 +16,10 @@ var DatagridSimpleBody = function DatagridSimpleBody(datagridState) {
16
16
  var getTableBodyProps = datagridState.getTableBodyProps,
17
17
  rows = datagridState.rows,
18
18
  prepareRow = datagridState.prepareRow;
19
- return /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps(), {
19
+ return /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
20
+ role: undefined
21
+ }), {
22
+ "aria-live": null,
20
23
  className: cx("".concat(blockClass, "__simple-body"), getTableBodyProps().className)
21
24
  }), rows.map(function (row) {
22
25
  prepareRow(row);
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useEffect, useRef } from 'react';
10
10
  import { VariableSizeList } from 'react-window';
11
11
  import { TableBody } from '@carbon/react';
@@ -77,7 +77,11 @@ var DatagridVirtualBody = function DatagridVirtualBody(datagridState) {
77
77
  width: (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.clientWidth,
78
78
  overflow: 'hidden'
79
79
  }
80
- }, /*#__PURE__*/React__default.createElement(DatagridHead, datagridState)), /*#__PURE__*/React__default.createElement(TableBody, getTableBodyProps(), /*#__PURE__*/React__default.createElement(VariableSizeList, {
80
+ }, /*#__PURE__*/React__default.createElement(DatagridHead, datagridState)), /*#__PURE__*/React__default.createElement(TableBody, _extends({}, getTableBodyProps({
81
+ role: undefined
82
+ }), {
83
+ "aria-live": null
84
+ }), /*#__PURE__*/React__default.createElement(VariableSizeList, {
81
85
  height: virtualHeight || tableHeight,
82
86
  itemCount: visibleRows.length,
83
87
  itemSize: function itemSize(index) {
@@ -1,5 +1,5 @@
1
1
  export default Columns;
2
- declare function Columns({ getVisibleColumnsCount, filterString, columns, setColumnsObject, onSelectColumn, assistiveTextInstructionsLabel, assistiveTextDisabledInstructionsLabel, selectAllLabel, customizeTearsheetHeadingLabel }: {
2
+ declare function Columns({ getVisibleColumnsCount, filterString, columns, setColumnsObject, onSelectColumn, assistiveTextInstructionsLabel, assistiveTextDisabledInstructionsLabel, selectAllLabel, customizeTearsheetHeadingLabel, }: {
3
3
  getVisibleColumnsCount: any;
4
4
  filterString: any;
5
5
  columns: any;
@@ -153,6 +153,10 @@ var InlineEditCell = function InlineEditCell(_ref) {
153
153
  if (type === 'number') {
154
154
  numberInputRef.current.focus();
155
155
  }
156
+ if (type === 'selection') {
157
+ var _dropdownRef$current;
158
+ dropdownRef === null || dropdownRef === void 0 || (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 || _dropdownRef$current.focus();
159
+ }
156
160
  }
157
161
  }, [inEditMode, type]);
158
162
 
@@ -1,8 +1,9 @@
1
- export function handleGridKeyPress({ event, dispatch, state, instance, keysPressedList, usingMac, }: {
1
+ export function handleGridKeyPress({ event, dispatch, state, instance, keysPressedList, usingMac, ref, }: {
2
2
  event: any;
3
3
  dispatch: any;
4
4
  state: any;
5
5
  instance: any;
6
6
  keysPressedList: any;
7
7
  usingMac: any;
8
+ ref: any;
8
9
  }): void;
@@ -17,7 +17,8 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
17
17
  state = _ref.state,
18
18
  instance = _ref.instance,
19
19
  keysPressedList = _ref.keysPressedList,
20
- usingMac = _ref.usingMac;
20
+ usingMac = _ref.usingMac,
21
+ ref = _ref.ref;
21
22
  var key = event.key;
22
23
  var gridActive = state.gridActive,
23
24
  activeCellId = state.activeCellId,
@@ -54,8 +55,8 @@ var handleGridKeyPress = function handleGridKeyPress(_ref) {
54
55
 
55
56
  // Checks if the dropdown menu is open
56
57
  var dropdownIsActive = function dropdownIsActive() {
57
- var focusedElementRole = document.activeElement.getAttribute('role');
58
- if (focusedElementRole === 'listbox' && document.activeElement.classList.contains("".concat(carbon.prefix, "--list-box__menu"))) {
58
+ var selectedDropdown = ref === null || ref === void 0 ? void 0 : ref.current.querySelector("\n #".concat(instance.tableId, " .").concat(blockClass, "__table-with-inline-edit [data-cell-id=\"").concat(activeCellId, "\"] button[role='combobox']\n "));
59
+ if (selectedDropdown) {
59
60
  // Prevents arrow keys from scrolling any other content when dropdown menu is open
60
61
  event.preventDefault();
61
62
  return true;
@@ -1,5 +1,95 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2021
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
+ import '../../global/js/utils/props-helper';
9
+ interface EditSidePanelProps {
10
+ /**
11
+ * Sets the body content of the create side panel
12
+ */
13
+ children: ReactNode;
14
+ /**
15
+ * Provide an optional class to be applied to the containing node.
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specifies a boolean for disabling or enabling the primary button. This is important for form validation
20
+ * Returning `true` prevents the primary button from being clicked until required fields are completed.
21
+ */
22
+ disableSubmit?: boolean;
23
+ /**
24
+ * Specifies an optional field that provides a additional context for a form
25
+ */
26
+ formDescription?: ReactNode;
27
+ /**
28
+ * Specifies a required field that provides a title for a form
29
+ */
30
+ formTitle: ReactNode;
31
+ /**
32
+ * Unique identifier
33
+ */
34
+ id?: string;
35
+ /**
36
+ * Specifies an optional handler which is called when the CreateSidePanel
37
+ * is closed.
38
+ */
39
+ onRequestClose?: () => void;
40
+ /**
41
+ * Specifies an optional handler which is called when the CreateSidePanel
42
+ * primary button is pressed.
43
+ */
44
+ onRequestSubmit?: () => void;
45
+ /**
46
+ * Specifies whether the CreateSidePanel is open or not.
47
+ */
48
+ open: boolean;
49
+ /**
50
+ * Determines if the side panel is on the right or left
51
+ */
52
+ placement?: 'left' | 'right';
53
+ /**
54
+ * Specifies the primary button's text in the modal.
55
+ */
56
+ primaryButtonText: string;
57
+ /**
58
+ * Specifies the secondary button's text in the modal.
59
+ */
60
+ secondaryButtonText: string;
61
+ /**
62
+ * This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
63
+ * This prop is required when using the `slideIn` variant of the side panel.
64
+ */
65
+ selectorPageContent?: string;
66
+ /**
67
+ * Specifies which DOM element in the form should be focused.
68
+ */
69
+ selectorPrimaryFocus?: string;
70
+ /**
71
+ * Sets the size of the side panel
72
+ */
73
+ size?: 'xs' | 'sm' | 'md' | 'lg' | '2xl';
74
+ /**
75
+ * Specifies which DOM element in the form should be focused.
76
+ */
77
+ slideIn?: boolean;
78
+ /**
79
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
80
+ */
81
+ slug?: ReactNode;
82
+ /**
83
+ * The subtitle of the CreateSidePanel is optional and serves to provide more information about the modal.
84
+ */
85
+ subtitle?: ReactNode;
86
+ /**
87
+ * The title of the CreateSidePanel is usually the product or service name.
88
+ */
89
+ title: string;
90
+ }
1
91
  /**
2
92
  * Use with medium complexity edits if the user needs page context.
3
93
  */
4
- export let EditSidePanel: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
- import React from 'react';
94
+ export declare let EditSidePanel: React.ForwardRefExoticComponent<EditSidePanelProps & React.RefAttributes<HTMLDivElement>>;
95
+ export {};
@@ -24,12 +24,6 @@ var componentName = 'EditSidePanel';
24
24
 
25
25
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
26
26
 
27
- // Default values for props
28
- var defaults = {
29
- placement: 'right',
30
- size: 'md'
31
- };
32
-
33
27
  /**
34
28
  * Use with medium complexity edits if the user needs page context.
35
29
  */
@@ -44,13 +38,13 @@ var EditSidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
44
38
  onRequestSubmit = _ref.onRequestSubmit,
45
39
  open = _ref.open,
46
40
  _ref$placement = _ref.placement,
47
- placement = _ref$placement === void 0 ? defaults.placement : _ref$placement,
41
+ placement = _ref$placement === void 0 ? 'right' : _ref$placement,
48
42
  primaryButtonText = _ref.primaryButtonText,
49
43
  secondaryButtonText = _ref.secondaryButtonText,
50
44
  selectorPrimaryFocus = _ref.selectorPrimaryFocus,
51
45
  selectorPageContent = _ref.selectorPageContent,
52
46
  _ref$size = _ref.size,
53
- size = _ref$size === void 0 ? defaults.size : _ref$size,
47
+ size = _ref$size === void 0 ? 'md' : _ref$size,
54
48
  slideIn = _ref.slideIn,
55
49
  subtitle = _ref.subtitle,
56
50
  title = _ref.title,
@@ -59,7 +53,7 @@ var EditSidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
59
53
  label: primaryButtonText,
60
54
  onClick: function onClick(event) {
61
55
  event.preventDefault();
62
- onRequestSubmit();
56
+ onRequestSubmit && onRequestSubmit();
63
57
  },
64
58
  kind: 'primary',
65
59
  disabled: disableSubmit,
@@ -112,6 +106,7 @@ EditSidePanel.propTypes = {
112
106
  /**
113
107
  * Sets the body content of the create side panel
114
108
  */
109
+ /**@ts-ignore*/
115
110
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
116
111
  /**
117
112
  * Provide an optional class to be applied to the containing node.
@@ -147,7 +142,7 @@ EditSidePanel.propTypes = {
147
142
  /**
148
143
  * Specifies whether the CreateSidePanel is open or not.
149
144
  */
150
- open: PropTypes.bool,
145
+ open: PropTypes.bool.isRequired,
151
146
  /**
152
147
  * Determines if the side panel is on the right or left
153
148
  */
@@ -164,6 +159,7 @@ EditSidePanel.propTypes = {
164
159
  * This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
165
160
  * This prop is required when using the `slideIn` variant of the side panel.
166
161
  */
162
+ /**@ts-ignore*/
167
163
  selectorPageContent: PropTypes.string.isRequired.if(function (_ref2) {
168
164
  var slideIn = _ref2.slideIn;
169
165
  return slideIn;
@@ -171,6 +167,7 @@ EditSidePanel.propTypes = {
171
167
  /**
172
168
  * Specifies which DOM element in the form should be focused.
173
169
  */
170
+ /**@ts-ignore*/
174
171
  selectorPrimaryFocus: PropTypes.node.isRequired,
175
172
  /**
176
173
  * Sets the size of the side panel
@@ -191,6 +188,7 @@ EditSidePanel.propTypes = {
191
188
  /**
192
189
  * The title of the CreateSidePanel is usually the product or service name.
193
190
  */
191
+ /**@ts-ignore*/
194
192
  title: PropTypes.node.isRequired
195
193
  };
196
194
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A container with a label and optional count.
3
+ */
4
+ export let FilterPanelAccordion: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';