@carbon/ibm-products 1.59.1 → 1.60.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/css/index-full-carbon.css +42 -21
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +42 -21
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +42 -21
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -1
  14. package/es/components/Datagrid/Datagrid/DatagridContent.js +7 -1
  15. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -4
  16. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +13 -1
  17. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -15
  18. package/es/components/Datagrid/Datagrid/DraggableElement.js +32 -135
  19. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +14 -38
  20. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -0
  21. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +128 -40
  22. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +7 -6
  23. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +104 -18
  24. package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +1 -0
  25. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +37 -4
  26. package/es/components/Datagrid/useFiltering.js +4 -1
  27. package/es/components/Datagrid/useNestedRowExpander.js +22 -9
  28. package/es/components/Datagrid/useRowExpander.js +22 -9
  29. package/es/components/Datagrid/utils/getArgTypes.js +12 -0
  30. package/es/components/EmptyStates/EmptyState.js +1 -1
  31. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
  32. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
  33. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
  34. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
  35. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
  36. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
  37. package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -11
  38. package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -11
  39. package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
  40. package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
  41. package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
  42. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
  43. package/es/components/FilterSummary/FilterSummary.js +9 -3
  44. package/es/components/TagSet/TagSet.js +3 -7
  45. package/es/global/js/hooks/useWindowScroll.js +5 -0
  46. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -1
  47. package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -0
  48. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -3
  49. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +13 -1
  50. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -15
  51. package/lib/components/Datagrid/Datagrid/DraggableElement.js +34 -140
  52. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +17 -38
  53. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -0
  54. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +128 -47
  55. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +7 -6
  56. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +104 -24
  57. package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +4 -2
  58. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +36 -3
  59. package/lib/components/Datagrid/useFiltering.js +4 -1
  60. package/lib/components/Datagrid/useNestedRowExpander.js +24 -9
  61. package/lib/components/Datagrid/useRowExpander.js +24 -9
  62. package/lib/components/Datagrid/utils/getArgTypes.js +12 -0
  63. package/lib/components/EmptyStates/EmptyState.js +1 -1
  64. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
  65. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
  66. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
  67. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
  68. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
  69. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
  70. package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -11
  71. package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -11
  72. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -12
  73. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -12
  74. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -12
  75. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -12
  76. package/lib/components/FilterSummary/FilterSummary.js +9 -10
  77. package/lib/components/TagSet/TagSet.js +2 -6
  78. package/lib/global/js/hooks/useWindowScroll.js +6 -0
  79. package/package.json +6 -5
  80. package/scss/components/Datagrid/_datagrid.scss +1 -1
  81. package/scss/components/Datagrid/styles/_draggableElement.scss +44 -20
  82. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +0 -1
@@ -24,13 +24,14 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
24
24
  size = _ref.size,
25
25
  rest = _objectWithoutProperties(_ref, _excluded);
26
26
  var svgId = uuidv4();
27
- return theme === 'dark' ? /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
27
+ return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
28
28
  xmlns: "http://www.w3.org/2000/svg",
29
29
  width: 80,
30
30
  height: 80,
31
31
  viewBox: "0 0 80 80",
32
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
33
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
32
+ className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notFound"), "".concat(blockClass, "__illustration--").concat(size)]),
33
+ role: "img"
34
+ }), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
34
35
  id: "prefix__a_dark_".concat(svgId),
35
36
  x1: 2.6,
36
37
  y1: -12.81,
@@ -181,14 +182,7 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
181
182
  }), /*#__PURE__*/React.createElement("path", {
182
183
  d: "M57 37.5c0-12-8.75-26.85-19.56-33.08C31.82 1.16 26.73.89 23.16 3.09l-4.83 2.78 1.19 1.94c3.25-1.74 7.72-1.38 12.67 1.47C42.09 15 50.11 28.57 50.11 39.6c0 4.86-1.55 8.4-4.11 10.4-.12.1-1.17.73-1.31.82l2.12 1.42 4.83-2.79C55 47.44 57 43.34 57 37.5",
183
184
  fill: "url(#prefix__f_dark_".concat(svgId, ")")
184
- })) : /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
185
- xmlns: "http://www.w3.org/2000/svg",
186
- xmlnsXlink: "http://www.w3.org/1999/xlink",
187
- width: 80,
188
- height: 80,
189
- viewBox: "0 0 80 80",
190
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
191
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
185
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
192
186
  id: "prefix__a_".concat(svgId),
