slim-select 4.2.4 → 4.3.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.
@@ -944,7 +944,7 @@ var O = class {
944
944
  this.settings.showSearch && (this.content.status.textContent = e);
945
945
  }
946
946
  repositionOpenContent() {
947
- !this.settings.isOpen || this.isModalViewActive() || this.settings.contentPosition !== "relative" && this.content.main.classList.contains(this.classes.getFirst("dirAbove")) && this.moveContentAbove();
947
+ this.settings.isOpen && !this.isModalViewActive() && this.settings.contentPosition !== "relative" && this.content.main.classList.contains(this.classes.getFirst("dirAbove")) && this.moveContentAbove();
948
948
  }
949
949
  moveContent() {
950
950
  if (!this.isModalViewActive()) {
@@ -964,14 +964,14 @@ var O = class {
964
964
  }
965
965
  }
966
966
  startPositionTracking() {
967
- this.settings.contentPosition !== "absolute" || this.isModalViewActive() || (this.stopPositionTracking(), !(typeof ResizeObserver > "u") && (this.lastObservedContentHeight = -1, this.positionObserver = new ResizeObserver((e) => {
967
+ this.settings.contentPosition !== "absolute" || this.isModalViewActive() || (this.stopPositionTracking(), typeof ResizeObserver < "u" && (this.lastObservedContentHeight = -1, this.positionObserver = new ResizeObserver((e) => {
968
968
  if (!this.settings.isOpen) return;
969
969
  let t = !1, n = !1;
970
970
  for (let r of e) if (r.target === this.content.main) {
971
971
  let e = r.contentRect.height;
972
972
  e !== this.lastObservedContentHeight && (this.lastObservedContentHeight = e, t = !0);
973
973
  } else n = !0;
974
- !t && !n || (cancelAnimationFrame(this.positionObserverRaf), this.positionObserverRaf = requestAnimationFrame(() => {
974
+ (t || n) && (cancelAnimationFrame(this.positionObserverRaf), this.positionObserverRaf = requestAnimationFrame(() => {
975
975
  n ? this.moveContent() : this.repositionOpenContent();
976
976
  }));
977
977
  }), this.observePositionTargets()));
@@ -982,7 +982,7 @@ var O = class {
982
982
  observePositionTargets() {
983
983
  if (!this.positionObserver) return;
984
984
  let e = /* @__PURE__ */ new Set(), t = (t) => {
985
- !t || e.has(t) || (e.add(t), this.positionObserver.observe(t));
985
+ t && !e.has(t) && (e.add(t), this.positionObserver.observe(t));
986
986
  };
987
987
  t(this.main.main), t(this.content.main);
988
988
  let n = this.main.main.parentElement, r = this.settings.contentLocation;
@@ -1448,7 +1448,7 @@ var O = class {
1448
1448
  this.settings.contentPosition !== "relative" && (this.content.main.style.width = e.width + "px");
1449
1449
  return;
1450
1450
  }
1451
- t.startsWith(">") ? this.content.main.style.minWidth = t.slice(1) : t.startsWith("<") ? this.content.main.style.maxWidth = t.slice(1) : this.content.main.style.width = t;
1451
+ t === "auto" ? this.content.main.style.minWidth = e.width + "px" : t.startsWith(">") ? this.content.main.style.minWidth = t.slice(1) : t.startsWith("<") ? this.content.main.style.maxWidth = t.slice(1) : this.content.main.style.width = t;
1452
1452
  }
1453
1453
  cancelOverflowShift() {
1454
1454
  this.overflowShiftRaf &&= (cancelAnimationFrame(this.overflowShiftRaf), 0);
@@ -1489,7 +1489,7 @@ var O = class {
1489
1489
  updateDeselectAll() {
1490
1490
  if (!this.store || !this.settings) return;
1491
1491
  let e = this.store.getSelectedOptions(), t = e && e.length > 0, n = this.settings.isMultiple, r = this.settings.allowDeselect, i = this.isAtMinSelected(), a = this.main.deselect.main, o = this.classes.hide;
1492
- r && !(n && !t) && !i ? this.removeClasses(a, o) : this.addClasses(a, o);
1492
+ r && (!n || t) && !i ? this.removeClasses(a, o) : this.addClasses(a, o);
1493
1493
  }
1494
1494
  };
1495
1495
  //#endregion
@@ -1996,10 +1996,10 @@ var R = class {
1996
1996
  }), this.globalEvents = new O({
1997
1997
  onDocumentClick: this.documentClick.bind(this),
1998
1998
  onWindowResize: () => {
1999
- !this.settings.isOpen && !this.settings.isFullOpen || this.render.moveContent();
1999
+ (this.settings.isOpen || this.settings.isFullOpen) && this.render.moveContent();
2000
2000
  },
2001
2001
  onWindowScroll: () => {
2002
- !this.settings.isOpen && !this.settings.isFullOpen || this.render.moveContent();
2002
+ (this.settings.isOpen || this.settings.isFullOpen) && this.render.moveContent();
2003
2003
  },
2004
2004
  onVisibilityChange: () => {
2005
2005
  document.hidden && this.close({
@@ -2064,7 +2064,7 @@ var R = class {
2064
2064
  source: "api",
2065
2065
  selectionChanged: !1
2066
2066
  }) {
2067
- !this.settings.isOpen || this.settings.alwaysOpen || this.lifecycle.requestClose(e).then((e) => {
2067
+ this.settings.isOpen && !this.settings.alwaysOpen && this.lifecycle.requestClose(e).then((e) => {
2068
2068
  e && (this.settings.isOpen || (this.settings.isOpen = this.lifecycle.isOpen, this.settings.isFullOpen = this.lifecycle.isFullOpen));
2069
2069
  });
2070
2070
  }