@carbon/ibm-products 1.62.1 → 1.64.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/css/index-full-carbon.css +29 -0
  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 +4 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +29 -0
  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 +29 -0
  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/Datagrid/Datagrid/DatagridContent.js +2 -1
  18. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +2 -2
  19. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -2
  20. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +58 -33
  21. package/es/components/Datagrid/useFiltering.js +2 -1
  22. package/es/components/Datagrid/utils/handleFilterTagLabelText.js +26 -0
  23. package/es/components/FilterSummary/FilterSummary.js +21 -7
  24. package/es/components/Guidebanner/Guidebanner.js +12 -3
  25. package/es/components/InlineTip/InlineTip.js +17 -6
  26. package/es/components/TagSet/TagSet.js +22 -5
  27. package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
  28. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +2 -2
  29. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -2
  30. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +58 -33
  31. package/lib/components/Datagrid/useFiltering.js +2 -1
  32. package/lib/components/Datagrid/utils/handleFilterTagLabelText.js +33 -0
  33. package/lib/components/FilterSummary/FilterSummary.js +23 -6
  34. package/lib/components/Guidebanner/Guidebanner.js +12 -3
  35. package/lib/components/InlineTip/InlineTip.js +17 -6
  36. package/lib/components/TagSet/TagSet.js +21 -4
  37. package/package.json +3 -3
  38. package/scss/components/FilterSummary/_filter-summary.scss +6 -1
  39. package/scss/components/Guidebanner/_guidebanner.scss +25 -0
  40. package/scss/components/InlineTip/_inline-tip.scss +12 -0
@@ -55,7 +55,9 @@ var FilterPanel = function FilterPanel(_ref) {
55
55
  _ref$searchPlaceholde = _ref.searchPlaceholder,
56
56
  searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde,
57
57
  _ref$reactTableFilter = _ref.reactTableFiltersState,
58
- reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter;
58
+ reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
59
+ _ref$isFetching = _ref.isFetching,
60
+ isFetching = _ref$isFetching === void 0 ? false : _ref$isFetching;
59
61
  /** State */
60
62
  var _useState = useState(false),
61
63
  _useState2 = _slicedToArray(_useState, 2),
@@ -73,7 +75,8 @@ var FilterPanel = function FilterPanel(_ref) {
73
75
  variation: PANEL,
74
76
  reactTableFiltersState: reactTableFiltersState,
75
77
  onCancel: onCancel,
76
- panelOpen: panelOpen
78
+ panelOpen: panelOpen,
79
+ isFetching: isFetching
77
80
  }),
78
81
  filtersState = _useFilters.filtersState,
79
82
  prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
