@plainsheet/core 0.7.11 → 0.7.12
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/README.md +8 -7
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/plainsheet-core.cjs.js +2 -2
- package/dist/plainsheet-core.es.js +165 -184
- package/dist/plainsheet-core.umd.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://
|
|
3
|
-
<img src="https://github.com/plainsheet/plainsheet/raw/main/documents/assets/readme-header.png" width="328" height="167">
|
|
2
|
+
<a href="https://www.plainsheet.org/">
|
|
3
|
+
<img src="https://github.com/plainsheet/plainsheet/raw/main/documents/assets/readme-header-mascot.png" width="328" height="167">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-

|
|
9
|
+

|
|
10
|
+
**Plainsheet/React**
|
|
11
|
+

|
|
12
|
+

|
|
12
13
|
|
|
13
14
|
<a href="https://codecov.io/gh/PeterByun/plain-bottom-sheet" >
|
|
14
15
|
<img src="https://codecov.io/gh/PeterByun/plain-bottom-sheet/graph/badge.svg?token=WFHGUAI3GC"/>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export * from './class-names';
|
|
8
|
-
export * from './utils';
|
|
1
|
+
export { createBottomSheet } from './bottom-sheet';
|
|
2
|
+
export type { BottomSheetCore, BottomSheetCoreProps, BottomSheetPosition, DraggingAnimationTimings, SnapPoints, } from './types';
|
|
3
|
+
export { createPlaceholderBottomSheet } from './initializer';
|
|
4
|
+
export { ClassNames } from './class-names';
|
|
5
|
+
export type { DraggingDirection } from './calculator';
|
|
6
|
+
export type { AnimationTimingPoints } from './utils';
|
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
"use strict";var Bt=Object.defineProperty;var Dt=(t,n,e)=>n in t?Bt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var U=(t,n,e)=>Dt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function w(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(tt(n))}function X(t,n){t.classList.add(tt(n))}function ot(t,n){t.classList.remove(tt(n))}function j(t,n,e){w(e)&&(w(n)&&ot(t,n),X(t,e))}function tt(t){return w(t)?t.trim().replace(/\./g,""):""}function _(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function It(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const dt="open",ft="hidden";function rt(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?(X(t,dt),ot(t,ft)):(X(t,ft),ot(t,dt))}function yt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function Nt(t){yt(t)&&t.focus()}function Mt(t){if(!yt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var y=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(y||{}),J=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(J||{}),W=(t=>(t.Hidden="hidden",t))(W||{});function N(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{X(r,i)}),w(e)&&r.setAttribute("data-testid",e),r}const Pt={CONTENTS_WRAPPER:It([y.Root,y.ContentWrapper])};function gt(t,n,e,r){switch(r){case"content-height":return n>=t?vt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Ct(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Et(t,n){return n<t?-(t-n):n-t}function $(t,n){return t>n?t-n:n-t}function xt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function ht(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function vt(t,n,e){return-(t-n)+e}function mt(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function St(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Ft(t){const n=t.style.transform,e=St(n);return{transform:n,transformValues:e}}function Ot(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function I(t){const n=t.style.transform,e=St(n),r=Ot(e,it);return wt(r??{type:it,values:[]})}function Z(t,{x:n,y:e}){const{transform:r,transformValues:o}=Ft(t),i=Ot(o,it);if(i){const a=wt(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function wt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:mt(n)??0,y:mt(e)??0}}function at(t){return t!=null}function bt(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Rt=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,y.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},_t=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=I(n),e.onDragStart()},Gt=(t,n,e,r,o)=>i=>{Ut(i,t,e,r,o,n,e.marginTop)};function Ut(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const u=n.getCoordinates(t).y,s=Et(r.startY,u),b=window.innerHeight,l=i.clientHeight,d=l-(r.containerStartTranslate.y+s);if(d>=b)return;const T=Ct(r.startY,u);if(T.isUp&&!e.expandable&&d>=l||e.preventClosing&&d<=l)return;o.start(()=>{Z(i,{y:r.containerStartTranslate.y+s})},0);const E=b-a,c=l-r.containerStartTranslate.y;if(T.isUp){const C=E-c,S=E-d,L=bt(1-Q(S/C,2),{min:0,max:1});e.onDragMove(T,L)}else if(T.isDown){const C=bt(Q(1-d/c,2),{min:0,max:1});e.onDragMove(T,C)}}const jt=(t,n,e,r,o,i,a)=>u=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,b=t.getCoordinates(u).y,l=I(n).y,d=Ct(s,b),T=window.innerHeight,E=n.clientHeight;if(d.isUp){if(!e.expandable)return;const c=[...e.snapPoints].sort((L,B)=>L-B),C=E+-l;for(const L of c){const B=L*window.innerHeight;if(C<=B){const H=$(C,B);a.translateContainer({startY:l,endY:l-H,animationFrame:o,bottomSheetContainer:n});return}}const S=vt(T,E,e.marginTop);a.translateContainer({startY:l,endY:S,animationFrame:o,bottomSheetContainer:n})}else if(d.isDown){const c=[...e.snapPoints].sort((C,S)=>S-C);for(const C of c){const S=C*window.innerHeight,L=E+-l;if(L>=S){const B=$(L,S);a.translateContainer({startY:l,endY:l+B,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const C=E+-l;if(C>=E){const S=$(C,E);a.translateContainer({startY:l,endY:l+S,animationFrame:o,bottomSheetContainer:n})}return}i()}};var x=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(x||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Vt={eventPhase:x.All};class V{constructor(n){U(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Vt,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function Wt(t,n){const e=$t(t);Xt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Kt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function $t(t){const n=N("dialog",_([y.Root,J.Dialog,t.rootClass]),y.Root);n.ariaLabel=t.ariaLabel;const e=N("section",_([y.Container,t.containerClass]),y.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=N("div",y.GapFiller,y.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=N("button",_([y.Handle,J.Button,t.shouldShowHandle?null:W.Hidden,t.handleClass]),y.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=N("span",_([y.HandleBar,t.shouldShowHandle?null:W.Hidden]),y.HandleBar),a=N("article",_([y.ContentWrapper,t.contentWrapperClass]),y.ContentWrapper),u=N("div",_([y.Backdrop,t.backdropClass,W.Hidden]),y.Backdrop);return t.backdropColor&&(u.style.backgroundColor=t.backdropColor),t.backDropTransition&&(u.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:u,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function Xt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Kt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:u,bottomSheetBackdrop:s}=t,{animationFrame:b}=e,l=new V(i),d=new V(u),T=new V(a);let E=[];const c=new V(window),C=_t(c,o,n,e.draggingState),S=Gt(c,o,n,e.draggingState,b),L=jt(c,o,n,e.draggingState,b,e.onClose,e.bottomSheetState);function B(O){O.target instanceof Element&&!r.contains(O.target)&&e.onClose()}function H(O){Rt(e.draggingState,O.target,t.bottomSheetContentWrapper)}function F(O){const k=O??n;k.draggable&&k.backgroundDraggable&&(d.addEventListeners({onStart:H,onStartOptions:{eventPhase:x.Target}}),T.addEventListeners({onStart:H})),k.draggable&&c.addEventListeners({onStart:C,onMove:S,onEnd:L}),k.draggable&&window.document.addEventListener("keyup",p=>{p.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",p=>{if(p.key==="ArrowUp"){e.moveUp();return}if(p.key==="ArrowDown"){e.moveDown();return}if(p.shiftKey&&p.key==="Tab"){const R=et(t.bottomSheetContentWrapper);Nt(R)}})}function K(O){const k=O??n;n.shouldCloseOnOutsideClick&&!n.preventClosing?s.addEventListener("click",B):s.style.pointerEvents="none",k.draggable&&(l.addEventListeners({onStart:H}),E.forEach(p=>{p.removeEventListeners({onStart:H})}),E=n.dragTriggers.reduce((p,R)=>{const g=r.querySelectorAll(R);if(!g.length)return p;const h=Array.from(g).map(f=>f instanceof HTMLElement?new V(f):null).filter(f=>!!f);return[...p,...h]},[]),E.forEach(p=>{p.addEventListeners({onStart:H,onStartOptions:{eventPhase:x.Target}})}))}function nt(){s.removeEventListener("click",B)}function et(O){let k=[...Array.from(O.childNodes).reverse()];for(;k.length;){const p=k.shift();if(Mt(p))return p;p&&(k=[...k,...Array.from(p.childNodes).reverse()])}return null}function z(){l.removeEventListeners({onStart:H}),d.removeEventListeners({onStart:H}),T.removeEventListeners({onStart:H}),E.forEach(O=>{O.removeEventListeners({onStart:H})}),c.removeEventListeners({onStart:C,onMove:S,onEnd:L})}return{attachEventListeners:F,clearEventListeners:z,attacheOnOpenEventListeners:K,clearOnOpenEventListeners:nt}}class zt{constructor(){U(this,"animationId");U(this,"isInProgress");U(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Q(a/e,2),b=s>=1&&!r;n(s),b?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:u}=t,s=Et(n,e);o.stop();let b=!1;o.start(l=>{Z(r,{y:n+s*a(l)}),!b&&l>=1&&(i==null||i(),b=!0)},u)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},P={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const M={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Lt(t){for(const n of Object.values(M))if(n===t)return!0;return!1}function ut(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function G(t,n,e,r){return function(s){return u(i(s))};function i(s){let b=0,l=1,d=s,T;if(s===0||s===1)return s;for(;b<l;){if(T=a(d),Math.abs(T-s)<.001)return d;s>T?b=d:l=d,d=(l+b)/2}return d}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function u(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const pt=G(.25,.1,.25,1),tn=G(.42,0,1,1),kt=G(.42,0,.58,1),nn=G(.4,.1,.6,1),en=G(.45,1.5,.55,1);function rn(t){switch(t){case M.EASE:return pt;case M.EASE_IN:return tn;case M.EASE_OUT:return kt;case M.EASE_IN_OUT:return nn;case M.SPRING:return en;default:return pt}}function Tt(t){return typeof t=="boolean"}const At={ariaLabel:"Bottom sheet",content:"",defaultPosition:P.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function on(t){const n={...At},e=Object.entries(t).reduce((o,i)=>{const[a,u]=i;return at(u)&&(o[a]=u),o},{});return{...n,...e}}function lt(t){if(ut(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return G(n,e,r,o)}return Lt(t)?rn(t):kt}function an(t,n,e,r){function o(i,a){switch(i){case"content":w(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":w(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Tt(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":w(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"containerBackgroundColor":w(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":w(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":w(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!w(a))return;j(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!w(a))return;j(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!w(a))return;j(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!w(a))return;j(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!w(a))return;j(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"dragTriggers":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(ut(a)){const u=lt(a),s=ct(u,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const u=lt(e.draggingAnimationTimings),s=ct(u,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=lt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const u=new zt,s={animationFrame:u,onClose:B,bottomSheetState:o,draggingState:i,snapTo:R,moveUp:k,moveDown:p},{elements:b,eventHandlers:l}=Wt(n,s),d=Qt(n,an(b,o,n,l)),{bottomSheetBackdrop:T,bottomSheetRoot:E,bottomSheetContainer:c}=b,C=g=>{const h=g??window.document.body;h.appendChild(E),h.appendChild(T);const f=window.innerHeight;Z(c,{y:f}),l.attachEventListeners(),o.isMounted=!0},S=()=>{l.clearEventListeners(),Object.values(b).forEach(g=>{g.remove()}),a(),o.isMounted=!1},L=()=>{var D;if(H()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),F())return;rt(T,!0),d.shouldShowBackdrop||X(T,"transparent"),rt([c],!0),Z(c,{y:c.clientHeight});const h=window.innerHeight,f=gt(h,c.clientHeight,d.marginTop,d.defaultPosition),m=I(c).y;o.translateContainer({startY:m,endY:f,animationFrame:u,bottomSheetContainer:c,onEnd:t.afterOpen});const v=document.body.style.overflowY;i.originalDocumentOverflowY=v||"initial";const A=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=A||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",b.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function B(){var f;if(K())return;(f=t.beforeClose)==null||f.call(t);const g=I(c).y,h=c.clientHeight;o.translateContainer({startY:g,endY:h,animationFrame:u,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),rt([T,c],!1),l.clearOnOpenEventListeners()}}),a()}function H(){return o.isMounted}function F(){const g=I(c).y,h=window.innerHeight,f=c.clientHeight>=h?h:c.clientHeight;return g<=f}function K(){return!F()}function nt(){const g=I(c).y,h=c.clientHeight,f=window.innerHeight;if(g<=5&&g>=-5)return P.CONTENT_HEIGHT;const m=h-g;if(m===f/2)return P.MIDDLE;const v=f-d.marginTop,A=10;return m<=v+A&&m>=v-A?P.TOP:P.CLOSED}function et(){return c.clientHeight}function z(g){if(!F())return;const h=I(c).y,m=c.clientHeight-h,v=window.innerHeight-g,A=xt(m,v),D=$(m,v);o.translateContainer({startY:h,endY:h+(A.isUp?-D:D),animationFrame:u,bottomSheetContainer:c})}function O(g,{viewportHeight:h,visibleHeight:f}){let m=null;for(const v of g){const A=v*h,D=$(f,A);(m===null||D<m)&&(m=D)}return{minOffset:m}}function k(){const g=[...d.snapPoints].reverse(),h=I(c).y,f=c.clientHeight,m=f-h;if(!d.expandable&&m>=f)return;const v=window.innerHeight,A=ht("above",{visibleHeight:m,viewportHeight:v},g),{minOffset:D}=O(A,{visibleHeight:m,viewportHeight:v});if(D===null&&m<v-d.marginTop){o.translateContainer({startY:h,endY:gt(v,f,d.marginTop,"top"),animationFrame:u,bottomSheetContainer:c});return}Y(D)&&o.translateContainer({startY:h,endY:h-D,animationFrame:u,bottomSheetContainer:c})}function p(){const g=I(c).y,f=c.clientHeight-g;if(f<1)return;const m=window.innerHeight,v=ht("below",{visibleHeight:f,viewportHeight:m},d.snapPoints),{minOffset:A}=O(v,{visibleHeight:f,viewportHeight:m});Y(A)&&o.translateContainer({startY:g,endY:g+A,animationFrame:u,bottomSheetContainer:c})}function R(g){const h=window.innerHeight;if(!Jt(g))return;const f=Q(h*g,2);z(f)}return{props:d,elements:b,mount:C,unmount:S,open:L,close:B,getIsMounted:H,getIsOpen:F,getIsClosed:K,getPosition:nt,getHeight:et,moveTo:z,snapTo:R}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>P.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=At;exports.BOTTOM_SHEET_POSITION=P;exports.BOTTOM_SHEET_SELECTORS=Pt;exports.COMMON_ANIMATION_KEYS=M;exports.ClassNames=y;exports.EventPhase=x;exports.ResetClassNames=J;exports.UtilClassNames=W;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=cn;exports.eventPhaseToEnum=st;exports.isAnimationTimingPoints=ut;exports.isCommonAnimationTimingsKey=Lt;
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
+
"use strict";var Lt=Object.defineProperty;var At=(t,n,e)=>n in t?Lt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var U=(t,n,e)=>At(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function H(t){return typeof t=="string"}function Bt(t,n){return t.classList.contains(Z(n))}function W(t,n){t.classList.add(Z(n))}function rt(t,n){t.classList.remove(Z(n))}function _(t,n,e){H(e)&&(H(n)&&rt(t,n),W(t,e))}function Z(t){return H(t)?t.trim().replace(/\./g,""):""}function M(t){return t.map(n=>Z(n)).filter(Boolean).join(" ")}const lt="open",ut="hidden";function et(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?(W(t,lt),rt(t,ut)):(W(t,ut),rt(t,lt))}function yt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function Dt(t){yt(t)&&t.focus()}function Yt(t){if(!yt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var T=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(T||{}),ot=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(ot||{}),K=(t=>(t.Hidden="hidden",t))(K||{});function N(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{W(r,i)}),H(e)&&r.setAttribute("data-testid",e),r}function dt(t,n,e,r){switch(r){case"content-height":return n>=t?Et(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Ct(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Tt(t,n){return n<t?-(t-n):n-t}function $(t,n){return t>n?t-n:n-t}function It(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function ft(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function Et(t,n,e){return-(t-n)+e}function gt(t){return Number(t.replace("px",""))}function J(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Nt(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function wt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function I(t){const n=t.style.transform,e=vt(n),r=wt(e,it);return St(r??{type:it,values:[]})}function Q(t,{x:n,y:e}){const{transform:r,transformValues:o}=Nt(t),i=wt(o,it);if(i){const a=St(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function St(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:gt(n)??0,y:gt(e)??0}}function at(t){return t!=null}function ht(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const xt=(t,n,e)=>{n instanceof HTMLElement&&!Bt(n,T.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=I(n),e.onDragStart()},Mt=(t,n,e,r,o)=>i=>{Pt(i,t,e,r,o,n,e.marginTop)};function Pt(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const u=n.getCoordinates(t).y,s=Tt(r.startY,u),b=window.innerHeight,l=i.clientHeight,d=l-(r.containerStartTranslate.y+s);if(d>=b)return;const y=Ct(r.startY,u);if(y.isUp&&!e.expandable&&d>=l||e.preventClosing&&d<=l)return;o.start(()=>{Q(i,{y:r.containerStartTranslate.y+s})},0);const E=b-a,c=l-r.containerStartTranslate.y;if(y.isUp){const C=E-c,w=E-d,k=ht(1-J(w/C,2),{min:0,max:1});e.onDragMove(y,k)}else if(y.isDown){const C=ht(J(1-d/c,2),{min:0,max:1});e.onDragMove(y,C)}}const Rt=(t,n,e,r,o,i,a)=>u=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,b=t.getCoordinates(u).y,l=I(n).y,d=Ct(s,b),y=window.innerHeight,E=n.clientHeight;if(d.isUp){if(!e.expandable)return;const c=[...e.snapPoints].sort((k,B)=>k-B),C=E+-l;for(const k of c){const B=k*window.innerHeight;if(C<=B){const O=$(C,B);a.translateContainer({startY:l,endY:l-O,animationFrame:o,bottomSheetContainer:n});return}}const w=Et(y,E,e.marginTop);a.translateContainer({startY:l,endY:w,animationFrame:o,bottomSheetContainer:n})}else if(d.isDown){const c=[...e.snapPoints].sort((C,w)=>w-C);for(const C of c){const w=C*window.innerHeight,k=E+-l;if(k>=w){const B=$(k,w);a.translateContainer({startY:l,endY:l+B,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const C=E+-l;if(C>=E){const w=$(C,E);a.translateContainer({startY:l,endY:l+w,animationFrame:o,bottomSheetContainer:n})}return}i()}};var G=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(G||{});function mt(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gt={eventPhase:G.All};class V{constructor(n){U(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Gt,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===G.All){n(i);return}mt(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===G.All){n(i);return}mt(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function jt(t,n){const e=Ut(t);_t(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Vt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Ut(t){const n=N("dialog",M([T.Root,ot.Dialog,t.rootClass]),T.Root);n.ariaLabel=t.ariaLabel;const e=N("section",M([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=N("div",T.GapFiller,T.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=N("button",M([T.Handle,ot.Button,t.shouldShowHandle?null:K.Hidden,t.handleClass]),T.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=N("span",M([T.HandleBar,t.shouldShowHandle?null:K.Hidden]),T.HandleBar),a=N("article",M([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),u=N("div",M([T.Backdrop,t.backdropClass,K.Hidden]),T.Backdrop);return t.backdropColor&&(u.style.backgroundColor=t.backdropColor),t.backDropTransition&&(u.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:u,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function _t({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Vt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:u,bottomSheetBackdrop:s}=t,{animationFrame:b}=e,l=new V(i),d=new V(u),y=new V(a);let E=[];const c=new V(window),C=Ft(c,o,n,e.draggingState),w=Mt(c,o,n,e.draggingState,b),k=Rt(c,o,n,e.draggingState,b,e.onClose,e.bottomSheetState);function B(S){S.target instanceof Element&&!r.contains(S.target)&&e.onClose()}function O(S){xt(e.draggingState,S.target,t.bottomSheetContentWrapper)}function x(S){const L=S??n;L.draggable&&L.backgroundDraggable&&(d.addEventListeners({onStart:O,onStartOptions:{eventPhase:G.Target}}),y.addEventListeners({onStart:O})),L.draggable&&c.addEventListeners({onStart:C,onMove:w,onEnd:k}),L.draggable&&window.document.addEventListener("keyup",p=>{p.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",p=>{if(p.key==="ArrowUp"){e.moveUp();return}if(p.key==="ArrowDown"){e.moveDown();return}if(p.shiftKey&&p.key==="Tab"){const F=nt(t.bottomSheetContentWrapper);Dt(F)}})}function X(S){const L=S??n;n.shouldCloseOnOutsideClick&&!n.preventClosing?s.addEventListener("click",B):s.style.pointerEvents="none",L.draggable&&(l.addEventListeners({onStart:O}),E.forEach(p=>{p.removeEventListeners({onStart:O})}),E=n.dragTriggers.reduce((p,F)=>{const g=r.querySelectorAll(F);if(!g.length)return p;const h=Array.from(g).map(f=>f instanceof HTMLElement?new V(f):null).filter(f=>!!f);return[...p,...h]},[]),E.forEach(p=>{p.addEventListeners({onStart:O,onStartOptions:{eventPhase:G.Target}})}))}function tt(){s.removeEventListener("click",B)}function nt(S){let L=[...Array.from(S.childNodes).reverse()];for(;L.length;){const p=L.shift();if(Yt(p))return p;p&&(L=[...L,...Array.from(p.childNodes).reverse()])}return null}function z(){l.removeEventListeners({onStart:O}),d.removeEventListeners({onStart:O}),y.removeEventListeners({onStart:O}),E.forEach(S=>{S.removeEventListeners({onStart:O})}),c.removeEventListeners({onStart:C,onMove:w,onEnd:k})}return{attachEventListeners:x,clearEventListeners:z,attacheOnOpenEventListeners:X,clearOnOpenEventListeners:tt}}class $t{constructor(){U(this,"animationId");U(this,"isInProgress");U(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:J(a/e,2),b=s>=1&&!r;n(s),b?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Wt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:u}=t,s=Tt(n,e);o.stop();let b=!1;o.start(l=>{Q(r,{y:n+s*a(l)}),!b&&l>=1&&(i==null||i(),b=!0)},u)}const st=(t,n)=>e=>{Wt({...e,animationTimingFunction:t,animationDuration:n})},R={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Xt(t){return!(!Y(t)||t>1||t<0)}function zt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Kt(...t){console.error(t)}const P={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function qt(t){for(const n of Object.values(P))if(n===t)return!0;return!1}function Ot(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function j(t,n,e,r){return function(s){return u(i(s))};function i(s){let b=0,l=1,d=s,y;if(s===0||s===1)return s;for(;b<l;){if(y=a(d),Math.abs(y-s)<.001)return d;s>y?b=d:l=d,d=(l+b)/2}return d}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function u(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const bt=j(.25,.1,.25,1),Jt=j(.42,0,1,1),kt=j(.42,0,.58,1),Qt=j(.4,.1,.6,1),Zt=j(.45,1.5,.55,1);function tn(t){switch(t){case P.EASE:return bt;case P.EASE_IN:return Jt;case P.EASE_OUT:return kt;case P.EASE_IN_OUT:return Qt;case P.SPRING:return Zt;default:return bt}}function pt(t){return typeof t=="boolean"}const nn={ariaLabel:"Bottom sheet",content:"",defaultPosition:R.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function en(t){const n={...nn},e=Object.entries(t).reduce((o,i)=>{const[a,u]=i;return at(u)&&(o[a]=u),o},{});return{...n,...e}}function ct(t){if(Ot(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return qt(t)?tn(t):kt}function rn(t,n,e,r){function o(i,a){switch(i){case"content":H(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":H(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":pt(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":pt(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":H(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"containerBackgroundColor":H(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":H(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":H(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!H(a))return;_(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!H(a))return;_(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!H(a))return;_(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!H(a))return;_(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!H(a))return;_(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"dragTriggers":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(Ot(a)){const u=ct(a),s=st(u,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const u=ct(e.draggingAnimationTimings),s=st(u,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function on(t){const n=en(t),e=ct(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:st(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const u=new $t,s={animationFrame:u,onClose:B,bottomSheetState:o,draggingState:i,snapTo:F,moveUp:L,moveDown:p},{elements:b,eventHandlers:l}=jt(n,s),d=zt(n,rn(b,o,n,l)),{bottomSheetBackdrop:y,bottomSheetRoot:E,bottomSheetContainer:c}=b,C=g=>{const h=g??window.document.body;h.appendChild(E),h.appendChild(y);const f=window.innerHeight;Q(c,{y:f}),l.attachEventListeners(),o.isMounted=!0},w=()=>{l.clearEventListeners(),Object.values(b).forEach(g=>{g.remove()}),a(),o.isMounted=!1},k=()=>{var D;if(O()||Kt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),x())return;et(y,!0),d.shouldShowBackdrop||W(y,"transparent"),et([c],!0),Q(c,{y:c.clientHeight});const h=window.innerHeight,f=dt(h,c.clientHeight,d.marginTop,d.defaultPosition),m=I(c).y;o.translateContainer({startY:m,endY:f,animationFrame:u,bottomSheetContainer:c,onEnd:t.afterOpen});const v=document.body.style.overflowY;i.originalDocumentOverflowY=v||"initial";const A=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=A||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",b.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function B(){var f;if(X())return;(f=t.beforeClose)==null||f.call(t);const g=I(c).y,h=c.clientHeight;o.translateContainer({startY:g,endY:h,animationFrame:u,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),et([y,c],!1),l.clearOnOpenEventListeners()}}),a()}function O(){return o.isMounted}function x(){const g=I(c).y,h=window.innerHeight,f=c.clientHeight>=h?h:c.clientHeight;return g<=f}function X(){return!x()}function tt(){const g=I(c).y,h=c.clientHeight,f=window.innerHeight;if(g<=5&&g>=-5)return R.CONTENT_HEIGHT;const m=h-g;if(m===f/2)return R.MIDDLE;const v=f-d.marginTop,A=10;return m<=v+A&&m>=v-A?R.TOP:R.CLOSED}function nt(){return c.clientHeight}function z(g){if(!x())return;const h=I(c).y,m=c.clientHeight-h,v=window.innerHeight-g,A=It(m,v),D=$(m,v);o.translateContainer({startY:h,endY:h+(A.isUp?-D:D),animationFrame:u,bottomSheetContainer:c})}function S(g,{viewportHeight:h,visibleHeight:f}){let m=null;for(const v of g){const A=v*h,D=$(f,A);(m===null||D<m)&&(m=D)}return{minOffset:m}}function L(){const g=[...d.snapPoints].reverse(),h=I(c).y,f=c.clientHeight,m=f-h;if(!d.expandable&&m>=f)return;const v=window.innerHeight,A=ft("above",{visibleHeight:m,viewportHeight:v},g),{minOffset:D}=S(A,{visibleHeight:m,viewportHeight:v});if(D===null&&m<v-d.marginTop){o.translateContainer({startY:h,endY:dt(v,f,d.marginTop,"top"),animationFrame:u,bottomSheetContainer:c});return}Y(D)&&o.translateContainer({startY:h,endY:h-D,animationFrame:u,bottomSheetContainer:c})}function p(){const g=I(c).y,f=c.clientHeight-g;if(f<1)return;const m=window.innerHeight,v=ft("below",{visibleHeight:f,viewportHeight:m},d.snapPoints),{minOffset:A}=S(v,{visibleHeight:f,viewportHeight:m});Y(A)&&o.translateContainer({startY:g,endY:g+A,animationFrame:u,bottomSheetContainer:c})}function F(g){const h=window.innerHeight;if(!Xt(g))return;const f=J(h*g,2);z(f)}return{props:d,elements:b,mount:C,unmount:w,open:k,close:B,getIsMounted:O,getIsOpen:x,getIsClosed:X,getPosition:tt,getHeight:nt,moveTo:z,snapTo:F}}function an(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>R.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.ClassNames=T;exports.createBottomSheet=on;exports.createPlaceholderBottomSheet=an;
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
2
|
var Lt = Object.defineProperty;
|
|
3
3
|
var At = (t, n, e) => n in t ? Lt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var _ = (t, n, e) => At(t, typeof n != "symbol" ? n + "" : n, e);
|
|
5
|
+
function S(t) {
|
|
6
6
|
return typeof t == "string";
|
|
7
7
|
}
|
|
8
8
|
function Bt(t, n) {
|
|
9
9
|
return t.classList.contains(Z(n));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function W(t, n) {
|
|
12
12
|
t.classList.add(Z(n));
|
|
13
13
|
}
|
|
14
14
|
function rt(t, n) {
|
|
15
15
|
t.classList.remove(Z(n));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function j(t, n, e) {
|
|
18
|
+
S(e) && (S(n) && rt(t, n), W(t, e));
|
|
19
19
|
}
|
|
20
20
|
function Z(t) {
|
|
21
|
-
return
|
|
21
|
+
return S(t) ? t.trim().replace(/\./g, "") : "";
|
|
22
22
|
}
|
|
23
23
|
function M(t) {
|
|
24
24
|
return t.map((n) => Z(n)).filter(Boolean).join(" ");
|
|
25
25
|
}
|
|
26
|
-
function Dt(t) {
|
|
27
|
-
return t.map((n) => n == null ? void 0 : n.trim()).filter(Boolean).map((n) => `.${n}`).join(" ");
|
|
28
|
-
}
|
|
29
26
|
const lt = "open", ut = "hidden";
|
|
30
27
|
function et(t, n) {
|
|
31
28
|
const e = n;
|
|
@@ -38,7 +35,7 @@ function et(t, n) {
|
|
|
38
35
|
q(t, e), t.setAttribute("aria-modal", e ? "true" : "false");
|
|
39
36
|
}
|
|
40
37
|
function q(t, n) {
|
|
41
|
-
n ? (
|
|
38
|
+
n ? (W(t, lt), rt(t, ut)) : (W(t, ut), rt(t, lt));
|
|
42
39
|
}
|
|
43
40
|
function yt(t) {
|
|
44
41
|
return t instanceof HTMLElement;
|
|
@@ -46,10 +43,10 @@ function yt(t) {
|
|
|
46
43
|
function Y(t) {
|
|
47
44
|
return typeof t == "number" && !Number.isNaN(t);
|
|
48
45
|
}
|
|
49
|
-
function
|
|
46
|
+
function Dt(t) {
|
|
50
47
|
yt(t) && t.focus();
|
|
51
48
|
}
|
|
52
|
-
function
|
|
49
|
+
function Yt(t) {
|
|
53
50
|
if (!yt(t) || t.offsetParent === null || "disabled" in t && t.disabled)
|
|
54
51
|
return !1;
|
|
55
52
|
const e = t.getAttribute("tabindex"), r = Y(e) ? parseInt(e, 10) : -1, i = [
|
|
@@ -63,19 +60,13 @@ function It(t) {
|
|
|
63
60
|
].includes(t.tagName), a = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
|
|
64
61
|
return i || a || r > -1;
|
|
65
62
|
}
|
|
66
|
-
var
|
|
67
|
-
function
|
|
63
|
+
var v = /* @__PURE__ */ ((t) => (t.Backdrop = "pbs-backdrop", t.Root = "pbs-root", t.Container = "pbs-container", t.GapFiller = "pbs-gap-filler", t.Handle = "pbs-handle", t.HandleBar = "pbs-handle-bar", t.ContentWrapper = "pbs-content-wrapper", t))(v || {}), ot = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(ot || {}), K = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(K || {});
|
|
64
|
+
function N(t, n, e) {
|
|
68
65
|
const r = document.createElement(t);
|
|
69
66
|
return n.split(" ").forEach((i) => {
|
|
70
|
-
|
|
71
|
-
}),
|
|
67
|
+
W(r, i);
|
|
68
|
+
}), S(e) && r.setAttribute("data-testid", e), r;
|
|
72
69
|
}
|
|
73
|
-
const sn = {
|
|
74
|
-
CONTENTS_WRAPPER: Dt([
|
|
75
|
-
T.Root,
|
|
76
|
-
T.ContentWrapper
|
|
77
|
-
])
|
|
78
|
-
};
|
|
79
70
|
function dt(t, n, e, r) {
|
|
80
71
|
switch (r) {
|
|
81
72
|
case "content-height":
|
|
@@ -99,10 +90,10 @@ function Ct(t, n) {
|
|
|
99
90
|
function Tt(t, n) {
|
|
100
91
|
return n < t ? -(t - n) : n - t;
|
|
101
92
|
}
|
|
102
|
-
function
|
|
93
|
+
function $(t, n) {
|
|
103
94
|
return t > n ? t - n : n - t;
|
|
104
95
|
}
|
|
105
|
-
function
|
|
96
|
+
function It(t, n) {
|
|
106
97
|
const e = t < n, r = t > n;
|
|
107
98
|
return {
|
|
108
99
|
isUp: e,
|
|
@@ -151,7 +142,7 @@ function I(t) {
|
|
|
151
142
|
e,
|
|
152
143
|
it
|
|
153
144
|
);
|
|
154
|
-
return
|
|
145
|
+
return Ht(r ?? {
|
|
155
146
|
type: it,
|
|
156
147
|
values: []
|
|
157
148
|
});
|
|
@@ -165,7 +156,7 @@ function Q(t, { x: n, y: e }) {
|
|
|
165
156
|
it
|
|
166
157
|
);
|
|
167
158
|
if (i) {
|
|
168
|
-
const a =
|
|
159
|
+
const a = Ht(i);
|
|
169
160
|
t.style.transform = `translate(${n ?? a.x ?? 0}px,${e ?? a.y ?? 0}px)`;
|
|
170
161
|
return;
|
|
171
162
|
}
|
|
@@ -175,7 +166,7 @@ function Q(t, { x: n, y: e }) {
|
|
|
175
166
|
}
|
|
176
167
|
t.style.transform = `translate(${n ?? 0}px,${e ?? 0}px)`;
|
|
177
168
|
}
|
|
178
|
-
function
|
|
169
|
+
function Ht(t) {
|
|
179
170
|
if (t.type !== "translate")
|
|
180
171
|
throw new Error(
|
|
181
172
|
`Could not get coordinates from ${t.type}, since is not translate.`
|
|
@@ -195,12 +186,12 @@ function ht(t, {
|
|
|
195
186
|
}) {
|
|
196
187
|
return at(e) && t >= e ? e : at(n) && t <= n ? n : t;
|
|
197
188
|
}
|
|
198
|
-
const
|
|
199
|
-
n instanceof HTMLElement && !Bt(n,
|
|
200
|
-
},
|
|
189
|
+
const xt = (t, n, e) => {
|
|
190
|
+
n instanceof HTMLElement && !Bt(n, v.Handle) && e.scrollTop >= 1 || (t.isDragging = !0);
|
|
191
|
+
}, Ft = (t, n, e, r) => (o) => {
|
|
201
192
|
r.startY = t.getCoordinates(o).y, r.containerStartTranslate = I(n), e.onDragStart();
|
|
202
|
-
},
|
|
203
|
-
|
|
193
|
+
}, Mt = (t, n, e, r, o) => (i) => {
|
|
194
|
+
Pt(
|
|
204
195
|
i,
|
|
205
196
|
t,
|
|
206
197
|
e,
|
|
@@ -210,7 +201,7 @@ const Ft = (t, n, e) => {
|
|
|
210
201
|
e.marginTop
|
|
211
202
|
);
|
|
212
203
|
};
|
|
213
|
-
function
|
|
204
|
+
function Pt(t, n, e, r, o, i, a) {
|
|
214
205
|
if (!r.isDragging || !Y(r.startY))
|
|
215
206
|
return;
|
|
216
207
|
const u = n.getCoordinates(t).y, s = Tt(r.startY, u), b = window.innerHeight, l = i.clientHeight, d = l - (r.containerStartTranslate.y + s);
|
|
@@ -224,9 +215,9 @@ function Rt(t, n, e, r, o, i, a) {
|
|
|
224
215
|
y: r.containerStartTranslate.y + s
|
|
225
216
|
});
|
|
226
217
|
}, 0);
|
|
227
|
-
const
|
|
218
|
+
const T = b - a, c = l - r.containerStartTranslate.y;
|
|
228
219
|
if (y.isUp) {
|
|
229
|
-
const C =
|
|
220
|
+
const C = T - c, w = T - d, k = ht(
|
|
230
221
|
1 - J(w / C, 2),
|
|
231
222
|
{
|
|
232
223
|
min: 0,
|
|
@@ -248,21 +239,21 @@ function Rt(t, n, e, r, o, i, a) {
|
|
|
248
239
|
e.onDragMove(y, C);
|
|
249
240
|
}
|
|
250
241
|
}
|
|
251
|
-
const
|
|
242
|
+
const Rt = (t, n, e, r, o, i, a) => (u) => {
|
|
252
243
|
if (!r.isDragging || (r.isDragging = !1, !Y(r.startY)))
|
|
253
244
|
return;
|
|
254
245
|
e.onDragEnd();
|
|
255
|
-
const s = r.startY, b = t.getCoordinates(u).y, l = I(n).y, d = Ct(s, b), y = window.innerHeight,
|
|
246
|
+
const s = r.startY, b = t.getCoordinates(u).y, l = I(n).y, d = Ct(s, b), y = window.innerHeight, T = n.clientHeight;
|
|
256
247
|
if (d.isUp) {
|
|
257
248
|
if (!e.expandable)
|
|
258
249
|
return;
|
|
259
250
|
const c = [...e.snapPoints].sort(
|
|
260
251
|
(k, B) => k - B
|
|
261
|
-
), C =
|
|
252
|
+
), C = T + -l;
|
|
262
253
|
for (const k of c) {
|
|
263
254
|
const B = k * window.innerHeight;
|
|
264
255
|
if (C <= B) {
|
|
265
|
-
const O =
|
|
256
|
+
const O = $(
|
|
266
257
|
C,
|
|
267
258
|
B
|
|
268
259
|
);
|
|
@@ -277,7 +268,7 @@ const Gt = (t, n, e, r, o, i, a) => (u) => {
|
|
|
277
268
|
}
|
|
278
269
|
const w = Et(
|
|
279
270
|
y,
|
|
280
|
-
|
|
271
|
+
T,
|
|
281
272
|
e.marginTop
|
|
282
273
|
);
|
|
283
274
|
a.translateContainer({
|
|
@@ -291,9 +282,9 @@ const Gt = (t, n, e, r, o, i, a) => (u) => {
|
|
|
291
282
|
(C, w) => w - C
|
|
292
283
|
);
|
|
293
284
|
for (const C of c) {
|
|
294
|
-
const w = C * window.innerHeight, k =
|
|
285
|
+
const w = C * window.innerHeight, k = T + -l;
|
|
295
286
|
if (k >= w) {
|
|
296
|
-
const B =
|
|
287
|
+
const B = $(
|
|
297
288
|
k,
|
|
298
289
|
w
|
|
299
290
|
);
|
|
@@ -307,9 +298,9 @@ const Gt = (t, n, e, r, o, i, a) => (u) => {
|
|
|
307
298
|
}
|
|
308
299
|
}
|
|
309
300
|
if (e.preventClosing) {
|
|
310
|
-
const C =
|
|
311
|
-
if (C >=
|
|
312
|
-
const w =
|
|
301
|
+
const C = T + -l;
|
|
302
|
+
if (C >= T) {
|
|
303
|
+
const w = $(C, T);
|
|
313
304
|
a.translateContainer({
|
|
314
305
|
startY: l,
|
|
315
306
|
endY: l + w,
|
|
@@ -337,17 +328,17 @@ function mt(t) {
|
|
|
337
328
|
return -1;
|
|
338
329
|
}
|
|
339
330
|
}
|
|
340
|
-
const
|
|
331
|
+
const Gt = {
|
|
341
332
|
eventPhase: G.All
|
|
342
333
|
};
|
|
343
334
|
class V {
|
|
344
335
|
constructor(n) {
|
|
345
|
-
|
|
336
|
+
_(this, "currentTarget");
|
|
346
337
|
this.currentTarget = n;
|
|
347
338
|
}
|
|
348
339
|
addEventListeners({
|
|
349
340
|
onStart: n,
|
|
350
|
-
onStartOptions: e =
|
|
341
|
+
onStartOptions: e = Gt,
|
|
351
342
|
onMove: r,
|
|
352
343
|
onEnd: o
|
|
353
344
|
}) {
|
|
@@ -433,18 +424,18 @@ class V {
|
|
|
433
424
|
};
|
|
434
425
|
}
|
|
435
426
|
}
|
|
436
|
-
function
|
|
427
|
+
function St(t) {
|
|
437
428
|
const n = t;
|
|
438
429
|
return `${n} ${n} 0px 0px`;
|
|
439
430
|
}
|
|
440
|
-
function
|
|
441
|
-
const e =
|
|
442
|
-
|
|
431
|
+
function Ut(t, n) {
|
|
432
|
+
const e = _t(t);
|
|
433
|
+
jt(e), e.bottomSheetContainer.style.width = t.width;
|
|
443
434
|
const r = document.createElement("div");
|
|
444
435
|
r.innerHTML = t.content ?? "";
|
|
445
436
|
const o = window.innerHeight;
|
|
446
437
|
e.bottomSheetContainer.style.maxHeight = `${o}px`, e.bottomSheetContentWrapper.appendChild(r);
|
|
447
|
-
const i =
|
|
438
|
+
const i = Vt({
|
|
448
439
|
bottomSheetElements: e,
|
|
449
440
|
bottomSheetProps: t,
|
|
450
441
|
options: n
|
|
@@ -457,64 +448,64 @@ function jt(t, n) {
|
|
|
457
448
|
t.contentWrapperStyle
|
|
458
449
|
), { elements: e, eventHandlers: i };
|
|
459
450
|
}
|
|
460
|
-
function
|
|
461
|
-
const n =
|
|
451
|
+
function _t(t) {
|
|
452
|
+
const n = N(
|
|
462
453
|
"dialog",
|
|
463
454
|
M([
|
|
464
|
-
|
|
455
|
+
v.Root,
|
|
465
456
|
ot.Dialog,
|
|
466
457
|
t.rootClass
|
|
467
458
|
]),
|
|
468
|
-
|
|
459
|
+
v.Root
|
|
469
460
|
);
|
|
470
461
|
n.ariaLabel = t.ariaLabel;
|
|
471
|
-
const e =
|
|
462
|
+
const e = N(
|
|
472
463
|
"section",
|
|
473
|
-
M([
|
|
474
|
-
|
|
464
|
+
M([v.Container, t.containerClass]),
|
|
465
|
+
v.Container
|
|
475
466
|
);
|
|
476
|
-
t.containerBorderRadius && (e.style.borderRadius =
|
|
467
|
+
t.containerBorderRadius && (e.style.borderRadius = St(
|
|
477
468
|
t.containerBorderRadius
|
|
478
469
|
));
|
|
479
|
-
const r =
|
|
470
|
+
const r = N(
|
|
480
471
|
"div",
|
|
481
|
-
|
|
482
|
-
|
|
472
|
+
v.GapFiller,
|
|
473
|
+
v.GapFiller
|
|
483
474
|
);
|
|
484
475
|
t.containerBackgroundColor && (e.style.backgroundColor = t.containerBackgroundColor, r.style.backgroundColor = t.containerBackgroundColor);
|
|
485
|
-
const o =
|
|
476
|
+
const o = N(
|
|
486
477
|
"button",
|
|
487
478
|
M([
|
|
488
|
-
|
|
479
|
+
v.Handle,
|
|
489
480
|
ot.Button,
|
|
490
481
|
t.shouldShowHandle ? null : K.Hidden,
|
|
491
482
|
t.handleClass
|
|
492
483
|
]),
|
|
493
|
-
|
|
484
|
+
v.Handle
|
|
494
485
|
);
|
|
495
486
|
o.setAttribute("type", "button"), o.ariaLabel = "bottom sheet close button";
|
|
496
|
-
const i =
|
|
487
|
+
const i = N(
|
|
497
488
|
"span",
|
|
498
489
|
M([
|
|
499
|
-
|
|
490
|
+
v.HandleBar,
|
|
500
491
|
t.shouldShowHandle ? null : K.Hidden
|
|
501
492
|
]),
|
|
502
|
-
|
|
503
|
-
), a =
|
|
493
|
+
v.HandleBar
|
|
494
|
+
), a = N(
|
|
504
495
|
"article",
|
|
505
496
|
M([
|
|
506
|
-
|
|
497
|
+
v.ContentWrapper,
|
|
507
498
|
t.contentWrapperClass
|
|
508
499
|
]),
|
|
509
|
-
|
|
510
|
-
), u =
|
|
500
|
+
v.ContentWrapper
|
|
501
|
+
), u = N(
|
|
511
502
|
"div",
|
|
512
503
|
M([
|
|
513
|
-
|
|
504
|
+
v.Backdrop,
|
|
514
505
|
t.backdropClass,
|
|
515
506
|
K.Hidden
|
|
516
507
|
]),
|
|
517
|
-
|
|
508
|
+
v.Backdrop
|
|
518
509
|
);
|
|
519
510
|
return t.backdropColor && (u.style.backgroundColor = t.backdropColor), t.backDropTransition && (u.style.transition = t.backDropTransition), {
|
|
520
511
|
bottomSheetRoot: n,
|
|
@@ -526,7 +517,7 @@ function Ut(t) {
|
|
|
526
517
|
bottomSheetContainerGapFiller: r
|
|
527
518
|
};
|
|
528
519
|
}
|
|
529
|
-
function
|
|
520
|
+
function jt({
|
|
530
521
|
bottomSheetRoot: t,
|
|
531
522
|
bottomSheetContainer: n,
|
|
532
523
|
bottomSheetHandle: e,
|
|
@@ -536,7 +527,7 @@ function Vt({
|
|
|
536
527
|
}) {
|
|
537
528
|
t.appendChild(n), e.appendChild(r), n.appendChild(e), n.appendChild(o), n.appendChild(i);
|
|
538
529
|
}
|
|
539
|
-
function
|
|
530
|
+
function Vt({
|
|
540
531
|
bottomSheetElements: t,
|
|
541
532
|
bottomSheetProps: n,
|
|
542
533
|
options: e
|
|
@@ -553,21 +544,21 @@ function Wt({
|
|
|
553
544
|
), y = new V(
|
|
554
545
|
a
|
|
555
546
|
);
|
|
556
|
-
let
|
|
547
|
+
let T = [];
|
|
557
548
|
const c = new V(
|
|
558
549
|
window
|
|
559
|
-
), C =
|
|
550
|
+
), C = Ft(
|
|
560
551
|
c,
|
|
561
552
|
o,
|
|
562
553
|
n,
|
|
563
554
|
e.draggingState
|
|
564
|
-
), w =
|
|
555
|
+
), w = Mt(
|
|
565
556
|
c,
|
|
566
557
|
o,
|
|
567
558
|
n,
|
|
568
559
|
e.draggingState,
|
|
569
560
|
b
|
|
570
|
-
), k =
|
|
561
|
+
), k = Rt(
|
|
571
562
|
c,
|
|
572
563
|
o,
|
|
573
564
|
n,
|
|
@@ -576,18 +567,18 @@ function Wt({
|
|
|
576
567
|
e.onClose,
|
|
577
568
|
e.bottomSheetState
|
|
578
569
|
);
|
|
579
|
-
function B(
|
|
580
|
-
|
|
570
|
+
function B(H) {
|
|
571
|
+
H.target instanceof Element && !r.contains(H.target) && e.onClose();
|
|
581
572
|
}
|
|
582
|
-
function O(
|
|
583
|
-
|
|
573
|
+
function O(H) {
|
|
574
|
+
xt(
|
|
584
575
|
e.draggingState,
|
|
585
|
-
|
|
576
|
+
H.target,
|
|
586
577
|
t.bottomSheetContentWrapper
|
|
587
578
|
);
|
|
588
579
|
}
|
|
589
|
-
function
|
|
590
|
-
const L =
|
|
580
|
+
function x(H) {
|
|
581
|
+
const L = H ?? n;
|
|
591
582
|
L.draggable && L.backgroundDraggable && (d.addEventListeners({
|
|
592
583
|
onStart: O,
|
|
593
584
|
onStartOptions: {
|
|
@@ -614,25 +605,25 @@ function Wt({
|
|
|
614
605
|
const F = nt(
|
|
615
606
|
t.bottomSheetContentWrapper
|
|
616
607
|
);
|
|
617
|
-
|
|
608
|
+
Dt(F);
|
|
618
609
|
}
|
|
619
610
|
});
|
|
620
611
|
}
|
|
621
|
-
function X(
|
|
622
|
-
const L =
|
|
612
|
+
function X(H) {
|
|
613
|
+
const L = H ?? n;
|
|
623
614
|
n.shouldCloseOnOutsideClick && !n.preventClosing ? s.addEventListener("click", B) : s.style.pointerEvents = "none", L.draggable && (l.addEventListeners({
|
|
624
615
|
onStart: O
|
|
625
|
-
}),
|
|
616
|
+
}), T.forEach((p) => {
|
|
626
617
|
p.removeEventListeners({
|
|
627
618
|
onStart: O
|
|
628
619
|
});
|
|
629
|
-
}),
|
|
620
|
+
}), T = n.dragTriggers.reduce((p, F) => {
|
|
630
621
|
const g = r.querySelectorAll(F);
|
|
631
622
|
if (!g.length)
|
|
632
623
|
return p;
|
|
633
624
|
const h = Array.from(g).map((f) => f instanceof HTMLElement ? new V(f) : null).filter((f) => !!f);
|
|
634
625
|
return [...p, ...h];
|
|
635
|
-
}, []),
|
|
626
|
+
}, []), T.forEach((p) => {
|
|
636
627
|
p.addEventListeners({
|
|
637
628
|
onStart: O,
|
|
638
629
|
onStartOptions: {
|
|
@@ -644,11 +635,11 @@ function Wt({
|
|
|
644
635
|
function tt() {
|
|
645
636
|
s.removeEventListener("click", B);
|
|
646
637
|
}
|
|
647
|
-
function nt(
|
|
648
|
-
let L = [...Array.from(
|
|
638
|
+
function nt(H) {
|
|
639
|
+
let L = [...Array.from(H.childNodes).reverse()];
|
|
649
640
|
for (; L.length; ) {
|
|
650
641
|
const p = L.shift();
|
|
651
|
-
if (
|
|
642
|
+
if (Yt(p))
|
|
652
643
|
return p;
|
|
653
644
|
p && (L = [
|
|
654
645
|
...L,
|
|
@@ -664,8 +655,8 @@ function Wt({
|
|
|
664
655
|
onStart: O
|
|
665
656
|
}), y.removeEventListeners({
|
|
666
657
|
onStart: O
|
|
667
|
-
}),
|
|
668
|
-
|
|
658
|
+
}), T.forEach((H) => {
|
|
659
|
+
H.removeEventListeners({
|
|
669
660
|
onStart: O
|
|
670
661
|
});
|
|
671
662
|
}), c.removeEventListeners({
|
|
@@ -675,7 +666,7 @@ function Wt({
|
|
|
675
666
|
});
|
|
676
667
|
}
|
|
677
668
|
return {
|
|
678
|
-
attachEventListeners:
|
|
669
|
+
attachEventListeners: x,
|
|
679
670
|
clearEventListeners: z,
|
|
680
671
|
attacheOnOpenEventListeners: X,
|
|
681
672
|
clearOnOpenEventListeners: tt
|
|
@@ -683,9 +674,9 @@ function Wt({
|
|
|
683
674
|
}
|
|
684
675
|
class $t {
|
|
685
676
|
constructor() {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
677
|
+
_(this, "animationId");
|
|
678
|
+
_(this, "isInProgress");
|
|
679
|
+
_(this, "startedAt");
|
|
689
680
|
this.animationId = null, this.isInProgress = !1, this.startedAt = null;
|
|
690
681
|
}
|
|
691
682
|
/**
|
|
@@ -706,7 +697,7 @@ class $t {
|
|
|
706
697
|
this.isInProgress = !1, this.startedAt = null, Y(this.animationId) && cancelAnimationFrame(this.animationId);
|
|
707
698
|
}
|
|
708
699
|
}
|
|
709
|
-
function
|
|
700
|
+
function Wt(t) {
|
|
710
701
|
const {
|
|
711
702
|
startY: n,
|
|
712
703
|
endY: e,
|
|
@@ -725,7 +716,7 @@ function Xt(t) {
|
|
|
725
716
|
}, u);
|
|
726
717
|
}
|
|
727
718
|
const st = (t, n) => (e) => {
|
|
728
|
-
|
|
719
|
+
Wt({
|
|
729
720
|
...e,
|
|
730
721
|
animationTimingFunction: t,
|
|
731
722
|
animationDuration: n
|
|
@@ -736,10 +727,10 @@ const st = (t, n) => (e) => {
|
|
|
736
727
|
CONTENT_HEIGHT: "content-height",
|
|
737
728
|
CLOSED: "closed"
|
|
738
729
|
};
|
|
739
|
-
function
|
|
730
|
+
function Xt(t) {
|
|
740
731
|
return !(!Y(t) || t > 1 || t < 0);
|
|
741
732
|
}
|
|
742
|
-
function
|
|
733
|
+
function zt(t, n) {
|
|
743
734
|
const e = {
|
|
744
735
|
set(r, o, i, a) {
|
|
745
736
|
return n(o, i), Reflect.set(r, o, i, a);
|
|
@@ -747,7 +738,7 @@ function Kt(t, n) {
|
|
|
747
738
|
};
|
|
748
739
|
return new Proxy(t, e);
|
|
749
740
|
}
|
|
750
|
-
function
|
|
741
|
+
function Kt(...t) {
|
|
751
742
|
console.error(t);
|
|
752
743
|
}
|
|
753
744
|
const P = {
|
|
@@ -757,7 +748,7 @@ const P = {
|
|
|
757
748
|
EASE_IN_OUT: "ease-in-out",
|
|
758
749
|
SPRING: "spring"
|
|
759
750
|
};
|
|
760
|
-
function
|
|
751
|
+
function qt(t) {
|
|
761
752
|
for (const n of Object.values(P))
|
|
762
753
|
if (n === t)
|
|
763
754
|
return !0;
|
|
@@ -766,7 +757,7 @@ function Jt(t) {
|
|
|
766
757
|
function Ot(t) {
|
|
767
758
|
return !!(t instanceof Object && "p1x" in t && "p1y" in t && "p2x" in t && "p2y" in t && Y(t.p1x) && Y(t.p1y) && Y(t.p2x) && Y(t.p2y));
|
|
768
759
|
}
|
|
769
|
-
function
|
|
760
|
+
function U(t, n, e, r) {
|
|
770
761
|
return function(s) {
|
|
771
762
|
return u(i(s));
|
|
772
763
|
};
|
|
@@ -788,19 +779,19 @@ function _(t, n, e, r) {
|
|
|
788
779
|
return 3 * n * s * Math.pow(1 - s, 2) + 3 * r * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
789
780
|
}
|
|
790
781
|
}
|
|
791
|
-
const bt =
|
|
792
|
-
function
|
|
782
|
+
const bt = U(0.25, 0.1, 0.25, 1), Jt = U(0.42, 0, 1, 1), kt = U(0.42, 0, 0.58, 1), Qt = U(0.4, 0.1, 0.6, 1), Zt = U(0.45, 1.5, 0.55, 1);
|
|
783
|
+
function tn(t) {
|
|
793
784
|
switch (t) {
|
|
794
785
|
case P.EASE:
|
|
795
786
|
return bt;
|
|
796
787
|
case P.EASE_IN:
|
|
797
|
-
return
|
|
788
|
+
return Jt;
|
|
798
789
|
case P.EASE_OUT:
|
|
799
790
|
return kt;
|
|
800
791
|
case P.EASE_IN_OUT:
|
|
801
|
-
return
|
|
792
|
+
return Qt;
|
|
802
793
|
case P.SPRING:
|
|
803
|
-
return
|
|
794
|
+
return Zt;
|
|
804
795
|
default:
|
|
805
796
|
return bt;
|
|
806
797
|
}
|
|
@@ -808,7 +799,7 @@ function nn(t) {
|
|
|
808
799
|
function pt(t) {
|
|
809
800
|
return typeof t == "boolean";
|
|
810
801
|
}
|
|
811
|
-
const
|
|
802
|
+
const nn = {
|
|
812
803
|
ariaLabel: "Bottom sheet",
|
|
813
804
|
content: "",
|
|
814
805
|
defaultPosition: R.CONTENT_HEIGHT,
|
|
@@ -855,9 +846,9 @@ const en = {
|
|
|
855
846
|
backdropStyle: {},
|
|
856
847
|
containerGapFillerStyle: {}
|
|
857
848
|
};
|
|
858
|
-
function
|
|
849
|
+
function en(t) {
|
|
859
850
|
const n = {
|
|
860
|
-
...
|
|
851
|
+
...nn
|
|
861
852
|
}, e = Object.entries(t).reduce(
|
|
862
853
|
(o, i) => {
|
|
863
854
|
const [a, u] = i;
|
|
@@ -873,18 +864,18 @@ function rn(t) {
|
|
|
873
864
|
function ct(t) {
|
|
874
865
|
if (Ot(t)) {
|
|
875
866
|
const { p1x: n, p1y: e, p2x: r, p2y: o } = t;
|
|
876
|
-
return
|
|
867
|
+
return U(n, e, r, o);
|
|
877
868
|
}
|
|
878
|
-
return
|
|
869
|
+
return qt(t) ? tn(t) : kt;
|
|
879
870
|
}
|
|
880
|
-
function
|
|
871
|
+
function rn(t, n, e, r) {
|
|
881
872
|
function o(i, a) {
|
|
882
873
|
switch (i) {
|
|
883
874
|
case "content":
|
|
884
|
-
|
|
875
|
+
S(a) && (t.bottomSheetContentWrapper.innerHTML = a);
|
|
885
876
|
break;
|
|
886
877
|
case "width":
|
|
887
|
-
|
|
878
|
+
S(a) && (t.bottomSheetContainer.style.width = a);
|
|
888
879
|
break;
|
|
889
880
|
case "shouldShowHandle":
|
|
890
881
|
pt(a) || q(t.bottomSheetHandle, !1);
|
|
@@ -893,57 +884,57 @@ function on(t, n, e, r) {
|
|
|
893
884
|
pt(a) || q(t.bottomSheetBackdrop, !1);
|
|
894
885
|
break;
|
|
895
886
|
case "containerBorderRadius":
|
|
896
|
-
|
|
887
|
+
S(a) && (t.bottomSheetContainer.style.borderRadius = St(a));
|
|
897
888
|
break;
|
|
898
889
|
case "containerBackgroundColor":
|
|
899
|
-
|
|
890
|
+
S(a) && (t.bottomSheetContainer.style.backgroundColor = a, t.bottomSheetContainerGapFiller.style.backgroundColor = a);
|
|
900
891
|
break;
|
|
901
892
|
case "backdropColor":
|
|
902
|
-
|
|
893
|
+
S(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
|
|
903
894
|
break;
|
|
904
895
|
case "backDropTransition":
|
|
905
|
-
|
|
896
|
+
S(a) && (t.bottomSheetBackdrop.style.transition = a);
|
|
906
897
|
break;
|
|
907
898
|
case "rootClass":
|
|
908
|
-
if (!
|
|
899
|
+
if (!S(a))
|
|
909
900
|
return;
|
|
910
|
-
|
|
901
|
+
j(
|
|
911
902
|
t.bottomSheetRoot,
|
|
912
903
|
e.rootClass,
|
|
913
904
|
a
|
|
914
905
|
);
|
|
915
906
|
break;
|
|
916
907
|
case "containerClass":
|
|
917
|
-
if (!
|
|
908
|
+
if (!S(a))
|
|
918
909
|
return;
|
|
919
|
-
|
|
910
|
+
j(
|
|
920
911
|
t.bottomSheetContainer,
|
|
921
912
|
e.containerClass,
|
|
922
913
|
a
|
|
923
914
|
);
|
|
924
915
|
break;
|
|
925
916
|
case "handleClass":
|
|
926
|
-
if (!
|
|
917
|
+
if (!S(a))
|
|
927
918
|
return;
|
|
928
|
-
|
|
919
|
+
j(
|
|
929
920
|
t.bottomSheetHandle,
|
|
930
921
|
e.handleClass,
|
|
931
922
|
a
|
|
932
923
|
);
|
|
933
924
|
break;
|
|
934
925
|
case "contentWrapperClass":
|
|
935
|
-
if (!
|
|
926
|
+
if (!S(a))
|
|
936
927
|
return;
|
|
937
|
-
|
|
928
|
+
j(
|
|
938
929
|
t.bottomSheetContentWrapper,
|
|
939
930
|
e.contentWrapperClass,
|
|
940
931
|
a
|
|
941
932
|
);
|
|
942
933
|
break;
|
|
943
934
|
case "backdropClass":
|
|
944
|
-
if (!
|
|
935
|
+
if (!S(a))
|
|
945
936
|
return;
|
|
946
|
-
|
|
937
|
+
j(
|
|
947
938
|
t.bottomSheetBackdrop,
|
|
948
939
|
e.backdropClass,
|
|
949
940
|
a
|
|
@@ -1021,8 +1012,8 @@ function on(t, n, e, r) {
|
|
|
1021
1012
|
}
|
|
1022
1013
|
return o;
|
|
1023
1014
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const n =
|
|
1015
|
+
function an(t) {
|
|
1016
|
+
const n = en(t), e = ct(
|
|
1026
1017
|
t.draggingAnimationTimings
|
|
1027
1018
|
), o = {
|
|
1028
1019
|
isMounted: !1,
|
|
@@ -1051,20 +1042,20 @@ function cn(t) {
|
|
|
1051
1042
|
snapTo: F,
|
|
1052
1043
|
moveUp: L,
|
|
1053
1044
|
moveDown: p
|
|
1054
|
-
}, { elements: b, eventHandlers: l } =
|
|
1045
|
+
}, { elements: b, eventHandlers: l } = Ut(
|
|
1055
1046
|
n,
|
|
1056
1047
|
s
|
|
1057
|
-
), d =
|
|
1048
|
+
), d = zt(
|
|
1058
1049
|
n,
|
|
1059
|
-
|
|
1050
|
+
rn(
|
|
1060
1051
|
b,
|
|
1061
1052
|
o,
|
|
1062
1053
|
n,
|
|
1063
1054
|
l
|
|
1064
1055
|
)
|
|
1065
|
-
), { bottomSheetBackdrop: y, bottomSheetRoot:
|
|
1056
|
+
), { bottomSheetBackdrop: y, bottomSheetRoot: T, bottomSheetContainer: c } = b, C = (g) => {
|
|
1066
1057
|
const h = g ?? window.document.body;
|
|
1067
|
-
h.appendChild(
|
|
1058
|
+
h.appendChild(T), h.appendChild(y);
|
|
1068
1059
|
const f = window.innerHeight;
|
|
1069
1060
|
Q(c, {
|
|
1070
1061
|
y: f
|
|
@@ -1075,11 +1066,11 @@ function cn(t) {
|
|
|
1075
1066
|
}), a(), o.isMounted = !1;
|
|
1076
1067
|
}, k = () => {
|
|
1077
1068
|
var D;
|
|
1078
|
-
if (O() ||
|
|
1069
|
+
if (O() || Kt(
|
|
1079
1070
|
'Bottom Sheet is not mounted yet. call the "mount" method first.'
|
|
1080
|
-
), (D = t.beforeOpen) == null || D.call(t),
|
|
1071
|
+
), (D = t.beforeOpen) == null || D.call(t), x())
|
|
1081
1072
|
return;
|
|
1082
|
-
et(y, !0), d.shouldShowBackdrop ||
|
|
1073
|
+
et(y, !0), d.shouldShowBackdrop || W(y, "transparent"), et([c], !0), Q(c, {
|
|
1083
1074
|
y: c.clientHeight
|
|
1084
1075
|
});
|
|
1085
1076
|
const h = window.innerHeight, f = dt(
|
|
@@ -1095,8 +1086,8 @@ function cn(t) {
|
|
|
1095
1086
|
bottomSheetContainer: c,
|
|
1096
1087
|
onEnd: t.afterOpen
|
|
1097
1088
|
});
|
|
1098
|
-
const
|
|
1099
|
-
i.originalDocumentOverflowY =
|
|
1089
|
+
const E = document.body.style.overflowY;
|
|
1090
|
+
i.originalDocumentOverflowY = E || "initial";
|
|
1100
1091
|
const A = document.body.style.overscrollBehavior;
|
|
1101
1092
|
i.originalDocumentOverscrollBehavior = A || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", b.bottomSheetHandle.focus(), l.attacheOnOpenEventListeners();
|
|
1102
1093
|
};
|
|
@@ -1120,12 +1111,12 @@ function cn(t) {
|
|
|
1120
1111
|
function O() {
|
|
1121
1112
|
return o.isMounted;
|
|
1122
1113
|
}
|
|
1123
|
-
function
|
|
1114
|
+
function x() {
|
|
1124
1115
|
const g = I(c).y, h = window.innerHeight, f = c.clientHeight >= h ? h : c.clientHeight;
|
|
1125
1116
|
return g <= f;
|
|
1126
1117
|
}
|
|
1127
1118
|
function X() {
|
|
1128
|
-
return !
|
|
1119
|
+
return !x();
|
|
1129
1120
|
}
|
|
1130
1121
|
function tt() {
|
|
1131
1122
|
const g = I(c).y, h = c.clientHeight, f = window.innerHeight;
|
|
@@ -1134,16 +1125,16 @@ function cn(t) {
|
|
|
1134
1125
|
const m = h - g;
|
|
1135
1126
|
if (m === f / 2)
|
|
1136
1127
|
return R.MIDDLE;
|
|
1137
|
-
const
|
|
1138
|
-
return m <=
|
|
1128
|
+
const E = f - d.marginTop, A = 10;
|
|
1129
|
+
return m <= E + A && m >= E - A ? R.TOP : R.CLOSED;
|
|
1139
1130
|
}
|
|
1140
1131
|
function nt() {
|
|
1141
1132
|
return c.clientHeight;
|
|
1142
1133
|
}
|
|
1143
1134
|
function z(g) {
|
|
1144
|
-
if (!
|
|
1135
|
+
if (!x())
|
|
1145
1136
|
return;
|
|
1146
|
-
const h = I(c).y, m = c.clientHeight - h,
|
|
1137
|
+
const h = I(c).y, m = c.clientHeight - h, E = window.innerHeight - g, A = It(m, E), D = $(m, E);
|
|
1147
1138
|
o.translateContainer({
|
|
1148
1139
|
startY: h,
|
|
1149
1140
|
endY: h + (A.isUp ? -D : D),
|
|
@@ -1151,13 +1142,13 @@ function cn(t) {
|
|
|
1151
1142
|
bottomSheetContainer: c
|
|
1152
1143
|
});
|
|
1153
1144
|
}
|
|
1154
|
-
function
|
|
1145
|
+
function H(g, {
|
|
1155
1146
|
viewportHeight: h,
|
|
1156
1147
|
visibleHeight: f
|
|
1157
1148
|
}) {
|
|
1158
1149
|
let m = null;
|
|
1159
|
-
for (const
|
|
1160
|
-
const A =
|
|
1150
|
+
for (const E of g) {
|
|
1151
|
+
const A = E * h, D = $(
|
|
1161
1152
|
f,
|
|
1162
1153
|
A
|
|
1163
1154
|
);
|
|
@@ -1171,19 +1162,19 @@ function cn(t) {
|
|
|
1171
1162
|
const g = [...d.snapPoints].reverse(), h = I(c).y, f = c.clientHeight, m = f - h;
|
|
1172
1163
|
if (!d.expandable && m >= f)
|
|
1173
1164
|
return;
|
|
1174
|
-
const
|
|
1165
|
+
const E = window.innerHeight, A = ft(
|
|
1175
1166
|
"above",
|
|
1176
|
-
{ visibleHeight: m, viewportHeight:
|
|
1167
|
+
{ visibleHeight: m, viewportHeight: E },
|
|
1177
1168
|
g
|
|
1178
|
-
), { minOffset: D } =
|
|
1169
|
+
), { minOffset: D } = H(A, {
|
|
1179
1170
|
visibleHeight: m,
|
|
1180
|
-
viewportHeight:
|
|
1171
|
+
viewportHeight: E
|
|
1181
1172
|
});
|
|
1182
|
-
if (D === null && m <
|
|
1173
|
+
if (D === null && m < E - d.marginTop) {
|
|
1183
1174
|
o.translateContainer({
|
|
1184
1175
|
startY: h,
|
|
1185
1176
|
endY: dt(
|
|
1186
|
-
|
|
1177
|
+
E,
|
|
1187
1178
|
f,
|
|
1188
1179
|
d.marginTop,
|
|
1189
1180
|
"top"
|
|
@@ -1204,11 +1195,11 @@ function cn(t) {
|
|
|
1204
1195
|
const g = I(c).y, f = c.clientHeight - g;
|
|
1205
1196
|
if (f < 1)
|
|
1206
1197
|
return;
|
|
1207
|
-
const m = window.innerHeight,
|
|
1198
|
+
const m = window.innerHeight, E = ft(
|
|
1208
1199
|
"below",
|
|
1209
1200
|
{ visibleHeight: f, viewportHeight: m },
|
|
1210
1201
|
d.snapPoints
|
|
1211
|
-
), { minOffset: A } =
|
|
1202
|
+
), { minOffset: A } = H(E, {
|
|
1212
1203
|
visibleHeight: f,
|
|
1213
1204
|
viewportHeight: m
|
|
1214
1205
|
});
|
|
@@ -1221,7 +1212,7 @@ function cn(t) {
|
|
|
1221
1212
|
}
|
|
1222
1213
|
function F(g) {
|
|
1223
1214
|
const h = window.innerHeight;
|
|
1224
|
-
if (!
|
|
1215
|
+
if (!Xt(g))
|
|
1225
1216
|
return;
|
|
1226
1217
|
const f = J(h * g, 2);
|
|
1227
1218
|
z(f);
|
|
@@ -1234,7 +1225,7 @@ function cn(t) {
|
|
|
1234
1225
|
open: k,
|
|
1235
1226
|
close: B,
|
|
1236
1227
|
getIsMounted: O,
|
|
1237
|
-
getIsOpen:
|
|
1228
|
+
getIsOpen: x,
|
|
1238
1229
|
getIsClosed: X,
|
|
1239
1230
|
getPosition: tt,
|
|
1240
1231
|
getHeight: nt,
|
|
@@ -1242,7 +1233,7 @@ function cn(t) {
|
|
|
1242
1233
|
snapTo: F
|
|
1243
1234
|
};
|
|
1244
1235
|
}
|
|
1245
|
-
function
|
|
1236
|
+
function sn() {
|
|
1246
1237
|
return {
|
|
1247
1238
|
elements: {
|
|
1248
1239
|
bottomSheetRoot: void 0,
|
|
@@ -1276,17 +1267,7 @@ function ln() {
|
|
|
1276
1267
|
};
|
|
1277
1268
|
}
|
|
1278
1269
|
export {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
sn as
|
|
1282
|
-
P as COMMON_ANIMATION_KEYS,
|
|
1283
|
-
T as ClassNames,
|
|
1284
|
-
G as EventPhase,
|
|
1285
|
-
ot as ResetClassNames,
|
|
1286
|
-
K as UtilClassNames,
|
|
1287
|
-
cn as createBottomSheet,
|
|
1288
|
-
ln as createPlaceholderBottomSheet,
|
|
1289
|
-
mt as eventPhaseToEnum,
|
|
1290
|
-
Ot as isAnimationTimingPoints,
|
|
1291
|
-
Jt as isCommonAnimationTimingsKey
|
|
1270
|
+
v as ClassNames,
|
|
1271
|
+
an as createBottomSheet,
|
|
1272
|
+
sn as createPlaceholderBottomSheet
|
|
1292
1273
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
(function(
|
|
3
|
-
/*$vite$:1*/`,document.head.appendChild(H);function y(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(q(n))}function $(t,n){t.classList.add(q(n))}function rt(t,n){t.classList.remove(q(n))}function V(t,n,e){y(e)&&(y(n)&&rt(t,n),$(t,e))}function q(t){return y(t)?t.trim().replace(/\./g,""):""}function R(t){return t.map(n=>q(n)).filter(Boolean).join(" ")}function xt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const gt="open",ht="hidden";function ot(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{J(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}J(t,e),t.setAttribute("aria-modal",e?"true":"false")}function J(t,n){n?($(t,gt),rt(t,ht)):($(t,ht),rt(t,gt))}function bt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){bt(t)&&t.focus()}function Nt(t){if(!bt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var C=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(C||{}),Q=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(Q||{}),W=(t=>(t.Hidden="hidden",t))(W||{});function M(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{$(r,i)}),y(e)&&r.setAttribute("data-testid",e),r}const Mt={CONTENTS_WRAPPER:xt([C.Root,C.ContentWrapper])};function mt(t,n,e,r){switch(r){case"content-height":return n>=t?Ct(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function pt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function yt(t,n){return n<t?-(t-n):n-t}function z(t,n){return t>n?t-n:n-t}function Pt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function Tt(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function Ct(t,n,e){return-(t-n)+e}function Et(t){return Number(t.replace("px",""))}function Z(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Ft(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function wt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function N(t){const n=t.style.transform,e=vt(n),r=wt(e,it);return St(r??{type:it,values:[]})}function tt(t,{x:n,y:e}){const{transform:r,transformValues:o}=Ft(t),i=wt(o,it);if(i){const a=St(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function St(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:Et(n)??0,y:Et(e)??0}}function at(t){return t!=null}function Ot(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const _t=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,C.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Rt=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=N(n),e.onDragStart()},jt=(t,n,e,r,o)=>i=>{Gt(i,t,e,r,o,n,e.marginTop)};function Gt(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const d=n.getCoordinates(t).y,s=yt(r.startY,d),p=window.innerHeight,l=i.clientHeight,u=l-(r.containerStartTranslate.y+s);if(u>=p)return;const E=pt(r.startY,d);if(E.isUp&&!e.expandable&&u>=l||e.preventClosing&&u<=l)return;o.start(()=>{tt(i,{y:r.containerStartTranslate.y+s})},0);const w=p-a,c=l-r.containerStartTranslate.y;if(E.isUp){const v=w-c,O=w-u,A=Ot(1-Z(O/v,2),{min:0,max:1});e.onDragMove(E,A)}else if(E.isDown){const v=Ot(Z(1-u/c,2),{min:0,max:1});e.onDragMove(E,v)}}const Ut=(t,n,e,r,o,i,a)=>d=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,p=t.getCoordinates(d).y,l=N(n).y,u=pt(s,p),E=window.innerHeight,w=n.clientHeight;if(u.isUp){if(!e.expandable)return;const c=[...e.snapPoints].sort((A,x)=>A-x),v=w+-l;for(const A of c){const x=A*window.innerHeight;if(v<=x){const L=z(v,x);a.translateContainer({startY:l,endY:l-L,animationFrame:o,bottomSheetContainer:n});return}}const O=Ct(E,w,e.marginTop);a.translateContainer({startY:l,endY:O,animationFrame:o,bottomSheetContainer:n})}else if(u.isDown){const c=[...e.snapPoints].sort((v,O)=>O-v);for(const v of c){const O=v*window.innerHeight,A=w+-l;if(A>=O){const x=z(A,O);a.translateContainer({startY:l,endY:l+x,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const v=w+-l;if(v>=w){const O=z(v,w);a.translateContainer({startY:l,endY:l+O,animationFrame:o,bottomSheetContainer:n})}return}i()}};var P=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(P||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:P.All};class X{constructor(n){K(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=$t,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===P.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===P.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function kt(t){const n=t;return`${n} ${n} 0px 0px`}function Vt(t,n){const e=Wt(t);zt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Xt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Wt(t){const n=M("dialog",R([C.Root,Q.Dialog,t.rootClass]),C.Root);n.ariaLabel=t.ariaLabel;const e=M("section",R([C.Container,t.containerClass]),C.Container);t.containerBorderRadius&&(e.style.borderRadius=kt(t.containerBorderRadius));const r=M("div",C.GapFiller,C.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=M("button",R([C.Handle,Q.Button,t.shouldShowHandle?null:W.Hidden,t.handleClass]),C.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=M("span",R([C.HandleBar,t.shouldShowHandle?null:W.Hidden]),C.HandleBar),a=M("article",R([C.ContentWrapper,t.contentWrapperClass]),C.ContentWrapper),d=M("div",R([C.Backdrop,t.backdropClass,W.Hidden]),C.Backdrop);return t.backdropColor&&(d.style.backgroundColor=t.backdropColor),t.backDropTransition&&(d.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:d,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function zt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Xt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:d,bottomSheetBackdrop:s}=t,{animationFrame:p}=e,l=new X(i),u=new X(d),E=new X(a);let w=[];const c=new X(window),v=Rt(c,o,n,e.draggingState),O=jt(c,o,n,e.draggingState,p),A=Ut(c,o,n,e.draggingState,p,e.onClose,e.bottomSheetState);function x(k){k.target instanceof Element&&!r.contains(k.target)&&e.onClose()}function L(k){_t(e.draggingState,k.target,t.bottomSheetContentWrapper)}function G(k){const B=k??n;B.draggable&&B.backgroundDraggable&&(u.addEventListeners({onStart:L,onStartOptions:{eventPhase:P.Target}}),E.addEventListeners({onStart:L})),B.draggable&&c.addEventListeners({onStart:v,onMove:O,onEnd:A}),B.draggable&&window.document.addEventListener("keyup",T=>{T.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",T=>{if(T.key==="ArrowUp"){e.moveUp();return}if(T.key==="ArrowDown"){e.moveDown();return}if(T.shiftKey&&T.key==="Tab"){const U=ft(t.bottomSheetContentWrapper);It(U)}})}function nt(k){const B=k??n;n.shouldCloseOnOutsideClick&&!n.preventClosing?s.addEventListener("click",x):s.style.pointerEvents="none",B.draggable&&(l.addEventListeners({onStart:L}),w.forEach(T=>{T.removeEventListeners({onStart:L})}),w=n.dragTriggers.reduce((T,U)=>{const g=r.querySelectorAll(U);if(!g.length)return T;const h=Array.from(g).map(f=>f instanceof HTMLElement?new X(f):null).filter(f=>!!f);return[...T,...h]},[]),w.forEach(T=>{T.addEventListeners({onStart:L,onStartOptions:{eventPhase:P.Target}})}))}function ut(){s.removeEventListener("click",x)}function ft(k){let B=[...Array.from(k.childNodes).reverse()];for(;B.length;){const T=B.shift();if(Nt(T))return T;T&&(B=[...B,...Array.from(T.childNodes).reverse()])}return null}function et(){l.removeEventListeners({onStart:L}),u.removeEventListeners({onStart:L}),E.removeEventListeners({onStart:L}),w.forEach(k=>{k.removeEventListeners({onStart:L})}),c.removeEventListeners({onStart:v,onMove:O,onEnd:A})}return{attachEventListeners:G,clearEventListeners:et,attacheOnOpenEventListeners:nt,clearOnOpenEventListeners:ut}}class Kt{constructor(){K(this,"animationId");K(this,"isInProgress");K(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Z(a/e,2),p=s>=1&&!r;n(s),p?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:d}=t,s=yt(n,e);o.stop();let p=!1;o.start(l=>{tt(r,{y:n+s*a(l)}),!p&&l>=1&&(i==null||i(),p=!0)},d)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},F={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const _={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Ht(t){for(const n of Object.values(_))if(n===t)return!0;return!1}function lt(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function j(t,n,e,r){return function(s){return d(i(s))};function i(s){let p=0,l=1,u=s,E;if(s===0||s===1)return s;for(;p<l;){if(E=a(u),Math.abs(E-s)<.001)return u;s>E?p=u:l=u,u=(l+p)/2}return u}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function d(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const Lt=j(.25,.1,.25,1),tn=j(.42,0,1,1),At=j(.42,0,.58,1),nn=j(.4,.1,.6,1),en=j(.45,1.5,.55,1);function rn(t){switch(t){case _.EASE:return Lt;case _.EASE_IN:return tn;case _.EASE_OUT:return At;case _.EASE_IN_OUT:return nn;case _.SPRING:return en;default:return Lt}}function Bt(t){return typeof t=="boolean"}const Dt={ariaLabel:"Bottom sheet",content:"",defaultPosition:F.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function on(t){const n={...Dt},e=Object.entries(t).reduce((o,i)=>{const[a,d]=i;return at(d)&&(o[a]=d),o},{});return{...n,...e}}function dt(t){if(lt(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return Ht(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":y(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":y(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Bt(a)||J(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Bt(a)||J(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":y(a)&&(t.bottomSheetContainer.style.borderRadius=kt(a));break;case"containerBackgroundColor":y(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":y(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":y(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!y(a))return;V(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!y(a))return;V(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!y(a))return;V(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!y(a))return;V(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!y(a))return;V(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"dragTriggers":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(lt(a)){const d=dt(a),s=ct(d,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const d=dt(e.draggingAnimationTimings),s=ct(d,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=dt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const d=new Kt,s={animationFrame:d,onClose:x,bottomSheetState:o,draggingState:i,snapTo:U,moveUp:B,moveDown:T},{elements:p,eventHandlers:l}=Vt(n,s),u=Qt(n,an(p,o,n,l)),{bottomSheetBackdrop:E,bottomSheetRoot:w,bottomSheetContainer:c}=p,v=g=>{const h=g??window.document.body;h.appendChild(w),h.appendChild(E);const f=window.innerHeight;tt(c,{y:f}),l.attachEventListeners(),o.isMounted=!0},O=()=>{l.clearEventListeners(),Object.values(p).forEach(g=>{g.remove()}),a(),o.isMounted=!1},A=()=>{var I;if(L()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(I=t.beforeOpen)==null||I.call(t),G())return;ot(E,!0),u.shouldShowBackdrop||$(E,"transparent"),ot([c],!0),tt(c,{y:c.clientHeight});const h=window.innerHeight,f=mt(h,c.clientHeight,u.marginTop,u.defaultPosition),m=N(c).y;o.translateContainer({startY:m,endY:f,animationFrame:d,bottomSheetContainer:c,onEnd:t.afterOpen});const S=document.body.style.overflowY;i.originalDocumentOverflowY=S||"initial";const D=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",p.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function x(){var f;if(nt())return;(f=t.beforeClose)==null||f.call(t);const g=N(c).y,h=c.clientHeight;o.translateContainer({startY:g,endY:h,animationFrame:d,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),ot([E,c],!1),l.clearOnOpenEventListeners()}}),a()}function L(){return o.isMounted}function G(){const g=N(c).y,h=window.innerHeight,f=c.clientHeight>=h?h:c.clientHeight;return g<=f}function nt(){return!G()}function ut(){const g=N(c).y,h=c.clientHeight,f=window.innerHeight;if(g<=5&&g>=-5)return F.CONTENT_HEIGHT;const m=h-g;if(m===f/2)return F.MIDDLE;const S=f-u.marginTop,D=10;return m<=S+D&&m>=S-D?F.TOP:F.CLOSED}function ft(){return c.clientHeight}function et(g){if(!G())return;const h=N(c).y,m=c.clientHeight-h,S=window.innerHeight-g,D=Pt(m,S),I=z(m,S);o.translateContainer({startY:h,endY:h+(D.isUp?-I:I),animationFrame:d,bottomSheetContainer:c})}function k(g,{viewportHeight:h,visibleHeight:f}){let m=null;for(const S of g){const D=S*h,I=z(f,D);(m===null||I<m)&&(m=I)}return{minOffset:m}}function B(){const g=[...u.snapPoints].reverse(),h=N(c).y,f=c.clientHeight,m=f-h;if(!u.expandable&&m>=f)return;const S=window.innerHeight,D=Tt("above",{visibleHeight:m,viewportHeight:S},g),{minOffset:I}=k(D,{visibleHeight:m,viewportHeight:S});if(I===null&&m<S-u.marginTop){o.translateContainer({startY:h,endY:mt(S,f,u.marginTop,"top"),animationFrame:d,bottomSheetContainer:c});return}Y(I)&&o.translateContainer({startY:h,endY:h-I,animationFrame:d,bottomSheetContainer:c})}function T(){const g=N(c).y,f=c.clientHeight-g;if(f<1)return;const m=window.innerHeight,S=Tt("below",{visibleHeight:f,viewportHeight:m},u.snapPoints),{minOffset:D}=k(S,{visibleHeight:f,viewportHeight:m});Y(D)&&o.translateContainer({startY:g,endY:g+D,animationFrame:d,bottomSheetContainer:c})}function U(g){const h=window.innerHeight;if(!Jt(g))return;const f=Z(h*g,2);et(f)}return{props:u,elements:p,mount:v,unmount:O,open:A,close:x,getIsMounted:L,getIsOpen:G,getIsClosed:nt,getPosition:ut,getHeight:ft,moveTo:et,snapTo:U}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>F.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}b.BOTTOM_SHEET_DEFAULT_PROPS=Dt,b.BOTTOM_SHEET_POSITION=F,b.BOTTOM_SHEET_SELECTORS=Mt,b.COMMON_ANIMATION_KEYS=_,b.ClassNames=C,b.EventPhase=P,b.ResetClassNames=Q,b.UtilClassNames=W,b.createBottomSheet=sn,b.createPlaceholderBottomSheet=cn,b.eventPhaseToEnum=st,b.isAnimationTimingPoints=lt,b.isCommonAnimationTimingsKey=Ht,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
+
(function(H,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(H=typeof globalThis<"u"?globalThis:H||self,O(H.BottomSheet={}))})(this,function(H){"use strict";var sn=Object.defineProperty;var cn=(H,O,m)=>O in H?sn(H,O,{enumerable:!0,configurable:!0,writable:!0,value:m}):H[O]=m;var X=(H,O,m)=>cn(H,typeof O!="symbol"?O+"":O,m);var O=document.createElement("style");O.textContent=`.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}
|
|
3
|
+
/*$vite$:1*/`,document.head.appendChild(O);function m(t){return typeof t=="string"}function Bt(t,n){return t.classList.contains(K(n))}function $(t,n){t.classList.add(K(n))}function et(t,n){t.classList.remove(K(n))}function V(t,n,e){m(e)&&(m(n)&&et(t,n),$(t,e))}function K(t){return m(t)?t.trim().replace(/\./g,""):""}function M(t){return t.map(n=>K(n)).filter(Boolean).join(" ")}const ut="open",ft="hidden";function rt(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?($(t,ut),et(t,ft)):($(t,ft),et(t,ut))}function gt(t){return t instanceof HTMLElement}function D(t){return typeof t=="number"&&!Number.isNaN(t)}function xt(t){gt(t)&&t.focus()}function Dt(t){if(!gt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=D(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var T=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(T||{}),ot=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(ot||{}),J=(t=>(t.Hidden="hidden",t))(J||{});function F(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{$(r,i)}),m(e)&&r.setAttribute("data-testid",e),r}function ht(t,n,e,r){switch(r){case"content-height":return n>=t?yt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function bt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function pt(t,n){return n<t?-(t-n):n-t}function W(t,n){return t>n?t-n:n-t}function Yt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function mt(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function yt(t,n,e){return-(t-n)+e}function Ct(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function It(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function Tt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function N(t){const n=t.style.transform,e=vt(n),r=Tt(e,it);return Et(r??{type:it,values:[]})}function Z(t,{x:n,y:e}){const{transform:r,transformValues:o}=It(t),i=Tt(o,it);if(i){const a=Et(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function Et(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:Ct(n)??0,y:Ct(e)??0}}function at(t){return t!=null}function wt(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Nt=(t,n,e)=>{n instanceof HTMLElement&&!Bt(n,T.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=N(n),e.onDragStart()},Mt=(t,n,e,r,o)=>i=>{Pt(i,t,e,r,o,n,e.marginTop)};function Pt(t,n,e,r,o,i,a){if(!r.isDragging||!D(r.startY))return;const d=n.getCoordinates(t).y,s=pt(r.startY,d),p=window.innerHeight,l=i.clientHeight,u=l-(r.containerStartTranslate.y+s);if(u>=p)return;const C=bt(r.startY,d);if(C.isUp&&!e.expandable&&u>=l||e.preventClosing&&u<=l)return;o.start(()=>{Z(i,{y:r.containerStartTranslate.y+s})},0);const E=p-a,c=l-r.containerStartTranslate.y;if(C.isUp){const v=E-c,k=E-u,A=wt(1-Q(k/v,2),{min:0,max:1});e.onDragMove(C,A)}else if(C.isDown){const v=wt(Q(1-u/c,2),{min:0,max:1});e.onDragMove(C,v)}}const Rt=(t,n,e,r,o,i,a)=>d=>{if(!r.isDragging||(r.isDragging=!1,!D(r.startY)))return;e.onDragEnd();const s=r.startY,p=t.getCoordinates(d).y,l=N(n).y,u=bt(s,p),C=window.innerHeight,E=n.clientHeight;if(u.isUp){if(!e.expandable)return;const c=[...e.snapPoints].sort((A,Y)=>A-Y),v=E+-l;for(const A of c){const Y=A*window.innerHeight;if(v<=Y){const L=W(v,Y);a.translateContainer({startY:l,endY:l-L,animationFrame:o,bottomSheetContainer:n});return}}const k=yt(C,E,e.marginTop);a.translateContainer({startY:l,endY:k,animationFrame:o,bottomSheetContainer:n})}else if(u.isDown){const c=[...e.snapPoints].sort((v,k)=>k-v);for(const v of c){const k=v*window.innerHeight,A=E+-l;if(A>=k){const Y=W(A,k);a.translateContainer({startY:l,endY:l+Y,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const v=E+-l;if(v>=E){const k=W(v,E);a.translateContainer({startY:l,endY:l+k,animationFrame:o,bottomSheetContainer:n})}return}i()}};var P=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(P||{});function kt(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const _t={eventPhase:P.All};class z{constructor(n){X(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=_t,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===P.All){n(i);return}kt(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===P.All){n(i);return}kt(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function St(t){const n=t;return`${n} ${n} 0px 0px`}function jt(t,n){const e=Gt(t);Ut(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=$t({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Gt(t){const n=F("dialog",M([T.Root,ot.Dialog,t.rootClass]),T.Root);n.ariaLabel=t.ariaLabel;const e=F("section",M([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(e.style.borderRadius=St(t.containerBorderRadius));const r=F("div",T.GapFiller,T.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=F("button",M([T.Handle,ot.Button,t.shouldShowHandle?null:J.Hidden,t.handleClass]),T.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=F("span",M([T.HandleBar,t.shouldShowHandle?null:J.Hidden]),T.HandleBar),a=F("article",M([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),d=F("div",M([T.Backdrop,t.backdropClass,J.Hidden]),T.Backdrop);return t.backdropColor&&(d.style.backgroundColor=t.backdropColor),t.backDropTransition&&(d.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:d,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function Ut({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function $t({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:d,bottomSheetBackdrop:s}=t,{animationFrame:p}=e,l=new z(i),u=new z(d),C=new z(a);let E=[];const c=new z(window),v=Ft(c,o,n,e.draggingState),k=Mt(c,o,n,e.draggingState,p),A=Rt(c,o,n,e.draggingState,p,e.onClose,e.bottomSheetState);function Y(S){S.target instanceof Element&&!r.contains(S.target)&&e.onClose()}function L(S){Nt(e.draggingState,S.target,t.bottomSheetContentWrapper)}function G(S){const B=S??n;B.draggable&&B.backgroundDraggable&&(u.addEventListeners({onStart:L,onStartOptions:{eventPhase:P.Target}}),C.addEventListeners({onStart:L})),B.draggable&&c.addEventListeners({onStart:v,onMove:k,onEnd:A}),B.draggable&&window.document.addEventListener("keyup",y=>{y.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",y=>{if(y.key==="ArrowUp"){e.moveUp();return}if(y.key==="ArrowDown"){e.moveDown();return}if(y.shiftKey&&y.key==="Tab"){const U=dt(t.bottomSheetContentWrapper);xt(U)}})}function tt(S){const B=S??n;n.shouldCloseOnOutsideClick&&!n.preventClosing?s.addEventListener("click",Y):s.style.pointerEvents="none",B.draggable&&(l.addEventListeners({onStart:L}),E.forEach(y=>{y.removeEventListeners({onStart:L})}),E=n.dragTriggers.reduce((y,U)=>{const g=r.querySelectorAll(U);if(!g.length)return y;const h=Array.from(g).map(f=>f instanceof HTMLElement?new z(f):null).filter(f=>!!f);return[...y,...h]},[]),E.forEach(y=>{y.addEventListeners({onStart:L,onStartOptions:{eventPhase:P.Target}})}))}function lt(){s.removeEventListener("click",Y)}function dt(S){let B=[...Array.from(S.childNodes).reverse()];for(;B.length;){const y=B.shift();if(Dt(y))return y;y&&(B=[...B,...Array.from(y.childNodes).reverse()])}return null}function nt(){l.removeEventListeners({onStart:L}),u.removeEventListeners({onStart:L}),C.removeEventListeners({onStart:L}),E.forEach(S=>{S.removeEventListeners({onStart:L})}),c.removeEventListeners({onStart:v,onMove:k,onEnd:A})}return{attachEventListeners:G,clearEventListeners:nt,attacheOnOpenEventListeners:tt,clearOnOpenEventListeners:lt}}class Vt{constructor(){X(this,"animationId");X(this,"isInProgress");X(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Q(a/e,2),p=s>=1&&!r;n(s),p?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,D(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Wt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:d}=t,s=pt(n,e);o.stop();let p=!1;o.start(l=>{Z(r,{y:n+s*a(l)}),!p&&l>=1&&(i==null||i(),p=!0)},d)}const st=(t,n)=>e=>{Wt({...e,animationTimingFunction:t,animationDuration:n})},R={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function zt(t){return!(!D(t)||t>1||t<0)}function Xt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Kt(...t){console.error(t)}const _={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function qt(t){for(const n of Object.values(_))if(n===t)return!0;return!1}function Ht(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&D(t.p1x)&&D(t.p1y)&&D(t.p2x)&&D(t.p2y))}function j(t,n,e,r){return function(s){return d(i(s))};function i(s){let p=0,l=1,u=s,C;if(s===0||s===1)return s;for(;p<l;){if(C=a(u),Math.abs(C-s)<.001)return u;s>C?p=u:l=u,u=(l+p)/2}return u}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function d(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const Ot=j(.25,.1,.25,1),Jt=j(.42,0,1,1),Lt=j(.42,0,.58,1),Qt=j(.4,.1,.6,1),Zt=j(.45,1.5,.55,1);function tn(t){switch(t){case _.EASE:return Ot;case _.EASE_IN:return Jt;case _.EASE_OUT:return Lt;case _.EASE_IN_OUT:return Qt;case _.SPRING:return Zt;default:return Ot}}function At(t){return typeof t=="boolean"}const nn={ariaLabel:"Bottom sheet",content:"",defaultPosition:R.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function en(t){const n={...nn},e=Object.entries(t).reduce((o,i)=>{const[a,d]=i;return at(d)&&(o[a]=d),o},{});return{...n,...e}}function ct(t){if(Ht(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return qt(t)?tn(t):Lt}function rn(t,n,e,r){function o(i,a){switch(i){case"content":m(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":m(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":At(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":At(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":m(a)&&(t.bottomSheetContainer.style.borderRadius=St(a));break;case"containerBackgroundColor":m(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":m(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":m(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!m(a))return;V(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!m(a))return;V(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!m(a))return;V(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!m(a))return;V(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!m(a))return;V(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"dragTriggers":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(Ht(a)){const d=ct(a),s=st(d,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(D(a)){const d=ct(e.draggingAnimationTimings),s=st(d,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function on(t){const n=en(t),e=ct(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:st(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const d=new Vt,s={animationFrame:d,onClose:Y,bottomSheetState:o,draggingState:i,snapTo:U,moveUp:B,moveDown:y},{elements:p,eventHandlers:l}=jt(n,s),u=Xt(n,rn(p,o,n,l)),{bottomSheetBackdrop:C,bottomSheetRoot:E,bottomSheetContainer:c}=p,v=g=>{const h=g??window.document.body;h.appendChild(E),h.appendChild(C);const f=window.innerHeight;Z(c,{y:f}),l.attachEventListeners(),o.isMounted=!0},k=()=>{l.clearEventListeners(),Object.values(p).forEach(g=>{g.remove()}),a(),o.isMounted=!1},A=()=>{var I;if(L()||Kt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(I=t.beforeOpen)==null||I.call(t),G())return;rt(C,!0),u.shouldShowBackdrop||$(C,"transparent"),rt([c],!0),Z(c,{y:c.clientHeight});const h=window.innerHeight,f=ht(h,c.clientHeight,u.marginTop,u.defaultPosition),b=N(c).y;o.translateContainer({startY:b,endY:f,animationFrame:d,bottomSheetContainer:c,onEnd:t.afterOpen});const w=document.body.style.overflowY;i.originalDocumentOverflowY=w||"initial";const x=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=x||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",p.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function Y(){var f;if(tt())return;(f=t.beforeClose)==null||f.call(t);const g=N(c).y,h=c.clientHeight;o.translateContainer({startY:g,endY:h,animationFrame:d,bottomSheetContainer:c,onEnd:()=>{var b;(b=t.afterClose)==null||b.call(t),rt([C,c],!1),l.clearOnOpenEventListeners()}}),a()}function L(){return o.isMounted}function G(){const g=N(c).y,h=window.innerHeight,f=c.clientHeight>=h?h:c.clientHeight;return g<=f}function tt(){return!G()}function lt(){const g=N(c).y,h=c.clientHeight,f=window.innerHeight;if(g<=5&&g>=-5)return R.CONTENT_HEIGHT;const b=h-g;if(b===f/2)return R.MIDDLE;const w=f-u.marginTop,x=10;return b<=w+x&&b>=w-x?R.TOP:R.CLOSED}function dt(){return c.clientHeight}function nt(g){if(!G())return;const h=N(c).y,b=c.clientHeight-h,w=window.innerHeight-g,x=Yt(b,w),I=W(b,w);o.translateContainer({startY:h,endY:h+(x.isUp?-I:I),animationFrame:d,bottomSheetContainer:c})}function S(g,{viewportHeight:h,visibleHeight:f}){let b=null;for(const w of g){const x=w*h,I=W(f,x);(b===null||I<b)&&(b=I)}return{minOffset:b}}function B(){const g=[...u.snapPoints].reverse(),h=N(c).y,f=c.clientHeight,b=f-h;if(!u.expandable&&b>=f)return;const w=window.innerHeight,x=mt("above",{visibleHeight:b,viewportHeight:w},g),{minOffset:I}=S(x,{visibleHeight:b,viewportHeight:w});if(I===null&&b<w-u.marginTop){o.translateContainer({startY:h,endY:ht(w,f,u.marginTop,"top"),animationFrame:d,bottomSheetContainer:c});return}D(I)&&o.translateContainer({startY:h,endY:h-I,animationFrame:d,bottomSheetContainer:c})}function y(){const g=N(c).y,f=c.clientHeight-g;if(f<1)return;const b=window.innerHeight,w=mt("below",{visibleHeight:f,viewportHeight:b},u.snapPoints),{minOffset:x}=S(w,{visibleHeight:f,viewportHeight:b});D(x)&&o.translateContainer({startY:g,endY:g+x,animationFrame:d,bottomSheetContainer:c})}function U(g){const h=window.innerHeight;if(!zt(g))return;const f=Q(h*g,2);nt(f)}return{props:u,elements:p,mount:v,unmount:k,open:A,close:Y,getIsMounted:L,getIsOpen:G,getIsClosed:tt,getPosition:lt,getHeight:dt,moveTo:nt,snapTo:U}}function an(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>R.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}H.ClassNames=T,H.createBottomSheet=on,H.createPlaceholderBottomSheet=an,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plainsheet/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "The minimalistic, configurable React bottom-sheet for the Web developers",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"vite": "^5.2.0",
|
|
42
42
|
"vite-plugin-css-injected-by-js": "^3.5.0",
|
|
43
43
|
"vite-plugin-dts": "^3.8.1",
|
|
44
|
-
"vitest": "^1.6.
|
|
44
|
+
"vitest": "^1.6.1",
|
|
45
45
|
"@internal/eslint-config": "0.0.0",
|
|
46
46
|
"@internal/typescript-config": "0.0.0"
|
|
47
47
|
},
|