@surdeddd/bottom-sheet 0.4.1 → 0.5.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.
Files changed (41) hide show
  1. package/dist/{BottomSheetEngine-L05jGZvU.d.ts → BottomSheetEngine-BHjKFtnM.d.ts} +2 -0
  2. package/dist/{BottomSheetEngine-BJrH7qY3.d.cts → BottomSheetEngine-CqiCz64W.d.cts} +2 -0
  3. package/dist/element.cjs +111 -12
  4. package/dist/element.d.cts +1 -1
  5. package/dist/element.d.ts +1 -1
  6. package/dist/element.iife.global.js +2 -2
  7. package/dist/element.js +111 -12
  8. package/dist/index.cjs +91 -8
  9. package/dist/index.d.cts +2 -2
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.js +91 -8
  12. package/dist/integrations/formik.d.cts +1 -1
  13. package/dist/integrations/formik.d.ts +1 -1
  14. package/dist/integrations/react-hook-form.d.cts +1 -1
  15. package/dist/integrations/react-hook-form.d.ts +1 -1
  16. package/dist/preact.d.cts +1 -1
  17. package/dist/preact.d.ts +1 -1
  18. package/dist/qwik.cjs +94 -10
  19. package/dist/qwik.d.cts +2 -2
  20. package/dist/qwik.d.ts +2 -2
  21. package/dist/qwik.js +94 -10
  22. package/dist/react.cjs +95 -10
  23. package/dist/react.d.cts +4 -2
  24. package/dist/react.d.ts +4 -2
  25. package/dist/react.js +95 -10
  26. package/dist/solid.cjs +122 -18
  27. package/dist/solid.d.cts +3 -0
  28. package/dist/solid.d.ts +3 -0
  29. package/dist/solid.js +124 -20
  30. package/dist/solid.source.jsx +100 -12
  31. package/dist/styles.css +17 -0
  32. package/dist/svelte-core.cjs +91 -8
  33. package/dist/svelte-core.js +91 -8
  34. package/dist/svelte-src/BottomSheet.svelte +5 -3
  35. package/dist/svelte.cjs +143 -45
  36. package/dist/svelte.d.cts +1 -0
  37. package/dist/svelte.d.ts +1 -0
  38. package/dist/svelte.js +143 -45
  39. package/dist/vue.cjs +106 -18
  40. package/dist/vue.js +106 -18
  41. package/package.json +1 -1
package/dist/qwik.cjs CHANGED
@@ -2898,11 +2898,54 @@ var BottomSheetEngine = class {
2898
2898
  this.updateAriaSlider();
2899
2899
  }
2900
2900
  }