@@ -238,6 +241,7 @@ FilterPanel.propTypes = {
238
241
  closeIconDescription: PropTypes.string,
239
242
  filterPanelMinHeight: PropTypes.number,
240
243
  filterSections: PropTypes.array,
244
+ isFetching: PropTypes.bool,
241
245
  onApply: PropTypes.func,
242
246
  onCancel: PropTypes.func,
243
247
  onPanelClose: PropTypes.func,
@@ -25,16 +25,21 @@ var useFilters = function useFilters(_ref) {
25
25
  reactTableFiltersState = _ref.reactTableFiltersState,
26
26
  _ref$onCancel = _ref.onCancel,
27
27
  onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel,
28
- panelOpen = _ref.panelOpen;
28
+ panelOpen = _ref.panelOpen,
29
+ isFetching = _ref.isFetching;
29
30
  /** State */
30
31
  var _useState = useState(getInitialStateFromFilters(filters, variation, reactTableFiltersState)),
31
32
  _useState2 = _slicedToArray(_useState, 2),
32
33
  filtersState = _useState2[0],
33
34
  setFiltersState = _useState2[1];
34
- var _useState3 = useState(reactTableFiltersState),
35
+ var _useState3 = useState(false),
35
36
  _useState4 = _slicedToArray(_useState3, 2),
36
- filtersObjectArray = _useState4[0],
37
- setFiltersObjectArray = _useState4[1];
37
+ fetchingReset = _useState4[0],
38
+ setFetchingReset = _useState4[1];
39
+ var _useState5 = useState(reactTableFiltersState),
40
+ _useState6 = _slicedToArray(_useState5, 2),
41
+ filtersObjectArray = _useState6[0],
42
+ setFiltersObjectArray = _useState6[1];
38
43
  var previousState = usePreviousValue({
39
44
  panelOpen: panelOpen
40
45
  });
@@ -50,7 +55,7 @@ var useFilters = function useFilters(_ref) {
50
55
  /** Methods */
51
56
  // If the user decides to cancel or click outside the flyout, it reverts back to the filters that were
52
57
  // there when they opened the flyout
53
- var revertToPreviousFilters = function revertToPreviousFilters() {
58
+ var revertToPreviousFilters = useCallback(function () {
54
59
  setFiltersState(JSON.parse(prevFiltersRef.current));
55
60
  setFiltersObjectArray(JSON.parse(prevFiltersObjectArrayRef.current));
56
61
  setAllFilters(JSON.parse(lastAppliedFilters.current));
@@ -60,7 +65,7 @@ var useFilters = function useFilters(_ref) {
60
65
  holdingPrevFiltersRef.current = JSON.parse(prevFiltersRef.current);
61
66
  holdingLastAppliedFiltersRef.current = JSON.parse(prevFiltersObjectArrayRef.current);
62
67
  holdingPrevFiltersObjectArrayRef.current = JSON.parse(lastAppliedFilters.current);
63
- };
68
+ }, [setAllFilters]);
64
69
  var reset = useCallback(function () {
65
70
  // When we reset we want the "initialFilters" to be an empty array
66
71
  var resetFiltersArray = [];
@@ -77,6 +82,7 @@ var useFilters = function useFilters(_ref) {
77
82
  // Update their respective refs so everything is in sync
78
83
  prevFiltersRef.current = JSON.stringify(initialFiltersState);
79
84
  prevFiltersObjectArrayRef.current = JSON.stringify(initialFiltersObjectArray);
85
+ lastAppliedFilters.current = JSON.stringify([]);
80
86
  }, [filters, setAllFilters, variation]);
81
87
  var applyFilters = function applyFilters(_ref2) {
82
88
  var column = _ref2.column,
@@ -167,7 +173,6 @@ var useFilters = function useFilters(_ref) {
167
173
  };
168
174
  /** Render the individual filter component */
169
175
  var renderFilter = function renderFilter(_ref3) {
170
- var _filtersState$column, _filtersState$column2;
171
176
  var type = _ref3.type,
172
177
  column = _ref3.column,
173
178
  components = _ref3.props;
@@ -254,31 +259,36 @@ var useFilters = function useFilters(_ref) {
254
259
  }));
255
260
  break;
256
261
  case RADIO:
257
- filter = /*#__PURE__*/React.createElement(FormGroup, components.FormGroup, /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({}, components.RadioButtonGroup, {
258
- valueSelected: ((_filtersState$column = filtersState[column]) === null || _filtersState$column === void 0 ? void 0 : _filtersState$column.value) === '' ? 'Any' : (_filtersState$column2 = filtersState[column]) === null || _filtersState$column2 === void 0 ? void 0 : _filtersState$column2.value,
259
- onChange: function onChange(selected) {
260
- var _components$RadioButt, _components$RadioButt2;
261
- setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
262
- value: selected,
263
- type: type
264
- })));
265
- applyFilters({
266
- column: column,
267
- value: selected,
268
- type: type
269
- });
270
- (_components$RadioButt = (_components$RadioButt2 = components.RadioButtonGroup).onChange) === null || _components$RadioButt === void 0 ? void 0 : _components$RadioButt.call(_components$RadioButt2, selected);
271
- }
272
- }), /*#__PURE__*/React.createElement(RadioButton, {
273
- id: "any",
274
- labelText: "Any",
275
- value: "Any"
276
- }), components.RadioButton.map(function (radio) {
277
- var _ref4, _radio$id;
278
- return /*#__PURE__*/React.createElement(RadioButton, _extends({
279
- key: (_ref4 = (_radio$id = radio.id) !== null && _radio$id !== void 0 ? _radio$id : radio.labelText) !== null && _ref4 !== void 0 ? _ref4 : radio.value
280
- }, radio));
281
- })));
262
+ {
263
+ var _filtersState$column, _components$DefaultRa, _components$DefaultRa2, _filtersState$column2, _components$DefaultRa3, _components$DefaultRa4, _components$DefaultRa5, _components$DefaultRa6, _components$DefaultRa7, _components$DefaultRa8;
264
+ var _components$RadioButt = _objectSpread({}, components.RadioButtonGroup),
265
+ name = _components$RadioButt.name;
266
+ filter = /*#__PURE__*/React.createElement(FormGroup, components.FormGroup, /*#__PURE__*/React.createElement(RadioButtonGroup, _extends({}, components.RadioButtonGroup, {
267
+ valueSelected: ((_filtersState$column = filtersState[column]) === null || _filtersState$column === void 0 ? void 0 : _filtersState$column.value) === '' ? (_components$DefaultRa = (_components$DefaultRa2 = components.DefaultRadioButton) === null || _components$DefaultRa2 === void 0 ? void 0 : _components$DefaultRa2.value) !== null && _components$DefaultRa !== void 0 ? _components$DefaultRa : 'Any' : (_filtersState$column2 = filtersState[column]) === null || _filtersState$column2 === void 0 ? void 0 : _filtersState$column2.value,
268
+ onChange: function onChange(selected) {
269
+ var _components$RadioButt2, _components$RadioButt3;
270
+ setFiltersState(_objectSpread(_objectSpread({}, filtersState), {}, _defineProperty({}, column, {
271
+ value: selected,
272
+ type: type
273
+ })));
274
+ applyFilters({
275
+ column: column,
276
+ value: selected,
277
+ type: type
278
+ });
279
+ (_components$RadioButt2 = (_components$RadioButt3 = components.RadioButtonGroup).onChange) === null || _components$RadioButt2 === void 0 ? void 0 : _components$RadioButt2.call(_components$RadioButt3, selected);
280
+ }
281
+ }), /*#__PURE__*/React.createElement(RadioButton, _extends({
282
+ id: (_components$DefaultRa3 = components === null || components === void 0 ? void 0 : (_components$DefaultRa4 = components.DefaultRadioButton) === null || _components$DefaultRa4 === void 0 ? void 0 : _components$DefaultRa4.id) !== null && _components$DefaultRa3 !== void 0 ? _components$DefaultRa3 : "any__".concat(name),
283
+ labelText: (_components$DefaultRa5 = components === null || components === void 0 ? void 0 : (_components$DefaultRa6 = components.DefaultRadioButton) === null || _components$DefaultRa6 === void 0 ? void 0 : _components$DefaultRa6.labelText) !== null && _components$DefaultRa5 !== void 0 ? _components$DefaultRa5 : 'Any',
284
+ value: (_components$DefaultRa7 = components === null || components === void 0 ? void 0 : (_components$DefaultRa8 = components.DefaultRadioButton) === null || _components$DefaultRa8 === void 0 ? void 0 : _components$DefaultRa8.value) !== null && _components$DefaultRa7 !== void 0 ? _components$DefaultRa7 : 'Any'
285
+ }, components.DefaultRadioButton)), components.RadioButton.map(function (radio) {
286
+ var _ref4, _radio$id;
287
+ return /*#__PURE__*/React.createElement(RadioButton, _extends({
288
+ key: (_ref4 = (_radio$id = radio.id) !== null && _radio$id !== void 0 ? _radio$id : radio.labelText) !== null && _ref4 !== void 0 ? _ref4 : radio.value
289
+ }, radio));
290
+ })));
291
+ }
282
292
  break;
