@plainsheet/core 0.7.12 → 1.0.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
- (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"})});
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;backface-visibility:"hidden"}.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(S,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(S=typeof globalThis<"u"?globalThis:S||self,H(S.BottomSheet={}))})(this,function(S){"use strict";var gn=Object.defineProperty;var hn=(S,H,y)=>H in S?gn(S,H,{enumerable:!0,configurable:!0,writable:!0,value:y}):S[H]=y;var K=(S,H,y)=>(hn(S,typeof H!="symbol"?H+"":H,y),y);var H=document.createElement("style");H.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;backface-visibility:"hidden"}.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
+ `,document.head.appendChild(H);function y(t){return typeof t=="string"}function at(t,n){return t.classList.contains(q(n))}function V(t,n){t.classList.add(q(n))}function st(t,n){t.classList.remove(q(n))}function $(t,n,e){y(e)&&(y(n)&&st(t,n),V(t,e))}function q(t){return y(t)?t.trim().replace(/\./g,""):""}function M(t){return t.map(n=>q(n)).filter(Boolean).join(" ")}const ct="open",lt="hidden";function It(t){return Mt(t)}function J(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?(V(t,ct),st(t,lt)):(V(t,lt),st(t,ct))}function Mt(t){return at(t,ct)&&!at(t,lt)}function Ct(t){return t instanceof HTMLElement}function L(t){return typeof t=="number"&&!Number.isNaN(t)}function Pt(t){Ct(t)&&t.focus()}function jt(t){if(!Ct(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=L(e)?parseInt(e,10):-1,a=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),o=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return a||o||r>-1}var E=(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))(E||{}),dt=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(dt||{}),Z=(t=>(t.Hidden="hidden",t))(Z||{});function I(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(a=>{V(r,a)}),y(e)&&r.setAttribute("data-testid",e),r}function Tt(t,n,e,r){switch(r){case"content-height":return n>=t?wt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function kt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function vt(t,n){return n<t?-(t-n):n-t}function W(t,n){return t>n?t-n:n-t}function Rt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function Et(t,n,e){const r=t==="above";return e.filter(i=>{const a=i*n.viewportHeight;return r?n.visibleHeight<a:n.visibleHeight>a})}function wt(t,n,e){return-(t-n)+e}function St(t){return Number(t.replace("px",""))}function tt(t,...n){return Number(t.toFixed(...n))}function Ht(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const i=r[1],a=r[2].split(",").map(o=>o.trim());e.push({type:i,values:a})}return e}function _t(t){const n=t.style.transform,e=Ht(n);return{transform:n,transformValues:e}}function Ot(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const ut="translate";function N(t){const n=t.style.transform,e=Ht(n),r=Ot(e,ut);return At(r??{type:ut,values:[]})}function nt(t,{x:n,y:e}){const{transform:r,transformValues:i}=_t(t),a=Ot(i,ut);if(a){const o=At(a);t.style.transform=`translate(${n??o.x??0}px,${e??o.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 At(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:St(n)??0,y:St(e)??0}}function ft(t){return t!=null}function Lt(t,{min:n,max:e}){return ft(e)&&t>=e?e:ft(n)&&t<=n?n:t}const Gt=(t,n,e)=>{n instanceof HTMLElement&&!at(n,E.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ut=(t,n,e,r)=>i=>{r.isDragging&&(r.startY=t.getCoordinates(i).y,r.containerStartTranslate=N(n),e.onDragStart())},Vt=(t,n,e,r,i)=>a=>{$t(a,t,e,r,i,n,e.marginTop)};function $t(t,n,e,r,i,a,o){if(!r.isDragging||!L(r.startY))return;const l=n.getCoordinates(t).y,s=vt(r.startY,l),g=window.innerHeight,u=a.clientHeight,m=u-(r.containerStartTranslate.y+s);if(m>=g)return;const T=kt(r.startY,l);if(T.isUp&&!e.expandable&&m>=u||e.preventClosing&&m<=u)return;i.start(()=>{nt(a,{y:r.containerStartTranslate.y+s})},0);const f=g-o,k=u-r.containerStartTranslate.y;if(T.isUp){const v=f-k,c=f-m,B=Lt(1-tt(c/v,2),{min:0,max:1});e.onDragMove(T,B)}else if(T.isDown){const v=Lt(tt(1-m/k,2),{min:0,max:1});e.onDragMove(T,v)}}const Wt=(t,n,e,r,i,a,o)=>l=>{if(!r.isDragging||(r.isDragging=!1,!L(r.startY)))return;e.onDragEnd();const s=r.startY,g=t.getCoordinates(l).y,u=N(n).y,m=kt(s,g),T=window.innerHeight,f=n.clientHeight;if(m.isUp){if(!e.expandable)return;const k=[...e.snapPoints].sort((B,F)=>B-F),v=f+-u;for(const B of k){const F=B*window.innerHeight;if(v<=F){const x=W(v,F);o.translateContainer({startY:u,endY:u-x,animationFrame:i,bottomSheetContainer:n});return}}const c=wt(T,f,e.marginTop);o.translateContainer({startY:u,endY:c,animationFrame:i,bottomSheetContainer:n})}else if(m.isDown){const k=[...e.snapPoints].sort((v,c)=>c-v);for(const v of k){const c=v*window.innerHeight,B=f+-u;if(B>=c){const F=W(B,c);o.translateContainer({startY:u,endY:u+F,animationFrame:i,bottomSheetContainer:n});return}}if(e.preventClosing){const v=f+-u;if(v>=f){const c=W(v,f);o.translateContainer({startY:u,endY:u+c,animationFrame:i,bottomSheetContainer:n})}return}a()}};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 Bt(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const zt={eventPhase:P.All};class z{constructor(n){K(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=zt,onMove:r,onEnd:i}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:i}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:i})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:i}){n&&this.currentTarget.addEventListener("touchstart",a=>{if(e.eventPhase===P.All){n(a);return}Bt(a.eventPhase)===e.eventPhase&&n(a)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),i&&this.currentTarget.addEventListener("touchend",i)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:i}){n&&this.currentTarget.addEventListener("mousedown",a=>{if(e.eventPhase===P.All){n(a);return}Bt(a.eventPhase)===e.eventPhase&&n(a)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),i&&this.currentTarget.addEventListener("mouseup",a=>{i(a)})}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 xt(t){const n=t;return`${n} ${n} 0px 0px`}function Xt(t,n){const e=Kt(t);qt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const i=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${i}px`,e.bottomSheetContentWrapper.appendChild(r);const a=Jt({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:a}}function Kt(t){const n=I("dialog",M([E.Root,dt.Dialog,t.rootClass]),E.Root);n.ariaLabel=t.ariaLabel;const e=I("section",M([E.Container,t.containerClass]),E.Container);t.containerBorderRadius&&(e.style.borderRadius=xt(t.containerBorderRadius));const r=I("div",E.GapFiller,E.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const i=I("button",M([E.Handle,dt.Button,t.shouldShowHandle?null:Z.Hidden,t.handleClass]),E.Handle);i.setAttribute("type","button"),i.ariaLabel="bottom sheet close button";const a=I("span",M([E.HandleBar,t.shouldShowHandle?null:Z.Hidden]),E.HandleBar),o=I("article",M([E.ContentWrapper,t.contentWrapperClass]),E.ContentWrapper),l=I("div",M([E.Backdrop,t.backdropClass,Z.Hidden]),E.Backdrop);return t.backdropColor&&(l.style.backgroundColor=t.backdropColor),t.backDropTransition&&(l.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:l,bottomSheetContainer:e,bottomSheetHandle:i,bottomSheetHandleBar:a,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:r}}function qt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:i,bottomSheetContainerGapFiller:a}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(i),n.appendChild(a)}function Jt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:i,bottomSheetHandle:a,bottomSheetContainerGapFiller:o,bottomSheetContentWrapper:l,bottomSheetBackdrop:s}=t,{animationFrame:g}=e,u=new z(a),m=new z(l),T=new z(o);let f=[];const k=new z(window),v=Ut(k,i,n,e.draggingState),c=Vt(k,i,n,e.draggingState,g),B=Wt(k,i,n,e.draggingState,g,e.onClose,e.bottomSheetState);function F(O){O.target instanceof Element&&!r.contains(O.target)&&e.onClose()}function x(O){Gt(e.draggingState,O.target,t.bottomSheetContentWrapper)}function et(O){const A=O??n;A.draggable&&A.backgroundDraggable&&(m.addEventListeners({onStart:x,onStartOptions:{eventPhase:P.Target}}),T.addEventListeners({onStart:x})),A.draggable&&k.addEventListeners({onStart:v,onMove:c,onEnd:B}),A.draggable&&window.document.addEventListener("keyup",C=>{C.key==="Escape"&&e.onClose()}),a.addEventListener("keyup",C=>{if(C.key==="ArrowUp"){e.moveUp();return}if(C.key==="ArrowDown"){e.moveDown();return}if(C.shiftKey&&C.key==="Tab"){const X=pt(t.bottomSheetContentWrapper);Pt(X)}})}function rt(O){const A=O??n;n.shouldCloseOnOutsideClick&&!n.preventClosing?s.addEventListener("click",F):s.style.pointerEvents="none",A.draggable&&(u.addEventListeners({onStart:x}),f.forEach(C=>{C.removeEventListeners({onStart:x})}),f=n.dragTriggers.reduce((C,X)=>{const ot=r.querySelectorAll(X);if(!ot.length)return C;const it=Array.from(ot).map(d=>d instanceof HTMLElement?new z(d):null).filter(d=>!!d);return[...C,...it]},[]),f.forEach(C=>{C.addEventListeners({onStart:x,onStartOptions:{eventPhase:P.Target}})}))}function U(){s.removeEventListener("click",F)}function pt(O){let A=[...Array.from(O.childNodes).reverse()];for(;A.length;){const C=A.shift();if(jt(C))return C;C&&(A=[...A,...Array.from(C.childNodes).reverse()])}return null}function yt(){u.removeEventListeners({onStart:x}),m.removeEventListeners({onStart:x}),T.removeEventListeners({onStart:x}),f.forEach(O=>{O.removeEventListeners({onStart:x})}),k.removeEventListeners({onStart:v,onMove:c,onEnd:B})}return{attachEventListeners:et,clearEventListeners:yt,attacheOnOpenEventListeners:rt,clearOnOpenEventListeners:U}}class Dt{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 i=a=>{this.startedAt||(this.startedAt=a);const o=a-this.startedAt,s=e===0?1:tt(o/e,2),g=s>=1&&!r;n(s),g?this.stop():this.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}stop(){this.isInProgress=!1,this.startedAt=null,L(this.animationId)&&cancelAnimationFrame(this.animationId)}}function Qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:i,onEnd:a,animationTimingFunction:o,animationDuration:l}=t,s=vt(n,e);i.stop();let g=!1;i.start(u=>{nt(r,{y:n+s*o(u)}),!g&&u>=1&&(a==null||a(),g=!0)},l)}const gt=(t,n)=>e=>{Qt({...e,animationTimingFunction:t,animationDuration:n})};function Zt(t){const{backdrop:n,animationFrame:e,animationTimingFunction:r,animationDuration:i,onEnd:a}=t;e.stop();let o=!1;e.start(l=>{Object.entries(t.styleCreators).forEach(([s,g])=>{n.style[s]=g(Number(r(l).toFixed(2)))}),!o&&l>=1&&(a==null||a(),o=!0)},i)}const ht=(t,n)=>e=>{Zt({...e,animationTimingFunction:t,animationDuration:n})},j={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function tn(t){return!(!L(t)||t>1||t<0)}function nn(t,n){const e={set(r,i,a,o){return n(i,a),Reflect.set(r,i,a,o)}};return new Proxy(t,e)}function en(...t){console.error(t)}const R={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function bt(t){for(const n of Object.values(R))if(n===t)return!0;return!1}function mt(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&L(t.p1x)&&L(t.p1y)&&L(t.p2x)&&L(t.p2y))}function _(t,n,e,r){return function(s){return l(a(s))};function a(s){let g=0,u=1,m=s,T;if(s===0||s===1)return s;for(;g<u;){if(T=o(m),Math.abs(T-s)<.001)return m;s>T?g=m:u=m,m=(u+g)/2}return m}function o(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function l(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const Yt=_(.25,.1,.25,1),rn=_(.42,0,1,1),Ft=_(.42,0,.58,1),on=_(.4,.1,.6,1),an=_(.45,1.5,.55,1);function sn(t){switch(t){case R.EASE:return Yt;case R.EASE_IN:return rn;case R.EASE_OUT:return Ft;case R.EASE_IN_OUT:return on;case R.SPRING:return an;default:return Yt}}function Nt(t){return typeof t=="boolean"}const cn={ariaLabel:"Bottom sheet",content:"",defaultPosition:j.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,backdropAnimationTimings:"ease-out",backdropAnimationDuration:180,backdropAnimStyleCreators:{opacity:t=>`${1-t}`},rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function ln(t){const n={...cn},e=Object.entries(t).reduce((i,a)=>{const[o,l]=a;return ft(l)&&(i[o]=l),i},{});return{...n,...e}}function G(t){if(mt(t)){const{p1x:n,p1y:e,p2x:r,p2y:i}=t;return _(n,e,r,i)}return bt(t)?sn(t):Ft}function dn(t,n,e,r){function i(a,o){switch(a){case"content":y(o)&&(t.bottomSheetContentWrapper.innerHTML=o);break;case"width":y(o)&&(t.bottomSheetContainer.style.width=o);break;case"shouldShowHandle":Nt(o)||Q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Nt(o)||Q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":y(o)&&(t.bottomSheetContainer.style.borderRadius=xt(o));break;case"containerBackgroundColor":y(o)&&(t.bottomSheetContainer.style.backgroundColor=o,t.bottomSheetContainerGapFiller.style.backgroundColor=o);break;case"backdropColor":y(o)&&(t.bottomSheetBackdrop.style.backgroundColor=o);break;case"backDropTransition":y(o)&&(t.bottomSheetBackdrop.style.transition=o);break;case"rootClass":if(!y(o))return;$(t.bottomSheetRoot,e.rootClass,o);break;case"containerClass":if(!y(o))return;$(t.bottomSheetContainer,e.containerClass,o);break;case"handleClass":if(!y(o))return;$(t.bottomSheetHandle,e.handleClass,o);break;case"contentWrapperClass":if(!y(o))return;$(t.bottomSheetContentWrapper,e.contentWrapperClass,o);break;case"backdropClass":if(!y(o))return;$(t.bottomSheetBackdrop,e.backdropClass,o);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(mt(o)||bt(o)){const l=G(o),s=gt(l,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(L(o)){const l=G(e.draggingAnimationTimings),s=gt(l,o);n.translateContainer=s}break;case"backdropAnimationTimings":if(mt(o)||bt(o)){const l=G(o),s=ht(l,e.backdropAnimationDuration);n.animateBackdrop=s}break;case"backdropAnimationDuration":if(L(o)){const l=G(e.backdropAnimationTimings),s=ht(l,o);n.animateBackdrop=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 i}function un(t){const n=ln(t),e=G(t.draggingAnimationTimings),r=gt(e,n.draggingAnimationDuration),i=G(t.backdropAnimationTimings),a=ht(i,n.backdropAnimationDuration),o={isMounted:!1,translateContainer:r,animateBackdrop:a},l={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function s(){l.originalDocumentOverflowY&&l.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=l.originalDocumentOverflowY),l.originalDocumentOverscrollBehavior&&(document.body.style.position=l.originalDocumentOverscrollBehavior)}const g=new Dt,u={animationFrame:g,onClose:et,bottomSheetState:o,draggingState:l,snapTo:it,moveUp:X,moveDown:ot},{elements:m,eventHandlers:T}=Xt(n,u),f=nn(n,dn(m,o,n,T)),{bottomSheetBackdrop:k,bottomSheetRoot:v,bottomSheetContainer:c}=m,B=d=>{const b=d??window.document.body;b.appendChild(v),b.appendChild(k);const p=window.innerHeight;nt(c,{y:p}),T.attachEventListeners(),o.isMounted=!0},F=()=>{T.clearEventListeners(),Object.values(m).forEach(d=>{d.remove()}),s(),o.isMounted=!1},x=()=>{var Y;if(rt()||en('Bottom Sheet is not mounted yet. call the "mount" method first.'),(Y=t.beforeOpen)==null||Y.call(t),U())return;J(k,!0),f.shouldShowBackdrop||V(k,"transparent"),J([c],!0),nt(c,{y:c.clientHeight});const b=window.innerHeight,p=Tt(b,c.clientHeight,f.marginTop,f.defaultPosition),h=N(c).y;o.translateContainer({startY:h,endY:p,animationFrame:g,bottomSheetContainer:c,onEnd:t.afterOpen});const w=document.body.style.overflowY;l.originalDocumentOverflowY=w||"initial";const D=document.body.style.overscrollBehavior;l.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",m.bottomSheetHandle.focus(),T.attacheOnOpenEventListeners()};function et(){var p;if(!It(c))return;(p=t.beforeClose)==null||p.call(t);const d=N(c).y,b=c.clientHeight;if(o.translateContainer({startY:d,endY:b,animationFrame:g,bottomSheetContainer:c,onEnd:()=>{var h;(h=t.afterClose)==null||h.call(t),J([c],!1),T.clearOnOpenEventListeners()}}),Object.keys(f.backdropAnimStyleCreators).length>0){const h=new Dt;o.animateBackdrop({animationFrame:h,backdrop:k,styleCreators:f.backdropAnimStyleCreators,onEnd:()=>{J([k],!1),k.style.opacity="1"}})}s()}function rt(){return o.isMounted}function U(){const d=N(c).y,b=window.innerHeight,p=c.clientHeight>=b?b:c.clientHeight;return d<=p}function pt(){return!U()}function yt(){const d=N(c).y,b=c.clientHeight,p=window.innerHeight;if(d<=5&&d>=-5)return j.CONTENT_HEIGHT;const h=b-d;if(h===p/2)return j.MIDDLE;const w=p-f.marginTop,D=10;return h<=w+D&&h>=w-D?j.TOP:j.CLOSED}function O(){return c.clientHeight}function A(d){if(!U())return;const b=N(c).y,h=c.clientHeight-b,w=window.innerHeight-d,D=Rt(h,w),Y=W(h,w);o.translateContainer({startY:b,endY:b+(D.isUp?-Y:Y),animationFrame:g,bottomSheetContainer:c})}function C(d,{viewportHeight:b,visibleHeight:p}){let h=null;for(const w of d){const D=w*b,Y=W(p,D);(h===null||Y<h)&&(h=Y)}return{minOffset:h}}function X(){const d=[...f.snapPoints].reverse(),b=N(c).y,p=c.clientHeight,h=p-b;if(!f.expandable&&h>=p)return;const w=window.innerHeight,D=Et("above",{visibleHeight:h,viewportHeight:w},d),{minOffset:Y}=C(D,{visibleHeight:h,viewportHeight:w});if(Y===null&&h<w-f.marginTop){o.translateContainer({startY:b,endY:Tt(w,p,f.marginTop,"top"),animationFrame:g,bottomSheetContainer:c});return}L(Y)&&o.translateContainer({startY:b,endY:b-Y,animationFrame:g,bottomSheetContainer:c})}function ot(){const d=N(c).y,p=c.clientHeight-d;if(p<1)return;const h=window.innerHeight,w=Et("below",{visibleHeight:p,viewportHeight:h},f.snapPoints),{minOffset:D}=C(w,{visibleHeight:p,viewportHeight:h});L(D)&&o.translateContainer({startY:d,endY:d+D,animationFrame:g,bottomSheetContainer:c})}function it(d){const b=window.innerHeight;if(!tn(d))return;const p=tt(b*d,2);A(p)}return{props:f,elements:m,mount:B,unmount:F,open:x,close:et,getIsMounted:rt,getIsOpen:U,getIsClosed:pt,getPosition:yt,getHeight:O,moveTo:A,snapTo:it}}function fn(){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:()=>j.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}S.ClassNames=E,S.createBottomSheet=un,S.createPlaceholderBottomSheet=fn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,6 @@
1
- import { DraggingDirection } from '../calculator/position-calculator.type';
2
1
  import { AnimationTimingPoints, CommonAnimation } from '../utils/animation/animation.type';
2
+ import { DraggingDirection } from '../calculator/position-calculator.type';
3
+ import { StyleCreators } from '../animation/animation.type';
3
4
 
4
5
  export type RequiredBottomSheetProps = Required<BottomSheetCoreProps>;
5
6
  export interface BottomSheetCoreProps {
@@ -82,6 +83,20 @@ export interface BottomSheetCoreProps {
82
83
  * In milliseconds.
83
84
  */
84
85
  draggingAnimationDuration?: number;
86
+ /**
87
+ * Common animation timing functions such as "ease-in-out", or
88
+ * an object {p1x: number, p1y: number, p2x: number, p2y: number} that describes the timing of animations as a Bezier curve.
89
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
90
+ */
91
+ backdropAnimationTimings?: DraggingAnimationTimings;
92
+ /**
93
+ * In milliseconds.
94
+ */
95
+ backdropAnimationDuration?: number;
96
+ /**
97
+ * Style creators used for animating the backdrop.
98
+ */
99
+ backdropAnimStyleCreators?: StyleCreators;
85
100
  }
86
101
  export type DraggingAnimationTimings = CommonAnimation | AnimationTimingPoints | null;
87
102
  export declare const BOTTOM_SHEET_POSITION: {
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet-props.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-props.type.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"bottom-sheet-props.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-props.type.ts"],"names":[],"mappings":"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"}
@@ -1,9 +1,10 @@
1
- import { translateContainerWithAnim } from '../animation/animation';
2
1
  import { Coordinates, Position } from '../animation/animation.type';
2
+ import { animateBackdropWithAnim, translateContainerWithAnim } from '../animation/animation';
3
3
 
4
4
  export interface BottomSheetState {
5
5
  isMounted: boolean;
6
6
  translateContainer: ReturnType<typeof translateContainerWithAnim>;
7
+ animateBackdrop: ReturnType<typeof animateBackdropWithAnim>;
7
8
  }
8
9
  export interface DraggingState {
9
10
  /** Used to know how far the cursor moved. */
@@ -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;IACzC,kCAAkC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnD"}
1
+ {"version":3,"file":"bottom-sheet-state.type.d.ts","sourceRoot":"","sources":["../../src/types/bottom-sheet-state.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,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;IAClE,eAAe,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;CAC7D;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"}
@@ -1,6 +1,6 @@
1
- import { BottomSheetElements } from '../initializer/bottom-sheet-initializer';
2
- import { BottomSheetPosition, BottomSheetCoreProps } from './bottom-sheet-props.type';
3
1
  import { BottomSheetState } from './bottom-sheet-state.type';
2
+ import { BottomSheetPosition, BottomSheetCoreProps } from './bottom-sheet-props.type';
3
+ import { BottomSheetElements } from '../initializer/bottom-sheet-initializer';
4
4
 
5
5
  export interface BottomSheetCore {
6
6
  /**
@@ -18,6 +18,6 @@ export declare const COMMON_ANIMATION_KEYS: {
18
18
  readonly EASE_IN_OUT: "ease-in-out";
19
19
  readonly SPRING: "spring";
20
20
  };
21
- export declare function isCommonAnimationTimingsKey(value: unknown): value is CommonAnimationKey;
21
+ export declare function isCommonAnimationTimingsKey(value: unknown): value is CommonAnimation;
22
22
  export declare function isAnimationTimingPoints(value: unknown): value is AnimationTimingPoints;
23
23
  //# sourceMappingURL=animation.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"animation.type.d.ts","sourceRoot":"","sources":["../../../src/utils/animation/animation.type.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AAEtE,eAAO,MAAM,qBAAqB;;;;;;CAMxB,CAAC;AAEX,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,kBAAkB,CAQ7B;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAgBhC"}
1
+ {"version":3,"file":"animation.type.d.ts","sourceRoot":"","sources":["../../../src/utils/animation/animation.type.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAAG,OAAO,qBAAqB,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,MAAM,mBAAmB,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AAEtE,eAAO,MAAM,qBAAqB;;;;;;CAMxB,CAAC;AAEX,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,eAAe,CAQ1B;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAgBhC"}
@@ -1,5 +1,5 @@
1
- import { Coordinates } from '../../animation/animation.type';
2
1
  import { TransformValue } from './transform';
2
+ import { Coordinates } from '../../animation/animation.type';
3
3
 
4
4
  export declare function getTranslate(element: HTMLElement): Coordinates;
5
5
  export declare function setTranslate(element: HTMLElement, { x, y }: Partial<Coordinates>): void;
@@ -1,3 +1,5 @@
1
+ export declare function getVisibility(element: Element): boolean;
1
2
  export declare function setVisibility(element: Element | Element[], visibility: boolean): void;
2
3
  export declare function setHiddenClass(element: Element, shouldOpen: boolean): void;
4
+ export declare function getHiddenClass(element: Element): boolean;
3
5
  //# sourceMappingURL=visibility.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/utils/dom/visibility.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,EAC5B,UAAU,EAAE,OAAO,GAClB,IAAI,CAgBN;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAQ1E"}
1
+ {"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/utils/dom/visibility.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,EAC5B,UAAU,EAAE,OAAO,GAClB,IAAI,CAgBN;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAQ1E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAExD"}
@@ -1,5 +1,5 @@
1
- import { Coordinates } from '../../animation/animation.type';
2
1
  import { EventPhase } from './EventPhase';
2
+ import { Coordinates } from '../../animation/animation.type';
3
3
 
4
4
  export interface AddEventListenersParams {
5
5
  onStart?: EventCallback;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@plainsheet/core",
3
- "version": "0.7.12",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
- "description": "The minimalistic, configurable React bottom-sheet for the Web developers",
6
+ "description": "The minimalistic, configurable bottom-sheet for the Web developers",
7
7
  "keywords": [
8
8
  "ui",
9
9
  "component",
@@ -42,8 +42,9 @@
42
42
  "vite-plugin-css-injected-by-js": "^3.5.0",
43
43
  "vite-plugin-dts": "^3.8.1",
44
44
  "vitest": "^1.6.1",
45
- "@internal/eslint-config": "0.0.0",
46
- "@internal/typescript-config": "0.0.0"
45
+ "@plainsheet/utility": "0.0.3",
46
+ "@internal/typescript-config": "0.0.0",
47
+ "@internal/eslint-config": "0.0.0"
47
48
  },
48
49
  "scripts": {
49
50
  "dev": "vite build --watch --mode development --emptyOutDir=false",