@carbon/ibm-products 1.69.0 → 1.71.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/README.md +8 -4
  2. package/css/index-full-carbon.css +17 -12
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +4 -4
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon-released-only.css +16 -12
  7. package/css/index-without-carbon-released-only.css.map +1 -1
  8. package/css/index-without-carbon-released-only.min.css +3 -3
  9. package/css/index-without-carbon-released-only.min.css.map +1 -1
  10. package/css/index-without-carbon.css +17 -12
  11. package/css/index-without-carbon.css.map +1 -1
  12. package/css/index-without-carbon.min.css +4 -4
  13. package/css/index-without-carbon.min.css.map +1 -1
  14. package/css/index.css +17 -12
  15. package/css/index.css.map +1 -1
  16. package/css/index.min.css +4 -4
  17. package/css/index.min.css.map +1 -1
  18. package/es/components/ButtonMenu/ButtonMenu.js +11 -1
  19. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
  20. package/es/components/Datagrid/Datagrid/DatagridContent.js +9 -8
  21. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
  22. package/es/components/Datagrid/Datagrid/DatagridRow.js +6 -1
  23. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +9 -4
  24. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
  25. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  26. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  27. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  28. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
  29. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
  30. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +34 -10
  31. package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +6 -2
  32. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
  33. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +42 -11
  34. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
  35. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useSubscribeToEventEmitter.js +1 -0
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/index.js +1 -0
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
  38. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
  39. package/es/components/Datagrid/useActionsColumn.js +18 -14
  40. package/es/components/Datagrid/useFiltering.js +3 -6
  41. package/es/components/Datagrid/useInfiniteScroll.js +7 -3
  42. package/es/components/Datagrid/useNestedRowExpander.js +2 -2
  43. package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
  44. package/es/components/Datagrid/useSelectAllToggle.js +11 -10
  45. package/es/components/Datagrid/useSelectRows.js +2 -2
  46. package/es/components/Datagrid/utils/filterPropsForTesting.js +150 -0
  47. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
  48. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  49. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
  50. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
  51. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
  52. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
  53. package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -6
  54. package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -6
  55. package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
  56. package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
  57. package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
  58. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
  59. package/es/components/FilterSummary/FilterSummary.js +19 -15
  60. package/es/components/InterstitialScreen/InterstitialScreen.js +8 -7
  61. package/es/components/Tearsheet/TearsheetShell.js +6 -4
  62. package/es/global/js/hooks/index.js +3 -2
  63. package/es/global/js/hooks/useFocus.js +72 -0
  64. package/es/global/js/hooks/useIsomorphicEffect.js +12 -0
  65. package/es/global/js/package-settings.js +0 -1
  66. package/lib/components/ButtonMenu/ButtonMenu.js +11 -1
  67. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
  68. package/lib/components/Datagrid/Datagrid/DatagridContent.js +9 -8
  69. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
  70. package/lib/components/Datagrid/Datagrid/DatagridRow.js +6 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +8 -3
  72. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
  73. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  74. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  75. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  76. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
  77. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
  78. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +30 -7
  79. package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +8 -3
  80. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
  81. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +34 -3
  82. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
  83. package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
  84. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
  85. package/lib/components/Datagrid/useActionsColumn.js +17 -13
  86. package/lib/components/Datagrid/useFiltering.js +1 -4
  87. package/lib/components/Datagrid/useInfiniteScroll.js +7 -3
  88. package/lib/components/Datagrid/useNestedRowExpander.js +1 -1
  89. package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
  90. package/lib/components/Datagrid/useSelectAllToggle.js +9 -9
  91. package/lib/components/Datagrid/useSelectRows.js +1 -1
  92. package/lib/components/Datagrid/utils/filterPropsForTesting.js +159 -0
  93. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
  94. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  95. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
  96. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
  97. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
  98. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
  99. package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -6
  100. package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -6
  101. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
  102. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
  103. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
  104. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
  105. package/lib/components/FilterSummary/FilterSummary.js +18 -14
  106. package/lib/components/InterstitialScreen/InterstitialScreen.js +8 -6
  107. package/lib/components/Tearsheet/TearsheetShell.js +6 -4
  108. package/lib/global/js/hooks/index.js +8 -1
  109. package/lib/global/js/hooks/useFocus.js +79 -0
  110. package/lib/global/js/hooks/useIsomorphicEffect.js +18 -0
  111. package/lib/global/js/package-settings.js +0 -1
  112. package/package.json +6 -5
  113. package/scss/components/Datagrid/_datagrid.scss +9 -1
  114. package/scss/components/Datagrid/styles/_datagrid.scss +10 -4
  115. package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +6 -7
  116. package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -0
  117. package/scss/components/SidePanel/_side-panel.scss +5 -1
  118. package/telemetry.yml +816 -0