283
293
  case DROPDOWN:
284
294
  filter = /*#__PURE__*/React.createElement(Dropdown, _extends({}, components.Dropdown, {
@@ -314,6 +324,7 @@ var useFilters = function useFilters(_ref) {
314
324
  */
315
325
  useEffect(function () {
316
326
  if (!panelOpen && previousState !== null && previousState !== void 0 && previousState.panelOpen) {
327
+ revertToPreviousFilters();
317
328
  setAllFilters(holdingLastAppliedFiltersRef.current);
318
329
  }
319
330
  if (panelOpen && !(previousState !== null && previousState !== void 0 && previousState.panelOpen)) {
@@ -323,7 +334,21 @@ var useFilters = function useFilters(_ref) {
323
334
  setAllFilters(JSON.parse(prevFiltersObjectArrayRef.current));
324
335
  }
325
336
  }
326
- }, [panelOpen, previousState, previousState === null || previousState === void 0 ? void 0 : previousState.panelOpen, reset, setAllFilters]);
337
+ }, [panelOpen, previousState, previousState === null || previousState === void 0 ? void 0 : previousState.panelOpen, reset, setAllFilters, revertToPreviousFilters]);
338
+
339
+ // Re-applies filters if the Datagrid goes into a fetching state while panel is open
340
+ // and has had filters changed without applying
341
+ useEffect(function () {
342
+ if (isFetching && !fetchingReset) {
343
+ setFiltersState(JSON.parse(prevFiltersRef.current));
344
+ setFiltersObjectArray(JSON.parse(prevFiltersRef.current));
345
+ setAllFilters(JSON.parse(prevFiltersObjectArrayRef.current));
346
+ setFetchingReset(true);
347
+ }
348
+ if (!isFetching) {
349
+ setFetchingReset(false);
350
+ }
351
+ }, [isFetching, reactTableFiltersState, setAllFilters, fetchingReset]);
327
352
  var cancel = function cancel() {
328
353
  // Reverting to previous filters only applies when using batch actions
329
354
  if (updateMethod === BATCH) {
@@ -28,7 +28,8 @@ var useFiltering = function useFiltering(hooks) {
28
28
  var rowValue = row.values[id];
29
29
  var startDateObj = _typeof(startDate) === 'object' ? startDate : new Date(startDate);
30
30
  var endDateObj = _typeof(endDate) === 'object' ? endDate : new Date(endDate);
31
- if (rowValue.getTime() <= endDateObj.getTime() && rowValue.getTime() >= startDateObj.getTime()) {
31
+ var rowValueDateObj = _typeof(rowValue) === 'object' ? rowValue : new Date(rowValue);
32
+ if (rowValueDateObj.getTime() <= endDateObj.getTime() && rowValueDateObj.getTime() >= startDateObj.getTime()) {
32
33
  // In date range
33
34
  return true;
34
35
  } else {
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 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.
6
+ */
7
+
8
+ // Example usage for custom filter tag labels, in practice this
9
+ // is where a translation service would be utilized. This
10
+ // utility is for storybook demonstration purposes only.
11
+ export var handleFilterTagLabelText = function handleFilterTagLabelText(key, value) {
12
+ switch (key) {
13
+ case 'role':
14
+ return "Role: ".concat(value);
15
+ case 'joined':
16
+ return "Joined: ".concat(value);
17
+ case 'visits':
18
+ return "Visits: ".concat(value);
19
+ case 'passwordStrength':
20
+ return "Password strength: ".concat(value);
21
+ case 'status':
22
+ return "Status: ".concat(value);
23
+ default:
24
+ return "".concat(key, ": ").concat(value);
25
+ }
26
+ };
@@ -4,19 +4,21 @@ var _excluded = ["key", "value"];
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, 2022
7
+ * Copyright IBM Corp. 2022, 2023
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
  import { Button } from 'carbon-components-react';
13
- import React from 'react';
13
+ import React, { useRef } from 'react';
14
14
  import PropTypes from 'prop-types';
15
15
  import cx from 'classnames';
16
16
  import { TagSet } from '../TagSet';
17
17
  import { pkg } from '../../settings';
18
+ import uuidv4 from '../../global/js/utils/uuidv4';
18
19
  var blockClass = "".concat(pkg.prefix, "--filter-summary");
19
20
  var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
+ var _filterSummaryClearBu;
20
22
  var _ref$className = _ref.className,
21
23
  className = _ref$className === void 0 ? '' : _ref$className,
22
24
  _ref$clearFiltersText = _ref.clearFiltersText,
@@ -28,7 +30,10 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
28
30
  _ref$renderLabel = _ref.renderLabel,
29
31
  renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
30
32
  _ref$overflowType = _ref.overflowType,
31
- overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType;
33
+ overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
34
+ _ref$clearButtonInlin = _ref.clearButtonInline,
35
+ clearButtonInline = _ref$clearButtonInlin === void 0 ? true : _ref$clearButtonInlin;
36
+ var filterSummaryId = "".concat(blockClass, "__").concat(uuidv4());
32
37
  var tagFilters = filters.map(function (_ref2) {
33
38
  var _renderLabel;
34
39
  var key = _ref2.key,
@@ -39,26 +44,35 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
44
  label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
40
45
  });
41
46
  });
47
+ var filterSummaryClearButton = useRef();
48
+ var filterSummaryRef = useRef();
49
+ var localRef = filterSummaryRef || ref;
42
50
  return /*#__PURE__*/React.createElement("div", {
43
- ref: ref,
44
- className: cx([blockClass, className])
51
+ ref: localRef,
52
+ className: cx([blockClass, className]),
53
+ id: filterSummaryId
45
54
  }, /*#__PURE__*/React.createElement(TagSet, {
46
55
  allTagsModalSearchLabel: "Search all tags",
47
56
  allTagsModalSearchPlaceholderText: "Search all tags",
48
57
  allTagsModalTitle: "All tags",
49
58
  showAllTagsLabel: "View all tags",
50
59
  tags: tagFilters,
51
- overflowType: overflowType
60
+ overflowType: overflowType,
61
+ className: cx(_defineProperty({}, "".concat(blockClass, "__clear-button-inline"), clearButtonInline)),
62
+ containingElementRef: localRef,
63
+ measurementOffset: filterSummaryClearButton === null || filterSummaryClearButton === void 0 ? void 0 : (_filterSummaryClearBu = filterSummaryClearButton.current) === null || _filterSummaryClearBu === void 0 ? void 0 : _filterSummaryClearBu.offsetWidth
52
64
  }), /*#__PURE__*/React.createElement(Button, {
53
65
  kind: "ghost",
54
66
  size: "sm",
55
- onClick: clearFilters
67
+ onClick: clearFilters,
68
+ ref: filterSummaryClearButton
56
69
  }, clearFiltersText));
57
70
  });
58
71
  var componentName = 'FilterSummary';
59
72
  FilterSummary.displayName = componentName;
60
73
  FilterSummary.propTypes = {
61
74
  className: PropTypes.string,
75
+ clearButtonInline: PropTypes.boolean,
62
76
  clearFilters: PropTypes.func.isRequired,
63
77
  clearFiltersText: PropTypes.string,
64
78
  filters: PropTypes.arrayOf(PropTypes.object).isRequired,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "className", "collapsible", "onClose", "closeIconDescription", "collapseButtonLabel", "expandButtonLabel", "nextIconDescription", "previousIconDescription", "title"];
4
+ var _excluded = ["children", "className", "collapsible", "onClose", "withLeftGutter", "closeIconDescription", "collapseButtonLabel", "expandButtonLabel", "nextIconDescription", "previousIconDescription", "title"];
5
5
  /**
6
6
  * Copyright IBM Corp. 2023, 2023
7
7
  *
@@ -30,6 +30,7 @@ var blockClass = "".concat(pkg.prefix, "--guidebanner");
30
30
  var componentName = 'Guidebanner';
31
31
  var defaults = {
32
32
  collapsible: false,
33
+ withLeftGutter: false,
33
34
  // Labels
34
35
  closeIconDescription: 'Close',
35
36
  collapseButtonLabel: 'Read less',
@@ -48,6 +49,8 @@ export var Guidebanner = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
48
49
  _ref$collapsible = _ref.collapsible,
49
50
  collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
50
51
  onClose = _ref.onClose,
52
+ _ref$withLeftGutter = _ref.withLeftGutter,
53
+ withLeftGutter = _ref$withLeftGutter === void 0 ? defaults.withLeftGutter : _ref$withLeftGutter,
51
54
  _ref$closeIconDescrip = _ref.closeIconDescription,
52
55
  closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
53
56
  _ref$collapseButtonLa = _ref.collapseButtonLabel,
@@ -83,7 +86,7 @@ export var Guidebanner = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
83
86
  };
84
87
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
85
88
  "aria-expanded": !isCollapsed,
86
- className: cx(blockClass, className, [collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null]),
89
+ className: cx(blockClass, className, collapsible && "".concat(blockClass, "__collapsible"), isCollapsed && "".concat(blockClass, "__collapsible-collapsed"), withLeftGutter && "".concat(blockClass, "__with-left-gutter")),
87
90
  ref: ref
88
91
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Idea20, {
89
92
  className: "".concat(blockClass, "__icon-idea")
@@ -222,5 +225,11 @@ Guidebanner.propTypes = {
222
225
  /**
223
226
  * Title text.
224
227
  */
225
- title: PropTypes.string.isRequired
228
+ title: PropTypes.string.isRequired,
229
+ /**
230
+ * If true, insert 1 rem of "space" on the left of the component.
231
+ * This will allow the component's content to line up with other
232
+ * content on the page under special circumstances.
233
+ */
234
+ withLeftGutter: PropTypes.bool
226
235
  };
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "className", "closeIconDescription", "collapsible", "collapseButtonLabel", "expandButtonLabel", "narrow", "onClick", "onClose", "tertiaryButtonLabel", "action", "title", "media"];
4
+ var _excluded = ["action", "children", "className", "closeIconDescription", "collapsible", "collapseButtonLabel", "expandButtonLabel", "media", "narrow", "onClick", "onClose", "tertiaryButtonLabel", "title", "withLeftGutter"];
5
5
  /**
6
6
  * Copyright IBM Corp. 2023, 2023
7
7
  *
@@ -48,6 +48,7 @@ var defaults = {
48
48
  collapseButtonLabel: 'Read less',
49
49
  expandButtonLabel: 'Read more',
50
50
  narrow: false,
51
+ withLeftGutter: false,
51
52
  onClick: function onClick() {},
52
53
  onClose: function onClose() {}
53
54
  };
@@ -56,7 +57,8 @@ var defaults = {
56
57
  * TODO: A description of the component.
57
58
  */
58
59
  export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
59
- var children = _ref.children,
60
+ var action = _ref.action,
61
+ children = _ref.children,
60
62
  className = _ref.className,
61
63
  _ref$closeIconDescrip = _ref.closeIconDescription,
62
64
  closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
@@ -66,15 +68,16 @@ export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
66
68
  collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
67
69
  _ref$expandButtonLabe = _ref.expandButtonLabel,
68
70
  expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
71
+ media = _ref.media,
69
72
  _ref$narrow = _ref.narrow,
70
73
  narrow = _ref$narrow === void 0 ? defaults.narrow : _ref$narrow,
71
74
  onClick = _ref.onClick,
72
75
  onClose = _ref.onClose,
73
76
  tertiaryButtonLabel = _ref.tertiaryButtonLabel,
74
- action = _ref.action,
75
77
  _ref$title = _ref.title,
76
78
  title = _ref$title === void 0 ? defaults.title : _ref$title,
77
- media = _ref.media,
79
+ _ref$withLeftGutter = _ref.withLeftGutter,
80
+ withLeftGutter = _ref$withLeftGutter === void 0 ? defaults.withLeftGutter : _ref$withLeftGutter,
78
81
  rest = _objectWithoutProperties(_ref, _excluded);
79
82
  var _useState = useState(collapsible),
80
83
  _useState2 = _slicedToArray(_useState, 2),
@@ -101,7 +104,7 @@ export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
101
104
  // Apply the block class to the main HTML element
102
105
  className,
103
106
  // Apply any supplied class names to the main HTML element.
104
- [collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null], [narrow ? "".concat(blockClass, "__narrow") : "".concat(blockClass, "__wide")], [media ? "".concat(blockClass, "__has-media") : null]),
107
+ collapsible && "".concat(blockClass, "__collapsible"), isCollapsed && "".concat(blockClass, "__collapsible-collapsed"), media && "".concat(blockClass, "__has-media"), [narrow ? "".concat(blockClass, "__narrow") : "".concat(blockClass, "__wide")], withLeftGutter && !narrow && "".concat(blockClass, "__with-left-gutter")),
105
108
  ref: ref,