193
187
  x1: 2.6,
194
188
  y1: -12.81,
@@ -358,7 +352,7 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
358
352
  }), /*#__PURE__*/React.createElement("path", {
359
353
  d: "M57 37.5c0-12-8.75-26.85-19.56-33.08C31.82 1.16 26.73.89 23.16 3.09l-4.83 2.78 1.19 1.94c3.25-1.74 7.72-1.38 12.67 1.47C42.09 15 50.11 28.57 50.11 39.6c0 4.86-1.55 8.4-4.11 10.4-.12.1-1.17.73-1.31.82l2.12 1.42 4.83-2.79C55 47.44 57 43.34 57 37.5",
360
354
  fill: "url(#prefix__g_".concat(svgId, ")")
361
- }));
355
+ })));
362
356
  };
363
357
  NotFoundIllustration.propTypes = {
364
358
  size: PropTypes.oneOf(['lg', 'sm']),
@@ -24,13 +24,14 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
24
24
  size = _ref.size,
25
25
  rest = _objectWithoutProperties(_ref, _excluded);
26
26
  var svgId = uuidv4();
27
- return theme === 'dark' ? /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
27
+ return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
28
28
  xmlns: "http://www.w3.org/2000/svg",
29
29
  width: 80,
30
30
  height: 80,
31
31
  viewBox: "0 0 80 80",
32
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
33
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
32
+ className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notification"), "".concat(blockClass, "__illustration--").concat(size)]),
33
+ role: "img"
34
+ }), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
34
35
  id: "prefix__a_dark_".concat(svgId),
35
36
  x1: 30.05,
36
37
  y1: 54.31,
@@ -126,14 +127,7 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
126
127
  }), /*#__PURE__*/React.createElement("path", {
127
128
  d: "M60.76 30.55a2.54 2.54 0 01.14.8v3.95l.41-.13v-3.82a3.54 3.54 0 00-1.63-2.82L16.86 3.8a2.09 2.09 0 00-.44-.19l-.78.45a1 1 0 01.21-.06h.48l.27.12 21.47 12.4 21.41 12.36a3.19 3.19 0 011.28 1.67z",
128
129
  fill: "url(#prefix__d_dark_".concat(svgId, ")")
129
- })) : /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
130
- xmlns: "http://www.w3.org/2000/svg",
131
- xmlnsXlink: "http://www.w3.org/1999/xlink",
132
- width: 80,
133
- height: 80,
134
- viewBox: "0 0 80 80",
135
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
136
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
130
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
137
131
  id: "prefix__a_".concat(svgId),
138
132
  x1: 61.44,
139
133
  y1: 66.99,
@@ -329,7 +323,7 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
329
323
  }), /*#__PURE__*/React.createElement("path", {
330
324
  d: "M60.76 30.55a2.54 2.54 0 01.14.8v3.95l.41-.13v-3.82a3.54 3.54 0 00-1.63-2.82L16.86 3.8a2.09 2.09 0 00-.44-.19l-.78.45a1 1 0 01.21-.06h.48l.27.12 21.47 12.4 21.41 12.36a3.19 3.19 0 011.28 1.67z",
331
325
  fill: "url(#prefix__k_".concat(svgId, ")")
332
- }));
326
+ })));
333
327
  };
334
328
  NotificationsIllustration.propTypes = {
335
329
  size: PropTypes.oneOf(['lg', 'sm']),
@@ -24,14 +24,15 @@ export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
24
24
  size = _ref.size,
25
25
  rest = _objectWithoutProperties(_ref, _excluded);
26
26
  var svgId = uuidv4();
27
- return theme === 'dark' ? /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
27
+ return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
28
28
  xmlns: "http://www.w3.org/2000/svg",
29
29
  xmlnsXlink: "http://www.w3.org/1999/xlink",
30
30
  width: 80,
31
31
  height: 80,
32
32
  viewBox: "0 0 80 80",
33
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
34
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
33
+ className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-unauthorized"), "".concat(blockClass, "__illustration--").concat(size)]),
34
+ role: "img"
35
+ }), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
35
36
  id: "prefix__b_dark_".concat(svgId),
36
37
  x1: 17.33,
37
38
  y1: 40.68,
