@surdeddd/bottom-sheet 0.7.0 → 0.8.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/dist/svelte.cjs CHANGED
@@ -2381,6 +2381,7 @@ var BottomSheetEngine = class {
2381
2381
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2382
2382
  __publicField(this, "isTopSheet", true);
2383
2383
  __publicField(this, "opening", false);
2384
+ __publicField(this, "allowOvershoot", false);
2384
2385
  __publicField(this, "progressPayload", {
2385
2386
  value: 0,
2386
2387
  size: 0
@@ -2933,40 +2934,32 @@ var BottomSheetEngine = class {
2933
2934
  }
2934
2935
  return out;
2935
2936
  }
2936
- measureContentExtent(vertical) {
2937
+ measureSheetNatural(vertical) {
2938
+ const el = this.element;
2937
2939
  const content = this.scrollContainer;
2938
- if (!content) return 0;
2939
- const targets = this.contentTargets();
2940
- if (targets.length === 0) {
2941
- return vertical ? content.scrollHeight : content.scrollWidth;
2942
- }
2943
- let min = Infinity;
2944
- let max = -Infinity;
2945
- for (const el of targets) {
2946
- const r = el.getBoundingClientRect();
2947
- if (vertical) {
2948
- if (r.top < min) min = r.top;
2949
- if (r.bottom > max) max = r.bottom;
2950
- } else {
2951
- if (r.left < min) min = r.left;
2952
- if (r.right > max) max = r.right;
2953
- }
2954
- }
2955
- if (!isFinite(min) || !isFinite(max) || max <= min) {
2956
- return vertical ? content.scrollHeight : content.scrollWidth;
2957
- }
2958
- let pad = 0;
2959
- if (typeof getComputedStyle !== "undefined") {
2960
- const cs = getComputedStyle(content);
2961
- pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2962
- }
2963
- return max - min + pad;
2940
+ if (!content) {
2941
+ return vertical ? el.offsetHeight : el.offsetWidth;
2942
+ }
2943
+ const axis = vertical ? "height" : "width";
2944
+ const sheetStyle = el.style;
2945
+ const cs = content.style;
2946
+ const prevSheet = sheetStyle[axis];
2947
+ const prevFlex = cs.flex;
2948
+ const prevContent = vertical ? cs.height : cs.width;
2949
+ sheetStyle[axis] = "auto";
2950
+ cs.flex = "none";
2951
+ if (vertical) cs.height = "auto";
2952
+ else cs.width = "auto";
2953
+ const natural = vertical ? el.offsetHeight : el.offsetWidth;
2954
+ sheetStyle[axis] = prevSheet;
2955
+ cs.flex = prevFlex;
2956
+ if (vertical) cs.height = prevContent;
2957
+ else cs.width = prevContent;
2958
+ return natural;
2964
2959
  }
2965
2960
  measureFitSize() {
2966
2961
  const vertical = layoutAxis(this.mode) === "height";
2967
- const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2968
- const content = this.scrollContainer;
2969
- const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2962
+ const natural = this.measureSheetNatural(vertical);
2970
2963
  const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
2971
2964
  if (typeof window === "undefined") return capped;
2972
2965
  const viewport = vertical ? window.innerHeight : window.innerWidth;
@@ -3052,6 +3045,10 @@ var BottomSheetEngine = class {
3052
3045
  this.backdrop.style.opacity = "";
3053
3046
  this.backdrop.style.pointerEvents = "";
3054
3047
  }
3048
+ if (this.anchorHost) {
3049
+ this.anchorHost.style.removeProperty("--bs-size");
3050
+ this.anchorHost.style.removeProperty("--bs-progress");
3051
+ }
3055
3052
  if (this.screenComponent) {
3056
3053
  this.screenComponent.style.opacity = "";
3057
3054
  this.screenComponent.style.display = "";
@@ -3063,6 +3060,7 @@ var BottomSheetEngine = class {
3063
3060
  this.bus.emit(event, payload);
3064
3061
  }
3065
3062
  newCycle() {
3063
+ this.allowOvershoot = false;
3066
3064
  this.currentAbort.abort();
3067
3065
  this.currentAbort = new AbortController();
3068
3066
  return this.currentAbort.signal;
@@ -3128,6 +3126,7 @@ var BottomSheetEngine = class {
3128
3126
  seen.add(p.id);
3129
3127
  }
3130
3128
  this.snaps.setRaw(this.snapPointsRaw);
3129
+ this.clampToMaxHeight();
3131
3130
  this.scrim.invalidateOpacityCache();
3132
3131
  }
3133
3132
  getAllowedRange() {
@@ -3334,9 +3333,13 @@ var BottomSheetEngine = class {
3334
3333
  this.opening = true;
3335
3334
  sheetStack.promote(this.id);
3336
3335
  }
3337
- void this.animation.animateTo(target.size, velocity).then(() => {
3338
- this.opening = false;
3336
+ const settleCap = this.snaps.getMaxAxisSize();
3337
+ const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
3338
+ this.allowOvershoot = true;
3339
+ void this.animation.animateTo(settleSize, velocity).then(() => {
3339
3340
  if (signal.aborted) return;
3341
+ this.allowOvershoot = false;
3342
+ this.opening = false;
3340
3343
  this.scrollCache.restore(target.id, previousSize, target.size);
3341
3344
  this.updateAriaSlider();
3342
3345
  this.emit("snap", {
@@ -3368,7 +3371,7 @@ var BottomSheetEngine = class {
3368
3371
  }
3369
3372
  applySize(size) {
3370
3373
  const cap = this.snaps.getMaxAxisSize();
3371
- const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
3374
+ const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
3372
3375
  this.size = clamped;
3373
3376
  const offset = cap - clamped;
3374
3377
  const style = this.element.style;
@@ -3699,8 +3702,6 @@ function BottomSheet($$anchor, $$props) {
3699
3702
  if (next && !isOpen) void engine.open();
3700
3703
  else if (!next && isOpen) void engine.close();
3701
3704
  });
3702
- let allowedIds = $2__namespace.derived(() => $$props.allowed && $$props.allowed.length > 0 ? $$props.allowed : $$props.snapPoints.map((s) => s.id));
3703
- let activeIdx = $2__namespace.derived(() => $2__namespace.get(allowedIds).indexOf($2__namespace.get(viewState).activeId));
3704
3705
  let isVerticalAxis = $2__namespace.derived(() => mode() === "bottom" || mode() === "top");
3705
3706
  var $$exports = {
3706
3707
  snapTo,
@@ -3754,7 +3755,6 @@ function BottomSheet($$anchor, $$props) {
3754
3755
  $2__namespace.bind_this(div_2, ($$value) => $2__namespace.set(screenEl, $$value), () => $2__namespace.get(screenEl));
3755
3756
  var section = $2__namespace.sibling(div_2, 2);
3756
3757
  var div_3 = $2__namespace.child(section);
3757
- $2__namespace.set_attribute(div_3, "aria-valuemin", 0);
3758
3758
  $2__namespace.bind_this(div_3, ($$value) => $2__namespace.set(handleEl, $$value), () => $2__namespace.get(handleEl));
3759
3759
  var node_3 = $2__namespace.sibling(div_3, 2);
3760
3760
  {
@@ -3831,23 +3831,14 @@ function BottomSheet($$anchor, $$props) {
3831
3831
  });
3832
3832
  }
3833
3833
  $2__namespace.reset(div);
3834
- $2__namespace.template_effect(
3835
- ($0, $1) => {
3836
- $2__namespace.set_attribute(section, "data-mode", mode());
3837
- $2__namespace.set_attribute(section, "data-active", $2__namespace.get(viewState).activeId);
3838
- $2__namespace.set_attribute(section, "aria-modal", focusTrap() ? "true" : void 0);
3839
- $2__namespace.set_attribute(section, "aria-label", ariaLabel());
3840
- $2__namespace.set_attribute(div_3, "aria-orientation", $2__namespace.get(isVerticalAxis) ? "vertical" : "horizontal");
3841
- $2__namespace.set_attribute(div_3, "aria-valuemax", $0);
3842
- $2__namespace.set_attribute(div_3, "aria-valuenow", $1);
3843
- $2__namespace.set_attribute(div_3, "aria-valuetext", $2__namespace.get(viewState).activeId);
3844
- $2__namespace.set_text(text, $2__namespace.get(viewState).activeId);
3845
- },
3846
- [
3847
- () => Math.max(0, $2__namespace.get(allowedIds).length - 1),
3848
- () => Math.max(0, $2__namespace.get(activeIdx))
3849
- ]
3850
- );
3834
+ $2__namespace.template_effect(() => {
3835
+ $2__namespace.set_attribute(section, "data-mode", mode());
3836
+ $2__namespace.set_attribute(section, "data-active", $2__namespace.get(viewState).activeId);
3837
+ $2__namespace.set_attribute(section, "aria-modal", focusTrap() ? "true" : void 0);
3838
+ $2__namespace.set_attribute(section, "aria-label", ariaLabel());
3839
+ $2__namespace.set_attribute(div_3, "aria-orientation", $2__namespace.get(isVerticalAxis) ? "vertical" : "horizontal");
3840
+ $2__namespace.set_text(text, $2__namespace.get(viewState).activeId);
3841
+ });
3851
3842
  $2__namespace.append($$anchor, div);
3852
3843
  return $2__namespace.pop($$exports);
3853
3844
  }
package/dist/svelte.js CHANGED
@@ -2359,6 +2359,7 @@ var BottomSheetEngine = class {
2359
2359
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2360
2360
  __publicField(this, "isTopSheet", true);
2361
2361
  __publicField(this, "opening", false);
2362
+ __publicField(this, "allowOvershoot", false);
2362
2363
  __publicField(this, "progressPayload", {
2363
2364
  value: 0,
2364
2365
  size: 0
@@ -2911,40 +2912,32 @@ var BottomSheetEngine = class {
2911
2912
  }
2912
2913
  return out;
2913
2914
  }
2914
- measureContentExtent(vertical) {
2915
+ measureSheetNatural(vertical) {
2916
+ const el = this.element;
2915
2917
  const content = this.scrollContainer;
2916
- if (!content) return 0;
2917
- const targets = this.contentTargets();
2918
- if (targets.length === 0) {
2919
- return vertical ? content.scrollHeight : content.scrollWidth;
2920
- }
2921
- let min = Infinity;
2922
- let max = -Infinity;
2923
- for (const el of targets) {
2924
- const r = el.getBoundingClientRect();
2925
- if (vertical) {
2926
- if (r.top < min) min = r.top;
2927
- if (r.bottom > max) max = r.bottom;
2928
- } else {
2929
- if (r.left < min) min = r.left;
2930
- if (r.right > max) max = r.right;
2931
- }
2932
- }
2933
- if (!isFinite(min) || !isFinite(max) || max <= min) {
2934
- return vertical ? content.scrollHeight : content.scrollWidth;
2935
- }
2936
- let pad = 0;
2937
- if (typeof getComputedStyle !== "undefined") {
2938
- const cs = getComputedStyle(content);
2939
- pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2940
- }
2941
- return max - min + pad;
2918
+ if (!content) {
2919
+ return vertical ? el.offsetHeight : el.offsetWidth;
2920
+ }
2921
+ const axis = vertical ? "height" : "width";
2922
+ const sheetStyle = el.style;
2923
+ const cs = content.style;
2924
+ const prevSheet = sheetStyle[axis];
2925
+ const prevFlex = cs.flex;
2926
+ const prevContent = vertical ? cs.height : cs.width;
2927
+ sheetStyle[axis] = "auto";
2928
+ cs.flex = "none";
2929
+ if (vertical) cs.height = "auto";
2930
+ else cs.width = "auto";
2931
+ const natural = vertical ? el.offsetHeight : el.offsetWidth;
2932
+ sheetStyle[axis] = prevSheet;
2933
+ cs.flex = prevFlex;
2934
+ if (vertical) cs.height = prevContent;
2935
+ else cs.width = prevContent;
2936
+ return natural;
2942
2937
  }
2943
2938
  measureFitSize() {
2944
2939
  const vertical = layoutAxis(this.mode) === "height";
2945
- const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2946
- const content = this.scrollContainer;
2947
- const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2940
+ const natural = this.measureSheetNatural(vertical);
2948
2941
  const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
2949
2942
  if (typeof window === "undefined") return capped;
2950
2943
  const viewport = vertical ? window.innerHeight : window.innerWidth;
@@ -3030,6 +3023,10 @@ var BottomSheetEngine = class {
3030
3023
  this.backdrop.style.opacity = "";
3031
3024
  this.backdrop.style.pointerEvents = "";
3032
3025
  }
3026
+ if (this.anchorHost) {
3027
+ this.anchorHost.style.removeProperty("--bs-size");
3028
+ this.anchorHost.style.removeProperty("--bs-progress");
3029
+ }
3033
3030
  if (this.screenComponent) {
3034
3031
  this.screenComponent.style.opacity = "";
3035
3032
  this.screenComponent.style.display = "";
@@ -3041,6 +3038,7 @@ var BottomSheetEngine = class {
3041
3038
  this.bus.emit(event, payload);
3042
3039
  }
3043
3040
  newCycle() {
3041
+ this.allowOvershoot = false;
3044
3042
  this.currentAbort.abort();
3045
3043
  this.currentAbort = new AbortController();
3046
3044
  return this.currentAbort.signal;
@@ -3106,6 +3104,7 @@ var BottomSheetEngine = class {
3106
3104
  seen.add(p.id);
3107
3105
  }
3108
3106
  this.snaps.setRaw(this.snapPointsRaw);
3107
+ this.clampToMaxHeight();
3109
3108
  this.scrim.invalidateOpacityCache();
3110
3109
  }
3111
3110
  getAllowedRange() {
@@ -3312,9 +3311,13 @@ var BottomSheetEngine = class {
3312
3311
  this.opening = true;
3313
3312
  sheetStack.promote(this.id);
3314
3313
  }
3315
- void this.animation.animateTo(target.size, velocity).then(() => {
3316
- this.opening = false;
3314
+ const settleCap = this.snaps.getMaxAxisSize();
3315
+ const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
3316
+ this.allowOvershoot = true;
3317
+ void this.animation.animateTo(settleSize, velocity).then(() => {
3317
3318
  if (signal.aborted) return;
3319
+ this.allowOvershoot = false;
3320
+ this.opening = false;
3318
3321
  this.scrollCache.restore(target.id, previousSize, target.size);
3319
3322
  this.updateAriaSlider();
3320
3323
  this.emit("snap", {
@@ -3346,7 +3349,7 @@ var BottomSheetEngine = class {
3346
3349
  }
3347
3350
  applySize(size) {
3348
3351
  const cap = this.snaps.getMaxAxisSize();
3349
- const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
3352
+ const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
3350
3353
  this.size = clamped;
3351
3354
  const offset = cap - clamped;
3352
3355
  const style = this.element.style;
@@ -3677,8 +3680,6 @@ function BottomSheet($$anchor, $$props) {
3677
3680
  if (next && !isOpen) void engine.open();
3678
3681
  else if (!next && isOpen) void engine.close();
3679
3682
  });
3680
- let allowedIds = $2.derived(() => $$props.allowed && $$props.allowed.length > 0 ? $$props.allowed : $$props.snapPoints.map((s) => s.id));
3681
- let activeIdx = $2.derived(() => $2.get(allowedIds).indexOf($2.get(viewState).activeId));
3682
3683
  let isVerticalAxis = $2.derived(() => mode() === "bottom" || mode() === "top");
3683
3684
  var $$exports = {
3684
3685
  snapTo,
@@ -3732,7 +3733,6 @@ function BottomSheet($$anchor, $$props) {
3732
3733
  $2.bind_this(div_2, ($$value) => $2.set(screenEl, $$value), () => $2.get(screenEl));
3733
3734
  var section = $2.sibling(div_2, 2);
3734
3735
  var div_3 = $2.child(section);
3735
- $2.set_attribute(div_3, "aria-valuemin", 0);
3736
3736
  $2.bind_this(div_3, ($$value) => $2.set(handleEl, $$value), () => $2.get(handleEl));
3737
3737
  var node_3 = $2.sibling(div_3, 2);
3738
3738
  {
@@ -3809,23 +3809,14 @@ function BottomSheet($$anchor, $$props) {
3809
3809
  });
3810
3810
  }
3811
3811
  $2.reset(div);
3812
- $2.template_effect(
3813
- ($0, $1) => {
3814
- $2.set_attribute(section, "data-mode", mode());
3815
- $2.set_attribute(section, "data-active", $2.get(viewState).activeId);
3816
- $2.set_attribute(section, "aria-modal", focusTrap() ? "true" : void 0);
3817
- $2.set_attribute(section, "aria-label", ariaLabel());
3818
- $2.set_attribute(div_3, "aria-orientation", $2.get(isVerticalAxis) ? "vertical" : "horizontal");
3819
- $2.set_attribute(div_3, "aria-valuemax", $0);
3820
- $2.set_attribute(div_3, "aria-valuenow", $1);
3821
- $2.set_attribute(div_3, "aria-valuetext", $2.get(viewState).activeId);
3822
- $2.set_text(text, $2.get(viewState).activeId);
3823
- },
3824
- [
3825
- () => Math.max(0, $2.get(allowedIds).length - 1),
3826
- () => Math.max(0, $2.get(activeIdx))
3827
- ]
3828
- );
3812
+ $2.template_effect(() => {
3813
+ $2.set_attribute(section, "data-mode", mode());
3814
+ $2.set_attribute(section, "data-active", $2.get(viewState).activeId);
3815
+ $2.set_attribute(section, "aria-modal", focusTrap() ? "true" : void 0);
3816
+ $2.set_attribute(section, "aria-label", ariaLabel());
3817
+ $2.set_attribute(div_3, "aria-orientation", $2.get(isVerticalAxis) ? "vertical" : "horizontal");
3818
+ $2.set_text(text, $2.get(viewState).activeId);
3819
+ });
3829
3820
  $2.append($$anchor, div);
3830
3821
  return $2.pop($$exports);
3831
3822
  }
package/dist/vue.cjs CHANGED
@@ -2359,6 +2359,7 @@ var BottomSheetEngine = class {
2359
2359
  __publicField(this, "progressWriteSentinel", new WriteSentinel());
2360
2360
  __publicField(this, "isTopSheet", true);
2361
2361
  __publicField(this, "opening", false);
2362
+ __publicField(this, "allowOvershoot", false);
2362
2363
  __publicField(this, "progressPayload", {
2363
2364
  value: 0,
2364
2365
  size: 0
@@ -2911,40 +2912,32 @@ var BottomSheetEngine = class {
2911
2912
  }
2912
2913
  return out;
2913
2914
  }
2914
- measureContentExtent(vertical) {
2915
+ measureSheetNatural(vertical) {
2916
+ const el = this.element;
2915
2917
  const content = this.scrollContainer;
2916
- if (!content) return 0;
2917
- const targets = this.contentTargets();
2918
- if (targets.length === 0) {
2919
- return vertical ? content.scrollHeight : content.scrollWidth;
2918
+ if (!content) {
2919
+ return vertical ? el.offsetHeight : el.offsetWidth;
2920
2920
  }
2921
- let min = Infinity;
2922
- let max = -Infinity;
2923
- for (const el of targets) {
2924
- const r = el.getBoundingClientRect();
2925
- if (vertical) {
2926
- if (r.top < min) min = r.top;
2927
- if (r.bottom > max) max = r.bottom;
2928
- } else {
2929
- if (r.left < min) min = r.left;
2930
- if (r.right > max) max = r.right;
2931
- }
2932
- }
2933
- if (!isFinite(min) || !isFinite(max) || max <= min) {
2934
- return vertical ? content.scrollHeight : content.scrollWidth;
2935
- }
2936
- let pad = 0;
2937
- if (typeof getComputedStyle !== "undefined") {
2938
- const cs = getComputedStyle(content);
2939
- pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2940
- }
2941
- return max - min + pad;
2921
+ const axis = vertical ? "height" : "width";
2922
+ const sheetStyle = el.style;
2923
+ const cs = content.style;
2924
+ const prevSheet = sheetStyle[axis];
2925
+ const prevFlex = cs.flex;
2926
+ const prevContent = vertical ? cs.height : cs.width;
2927
+ sheetStyle[axis] = "auto";
2928
+ cs.flex = "none";
2929
+ if (vertical) cs.height = "auto";
2930
+ else cs.width = "auto";
2931
+ const natural = vertical ? el.offsetHeight : el.offsetWidth;
2932
+ sheetStyle[axis] = prevSheet;
2933
+ cs.flex = prevFlex;
2934
+ if (vertical) cs.height = prevContent;
2935
+ else cs.width = prevContent;
2936
+ return natural;
2942
2937
  }
2943
2938
  measureFitSize() {
2944
2939
  const vertical = layoutAxis(this.mode) === "height";
2945
- const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2946
- const content = this.scrollContainer;
2947
- const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2940
+ const natural = this.measureSheetNatural(vertical);
2948
2941
  const capped = this.maxHeightCap !== void 0 ? Math.min(natural, this.maxHeightCap) : natural;
2949
2942
  if (typeof window === "undefined") return capped;
2950
2943
  const viewport = vertical ? window.innerHeight : window.innerWidth;
@@ -3030,6 +3023,10 @@ var BottomSheetEngine = class {
3030
3023
  this.backdrop.style.opacity = "";
3031
3024
  this.backdrop.style.pointerEvents = "";
3032
3025
  }
3026
+ if (this.anchorHost) {
3027
+ this.anchorHost.style.removeProperty("--bs-size");
3028
+ this.anchorHost.style.removeProperty("--bs-progress");
3029
+ }
3033
3030
  if (this.screenComponent) {
3034
3031
  this.screenComponent.style.opacity = "";
3035
3032
  this.screenComponent.style.display = "";
@@ -3041,6 +3038,7 @@ var BottomSheetEngine = class {
3041
3038
  this.bus.emit(event, payload);
3042
3039
  }
3043
3040
  newCycle() {
3041
+ this.allowOvershoot = false;
3044
3042
  this.currentAbort.abort();
3045
3043
  this.currentAbort = new AbortController();
3046
3044
  return this.currentAbort.signal;
@@ -3106,6 +3104,7 @@ var BottomSheetEngine = class {
3106
3104
  seen.add(p.id);
3107
3105
  }
3108
3106
  this.snaps.setRaw(this.snapPointsRaw);
3107
+ this.clampToMaxHeight();
3109
3108
  this.scrim.invalidateOpacityCache();
3110
3109
  }
3111
3110
  getAllowedRange() {
@@ -3312,9 +3311,13 @@ var BottomSheetEngine = class {
3312
3311
  this.opening = true;
3313
3312
  sheetStack.promote(this.id);
3314
3313
  }
3315
- void this.animation.animateTo(target.size, velocity).then(() => {
3316
- this.opening = false;
3314
+ const settleCap = this.snaps.getMaxAxisSize();
3315
+ const settleSize = settleCap > 0 ? Math.min(target.size, settleCap) : target.size;
3316
+ this.allowOvershoot = true;
3317
+ void this.animation.animateTo(settleSize, velocity).then(() => {
3317
3318
  if (signal.aborted) return;
3319
+ this.allowOvershoot = false;
3320
+ this.opening = false;
3318
3321
  this.scrollCache.restore(target.id, previousSize, target.size);
3319
3322
  this.updateAriaSlider();
3320
3323
  this.emit("snap", {
@@ -3346,7 +3349,7 @@ var BottomSheetEngine = class {
3346
3349
  }
3347
3350
  applySize(size) {
3348
3351
  const cap = this.snaps.getMaxAxisSize();
3349
- const clamped = cap > 0 && size > cap && !this.gesture?.isDragging ? cap : size;
3352
+ const clamped = cap > 0 && size > cap && !this.gesture?.isDragging && !this.allowOvershoot ? cap : size;
3350
3353
  this.size = clamped;
3351
3354
  const offset = cap - clamped;
3352
3355
  const style = this.element.style;
@@ -3939,11 +3942,6 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
3939
3942
  const mode = props.mode ?? "bottom";
3940
3943
  return mode === "bottom" || mode === "top";
3941
3944
  });
3942
- const allowedIds = vue.computed(() => props.allowed ?? props.snapPoints.map((p) => p.id));
3943
- const activeIdx = vue.computed(() => {
3944
- const idx = allowedIds.value.indexOf(state.activeId);
3945
- return idx === -1 ? 0 : idx;
3946
- });
3947
3945
  const ariaModal = vue.computed(() => props.focusTrap === true);
3948
3946
  __expose({
3949
3947
  snapTo,
@@ -4013,8 +4011,6 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
4013
4011
  anchorsKey,
4014
4012
  applyStages,
4015
4013
  isVerticalAxis,
4016
- allowedIds,
4017
- activeIdx,
4018
4014
  ariaModal
4019
4015
  };
4020
4016
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -4036,12 +4032,7 @@ var _hoisted_3 = [
4036
4032
  "aria-modal",
4037
4033
  "aria-label"
4038
4034
  ];
4039
- var _hoisted_4 = [
4040
- "aria-orientation",
4041
- "aria-valuemax",
4042
- "aria-valuenow",
4043
- "aria-valuetext"
4044
- ];
4035
+ var _hoisted_4 = ["aria-orientation"];
4045
4036
  var _hoisted_5 = {
4046
4037
  key: 0,
4047
4038
  class: "bs-header"
@@ -4104,10 +4095,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4104
4095
  role: "slider",
4105
4096
  tabindex: "0",
4106
4097
  "aria-orientation": $setup.isVerticalAxis ? "vertical" : "horizontal",
4107
- "aria-valuemin": "0",
4108
- "aria-valuemax": Math.max(0, $setup.allowedIds.length - 1),
4109
- "aria-valuenow": $setup.activeIdx,
4110
- "aria-valuetext": $setup.state.activeId,
4111
4098
  "aria-label": "Resize sheet"
4112
4099
  }, null, 8, _hoisted_4),
4113
4100
  _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [vue.renderSlot(_ctx.$slots, "header", { state: $setup.state })])) : vue.createCommentVNode("v-if", true),