@carbon/ibm-products 1.61.1 → 1.62.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/css/index-full-carbon.css +156 -68
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +1753 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +156 -68
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +156 -68
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Coachmark/Coachmark.js +17 -5
  18. package/es/components/Coachmark/CoachmarkDragbar.js +12 -5
  19. package/es/components/Coachmark/CoachmarkHeader.js +2 -1
  20. package/es/components/Coachmark/CoachmarkOverlay.js +105 -9
  21. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
  22. package/es/components/CoachmarkFixed/CoachmarkFixed.js +26 -6
  23. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
  24. package/es/components/CoachmarkStack/CoachmarkStack.js +19 -4
  25. package/es/components/CoachmarkStack/CoachmarkStackHome.js +45 -11
  26. package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
  27. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
  28. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -25
  29. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
  30. package/es/components/Datagrid/Datagrid/DatagridRow.js +5 -2
  31. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
  32. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
  33. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
  34. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
  35. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +50 -14
  36. package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
  37. package/es/components/Datagrid/useActionsColumn.js +9 -9
  38. package/es/components/Datagrid/useDatagrid.js +13 -1
  39. package/es/components/Datagrid/useFlexResize.js +19 -9
  40. package/es/components/Datagrid/useInfiniteScroll.js +10 -9
  41. package/es/components/Datagrid/useOnRowClick.js +6 -7
  42. package/es/components/Datagrid/useParentDimensions.js +6 -6
  43. package/es/components/Datagrid/useResizeTable.js +7 -7
  44. package/es/components/Datagrid/useSelectAllToggle.js +2 -2
  45. package/es/components/Datagrid/useSelectRows.js +31 -21
  46. package/es/components/Datagrid/useSkeletonRows.js +6 -6
  47. package/es/components/Datagrid/useSortableColumns.js +4 -5
  48. package/es/components/Datagrid/useStickyColumn.js +13 -6
  49. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
  50. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
  51. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
  52. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
  53. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
  54. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
  55. package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -4
  56. package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -4
  57. package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
  58. package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
  59. package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
  60. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
  61. package/es/global/js/hooks/index.js +3 -2
  62. package/es/global/js/hooks/usePrefix.js +11 -0
  63. package/es/global/js/package-settings.js +1 -2
  64. package/lib/components/Coachmark/Coachmark.js +16 -4
  65. package/lib/components/Coachmark/CoachmarkDragbar.js +12 -5
  66. package/lib/components/Coachmark/CoachmarkHeader.js +2 -1
  67. package/lib/components/Coachmark/CoachmarkOverlay.js +105 -8
  68. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
  69. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +25 -5
  70. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +28 -3
  71. package/lib/components/CoachmarkStack/CoachmarkStack.js +18 -3
  72. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +44 -10
  73. package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
  74. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
  75. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -32
  76. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
  77. package/lib/components/Datagrid/Datagrid/DatagridRow.js +5 -2
  78. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +6 -4
  79. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
  80. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +29 -23
  81. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
  82. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +52 -15
  83. package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
  84. package/lib/components/Datagrid/useActionsColumn.js +9 -12
  85. package/lib/components/Datagrid/useDatagrid.js +13 -1
  86. package/lib/components/Datagrid/useFlexResize.js +19 -9
  87. package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
  88. package/lib/components/Datagrid/useOnRowClick.js +6 -7
  89. package/lib/components/Datagrid/useParentDimensions.js +5 -6
  90. package/lib/components/Datagrid/useResizeTable.js +6 -7
  91. package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
  92. package/lib/components/Datagrid/useSelectRows.js +31 -21
  93. package/lib/components/Datagrid/useSkeletonRows.js +6 -6
  94. package/lib/components/Datagrid/useSortableColumns.js +4 -5
  95. package/lib/components/Datagrid/useStickyColumn.js +8 -0
  96. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
  97. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
  98. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
  99. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
  100. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
  101. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
  102. package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -4
  103. package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -4
  104. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
  105. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
  106. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
  107. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
  108. package/lib/global/js/hooks/index.js +8 -1
  109. package/lib/global/js/hooks/usePrefix.js +19 -0
  110. package/lib/global/js/package-settings.js +1 -2
  111. package/package.json +2 -2
  112. package/scss/components/Checklist/_checklist.scss +13 -25
  113. package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +1 -45
  114. package/scss/components/Coachmark/styles/_coachmark-header.scss +0 -33
  115. package/scss/components/Coachmark/styles/_coachmark-overlay.scss +113 -5
  116. package/scss/components/Coachmark/styles/_coachmark-tagline.scss +18 -0
  117. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +19 -1
  118. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +2 -0
  119. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
  120. package/scss/components/CoachmarkStack/_coachmark-stack.scss +3 -0
  121. package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
  122. package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
  123. package/scss/components/_index-released-only.scss +1 -0