2901
+ contentTargets() {
2902
+ const scroller = this.scrollContainer;
2903
+ if (!scroller) return [];
2904
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2905
+ const out = [];
2906
+ for (const child of Array.from(scroller.children)) {
2907
+ if (hasSlot && child instanceof HTMLSlotElement) {
2908
+ for (const el of child.assignedElements()) out.push(el);
2909
+ } else {
2910
+ out.push(child);
2911
+ }
2912
+ }
2913
+ return out;
2914
+ }
2915
+ measureContentExtent(vertical) {
2916
+ const content = this.scrollContainer;
2917
+ if (!content) return 0;
2918
+ const targets = this.contentTargets();
2919
+ if (targets.length === 0) {
2920
+ return vertical ? content.scrollHeight : content.scrollWidth;
2921
+ }
2922
+ let min = Infinity;
2923
+ let max = -Infinity;
2924
+ for (const el of targets) {
2925
+ const r = el.getBoundingClientRect();
2926
+ if (vertical) {
2927
+ if (r.top < min) min = r.top;
2928
+ if (r.bottom > max) max = r.bottom;
2929
+ } else {
2930
+ if (r.left < min) min = r.left;
2931
+ if (r.right > max) max = r.right;
2932
+ }
2933
+ }
2934
+ if (!isFinite(min) || !isFinite(max) || max <= min) {
2935
+ return vertical ? content.scrollHeight : content.scrollWidth;
2936
+ }
2937
+ let pad = 0;
2938
+ if (typeof getComputedStyle !== "undefined") {
2939
+ const cs = getComputedStyle(content);
2940
+ pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2941
+ }
2942
+ return max - min + pad;
2943
+ }
2901
2944
  measureFitSize() {
2902
2945
  const vertical = layoutAxis(this.mode) === "height";
2903
2946
  const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2904
2947
  const content = this.scrollContainer;
2905
- const natural = content ? handleSize + (vertical ? content.scrollHeight : content.scrollWidth) : handleSize;
2948
+ const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2906
2949
  if (typeof window === "undefined") return natural;
2907
2950
  const viewport = vertical ? window.innerHeight : window.innerWidth;
2908
2951
  return viewport > 0 ? Math.min(natural, viewport) : natural;
@@ -2911,22 +2954,62 @@ var BottomSheetEngine = class {
2911
2954
  if (typeof ResizeObserver === "undefined") return;
2912
2955
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
2913
2956
  return;
2914
- const targets = [this.handle];
2915
- if (this.scrollContainer && this.scrollContainer !== this.handle) {
2916
- targets.push(this.scrollContainer);
2917
- }
2918
2957
  let raf = 0;
2919
- const ro = new ResizeObserver(() => {
2958
+ const schedule = () => {
2920
2959
  if (raf) return;
2921
2960
  raf = requestAnimationFrame(() => {
2922
2961
  raf = 0;
2923
2962
  if (this.destroyed || this.gesture?.isDragging) return;
2924
2963
  this.recompute();
2925
2964
  });
2926
- });
2927
- for (const t of targets) ro.observe(t);
2965
+ };
2966
+ const ro = new ResizeObserver(schedule);
2967
+ ro.observe(this.handle);
2968
+ const scroller = this.scrollContainer;
2969
+ const observed = /* @__PURE__ */ new Set();
2970
+ const slots = /* @__PURE__ */ new Set();
2971
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2972
+ const onSlotChange = () => resync();
2973
+ const trackSlots = () => {
2974
+ if (!scroller || !hasSlot) return;
2975
+ for (const child of Array.from(scroller.children)) {
2976
+ if (child instanceof HTMLSlotElement && !slots.has(child)) {
2977
+ child.addEventListener("slotchange", onSlotChange);
2978
+ slots.add(child);
2979
+ }
2980
+ }
2981
+ };
2982
+ const resync = () => {
2983
+ trackSlots();
2984
+ const targets = this.contentTargets();
2985
+ for (const el of observed) {
2986
+ if (!targets.includes(el)) {
2987
+ ro.unobserve(el);
2988
+ observed.delete(el);
2989
+ }
2990
+ }
2991
+ for (const el of targets) {
2992
+ if (!observed.has(el)) {
2993
+ ro.observe(el);
2994
+ observed.add(el);
2995
+ }
2996
+ }
2997
+ schedule();
2998
+ };
2999
+ let mo;
3000
+ if (scroller) {
3001
+ resync();
3002
+ if (typeof MutationObserver !== "undefined") {
3003
+ mo = new MutationObserver(resync);
3004
+ mo.observe(scroller, { childList: true });
3005
+ }
3006
+ }
2928
3007
  this.teardowns.add(() => {
2929
3008
  ro.disconnect();
3009
+ mo?.disconnect();
3010
+ for (const slot of slots) {
3011
+ slot.removeEventListener("slotchange", onSlotChange);
3012
+ }
2930
3013
  if (raf) cancelAnimationFrame(raf);
2931
3014
  });
2932
3015
  }
@@ -3454,11 +3537,12 @@ var BottomSheet = qwik.component$((props) => {
3454
3537
  ref: handleRef,
3455
3538
  role: "slider",
3456
3539
  tabIndex: 0,
3457
- "aria-label": "Resize sheet",
3458
- children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, { name: "header" })
3540
+ "aria-label": "Resize sheet"
3459
3541
  }
3460
3542
  ),
3543
+ /* @__PURE__ */ jsxRuntime.jsx("div", { class: "bs-header", children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, { name: "header" }) }),
3461
3544
  /* @__PURE__ */ jsxRuntime.jsx("div", { class: "bs-content", ref: contentRef, children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {}) }),
3545
+ /* @__PURE__ */ jsxRuntime.jsx("div", { class: "bs-footer", children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, { name: "footer" }) }),
3462
3546
  /* @__PURE__ */ jsxRuntime.jsx("span", { class: "bs-sr-only", role: "status", "aria-live": "polite", children: state.activeId })
