@carbon/ibm-products 2.38.0 → 2.39.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +227 -0
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +227 -0
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +227 -0
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Card/Card.js +50 -9
- package/es/components/Card/CardFooter.d.ts +5 -1
- package/es/components/Card/CardFooter.js +11 -1
- package/es/components/Carousel/Carousel.d.ts +6 -2
- package/es/components/Checklist/Checklist.d.ts +100 -2
- package/es/components/Checklist/Checklist.js +9 -5
- package/es/components/Checklist/Checklist.types.d.ts +19 -0
- package/es/components/Checklist/Checklist.types.js +22 -0
- package/es/components/Checklist/ChecklistChart.d.ts +5 -1
- package/es/components/Checklist/ChecklistChart.js +9 -4
- package/es/components/Checklist/ChecklistIcon.d.ts +5 -1
- package/es/components/Checklist/ChecklistIcon.js +9 -4
- package/es/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
- package/es/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +46 -31
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +34 -25
- package/es/components/DataSpreadsheet/types/index.d.ts +30 -0
- package/es/components/GetStartedCard/GetStartedCard.d.ts +5 -0
- package/es/components/GetStartedCard/GetStartedCard.js +82 -0
- package/es/components/GetStartedCard/index.d.ts +1 -0
- package/es/components/Guidebanner/Guidebanner.js +2 -2
- package/es/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +10 -10
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/es/components/TagOverflow/TagOverflow.js +153 -29
- package/es/components/TagOverflow/TagOverflowModal.d.ts +29 -0
- package/es/components/TagOverflow/TagOverflowModal.js +112 -0
- package/es/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
- package/es/components/TagOverflow/TagOverflowPopover.js +135 -0
- package/es/components/index.d.ts +1 -0
- package/es/global/js/package-settings.d.ts +1 -0
- package/es/global/js/package-settings.js +1 -0
- package/es/index.js +1 -0
- package/es/settings.d.ts +1 -0
- package/lib/components/Card/Card.js +50 -9
- package/lib/components/Card/CardFooter.d.ts +5 -1
- package/lib/components/Card/CardFooter.js +11 -1
- package/lib/components/Carousel/Carousel.d.ts +6 -2
- package/lib/components/Checklist/Checklist.d.ts +100 -2
- package/lib/components/Checklist/Checklist.js +9 -5
- package/lib/components/Checklist/Checklist.types.d.ts +19 -0
- package/lib/components/Checklist/Checklist.types.js +27 -0
- package/lib/components/Checklist/ChecklistChart.d.ts +5 -1
- package/lib/components/Checklist/ChecklistChart.js +14 -9
- package/lib/components/Checklist/ChecklistIcon.d.ts +5 -1
- package/lib/components/Checklist/ChecklistIcon.js +9 -4
- package/lib/components/CoachmarkButton/CoachmarkButton.d.ts +19 -2
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +46 -2
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +5 -4
- package/lib/components/CreateInfluencer/CreateInfluencer.d.ts +55 -17
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +67 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +48 -27
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +139 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +46 -31
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +89 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +34 -25
- package/lib/components/DataSpreadsheet/types/index.d.ts +30 -0
- package/lib/components/GetStartedCard/GetStartedCard.d.ts +5 -0
- package/lib/components/GetStartedCard/GetStartedCard.js +88 -0
- package/lib/components/GetStartedCard/index.d.ts +1 -0
- package/lib/components/Guidebanner/Guidebanner.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +162 -1
- package/lib/components/NotificationsPanel/NotificationsPanel.js +10 -10
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/lib/components/TagOverflow/TagOverflow.js +154 -28
- package/lib/components/TagOverflow/TagOverflowModal.d.ts +29 -0
- package/lib/components/TagOverflow/TagOverflowModal.js +121 -0
- package/lib/components/TagOverflow/TagOverflowPopover.d.ts +2 -0
- package/lib/components/TagOverflow/TagOverflowPopover.js +144 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/global/js/package-settings.d.ts +1 -0
- package/lib/global/js/package-settings.js +1 -0
- package/lib/index.js +5 -0
- package/lib/settings.d.ts +1 -0
- package/package.json +3 -3
- package/scss/components/GetStartedCard/_carbon-imports.scss +9 -0
- package/scss/components/GetStartedCard/_get-started-card.scss +135 -0
- package/scss/components/GetStartedCard/_index-with-carbon.scss +9 -0
- package/scss/components/GetStartedCard/_index.scss +8 -0
- package/scss/components/TagOverflow/_tag-overflow.scss +157 -0
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
- package/telemetry.yml +23 -16
@@ -63,21 +63,21 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
63
63
|
var previousState = usePreviousValue({
|
64
64
|
selectionAreaData: selectionAreaData,
|
65
65
|
clickAndHoldActive: clickAndHoldActive,
|
66
|
-
rowHeight: defaultColumn.rowHeight
|
67
|
-
});
|
66
|
+
rowHeight: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight
|
67
|
+
}) || {};
|
68
68
|
|
69
69
|
// Set custom css property containing the spreadsheet total width
|
70
70
|
useEffect(function () {
|
71
|
-
ref === null || ref === void 0 || ref.current.style.setProperty("--".concat(blockClass, "--total-width"), px(totalColumnsWidth + scrollBarSize));
|
71
|
+
ref === null || ref === void 0 || ref.current.style.setProperty("--".concat(blockClass, "--total-width"), px((totalColumnsWidth || 0) + (scrollBarSize || 0)));
|
72
72
|
}, [ref, scrollBarSize, totalColumnsWidth]);
|
73
73
|
|
74
74
|
// Call the `onSelectionAreaChange` handler to send selection area data
|
75
75
|
// back to the consumer
|
76
76
|
useEffect(function () {
|
77
|
-
if (selectionAreaData.length) {
|
77
|
+
if (selectionAreaData !== null && selectionAreaData !== void 0 && selectionAreaData.length) {
|
78
78
|
var _previousState$select;
|
79
79
|
if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || (previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length)) {
|
80
|
-
onSelectionAreaChange(selectionAreaData);
|
80
|
+
onSelectionAreaChange === null || onSelectionAreaChange === void 0 || onSelectionAreaChange(selectionAreaData);
|
81
81
|
}
|
82
82
|
}
|
83
83
|
}, [previousState === null || previousState === void 0 ? void 0 : previousState.selectionAreaData, selectionAreaData, onSelectionAreaChange, clickAndHoldActive, previousState === null || previousState === void 0 ? void 0 : previousState.clickAndHoldActive]);
|
@@ -109,7 +109,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
109
109
|
}),
|
110
110
|
selectionId: area.matcher
|
111
111
|
};
|
112
|
-
setSelectionAreaData(function (prev) {
|
112
|
+
setSelectionAreaData === null || setSelectionAreaData === void 0 || setSelectionAreaData(function (prev) {
|
113
113
|
var prevValues = deepCloneObject(prev);
|
114
114
|
var newAreaData = prevValues.filter(function (item) {
|
115
115
|
return item.selectionId !== area.matcher;
|
@@ -167,19 +167,28 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
167
167
|
// cell also gets updated with the new size and new top placement
|
168
168
|
// value. All of the cell selections will be updated as well
|
169
169
|
useEffect(function () {
|
170
|
-
var listContainer
|
171
|
-
var activeCellButton
|
172
|
-
if (
|
170
|
+
var listContainer;
|
171
|
+
var activeCellButton;
|
172
|
+
if (spreadsheetBodyRef !== null && spreadsheetBodyRef !== void 0 && spreadsheetBodyRef.current) {
|
173
|
+
var _listContainer;
|
174
|
+
listContainer = spreadsheetBodyRef === null || spreadsheetBodyRef === void 0 ? void 0 : spreadsheetBodyRef.current;
|
175
|
+
activeCellButton = (_listContainer = listContainer) === null || _listContainer === void 0 ? void 0 : _listContainer.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
176
|
+
}
|
177
|
+
if (activeCellButton && (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight) !== previousState.rowHeight) {
|
173
178
|
activeCellButton.style.height = "".concat(defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight, "px");
|
174
179
|
if (activeCellCoordinates) {
|
175
|
-
var activeTargetElement = ref.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates.column, "\"]"));
|
176
|
-
var
|
177
|
-
var newActiveCellTopPosition
|
180
|
+
var activeTargetElement = ref === null || ref === void 0 ? void 0 : ref.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates.column, "\"]"));
|
181
|
+
var _listContainer2 = ref === null || ref === void 0 ? void 0 : ref.current.querySelector(".".concat(blockClass, "__list--container"));
|
182
|
+
var newActiveCellTopPosition;
|
183
|
+
if (activeTargetElement && _listContainer2) {
|
184
|
+
newActiveCellTopPosition = (activeTargetElement === null || activeTargetElement === void 0 ? void 0 : activeTargetElement.getBoundingClientRect().top) - _listContainer2.getBoundingClientRect().top;
|
185
|
+
}
|
178
186
|
activeCellButton.style.top = px(newActiveCellTopPosition);
|
179
187
|
removeCellSelections({
|
188
|
+
matcher: undefined,
|
180
189
|
spreadsheetRef: ref
|
181
190
|
});
|
182
|
-
selectionAreas.map(function (area) {
|
191
|
+
selectionAreas === null || selectionAreas === void 0 || selectionAreas.map(function (area) {
|
183
192
|
if (!area.areaCreated && area.point1 && area.point2 && area.matcher) {
|
184
193
|
return createCellSelectionArea({
|
185
194
|
ref: ref,
|
@@ -202,12 +211,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
202
211
|
var removeDuplicateSelections = useCallback(function () {
|
203
212
|
var uniqueAttrArray = [],
|
204
213
|
removedSelectionAreaMatcherArr = [];
|
205
|
-
ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
|
206
|
-
var
|
207
|
-
top =
|
208
|
-
left =
|
209
|
-
height =
|
210
|
-
width =
|
214
|
+
ref === null || ref === void 0 || ref.current.querySelectorAll(".".concat(blockClass, "__selection-area--element")).forEach(function (selectorEl) {
|
215
|
+
var _style = selectorEl.style,
|
216
|
+
top = _style.top,
|
217
|
+
left = _style.left,
|
218
|
+
height = _style.height,
|
219
|
+
width = _style.width;
|
211
220
|
var uniqueAttrStr = "".concat(top).concat(left).concat(height).concat(width); // eg: 20px30px70px90px
|
212
221
|
if (uniqueAttrArray.indexOf(uniqueAttrStr) == -1) {
|
213
222
|
uniqueAttrArray.push(uniqueAttrStr);
|
@@ -219,13 +228,13 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
219
228
|
|
220
229
|
//clean the duplicate selectionAreaData and selectionArea
|
221
230
|
if (removedSelectionAreaMatcherArr.length) {
|
222
|
-
setSelectionAreas(function (prev) {
|
231
|
+
setSelectionAreas === null || setSelectionAreas === void 0 || setSelectionAreas(function (prev) {
|
223
232
|
var prevValues = deepCloneObject(prev);
|
224
233
|
return prevValues.filter(function (item) {
|
225
234
|
return !removedSelectionAreaMatcherArr.includes(item.matcher);
|
226
235
|
});
|
227
236
|
});
|
228
|
-
setSelectionAreaData(function (prev) {
|
237
|
+
setSelectionAreaData === null || setSelectionAreaData === void 0 || setSelectionAreaData(function (prev) {
|
229
238
|
var prevValues = deepCloneObject(prev);
|
230
239
|
return prevValues.filter(function (item) {
|
231
240
|
return !removedSelectionAreaMatcherArr.includes(item.selectionId);
|
@@ -248,14 +257,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
248
257
|
};
|
249
258
|
}, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
|
250
259
|
var handleBodyScroll = function handleBodyScroll() {
|
251
|
-
var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr"));
|
252
|
-
headerRowElement.scrollLeft = contentScrollRef.current.scrollLeft;
|
260
|
+
var headerRowElement = ref.current.querySelector("\n .".concat(blockClass, "__header--container .").concat(blockClass, "__tr")) || new HTMLDivElement();
|
261
|
+
headerRowElement.scrollLeft = contentScrollRef === null || contentScrollRef === void 0 ? void 0 : contentScrollRef.current.scrollLeft;
|
253
262
|
};
|
254
263
|
useEffect(function () {
|
255
|
-
contentScrollRef.current.addEventListener('scroll', function (
|
264
|
+
contentScrollRef.current.addEventListener('scroll', function () {
|
256
265
|
return handleBodyScroll();
|
257
266
|
});
|
258
|
-
var contentScrollElementRef = contentScrollRef.current;
|
267
|
+
var contentScrollElementRef = contentScrollRef.current || new HTMLElement();
|
259
268
|
return function () {
|
260
269
|
contentScrollElementRef.removeEventListener('scroll', handleBodyScroll);
|
261
270
|
};
|
@@ -280,12 +289,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
280
289
|
_toConsumableArray(Array(defaultEmptyRowCount)).map(function () {
|
281
290
|
var _headerGroups$;
|
282
291
|
var emptyCell = {};
|
283
|
-
(_headerGroups$ = headerGroups[0]) === null || _headerGroups$ === void 0 || _headerGroups$.headers.map(function (header) {
|
292
|
+
headerGroups === null || headerGroups === void 0 || (_headerGroups$ = headerGroups[0]) === null || _headerGroups$ === void 0 || _headerGroups$.headers.map(function (header) {
|
284
293
|
emptyCell[header.id] = null;
|
285
294
|
});
|
286
295
|
emptyRowData.push(emptyCell);
|
287
296
|
});
|
288
|
-
onDataUpdate(emptyRowData);
|
297
|
+
onDataUpdate === null || onDataUpdate === void 0 || onDataUpdate(emptyRowData);
|
289
298
|
};
|
290
299
|
buildEmptyRows();
|
291
300
|
}
|
@@ -298,9 +307,9 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
298
307
|
var RenderRow = useCallback(function (_ref3) {
|
299
308
|
var index = _ref3.index,
|
300
309
|
style = _ref3.style;
|
301
|
-
var row = rows[index];
|
310
|
+
var row = rows === null || rows === void 0 ? void 0 : rows[index];
|
302
311
|
if (rows && rows.length) {
|
303
|
-
prepareRow(row);
|
312
|
+
prepareRow === null || prepareRow === void 0 || prepareRow(row);
|
304
313
|
var rowProps = prepareProps(row.getRowProps({
|
305
314
|
style: style
|
306
315
|
}), 'key');
|
@@ -355,12 +364,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
355
364
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
356
365
|
ref: spreadsheetBodyRef,
|
357
366
|
className: cx("".concat(blockClass, "__body--container"))
|
358
|
-
}, getTableBodyProps()), /*#__PURE__*/React__default.createElement(FixedSizeList, {
|
367
|
+
}, getTableBodyProps === null || getTableBodyProps === void 0 ? void 0 : getTableBodyProps()), /*#__PURE__*/React__default.createElement(FixedSizeList, {
|
359
368
|
className: cx("".concat(blockClass, "__list--container"), "".concat(blockClass, "__list--container--").concat(id)),
|
360
369
|
height: 400,
|
361
|
-
itemCount: rows.length || defaultEmptyRowCount,
|
370
|
+
itemCount: (rows === null || rows === void 0 ? void 0 : rows.length) || defaultEmptyRowCount,
|
362
371
|
itemSize: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
363
372
|
width: getSpreadsheetWidth({
|
373
|
+
headerGroup: undefined,
|
374
|
+
type: undefined,
|
364
375
|
scrollBarSizeValue: scrollBarSize,
|
365
376
|
totalVisibleColumns: totalVisibleColumns,
|
366
377
|
defaultColumn: defaultColumn,
|
@@ -374,6 +385,7 @@ DataSpreadsheetBody.propTypes = {
|
|
374
385
|
/**
|
375
386
|
* Object containing the active cell coordinates
|
376
387
|
*/
|
388
|
+
/**@ts-ignore */
|
377
389
|
activeCellCoordinates: PropTypes.shape({
|
378
390
|
row: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
379
391
|
column: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
@@ -381,6 +393,7 @@ DataSpreadsheetBody.propTypes = {
|
|
381
393
|
/**
|
382
394
|
*This is the ref of the button input, which is the active cell element
|
383
395
|
*/
|
396
|
+
/**@ts-ignore */
|
384
397
|
activeCellRef: PropTypes.object,
|
385
398
|
/**
|
386
399
|
* Is the user clicking and holding in the data spreadsheet body
|
@@ -397,6 +410,7 @@ DataSpreadsheetBody.propTypes = {
|
|
397
410
|
/**
|
398
411
|
* Default spreadsheet sizing values
|
399
412
|
*/
|
413
|
+
/**@ts-ignore */
|
400
414
|
defaultColumn: PropTypes.shape({
|
401
415
|
rowHeight: PropTypes.number,
|
402
416
|
rowHeaderWidth: PropTypes.number,
|
@@ -498,6 +512,7 @@ DataSpreadsheetBody.propTypes = {
|
|
498
512
|
/**
|
499
513
|
* Prop from react-table used to reorder columns
|
500
514
|
*/
|
515
|
+
/**@ts-ignore */
|
501
516
|
visibleColumns: PropTypes.array
|
502
517
|
};
|
503
518
|
|
@@ -1,2 +1,89 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
8
|
+
import { ActiveCellCoordinates, Column, ItemType, Size } from './types';
|
9
|
+
interface DataSpreadsheetHeaderProps {
|
10
|
+
/**
|
11
|
+
* Object containing the active cell coordinates
|
12
|
+
*/
|
13
|
+
activeCellCoordinates?: ActiveCellCoordinates | null;
|
14
|
+
/**
|
15
|
+
* Specifies the cell height
|
16
|
+
*/
|
17
|
+
cellSize?: Size;
|
18
|
+
/**
|
19
|
+
* All of the spreadsheet columns
|
20
|
+
*/
|
21
|
+
columns?: readonly Column[];
|
22
|
+
/**
|
23
|
+
* uuid that corresponds to the current selection area
|
24
|
+
*/
|
25
|
+
currentMatcher?: string;
|
26
|
+
/**
|
27
|
+
* Default spreadsheet sizing values
|
28
|
+
*/
|
29
|
+
defaultColumn?: Column;
|
30
|
+
/**
|
31
|
+
* Whether or not a click/hold is active on a header cell
|
32
|
+
*/
|
33
|
+
headerCellHoldActive?: boolean;
|
34
|
+
/**
|
35
|
+
* Headers provided from useTable hook
|
36
|
+
*/
|
37
|
+
headerGroups?: any[];
|
38
|
+
/**
|
39
|
+
* All of the spreadsheet row data
|
40
|
+
*/
|
41
|
+
rows?: object[];
|
42
|
+
/**
|
43
|
+
* The scrollbar width
|
44
|
+
*/
|
45
|
+
scrollBarSize?: number;
|
46
|
+
/**
|
47
|
+
* The aria label applied to the Select all button
|
48
|
+
*/
|
49
|
+
selectAllAriaLabel: string;
|
50
|
+
/**
|
51
|
+
* All of the cell selection area items
|
52
|
+
*/
|
53
|
+
selectionAreas?: ItemType[];
|
54
|
+
/**
|
55
|
+
* Setter fn for activeCellCoordinates value
|
56
|
+
*/
|
57
|
+
setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
|
58
|
+
/**
|
59
|
+
* Setter fn for currentMatcher value
|
60
|
+
*/
|
61
|
+
setCurrentMatcher?: Dispatch<SetStateAction<string>>;
|
62
|
+
/**
|
63
|
+
* Setter fn for header cell hold active value
|
64
|
+
*/
|
65
|
+
setHeaderCellHoldActive?: (arg: boolean) => void;
|
66
|
+
/**
|
67
|
+
* Setter fn for selectionAreaData state value
|
68
|
+
*/
|
69
|
+
setSelectionAreaData?: Dispatch<SetStateAction<object[]>>;
|
70
|
+
/**
|
71
|
+
* Setter fn for selectionAreas value
|
72
|
+
*/
|
73
|
+
setSelectionAreas?: Dispatch<SetStateAction<object[]>>;
|
74
|
+
/**
|
75
|
+
* The total number of columns to be initially visible, additional columns will be rendered and
|
76
|
+
* visible via horizontal scrollbar
|
77
|
+
*/
|
78
|
+
totalVisibleColumns?: number;
|
79
|
+
/**
|
80
|
+
* Function used to update the active cell coordinates
|
81
|
+
*/
|
82
|
+
updateActiveCellCoordinates?: (arg: any) => void;
|
83
|
+
/**
|
84
|
+
* Array of visible columns provided by react-table useTable hook
|
85
|
+
*/
|
86
|
+
visibleColumns?: [];
|
87
|
+
}
|
88
|
+
export declare const DataSpreadsheetHeader: React.ForwardRefExoticComponent<DataSpreadsheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
89
|
+
export {};
|
@@ -52,12 +52,12 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
52
52
|
setSelectedHeaderReorderActive = _useState4[1];
|
53
53
|
var previousState = usePreviousValue({
|
54
54
|
cellSize: cellSize
|
55
|
-
});
|
55
|
+
}) || {};
|
56
56
|
useEffect(function () {
|
57
57
|
if ((previousState === null || previousState === void 0 ? void 0 : previousState.cellSize) !== cellSize) {
|
58
|
-
var
|
59
|
-
var scrollContainer = ref === null || ref === void 0 || (
|
60
|
-
var hasScrollBar = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollHeight) > (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientHeight);
|
58
|
+
var _current;
|
59
|
+
var scrollContainer = ref === null || ref === void 0 || (_current = ref.current) === null || _current === void 0 ? void 0 : _current.querySelector(".".concat(blockClass, "__list--container"));
|
60
|
+
var hasScrollBar = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollHeight) && (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientHeight) && (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollHeight) > (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.clientHeight);
|
61
61
|
var scrollBarValue = hasScrollBar ? 0 : scrollBarSize;
|
62
62
|
setScrollBarSizeValue(scrollBarValue);
|
63
63
|
}
|
@@ -71,15 +71,16 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
71
71
|
activeCellCoordinates: activeCellCoordinates,
|
72
72
|
rows: rows,
|
73
73
|
columns: columns,
|
74
|
+
currentMatcher: currentMatcher,
|
74
75
|
setActiveCellCoordinates: setActiveCellCoordinates,
|
75
76
|
setCurrentMatcher: setCurrentMatcher,
|
76
77
|
setSelectionAreas: setSelectionAreas,
|
77
78
|
spreadsheetRef: ref,
|
78
79
|
index: index,
|
80
|
+
isKeyboard: undefined,
|
79
81
|
setSelectionAreaData: setSelectionAreaData,
|
80
82
|
isHoldingCommandKey: isHoldingCommandKey,
|
81
|
-
isHoldingShiftKey: isHoldingShiftKey
|
82
|
-
currentMatcher: currentMatcher
|
83
|
+
isHoldingShiftKey: isHoldingShiftKey
|
83
84
|
});
|
84
85
|
};
|
85
86
|
};
|
@@ -96,34 +97,36 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
96
97
|
};
|
97
98
|
var handleHeaderMouseDown = function handleHeaderMouseDown(index) {
|
98
99
|
return function (event) {
|
99
|
-
var _selectionAreaToClone;
|
100
|
+
var _selectionAreaToClone, _selectionAreaToClone2, _selectionAreaToClone3, _document;
|
100
101
|
if (event.shiftKey) {
|
101
102
|
// Remove columns, need to call handleHeaderCellSelection
|
102
103
|
return;
|
103
104
|
}
|
104
105
|
setSelectedHeaderReorderActive(true);
|
105
|
-
var selectionAreaToClone = selectionAreas.filter(function (item) {
|
106
|
+
var selectionAreaToClone = selectionAreas === null || selectionAreas === void 0 ? void 0 : selectionAreas.filter(function (item) {
|
106
107
|
return (item === null || item === void 0 ? void 0 : item.matcher) === currentMatcher;
|
107
108
|
});
|
108
|
-
var selectionAreaElement = ref.current.querySelector("[data-matcher-id=\"".concat((_selectionAreaToClone = selectionAreaToClone[0]) === null || _selectionAreaToClone === void 0 ? void 0 : _selectionAreaToClone.matcher, "\"]"));
|
109
|
+
var selectionAreaElement = ref.current.querySelector("[data-matcher-id=\"".concat(selectionAreaToClone === null || selectionAreaToClone === void 0 || (_selectionAreaToClone = selectionAreaToClone[0]) === null || _selectionAreaToClone === void 0 ? void 0 : _selectionAreaToClone.matcher, "\"]"));
|
109
110
|
var clickXPosition = event.clientX;
|
110
111
|
var headerButtonCoords = event.target.getBoundingClientRect();
|
111
112
|
var headerIndex = event.target.getAttribute('data-column-index');
|
112
113
|
var offsetXValue = clickXPosition - headerButtonCoords.left;
|
113
|
-
var lowestColumnIndexFromSelectionArea = Math.min(selectionAreaToClone[0].point1.column, selectionAreaToClone[0].point2.column);
|
114
|
-
var selectionAreaCoords = selectionAreaElement.getBoundingClientRect();
|
115
|
-
var updatedOffsetDifference = lowestColumnIndexFromSelectionArea < parseInt(headerIndex) ? offsetXValue + (headerButtonCoords.left - selectionAreaCoords.left) : offsetXValue;
|
116
|
-
var bodyContainer = document.querySelector(".".concat(blockClass, "__list--container")).firstElementChild;
|
117
|
-
var selectionAreaClonedElement = selectionAreaElement.cloneNode();
|
118
|
-
var reorderIndicatorLine = selectionAreaElement.cloneNode();
|
119
|
-
|
120
|
-
|
114
|
+
var lowestColumnIndexFromSelectionArea = Math.min((selectionAreaToClone === null || selectionAreaToClone === void 0 || (_selectionAreaToClone2 = selectionAreaToClone[0]) === null || _selectionAreaToClone2 === void 0 || (_selectionAreaToClone2 = _selectionAreaToClone2.point1) === null || _selectionAreaToClone2 === void 0 ? void 0 : _selectionAreaToClone2.column) || 0, (selectionAreaToClone === null || selectionAreaToClone === void 0 || (_selectionAreaToClone3 = selectionAreaToClone[0]) === null || _selectionAreaToClone3 === void 0 || (_selectionAreaToClone3 = _selectionAreaToClone3.point2) === null || _selectionAreaToClone3 === void 0 ? void 0 : _selectionAreaToClone3.column) || 0);
|
115
|
+
var selectionAreaCoords = (selectionAreaElement === null || selectionAreaElement === void 0 ? void 0 : selectionAreaElement.getBoundingClientRect()) || new DOMRect();
|
116
|
+
var updatedOffsetDifference = lowestColumnIndexFromSelectionArea < parseInt(headerIndex) ? offsetXValue + (headerButtonCoords.left - (selectionAreaCoords === null || selectionAreaCoords === void 0 ? void 0 : selectionAreaCoords.left)) : offsetXValue;
|
117
|
+
var bodyContainer = (_document = document) === null || _document === void 0 || (_document = _document.querySelector(".".concat(blockClass, "__list--container"))) === null || _document === void 0 ? void 0 : _document.firstElementChild;
|
118
|
+
var selectionAreaClonedElement = selectionAreaElement === null || selectionAreaElement === void 0 ? void 0 : selectionAreaElement.cloneNode();
|
119
|
+
var reorderIndicatorLine = selectionAreaElement === null || selectionAreaElement === void 0 ? void 0 : selectionAreaElement.cloneNode();
|
120
|
+
if (reorderIndicatorLine) {
|
121
|
+
reorderIndicatorLine.className = "".concat(blockClass, "__reorder-indicator-line");
|
122
|
+
reorderIndicatorLine.style.width = px(2);
|
123
|
+
}
|
121
124
|
selectionAreaClonedElement.classList.add("".concat(blockClass, "__selection-area--element-cloned"));
|
122
|
-
selectionAreaClonedElement.setAttribute('data-clone-offset-x', updatedOffsetDifference);
|
125
|
+
selectionAreaClonedElement.setAttribute('data-clone-offset-x', "".concat(updatedOffsetDifference));
|
123
126
|
selectionAreaClonedElement.setAttribute('data-column-index-original', index);
|
124
|
-
bodyContainer.appendChild(selectionAreaClonedElement);
|
125
|
-
bodyContainer.appendChild(reorderIndicatorLine);
|
126
|
-
setHeaderCellHoldActive(true);
|
127
|
+
bodyContainer === null || bodyContainer === void 0 || bodyContainer.appendChild(selectionAreaClonedElement);
|
128
|
+
bodyContainer === null || bodyContainer === void 0 || bodyContainer.appendChild(reorderIndicatorLine);
|
129
|
+
setHeaderCellHoldActive === null || setHeaderCellHoldActive === void 0 || setHeaderCellHoldActive(true);
|
127
130
|
};
|
128
131
|
};
|
129
132
|
useSpreadsheetMouseMove({
|
@@ -134,7 +137,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
134
137
|
return /*#__PURE__*/React__default.createElement("div", {
|
135
138
|
className: cx("".concat(blockClass, "__header--container")),
|
136
139
|
role: "rowgroup"
|
137
|
-
}, headerGroups.map(function (headerGroup, index) {
|
140
|
+
}, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(function (headerGroup, index) {
|
138
141
|
var headerProps = prepareProps(headerGroup.getHeaderGroupProps(), 'key');
|
139
142
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
140
143
|
key: "header_".concat(index)
|
@@ -146,6 +149,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
146
149
|
scrollBarSizeValue: scrollBarSizeValue,
|
147
150
|
totalVisibleColumns: totalVisibleColumns,
|
148
151
|
defaultColumn: defaultColumn,
|
152
|
+
totalColumnsWidth: undefined,
|
149
153
|
visibleColumns: visibleColumns
|
150
154
|
}),
|
151
155
|
overflow: 'hidden'
|
@@ -179,11 +183,11 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
179
183
|
"data-row-index": "header",
|
180
184
|
"data-column-index": index,
|
181
185
|
tabIndex: -1,
|
182
|
-
onMouseDown: selectedHeader ? handleHeaderMouseDown(index) :
|
186
|
+
onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
|
183
187
|
onMouseUp: selectedHeader ? function () {
|
184
188
|
return setSelectedHeaderReorderActive(false);
|
185
|
-
} :
|
186
|
-
onClick: !selectedHeader ? handleColumnHeaderClick(index) :
|
189
|
+
} : undefined,
|
190
|
+
onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
|
187
191
|
style: {
|
188
192
|
height: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
189
193
|
width: (column === null || column === void 0 ? void 0 : column.width) || (defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.width)
|
@@ -198,6 +202,7 @@ DataSpreadsheetHeader.propTypes = {
|
|
198
202
|
/**
|
199
203
|
* Object containing the active cell coordinates
|
200
204
|
*/
|
205
|
+
/**@ts-ignore */
|
201
206
|
activeCellCoordinates: PropTypes.shape({
|
202
207
|
row: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
203
208
|
column: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
@@ -217,6 +222,7 @@ DataSpreadsheetHeader.propTypes = {
|
|
217
222
|
/**
|
218
223
|
* Default spreadsheet sizing values
|
219
224
|
*/
|
225
|
+
/**@ts-ignore */
|
220
226
|
defaultColumn: PropTypes.shape({
|
221
227
|
rowHeight: PropTypes.number,
|
222
228
|
rowHeaderWidth: PropTypes.number,
|
@@ -233,6 +239,7 @@ DataSpreadsheetHeader.propTypes = {
|
|
233
239
|
/**
|
234
240
|
* All of the spreadsheet row data
|
235
241
|
*/
|
242
|
+
/**@ts-ignore */
|
236
243
|
rows: PropTypes.arrayOf(PropTypes.object),
|
237
244
|
/**
|
238
245
|
* The scrollbar width
|
@@ -245,6 +252,7 @@ DataSpreadsheetHeader.propTypes = {
|
|
245
252
|
/**
|
246
253
|
* All of the cell selection area items
|
247
254
|
*/
|
255
|
+
/**@ts-ignore */
|
248
256
|
selectionAreas: PropTypes.arrayOf(PropTypes.object),
|
249
257
|
/**
|
250
258
|
* Setter fn for activeCellCoordinates value
|
@@ -278,6 +286,7 @@ DataSpreadsheetHeader.propTypes = {
|
|
278
286
|
/**
|
279
287
|
* Array of visible columns provided by react-table useTable hook
|
280
288
|
*/
|
289
|
+
/**@ts-ignore */
|
281
290
|
visibleColumns: PropTypes.array
|
282
291
|
};
|
283
292
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export type Size = 'xs' | 'sm' | 'md' | 'lg';
|
2
|
+
export type Theme = 'light' | 'dark';
|
3
|
+
export interface Column {
|
4
|
+
Header?: string;
|
5
|
+
accessor?: string | (() => void);
|
6
|
+
Cell?: () => void;
|
7
|
+
rowHeight?: number;
|
8
|
+
rowHeaderWidth?: number;
|
9
|
+
width?: number;
|
10
|
+
}
|
11
|
+
export interface ActiveCellCoordinates {
|
12
|
+
row?: number | string;
|
13
|
+
column?: number | string;
|
14
|
+
}
|
15
|
+
export interface PrevState {
|
16
|
+
activeCellCoordinates?: ActiveCellCoordinates;
|
17
|
+
isEditing?: boolean;
|
18
|
+
selectionAreaData?: object[];
|
19
|
+
clickAndHoldActive?: boolean;
|
20
|
+
rowHeight?: number;
|
21
|
+
cellSize?: Size;
|
22
|
+
}
|
23
|
+
export interface Point {
|
24
|
+
column?: number;
|
25
|
+
}
|
26
|
+
export interface ItemType {
|
27
|
+
matcher?: string;
|
28
|
+
point1?: Point;
|
29
|
+
point2?: Point;
|
30
|
+
}
|
@@ -0,0 +1,82 @@
|
|
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 { extends as _extends, objectDestructuringEmpty as _objectDestructuringEmpty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default from 'react';
|
10
|
+
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
12
|
+
import { pkg } from '../../settings.js';
|
13
|
+
import { Card } from '../Card/Card.js';
|
14
|
+
|
15
|
+
var componentName = 'GetStartedCard';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* GetStartedCard a card with icon, number, and media variants
|
19
|
+
*/
|
20
|
+
var GetStartedCard = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
21
|
+
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
22
|
+
return /*#__PURE__*/React__default.createElement(Card, _extends({
|
23
|
+
getStarted: true,
|
24
|
+
ref: ref
|
25
|
+
}, rest, getDevtoolsProps(componentName)));
|
26
|
+
});
|
27
|
+
|
28
|
+
// Return a placeholder if not released and not enabled by feature flag
|
29
|
+
GetStartedCard = pkg.checkComponentEnabled(GetStartedCard, componentName);
|
30
|
+
GetStartedCard.displayName = componentName;
|
31
|
+
GetStartedCard.propTypes = {
|
32
|
+
/**
|
33
|
+
* Provide an optional class to be applied to the containing node.
|
34
|
+
*/
|
35
|
+
className: PropTypes.string,
|
36
|
+
/**
|
37
|
+
* Optional if the card should be disabled
|
38
|
+
*/
|
39
|
+
disabled: PropTypes.bool,
|
40
|
+
/**
|
41
|
+
* Provides the action icon that's displayed at the footer of the card
|
42
|
+
*/
|
43
|
+
footerActionIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
44
|
+
/**
|
45
|
+
* Optional label for the top of the card
|
46
|
+
*/
|
47
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node]),
|
48
|
+
/**
|
49
|
+
* Optional media content like an image to be placed in the card
|
50
|
+
*/
|
51
|
+
media: PropTypes.node,
|
52
|
+
/**
|
53
|
+
* Icons that are displayed on the card showing the time and skill needed
|
54
|
+
*/
|
55
|
+
metadata: PropTypes.arrayOf(PropTypes.shape({
|
56
|
+
id: PropTypes.string,
|
57
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
58
|
+
iconDescription: PropTypes.string
|
59
|
+
})),
|
60
|
+
/**
|
61
|
+
* Provides the callback for a clickable card
|
62
|
+
*/
|
63
|
+
onClick: PropTypes.func.isRequired,
|
64
|
+
/**
|
65
|
+
* Provides the icon that's displayed at the top of the card
|
66
|
+
*/
|
67
|
+
pictogram: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
68
|
+
/**
|
69
|
+
* Provides number for card for tasks in a sequential order
|
70
|
+
*/
|
71
|
+
sequence: PropTypes.number,
|
72
|
+
/**
|
73
|
+
* Provides the status that's displayed at the top of the card
|
74
|
+
*/
|
75
|
+
status: PropTypes.oneOf(['complete', 'incomplete']),
|
76
|
+
/**
|
77
|
+
* Title that's displayed at the top of the card
|
78
|
+
*/
|
79
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node])
|
80
|
+
};
|
81
|
+
|
82
|
+
export { GetStartedCard };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { GetStartedCard } from "./GetStartedCard";
|
@@ -77,7 +77,6 @@ var Guidebanner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
77
77
|
});
|
78
78
|
};
|
79
79
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
80
|
-
"aria-expanded": !isCollapsed,
|
81
80
|
className: cx(blockClass, className, collapsible && "".concat(blockClass, "__collapsible"), isCollapsed && "".concat(blockClass, "__collapsible-collapsed"), withLeftGutter && "".concat(blockClass, "__with-left-gutter")),
|
82
81
|
ref: ref
|
83
82
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement(Idea, {
|
@@ -108,7 +107,8 @@ var Guidebanner = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
108
107
|
size: "md",
|
109
108
|
className: "".concat(blockClass, "__toggle-button"),
|
110
109
|
onClick: handleClickToggle,
|
111
|
-
ref: toggleRef
|
110
|
+
ref: toggleRef,
|
111
|
+
"aria-expanded": !isCollapsed
|
112
112
|
}, isCollapsed ? expandButtonLabel : collapseButtonLabel), showNavigation && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
113
113
|
className: cx("".concat(blockClass, "__back-button"), [scrollPosition === 0 ? "".concat(blockClass, "__back-button--disabled") : null])
|
114
114
|
}, /*#__PURE__*/React__default.createElement(IconButton, {
|