@carbon/ibm-products 2.43.2-canary.78 → 2.43.2-canary.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/css/index-full-carbon.css +241 -56
  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-released-only.css +3 -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 +61 -18
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +162 -42
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ActionBar/ActionBarItem.js +1 -1
  18. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +33 -1
  19. package/es/components/StringFormatter/StringFormatter.js +14 -3
  20. package/es/components/StringFormatter/utils/enums.d.ts +20 -1
  21. package/es/components/StringFormatter/utils/enums.js +22 -2
  22. package/es/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  23. package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1020 -1058
  24. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +881 -758
  25. package/lib/components/ActionBar/ActionBarItem.js +1 -1
  26. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +32 -0
  27. package/lib/components/StringFormatter/StringFormatter.js +13 -2
  28. package/lib/components/StringFormatter/utils/enums.d.ts +20 -1
  29. package/lib/components/StringFormatter/utils/enums.js +23 -1
  30. package/lib/node_modules/@carbon/icon-helpers/es/index.js +49 -62
  31. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +1036 -1074
  32. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +946 -823
  33. package/package.json +4 -4
  34. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsTearsheet.scss +7 -5
  35. package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +5 -4
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty, toConsumableArray as _toConsumableArray } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import { MULTISELECT, DROPDOWN, RADIO, CHECKBOX, NUMBER, DATE, BATCH, SAVED_FILTERS, INSTANT, PANEL } from '../constants.js';
10
10
  import { MultiSelect, Dropdown, FormGroup, RadioButtonGroup, RadioButton, NumberInput, DatePicker, DatePickerInput, Layer, Checkbox } from '@carbon/react';
11
11
  import React__default, { useContext, useState, useRef, useCallback, useEffect } from 'react';
@@ -13,6 +13,7 @@ import OverflowCheckboxes from '../OverflowCheckboxes.js';
13
13
  import { getInitialStateFromFilters } from '../utils.js';
14
14
  import { FilterContext } from '../FilterProvider.js';
15
15
  import { handleCheckboxChange } from '../handleCheckboxChange.js';
16
+ import uuidv4 from '../../../../../../global/js/utils/uuidv4.js';
16
17
  import { usePreviousValue } from '../../../../../../global/js/hooks/usePreviousValue.js';
17
18
 
18
19
  var useFilters = function useFilters(_ref) {
@@ -47,6 +48,7 @@ var useFilters = function useFilters(_ref) {
47
48
  var previousState = usePreviousValue({
48
49
  panelOpen: panelOpen
49
50
  });
51
+ var filteredItemsRef = useRef();
50
52
 
51
53
  // When using batch actions we have to store the filters to then apply them later
52
54
  var prevFiltersRef = useRef(JSON.stringify(filtersState));
@@ -307,8 +309,18 @@ var useFilters = function useFilters(_ref) {
307
309
  }
308
310
  return null;
309
311
  }).filter(Boolean);