3463
3547
  ]
3464
3548
  }
package/dist/qwik.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _builder_io_qwik from '@builder.io/qwik';
2
2
  import { QRL } from '@builder.io/qwik';
3
- import { a as SnapPointDef, b as SheetMode, E as EngineState } from './BottomSheetEngine-BJrH7qY3.cjs';
4
- export { c as EngineOptions, d as SnapPoint } from './BottomSheetEngine-BJrH7qY3.cjs';
3
+ import { a as SnapPointDef, b as SheetMode, E as EngineState } from './BottomSheetEngine-CqiCz64W.cjs';
4
+ export { c as EngineOptions, d as SnapPoint } from './BottomSheetEngine-CqiCz64W.cjs';
5
5
  import './transform-jVfAikE9.cjs';
6
6
 
7
7
  type BottomSheetProps<TId extends string = string> = {
package/dist/qwik.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _builder_io_qwik from '@builder.io/qwik';
2
2
  import { QRL } from '@builder.io/qwik';
3
- import { a as SnapPointDef, b as SheetMode, E as EngineState } from './BottomSheetEngine-L05jGZvU.js';
4
- export { c as EngineOptions, d as SnapPoint } from './BottomSheetEngine-L05jGZvU.js';
3
+ import { a as SnapPointDef, b as SheetMode, E as EngineState } from './BottomSheetEngine-BHjKFtnM.js';
4
+ export { c as EngineOptions, d as SnapPoint } from './BottomSheetEngine-BHjKFtnM.js';
5
5
  import './transform-jVfAikE9.js';
6
6
 
7
7
  type BottomSheetProps<TId extends string = string> = {
package/dist/qwik.js CHANGED
@@ -2896,11 +2896,54 @@ var BottomSheetEngine = class {
2896
2896
  this.updateAriaSlider();
2897
2897
  }
2898
2898
  }
2899
+ contentTargets() {
2900
+ const scroller = this.scrollContainer;
2901
+ if (!scroller) return [];
2902
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2903
+ const out = [];
2904
+ for (const child of Array.from(scroller.children)) {
2905
+ if (hasSlot && child instanceof HTMLSlotElement) {
2906
+ for (const el of child.assignedElements()) out.push(el);
2907
+ } else {
2908
+ out.push(child);
2909
+ }
2910
+ }
2911
+ return out;
2912
+ }
2913
+ measureContentExtent(vertical) {
2914
+ const content = this.scrollContainer;
2915
+ if (!content) return 0;
2916
+ const targets = this.contentTargets();
2917
+ if (targets.length === 0) {
2918
+ return vertical ? content.scrollHeight : content.scrollWidth;
2919
+ }
2920
+ let min = Infinity;
2921
+ let max = -Infinity;
2922
+ for (const el of targets) {
2923
+ const r = el.getBoundingClientRect();
2924
+ if (vertical) {
2925
+ if (r.top < min) min = r.top;
2926
+ if (r.bottom > max) max = r.bottom;
2927
+ } else {
2928
+ if (r.left < min) min = r.left;
2929
+ if (r.right > max) max = r.right;
2930
+ }
2931
+ }
2932
+ if (!isFinite(min) || !isFinite(max) || max <= min) {
2933
+ return vertical ? content.scrollHeight : content.scrollWidth;
2934
+ }
2935
+ let pad = 0;
2936
+ if (typeof getComputedStyle !== "undefined") {
2937
+ const cs = getComputedStyle(content);
2938
+ pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2939
+ }
2940
+ return max - min + pad;
2941
+ }
2899
2942
  measureFitSize() {
2900
2943
  const vertical = layoutAxis(this.mode) === "height";
2901
2944
  const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2902
2945
  const content = this.scrollContainer;
2903
- const natural = content ? handleSize + (vertical ? content.scrollHeight : content.scrollWidth) : handleSize;
2946
+ const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2904
2947
  if (typeof window === "undefined") return natural;
2905
2948
  const viewport = vertical ? window.innerHeight : window.innerWidth;
2906
2949
  return viewport > 0 ? Math.min(natural, viewport) : natural;
@@ -2909,22 +2952,62 @@ var BottomSheetEngine = class {
2909
2952
  if (typeof ResizeObserver === "undefined") return;
2910
2953
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
2911
2954
  return;
2912
- const targets = [this.handle];
2913
- if (this.scrollContainer && this.scrollContainer !== this.handle) {
2914
- targets.push(this.scrollContainer);
2915
- }
2916
2955
  let raf = 0;
2917
- const ro = new ResizeObserver(() => {
2956
+ const schedule = () => {
2918
2957
  if (raf) return;
2919
2958
  raf = requestAnimationFrame(() => {
2920
2959
  raf = 0;
2921
2960
  if (this.destroyed || this.gesture?.isDragging) return;
2922
2961
  this.recompute();
2923
2962
  });
2924
- });
2925
- for (const t of targets) ro.observe(t);
2963
+ };
2964
+ const ro = new ResizeObserver(schedule);
2965
+ ro.observe(this.handle);
2966
+ const scroller = this.scrollContainer;
2967
+ const observed = /* @__PURE__ */ new Set();
2968
+ const slots = /* @__PURE__ */ new Set();
2969
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2970
+ const onSlotChange = () => resync();
2971
+ const trackSlots = () => {
2972
+ if (!scroller || !hasSlot) return;
2973
+ for (const child of Array.from(scroller.children)) {
2974
+ if (child instanceof HTMLSlotElement && !slots.has(child)) {
2975
+ child.addEventListener("slotchange", onSlotChange);
2976
+ slots.add(child);
2977
+ }
2978
+ }
2979
+ };
2980
+ const resync = () => {
2981
+ trackSlots();
2982
+ const targets = this.contentTargets();
2983
+ for (const el of observed) {
2984
+ if (!targets.includes(el)) {
2985
+ ro.unobserve(el);
2986
+ observed.delete(el);
2987
+ }
2988
+ }
2989
+ for (const el of targets) {
2990
+ if (!observed.has(el)) {
2991
+ ro.observe(el);
2992
+ observed.add(el);
2993
+ }
2994
+ }
2995
+ schedule();
2996
+ };
2997
+ let mo;
2998
+ if (scroller) {
2999
+ resync();
3000
+ if (typeof MutationObserver !== "undefined") {
3001
+ mo = new MutationObserver(resync);
3002
+ mo.observe(scroller, { childList: true });
3003
+ }
3004
+ }
2926
3005
  this.teardowns.add(() => {
2927
3006
  ro.disconnect();
3007
+ mo?.disconnect();
3008
+ for (const slot of slots) {
3009
+ slot.removeEventListener("slotchange", onSlotChange);
3010
+ }
2928
3011
  if (raf) cancelAnimationFrame(raf);
2929
3012
  });
2930
3013
  }
@@ -3452,11 +3535,12 @@ var BottomSheet = component$((props) => {
3452
3535
  ref: handleRef,
3453
3536
  role: "slider",
3454
3537
  tabIndex: 0,
3455
- "aria-label": "Resize sheet",
3456
- children: /* @__PURE__ */ jsx(Slot, { name: "header" })
3538
+ "aria-label": "Resize sheet"
3457
3539
  }
3458
3540
  ),
3541
+ /* @__PURE__ */ jsx("div", { class: "bs-header", children: /* @__PURE__ */ jsx(Slot, { name: "header" }) }),
3459
3542
  /* @__PURE__ */ jsx("div", { class: "bs-content", ref: contentRef, children: /* @__PURE__ */ jsx(Slot, {}) }),
3543
+ /* @__PURE__ */ jsx("div", { class: "bs-footer", children: /* @__PURE__ */ jsx(Slot, { name: "footer" }) }),
3460
3544
  /* @__PURE__ */ jsx("span", { class: "bs-sr-only", role: "status", "aria-live": "polite", children: state.activeId })
3461
3545
  ]
3462
3546
  }