@@ -12,15 +12,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  * LICENSE file in the root directory of this source tree.
13
13
  */
14
14
 
15
- import React, { useEffect } from 'react';
15
+ import React from 'react';
16
16
  import cx from 'classnames';
17
17
  import { IconSkeleton, OverflowMenu, OverflowMenuItem } from 'carbon-components-react';
18
18
  import { pkg } from '../../settings';
19
19
  var blockClass = "".concat(pkg.prefix, "--datagrid");
20
20
  var useActionsColumn = function useActionsColumn(hooks) {
21
- useEffect(function () {
22
- pkg.checkReportFeatureEnabled('Datagrid.useActionsColumn');
23
- }, []);
24
21
  var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
25
22
  var rowActions = instance.rowActions,
26
23
  isFetching = instance.isFetching,
@@ -41,12 +38,13 @@ var useActionsColumn = function useActionsColumn(hooks) {
41
38
  column = cell.column;
42
39
  if (column.isAction) {
43
40
  var _cx3;
41
+ var isColumnSticky = !!column.sticky;
44
42
  return [props, {
45
43
  children: /*#__PURE__*/React.createElement("div", {
46
44
  className: "".concat(blockClass, "__actions-column-contents")
47
45
  }, isFetching && /*#__PURE__*/React.createElement(IconSkeleton, {
48
46
  className: "".concat(blockClass, "__actions-column-loading")
49
- }), !isFetching && rowActions.length <= 2 && /*#__PURE__*/React.createElement("div", {
47
+ }), !isFetching && rowActions.length <= 2 && !isColumnSticky && /*#__PURE__*/React.createElement("div", {
50
48
  className: "".concat(blockClass, "_actions-column"),
51
49
  style: {
52
50
  display: 'flex'
@@ -70,6 +68,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
70
68
  hasIconOnly: true,
71
69
  light: true,
72
70
  iconDescription: itemText,
71
+ ariaLabel: itemText,
73
72
  kind: "ghost",
74
73
  className: cx(_defineProperty({}, "".concat(blockClass, "__disabled-row-action"), getDisabledState(row.index))),
75
74
  onClick: function onClick(e) {
@@ -81,7 +80,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
81
80
  _onClick(id, row, e);
82
81
  }
83
82
  })));
84
- })), !isFetching && rowActions.length > 2 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(OverflowMenu, {
83
+ })), !isFetching && (rowActions.length > 2 || isColumnSticky) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(OverflowMenu, {
85
84
  size: "sm",
86
85
  light: true,
87
86
  flipped: true,
@@ -111,9 +110,9 @@ var useActionsColumn = function useActionsColumn(hooks) {
111
110
  key: id
112
111
  }));
113
112
  })))),
114
- className: cx((_cx3 = {}, _defineProperty(_cx3, "".concat(blockClass, "__actions-column-cell"), true), _defineProperty(_cx3, "".concat(blockClass, "__cell"), true), _cx3)),
113
+ className: cx((_cx3 = {}, _defineProperty(_cx3, "".concat(blockClass, "__actions-column-cell"), true), _defineProperty(_cx3, "".concat(blockClass, "__cell"), true), _defineProperty(_cx3, "".concat(blockClass, "__actions-column-cell-non-sticky"), !isColumnSticky), _cx3)),
115
114
  style: {
116
- width: rowActions.length > 2 ? 48 : 96
115
+ width: rowActions.length > 2 || isColumnSticky ? 48 : 96
117
116
  }