@@ -114,14 +115,7 @@ export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
114
115
  }), /*#__PURE__*/React.createElement("path", {
115
116
  d: "M51.41 38.51a1.9 1.9 0 00-.64-.65l-1.1-.63-28.49-16.45-.1-.05-.61.35a.33.33 0 01.17 0 .6.6 0 01.32.1l28.5 16.41 1.1.63a1.5 1.5 0 01.49.51s.05.09.08.14l.36-.21z",
116
117
  fill: "#6f6f6f"
117
- })) : /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
118
- xmlns: "http://www.w3.org/2000/svg",
119
- xmlnsXlink: "http://www.w3.org/1999/xlink",
120
- width: 80,
121
- height: 80,
122
- viewBox: "0 0 80 80",
123
- className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration--").concat(size)])
124
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
118
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
125
119
  id: "prefix__b",
126
120
  x1: 27.98,
127
121
  y1: 73.72,
@@ -302,7 +296,7 @@ export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
302
296
  }), /*#__PURE__*/React.createElement("path", {
303
297
  d: "M51.41 38.51a1.9 1.9 0 00-.64-.65l-1.1-.63-28.49-16.45-.1-.05-.61.35a.33.33 0 01.17 0 .6.6 0 01.32.1l28.5 16.41 1.1.63a1.5 1.5 0 01.49.51s.05.09.08.14l.36-.21z",
304
298
  fill: "url(#prefix__h_".concat(svgId, ")")
305
- }));
299
+ })));
306
300
  };
307
301
  UnauthorizedIllustration.propTypes = {
308
302
  size: PropTypes.oneOf(['lg', 'sm']),
@@ -1,3 +1,8 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["key", "value"];
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
+ 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; }
1
6
  /**
2
7
  * Copyright IBM Corp. 2022, 2022
3
8
  *
@@ -25,11 +30,12 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
25
30
  var tagFilters = filters.map(function (_ref2) {
26
31
  var _renderLabel;
27
32
  var key = _ref2.key,
28
- value = _ref2.value;
29
- return {
33
+ value = _ref2.value,
34
+ rest = _objectWithoutProperties(_ref2, _excluded);
35
+ return _objectSpread(_objectSpread({}, rest), {}, {
30
36
  type: 'gray',
31
37
  label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
32
- };
38
+ });
33
39
  });
34
40
  return /*#__PURE__*/React.createElement("div", {
35
41
  ref: ref,
@@ -23,7 +23,7 @@ import { TagSetModal } from './TagSetModal';
23
23
  import { Tag } from 'carbon-components-react';
24
24
  import { useResizeObserver } from '../../global/js/hooks/useResizeObserver';
25
25
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
26
- import { prepareProps, isRequiredIf } from '../../global/js/utils/props-helper';
26
+ import { isRequiredIf } from '../../global/js/utils/props-helper';
27
27
  import { pkg } from '../../settings';
28
28
  var componentName = 'TagSet';
29
29
  var blockClass = "".concat(pkg.prefix, "--tag-set");
@@ -110,8 +110,7 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
110
110
  }
111
111
  }, /*#__PURE__*/React.createElement(Tag, _extends({}, other, {
112
112
  // ensure id is not duplicated
113
- "data-original-id": id,
114
- filter: false
113
+ "data-original-id": id
115
114
  }), label));
116
115
  }) : []);
117
116
  setSizingTags(newSizingTags);
@@ -122,7 +121,6 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
122
121
  var label = _ref3.label,
123
122
  other = _objectWithoutProperties(_ref3, _excluded3);
124
123
  return /*#__PURE__*/React.createElement(Tag, _extends({}, other, {
125
- filter: false,
126
124
  key: "displayed-tag-".concat(index)
127
125
  }), label);
128
126
  }) : [];
@@ -313,12 +311,10 @@ TagSet.propTypes = {
313
311
  * with properties: **label**\* (required) to supply the tag content, and
314
312
  * other properties will be passed to the Carbon Tag component, such as
315
313
  * **type**, **disabled**, **ref**, **className** , and any other Tag props.
316
- * NOTE: **filter** is not supported. Any other fields in the object will be passed through to the HTML element
317
- * as HTML attributes.
318
314
  *
319
315
  * See https://react.carbondesignsystem.com/?path=/docs/components-tag--default
320
316
  */
321
- tags: PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, prepareProps(Tag.propTypes, 'filter')), {}, {
317
+ tags: PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, Tag.propTypes), {}, {
322
318
  label: PropTypes.string.isRequired,
323
319
  // we duplicate this prop to improve the DocGen
324
320
  type: PropTypes.oneOf(tagTypes)
@@ -68,4 +68,9 @@ export function useNearestScroll(ref, effect, deps) {
68
68
  scrollableTarget = window;
69
69
  }
70
70
  return useTargetScroll(scrollableTarget, effect, deps, throttle);
71
+ }
72
+ export function useScroll(ref, effect, deps) {
73
+ var _ref$current;
74
+ var throttle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
75
+ return useTargetScroll((_ref$current = ref === null || ref === void 0 ? void 0 : ref.current) !== null && _ref$current !== void 0 ? _ref$current : null, effect, deps, throttle);
71
76
  }