106
109
  role: "complementary"
107
110
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Button, {
@@ -228,5 +231,13 @@ InlineTip.propTypes = {
228
231
  /**
229
232
  * The title of the InlineTip.
230
233
  */
231
- title: PropTypes.string.isRequired
234
+ title: PropTypes.string.isRequired,
235
+ /**
236
+ * If true, insert 1 rem of "space" on the left of the component.
237
+ * This will allow the component's content to line up with other
238
+ * content on the page under special circumstances.
239
+ *
240
+ * This will only be applied when `narrow` is false.
241
+ */
242
+ withLeftGutter: PropTypes.bool
232
243
  };
@@ -2,13 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
5
+ var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset"],
6
6
  _excluded2 = ["label", "id"],
7
7
  _excluded3 = ["label"];
8
8
  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; }
9
9
  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; }
10
10
  //
11
- // Copyright IBM Corp. 2020, 2021
11
+ // Copyright IBM Corp. 2020, 2023
12
12
  //
13
13
  // This source code is licensed under the Apache-2.0 license found in the
14
14
  // LICENSE file in the root directory of this source tree.
@@ -33,6 +33,7 @@ var allTagsModalSearchThreshold = 10;
33
33
  var defaults = {
34
34
  align: 'start',
35
35
  // allTagsModalTarget: document.body,
36
+ measurementOffset: 0,
36
37
  overflowAlign: 'center',
37
38
  overflowDirection: 'bottom',
38
39
  overflowType: 'default'
@@ -56,6 +57,9 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
56
57
  allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
57
58
  showAllTagsLabel = _ref.showAllTagsLabel,
58
59
  tags = _ref.tags,
60
+ containingElementRef = _ref.containingElementRef,
61
+ _ref$measurementOffse = _ref.measurementOffset,
62
+ measurementOffset = _ref$measurementOffse === void 0 ? defaults.measurementOffset : _ref$measurementOffse,
59
63
  rest = _objectWithoutProperties(_ref, _excluded);
60
64
  var _useState = useState(3),
61
65
  _useState2 = _slicedToArray(_useState, 2),
@@ -160,7 +164,9 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
160
164
  // how many will fit?
161
165
  var willFit = 0;
162
166
  if (sizingTags.length > 0) {
163
- var spaceAvailable = tagSetRef.current.offsetWidth;
167
+ var optionalContainingElement = containingElementRef === null || containingElementRef === void 0 ? void 0 : containingElementRef.current;
168
+ var measurementOffsetValue = typeof measurementOffset === 'number' ? measurementOffset : 0;
169
+ var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : tagSetRef.current.offsetWidth;
164
170
  for (var i in sizingTags) {
165
171
  var tagWidth = sizingTags[i].offsetWidth;
166
172
  if (spaceAvailable >= tagWidth) {
@@ -183,7 +189,7 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
183
189
  } else {
184
190
  setDisplayCount(maxVisible ? Math.min(willFit, maxVisible) : willFit);
185
191
  }
186
- }, [maxVisible, multiline, sizingTags, tagSetRef]);
192
+ }, [maxVisible, multiline, sizingTags, tagSetRef, containingElementRef, measurementOffset]);
187
193
  useEffect(function () {
188
194
  checkFullyVisibleTags();
189
195
  }, [checkFullyVisibleTags, maxVisible, multiline, sizingTags]);