312
+ var isEqual = compareFilterItems(filteredItems);
313
+ if (!isEqual) {
314
+ filteredItemsRef.current = _toConsumableArray(filteredItems);
315
+ }
316
+ var getKey = function getKey() {
317
+ return isEqual ? {
318
+ key: uuidv4()
319
+ } : column;
320
+ };
310
321
  filter = /*#__PURE__*/React__default.createElement(MultiSelect, _extends({}, components.MultiSelect, {
311
322
  selectedItems: filteredItems,
323
+ key: getKey(),
312
324
  onChange: function onChange(_ref9) {
313
325
  var _components$MultiSele, _components$MultiSele2;
314
326
  var selectedItems = _ref9.selectedItems;
@@ -324,6 +336,7 @@ var useFilters = function useFilters(_ref) {
324
336
  }
325
337
  return null;
326
338
  }).filter(Boolean);
339
+ filteredItemsRef.current = _toConsumableArray(foundItems);
327
340
 
328
341
  // Change selected state for those items that have been selected
329
342
  allOptions.map(function (a) {
@@ -366,6 +379,25 @@ var useFilters = function useFilters(_ref) {
366
379
  key: column
367
380
  }, filter);
368
381
  };
382
+ var compareFilterItems = function compareFilterItems(filteredItems) {
383
+ var _filteredItems$map, _filteredItemsRef$cur, _filteredItemsRef$cur2;
384
+ var filteredItemsId = (_filteredItems$map = filteredItems.map(function (item) {
385
+ return item.id;
386
+ })) !== null && _filteredItems$map !== void 0 ? _filteredItems$map : [];
387
+ var previousFilteredItemsId = (_filteredItemsRef$cur = filteredItemsRef === null || filteredItemsRef === void 0 || (_filteredItemsRef$cur2 = filteredItemsRef.current) === null || _filteredItemsRef$cur2 === void 0 ? void 0 : _filteredItemsRef$cur2.map(function (item) {
388
+ return item.id;
389
+ })) !== null && _filteredItemsRef$cur !== void 0 ? _filteredItemsRef$cur : [];
390
+ var set1 = new Set(filteredItemsId);
391
+ var set2 = new Set(previousFilteredItemsId);
392
+ // Check if the sets have the same size (same number of unique elements)
393
+ if (set1.size !== set2.size) {
394
+ return false;
395
+ }
396
+ // Check if all elements in set1 are also present in set2 (using spread syntax)
397
+ return _toConsumableArray(set1).every(function (element) {
398
+ return set2.has(element);
399
+ });
400
+ };
369
401
 
370
402
  /** This useEffect will properly handle the previous filters when the panel closes
371
403
  * 1. If the panel closes we need to call the reset fn but also store the
@@ -12,14 +12,15 @@ import cx from 'classnames';
12
12
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { DefinitionTooltip } from '@carbon/react';
15
- import { StringFormatterAlignment } from './utils/enums.js';
15
+ import { StringFormatterAlignment, deprecated_StringFormatterAlignment, propMappingFunction } from './utils/enums.js';
16
+ import { allPropTypes } from '../../global/js/utils/props-helper.js';
16
17
 
17
18
  var _excluded = ["className", "lines", "tooltipDirection", "truncate", "width", "value"];
18
19
  var blockClass = "".concat(pkg.prefix, "--string-formatter");
19
20
  var componentName = 'StringFormatter';
20
21
  var defaults = {
21
22
  lines: 1,
22
- tooltipDirection: StringFormatterAlignment.BOTTOM_LEFT,
23
+ tooltipDirection: StringFormatterAlignment.BOTTOM_START,
23
24
  truncate: false,
24
25
  width: null
25
26
  };
@@ -59,6 +60,16 @@ var StringFormatter = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
59
60
  });
60
61
  StringFormatter = pkg.checkComponentEnabled(StringFormatter, componentName);
61
62
  StringFormatter.displayName = componentName;
63
+ StringFormatter.validateAlignment = function () {
64
+ return function (props, propName, componentName) {
65
+ var prop = props[propName];
66
+ var deprecatedAlignValues = Object.values(deprecated_StringFormatterAlignment);
67
+ if (deprecatedAlignValues.includes(prop)) {
68
+ var mappedNewProp = propMappingFunction(prop);
69
+ console.warn("\"".concat(prop, "\" is a deprecated value for the \"").concat(propName, "\" prop on the \"").concat(componentName, "\" component. Use \"").concat(mappedNewProp, "\" instead. Allowable values are: ").concat(Object.values(StringFormatterAlignment).join(', '), "."));
70
+ }
71
+ };
72
+ };
62
73
  StringFormatter.propTypes = {
63
74
  /**
64
75
  * Provide an optional class to be applied to the containing node.
@@ -67,7 +78,7 @@ StringFormatter.propTypes = {
67
78
  /** Number of lines to clamp value. */
68
79
  lines: PropTypes.number,
69
80
  /** Specify the direction of the tooltip. Can be either top or bottom. */
70
- tooltipDirection: PropTypes.oneOf(Object.values(StringFormatterAlignment)),
81
+ tooltipDirection: allPropTypes([StringFormatter.validateAlignment(), PropTypes.oneOf(Object.values(deprecated_StringFormatterAlignment), Object.values(StringFormatterAlignment))]),
71
82
  /** Whether or not the value should be truncated. */
72
83
  truncate: PropTypes.bool,
73
84
  /** Value to format. */
@@ -1,4 +1,4 @@
1
- export namespace StringFormatterAlignment {
1
+ export namespace deprecated_StringFormatterAlignment {
2
2
  let TOP: string;
3
3
  let TOP_LEFT: string;
4
4
  let TOP_RIGHT: string;
@@ -12,3 +12,22 @@ export namespace StringFormatterAlignment {
12
12
  let RIGHT_BOTTOM: string;
13
13
  let RIGHT_TOP: string;
14
14
  }
15
+ export namespace StringFormatterAlignment {
16
+ let TOP_1: string;
17
+ export { TOP_1 as TOP };
18
+ export let TOP_START: string;
19
+ export let TOP_END: string;
20
+ let BOTTOM_1: string;
21
+ export { BOTTOM_1 as BOTTOM };
22
+ export let BOTTOM_START: string;
23
+ export let BOTTOM_END: string;
24
+ let LEFT_1: string;
25
+ export { LEFT_1 as LEFT };
26
+ export let LEFT_END: string;
27
+ export let LEFT_START: string;
28
+ let RIGHT_1: string;
29
+ export { RIGHT_1 as RIGHT };
30
+ export let RIGHT_END: string;
31
+ export let RIGHT_START: string;
32
+ }
33
+ export function propMappingFunction(deprecatedValue: any): string;
@@ -5,7 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- var StringFormatterAlignment = {
8
+ import { defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+
10
+ var deprecated_StringFormatterAlignment = {
9
11
  TOP: 'top',
10
12
  TOP_LEFT: 'top-left',
11
13
  TOP_RIGHT: 'top-right',
@@ -19,5 +21,23 @@ var StringFormatterAlignment = {
19
21
  RIGHT_BOTTOM: 'right-bottom',
20
22
  RIGHT_TOP: 'right-top'
21
23
  };
24
+ var StringFormatterAlignment = {
25
+ TOP: 'top',
26
+ TOP_START: 'top-start',
27
+ TOP_END: 'top-end',
28
+ BOTTOM: 'bottom',
29
+ BOTTOM_START: 'bottom-start',
30
+ BOTTOM_END: 'bottom-end',
31
+ LEFT: 'left',
32
+ LEFT_END: 'left-end',
33
+ LEFT_START: 'left-start',
34
+ RIGHT: 'right',
35
+ RIGHT_END: 'right-end',
36
+ RIGHT_START: 'right-start'
37
+ };
38
+ var propMappingFunction = function propMappingFunction(deprecatedValue) {
39
+ var mapping = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, deprecated_StringFormatterAlignment.TOP_LEFT, StringFormatterAlignment.TOP_START), deprecated_StringFormatterAlignment.TOP_RIGHT, StringFormatterAlignment.TOP_END), deprecated_StringFormatterAlignment.BOTTOM_LEFT, StringFormatterAlignment.BOTTOM_START), deprecated_StringFormatterAlignment.BOTTOM_RIGHT, StringFormatterAlignment.BOTTOM_END), deprecated_StringFormatterAlignment.LEFT_BOTTOM, StringFormatterAlignment.LEFT_END), deprecated_StringFormatterAlignment.LEFT_TOP, StringFormatterAlignment.LEFT_START), deprecated_StringFormatterAlignment.RIGHT_BOTTOM, StringFormatterAlignment.RIGHT_END), deprecated_StringFormatterAlignment.RIGHT_START, StringFormatterAlignment.RIGHT_START);
40
+ return mapping[deprecatedValue];
41
+ };
22
42
 
