@buoy-gg/bottom-sheet 7.0.40 → 7.0.42
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/lib/commonjs/components/BottomSheet.js +1 -1160
- package/lib/commonjs/components/BottomSheet.web.js +1 -795
- package/lib/commonjs/components/bottomSheetGeometry.js +1 -86
- package/lib/commonjs/components/useMultiTap.js +1 -52
- package/lib/commonjs/index.js +1 -12
- package/lib/commonjs/index.web.js +1 -12
- package/lib/module/components/BottomSheet.js +1 -1157
- package/lib/module/components/BottomSheet.web.js +1 -790
- package/lib/module/components/bottomSheetGeometry.js +1 -79
- package/lib/module/components/useMultiTap.js +1 -47
- package/lib/module/index.js +1 -4
- package/lib/module/index.web.js +1 -6
- package/lib/web/index.mjs +1 -0
- package/package.json +32 -10
- package/lib/typescript/components/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/components/BottomSheet.web.d.ts.map +0 -1
- package/lib/typescript/components/bottomSheetGeometry.d.ts.map +0 -1
- package/lib/typescript/components/useMultiTap.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.web.d.ts.map +0 -1
|
@@ -1,79 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Platform-free geometry for the BottomSheet.
|
|
5
|
-
*
|
|
6
|
-
* Extracted verbatim from the native implementation so the web port
|
|
7
|
-
* (BottomSheet.web.tsx) shares the exact clamping behavior:
|
|
8
|
-
* - corner-resize math: BottomSheet.tsx createResizeHandler (lines ~767-869)
|
|
9
|
-
* - close heuristic: BottomSheet.tsx onPanResponderRelease (lines ~706-708)
|
|
10
|
-
* The native file still carries its own inline copy; if you change one,
|
|
11
|
-
* change both (candidate for a later native refactor to import this).
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const MIN_HEIGHT = 100;
|
|
15
|
-
export const DEFAULT_HEIGHT = 400;
|
|
16
|
-
export const FLOATING_WIDTH = 380;
|
|
17
|
-
export const FLOATING_HEIGHT = 500;
|
|
18
|
-
export const FLOATING_MIN_HEIGHT = 80;
|
|
19
|
-
|
|
20
|
-
/** Native: FLOATING_MIN_WIDTH = SCREEN.width * 0.25 */
|
|
21
|
-
export function floatingMinWidth(screenWidth) {
|
|
22
|
-
return screenWidth * 0.25;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 4-corner resize with safe-area-clamped bounds and min sizes.
|
|
26
|
-
* Mirrors the switch in the native createResizeHandler exactly.
|
|
27
|
-
*/
|
|
28
|
-
export function resizeCorner(corner, start, dx, dy, container, insets, minWidth, minHeight = FLOATING_MIN_HEIGHT) {
|
|
29
|
-
const minLeft = Math.max(0, insets.left || 0);
|
|
30
|
-
const maxRight = container.width - Math.max(0, insets.right || 0);
|
|
31
|
-
const minTop = Math.max(0, insets.top || 0);
|
|
32
|
-
const maxBottom = container.height - Math.max(0, insets.bottom || 0);
|
|
33
|
-
const startRight = start.left + start.width;
|
|
34
|
-
const startBottom = start.top + start.height;
|
|
35
|
-
let left = start.left;
|
|
36
|
-
let top = start.top;
|
|
37
|
-
let right = startRight;
|
|
38
|
-
let bottom = startBottom;
|
|
39
|
-
switch (corner) {
|
|
40
|
-
case 'topLeft':
|
|
41
|
-
{
|
|
42
|
-
left = Math.max(minLeft, Math.min(start.left + dx, startRight - minWidth));
|
|
43
|
-
top = Math.max(minTop, Math.min(start.top + dy, startBottom - minHeight));
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case 'topRight':
|
|
47
|
-
{
|
|
48
|
-
right = Math.min(maxRight, Math.max(startRight + dx, start.left + minWidth));
|
|
49
|
-
top = Math.max(minTop, Math.min(start.top + dy, startBottom - minHeight));
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'bottomLeft':
|
|
53
|
-
{
|
|
54
|
-
left = Math.max(minLeft, Math.min(start.left + dx, startRight - minWidth));
|
|
55
|
-
bottom = Math.min(maxBottom, Math.max(startBottom + dy, start.top + minHeight));
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case 'bottomRight':
|
|
59
|
-
{
|
|
60
|
-
right = Math.min(maxRight, Math.max(startRight + dx, start.left + minWidth));
|
|
61
|
-
bottom = Math.min(maxBottom, Math.max(startBottom + dy, start.top + minHeight));
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
left,
|
|
67
|
-
top,
|
|
68
|
-
width: Math.max(minWidth, right - left),
|
|
69
|
-
height: Math.max(minHeight, bottom - top)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Drag-to-dismiss heuristic. Native units: vy in px/ms (RN gestureState.vy),
|
|
75
|
-
* dy total drag in px.
|
|
76
|
-
*/
|
|
77
|
-
export function shouldCloseOnRelease(vy, dy, finalHeight, minHeight) {
|
|
78
|
-
return vy > 0.8 && dy > 50 || dy > 150 && finalHeight <= minHeight;
|
|
79
|
-
}
|
|
1
|
+
"use strict";export const MIN_HEIGHT=100;export const DEFAULT_HEIGHT=400;export const FLOATING_WIDTH=380;export const FLOATING_HEIGHT=500;export const FLOATING_MIN_HEIGHT=80;export function floatingMinWidth(a){return a*.25}export function resizeCorner(a,t,o,e,r,x,h,M=FLOATING_MIN_HEIGHT){const i=Math.max(0,x.left||0);const I=r.width-Math.max(0,x.right||0);const T=Math.max(0,x.top||0);const b=r.height-Math.max(0,x.bottom||0);const m=t.left+t.width;const n=t.top+t.height;let c=t.left;let p=t.top;let l=m;let f=n;switch(a){case"topLeft":{c=Math.max(i,Math.min(t.left+o,m-h));p=Math.max(T,Math.min(t.top+e,n-M));break}case"topRight":{l=Math.min(I,Math.max(m+o,t.left+h));p=Math.max(T,Math.min(t.top+e,n-M));break}case"bottomLeft":{c=Math.max(i,Math.min(t.left+o,m-h));f=Math.min(b,Math.max(n+e,t.top+M));break}case"bottomRight":{l=Math.min(I,Math.max(m+o,t.left+h));f=Math.min(b,Math.max(n+e,t.top+M));break}}return{left:c,top:p,width:Math.max(h,l-c),height:Math.max(M,f-p)}}export function shouldCloseOnRelease(a,t,o,e){return a>.8&&t>50||t>150&&o<=e}
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Platform-free tap-count recognizer shared by the BottomSheet header and
|
|
5
|
-
* floating window: 2 taps toggles mode, 3+ closes. Mirrors the native
|
|
6
|
-
* implementation (BottomSheet.tsx ModalHeader.handleHeaderTap /
|
|
7
|
-
* handleFloatingTap): 500ms reset window, 300ms settle timer.
|
|
8
|
-
*/
|
|
9
|
-
import { useEffect, useRef } from 'react';
|
|
10
|
-
export function useMultiTap(onDouble, onTriple) {
|
|
11
|
-
const lastTapRef = useRef(0);
|
|
12
|
-
const tapCountRef = useRef(0);
|
|
13
|
-
const timeoutRef = useRef(null);
|
|
14
|
-
// Latest-ref pattern so the returned handler stays stable without
|
|
15
|
-
// re-arming timers when callbacks change identity.
|
|
16
|
-
const handlersRef = useRef({
|
|
17
|
-
onDouble,
|
|
18
|
-
onTriple
|
|
19
|
-
});
|
|
20
|
-
handlersRef.current = {
|
|
21
|
-
onDouble,
|
|
22
|
-
onTriple
|
|
23
|
-
};
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
return () => {
|
|
26
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
const tapHandlerRef = useRef(() => {
|
|
30
|
-
const now = Date.now();
|
|
31
|
-
if (now - lastTapRef.current > 500) {
|
|
32
|
-
tapCountRef.current = 0;
|
|
33
|
-
}
|
|
34
|
-
tapCountRef.current++;
|
|
35
|
-
lastTapRef.current = now;
|
|
36
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
37
|
-
timeoutRef.current = setTimeout(() => {
|
|
38
|
-
if (tapCountRef.current === 2) {
|
|
39
|
-
handlersRef.current.onDouble();
|
|
40
|
-
} else if (tapCountRef.current >= 3) {
|
|
41
|
-
handlersRef.current.onTriple();
|
|
42
|
-
}
|
|
43
|
-
tapCountRef.current = 0;
|
|
44
|
-
}, 300);
|
|
45
|
-
});
|
|
46
|
-
return tapHandlerRef.current;
|
|
47
|
-
}
|
|
1
|
+
"use strict";import{useEffect as i,useRef as t}from"react";export function useMultiTap(u,c){const o=t(0);const r=t(0);const e=t(null);const n=t({onDouble:u,onTriple:c});n.current={onDouble:u,onTriple:c};i(()=>{return()=>{if(e.current)clearTimeout(e.current)}},[]);const s=t(()=>{const f=Date.now();if(f-o.current>500){r.current=0}r.current++;o.current=f;if(e.current)clearTimeout(e.current);e.current=setTimeout(()=>{if(r.current===2){n.current.onDouble()}else if(r.current>=3){n.current.onTriple()}r.current=0},300)});return s.current}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.web.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Web entry — reached via bundler alias (same pattern as
|
|
4
|
-
// @buoy-gg/core → devtools-floating-menu/src/index.web.tsx; the package
|
|
5
|
-
// exports map has no browser condition, so consumers alias this file).
|
|
6
|
-
export { BottomSheet } from './components/BottomSheet.web';
|
|
1
|
+
"use strict";export{BottomSheet}from"./components/BottomSheet.web";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{useState as R,useRef as E,useEffect as q}from"react";import{ToolBackground as Z}from"@buoy-gg/shared-ui/web";function ee(t){return t*.25}function te(t,e,n,o,r,s,d,p=80){let m=Math.max(0,s.left||0),f=r.width-Math.max(0,s.right||0),c=Math.max(0,s.top||0),y=r.height-Math.max(0,s.bottom||0),l=e.left+e.width,h=e.top+e.height,g=e.left,b=e.top,v=l,x=h;switch(t){case"topLeft":{g=Math.max(m,Math.min(e.left+n,l-d)),b=Math.max(c,Math.min(e.top+o,h-p));break}case"topRight":{v=Math.min(f,Math.max(l+n,e.left+d)),b=Math.max(c,Math.min(e.top+o,h-p));break}case"bottomLeft":{g=Math.max(m,Math.min(e.left+n,l-d)),x=Math.min(y,Math.max(h+o,e.top+p));break}case"bottomRight":{v=Math.min(f,Math.max(l+n,e.left+d)),x=Math.min(y,Math.max(h+o,e.top+p));break}}return{left:g,top:b,width:Math.max(d,v-g),height:Math.max(p,x-b)}}function oe(t,e,n,o){return t>.8&&e>50||e>150&&n<=o}import{useEffect as ne,useRef as D}from"react";function re(t,e){let n=D(0),o=D(0),r=D(null),s=D({onDouble:t,onTriple:e});return s.current={onDouble:t,onTriple:e},ne(()=>()=>{r.current&&clearTimeout(r.current)},[]),D(()=>{let d=Date.now();d-n.current>500&&(o.current=0),o.current++,n.current=d,r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{o.current===2?s.current.onDouble():o.current>=3&&s.current.onTriple(),o.current=0},300)}).current}import{jsx as a,jsxs as z}from"react/jsx-runtime";var ie={background:"rgba(8, 12, 21, 0.98)",panel:"rgba(16, 22, 35, 0.98)",border:"#00B8E666",primary:"#FFFFFF",secondary:"#B8BFC9",muted:"#7A8599",success:"#4AFF9F",error:"#FF5252",info:"#00B8E6"};function ae(t){return window.addEventListener("resize",t),window.visualViewport?.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),window.visualViewport?.removeEventListener("resize",t)}}function J(){return{width:window.innerWidth,height:window.innerHeight}}function K(){let t=document.createElement("div");t.style.cssText="position:fixed;visibility:hidden;pointer-events:none;top:env(safe-area-inset-top);bottom:env(safe-area-inset-bottom);left:env(safe-area-inset-left);right:env(safe-area-inset-right)",document.body.appendChild(t);let e=getComputedStyle(t),n={top:parseFloat(e.top)||0,bottom:parseFloat(e.bottom)||0,left:parseFloat(e.left)||0,right:parseFloat(e.right)||0};return document.body.removeChild(t),n}function le(){let[t,e]=R(()=>({viewport:J(),insets:K()}));return q(()=>ae(()=>{e({viewport:J(),insets:K()})}),[]),t}function V(t,e){if(!t.isPrimary)return;let n=t.currentTarget,o=t.clientX,r=t.clientY,s=t.clientY,d=performance.now(),p=0,m=0;e.onStart?.(t),n.setPointerCapture(t.pointerId);let f=l=>{if(l.pointerId!==t.pointerId)return;let h=l.clientX-o,g=l.clientY-r;m=Math.max(m,Math.abs(h)+Math.abs(g));let b=performance.now(),v=b-d;v>0&&(p=(l.clientY-s)/v,s=l.clientY,d=b),e.onMove(l,{dx:h,dy:g})},c=l=>{l.pointerId===t.pointerId&&(y(),e.onEnd(l,{dx:l.clientX-o,dy:l.clientY-r,vy:p,wasTap:m<=5}))},y=()=>{n.removeEventListener("pointermove",f),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c)};n.addEventListener("pointermove",f),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c)}function O({isResizing:t,mode:e,hasCustomContent:n=false,theme:o}){return z("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:n?"6px 0 2px":"8px 0",position:"relative"},children:[a("div",{style:{width:t?40:e==="floating"?50:40,height:e==="floating"?5:3,backgroundColor:t?o.success:e==="floating"?o.muted:o.info+"99",borderRadius:2,boxShadow:`0 0 4px ${o.info}CC`}}),t&&e==="bottomSheet"&&a("div",{style:{position:"absolute",display:"flex",flexDirection:"row",gap:2,marginTop:12},children:[0,1,2].map(r=>a("div",{style:{width:12,height:1,backgroundColor:o.success,opacity:.6}},r))})]})}function U({header:t,isResizing:e,mode:n,theme:o}){return t?.customContent?z("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center"},children:[a(O,{isResizing:e,mode:n,hasCustomContent:true,theme:o}),t.customContent]}):z("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",position:"relative"},children:[a(O,{isResizing:e,mode:n,theme:o}),z("div",{style:{padding:"0 16px",display:"flex",flexDirection:"column",alignItems:"center"},children:[t?.title&&a("span",{style:{fontSize:16,fontWeight:600,color:o.primary},children:t.title}),t?.subtitle&&a("span",{style:{fontSize:12,color:o.secondary,paddingTop:4},children:t.subtitle})]}),a("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a("span",{style:{fontSize:10,color:o.muted,fontStyle:"italic"},children:"Double tap: Toggle \u2022 Triple tap: Close"})})]})}function _({children:t,footer:e,footerHeight:n,disableScrollWrapper:o,contentStyle:r,theme:s,background:d}){return z("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",backgroundColor:s.background,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden",position:"relative",...r},children:[d?a(Z,{}):null,o?t:a("div",{style:{flex:1,minHeight:0,overflowY:"auto",WebkitOverflowScrolling:"touch",paddingBottom:n},children:t}),e?a("div",{style:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:s.background,borderBottomLeftRadius:16,borderBottomRightRadius:16},children:e}):null]})}var Q="transform 320ms cubic-bezier(0.16, 1, 0.3, 1)",G="opacity 200ms ease";function se({props:t,theme:e,viewport:n,effectiveMaxHeight:o,panelHeight:r,setPanelHeight:s,onHeaderTap:d}){let{onClose:p,children:m,header:f,styles:c={},minHeight:y=100,footer:l,footerHeight:h=0,disableScrollWrapper:g,zIndex:b=1e3,background:v=true}=t,x=E(null),C=E(null),[S,Y]=R(false),[$,W]=R(false),A=E(false),k=E(r);q(()=>{let M=requestAnimationFrame(()=>W(true));return()=>cancelAnimationFrame(M)},[]);let L=M=>{if(A.current)return;let j=M.currentTarget.getBoundingClientRect().top,X=M.clientY-j;V(M,{onStart:()=>Y(true),onMove:H=>{let B=H.clientY-X,i=Math.max(y,Math.min(n.height-B,o));k.current=i,x.current&&(x.current.style.height=`${i}px`)},onEnd:(H,{dy:B,vy:i,wasTap:u})=>{if(Y(false),u){d();return}if(oe(i,B,k.current,y)){A.current=true;let T=C.current;T&&(T.style.transition=`${Q}, ${G}`,T.style.transform="translateY(100%)",T.style.opacity="0"),setTimeout(p,220);return}s(k.current)}})};return a("div",{style:{position:"fixed",inset:0,zIndex:b,pointerEvents:"none"},children:a("div",{ref:C,style:{position:"absolute",bottom:0,left:0,right:0,pointerEvents:"auto",transform:$?"translateY(0)":"translateY(100%)",opacity:$?1:0,transition:`${Q}, ${G}`},children:z("div",{ref:x,style:{display:"flex",flexDirection:"column",height:r,backgroundColor:e.panel,borderTopLeftRadius:16,borderTopRightRadius:16,border:`1px solid ${e.border}`,boxShadow:`0 -4px 12px ${e.info}4D, 0 -2px 24px rgba(0,0,0,0.4)`,...c.container},children:[a("div",{onPointerDown:L,style:{minHeight:56,display:"flex",backgroundColor:e.panel,borderTopLeftRadius:16,borderTopRightRadius:16,borderBottom:"1px solid rgba(255, 255, 255, 0.1)",cursor:S?"ns-resize":"grab",touchAction:"none",userSelect:"none"},children:a(U,{header:f,isResizing:S,mode:"bottomSheet",theme:e})}),a(_,{footer:l,footerHeight:h,disableScrollWrapper:g,contentStyle:c.content,theme:e,background:v,children:m})]})})})}function de({isActive:t,theme:e}){return a("div",{style:{width:20,height:20,borderRadius:10,margin:5,backgroundColor:t?e.success+"1A":"transparent",border:t?`2px solid ${e.success}`:"2px solid transparent",boxShadow:t?`0 0 8px ${e.success}99`:"none"}})}function ce({props:t,theme:e,viewport:n,insets:o,rect:r,setRect:s,onHeaderTap:d}){let{onClose:p,children:m,header:f,styles:c={},footer:y,footerHeight:l=0,onBack:h,disableScrollWrapper:g,zIndex:b=1e3,background:v=true}=t,x=E(null),[C,S]=R(false),[Y,$]=R(false),[W,A]=R(false),k=E(r);k.current=r;let L=E(r);q(()=>{let i=requestAnimationFrame(()=>A(true));return()=>cancelAnimationFrame(i)},[]);let M=i=>{L.current=i;let u=x.current;u&&(u.style.transform=`translate(${i.left}px, ${i.top}px)`,u.style.width=`${i.width}px`,u.style.height=`${i.height}px`)},j=i=>{let u=k.current,T=i.clientX-u.left,I=i.clientY-u.top;V(i,{onMove:(P,{dx:F,dy:w})=>{Math.abs(F)+Math.abs(w)>5&&S(true),M({...L.current,left:P.clientX-T,top:P.clientY-I})},onEnd:(P,{wasTap:F})=>{if(S(false),F){d();return}let w=L.current,N={...w,left:Math.max(o.left,Math.min(w.left,n.width-o.right-w.width)),top:Math.max(o.top,Math.min(w.top,n.height-o.bottom-w.height))};M(N),s(N)}})},X=i=>u=>{u.stopPropagation();let T={...k.current},I=false;V(u,{onStart:()=>$(true),onMove:(P,{dx:F,dy:w})=>{Math.abs(F)<.5&&Math.abs(w)<.5||(I=true,M(te(i,T,F,w,n,o,ee(n.width),80)))},onEnd:()=>{if($(false),!I){if(i==="topRight"){p();return}if(i==="topLeft"&&h){h();return}}s(L.current)}})},H=C||Y,B=[{corner:"topLeft",style:{top:4,left:4}},{corner:"topRight",style:{top:4,right:4}},{corner:"bottomLeft",style:{bottom:4,left:4}},{corner:"bottomRight",style:{bottom:4,right:4}}];return z("div",{ref:x,style:{position:"fixed",top:0,left:0,transform:`translate(${r.left}px, ${r.top}px)`,width:r.width,height:r.height,display:"flex",flexDirection:"column",backgroundColor:e.panel,borderRadius:16,border:H?`2px solid ${e.success}`:`1px solid ${e.border}`,boxShadow:H?`0 0 12px ${e.success}99`:`0 0 20px ${e.info}80, 0 8px 32px rgba(0,0,0,0.5)`,zIndex:b,opacity:W?1:0,transition:G,...c.container},children:[a("div",{onPointerDown:j,style:{minHeight:56,display:"flex",backgroundColor:e.panel,borderTopLeftRadius:14,borderTopRightRadius:14,borderBottom:"1px solid rgba(255, 255, 255, 0.1)",cursor:C?"grabbing":"grab",touchAction:"none",userSelect:"none"},children:a(U,{header:f,isResizing:H,mode:"floating",theme:e})}),a(_,{footer:y,footerHeight:l,disableScrollWrapper:g,contentStyle:c.content,theme:e,background:v,children:m}),B.map(({corner:i,style:u})=>a("div",{onPointerDown:X(i),style:{position:"absolute",width:30,height:30,zIndex:10,touchAction:"none",cursor:i==="topLeft"||i==="bottomRight"?"nwse-resize":"nesw-resize",...u},children:a(de,{isActive:H,theme:e})},i))]})}var he=t=>{let{visible:e,onClose:n,maxHeight:o,initialHeight:r=400,initialMode:s="bottomSheet",onModeChange:d,theme:p}=t,m={...ie,...p},{viewport:f,insets:c}=le(),[y,l]=R(s),[h,g]=R(r),[b,v]=R(()=>({width:380,height:500,left:(window.innerWidth-380)/2,top:(window.innerHeight-500)/2})),x=o||f.height-c.top,C=re(()=>{let S=y==="bottomSheet"?"floating":"bottomSheet";l(S),d?.(S)},n);return e?y==="floating"?a(ce,{props:t,theme:m,viewport:f,insets:c,rect:b,setRect:v,onHeaderTap:C}):a(se,{props:t,theme:m,viewport:f,effectiveMaxHeight:x,panelHeight:Math.min(h,x),setPanelHeight:g,onHeaderTap:C}):null};export{he as BottomSheet};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/bottom-sheet",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.42",
|
|
4
4
|
"description": "Bottom sheet and floating window components for React Native, with configurable presentation and native-driver animations.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -10,27 +10,37 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"react-native": "./lib/module/index.js",
|
|
13
|
+
"browser": {
|
|
14
|
+
"types": "./lib/typescript/index.web.d.ts",
|
|
15
|
+
"default": "./lib/web/index.mjs"
|
|
16
|
+
},
|
|
13
17
|
"import": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
18
|
+
"types": "./lib/typescript/index.d.ts",
|
|
19
|
+
"default": "./lib/module/index.js"
|
|
16
20
|
},
|
|
17
21
|
"require": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
22
|
+
"types": "./lib/typescript/index.d.ts",
|
|
23
|
+
"default": "./lib/commonjs/index.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
|
-
"./package.json": "./package.json"
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
"./web": {
|
|
28
|
+
"types": "./lib/typescript/index.web.d.ts",
|
|
29
|
+
"default": "./lib/web/index.mjs"
|
|
30
|
+
}
|
|
23
31
|
},
|
|
24
32
|
"files": [
|
|
25
33
|
"lib"
|
|
26
34
|
],
|
|
27
35
|
"sideEffects": false,
|
|
28
36
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
37
|
+
"@buoy-gg/shared-ui": "^7.0.42"
|
|
30
38
|
},
|
|
31
39
|
"peerDependencies": {
|
|
32
40
|
"react": "*",
|
|
33
|
-
"react-native": "*"
|
|
41
|
+
"react-native": "*",
|
|
42
|
+
"react-native-web": "^0.21.0",
|
|
43
|
+
"react-dom": ">=18"
|
|
34
44
|
},
|
|
35
45
|
"devDependencies": {
|
|
36
46
|
"@types/react": "^19.1.0",
|
|
@@ -85,11 +95,23 @@
|
|
|
85
95
|
"modal",
|
|
86
96
|
"ui-components"
|
|
87
97
|
],
|
|
98
|
+
"peerDependenciesMeta": {
|
|
99
|
+
"react-native": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"react-native-web": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"react-dom": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
88
109
|
"scripts": {
|
|
89
|
-
"build": "bob build",
|
|
110
|
+
"build": "bob build && pnpm run build:web",
|
|
90
111
|
"typecheck": "tsc --noEmit",
|
|
91
112
|
"clean": "rimraf lib",
|
|
92
113
|
"test": "pnpm run typecheck",
|
|
93
|
-
"postinstall": "echo \"Run pnpm build to compile this package\""
|
|
114
|
+
"postinstall": "echo \"Run pnpm build to compile this package\"",
|
|
115
|
+
"build:web": "node ../../scripts/build-web.mjs bottom-sheet"
|
|
94
116
|
}
|
|
95
117
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/components/BottomSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAUL,SAAS,EAEV,MAAM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H,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAquBD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA+D5C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bottomSheetGeometry.d.ts","sourceRoot":"","sources":["../../../src/components/bottomSheetGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;AAE3E,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,IAAI,EACX,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,MAA4B,GACtC,IAAI,CA2CN;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMultiTap.d.ts","sourceRoot":"","sources":["../../../src/components/useMultiTap.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,cAmCrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../src/index.web.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,uBAAuB,GACxB,MAAM,8BAA8B,CAAC"}
|