@@ -205,7 +211,8 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
205
211
  setShowAllModalOpen(false);
206
212
  };
207
213
  useResizeObserver(sizingContainerRef, handleSizerTagsResize);
208
- useResizeObserver(tagSetRef, handleResize);
214
+ var resizeOption = containingElementRef ? containingElementRef : tagSetRef;
215
+ useResizeObserver(resizeOption, handleResize);
209
216
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
210
217
  className: cx([blockClass, className]),
211
218
  ref: tagSetRef
@@ -284,10 +291,20 @@ TagSet.propTypes = {
284
291
  * className
285
292
  */
286
293
  className: PropTypes.string,
294
+ /**
295
+ * Optional ref for custom resize container to measure available space
296
+ * Default will measure the available space of the TagSet container itself.
297
+ */
298
+ containingElementRef: PropTypes.object,
287
299
  /**
288
300
  * maximum visible tags
289
301
  */
290
302
  maxVisible: PropTypes.number,
303
+ /**
304
+ * Specify offset amount for measure available space, only used when `containingElementSelector`
305
+ * is also provided
306
+ */
307
+ measurementOffset: PropTypes.number,
291
308
  /**
292
309
  * display tags in multiple lines
293
310
  */
@@ -168,7 +168,8 @@ var DatagridContent = function DatagridContent(_ref) {
168
168
  updateMethod: "batch"
169
169
  }, getFilterFlyoutProps(), {
170
170
  title: filterProps.panelTitle,
171
- filterSections: filterProps.sections
171
+ filterSections: filterProps.sections,
172
+ isFetching: isFetching
172
173
  })), /*#__PURE__*/_react.default.createElement("div", {
173
174
  className: "".concat(blockClass, "__table-container-inner")
174
175
  }, renderFilterSummary(), withInlineEdit ? /*#__PURE__*/_react.default.createElement("div", {
@@ -154,9 +154,9 @@ var DatagridToolbar = function DatagridToolbar(datagridState) {
154
154
  return batchActions && DatagridActions ? /*#__PURE__*/_react.default.createElement("div", {
155
155
  ref: ref,
156
156
  className: (0, _classnames.default)([toolbarClass, "".concat(toolbarClass, "--").concat(getRowHeight)])
157
- }, /*#__PURE__*/_react.default.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActionsToolbar && DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/_react.default.createElement("div", {
157
+ }, /*#__PURE__*/_react.default.createElement(TableToolbar, null, DatagridActions && /*#__PURE__*/_react.default.createElement(DatagridActions, datagridState), DatagridBatchActionsToolbar && DatagridBatchActionsToolbar(datagridState, width, ref))) : DatagridActions ? /*#__PURE__*/_react.default.createElement("div", {
158
158
  className: toolbarClass
159
- }, /*#__PURE__*/_react.default.createElement(TableToolbar, null, DatagridActions && DatagridActions(datagridState), DatagridBatchActions && DatagridBatchActions(datagridState))) : null;
159
+ }, /*#__PURE__*/_react.default.createElement(TableToolbar, null, DatagridActions && /*#__PURE__*/_react.default.createElement(DatagridActions, datagridState), DatagridBatchActions && DatagridBatchActions(datagridState))) : null;
160
160
  };
161
161
  var _default = DatagridToolbar;
162
162
  exports.default = _default;
@@ -65,7 +65,9 @@ var FilterPanel = function FilterPanel(_ref) {
65
65
  _ref$searchPlaceholde = _ref.searchPlaceholder,
66
66
  searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Find filters' : _ref$searchPlaceholde,
67
67
  _ref$reactTableFilter = _ref.reactTableFiltersState,
68
- reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter;
68
+ reactTableFiltersState = _ref$reactTableFilter === void 0 ? [] : _ref$reactTableFilter,
69
+ _ref$isFetching = _ref.isFetching,
70
+ isFetching = _ref$isFetching === void 0 ? false : _ref$isFetching;
69
71
  /** State */
70
72
  var _useState = (0, _react.useState)(false),
71
73
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -83,7 +85,8 @@ var FilterPanel = function FilterPanel(_ref) {
83
85
  variation: _constants.PANEL,
84
86
  reactTableFiltersState: reactTableFiltersState,
85
87
  onCancel: onCancel,
86
- panelOpen: panelOpen
88
+ panelOpen: panelOpen,
89
+ isFetching: isFetching
87
90
  }),
88
91
  filtersState = _useFilters.filtersState,
89
92
  prevFiltersObjectArrayRef = _useFilters.prevFiltersObjectArrayRef,
@@ -248,6 +251,7 @@ FilterPanel.propTypes = {
248
251
  closeIconDescription: _propTypes.default.string,
249
252
  filterPanelMinHeight: _propTypes.default.number,
250
253
  filterSections: _propTypes.default.array,
254
+ isFetching: _propTypes.default.bool,
251
255
  onApply: _propTypes.default.func,
252
256
  onCancel: _propTypes.default.func,
253
257
  onPanelClose: _propTypes.default.func,