package/dist/react.cjs CHANGED
@@ -2905,11 +2905,54 @@ var BottomSheetEngine = class {
2905
2905
  this.updateAriaSlider();
2906
2906
  }
2907
2907
  }
2908
+ contentTargets() {
2909
+ const scroller = this.scrollContainer;
2910
+ if (!scroller) return [];
2911
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2912
+ const out = [];
2913
+ for (const child of Array.from(scroller.children)) {
2914
+ if (hasSlot && child instanceof HTMLSlotElement) {
2915
+ for (const el of child.assignedElements()) out.push(el);
2916
+ } else {
2917
+ out.push(child);
2918
+ }
2919
+ }
2920
+ return out;
2921
+ }
2922
+ measureContentExtent(vertical) {
2923
+ const content = this.scrollContainer;
2924
+ if (!content) return 0;
2925
+ const targets = this.contentTargets();
2926
+ if (targets.length === 0) {
2927
+ return vertical ? content.scrollHeight : content.scrollWidth;
2928
+ }
2929
+ let min = Infinity;
2930
+ let max = -Infinity;
2931
+ for (const el of targets) {
2932
+ const r = el.getBoundingClientRect();
2933
+ if (vertical) {
2934
+ if (r.top < min) min = r.top;
2935
+ if (r.bottom > max) max = r.bottom;
2936
+ } else {
2937
+ if (r.left < min) min = r.left;
2938
+ if (r.right > max) max = r.right;
2939
+ }
2940
+ }
2941
+ if (!isFinite(min) || !isFinite(max) || max <= min) {
2942
+ return vertical ? content.scrollHeight : content.scrollWidth;
2943
+ }
2944
+ let pad = 0;
2945
+ if (typeof getComputedStyle !== "undefined") {
2946
+ const cs = getComputedStyle(content);
2947
+ pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2948
+ }
2949
+ return max - min + pad;
2950
+ }
2908
2951
  measureFitSize() {
2909
2952
  const vertical = layoutAxis(this.mode) === "height";
2910
2953
  const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2911
2954
  const content = this.scrollContainer;
2912
- const natural = content ? handleSize + (vertical ? content.scrollHeight : content.scrollWidth) : handleSize;
2955
+ const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2913
2956
  if (typeof window === "undefined") return natural;
2914
2957
  const viewport = vertical ? window.innerHeight : window.innerWidth;
2915
2958
  return viewport > 0 ? Math.min(natural, viewport) : natural;
@@ -2918,22 +2961,62 @@ var BottomSheetEngine = class {
2918
2961
  if (typeof ResizeObserver === "undefined") return;
2919
2962
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
2920
2963
  return;
2921
- const targets = [this.handle];
2922
- if (this.scrollContainer && this.scrollContainer !== this.handle) {
2923
- targets.push(this.scrollContainer);
2924
- }
2925
2964
  let raf = 0;
2926
- const ro = new ResizeObserver(() => {
2965
+ const schedule = () => {
2927
2966
  if (raf) return;
2928
2967
  raf = requestAnimationFrame(() => {
2929
2968
  raf = 0;
2930
2969
  if (this.destroyed || this.gesture?.isDragging) return;
2931
2970
  this.recompute();
2932
2971
  });
2933
- });
2934
- for (const t of targets) ro.observe(t);
2972
+ };
2973
+ const ro = new ResizeObserver(schedule);
2974
+ ro.observe(this.handle);
2975
+ const scroller = this.scrollContainer;
2976
+ const observed = /* @__PURE__ */ new Set();
2977
+ const slots = /* @__PURE__ */ new Set();
2978
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2979
+ const onSlotChange = () => resync();
2980
+ const trackSlots = () => {
2981
+ if (!scroller || !hasSlot) return;
2982
+ for (const child of Array.from(scroller.children)) {
2983
+ if (child instanceof HTMLSlotElement && !slots.has(child)) {
2984
+ child.addEventListener("slotchange", onSlotChange);
2985
+ slots.add(child);
2986
+ }
2987
+ }
2988
+ };
2989
+ const resync = () => {
2990
+ trackSlots();
2991
+ const targets = this.contentTargets();
2992
+ for (const el of observed) {
2993
+ if (!targets.includes(el)) {
2994
+ ro.unobserve(el);
2995
+ observed.delete(el);
2996
+ }
2997
+ }
2998
+ for (const el of targets) {
2999
+ if (!observed.has(el)) {
3000
+ ro.observe(el);
3001
+ observed.add(el);
3002
+ }
3003
+ }
3004
+ schedule();
3005
+ };
3006
+ let mo;
3007
+ if (scroller) {
3008
+ resync();
3009
+ if (typeof MutationObserver !== "undefined") {
3010
+ mo = new MutationObserver(resync);
3011
+ mo.observe(scroller, { childList: true });
3012
+ }
3013
+ }
2935
3014
  this.teardowns.add(() => {
2936
3015
  ro.disconnect();
3016
+ mo?.disconnect();
3017
+ for (const slot of slots) {
3018
+ slot.removeEventListener("slotchange", onSlotChange);
3019
+ }
2937
3020
  if (raf) cancelAnimationFrame(raf);
2938
3021
  });
2939
3022
  }
@@ -3532,6 +3615,7 @@ var BottomSheet = react.forwardRef(
3532
3615
  className = "",
3533
3616
  style,
3534
3617
  header,
3618
+ footer,
3535
3619
  children,
3536
3620
  leftButton,
3537
3621
  rightButton,
@@ -3719,10 +3803,10 @@ var BottomSheet = react.forwardRef(
3719
3803
  className: "bs-handle",
3720
3804
  role: "slider",
3721
3805
  tabIndex: 0,
3722
- "aria-label": "Resize sheet",
3723
- children: typeof header === "function" ? header(state) : header
3806
+ "aria-label": "Resize sheet"
3724
3807
  }
3725
3808
  ),
3809
+ header != null && header !== false && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bs-header", children: typeof header === "function" ? header(state) : header }),
3726
3810
  /* @__PURE__ */ jsxRuntime.jsx(
3727
3811
  "div",
3728
3812
  {
@@ -3734,6 +3818,7 @@ var BottomSheet = react.forwardRef(
3734
3818
  children
3735
3819
  }
3736
3820
  ),
3821
+ footer != null && footer !== false && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bs-footer", children: typeof footer === "function" ? footer(state) : footer }),
3737
3822
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bs-sr-only", role: "status", "aria-live": "polite", children: announce })
3738
3823
  ]
3739
3824
  }
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as EngineOptions, E as EngineState, A as AnchorOptions, S as ScrimStagesOptions, p as ScrimStageDef, e as SheetEventMap, C as CloseReason, q as ScrimUpdate, m as ScrimOverlayOptions, B as BottomSheetEngine, a as SnapPointDef, b as SheetMode } from './BottomSheetEngine-BJrH7qY3.cjs';
2
- export { d as SnapPoint } from './BottomSheetEngine-BJrH7qY3.cjs';
1
+ import { c as EngineOptions, E as EngineState, A as AnchorOptions, S as ScrimStagesOptions, p as ScrimStageDef, e as SheetEventMap, C as CloseReason, q as ScrimUpdate, m as ScrimOverlayOptions, B as BottomSheetEngine, a as SnapPointDef, b as SheetMode } from './BottomSheetEngine-CqiCz64W.cjs';
2
+ export { d as SnapPoint } from './BottomSheetEngine-CqiCz64W.cjs';
3
3
  import { OverlayOptions, OverlayState, Overlay as OverlayEngine } from './overlay.cjs';
