@useblu/ocean-react 1.55.1 → 1.56.0

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.
package/index.js CHANGED
@@ -46458,13 +46458,16 @@ var Chips = function (_a) {
46458
46458
  var target = event.target;
46459
46459
  if (wrapperRef.current && !wrapperRef.current.contains(target)) {
46460
46460
  setSelectionIsOpen(false);
46461
- if (onClose)
46461
+ if (onClose && selectionIsOpen)
46462
46462
  onClose();
46463
46463
  }
46464
46464
  }
46465
46465
  e.useEffect(function () {
46466
- if (selectedValue && selectedValue !== selectedOptions && !multiChoice) {
46466
+ if (selectedValue && selectedValue !== selectedOptions) {
46467
46467
  setSelectedOptions(selectedValue);
46468
+ if (multiChoice && Array.isArray(selectedValue)) {
46469
+ setCounter(selectedValue.length);
46470
+ }
46468
46471
  }
46469
46472
  }, [selectedValue]);
46470
46473
  e.useEffect(function () {
@@ -46472,7 +46475,7 @@ var Chips = function (_a) {
46472
46475
  return function () {
46473
46476
  document.removeEventListener('mousedown', handleClickOutside);
46474
46477
  };
46475
- }, [wrapperRef]);
46478
+ }, [wrapperRef, selectionIsOpen]);
46476
46479
  var handleClickChips = function () {
46477
46480
  if (options && (options === null || options === void 0 ? void 0 : options.length) > 0) {
46478
46481
  setSelectionIsOpen(!selectionIsOpen);