23
- export { StringFormatterAlignment };
43
+ export { StringFormatterAlignment, deprecated_StringFormatterAlignment, propMappingFunction };
@@ -7,81 +7,68 @@
7
7
 
8
8
  import { typeof as _typeof } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
9
9
 
10
- function ownKeys(object, enumerableOnly) {
11
- var keys = Object.keys(object);
12
- if (Object.getOwnPropertySymbols) {
13
- var symbols = Object.getOwnPropertySymbols(object);
14
- enumerableOnly && (symbols = symbols.filter(function (sym) {
15
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
16
- })), keys.push.apply(keys, symbols);
17
- }
18
- return keys;
10
+ function _defineProperty(e, r, t) {
11
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
12
+ value: t,
13
+ enumerable: !0,
14
+ configurable: !0,
15
+ writable: !0
16
+ }) : e[r] = t, e;
19
17
  }
20
- function _objectSpread2(target) {
21
- for (var i = 1; i < arguments.length; i++) {
22
- var source = null != arguments[i] ? arguments[i] : {};
23
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
24
- _defineProperty(target, key, source[key]);
25
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
26
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
27
- });
18
+ function ownKeys(e, r) {
19
+ var t = Object.keys(e);
20
+ if (Object.getOwnPropertySymbols) {
21
+ var o = Object.getOwnPropertySymbols(e);
22
+ r && (o = o.filter(function (r) {
23
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
24
+ })), t.push.apply(t, o);
28
25
  }
29
- return target;
26
+ return t;
30
27
  }