@@ -40,7 +40,8 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
40
40
  datagridState: datagridState
41
41
  };
42
42
  return /*#__PURE__*/_react.default.createElement(_FilterProvider.FilterProvider, {
43
- filters: filters
43
+ filters: filters,
44
+ filterProps: filterProps
44
45
  }, /*#__PURE__*/_react.default.createElement(_InlineEditContext.InlineEditProvider, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
45
46
  id: tableId,
46
47
  ref: ref,
@@ -26,6 +26,8 @@ var _FilterPanel = _interopRequireDefault(require("./addons/Filtering/FilterPane
26
26
  var _FilterSummary = require("../../FilterSummary");
27
27
  var _Filtering = require("./addons/Filtering");
28
28
  var _constants = require("./addons/Filtering/constants");
29
+ var _hooks3 = require("./addons/Filtering/hooks");
30
+ var _FilterProvider = require("./addons/Filtering/FilterProvider");
29
31
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
33
  /**
@@ -72,6 +74,7 @@ var DatagridContent = function DatagridContent(_ref) {
72
74
  DatagridActions = datagridState.DatagridActions,
73
75
  totalColumnsWidth = datagridState.totalColumnsWidth,
74
76
  gridRef = datagridState.gridRef,
77
+ setAllFilters = datagridState.setAllFilters,
75
78
  state = datagridState.state,
76
79
  page = datagridState.page,
77
80
  rows = datagridState.rows;
@@ -137,6 +140,9 @@ var DatagridContent = function DatagridContent(_ref) {
137
140
  gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), (0, _layout.px)((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
138
141
  }
139
142
  }, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
143
+ (0, _hooks3.useSubscribeToEventEmitter)(_constants.CLEAR_SINGLE_FILTER, function (id) {
144
+ return (0, _FilterProvider.clearSingleFilter)(id, setAllFilters, state);
145
+ });
140
146
  var renderFilterSummary = function renderFilterSummary() {
141
147
  return state.filters.length > 0 && /*#__PURE__*/_react.default.createElement(_FilterSummary.FilterSummary, {
142
148
  className: "".concat(blockClass, "__filter-summary"),
@@ -40,14 +40,14 @@ var DatagridEmptyBody = function DatagridEmptyBody(datagridState) {
40
40
  action: emptyStateAction,
41
41
  link: emptyStateLink
42
42
  };
43
+ var validEmptyStates = ['error', 'noData', 'notFound'];
43
44
  return /*#__PURE__*/_react.default.createElement(TableBody, (0, _extends2.default)({}, getTableBodyProps({
44
45
  role: false
45
46
  }), {
46
47
  className: "".concat(blockClass, "__empty-state-body")
47
48
  }), /*#__PURE__*/_react.default.createElement(TableRow, null, /*#__PURE__*/_react.default.createElement(TableCell, {
48
- colSpan: headers.length,
49
- className: "".concat(blockClass, "__empty-state-cell")
50
- }, emptyStateType === 'error' && /*#__PURE__*/_react.default.createElement(_EmptyStates.ErrorEmptyState, emptyStateProps), emptyStateType === 'noData' && /*#__PURE__*/_react.default.createElement(_EmptyStates.NoDataEmptyState, emptyStateProps), emptyStateType === 'notFound' && /*#__PURE__*/_react.default.createElement(_EmptyStates.NotFoundEmptyState, emptyStateProps))));
49
+ colSpan: headers.length
50
+ }, validEmptyStates.includes(emptyStateType) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, emptyStateType === 'error' && /*#__PURE__*/_react.default.createElement(_EmptyStates.ErrorEmptyState, emptyStateProps), emptyStateType === 'noData' && /*#__PURE__*/_react.default.createElement(_EmptyStates.NoDataEmptyState, emptyStateProps), emptyStateType === 'notFound' && /*#__PURE__*/_react.default.createElement(_EmptyStates.NotFoundEmptyState, emptyStateProps)) : /*#__PURE__*/_react.default.createElement(_EmptyStates.EmptyState, emptyStateProps))));
51
51
  };