4
4
  export { OverlayEdge } from './overlay.cjs';
5
5
  import * as react from 'react';
@@ -23,6 +23,7 @@ type BottomSheetProps = EngineOptionsForProps & {
23
23
  className?: string;
24
24
  style?: CSSProperties;
25
25
  header?: HeaderProp;
26
+ footer?: HeaderProp;
26
27
  children?: ReactNode;
27
28
  leftButton?: ReactNode;
28
29
  rightButton?: ReactNode;
@@ -65,6 +66,7 @@ declare const BottomSheet: react.ForwardRefExoticComponent<EngineOptionsForProps
65
66
  className?: string;
66
67
  style?: CSSProperties;
67
68
  header?: HeaderProp;
69
+ footer?: HeaderProp;
68
70
  children?: ReactNode;
69
71
  leftButton?: ReactNode;
70
72
  rightButton?: ReactNode;
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as EngineOptions, E as EngineState, A as AnchorOptions, S as ScrimStagesOptions, p as ScrimStageDef, e as SheetEventMap, C as CloseReason, q as ScrimUpdate, m as ScrimOverlayOptions, B as BottomSheetEngine, a as SnapPointDef, b as SheetMode } from './BottomSheetEngine-L05jGZvU.js';
2
- export { d as SnapPoint } from './BottomSheetEngine-L05jGZvU.js';
1
+ import { c as EngineOptions, E as EngineState, A as AnchorOptions, S as ScrimStagesOptions, p as ScrimStageDef, e as SheetEventMap, C as CloseReason, q as ScrimUpdate, m as ScrimOverlayOptions, B as BottomSheetEngine, a as SnapPointDef, b as SheetMode } from './BottomSheetEngine-BHjKFtnM.js';
2
+ export { d as SnapPoint } from './BottomSheetEngine-BHjKFtnM.js';
3
3
  import { OverlayOptions, OverlayState, Overlay as OverlayEngine } from './overlay.js';