31
- function _defineProperty(obj, key, value) {
32
- key = _toPropertyKey(key);
33
- if (key in obj) {
34
- Object.defineProperty(obj, key, {
35
- value: value,
36
- enumerable: true,
37
- configurable: true,
38
- writable: true
28
+ function _objectSpread2(e) {
29
+ for (var r = 1; r < arguments.length; r++) {
30
+ var t = null != arguments[r] ? arguments[r] : {};
31
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
32
+ _defineProperty(e, r, t[r]);
33
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
34
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
39
35
  });
40
- } else {
41
- obj[key] = value;
42
36
  }
43
- return obj;
37
+ return e;
44
38
  }
45
- function _objectWithoutPropertiesLoose(source, excluded) {
46
- if (source == null) return {};
47
- var target = {};
48
- var sourceKeys = Object.keys(source);
49
- var key, i;
50
- for (i = 0; i < sourceKeys.length; i++) {
51
- key = sourceKeys[i];
52
- if (excluded.indexOf(key) >= 0) continue;
53
- target[key] = source[key];
39
+ function _objectWithoutProperties(e, t) {
40
+ if (null == e) return {};
41
+ var o,
42
+ r,
43
+ i = _objectWithoutPropertiesLoose(e, t);
44
+ if (Object.getOwnPropertySymbols) {
45
+ var n = Object.getOwnPropertySymbols(e);
46
+ for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
54
47
  }
55
- return target;
48
+ return i;
56
49
  }
57
- function _objectWithoutProperties(source, excluded) {
58
- if (source == null) return {};
59
- var target = _objectWithoutPropertiesLoose(source, excluded);
60
- var key, i;
61
- if (Object.getOwnPropertySymbols) {
62
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
63
- for (i = 0; i < sourceSymbolKeys.length; i++) {
64
- key = sourceSymbolKeys[i];
65
- if (excluded.indexOf(key) >= 0) continue;
66
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
67
- target[key] = source[key];
68
- }
50
+ function _objectWithoutPropertiesLoose(r, e) {
51
+ if (null == r) return {};
52
+ var t = {};
53
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
54
+ if (e.indexOf(n) >= 0) continue;
55
+ t[n] = r[n];
69
56
  }
70
- return target;
57
+ return t;
71
58
  }
72
- function _toPrimitive(input, hint) {
73
- if (_typeof(input) !== "object" || input === null) return input;
74
- var prim = input[Symbol.toPrimitive];
75
- if (prim !== undefined) {
76
- var res = prim.call(input, hint || "default");
77
- if (_typeof(res) !== "object") return res;
59
+ function _toPrimitive(t, r) {
60
+ if ("object" != _typeof(t) || !t) return t;
61
+ var e = t[Symbol.toPrimitive];
62
+ if (void 0 !== e) {
63
+ var i = e.call(t, r || "default");
64
+ if ("object" != _typeof(i)) return i;
78
65
  throw new TypeError("@@toPrimitive must return a primitive value.");
79
66
  }
80
- return (hint === "string" ? String : Number)(input);
67
+ return ("string" === r ? String : Number)(t);
81
68
  }
82
- function _toPropertyKey(arg) {
83
- var key = _toPrimitive(arg, "string");
84
- return _typeof(key) === "symbol" ? key : String(key);
69
+ function _toPropertyKey(t) {
70
+ var i = _toPrimitive(t, "string");
71
+ return "symbol" == _typeof(i) ? i : i + "";
85
72
  }
86
73
  var _excluded = ["width", "height", "viewBox"],
87
74
  _excluded2 = ["tabindex"];