@@ -1,10 +1,11 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /**
3
- * Copyright IBM Corp. 2023, 2023
3
+ * Copyright IBM Corp. 2023, 2024
4
4
  *
5
5
  * This source code is licensed under the Apache-2.0 license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
+
8
9
  /* eslint-disable jsdoc/check-param-names */
9
10
 
10
11
  import { useState, useEffect } from 'react';
@@ -18,8 +19,7 @@ import isEqual from 'lodash/isEqual';
18
19
  * @returns {Array} returns a tuple of the state and setter function
19
20
  */
20
21
  var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
21
- var _ref$initialValue = _ref.initialValue,
22
- initialValue = _ref$initialValue === void 0 ? true : _ref$initialValue,
22
+ var initialValue = _ref.initialValue,
23
23
  filtersState = _ref.filtersState,
24
24
  prevFiltersRef = _ref.prevFiltersRef;
25
25
  var _useState = useState(initialValue),
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+
7
8
  import { useEffect, useContext } from 'react';
8
9
  import { FilterContext } from '../FilterProvider';
9
10
 
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+
7
8
  export { default as FilterFlyout } from './FilterFlyout';
8
9
  export { default as FilterPanel } from './FilterPanel';
9
10
  export { FilterProvider, FilterContext } from './FilterProvider';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022, 2022
2
+ * Copyright IBM Corp. 2022, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -18,9 +18,7 @@ var applyInitialFilters = function applyInitialFilters(filterState, initialFilte
18
18
  };
19
19
 
20
20
  // This functions takes the filters passed in and makes an object to track it's state
21
- export var getInitialStateFromFilters = function getInitialStateFromFilters(filters) {
22
- var variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FLYOUT;
23
- var initialFilters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
21
+ export var getInitialStateFromFilters = function getInitialStateFromFilters(filters, variation, initialFilters) {
24
22
  var initialFilterState = {};
25
23
  var setInitialState = function setInitialState(_ref) {
26
24
  var type = _ref.type,
@@ -74,8 +72,6 @@ export var getInitialStateFromFilters = function getInitialStateFromFilters(filt
74
72
  return setInitialState(filter);
75
73
  });
76
74
  });
77
- } else {
78
- console.error('No variation passed into useInitialStateFromFilters');
79
75
  }
