sag_components 2.0.0-beta268 → 2.0.0-beta269

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/dist/index.esm.js CHANGED
@@ -37877,7 +37877,6 @@ const FilterPop = props => {
37877
37877
  const unselectedItems = nonAllItems.filter(item => !attributes[item.value]);
37878
37878
  const allSelected = selectedItems.length === nonAllItems.length;
37879
37879
  const noneSelected = selectedItems.length === 0;
37880
- const fewerSelected = selectedItems.length <= unselectedItems.length;
37881
37880
  if (allSelected) {
37882
37881
  return {
37883
37882
  excluded: [],
@@ -37890,18 +37889,21 @@ const FilterPop = props => {
37890
37889
  included: [],
37891
37890
  isSelectAll: false
37892
37891
  };
37893
- } else if (fewerSelected) {
37894
- return {
37895
- excluded: [],
37896
- included: selectedItems.map(item => item.value),
37897
- isSelectAll: false
37898
- };
37899
37892
  } else {
37900
- return {
37901
- excluded: unselectedItems.map(item => item.value),
37902
- included: [],
37903
- isSelectAll: true
37904
- };
37893
+ const fewerSelected = selectedItems.length <= unselectedItems.length;
37894
+ if (fewerSelected) {
37895
+ return {
37896
+ excluded: [],
37897
+ included: selectedItems.map(item => item.value),
37898
+ isSelectAll: false
37899
+ };
37900
+ } else {
37901
+ return {
37902
+ excluded: unselectedItems.map(item => item.value),
37903
+ included: [],
37904
+ isSelectAll: true
37905
+ };
37906
+ }
37905
37907
  }
37906
37908
  };
37907
37909
  const handleCheckboxChange = attribute => {
@@ -37911,9 +37913,22 @@ const FilterPop = props => {
37911
37913
  const updatedAttributes = {
37912
37914
  ...selectedAttributes
37913
37915
  };
37914
- visibleNonAllItems.forEach(item => {
37915
- updatedAttributes[item.value] = !allVisibleSelected;
37916
- });
37916
+ if (searchTerm.trim()) {
37917
+ if (allVisibleSelected) {
37918
+ const nonAllItems = getNonAllItems();
37919
+ nonAllItems.forEach(item => {
37920
+ updatedAttributes[item.value] = false;
37921
+ });
37922
+ } else {
37923
+ visibleNonAllItems.forEach(item => {
37924
+ updatedAttributes[item.value] = true;
37925
+ });
37926
+ }
37927
+ } else {
37928
+ visibleNonAllItems.forEach(item => {
37929
+ updatedAttributes[item.value] = !allVisibleSelected;
37930
+ });
37931
+ }
37917
37932
  updatedAttributes.All = areAllNonAllItemsSelected(updatedAttributes);
37918
37933
  setSelectedAttributes(updatedAttributes);
37919
37934
  const filterData = createFilterData(updatedAttributes);