52
52
  var _default = DatagridEmptyBody;
53
53
  exports.default = _default;
@@ -52,11 +52,23 @@ var SelectAll = function SelectAll(datagridState) {
52
52
  var _getProps = getProps(),
53
53
  onChange = _getProps.onChange,
54
54
  selectProps = (0, _objectWithoutProperties2.default)(_getProps, _excluded);
55
+ var _ref = selectProps || {},
56
+ indeterminate = _ref.indeterminate;
57
+ var handleSelectAllChange = function handleSelectAllChange(event) {
58
+ if (indeterminate) {
59
+ return onChange === null || onChange === void 0 ? void 0 : onChange({
60
+ target: {
61
+ checked: false
62
+ }
63
+ });
64
+ }
65
+ return onChange === null || onChange === void 0 ? void 0 : onChange(event);
66
+ };
55
67
  return /*#__PURE__*/_react.default.createElement("div", {
56
68
  className: (0, _classnames.default)("".concat(blockClass, "__head-select-all"), "".concat(blockClass, "__checkbox-cell"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__checkbox-cell-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
57
69
  }, /*#__PURE__*/_react.default.createElement(TableSelectAll, (0, _extends2.default)({}, selectProps, {
58
70
  name: "".concat(tableId, "-select-all-checkbox-name"),
59
- onSelect: onChange,
71
+ onSelect: handleSelectAllChange,
60
72
  disabled: isFetching || selectProps.disabled,
61
73
  id: "".concat(tableId, "-select-all-checkbox-id")
62
74
  })));
@@ -18,7 +18,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
18
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
20
  /**
21
- * Copyright IBM Corp. 2022, 2022
21
+ * Copyright IBM Corp. 2022, 2023
22
22
  *
23
23
  * This source code is licensed under the Apache-2.0 license found in the
24
24
  * LICENSE file in the root directory of this source tree.
@@ -80,20 +80,8 @@ var DatagridBatchActionsToolbar = function DatagridBatchActionsToolbar(datagridS
80
80
  menuOptionsClass: "".concat(blockClass, "__button-menu-options"),
81
81
  flipped: true
82
82
  }, toolbarBatchActions && toolbarBatchActions.map(function (batchAction, index) {
83
- if (index < 2) {
84
- if (displayAllInMenu) {
85
- return /*#__PURE__*/_react.default.createElement(_ButtonMenu.ButtonMenuItem, {
86
- key: "".concat(batchAction.label, "-").concat(index),
87
- itemText: batchAction.label,
88
- onClick: function onClick() {
89
- batchAction.onClick();
90
- if (batchAction.type === 'select_all') {
91
- toggleAllRowsSelected(true);
92
- }
93
- }
94
- });
95
- }
96
- return null;
83
+ if (index < 2 && !displayAllInMenu) {
84
+ return;
97
85
  }
98
86
  return /*#__PURE__*/_react.default.createElement(_ButtonMenu.ButtonMenuItem, {
99
87
  key: "".concat(batchAction.label, "-").concat(index),
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var React = _interopRequireWildcard(require("react"));
10
+ var _react = _interopRequireDefault(require("react"));
12
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
12
  var _iconsReact = require("@carbon/icons-react");
14
- var _reactDnd = require("react-dnd");
15
13
  var _classnames = _interopRequireDefault(require("classnames"));
16
14
  var _settings = require("../../../settings");
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ var _utilities = require("@dnd-kit/utilities");
16
+ var _sortable = require("@dnd-kit/sortable");
19
17
  // @flow
20
18
  /*
21
19
  * Licensed Materials - Property of IBM
@@ -25,161 +23,57 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
23
  * restricted by GSA ADP Schedule Contract with IBM Corp.
26
24
  */
27
25
 
28
- var useEffect = React.useEffect,
29
- useRef = React.useRef,
30
- useState = React.useState;
31
26
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
32
- var DRAG_TYPE = "".concat(blockClass, "__shared-ui-draggable-element");
33
27
  var DraggableElement = function DraggableElement(_ref) {
34
28
  var _cx;
35
29
  var id = _ref.id,
36
- index = _ref.index,
37
- listData = _ref.listData,
38
30
  children = _ref.children,
39
- type = _ref.type,
31
+ classList = _ref.classList,
40
32
  disabled = _ref.disabled,
41
33
  ariaLabel = _ref.ariaLabel,
42
- onGrab = _ref.onGrab,
43
- onArrowKeyDown = _ref.onArrowKeyDown,
44
- isFocused = _ref.isFocused,
45
34
  isSticky = _ref.isSticky,
46
- moveElement = _ref.moveElement,
47
- selected = _ref.selected,
48
- _ref$positionLabel = _ref.positionLabel,
49
- positionLabel = _ref$positionLabel === void 0 ? 'Current position {index} of {total}' : _ref$positionLabel,
50
- _ref$grabbedLabel = _ref.grabbedLabel,
51
- grabbedLabel = _ref$grabbedLabel === void 0 ? '{itemName} grabbed.' : _ref$grabbedLabel,
52
- _ref$droppedLabel = _ref.droppedLabel,
53
- droppedLabel = _ref$droppedLabel === void 0 ? '{itemName} dropped.' : _ref$droppedLabel;
54
- var ref = useRef();
55
- var _useDrop = (0, _reactDnd.useDrop)({
56
- accept: DRAG_TYPE + type,
57
- collect: function collect(monitor) {
58
- return {
59
- isOver: !!monitor.isOver()
60
- };
61
- },
62
- drop: function drop(item) {
63
- moveElement(item.index, index);
64
- },
65
- canDrop: function canDrop() {
66
- return !disabled;
67
- },
68
- hover: function hover(item) {
69
- var dragIndex = item.index;
70
- var hoverIndex = index;
71
- // Don't replace items with themselves
72
- if (dragIndex === hoverIndex || disabled) {
73
- return;
74
- }
75
- moveElement(dragIndex, hoverIndex);
76
- // Time to actually perform the action
77
- // Note: we're mutating the monitor item here!
78
- // Generally it's better to avoid mutations,
79
- // but it's good here for the sake of performance
80
- // to avoid expensive index searches.
81
- // eslint-disable-next-line no-param-reassign
82
- item.index = hoverIndex;
83
- }
35
+ selected = _ref.selected;
36
+ var _useSortable = (0, _sortable.useSortable)({
37
+ id: id
84
38
  }),
85
- _useDrop2 = (0, _slicedToArray2.default)(_useDrop, 2),
86
- isOver = _useDrop2[0].isOver,
87
- drop = _useDrop2[1];
88
- var _useDrag = (0, _reactDnd.useDrag)({
89
- type: DRAG_TYPE + type,
90
- item: {
91
- id: id,
92
- index: index
93
- },
94
- canDrag: function canDrag() {
95
- return !disabled;
96
- },
97
- collect: function collect(monitor) {
98
- return {
99
- isDragging: monitor.isDragging()
100
- };
101
- }
102
- }),
103
- _useDrag2 = (0, _slicedToArray2.default)(_useDrag, 3),
104
- isDragging = _useDrag2[0].isDragging,
105
- drag = _useDrag2[1],
106
- preview = _useDrag2[2];
107
- useEffect(function () {
108
- if (isFocused && ref && ref.current) {
109
- ref.current.focus();
110
- }
111
- }, [isFocused]);
112
- var _useState = useState(false),
113
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
114
- isGrabbed = _useState2[0],
115
- setIsGrabbed = _useState2[1];
116
- var _useState3 = useState(isFocused),
117
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
118
- isFocusedOnItem = _useState4[0],
119
- setIsFocusedOnItem = _useState4[1];
120
- drop(ref);
121
- var content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
39
+ attributes = _useSortable.attributes,
40
+ isDragging = _useSortable.isDragging,
41
+ listeners = _useSortable.listeners,
42
+ setNodeRef = _useSortable.setNodeRef,
43
+ transform = _useSortable.transform,
44
+ transition = _useSortable.transition;
45
+ var content = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
122
46
  className: (0, _classnames.default)({
123
47
  disabled: disabled
124
48
  }, "".concat(blockClass, "__draggable-handleStyle"))
125
- }, isSticky ? /*#__PURE__*/React.createElement(_iconsReact.Locked16, null) : /*#__PURE__*/React.createElement(_iconsReact.Draggable16, null)), children);
126
- return /*#__PURE__*/React.createElement("li", {
127
- className: (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-isOver"), isOver && !disabled), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-grabbed"), isGrabbed), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-selected"), selected), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder--sticky"), isSticky), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder"), !selected), _cx)),
128
- ref: ref,
129
- "aria-selected": isFocused,
130
- role: "option",
131
- tabIndex: isFocused ? 0 : -1,
132
- onKeyPress: function onKeyPress(e) {
133
- if (e.key === ' ' && e.target === e.currentTarget && !disabled) {
134
- var positionText = positionLabel.replace('{index}', index + 1).replace('{total}', listData.length);
135
- var grabAriaText = (isGrabbed ? droppedLabel : grabbedLabel).replace('{itemName}', ariaLabel);
136
- onGrab(grabAriaText + positionText);
137
- setIsGrabbed(!isGrabbed);
138
- e.preventDefault();
139
- }
140
- },
141
- onKeyDown: function onKeyDown(e) {
142
- if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
143
- onArrowKeyDown(e, isGrabbed, index);
144
- }
145
- },
146
- onBlur: function onBlur(e) {
147
- // handle when focus move to inner elements
148
- setIsFocusedOnItem(e.currentTarget === e.target);
149
- },
150
- onFocus: function onFocus(e) {
151
- // handle when focus move to li element
152
- setIsFocusedOnItem(e.currentTarget === e.target);
153
- }
154
- }, /*#__PURE__*/React.createElement("span", {
49
+ }, isSticky ? /*#__PURE__*/_react.default.createElement(_iconsReact.Locked16, null) : /*#__PURE__*/_react.default.createElement(_iconsReact.Draggable16, null)), children);
50
+ var style = {
51
+ transform: _utilities.CSS.Transform.toString(transform),
52
+ transition: transition
53
+ };
54
+ return /*#__PURE__*/_react.default.createElement("li", (0, _extends2.default)({
55
+ className: (0, _classnames.default)(classList, "".concat(blockClass, "__draggable-handleHolder"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder--selected"), selected), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder--sticky"), isSticky), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder--dragging"), isDragging), _cx)),
56
+ id: id,
57
+ ref: setNodeRef,
58
+ style: style
59
+ }, attributes, listeners, {
60
+ disabled: disabled,
61
+ "aria-selected": selected,
62
+ role: "option"
63
+ }), /*#__PURE__*/_react.default.createElement("span", {
155
64
  className: "".concat(blockClass, "__shared-ui--assistive-text")
156
- }, ariaLabel), isDragging && !isOver ? /*#__PURE__*/React.createElement("div", {
157
- ref: preview,
158
- className: "".concat(blockClass, "__draggable-handleHolder-droppable ").concat(blockClass, "__draggable-handleHolder-droppable--origin")
159
- }, content) : /*#__PURE__*/React.createElement("div", {
160
- ref: drag,
161
- "aria-hidden": isFocused && isFocusedOnItem // if focus on li, hide the children from aria
162
- ,
65
+ }, ariaLabel), /*#__PURE__*/_react.default.createElement("div", {
163
66
  className: (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__draggable-handleStyle"), !disabled), ["".concat(blockClass, "__draggable-handleHolder-droppable")])
164
- }, (!isOver || disabled) && content));
67
+ }, content));
165
68
  };
166
69
  DraggableElement.propTypes = {
167
70
  ariaLabel: _propTypes.default.string.isRequired,
168
71
  children: _propTypes.default.element.isRequired,
72
+ classList: _propTypes.default.string,
169
73
  disabled: _propTypes.default.bool,
170
- droppedLabel: _propTypes.default.string,
171
- grabbedLabel: _propTypes.default.string,
172
74
  id: _propTypes.default.string.isRequired,
173
- index: _propTypes.default.number.isRequired,
174
- isFocused: _propTypes.default.bool.isRequired,
175
75
  isSticky: _propTypes.default.bool,
176
- listData: _propTypes.default.array.isRequired,
177
- moveElement: _propTypes.default.func.isRequired,
178
- onArrowKeyDown: _propTypes.default.func.isRequired,
179
- onGrab: _propTypes.default.func.isRequired,
180
- positionLabel: _propTypes.default.string,
181
- selected: _propTypes.default.bool,
182
- type: _propTypes.default.string.isRequired
76
+ selected: _propTypes.default.bool
183
77
  };
184
78
  var _default = DraggableElement;
185
79
  exports.default = _default;