118
117
  }];
119
118
  }
@@ -128,9 +127,10 @@ var useActionsColumn = function useActionsColumn(hooks) {
128
127
  var addHeaderWidth = function addHeaderWidth(props, cellData) {
129
128
  var column = cellData.column;
130
129
  if (column.isAction) {
130
+ var isColumnSticky = !!column.sticky;
131
131
  return [props, {
132
132
  style: _objectSpread(_objectSpread({}, props.style), {}, {
133
- width: rowActions.length > 2 ? 48 : 96 // set header width based on action length
133
+ width: rowActions.length > 2 || isColumnSticky ? 48 : 96 // set header width based on action length
134
134
  })
135
135
  }];
136
136
  }
@@ -22,8 +22,19 @@ import useFloatingScroll from './useFloatingScroll';
22
22
  import { stateReducer } from './Datagrid/addons/stateReducer';
23
23
  var useDatagrid = function useDatagrid(params) {
24
24
  var defaultPlugins = [useFlexLayout, useHeaderRow, useSkeletonRows, useResizeColumns, useRowRenderer, useDefaultStringRenderer, useRowSize, useFilters, useGlobalFilter, useSortBy, useExpanded];
25
+
26
+ // Disable resizing
27
+ if (params.disableResizing) {
28
+ var resizeIndex = defaultPlugins.findIndex(function (p) {
29
+ return p.pluginName === 'useResizeColumns';
30
+ });
31
+ defaultPlugins.splice(resizeIndex, 1);
32
+ }
25
33
  var defaultEndPlugins = [usePagination, useRowSelect, useFlexResize, useFloatingScroll];
26
34
  var clientEndPlugins = params.endPlugins || [];
35
+ var defaultColumn = {
36
+ minWidth: 50
37
+ };
27
38
  var tableId = useMemo(function () {
28
39
  return uniqueId('datagrid-table-id');
29
40
  }, []);
@@ -33,7 +44,8 @@ var useDatagrid = function useDatagrid(params) {
33
44
  var tableState = useTable.apply(void 0, [_objectSpread(_objectSpread({
34
45
  tableId: tableId
35
46
  }, params), {}, {
36
- stateReducer: stateReducer
47
+ stateReducer: stateReducer,
48
+ defaultColumn: defaultColumn
37
49
  })].concat(defaultPlugins, plugins, defaultEndPlugins, _toConsumableArray(clientEndPlugins)));
38
50
  return tableState;
39
51
  };
@@ -1,27 +1,37 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- /*
3
- * Licensed Materials - Property of IBM
4
- * 5724-Q36
5
- * (c) Copyright IBM Corp. 2020
6
- * US Government Users Restricted Rights - Use, duplication or disclosure
7
- * restricted by GSA ADP Schedule Contract with IBM Corp.
2
+ /**
3
+ * Copyright IBM Corp. 2020, 2023
4
+ *
5
+ * This source code is licensed under the Apache-2.0 license found in the
6
+ * LICENSE file in the root directory of this source tree.
8
7
  */
8
+
9
9
  var useFlexResize = function useFlexResize(hooks) {
10
- var spacerColumn = {
10
+ var spacer = {
11
11
  id: 'spacer',
12
12
  width: 0,
13
13
  disableSortBy: true,
14
14
  disableResizing: true
15
15
  };
16
16
  hooks.visibleColumns.push(function (columns) {
17
- return [].concat(_toConsumableArray(columns), [spacerColumn]);
17
+ // always move actions and spacer to the end
18
+ var actionsIdx = columns.findIndex(function (col) {
19
+ return col.isAction;
20
+ });
21
+ if (actionsIdx === -1) {
22
+ return [].concat(_toConsumableArray(columns), [spacer]);
23
+ }
24
+ var cols = _toConsumableArray(columns);
25
+ var actions = cols.splice(actionsIdx, 1)[0];
26
+ cols.splice(columns.length, 0, spacer, actions);
27
+ return cols;
18
28
  });
19
29
  var changeProps = function changeProps(props, data) {
20
30
  var column = data.column;
21
31
  if (!column && data.cell) {
22
32
  column = data.cell.column;
23
33
  }
24
- if (column.id === spacerColumn.id) {
34
+ if (column.id === spacer.id) {
25
35
  return [props, {
26
36
  style: {
27
37
  flex: '1 1 0'
@@ -1,10 +1,10 @@
1
- /*
2
- * Licensed Materials - Property of IBM
3
- * 5724-Q36
4
- * (c) Copyright IBM Corp. 2020
5
- * US Government Users Restricted Rights - Use, duplication or disclosure
6
- * restricted by GSA ADP Schedule Contract with IBM Corp.
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
7
6
  */
7
+
8
8
  import { useCallback } from 'react';
9
9
  import debounce from 'lodash/debounce';
10
10
  import useParentDimensions from './useParentDimensions';
@@ -17,10 +17,11 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
17
17
  tableHeight = instance.tableHeight,
18
18
  innerListRef = instance.innerListRef,
19
19
  fetchMoreData = instance.fetchMoreData,
20
- tableId = instance.tableId;
20
+ tableId = instance.tableId,
21
+ loadMoreThreshold = instance.loadMoreThreshold;
21
22
  var tableElement = document.querySelector("#".concat(tableId));
22
23
  var totalTableHeight = tableHeight || (tableElement === null || tableElement === void 0 ? void 0 : tableElement.clientHeight);
23
- var loadMoreThreshold = 200;
24
+ var loadMoreThresholdValue = typeof loadMoreThreshold === 'number' ? loadMoreThreshold : 200;
24
25
  var emptyFetchData = function emptyFetchData() {};
25
26
  // eslint-disable-next-line react-hooks/exhaustive-deps
26
27
  var fetchMore = useCallback(debounce(fetchMoreData || emptyFetchData, 3000, {
@@ -31,7 +32,7 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
31
32
  var scrollDirection = _ref.scrollDirection,
32
33
  scrollOffset = _ref.scrollOffset;
33
34
  if (innerListRef && innerListRef.current) {
34
- if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThreshold) {
35
+ if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThresholdValue) {
35
36
  if (fetchMoreData) {
36
37
  fetchMore();
37
38
  }
@@ -1,9 +1,8 @@
1
- /*
2
- * Licensed Materials - Property of IBM
3
- * 5724-Q36
4
- * (c) Copyright IBM Corp. 2020, 2023
5
- * US Government Users Restricted Rights - Use, duplication or disclosure
6
- * restricted by GSA ADP Schedule Contract with IBM Corp.
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
7
6
  */
8
7
 
9
8
  import { pkg, carbon } from '../../settings';
@@ -43,7 +42,7 @@ var useOnRowClick = function useOnRowClick(hooks) {
43
42
  var onKeyDown = function onKeyDown(event) {
44
43
  var key = event.key;
45
44
  if (key === 'Enter') {
46
- onClick();
45
+ onClick(event);
47
46
  }
48
47
  };
49
48
  return [props, {
@@ -1,11 +1,11 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- /*
3
- * Licensed Materials - Property of IBM
4
- * 5724-Q36
5
- * (c) Copyright IBM Corp. 2020
6
- * US Government Users Restricted Rights - Use, duplication or disclosure
7
- * restricted by GSA ADP Schedule Contract with IBM Corp.
2
+ /**
3
+ * Copyright IBM Corp. 2020, 2023
4
+ *
5
+ * This source code is licensed under the Apache-2.0 license found in the
6
+ * LICENSE file in the root directory of this source tree.
8
7
  */
8
+
9
9
  import { useRef, useState } from 'react';
10
10
  var useParentDimensions = function useParentDimensions(hooks) {
11
11
  var rootRef = useRef();
@@ -1,10 +1,10 @@
1
- /*
2
- * Licensed Materials - Property of IBM
3
- * 5724-Q36
4
- * (c) Copyright IBM Corp. 2020
5
- * US Government Users Restricted Rights - Use, duplication or disclosure
6
- * restricted by GSA ADP Schedule Contract with IBM Corp.
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
7
6
  */
7
+
8
8
  import { useLayoutEffect } from 'react';
9
9
  var useResizeTable = function useResizeTable(hooks) {
10
10
  var useInstanceBeforeDimensions = function useInstanceBeforeDimensions(instance) {
@@ -26,7 +26,7 @@ var useResizeTable = function useResizeTable(hooks) {
26
26
  resizeObserver = null;
27
27
  };
28
28
  }
29
- return console.error(' Could not resize table, no support for ResizeObserver');
29
+ return console.error('Could not resize table, no support for ResizeObserver');
30
30
  }, [handleResize, parent]);
31
31
  };
32
32
  hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
@@ -13,7 +13,7 @@ import cx from 'classnames';
13
13
  import { selectionColumnId } from './common-column-ids';
14
14
  import SelectAllWithToggle from './Datagrid/DatagridSelectAllWithToggle';
15
15
  import { pkg } from '../../settings';
16
- var blockClass = "".concat(pkg.prefix, "--datagrid");
16
+ var blockClass = "".concat(pkg.prefix, "--datagrid__select-all");
17
17
  var useSelectAllToggle = function useSelectAllToggle(hooks) {
18
18
  useSelectAllWithToggleComponent(hooks);
19
19
  useAddClassNameToSelectRow(hooks);
@@ -60,7 +60,7 @@ var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
60
60
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
61
61
  if (column.id === selectionColumnId && DatagridPagination) {
62
62
  return [props, {
63
- className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
63
+ className: cx(["".concat(blockClass, "-toggle-on"), _defineProperty({}, "".concat(blockClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)])
64
64
  }];
65
65
  }
66
66
  return [props];
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- var _excluded = ["onChange"];
6
+ var _excluded = ["onChange", "title"];
7
7
  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
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
9
  /*
@@ -20,7 +20,9 @@ import { TableSelectRow } from 'carbon-components-react';
20
20
  import { SelectAll } from './Datagrid/DatagridSelectAll';
21
21
  import { selectionColumnId } from './common-column-ids';
22
22
  import { pkg, carbon } from '../../settings';
23
+ import { handleToggleRowSelected } from './Datagrid/addons/stateReducer';
23
24
  var blockClass = "".concat(pkg.prefix, "--datagrid");
25
+ var checkboxClass = "".concat(blockClass, "__checkbox-cell");
24
26
  var useSelectRows = function useSelectRows(hooks) {
25
27
  useHighlightSelection(hooks);
26
28
  var useInstance = function useInstance(instance) {
@@ -54,9 +56,12 @@ var useSelectRows = function useSelectRows(hooks) {
54
56
  };
55
57
  var useHighlightSelection = function useHighlightSelection(hooks) {
56
58
  var getRowProps = function getRowProps(props, _ref) {
59
+ var _ref2;
57
60
  var row = _ref.row;
61
+ var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
62
+ checked = _row$getToggleRowSele.checked;
58
63
  return [props, {
59
- className: cx("".concat(blockClass, "__carbon-row"), row.getToggleRowSelectedProps().checked ? "".concat(carbon.prefix, "--data-table--selected ").concat(blockClass, "__active-row") : '')
64
+ className: cx(["".concat(blockClass, "__carbon-row"), (_ref2 = {}, _defineProperty(_ref2, "".concat(carbon.prefix, "--data-table--selected"), checked), _defineProperty(_ref2, "".concat(blockClass, "__active-row"), checked), _ref2)])
60
65
  }];
61
66
  };
62
67
  hooks.getRowProps.push(getRowProps);
@@ -73,7 +78,8 @@ var SelectRow = function SelectRow(datagridState) {
73
78
  onRadioSelect = datagridState.onRadioSelect,
74
79
  onRowSelect = datagridState.onRowSelect,
75
80
  columns = datagridState.columns,
76
- withStickyColumn = datagridState.withStickyColumn;
81
+ withStickyColumn = datagridState.withStickyColumn,
82
+ dispatch = datagridState.dispatch;
77
83
  var _useState = useState(window.innerWidth),
78
84
  _useState2 = _slicedToArray(_useState, 2),
79
85
  windowSize = _useState2[0],
@@ -88,28 +94,32 @@ var SelectRow = function SelectRow(datagridState) {
88
94
  };
89
95
  }, []);
90
96
  var selectDisabled = isFetching || row.getRowProps().selectDisabled;
91
- var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
92
- onChange = _row$getToggleRowSele.onChange,
93
- selectProps = _objectWithoutProperties(_row$getToggleRowSele, _excluded);
97
+ var _row$getToggleRowSele2 = row.getToggleRowSelectedProps(),
98
+ onChange = _row$getToggleRowSele2.onChange,
99
+ title = _row$getToggleRowSele2.title,
100
+ selectProps = _objectWithoutProperties(_row$getToggleRowSele2, _excluded);
94
101
  var cellProps = cell.getCellProps();
95
102
  var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
103
+ var onSelectHandler = function onSelectHandler(event) {
104
+ event.stopPropagation(); // avoid triggering onRowClick
105
+ if (radio) {
106
+ toggleAllRowsSelected(false);
107
+ if (onRadioSelect) {
108
+ onRadioSelect(row);
109
+ }
110
+ }
111
+ onChange(event);
112
+ onRowSelect === null || onRowSelect === void 0 ? void 0 : onRowSelect(row, event);
113
+ handleToggleRowSelected(dispatch, row, event.target.checked);
114
+ };
115
+ var rowId = "".concat(tableId, "-").concat(row.index);
96
116
  return /*#__PURE__*/React.createElement(TableSelectRow, _extends({}, cellProps, selectProps, {
97
117
  radio: radio,
98
- onSelect: function onSelect(e) {
99
- e.stopPropagation(); // avoid triggering onRowClick
100
- if (radio) {
101
- toggleAllRowsSelected(false);
102
- if (onRadioSelect) {
103
- onRadioSelect(row);
104
- }
105
- }
106
- onChange(e);
107
- onRowSelect === null || onRowSelect === void 0 ? void 0 : onRowSelect(row, e);
108
- },
109
- id: "".concat(tableId, "-").concat(row.index),
110
- name: "".concat(tableId, "-").concat(row.index, "-name"),
111
- className: cx("".concat(blockClass, "__checkbox-cell"), cellProps.className, _defineProperty({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)),
112
- ariaLabel: "".concat(tableId, "-row-").concat(row.index) // TODO: aria label should be i18n'ed
118
+ onSelect: onSelectHandler,
119
+ id: rowId,
120
+ name: "".concat(rowId, "-name"),
121
+ className: cx(["".concat(checkboxClass, "__checkbox-cell"), cellProps.className, _defineProperty({}, "".concat(checkboxClass, "-sticky-left"), isFirstColumnStickyLeft && windowSize > 671)]),
122
+ ariaLabel: title // TODO: aria label should be i18n'ed
113
123
  ,
114
124
  disabled: selectDisabled
115
125
  }));
@@ -1,11 +1,11 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- /*
3
- * Licensed Materials - Property of IBM
4
- * 5724-Q36
5
- * (c) Copyright IBM Corp. 2020
6
- * US Government Users Restricted Rights - Use, duplication or disclosure
7
- * restricted by GSA ADP Schedule Contract with IBM Corp.
2
+ /**
3
+ * Copyright IBM Corp. 2020, 2023
4
+ *
5
+ * This source code is licensed under the Apache-2.0 license found in the
6
+ * LICENSE file in the root directory of this source tree.
8
7
  */
8
+
9
9
  var useSkeletons = function useSkeletons(hooks) {
10
10
  var useInstance = function useInstance(instance) {
11
11
  var isFetching = instance.isFetching,
@@ -28,9 +28,8 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
28
28
  if (!col) {
29
29
  return;
30
30
  }
31
- var _ref2 = col || {},
32
- isSorted = _ref2.isSorted,
33
- isSortedDesc = _ref2.isSortedDesc;
31
+ var isSorted = col.isSorted,
32
+ isSortedDesc = col.isSortedDesc;
34
33
  if (!isSorted) {
35
34
  return defaultSortableLabelText;
36
35
  }
@@ -42,9 +41,9 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
42
41
  }
43
42
  };
44
43
  var useSortableColumns = function useSortableColumns(hooks) {
45
- var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref3) {
44
+ var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref2) {
46
45
  var _instance$customizeCo;
47
- var instance = _ref3.instance;
46
+ var instance = _ref2.instance;
48
47
  var onSort = instance.onSort,
49
48
  ascendingSortableLabelText = instance.ascendingSortableLabelText,
50
49
  descendingSortableLabelText = instance.descendingSortableLabelText,
@@ -2,12 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  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; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- /*
6
- * Licensed Materials - Property of IBM
7
- * 5724-Q36
8
- * (c) Copyright IBM Corp. 2021
9
- * US Government Users Restricted Rights - Use, duplication or disclosure
10
- * restricted by GSA ADP Schedule Contract with IBM Corp.
5
+ /**
6
+ * Copyright IBM Corp. 2021, 2023
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
11
10
  */
12
11
 
13
12
  import { useEffect, useRef, useLayoutEffect, useState } from 'react';
@@ -29,9 +28,11 @@ var useStickyColumn = function useStickyColumn(hooks) {
29
28
  setWindowSize(window.innerWidth);
30
29
  }, []);
31
30
  useLayoutEffect(function () {
31
+ /* istanbul ignore next */
32
32
  function updateSize() {
33
33
  setWindowSize(window.innerWidth);
34
34
  }
35
+ /* istanbul ignore next */
35
36
  window.addEventListener('resize', updateSize);
36
37
  return function () {
37
38
  return window.removeEventListener('resize', updateSize);
@@ -52,14 +53,17 @@ var useStickyColumn = function useStickyColumn(hooks) {
52
53
  useEffect(function () {
53
54
  var tableBodyElement = tableBodyRef.current;
54
55
  var headerCellElement = stickyHeaderCellRef.current;
56
+ /* istanbul ignore next */
55
57
  if (hasVertScroll(tableBodyElement) && headerCellElement) {
56
58
  headerCellElement.classList.add(OFFSET_SCROLL_CLASS);
57
59
  }
58
60
  var boundListener = debounce(onBodyResize.bind(null, tableBodyElement, headerCellElement), 250);
61
+ /* istanbul ignore next */
59
62
  if (typeof window !== 'undefined') {
60
63
  window.addEventListener('resize', boundListener);
61
64
  }
62
65
  return function () {
66
+ /* istanbul ignore next */
63
67
  if (typeof window !== 'undefined') {
64
68
  window.removeEventListener('resize', boundListener);
65
69
  }
@@ -158,6 +162,7 @@ var changeProps = function changeProps(elementName, headerCellRef, windowSize, p
158
162
  };
159
163
  var onBodyResize = function onBodyResize(tableBodyEle, headerCellEle) {
160
164
  if (headerCellEle) {
165
+ /* istanbul ignore next */
161
166
  if (hasVertScroll(tableBodyEle)) {
162
167
  headerCellEle.classList.add(OFFSET_SCROLL_CLASS);
163
168
  } else {
@@ -167,6 +172,7 @@ var onBodyResize = function onBodyResize(tableBodyEle, headerCellEle) {
167
172
  }
168
173
  };
169
174
  var toggleStickyShadow = function toggleStickyShadow(tableBodyEle, headerCellEle) {
175
+ /* istanbul ignore next */
170
176
  if (tableBodyEle && headerCellEle) {
171
177
  var isScrolledToRight = tableBodyEle.scrollLeft + tableBodyEle.clientWidth === tableBodyEle.scrollWidth;
172
178
  if (isScrolledToRight) {
@@ -179,6 +185,7 @@ var toggleStickyShadow = function toggleStickyShadow(tableBodyEle, headerCellEle
179
185
  }
180
186
  };
181
187
  var hasVertScroll = function hasVertScroll(element) {
188
+ /* istanbul ignore next */
182
189
  if (!element) {
183
190
  return false;
184
191
  }
@@ -41,6 +41,7 @@ export var ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
41
  className: cx(blockClass, className, "".concat(blockClass, "-type--error")),
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ErrorIllustration, {
44
+ title: title,
44
45
  theme: illustrationTheme,
45
46
  size: size
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
@@ -41,6 +41,7 @@ export var NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
41
  className: cx(blockClass, className, "".concat(blockClass, "-type--noData")),
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoDataIllustration, {
44
+ title: title,
44
45
  theme: illustrationTheme,
45
46
  size: size
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
@@ -41,6 +41,7 @@ export var NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
41
  className: cx(blockClass, className, "".concat(blockClass, "-type--noTags")),
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoTagsIllustration, {
44
+ title: title,
44
45
  theme: illustrationTheme,
45
46
  size: size
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
@@ -41,6 +41,7 @@ export var NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, re
41
41
  className: cx(blockClass, className, "".concat(blockClass, "-type--notFound")),
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotFoundIllustration, {
44
+ title: title,
44
45
  theme: illustrationTheme,
45
46
  size: size
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
@@ -42,6 +42,7 @@ export var NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_re
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotificationsIllustration, {
44
44
  size: size,
45
+ title: title,
45
46
  theme: illustrationTheme
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
47
48
  action: action,
@@ -42,6 +42,7 @@ export var UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref
42
42
  ref: ref
43
43
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(UnauthorizedIllustration, {
44
44
  size: size,
45
+ title: title,
45
46
  theme: illustrationTheme
46
47
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
47
48
  action: action,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["theme", "size"];
3
+ var _excluded = ["title", "theme", "size"];
4
4
  /**
5
5
  * Copyright IBM Corp. 2020, 2021
6
6
  *
@@ -20,7 +20,8 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
20
20
  // The block part of our conventional BEM class names (blockClass__E--M).
21
21
  var blockClass = "".concat(pkg.prefix, "--empty-state");
22
22
  export var ErrorIllustration = function ErrorIllustration(_ref) {
23
- var theme = _ref.theme,
23
+ var title = _ref.title,
24
+ theme = _ref.theme,
24
25
  size = _ref.size,
25
26
  rest = _objectWithoutProperties(_ref, _excluded);
26
27
  var svgId = uuidv4();
@@ -31,7 +32,7 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
31
32
  viewBox: "0 0 80 80",
32
33
  className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-error"), "".concat(blockClass, "__illustration--").concat(size)]),
33
34
  role: "img"
34
- }), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
35
+ }), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
35
36
  id: "prefix__a_dark_".concat(svgId),
36
37
  x1: 38.9,
37
38
  y1: 77.08,
@@ -209,5 +210,6 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
209
210
  };
210
211
  ErrorIllustration.propTypes = {
211
212
  size: PropTypes.oneOf(['lg', 'sm']),
212
- theme: PropTypes.oneOf(['light', 'dark'])
213
+ theme: PropTypes.oneOf(['light', 'dark']),
214
+ title: PropTypes.string
213
215
  };
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["theme", "size"];
3
+ var _excluded = ["title", "theme", "size"];
4
4
  /**
5
5
  * Copyright IBM Corp. 2020, 2021
6
6
  *
@@ -20,7 +20,8 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
20
20
  // The block part of our conventional BEM class names (blockClass__E--M).
21
21
  var blockClass = "".concat(pkg.prefix, "--empty-state");
22
22
  export var NoDataIllustration = function NoDataIllustration(_ref) {
23
- var theme = _ref.theme,
23
+ var title = _ref.title,
24
+ theme = _ref.theme,
24
25
  size = _ref.size,
25
26
  rest = _objectWithoutProperties(_ref, _excluded);
26
27
  var svgId = uuidv4();
@@ -31,7 +32,7 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
31
32
  viewBox: "0 0 80 80",
32
33
  className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noData"), "".concat(blockClass, "__illustration--").concat(size)]),
33
34
  role: "img"
34
- }), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
35
+ }), /*#__PURE__*/React.createElement("title", null, title), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
35
36
  id: "prefix__a_dark_".concat(svgId),
36
37
  x1: 11.12,
37
38
  y1: 43.34,
@@ -172,5 +173,6 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
172
173
  };
173
174
  NoDataIllustration.propTypes = {
174
175
  size: PropTypes.oneOf(['lg', 'sm']),
175
- theme: PropTypes.oneOf(['light', 'dark'])
176
+ theme: PropTypes.oneOf(['light', 'dark']),
177
+ title: PropTypes.string
176
178
  };