4
4
  export { OverlayEdge } from './overlay.js';
5
5
  import * as react from 'react';
@@ -23,6 +23,7 @@ type BottomSheetProps = EngineOptionsForProps & {
23
23
  className?: string;
24
24
  style?: CSSProperties;
25
25
  header?: HeaderProp;
26
+ footer?: HeaderProp;
26
27
  children?: ReactNode;
27
28
  leftButton?: ReactNode;
28
29
  rightButton?: ReactNode;
@@ -65,6 +66,7 @@ declare const BottomSheet: react.ForwardRefExoticComponent<EngineOptionsForProps
65
66
  className?: string;
66
67
  style?: CSSProperties;
67
68
  header?: HeaderProp;
69
+ footer?: HeaderProp;
68
70
  children?: ReactNode;
69
71
  leftButton?: ReactNode;
70
72
  rightButton?: ReactNode;
package/dist/react.js CHANGED
@@ -2903,11 +2903,54 @@ var BottomSheetEngine = class {
2903
2903
  this.updateAriaSlider();
2904
2904
  }
2905
2905
  }
2906
+ contentTargets() {
2907
+ const scroller = this.scrollContainer;
2908
+ if (!scroller) return [];
2909
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2910
+ const out = [];
2911
+ for (const child of Array.from(scroller.children)) {
2912
+ if (hasSlot && child instanceof HTMLSlotElement) {
2913
+ for (const el of child.assignedElements()) out.push(el);
2914
+ } else {
2915
+ out.push(child);
2916
+ }
2917
+ }
2918
+ return out;
2919
+ }
2920
+ measureContentExtent(vertical) {
2921
+ const content = this.scrollContainer;
2922
+ if (!content) return 0;
2923
+ const targets = this.contentTargets();
2924
+ if (targets.length === 0) {
2925
+ return vertical ? content.scrollHeight : content.scrollWidth;
2926
+ }
2927
+ let min = Infinity;
2928
+ let max = -Infinity;
2929
+ for (const el of targets) {
2930
+ const r = el.getBoundingClientRect();
2931
+ if (vertical) {
2932
+ if (r.top < min) min = r.top;
2933
+ if (r.bottom > max) max = r.bottom;
2934
+ } else {
2935
+ if (r.left < min) min = r.left;
2936
+ if (r.right > max) max = r.right;
2937
+ }
2938
+ }
2939
+ if (!isFinite(min) || !isFinite(max) || max <= min) {
2940
+ return vertical ? content.scrollHeight : content.scrollWidth;
2941
+ }
2942
+ let pad = 0;
2943
+ if (typeof getComputedStyle !== "undefined") {
2944
+ const cs = getComputedStyle(content);
2945
+ pad = vertical ? (parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0) : (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
2946
+ }
2947
+ return max - min + pad;
2948
+ }
2906
2949
  measureFitSize() {
2907
2950
  const vertical = layoutAxis(this.mode) === "height";
2908
2951
  const handleSize = vertical ? this.handle.offsetHeight : this.handle.offsetWidth;
2909
2952
  const content = this.scrollContainer;
2910
- const natural = content ? handleSize + (vertical ? content.scrollHeight : content.scrollWidth) : handleSize;
2953
+ const natural = content ? handleSize + this.measureContentExtent(vertical) : handleSize;
2911
2954
  if (typeof window === "undefined") return natural;
2912
2955
  const viewport = vertical ? window.innerHeight : window.innerWidth;
2913
2956
  return viewport > 0 ? Math.min(natural, viewport) : natural;
@@ -2916,22 +2959,62 @@ var BottomSheetEngine = class {
2916
2959
  if (typeof ResizeObserver === "undefined") return;
2917
2960
  if (!this.snapPointsRaw.some((p) => p.size === "fit" || p.size === "content"))
2918
2961
  return;
2919
- const targets = [this.handle];
2920
- if (this.scrollContainer && this.scrollContainer !== this.handle) {
2921
- targets.push(this.scrollContainer);
2922
- }
2923
2962
  let raf = 0;
2924
- const ro = new ResizeObserver(() => {
2963
+ const schedule = () => {
2925
2964
  if (raf) return;
2926
2965
  raf = requestAnimationFrame(() => {
2927
2966
  raf = 0;
2928
2967
  if (this.destroyed || this.gesture?.isDragging) return;
2929
2968
  this.recompute();
2930
2969
  });
2931
- });
2932
- for (const t of targets) ro.observe(t);
2970
+ };
2971
+ const ro = new ResizeObserver(schedule);
2972
+ ro.observe(this.handle);
2973
+ const scroller = this.scrollContainer;
2974
+ const observed = /* @__PURE__ */ new Set();
2975
+ const slots = /* @__PURE__ */ new Set();
2976
+ const hasSlot = typeof HTMLSlotElement !== "undefined";
2977
+ const onSlotChange = () => resync();
2978
+ const trackSlots = () => {
2979
+ if (!scroller || !hasSlot) return;
2980
+ for (const child of Array.from(scroller.children)) {
2981
+ if (child instanceof HTMLSlotElement && !slots.has(child)) {
2982
+ child.addEventListener("slotchange", onSlotChange);
2983
+ slots.add(child);
2984
+ }
2985
+ }
2986
+ };
2987
+ const resync = () => {
2988
+ trackSlots();
2989
+ const targets = this.contentTargets();
2990
+ for (const el of observed) {
2991
+ if (!targets.includes(el)) {
2992
+ ro.unobserve(el);
2993
+ observed.delete(el);
2994
+ }
2995
+ }
2996
+ for (const el of targets) {
2997
+ if (!observed.has(el)) {
2998
+ ro.observe(el);
2999
+ observed.add(el);
3000
+ }
3001
+ }
3002
+ schedule();
3003
+ };
3004
+ let mo;
3005
+ if (scroller) {
3006
+ resync();
3007
+ if (typeof MutationObserver !== "undefined") {
3008
+ mo = new MutationObserver(resync);
3009
+ mo.observe(scroller, { childList: true });
3010
+ }
3011
+ }
2933
3012
  this.teardowns.add(() => {
2934
3013
  ro.disconnect();
3014
+ mo?.disconnect();
3015
+ for (const slot of slots) {
3016
+ slot.removeEventListener("slotchange", onSlotChange);
3017
+ }
2935
3018
  if (raf) cancelAnimationFrame(raf);
2936
3019
  });
2937
3020
  }
@@ -3530,6 +3613,7 @@ var BottomSheet = forwardRef(
3530
3613
  className = "",
3531
3614
  style,
3532
3615
  header,
3616
+ footer,
3533
3617
  children,
3534
3618
  leftButton,
3535
3619
  rightButton,
@@ -3717,10 +3801,10 @@ var BottomSheet = forwardRef(
3717
3801
  className: "bs-handle",
3718
3802
  role: "slider",
3719
3803
  tabIndex: 0,
3720
- "aria-label": "Resize sheet",
3721
- children: typeof header === "function" ? header(state) : header
3804
+ "aria-label": "Resize sheet"
3722
3805
  }
3723
3806
  ),
3807
+ header != null && header !== false && /* @__PURE__ */ jsx("div", { className: "bs-header", children: typeof header === "function" ? header(state) : header }),
3724
3808
  /* @__PURE__ */ jsx(
3725
3809
  "div",
3726
3810
  {
@@ -3732,6 +3816,7 @@ var BottomSheet = forwardRef(
3732
3816
  children
3733
3817
  }
3734
3818
  ),
3819
+ footer != null && footer !== false && /* @__PURE__ */ jsx("div", { className: "bs-footer", children: typeof footer === "function" ? footer(state) : footer }),
3735
3820
  /* @__PURE__ */ jsx("span", { className: "bs-sr-only", role: "status", "aria-live": "polite", children: announce })
3736
3821
  ]
3737
3822
  }