@plainsheet/core 0.6.0 → 0.7.1

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.
@@ -1,3 +1,3 @@
1
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%;pointer-events:none;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{display:none}.pbs-backdrop.open{background-color:#454545b3}.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
2
  (function(h,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(h=typeof globalThis<"u"?globalThis:h||self,A(h.BottomSheet={}))})(this,function(h){"use strict";var ct=Object.defineProperty;var lt=(h,A,C)=>A in h?ct(h,A,{enumerable:!0,configurable:!0,writable:!0,value:C}):h[A]=C;var X=(h,A,C)=>lt(h,typeof A!="symbol"?A+"":A,C);var A=document.createElement("style");A.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%;pointer-events:none;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{display:none}.pbs-backdrop.open{background-color:#454545b3}.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}
3
- `,document.head.appendChild(A);function C(n){return typeof n=="string"}function Bn(n,t){return n.classList.contains(K(t))}function z(n,t){n.classList.add(K(t))}function rn(n,t){n.classList.remove(K(t))}function j(n,t,e){C(e)&&(C(t)&&rn(n,t),z(n,e))}function K(n){return C(n)?n.trim().replace(/\./g,""):""}function F(n){return n.map(t=>K(t)).filter(Boolean).join(" ")}function Yn(n){return n.map(t=>t==null?void 0:t.trim()).filter(Boolean).map(t=>`.${t}`).join(" ")}const fn="open",hn="hidden";function on(n,t){const e=t;if(Array.isArray(n)){n.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(n,e),n.setAttribute("aria-modal",e?"true":"false")}function q(n,t){t?(z(n,fn),rn(n,hn)):(z(n,hn),rn(n,fn))}function gn(n){return n instanceof HTMLElement}function D(n){return typeof n=="number"&&!Number.isNaN(n)}function xn(n){gn(n)&&n.focus()}function In(n){if(!gn(n)||n.offsetParent===null||"disabled"in n&&n.disabled)return!1;const e=n.getAttribute("tabindex"),r=D(e)?parseInt(e,10):-1,o=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(n.tagName),c=n instanceof HTMLAnchorElement&&n.href!==""||n instanceof HTMLAreaElement&&n.href!=="";return o||c||r>-1}var E=(n=>(n.Backdrop="pbs-backdrop",n.Root="pbs-root",n.Container="pbs-container",n.GapFiller="pbs-gap-filler",n.Handle="pbs-handle",n.HandleBar="pbs-handle-bar",n.ContentWrapper="pbs-content-wrapper",n))(E||{}),J=(n=>(n.Button="pbs-button-reset",n.Dialog="pbs-dialog-reset",n))(J||{}),V=(n=>(n.Hidden="hidden",n))(V||{});function N(n,t,e){const r=document.createElement(n);return t.split(" ").forEach(o=>{z(r,o)}),C(e)&&r.setAttribute("data-testid",e),r}const Nn={CONTENTS_WRAPPER:Yn([E.Root,E.ContentWrapper])};function pn(n,t,e,r){switch(r){case"content-height":return t>=n?Cn(n,t,e):0;case"middle":return-(n/2-t);case"top":return-(n-t)+e;default:return 0}}function mn(n,t){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function bn(n,t){return t<n?-(n-t):t-n}function Q(n,t){return n>t?n-t:t-n}function Mn(n,t){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Tn(n,t,e){const r=n==="above";return e.filter(i=>{const o=i*t.viewportHeight;return r?t.visibleHeight<o:t.visibleHeight>o})}function Cn(n,t,e){return-(n-t)+e}function En(n){return Number(n.replace("px",""))}function Z(n,...t){return Number(n.toFixed(...t))}function wn(n){const t=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=t.exec(n))!==null;){const i=r[1],o=r[2].split(",").map(c=>c.trim());e.push({type:i,values:o})}return e}function Pn(n){const t=n.style.transform,e=wn(t);return{transform:t,transformValues:e}}function vn(n,t){const e=n.find(r=>r.type.startsWith(t));return e||null}const sn="translate";function x(n){const t=n.style.transform,e=wn(t),r=vn(e,sn);return yn(r??{type:sn,values:[]})}function nn(n,{x:t,y:e}){const{transform:r,transformValues:i}=Pn(n),o=vn(i,sn);if(o){const c=yn(o);n.style.transform=`translate(${t??c.x??0}px,${e??c.y??0}px)`;return}if(r){n.style.transform=`${r}, translate(${t??0}px,${e??0}px)`;return}n.style.transform=`translate(${t??0}px,${e??0}px)`}function yn(n){if(n.type!=="translate")throw new Error(`Could not get coordinates from ${n.type}, since is not translate.`);const t=n.values[0],e=n.values[1];return{x:En(t)??0,y:En(e)??0}}function an(n){return n!=null}function Hn(n,{min:t,max:e}){return an(e)&&n>=e?e:an(t)&&n<=t?t:n}const _n=(n,t,e)=>{t instanceof HTMLElement&&!Bn(t,E.Handle)&&e.scrollTop>=1||(n.isDragging=!0)},Fn=(n,t,e,r)=>i=>{r.startY=n.getCoordinates(i).y,r.containerStartTranslate=x(t),e.onDragStart()},Rn=(n,t,e,r,i)=>o=>{Un(o,n,e,r,i,t,e.marginTop)};function Un(n,t,e,r,i,o,c){if(!r.isDragging||!D(r.startY))return;const l=t.getCoordinates(n).y,a=bn(r.startY,l),b=window.innerHeight,g=o.clientHeight,u=g-(r.containerStartTranslate.y+a);if(u>=b)return;const w=mn(r.startY,l);if(w.isUp&&!e.expandable&&u>=g)return;i.start(()=>{nn(o,{y:r.containerStartTranslate.y+a})},0);const O=b-c,s=g-r.containerStartTranslate.y;if(w.isUp){const y=O-s,k=O-u,S=Hn(1-Z(k/y,2),{min:0,max:1});e.onDragMove(w,S)}else if(w.isDown){const y=Hn(Z(1-u/s,2),{min:0,max:1});e.onDragMove(w,y)}}const Wn=(n,t,e,r,i,o,c)=>l=>{if(!r.isDragging||(r.isDragging=!1,!D(r.startY)))return;e.onDragEnd();const a=r.startY,b=n.getCoordinates(l).y,g=x(t).y,u=mn(a,b),w=window.innerHeight,O=t.clientHeight;if(u.isUp){const s=[...e.snapPoints].sort((S,v)=>S-v),y=O+-g;if(!e.expandable&&y>=O)return;for(const S of s){const v=S*window.innerHeight;if(y<=v){const U=Q(y,v);c.translateContainer({startY:g,endY:g-U,animationFrame:i,bottomSheetContainer:t});return}}const k=Cn(w,O,e.marginTop);c.translateContainer({startY:g,endY:k,animationFrame:i,bottomSheetContainer:t})}else if(u.isDown){const s=[...e.snapPoints].sort((y,k)=>k-y);for(const y of s){const k=y*window.innerHeight,S=O+-g;if(S>=k){const v=Q(S,k);c.translateContainer({startY:g,endY:g+v,animationFrame:i,bottomSheetContainer:t});return}}o()}};var M=(n=>(n[n.All=-1]="All",n[n.None=0]="None",n[n.Capture=1]="Capture",n[n.Target=2]="Target",n[n.Bubble=3]="Bubble",n))(M||{});function cn(n){switch(n){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gn={eventPhase:M.All};class ${constructor(t){X(this,"currentTarget");this.currentTarget=t}addEventListeners({onStart:t,onStartOptions:e=Gn,onMove:r,onEnd:i}){this.addTouchEventListeners({onStart:t,onStartOptions:e,onMove:r,onEnd:i}),this.addMouseEventListeners({onStart:t,onStartOptions:e,onMove:r,onEnd:i})}addTouchEventListeners({onStart:t,onStartOptions:e,onMove:r,onEnd:i}){t&&this.currentTarget.addEventListener("touchstart",o=>{if(e.eventPhase===M.All){t(o);return}cn(o.eventPhase)===e.eventPhase&&t(o)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),i&&this.currentTarget.addEventListener("touchend",i)}addMouseEventListeners({onStart:t,onStartOptions:e,onMove:r,onEnd:i}){t&&this.currentTarget.addEventListener("mousedown",o=>{if(e.eventPhase===M.All){t(o);return}cn(o.eventPhase)===e.eventPhase&&t(o)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),i&&this.currentTarget.addEventListener("mouseup",o=>{i(o)})}removeEventListeners({onStart:t,onMove:e,onEnd:r}){t&&this.currentTarget.removeEventListener("touchstart",t),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),t&&this.currentTarget.removeEventListener("mousedown",t),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(t){if(t.type==="touchstart"||t.type==="mousedown"){if("touches"in t)return{x:t.touches[0].clientX,y:t.touches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}if(t.type==="touchend"||t.type==="mouseup"||t.type==="mousemove"||t.type==="touchmove"){if("touches"in t)return{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}return{x:0,y:0}}}function jn(n,t){const e=Vn(n);$n(e),e.bottomSheetContainer.style.width=n.width;const r=document.createElement("div");r.innerHTML=n.content??"";const i=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${i}px`,e.bottomSheetContentWrapper.appendChild(r);const o=Xn({bottomSheetElements:e,bottomSheetProps:n,options:t});return{elements:e,eventHandlers:o}}function Vn(n){const t=N("dialog",F([E.Root,J.Dialog,n.rootClass]),E.Root);t.ariaLabel=n.ariaLabel;const e=N("section",F([E.Container,n.containerClass]),E.Container);n.containerBorderRadius&&(e.style.borderRadius=n.containerBorderRadius);const r=N("div",E.GapFiller,E.GapFiller),i=N("button",F([E.Handle,J.Button,n.shouldShowHandle?null:V.Hidden,n.handleClass]),E.Handle);i.setAttribute("type","button"),i.ariaLabel="bottom sheet close button";const o=N("span",F([E.HandleBar,n.shouldShowHandle?null:V.Hidden]),E.HandleBar),c=N("article",F([E.ContentWrapper,n.contentWrapperClass]),E.ContentWrapper),l=N("div",F([E.Backdrop,n.backdropClass,V.Hidden]),E.Backdrop);return n.backdropColor&&(l.style.backgroundColor=n.backdropColor),n.backDropTransition&&(l.style.transition=n.backDropTransition),{bottomSheetRoot:t,bottomSheetBackdrop:l,bottomSheetContainer:e,bottomSheetHandle:i,bottomSheetHandleBar:o,bottomSheetContentWrapper:c,bottomSheetContainerGapFiller:r}}function $n({bottomSheetRoot:n,bottomSheetContainer:t,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:i,bottomSheetContainerGapFiller:o}){n.appendChild(t),e.appendChild(r),t.appendChild(e),t.appendChild(i),t.appendChild(o)}function Xn({bottomSheetElements:n,bottomSheetProps:t,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:i,bottomSheetHandle:o,bottomSheetContainerGapFiller:c,bottomSheetContentWrapper:l}=n,{animationFrame:a}=e,b=new $(o),g=new $(l),u=new $(c),w=t.dragTriggers.reduce((T,B)=>{const Y=r.querySelectorAll(B);if(!Y.length)return T;const en=Array.from(Y).map(G=>G instanceof HTMLElement?new $(G):null).filter(G=>!!G);return[...T,...en]},[]),O=new $(window),s=Fn(O,i,t,e.draggingState),y=Rn(O,i,t,e.draggingState,a),k=Wn(O,i,t,e.draggingState,a,e.onClose,e.bottomSheetState);function S(T){T.target instanceof Element&&!r.contains(T.target)&&e.onClose()}function v(T){_n(e.draggingState,T.target,n.bottomSheetContentWrapper)}function U(){t.draggable&&(b.addEventListeners({onStart:v}),w.forEach(T=>{T.addEventListeners({onStart:v,onStartOptions:{eventPhase:M.Target}})})),t.draggable&&t.backgroundDraggable&&(g.addEventListeners({onStart:v,onStartOptions:{eventPhase:M.Target}}),u.addEventListeners({onStart:v})),t.draggable&&O.addEventListeners({onStart:s,onMove:y,onEnd:k}),t.draggable&&window.document.addEventListener("keyup",T=>{T.key==="Escape"&&e.onClose()}),t.shouldCloseOnOutsideClick&&window.document.addEventListener("click",S),o.addEventListener("keyup",T=>{if(T.key==="ArrowUp"){e.moveUp();return}if(T.key==="ArrowDown"){e.moveDown();return}if(T.shiftKey&&T.key==="Tab"){const B=W(n.bottomSheetContentWrapper);xn(B)}})}function W(T){let B=[...Array.from(T.childNodes).reverse()];for(;B.length;){const Y=B.shift();if(In(Y))return Y;Y&&(B=[...B,...Array.from(Y.childNodes).reverse()])}return null}function tn(){b.removeEventListeners({onStart:v}),g.removeEventListeners({onStart:v}),u.removeEventListeners({onStart:v}),w.forEach(T=>{T.removeEventListeners({onStart:v})}),O.removeEventListeners({onStart:s,onMove:y,onEnd:k}),window.removeEventListener("click",S)}return{attachEventListeners:U,clearEventListeners:tn}}class zn{constructor(){X(this,"animationId");X(this,"isInProgress");X(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(t,e,r=!1){this.isInProgress=!0;const i=o=>{this.startedAt||(this.startedAt=o);const c=o-this.startedAt,a=e===0?1:Z(c/e,2),b=a>=1&&!r;t(a),b?this.stop():this.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}stop(){this.isInProgress=!1,this.startedAt=null,D(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Kn(n){const{startY:t,endY:e,bottomSheetContainer:r,animationFrame:i,onEnd:o,animationTimingFunction:c,animationDuration:l}=n,a=bn(t,e);i.stop();let b=!1;i.start(g=>{nn(r,{y:t+a*c(g)}),!b&&g>=1&&(o==null||o(),b=!0)},l)}const ln=(n,t)=>e=>{Kn({...e,animationTimingFunction:n,animationDuration:t})},P={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function qn(n){return!(!D(n)||n>1||n<0)}function Jn(n,t){const e={set(r,i,o,c){return t(i,o),Reflect.set(r,i,o,c)}};return new Proxy(n,e)}function Qn(...n){console.error(n)}const _={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function On(n){for(const t of Object.values(_))if(t===n)return!0;return!1}function un(n){return!!(n instanceof Object&&"p1x"in n&&"p1y"in n&&"p2x"in n&&"p2y"in n&&D(n.p1x)&&D(n.p1y)&&D(n.p2x)&&D(n.p2y))}function R(n,t,e,r){return function(a){return l(o(a))};function o(a){let b=0,g=1,u=a,w;if(a===0||a===1)return a;for(;b<g;){if(w=c(u),Math.abs(w-a)<.001)return u;a>w?b=u:g=u,u=(g+b)/2}return u}function c(a){return 3*n*a*Math.pow(1-a,2)+3*e*Math.pow(a,2)*(1-a)+Math.pow(a,3)}function l(a){return 3*t*a*Math.pow(1-a,2)+3*r*Math.pow(a,2)*(1-a)+Math.pow(a,3)}}const Zn=R(.25,.1,.25,1),nt=R(.42,0,1,1),An=R(.42,0,.58,1),Ln=R(.4,.1,.6,1),tt=R(.45,1.5,.55,1);function et(n){switch(n){case _.EASE:return Zn;case _.EASE_IN:return nt;case _.EASE_OUT:return An;case _.EASE_IN_OUT:return Ln;case _.SPRING:return tt;default:return Ln}}function kn(n){return typeof n=="boolean"}const Sn={ariaLabel:"Bottom sheet",content:"",defaultPosition:P.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180};function rt(n){const t={...Sn},e=Object.entries(n).reduce((i,o)=>{const[c,l]=o;return an(l)&&(i[c]=l),i},{});return{...t,...e}}function dn(n){if(un(n)){const{p1x:t,p1y:e,p2x:r,p2y:i}=n;return R(t,e,r,i)}return On(n)?et(n):An}function ot(n,t,e){function r(i,o){switch(i){case"content":C(o)&&(n.bottomSheetContentWrapper.innerHTML=o);break;case"width":C(o)&&(n.bottomSheetContainer.style.width=o);break;case"shouldShowHandle":kn(o)||q(n.bottomSheetHandle,!1);break;case"shouldShowBackdrop":kn(o)||q(n.bottomSheetBackdrop,!1);break;case"containerBorderRadius":C(o)&&(n.bottomSheetContainer.style.borderRadius=o);break;case"backdropColor":C(o)&&(n.bottomSheetBackdrop.style.backgroundColor=o);break;case"backDropTransition":C(o)&&(n.bottomSheetBackdrop.style.transition=o);break;case"rootClass":if(!C(o))return;j(n.bottomSheetRoot,e.rootClass,o);break;case"containerClass":if(!C(o))return;j(n.bottomSheetContainer,e.containerClass,o);break;case"handleClass":if(!C(o))return;j(n.bottomSheetHandle,e.handleClass,o);break;case"contentWrapperClass":if(!C(o))return;j(n.bottomSheetContentWrapper,e.contentWrapperClass,o);break;case"backdropClass":if(!C(o))return;j(n.bottomSheetBackdrop,e.backdropClass,o);break;case"draggingAnimationTimings":if(un(o)){const c=dn(o),l=ln(c,e.draggingAnimationDuration);t.translateContainer=l}break;case"draggingAnimationDuration":if(D(o)){const c=dn(e.draggingAnimationTimings),l=ln(c,o);t.translateContainer=l}break}}return r}function it(n){const t=rt(n),e=dn(n.draggingAnimationTimings),i={isMounted:!1,translateContainer:ln(e,t.draggingAnimationDuration)},o={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null};function c(){o.originalDocumentOverflowY&&o.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=o.originalDocumentOverflowY)}const l=new zn,a={animationFrame:l,onClose:v,bottomSheetState:i,draggingState:o,snapTo:Dn,moveUp:G,moveDown:at},{elements:b,eventHandlers:g}=jn(t,a),u=Jn(t,ot(b,i,t)),{bottomSheetBackdrop:w,bottomSheetRoot:O,bottomSheetContainer:s}=b,y=d=>{const f=d??window.document.body;f.appendChild(O),f.appendChild(w);const p=window.innerHeight;nn(s,{y:p}),g.attachEventListeners(),i.isMounted=!0},k=()=>{g.clearEventListeners(),Object.values(b).forEach(d=>{d.remove()}),c(),i.isMounted=!1},S=()=>{var L;if(U()||Qn('Bottom Sheet is not mounted yet. call the "mount" method first.'),(L=n.beforeOpen)==null||L.call(n),W())return;u.shouldShowBackdrop&&on(w,!0),on([s],!0),nn(s,{y:s.clientHeight});const f=window.innerHeight,p=pn(f,s.clientHeight,u.marginTop,u.defaultPosition),m=x(s).y;i.translateContainer({startY:m,endY:p,animationFrame:l,bottomSheetContainer:s,onEnd:n.afterOpen}),b.bottomSheetHandle.focus();const H=document.body.style.overflowY;o.originalDocumentOverflowY=H||"initial",document.body.style.overflowY="hidden"};function v(){var p;if(tn())return;(p=n.beforeClose)==null||p.call(n);const d=x(s).y,f=s.clientHeight;i.translateContainer({startY:d,endY:f,animationFrame:l,bottomSheetContainer:s,onEnd:()=>{var m;(m=n.afterClose)==null||m.call(n),on([w,s],!1)}}),c()}function U(){return i.isMounted}function W(){const d=x(s).y,f=window.innerHeight,p=s.clientHeight>=f?f:s.clientHeight;return d<p}function tn(){return!W()}function T(){const d=x(s).y,f=s.clientHeight,p=window.innerHeight;if(d<=5&&d>=-5)return P.CONTENT_HEIGHT;const m=f-d;if(m===p/2)return P.MIDDLE;const H=p-u.marginTop,L=10;return m<=H+L&&m>=H-L?P.TOP:P.CLOSED}function B(){return s.clientHeight}function Y(d){if(!W())return;const f=x(s).y,m=s.clientHeight-f,H=window.innerHeight-d,L=Mn(m,H),I=Q(m,H);i.translateContainer({startY:f,endY:f+(L.isUp?-I:I),animationFrame:l,bottomSheetContainer:s})}function en(d,{viewportHeight:f,visibleHeight:p}){let m=null;for(const H of d){const L=H*f,I=Q(p,L);(m===null||I<m)&&(m=I)}return{minOffset:m}}function G(){const d=[...u.snapPoints].reverse(),f=x(s).y,p=s.clientHeight,m=p-f;if(!u.expandable&&m>=p)return;const H=window.innerHeight,L=Tn("above",{visibleHeight:m,viewportHeight:H},d),{minOffset:I}=en(L,{visibleHeight:m,viewportHeight:H});if(I===null&&m<H-u.marginTop){i.translateContainer({startY:f,endY:pn(H,p,u.marginTop,"top"),animationFrame:l,bottomSheetContainer:s});return}D(I)&&i.translateContainer({startY:f,endY:f-I,animationFrame:l,bottomSheetContainer:s})}function at(){const d=x(s).y,p=s.clientHeight-d;if(p<1)return;const m=window.innerHeight,H=Tn("below",{visibleHeight:p,viewportHeight:m},u.snapPoints),{minOffset:L}=en(H,{visibleHeight:p,viewportHeight:m});D(L)&&i.translateContainer({startY:d,endY:d+L,animationFrame:l,bottomSheetContainer:s})}function Dn(d){const f=window.innerHeight;if(!qn(d))return;const p=Z(f*d,2);Y(p)}return{props:u,elements:b,mount:y,unmount:k,open:S,close:v,getIsMounted:U,getIsOpen:W,getIsClosed:tn,getPosition:T,getHeight:B,moveTo:Y,snapTo:Dn}}function st(){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:""}}}h.BOTTOM_SHEET_DEFAULT_PROPS=Sn,h.BOTTOM_SHEET_POSITION=P,h.BOTTOM_SHEET_SELECTORS=Nn,h.COMMON_ANIMATION_KEYS=_,h.ClassNames=E,h.EventPhase=M,h.ResetClassNames=J,h.UtilClassNames=V,h.createBottomSheet=it,h.createPlaceholderBottomSheet=st,h.eventPhaseToEnum=cn,h.isAnimationTimingPoints=un,h.isCommonAnimationTimingsKey=On,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
3
+ /*$vite$:1*/`,document.head.appendChild(A);function C(n){return typeof n=="string"}function Bn(n,t){return n.classList.contains(K(t))}function z(n,t){n.classList.add(K(t))}function rn(n,t){n.classList.remove(K(t))}function $(n,t,e){C(e)&&(C(t)&&rn(n,t),z(n,e))}function K(n){return C(n)?n.trim().replace(/\./g,""):""}function F(n){return n.map(t=>K(t)).filter(Boolean).join(" ")}function Yn(n){return n.map(t=>t==null?void 0:t.trim()).filter(Boolean).map(t=>`.${t}`).join(" ")}const fn="open",hn="hidden";function on(n,t){const e=t;if(Array.isArray(n)){n.forEach(o=>{q(o,e),o.setAttribute("aria-modal",e?"true":"false")});return}q(n,e),n.setAttribute("aria-modal",e?"true":"false")}function q(n,t){t?(z(n,fn),rn(n,hn)):(z(n,hn),rn(n,fn))}function gn(n){return n instanceof HTMLElement}function S(n){return typeof n=="number"&&!Number.isNaN(n)}function xn(n){gn(n)&&n.focus()}function In(n){if(!gn(n)||n.offsetParent===null||"disabled"in n&&n.disabled)return!1;const e=n.getAttribute("tabindex"),o=S(e)?parseInt(e,10):-1,r=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(n.tagName),c=n instanceof HTMLAnchorElement&&n.href!==""||n instanceof HTMLAreaElement&&n.href!=="";return r||c||o>-1}var E=(n=>(n.Backdrop="pbs-backdrop",n.Root="pbs-root",n.Container="pbs-container",n.GapFiller="pbs-gap-filler",n.Handle="pbs-handle",n.HandleBar="pbs-handle-bar",n.ContentWrapper="pbs-content-wrapper",n))(E||{}),J=(n=>(n.Button="pbs-button-reset",n.Dialog="pbs-dialog-reset",n))(J||{}),j=(n=>(n.Hidden="hidden",n))(j||{});function N(n,t,e){const o=document.createElement(n);return t.split(" ").forEach(r=>{z(o,r)}),C(e)&&o.setAttribute("data-testid",e),o}const Nn={CONTENTS_WRAPPER:Yn([E.Root,E.ContentWrapper])};function pn(n,t,e,o){switch(o){case"content-height":return t>=n?Cn(n,t,e):0;case"middle":return-(n/2-t);case"top":return-(n-t)+e;default:return 0}}function mn(n,t){const e=t<n,o=t>n;return{isUp:e,isDown:o,stayedSame:t===n}}function bn(n,t){return t<n?-(n-t):t-n}function Q(n,t){return n>t?n-t:t-n}function Mn(n,t){const e=n<t,o=n>t;return{isUp:e,isDown:o,stayedSame:n===t}}function Tn(n,t,e){const o=n==="above";return e.filter(i=>{const r=i*t.viewportHeight;return o?t.visibleHeight<r:t.visibleHeight>r})}function Cn(n,t,e){return-(n-t)+e}function En(n){return Number(n.replace("px",""))}function Z(n,...t){return Number(n.toFixed(...t))}function vn(n){const t=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let o;for(;(o=t.exec(n))!==null;){const i=o[1],r=o[2].split(",").map(c=>c.trim());e.push({type:i,values:r})}return e}function Pn(n){const t=n.style.transform,e=vn(t);return{transform:t,transformValues:e}}function wn(n,t){const e=n.find(o=>o.type.startsWith(t));return e||null}const sn="translate";function I(n){const t=n.style.transform,e=vn(t),o=wn(e,sn);return yn(o??{type:sn,values:[]})}function nn(n,{x:t,y:e}){const{transform:o,transformValues:i}=Pn(n),r=wn(i,sn);if(r){const c=yn(r);n.style.transform=`translate(${t??c.x??0}px,${e??c.y??0}px)`;return}if(o){n.style.transform=`${o}, translate(${t??0}px,${e??0}px)`;return}n.style.transform=`translate(${t??0}px,${e??0}px)`}function yn(n){if(n.type!=="translate")throw new Error(`Could not get coordinates from ${n.type}, since is not translate.`);const t=n.values[0],e=n.values[1];return{x:En(t)??0,y:En(e)??0}}function an(n){return n!=null}function Hn(n,{min:t,max:e}){return an(e)&&n>=e?e:an(t)&&n<=t?t:n}const _n=(n,t,e)=>{t instanceof HTMLElement&&!Bn(t,E.Handle)&&e.scrollTop>=1||(n.isDragging=!0)},Fn=(n,t,e,o)=>i=>{o.startY=n.getCoordinates(i).y,o.containerStartTranslate=I(t),e.onDragStart()},Rn=(n,t,e,o,i)=>r=>{Un(r,n,e,o,i,t,e.marginTop)};function Un(n,t,e,o,i,r,c){if(!o.isDragging||!S(o.startY))return;const l=t.getCoordinates(n).y,a=bn(o.startY,l),b=window.innerHeight,g=r.clientHeight,u=g-(o.containerStartTranslate.y+a);if(u>=b)return;const v=mn(o.startY,l);if(v.isUp&&!e.expandable&&u>=g)return;i.start(()=>{nn(r,{y:o.containerStartTranslate.y+a})},0);const O=b-c,s=g-o.containerStartTranslate.y;if(v.isUp){const y=O-s,L=O-u,k=Hn(1-Z(L/y,2),{min:0,max:1});e.onDragMove(v,k)}else if(v.isDown){const y=Hn(Z(1-u/s,2),{min:0,max:1});e.onDragMove(v,y)}}const Wn=(n,t,e,o,i,r,c)=>l=>{if(!o.isDragging||(o.isDragging=!1,!S(o.startY)))return;e.onDragEnd();const a=o.startY,b=n.getCoordinates(l).y,g=I(t).y,u=mn(a,b),v=window.innerHeight,O=t.clientHeight;if(u.isUp){const s=[...e.snapPoints].sort((k,w)=>k-w),y=O+-g;if(!e.expandable&&y>=O)return;for(const k of s){const w=k*window.innerHeight;if(y<=w){const U=Q(y,w);c.translateContainer({startY:g,endY:g-U,animationFrame:i,bottomSheetContainer:t});return}}const L=Cn(v,O,e.marginTop);c.translateContainer({startY:g,endY:L,animationFrame:i,bottomSheetContainer:t})}else if(u.isDown){const s=[...e.snapPoints].sort((y,L)=>L-y);for(const y of s){const L=y*window.innerHeight,k=O+-g;if(k>=L){const w=Q(k,L);c.translateContainer({startY:g,endY:g+w,animationFrame:i,bottomSheetContainer:t});return}}r()}};var M=(n=>(n[n.All=-1]="All",n[n.None=0]="None",n[n.Capture=1]="Capture",n[n.Target=2]="Target",n[n.Bubble=3]="Bubble",n))(M||{});function cn(n){switch(n){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gn={eventPhase:M.All};class V{constructor(t){X(this,"currentTarget");this.currentTarget=t}addEventListeners({onStart:t,onStartOptions:e=Gn,onMove:o,onEnd:i}){this.addTouchEventListeners({onStart:t,onStartOptions:e,onMove:o,onEnd:i}),this.addMouseEventListeners({onStart:t,onStartOptions:e,onMove:o,onEnd:i})}addTouchEventListeners({onStart:t,onStartOptions:e,onMove:o,onEnd:i}){t&&this.currentTarget.addEventListener("touchstart",r=>{if(e.eventPhase===M.All){t(r);return}cn(r.eventPhase)===e.eventPhase&&t(r)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),i&&this.currentTarget.addEventListener("touchend",i)}addMouseEventListeners({onStart:t,onStartOptions:e,onMove:o,onEnd:i}){t&&this.currentTarget.addEventListener("mousedown",r=>{if(e.eventPhase===M.All){t(r);return}cn(r.eventPhase)===e.eventPhase&&t(r)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),i&&this.currentTarget.addEventListener("mouseup",r=>{i(r)})}removeEventListeners({onStart:t,onMove:e,onEnd:o}){t&&this.currentTarget.removeEventListener("touchstart",t),o&&this.currentTarget.removeEventListener("touchend",o),e&&this.currentTarget.removeEventListener("touchmove",e),t&&this.currentTarget.removeEventListener("mousedown",t),e&&this.currentTarget.removeEventListener("mousemove",e),o&&this.currentTarget.removeEventListener("mouseup",o)}getCoordinates(t){if(t.type==="touchstart"||t.type==="mousedown"){if("touches"in t)return{x:t.touches[0].clientX,y:t.touches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}if(t.type==="touchend"||t.type==="mouseup"||t.type==="mousemove"||t.type==="touchmove"){if("touches"in t)return{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY};if(t instanceof MouseEvent)return{x:t.clientX,y:t.clientY}}return{x:0,y:0}}}function $n(n,t){const e=jn(n);Vn(e),e.bottomSheetContainer.style.width=n.width;const o=document.createElement("div");o.innerHTML=n.content??"";const i=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${i}px`,e.bottomSheetContentWrapper.appendChild(o);const r=Xn({bottomSheetElements:e,bottomSheetProps:n,options:t});return{elements:e,eventHandlers:r}}function jn(n){const t=N("dialog",F([E.Root,J.Dialog,n.rootClass]),E.Root);t.ariaLabel=n.ariaLabel;const e=N("section",F([E.Container,n.containerClass]),E.Container);n.containerBorderRadius&&(e.style.borderRadius=n.containerBorderRadius);const o=N("div",E.GapFiller,E.GapFiller),i=N("button",F([E.Handle,J.Button,n.shouldShowHandle?null:j.Hidden,n.handleClass]),E.Handle);i.setAttribute("type","button"),i.ariaLabel="bottom sheet close button";const r=N("span",F([E.HandleBar,n.shouldShowHandle?null:j.Hidden]),E.HandleBar),c=N("article",F([E.ContentWrapper,n.contentWrapperClass]),E.ContentWrapper),l=N("div",F([E.Backdrop,n.backdropClass,j.Hidden]),E.Backdrop);return n.backdropColor&&(l.style.backgroundColor=n.backdropColor),n.backDropTransition&&(l.style.transition=n.backDropTransition),{bottomSheetRoot:t,bottomSheetBackdrop:l,bottomSheetContainer:e,bottomSheetHandle:i,bottomSheetHandleBar:r,bottomSheetContentWrapper:c,bottomSheetContainerGapFiller:o}}function Vn({bottomSheetRoot:n,bottomSheetContainer:t,bottomSheetHandle:e,bottomSheetHandleBar:o,bottomSheetContentWrapper:i,bottomSheetContainerGapFiller:r}){n.appendChild(t),e.appendChild(o),t.appendChild(e),t.appendChild(i),t.appendChild(r)}function Xn({bottomSheetElements:n,bottomSheetProps:t,options:e}){const{bottomSheetRoot:o,bottomSheetContainer:i,bottomSheetHandle:r,bottomSheetContainerGapFiller:c,bottomSheetContentWrapper:l}=n,{animationFrame:a}=e,b=new V(r),g=new V(l),u=new V(c),v=t.dragTriggers.reduce((T,Y)=>{const x=o.querySelectorAll(Y);if(!x.length)return T;const en=Array.from(x).map(G=>G instanceof HTMLElement?new V(G):null).filter(G=>!!G);return[...T,...en]},[]),O=new V(window),s=Fn(O,i,t,e.draggingState),y=Rn(O,i,t,e.draggingState,a),L=Wn(O,i,t,e.draggingState,a,e.onClose,e.bottomSheetState);function k(T){T.target instanceof Element&&!o.contains(T.target)&&e.onClose()}function w(T){_n(e.draggingState,T.target,n.bottomSheetContentWrapper)}function U(){t.draggable&&(b.addEventListeners({onStart:w}),v.forEach(T=>{T.addEventListeners({onStart:w,onStartOptions:{eventPhase:M.Target}})})),t.draggable&&t.backgroundDraggable&&(g.addEventListeners({onStart:w,onStartOptions:{eventPhase:M.Target}}),u.addEventListeners({onStart:w})),t.draggable&&O.addEventListeners({onStart:s,onMove:y,onEnd:L}),t.draggable&&window.document.addEventListener("keyup",T=>{T.key==="Escape"&&e.onClose()}),t.shouldCloseOnOutsideClick&&window.document.addEventListener("click",k),r.addEventListener("keyup",T=>{if(T.key==="ArrowUp"){e.moveUp();return}if(T.key==="ArrowDown"){e.moveDown();return}if(T.shiftKey&&T.key==="Tab"){const Y=W(n.bottomSheetContentWrapper);xn(Y)}})}function W(T){let Y=[...Array.from(T.childNodes).reverse()];for(;Y.length;){const x=Y.shift();if(In(x))return x;x&&(Y=[...Y,...Array.from(x.childNodes).reverse()])}return null}function tn(){b.removeEventListeners({onStart:w}),g.removeEventListeners({onStart:w}),u.removeEventListeners({onStart:w}),v.forEach(T=>{T.removeEventListeners({onStart:w})}),O.removeEventListeners({onStart:s,onMove:y,onEnd:L}),window.removeEventListener("click",k)}return{attachEventListeners:U,clearEventListeners:tn}}class zn{constructor(){X(this,"animationId");X(this,"isInProgress");X(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(t,e,o=!1){this.isInProgress=!0;const i=r=>{this.startedAt||(this.startedAt=r);const c=r-this.startedAt,a=e===0?1:Z(c/e,2),b=a>=1&&!o;t(a),b?this.stop():this.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}stop(){this.isInProgress=!1,this.startedAt=null,S(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Kn(n){const{startY:t,endY:e,bottomSheetContainer:o,animationFrame:i,onEnd:r,animationTimingFunction:c,animationDuration:l}=n,a=bn(t,e);i.stop();let b=!1;i.start(g=>{nn(o,{y:t+a*c(g)}),!b&&g>=1&&(r==null||r(),b=!0)},l)}const ln=(n,t)=>e=>{Kn({...e,animationTimingFunction:n,animationDuration:t})},P={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function qn(n){return!(!S(n)||n>1||n<0)}function Jn(n,t){const e={set(o,i,r,c){return t(i,r),Reflect.set(o,i,r,c)}};return new Proxy(n,e)}function Qn(...n){console.error(n)}const _={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function On(n){for(const t of Object.values(_))if(t===n)return!0;return!1}function un(n){return!!(n instanceof Object&&"p1x"in n&&"p1y"in n&&"p2x"in n&&"p2y"in n&&S(n.p1x)&&S(n.p1y)&&S(n.p2x)&&S(n.p2y))}function R(n,t,e,o){return function(a){return l(r(a))};function r(a){let b=0,g=1,u=a,v;if(a===0||a===1)return a;for(;b<g;){if(v=c(u),Math.abs(v-a)<.001)return u;a>v?b=u:g=u,u=(g+b)/2}return u}function c(a){return 3*n*a*Math.pow(1-a,2)+3*e*Math.pow(a,2)*(1-a)+Math.pow(a,3)}function l(a){return 3*t*a*Math.pow(1-a,2)+3*o*Math.pow(a,2)*(1-a)+Math.pow(a,3)}}const An=R(.25,.1,.25,1),Zn=R(.42,0,1,1),Ln=R(.42,0,.58,1),nt=R(.4,.1,.6,1),tt=R(.45,1.5,.55,1);function et(n){switch(n){case _.EASE:return An;case _.EASE_IN:return Zn;case _.EASE_OUT:return Ln;case _.EASE_IN_OUT:return nt;case _.SPRING:return tt;default:return An}}function kn(n){return typeof n=="boolean"}const Dn={ariaLabel:"Bottom sheet",content:"",defaultPosition:P.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180};function rt(n){const t={...Dn},e=Object.entries(n).reduce((i,r)=>{const[c,l]=r;return an(l)&&(i[c]=l),i},{});return{...t,...e}}function dn(n){if(un(n)){const{p1x:t,p1y:e,p2x:o,p2y:i}=n;return R(t,e,o,i)}return On(n)?et(n):Ln}function ot(n,t,e){function o(i,r){switch(i){case"content":C(r)&&(n.bottomSheetContentWrapper.innerHTML=r);break;case"width":C(r)&&(n.bottomSheetContainer.style.width=r);break;case"shouldShowHandle":kn(r)||q(n.bottomSheetHandle,!1);break;case"shouldShowBackdrop":kn(r)||q(n.bottomSheetBackdrop,!1);break;case"containerBorderRadius":C(r)&&(n.bottomSheetContainer.style.borderRadius=r);break;case"backdropColor":C(r)&&(n.bottomSheetBackdrop.style.backgroundColor=r);break;case"backDropTransition":C(r)&&(n.bottomSheetBackdrop.style.transition=r);break;case"rootClass":if(!C(r))return;$(n.bottomSheetRoot,e.rootClass,r);break;case"containerClass":if(!C(r))return;$(n.bottomSheetContainer,e.containerClass,r);break;case"handleClass":if(!C(r))return;$(n.bottomSheetHandle,e.handleClass,r);break;case"contentWrapperClass":if(!C(r))return;$(n.bottomSheetContentWrapper,e.contentWrapperClass,r);break;case"backdropClass":if(!C(r))return;$(n.bottomSheetBackdrop,e.backdropClass,r);break;case"draggingAnimationTimings":if(un(r)){const c=dn(r),l=ln(c,e.draggingAnimationDuration);t.translateContainer=l}break;case"draggingAnimationDuration":if(S(r)){const c=dn(e.draggingAnimationTimings),l=ln(c,r);t.translateContainer=l}break}}return o}function it(n){const t=rt(n),e=dn(n.draggingAnimationTimings),i={isMounted:!1,translateContainer:ln(e,t.draggingAnimationDuration)},r={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function c(){r.originalDocumentOverflowY&&r.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=r.originalDocumentOverflowY),r.originalDocumentOverscrollBehavior&&(document.body.style.position=r.originalDocumentOverscrollBehavior)}const l=new zn,a={animationFrame:l,onClose:w,bottomSheetState:i,draggingState:r,snapTo:Sn,moveUp:G,moveDown:at},{elements:b,eventHandlers:g}=$n(t,a),u=Jn(t,ot(b,i,t)),{bottomSheetBackdrop:v,bottomSheetRoot:O,bottomSheetContainer:s}=b,y=d=>{const f=d??window.document.body;f.appendChild(O),f.appendChild(v);const p=window.innerHeight;nn(s,{y:p}),g.attachEventListeners(),i.isMounted=!0},L=()=>{g.clearEventListeners(),Object.values(b).forEach(d=>{d.remove()}),c(),i.isMounted=!1},k=()=>{var B;if(U()||Qn('Bottom Sheet is not mounted yet. call the "mount" method first.'),(B=n.beforeOpen)==null||B.call(n),W())return;u.shouldShowBackdrop&&on(v,!0),on([s],!0),nn(s,{y:s.clientHeight});const f=window.innerHeight,p=pn(f,s.clientHeight,u.marginTop,u.defaultPosition),m=I(s).y;i.translateContainer({startY:m,endY:p,animationFrame:l,bottomSheetContainer:s,onEnd:n.afterOpen}),b.bottomSheetHandle.focus();const H=document.body.style.overflowY;r.originalDocumentOverflowY=H||"initial";const D=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain"};function w(){var p;if(tn())return;(p=n.beforeClose)==null||p.call(n);const d=I(s).y,f=s.clientHeight;i.translateContainer({startY:d,endY:f,animationFrame:l,bottomSheetContainer:s,onEnd:()=>{var m;(m=n.afterClose)==null||m.call(n),on([v,s],!1)}}),c()}function U(){return i.isMounted}function W(){const d=I(s).y,f=window.innerHeight,p=s.clientHeight>=f?f:s.clientHeight;return d<p}function tn(){return!W()}function T(){const d=I(s).y,f=s.clientHeight,p=window.innerHeight;if(d<=5&&d>=-5)return P.CONTENT_HEIGHT;const m=f-d;if(m===p/2)return P.MIDDLE;const H=p-u.marginTop,D=10;return m<=H+D&&m>=H-D?P.TOP:P.CLOSED}function Y(){return s.clientHeight}function x(d){if(!W())return;const f=I(s).y,m=s.clientHeight-f,H=window.innerHeight-d,D=Mn(m,H),B=Q(m,H);i.translateContainer({startY:f,endY:f+(D.isUp?-B:B),animationFrame:l,bottomSheetContainer:s})}function en(d,{viewportHeight:f,visibleHeight:p}){let m=null;for(const H of d){const D=H*f,B=Q(p,D);(m===null||B<m)&&(m=B)}return{minOffset:m}}function G(){const d=[...u.snapPoints].reverse(),f=I(s).y,p=s.clientHeight,m=p-f;if(!u.expandable&&m>=p)return;const H=window.innerHeight,D=Tn("above",{visibleHeight:m,viewportHeight:H},d),{minOffset:B}=en(D,{visibleHeight:m,viewportHeight:H});if(B===null&&m<H-u.marginTop){i.translateContainer({startY:f,endY:pn(H,p,u.marginTop,"top"),animationFrame:l,bottomSheetContainer:s});return}S(B)&&i.translateContainer({startY:f,endY:f-B,animationFrame:l,bottomSheetContainer:s})}function at(){const d=I(s).y,p=s.clientHeight-d;if(p<1)return;const m=window.innerHeight,H=Tn("below",{visibleHeight:p,viewportHeight:m},u.snapPoints),{minOffset:D}=en(H,{visibleHeight:p,viewportHeight:m});S(D)&&i.translateContainer({startY:d,endY:d+D,animationFrame:l,bottomSheetContainer:s})}function Sn(d){const f=window.innerHeight;if(!qn(d))return;const p=Z(f*d,2);x(p)}return{props:u,elements:b,mount:y,unmount:L,open:k,close:w,getIsMounted:U,getIsOpen:W,getIsClosed:tn,getPosition:T,getHeight:Y,moveTo:x,snapTo:Sn}}function st(){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:""}}}h.BOTTOM_SHEET_DEFAULT_PROPS=Dn,h.BOTTOM_SHEET_POSITION=P,h.BOTTOM_SHEET_SELECTORS=Nn,h.COMMON_ANIMATION_KEYS=_,h.ClassNames=E,h.EventPhase=M,h.ResetClassNames=J,h.UtilClassNames=j,h.createBottomSheet=it,h.createPlaceholderBottomSheet=st,h.eventPhaseToEnum=cn,h.isAnimationTimingPoints=un,h.isCommonAnimationTimingsKey=On,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
@@ -59,7 +59,8 @@ export interface BottomSheetCoreProps {
59
59
  backdropClass?: string | null;
60
60
  /**
61
61
  * Common animation timing functions such as "ease-in-out", or
62
- * four points(p1x, p1y, p2x, p2y) that express the timing of animations as a Bezier curve.
62
+ * an object {p1x: number, p1y: number, p2x: number, p2y: number} that describes the timing of animations as a Bezier curve.
63
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
63
64
  */
64
65
  draggingAnimationTimings?: CommonAnimation | AnimationTimingPoints | null;
65
66
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet-props.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-props.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AACtE,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IAGtC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAGxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAGvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,eAAe,GAAG,qBAAqB,GAAG,IAAI,CAAC;IAC1E;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"bottom-sheet-props.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-props.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AACtE,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IAGtC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAGxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAGvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,eAAe,GAAG,qBAAqB,GAAG,IAAI,CAAC;IAC1E;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC"}
@@ -12,5 +12,6 @@ export interface DraggingState {
12
12
  containerStartTranslate: Coordinates;
13
13
  isDragging: boolean;
14
14
  originalDocumentOverflowY: string | null;
15
+ originalDocumentOverscrollBehavior: string | null;
15
16
  }
16
17
  //# sourceMappingURL=bottom-sheet-state.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet-state.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-state.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAExB,+DAA+D;IAC/D,uBAAuB,EAAE,WAAW,CAAC;IAErC,UAAU,EAAE,OAAO,CAAC;IAEpB,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C"}
1
+ {"version":3,"file":"bottom-sheet-state.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-state.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAExB,+DAA+D;IAC/D,uBAAuB,EAAE,WAAW,CAAC;IAErC,UAAU,EAAE,OAAO,CAAC;IAEpB,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,kCAAkC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainsheet/core",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "description": "The minimalistic, configurable React bottom-sheet for the Web developers",