80
76
  if (initialFilters.length > 0) {
81
77
  applyInitialFilters(initialFilterState, initialFilters);
@@ -92,7 +92,7 @@ export var stateReducer = function stateReducer(newState, action) {
92
92
  if (rows) {
93
93
  var newSelectedRowData = {};
94
94
  rows.forEach(function (row) {
95
- newSelectedRowData[getRowId(row, row.index)] = row;
95
+ newSelectedRowData[getRowId(row.original, row.index)] = row.original;
96
96
  });
97
97
  return _objectSpread(_objectSpread({}, newState), {}, {
98
98
  selectedRowData: indeterminate || !isChecked ? {} : newSelectedRowData
@@ -111,7 +111,7 @@ export var stateReducer = function stateReducer(newState, action) {
111
111
  }
112
112
  if (_isChecked) {
113
113
  return _objectSpread(_objectSpread({}, newState), {}, {
114
- selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData, rowData.index), rowData))
114
+ selectedRowData: _objectSpread(_objectSpread({}, newState.selectedRowData), {}, _defineProperty({}, _getRowId(rowData.original, rowData.index), rowData.original))
115
115
  });
116
116
  }
117
117
  if (rowData && !_isChecked) {
@@ -119,7 +119,7 @@ export var stateReducer = function stateReducer(newState, action) {
119
119
  var dataWithRemovedRow = Object.fromEntries(Object.entries(newData).filter(function (_ref5) {
120
120
  var _ref6 = _slicedToArray(_ref5, 1),
121
121
  key = _ref6[0];
122
- return parseInt(key) !== parseInt(rowData.index);
122
+ return parseInt(key) !== parseInt(_getRowId(rowData.original, rowData.index));
123
123
  }));
124
124
  return _objectSpread(_objectSpread({}, newState), {}, {
125
125
  selectedRowData: dataWithRemovedRow
@@ -177,10 +177,7 @@ export var stateReducer = function stateReducer(newState, action) {
177
177
  var currentColumn = {};
178
178
  currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
179
179
  var allChangedColumns = newState.columnResizing.columnWidths;
180
- var isResizing = newState.isResizing;
181
- if (isResizing) {
182
- onColResizeEnd === null || onColResizeEnd === void 0 ? void 0 : onColResizeEnd(currentColumn, allChangedColumns);
183
- }
180
+ onColResizeEnd === null || onColResizeEnd === void 0 ? void 0 : onColResizeEnd(currentColumn, allChangedColumns);
184
181
  if (!isKeyEvent) {
185
182
  if (typeof isKeyEvent === 'undefined') {
186
183
  // Blur resizer input if it has focus and is not from a key event resize
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["id", "itemText", "onClick", "icon", "shouldHideMenuItem"],
4
+ var _excluded = ["id", "itemText", "onClick", "shouldHideMenuItem", "align", "icon"],
5
5
  _excluded2 = ["id", "onClick", "shouldHideMenuItem", "shouldDisableMenuItem", "disabled"];
6
6
  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; }
7
7
  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; }
@@ -14,8 +14,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
14
14
 
15
15
  import React from 'react';
16
16
  import cx from 'classnames';
17
- import { IconSkeleton, OverflowMenu, OverflowMenuItem } from 'carbon-components-react';
17
+ import { IconSkeleton, OverflowMenu, OverflowMenuItem, Button } from 'carbon-components-react';
18
18
  import { pkg } from '../../settings';
19
+ import { prepareProps } from '../../global/js/utils/props-helper';
19
20
  var blockClass = "".concat(pkg.prefix, "--datagrid");
20
21
  var useActionsColumn = function useActionsColumn(hooks) {
21
22
  var useAttachActionsOnInstance = function useAttachActionsOnInstance(instance) {
@@ -50,12 +51,14 @@ var useActionsColumn = function useActionsColumn(hooks) {
50
51
  display: 'flex'
51
52
  }
52
53
  }, rowActions.map(function (action, index) {
53
- var id = action.id,
54
- itemText = action.itemText,
55
- _onClick = action.onClick,
56
- icon = action.icon,
57
- shouldHideMenuItem = action.shouldHideMenuItem,
58
- rest = _objectWithoutProperties(action, _excluded);
54
+ var preparedActionProps = prepareProps(action, ['isDelete']);
55
+ var id = preparedActionProps.id,
56
+ itemText = preparedActionProps.itemText,
57
+ _onClick = preparedActionProps.onClick,
58
+ shouldHideMenuItem = preparedActionProps.shouldHideMenuItem,
59
+ align = preparedActionProps.align,
60
+ icon = preparedActionProps.icon,
61
+ rest = _objectWithoutProperties(preparedActionProps, _excluded);
59
62
  var hidden = typeof shouldHideMenuItem === 'function' && shouldHideMenuItem(row);
60
63
  if (hidden) {
61
64
  return null;
@@ -63,13 +66,13 @@ var useActionsColumn = function useActionsColumn(hooks) {
63
66
  return /*#__PURE__*/React.createElement("div", {
64
67
  className: cx("".concat(blockClass, "__actions-column-button"), _defineProperty({}, "".concat(blockClass, "__disabled-row-action-button"), getDisabledState(row.index))),
65
68
  key: "".concat(itemText, "__").concat(index)
66
- }, /*#__PURE__*/React.createElement(OverflowMenu, _extends({}, rest, {
69
+ }, /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
70
+ tooltipPosition: align || 'top',
71
+ kind: "ghost",
72
+ name: itemText //for test use
73
+ ,
67
74
  renderIcon: icon,
68
- hasIconOnly: true,
69
- light: true,
70
75
  iconDescription: itemText,
71
- ariaLabel: itemText,
72
- kind: "ghost",
73
76
  className: cx(_defineProperty({}, "".concat(blockClass, "__disabled-row-action"), getDisabledState(row.index))),
74
77
  onClick: function onClick(e) {
75
78
  if (getDisabledState(row.index)) {
@@ -78,7 +81,8 @@ var useActionsColumn = function useActionsColumn(hooks) {
78
81
  }
79
82
  e.stopPropagation();
80
83
  _onClick(id, row, e);
81
- }
84
+ },
85
+ hasIconOnly: true
82
86
  })));
83
87
  })), !isFetching && (rowActions.length > 2 || isColumnSticky) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(OverflowMenu, {
84
88
  size: "sm",
@@ -4,20 +4,17 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  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; }
5
5
  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; }
6
6
  /**
7
- * Copyright IBM Corp. 2022, 2023
7
+ * Copyright IBM Corp. 2022, 2024
8
8
  *
9
9
  * This source code is licensed under the Apache-2.0 license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
 
13
- import { useMemo, useEffect } from 'react';
14
- import { pkg } from '../../settings';
13
+ import { useMemo } from 'react';
15
14
  import { FilterFlyout } from './Datagrid/addons/Filtering';
16
15
  import { BATCH } from './Datagrid/addons/Filtering/constants';
17
16
  var useFiltering = function useFiltering(hooks) {
18
- useEffect(function () {
19
- pkg.checkReportFeatureEnabled('Datagrid.useFiltering');
20
- }, []);
17
+ /* istanbul ignore next */
21
18
  var filterTypes = useMemo(function () {
22
19
  return {
23
20
  date: function date(rows, id, _ref) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2020, 2023
2
+ * Copyright IBM Corp. 2020, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -13,14 +13,18 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
13
13
  useParentDimensions(hooks);
14
14
  useResizeTable(hooks);
15
15
  var useInstance = function useInstance(instance) {
16
+ var _tableElement;
16
17
  var isFetching = instance.isFetching,
17
18
  tableHeight = instance.tableHeight,
18
19
  innerListRef = instance.innerListRef,
19
20
  fetchMoreData = instance.fetchMoreData,
20
21
  tableId = instance.tableId,
21
22
  loadMoreThreshold = instance.loadMoreThreshold;
22
- var tableElement = document.querySelector("#".concat(tableId));
23
- var totalTableHeight = tableHeight || (tableElement === null || tableElement === void 0 ? void 0 : tableElement.clientHeight);
23
+ var tableElement;
24
+ if (typeof document !== 'undefined') {
25
+ tableElement = document.querySelector("#".concat(tableId));
26
+ }
27
+ var totalTableHeight = tableHeight || ((_tableElement = tableElement) === null || _tableElement === void 0 ? void 0 : _tableElement.clientHeight);
24
28
  var loadMoreThresholdValue = typeof loadMoreThreshold === 'number' ? loadMoreThreshold : 200;
25
29
  var emptyFetchData = function emptyFetchData() {};
26
30
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -5,7 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  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; }
6
6
  /* eslint-disable react/prop-types */
7
7
  /**
8
- * Copyright IBM Corp. 2020, 2023
8
+ * Copyright IBM Corp. 2020, 2024
9
9
  *
10
10
  * This source code is licensed under the Apache-2.0 license found in the
11
11
  * LICENSE file in the root directory of this source tree.
@@ -27,7 +27,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
27
27
  instance: tempState === null || tempState === void 0 ? void 0 : tempState.current,
28
28
  lastExpandedRowIndex: lastExpandedRowIndex === null || lastExpandedRowIndex === void 0 ? void 0 : lastExpandedRowIndex.current,
29
29
  blockClass: blockClass,
30
- activeElement: document.activeElement
30
+ activeElement: typeof document !== 'undefined' && document.activeElement
31
31
  });
32
32
  var visibleColumns = function visibleColumns(columns) {
33
33
  var expanderColumn = {
@@ -37,7 +37,9 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
37
37
  });
38
38
  });
39
39
  Object.assign(instance, {
40
- rows: rowsWithMouseOver
40
+ rows: rowsWithMouseOver,
41
+ withMouseHover: true,
42
+ setMouseOverRowIndex: setMouseOverRowIndex
41
43
  });
42
44
  hooks.getRowProps.push(getRowProps);
43
45
  };
@@ -1,18 +1,18 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- /*
4
- * Licensed Materials - Property of IBM
5
- * 5724-Q36
6
- * (c) Copyright IBM Corp. 2021
7
- * US Government Users Restricted Rights - Use, duplication or disclosure
8
- * restricted by GSA ADP Schedule Contract with IBM Corp.
3
+ /**
4
+ * Copyright IBM Corp. 2021, 2024
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
9
8
  */
10
- // @flow
11
- import React, { useLayoutEffect, useState } from 'react';
9
+
10
+ import React, { useState } from 'react';
12
11
  import cx from 'classnames';
13
12
  import { selectionColumnId } from './common-column-ids';
14
13
  import SelectAllWithToggle from './Datagrid/DatagridSelectAllWithToggle';
15
14
  import { pkg } from '../../settings';
15
+ import { useIsomorphicEffect } from '../../global/js/hooks';
16
16
  var blockClass = "".concat(pkg.prefix, "--datagrid__select-all");
17
17
  var useSelectAllToggle = function useSelectAllToggle(hooks) {
18
18
  useSelectAllWithToggleComponent(hooks);
@@ -37,11 +37,12 @@ var useSelectAllWithToggleComponent = function useSelectAllWithToggleComponent(h
37
37
  hooks.useInstance.push(useInstance);
38
38
  };
39
39
  var useAddClassNameToSelectRow = function useAddClassNameToSelectRow(hooks) {
40
- var _useState = useState(window.innerWidth),
40
+ var _useState = useState(0),
41
41
  _useState2 = _slicedToArray(_useState, 2),
42
42
  windowSize = _useState2[0],
43
43
  setWindowSize = _useState2[1];
44
- useLayoutEffect(function () {
44
+ useIsomorphicEffect(function () {
45
+ setWindowSize(window.innerWidth);
45
46
  function updateSize() {
46
47
  setWindowSize(window.innerWidth);
47
48
  }
@@ -7,7 +7,7 @@ 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
  /**
10
- * Copyright IBM Corp. 2020, 2023
10
+ * Copyright IBM Corp. 2020, 2024
11
11
  *
12
12
  * This source code is licensed under the Apache-2.0 license found in the
13
13
  * LICENSE file in the root directory of this source tree.
@@ -87,7 +87,7 @@ var SelectRow = function SelectRow(datagridState) {
87
87
  withStickyColumn = datagridState.withStickyColumn,
88
88
  dispatch = datagridState.dispatch,
89
89
  getRowId = datagridState.getRowId;
90
- var _useState = useState(window.innerWidth),
90
+ var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
91
91
  _useState2 = _slicedToArray(_useState, 2),
92
92
  windowSize = _useState2[0],
93
93
  setWindowSize = _useState2[1];
@@ -0,0 +1,150 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ /**
4
+ * Copyright IBM Corp. 2024, 2024
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ import { handleFilterTagLabelText } from './handleFilterTagLabelText';
11
+ export var generateDummyCheckboxes = Array(25).fill(null).map(function (_, index) {
12
+ return {
13
+ id: "".concat(index),
14
+ labelText: "Dummy checkbox ".concat(index + 1),
15
+ value: 'dummy-checkbox',
16
+ disabled: true
17
+ };
18
+ });
19
+ export var filterProps = function filterProps() {
20
+ var _Dropdown;
21
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22
+ _ref$includeManyCheck = _ref.includeManyCheckboxes,
23
+ includeManyCheckboxes = _ref$includeManyCheck === void 0 ? false : _ref$includeManyCheck,
24
+ _ref$dropdownOnChange = _ref.dropdownOnChange,
25
+ dropdownOnChange = _ref$dropdownOnChange === void 0 ? function () {} : _ref$dropdownOnChange;
26
+ var checkboxList = [{
27
+ id: 'normal',
28
+ labelText: 'Normal',
29
+ value: 'normal'
30
+ }, {
31
+ id: 'minor-warning',
32
+ labelText: 'Minor warning',
33
+ value: 'minor-warning'
34
+ }, {
35
+ id: 'critical',
36
+ labelText: 'Critical',
37
+ value: 'critical'
38
+ }].concat(_toConsumableArray(includeManyCheckboxes ? generateDummyCheckboxes : []));
39
+ return {
40
+ autoHideFilters: includeManyCheckboxes ? false : true,
41
+ variation: 'panel',
42
+ panelIconDescription: 'Open filters',
43
+ sections: [{
44
+ categoryTitle: 'Category title',
45
+ hasAccordion: true,
46
+ filters: [{
47
+ filterLabel: 'Joined',
48
+ filter: {
49
+ type: 'date',
50
+ column: 'joined',
51
+ props: {
52
+ DatePicker: {
53
+ datePickerType: 'range'
54
+ },
55
+ DatePickerInput: {
56
+ start: {
57
+ id: 'date-picker-input-id-start',
58
+ placeholder: 'mm/dd/yyyy',
59
+ labelText: 'Joined start date'
60
+ },
61
+ end: {
62
+ id: 'date-picker-input-id-end',
63
+ placeholder: 'mm/dd/yyyy',
64
+ labelText: 'Joined end date'
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }, {
70
+ filterLabel: 'Status',
71
+ filter: {
72
+ type: 'dropdown',
73
+ column: 'status',
74
+ props: {
75
+ Dropdown: (_Dropdown = {
76
+ id: 'marital-status-dropdown'
77
+ }, _defineProperty(_Dropdown, 'aria-label', 'Marital status dropdown'), _defineProperty(_Dropdown, "items", ['relationship', 'complicated', 'single']), _defineProperty(_Dropdown, "label", 'Marital status'), _defineProperty(_Dropdown, "titleText", 'Marital status'), _defineProperty(_Dropdown, "onChange", dropdownOnChange), _Dropdown)
78
+ }
79
+ }
80
+ }]
81
+ }, {
82
+ categoryTitle: 'Category title',
83
+ filters: [{
84
+ filterLabel: 'Role',
85
+ filter: {
86
+ type: 'radio',
87
+ column: 'role',
88
+ props: {
89
+ FormGroup: {
90
+ legendText: 'Role'
91
+ },
92
+ RadioButtonGroup: {
93
+ orientation: 'vertical',
94
+ legend: 'Role legend',
95
+ name: 'role-radio-button-group'
96
+ },
97
+ RadioButton: [{
98
+ id: 'developer',
99
+ labelText: 'Developer',
100
+ value: 'developer'
101
+ }, {
102
+ id: 'designer',
103
+ labelText: 'Designer',
104
+ value: 'designer'
105
+ }, {
106
+ id: 'researcher',
107
+ labelText: 'Researcher',
108
+ value: 'researcher'
109
+ }]
110
+ }
111
+ }
112
+ }, {
113
+ filterLabel: 'Visits',
114
+ filter: {
115
+ type: 'number',
116
+ column: 'visits',
117
+ props: {
118
+ NumberInput: {
119
+ min: 0,
120
+ id: 'visits-number-input',
121
+ invalidText: 'A valid value is required',
122
+ label: 'Visits',
123
+ placeholder: 'Type a number amount of visits'
124
+ }
125
+ }
126
+ }
127
+ }, {
128
+ filterLabel: 'Password strength',
129
+ filter: {
130
+ type: 'checkbox',
131
+ column: 'passwordStrength',
132
+ props: {
133
+ FormGroup: {
134
+ legendText: 'Password strength'
135
+ },
136
+ Checkbox: checkboxList
137
+ }
138
+ }
139
+ }]
140
+ }],
141
+ renderLabel: function renderLabel(key, value) {
142
+ return handleFilterTagLabelText(key, value);
143
+ },
144
+ renderDateLabel: function renderDateLabel(start, end) {
145
+ var startDateObj = new Date(start);
146
+ var endDateObj = new Date(end);
147
+ return "".concat(startDateObj.toLocaleDateString(), " - ").concat(endDateObj.toLocaleDateString());
148
+ }
149
+ };
150
+ };
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
4
+ var _excluded = ["action", "className", "illustrationDescription", "illustrationTheme", "link", "size", "subtitle", "title"];
5
5
  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; }
6
6
  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; }
7
7
  /**
@@ -30,6 +30,7 @@ var componentName = 'ErrorEmptyState';
30
30
  export var ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
31
31
  var action = _ref.action,
32
32
  className = _ref.className,
33
+ illustrationDescription = _ref.illustrationDescription,
33
34
  illustrationTheme = _ref.illustrationTheme,
34
35
  link = _ref.link,
35
36
  _ref$size = _ref.size,
@@ -41,9 +42,9 @@ export var ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
42
  className: cx(blockClass, className, "".concat(blockClass, "-type--error")),
42
43
  ref: ref
43
44
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ErrorIllustration, {
44
- title: title,
45
45
  theme: illustrationTheme,
46
- size: size
46
+ size: size,
47
+ alt: illustrationDescription || title
47
48
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
48
49
  action: action,
49
50
  link: link,
@@ -77,6 +78,11 @@ ErrorEmptyState.propTypes = {
77
78
  * Provide an optional class to be applied to the containing node.
78
79
  */
79
80
  className: PropTypes.string,
81
+ /**
82
+ /**
83
+ * The alt text for empty state svg images. If not provided , title will be used.
84
+ */
85
+ illustrationDescription: PropTypes.string,
80
86
  /**
81
87
  * Empty state illustration theme variations.
82
88
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
4
+ var _excluded = ["action", "className", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
5
5
  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; }
6
6
  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; }
7
7
  /**
@@ -31,6 +31,7 @@ export var NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
31
31
  var action = _ref.action,
32
32
  className = _ref.className,
33
33
  illustrationTheme = _ref.illustrationTheme,
34
+ illustrationDescription = _ref.illustrationDescription,
34
35
  link = _ref.link,
35
36
  _ref$size = _ref.size,
36
37
  size = _ref$size === void 0 ? defaults.size : _ref$size,
@@ -41,9 +42,9 @@ export var NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
42
  className: cx(blockClass, className, "".concat(blockClass, "-type--noData")),
42
43
  ref: ref
43
44
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoDataIllustration, {
44
- title: title,
45
45
  theme: illustrationTheme,
46
- size: size
46
+ size: size,
47
+ alt: illustrationDescription || title
47
48
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
48
49
  action: action,
49
50
  link: link,
@@ -77,6 +78,10 @@ NoDataEmptyState.propTypes = {
77
78
  * Provide an optional class to be applied to the containing node.
78
79
  */
79
80
  className: PropTypes.string,
81
+ /**
82
+ * The alt text for empty state svg images.If not provided , title will be used.
83
+ */
84
+ illustrationDescription: PropTypes.string,
80
85
  /**
81
86
  * Empty state illustration theme variations.
82
87
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
4
+ var _excluded = ["action", "className", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
5
5
  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; }
6
6
  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; }
7
7
  /**
@@ -31,6 +31,7 @@ export var NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
31
31
  var action = _ref.action,
32
32
  className = _ref.className,
33
33
  illustrationTheme = _ref.illustrationTheme,
34
+ illustrationDescription = _ref.illustrationDescription,
34
35
  link = _ref.link,
35
36
  _ref$size = _ref.size,
36
37
  size = _ref$size === void 0 ? defaults.size : _ref$size,
@@ -41,9 +42,9 @@ export var NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
42
  className: cx(blockClass, className, "".concat(blockClass, "-type--noTags")),
42
43
  ref: ref
43
44
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NoTagsIllustration, {
44
- title: title,
45
45
  theme: illustrationTheme,
46
- size: size
46
+ size: size,
47
+ alt: illustrationDescription || title
47
48
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
48
49
  action: action,
49
50
  link: link,
@@ -77,6 +78,10 @@ NoTagsEmptyState.propTypes = {
77
78
  * Provide an optional class to be applied to the containing node.
78
79
  */
79
80
  className: PropTypes.string,
81
+ /**
82
+ * The alt text for empty state svg images.If not provided , title will be used.
83
+ */
84
+ illustrationDescription: PropTypes.string,
80
85
  /**
81
86
  * Empty state illustration theme variations.
82
87
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
4
+ var _excluded = ["action", "className", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
5
5
  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; }
6
6
  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; }
7
7
  /**
@@ -31,6 +31,7 @@ export var NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, re
31
31
  var action = _ref.action,
32
32
  className = _ref.className,
33
33
  illustrationTheme = _ref.illustrationTheme,
34
+ illustrationDescription = _ref.illustrationDescription,
34
35
  link = _ref.link,
35
36
  _ref$size = _ref.size,
36
37
  size = _ref$size === void 0 ? defaults.size : _ref$size,
@@ -41,9 +42,9 @@ export var NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, re
41
42
  className: cx(blockClass, className, "".concat(blockClass, "-type--notFound")),
42
43
  ref: ref
43
44
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotFoundIllustration, {
44
- title: title,
45
45
  theme: illustrationTheme,
46
- size: size
46
+ size: size,
47
+ alt: illustrationDescription || title
47
48
  }), /*#__PURE__*/React.createElement(EmptyStateContent, {
48
49
  action: action,
49
50
  link: link,
@@ -77,6 +78,10 @@ NotFoundEmptyState.propTypes = {
77
78
  * Provide an optional class to be applied to the containing node.
78
79
  */
79
80
  className: PropTypes.string,
81
+ /**
82
+ * The alt text for empty state svg images.If not provided , title will be used.
83
+ */
84
+ illustrationDescription: PropTypes.string,
80
85
  /**
81
86
  * Empty state illustration theme variations.
82
87
  * To ensure you use the correct themed illustrations, you can conditionally specify light or dark