@plainsheet/core 0.7.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,5 +1,5 @@
1
- import { AnimationFrame } from '../utils/animation/animation-frame';
2
1
  import { AnimationTimingFunction } from '../utils/animation/animation.type';
2
+ import { AnimationFrame } from '../utils/animation/animation-frame';
3
3
 
4
4
  export interface TranslateContainerParams {
5
5
  startY: number;
@@ -1,5 +1,5 @@
1
- import { BottomSheetCore } from './types/bottom-sheet.type';
2
1
  import { BottomSheetCoreProps } from './types/bottom-sheet-props.type';
2
+ import { BottomSheetCore } from './types/bottom-sheet.type';
3
3
 
4
4
  export declare function createBottomSheet(props: BottomSheetCoreProps): BottomSheetCore;
5
5
  //# sourceMappingURL=bottom-sheet.d.ts.map
@@ -1,5 +1,5 @@
1
- import { DraggingDirection } from './position-calculator.type';
2
1
  import { BottomSheetPosition, SnapPoints } from '../types/bottom-sheet-props.type';
2
+ import { DraggingDirection } from './position-calculator.type';
3
3
 
4
4
  /** It expects the bottom sheet to be open. */
5
5
  export declare function convertDefaultPositionToYCoordinate(viewportHeight: number, containerHeight: number, marginTop: number, position: BottomSheetPosition): number;
@@ -1,7 +1,7 @@
1
- import { BottomSheetCoreProps } from '../types/bottom-sheet-props.type';
2
- import { TabEvent, TabEventListener } from '../utils/event-listeners/TabEventListener';
3
- import { AnimationFrame } from '../utils/animation/animation-frame';
4
1
  import { BottomSheetState, DraggingState } from '../types';
2
+ import { AnimationFrame } from '../utils/animation/animation-frame';
3
+ import { TabEvent, TabEventListener } from '../utils/event-listeners/TabEventListener';
4
+ import { BottomSheetCoreProps } from '../types/bottom-sheet-props.type';
5
5
 
6
6
  export declare const handleDragTriggerClick: (draggingState: DraggingState, eventTrigger: EventTarget | null, contentWrapper: HTMLElement) => void;
7
7
  export declare const handleDragStart: (mouseEventListener: TabEventListener, bottomSheetContainer: HTMLElement, bottomSheetProps: Required<BottomSheetCoreProps>, draggingState: DraggingState) => (event: TabEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"dragging-handler.d.ts","sourceRoot":"","sources":["../../src/event-handlers/dragging-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AASjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EACjB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAI7E,eAAO,MAAM,sBAAsB,kBAClB,aAAa,gBACd,WAAW,GAAG,IAAI,kBAChB,WAAW,KAC1B,IAYF,CAAC;AAEF,eAAO,MAAM,eAAe,uBAEJ,gBAAgB,wBACd,WAAW,oBACf,SAAS,oBAAoB,CAAC,iBACjC,aAAa,aAEtB,QAAQ,SAKf,CAAC;AAEJ,eAAO,MAAM,cAAc,uBAEH,gBAAgB,wBACd,WAAW,oBACf,SAAS,oBAAoB,CAAC,iBACjC,aAAa,kBACZ,cAAc,aAExB,QAAQ,SAUf,CAAC;AA+EJ,eAAO,MAAM,aAAa,kBAEP,gBAAgB,wBACT,WAAW,oBACf,SAAS,oBAAoB,CAAC,iBACjC,aAAa,kBACZ,cAAc,WACrB,MAAM,IAAI,oBACD,gBAAgB,aAE5B,QAAQ,SAqGf,CAAC"}
1
+ {"version":3,"file":"dragging-handler.d.ts","sourceRoot":"","sources":["../../src/event-handlers/dragging-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AASjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EACjB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAI7E,eAAO,MAAM,sBAAsB,kBAClB,aAAa,gBACd,WAAW,GAAG,IAAI,kBAChB,WAAW,KAC1B,IAYF,CAAC;AAEF,eAAO,MAAM,eAAe,uBAEJ,gBAAgB,wBACd,WAAW,oBACf,QAAQ,CAAC,oBAAoB,CAAC,iBACjC,aAAa,aAEtB,QAAQ,SAKf,CAAC;AAEJ,eAAO,MAAM,cAAc,uBAEH,gBAAgB,wBACd,WAAW,oBACf,QAAQ,CAAC,oBAAoB,CAAC,iBACjC,aAAa,kBACZ,cAAc,aAExB,QAAQ,SAUf,CAAC;AA+EJ,eAAO,MAAM,aAAa,kBAEP,gBAAgB,wBACT,WAAW,oBACf,QAAQ,CAAC,oBAAoB,CAAC,iBACjC,aAAa,kBACZ,cAAc,WACrB,MAAM,IAAI,oBACD,gBAAgB,aAE5B,QAAQ,SAqGf,CAAC"}
@@ -1,6 +1,6 @@
1
- import { BottomSheetCoreProps } from '../types/bottom-sheet-props.type';
2
- import { AnimationFrame } from '../utils/animation/animation-frame';
3
1
  import { BottomSheetState, DraggingState } from '../types';
2
+ import { AnimationFrame } from '../utils/animation/animation-frame';
3
+ import { BottomSheetCoreProps } from '../types/bottom-sheet-props.type';
4
4
 
5
5
  export interface InitializerOptions {
6
6
  animationFrame: AnimationFrame;
@@ -1,7 +1,7 @@
1
- import { BottomSheetElements } from './bottom-sheet-initializer';
2
- import { ObserverSetHandler } from '../utils/proxy/observe';
3
- import { AnimationTimingFunction } from '../utils';
4
1
  import { BottomSheetCoreProps, BottomSheetState, RequiredBottomSheetProps } from '../types';
2
+ import { AnimationTimingFunction } from '../utils';
3
+ import { ObserverSetHandler } from '../utils/proxy/observe';
4
+ import { BottomSheetElements } from './bottom-sheet-initializer';
5
5
 
6
6
  export declare function overwriteDefaultProps(props: BottomSheetCoreProps): RequiredBottomSheetProps;
7
7
  export declare function interpretAnimationTimingsProp(draggingAnimationTimings: BottomSheetCoreProps["draggingAnimationTimings"]): AnimationTimingFunction;
@@ -1,2 +1,2 @@
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
- "use strict";var St=Object.defineProperty;var kt=(t,n,e)=>n in t?St(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var W=(t,n,e)=>(kt(t,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(t){return typeof t=="string"}function Bt(t,n){return t.classList.contains(tt(n))}function K(t,n){t.classList.add(tt(n))}function et(t,n){t.classList.remove(tt(n))}function G(t,n,e){y(e)&&(y(n)&&et(t,n),K(t,e))}function tt(t){return y(t)?t.trim().replace(/\./g,""):""}function R(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function Yt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const ut="open",dt="hidden";function nt(t,n){const e=n;if(Array.isArray(t)){t.forEach(o=>{z(o,e),o.setAttribute("aria-modal",e?"true":"false")});return}z(t,e),t.setAttribute("aria-modal",e?"true":"false")}function z(t,n){n?(K(t,ut),et(t,dt)):(K(t,dt),et(t,ut))}function bt(t){return t instanceof HTMLElement}function S(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){bt(t)&&t.focus()}function Nt(t){if(!bt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),o=S(e)?parseInt(e,10):-1,r=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),c=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return r||c||o>-1}var b=(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))(b||{}),q=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(q||{}),$=(t=>(t.Hidden="hidden",t))($||{});function I(t,n,e){const o=document.createElement(t);return n.split(" ").forEach(r=>{K(o,r)}),y(e)&&o.setAttribute("data-testid",e),o}const Mt={CONTENTS_WRAPPER:Yt([b.Root,b.ContentWrapper])};function ft(t,n,e,o){switch(o){case"content-height":return n>=t?vt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Ct(t,n){const e=n<t,o=n>t;return{isUp:e,isDown:o,stayedSame:n===t}}function Et(t,n){return n<t?-(t-n):n-t}function J(t,n){return t>n?t-n:n-t}function Pt(t,n){const e=t<n,o=t>n;return{isUp:e,isDown:o,stayedSame:t===n}}function gt(t,n,e){const o=t==="above";return e.filter(i=>{const r=i*n.viewportHeight;return o?n.visibleHeight<r:n.visibleHeight>r})}function vt(t,n,e){return-(t-n)+e}function ht(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function wt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let o;for(;(o=n.exec(t))!==null;){const i=o[1],r=o[2].split(",").map(c=>c.trim());e.push({type:i,values:r})}return e}function xt(t){const n=t.style.transform,e=wt(n);return{transform:n,transformValues:e}}function Ht(t,n){const e=t.find(o=>o.type.startsWith(n));return e||null}const rt="translate";function Y(t){const n=t.style.transform,e=wt(n),o=Ht(e,rt);return yt(o??{type:rt,values:[]})}function Z(t,{x:n,y:e}){const{transform:o,transformValues:i}=xt(t),r=Ht(i,rt);if(r){const c=yt(r);t.style.transform=`translate(${n??c.x??0}px,${e??c.y??0}px)`;return}if(o){t.style.transform=`${o}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function yt(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:ht(n)??0,y:ht(e)??0}}function ot(t){return t!=null}function mt(t,{min:n,max:e}){return ot(e)&&t>=e?e:ot(n)&&t<=n?n:t}const _t=(t,n,e)=>{n instanceof HTMLElement&&!Bt(n,b.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,o)=>i=>{o.startY=t.getCoordinates(i).y,o.containerStartTranslate=Y(n),e.onDragStart()},Rt=(t,n,e,o,i)=>r=>{Ut(r,t,e,o,i,n,e.marginTop)};function Ut(t,n,e,o,i,r,c){if(!o.isDragging||!S(o.startY))return;const l=n.getCoordinates(t).y,a=Et(o.startY,l),p=window.innerHeight,g=r.clientHeight,u=g-(o.containerStartTranslate.y+a);if(u>=p)return;const C=Ct(o.startY,l);if(C.isUp&&!e.expandable&&u>=g)return;i.start(()=>{Z(r,{y:o.containerStartTranslate.y+a})},0);const H=p-c,s=g-o.containerStartTranslate.y;if(C.isUp){const v=H-s,O=H-u,A=mt(1-Q(O/v,2),{min:0,max:1});e.onDragMove(C,A)}else if(C.isDown){const v=mt(Q(1-u/s,2),{min:0,max:1});e.onDragMove(C,v)}}const Wt=(t,n,e,o,i,r,c)=>l=>{if(!o.isDragging||(o.isDragging=!1,!S(o.startY)))return;e.onDragEnd();const a=o.startY,p=t.getCoordinates(l).y,g=Y(n).y,u=Ct(a,p),C=window.innerHeight,H=n.clientHeight;if(u.isUp){const s=[...e.snapPoints].sort((A,E)=>A-E),v=H+-g;if(!e.expandable&&v>=H)return;for(const A of s){const E=A*window.innerHeight;if(v<=E){const x=J(v,E);c.translateContainer({startY:g,endY:g-x,animationFrame:i,bottomSheetContainer:n});return}}const O=vt(C,H,e.marginTop);c.translateContainer({startY:g,endY:O,animationFrame:i,bottomSheetContainer:n})}else if(u.isDown){const s=[...e.snapPoints].sort((v,O)=>O-v);for(const v of s){const O=v*window.innerHeight,A=H+-g;if(A>=O){const E=J(A,O);c.translateContainer({startY:g,endY:g+E,animationFrame:i,bottomSheetContainer:n});return}}r()}};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 it(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gt={eventPhase:P.All};class V{constructor(n){W(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Gt,onMove:o,onEnd:i}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}){n&&this.currentTarget.addEventListener("touchstart",r=>{if(e.eventPhase===P.All){n(r);return}it(r.eventPhase)===e.eventPhase&&n(r)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),i&&this.currentTarget.addEventListener("touchend",i)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}){n&&this.currentTarget.addEventListener("mousedown",r=>{if(e.eventPhase===P.All){n(r);return}it(r.eventPhase)===e.eventPhase&&n(r)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),i&&this.currentTarget.addEventListener("mouseup",r=>{i(r)})}removeEventListeners({onStart:n,onMove:e,onEnd:o}){n&&this.currentTarget.removeEventListener("touchstart",n),o&&this.currentTarget.removeEventListener("touchend",o),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),o&&this.currentTarget.removeEventListener("mouseup",o)}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 Vt(t,n){const e=$t(t);Xt(e),e.bottomSheetContainer.style.width=t.width;const o=document.createElement("div");o.innerHTML=t.content??"";const i=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${i}px`,e.bottomSheetContentWrapper.appendChild(o);const r=jt({bottomSheetElements:e,bottomSheetProps:t,options:n});return{elements:e,eventHandlers:r}}function $t(t){const n=I("dialog",R([b.Root,q.Dialog,t.rootClass]),b.Root);n.ariaLabel=t.ariaLabel;const e=I("section",R([b.Container,t.containerClass]),b.Container);t.containerBorderRadius&&(e.style.borderRadius=t.containerBorderRadius);const o=I("div",b.GapFiller,b.GapFiller),i=I("button",R([b.Handle,q.Button,t.shouldShowHandle?null:$.Hidden,t.handleClass]),b.Handle);i.setAttribute("type","button"),i.ariaLabel="bottom sheet close button";const r=I("span",R([b.HandleBar,t.shouldShowHandle?null:$.Hidden]),b.HandleBar),c=I("article",R([b.ContentWrapper,t.contentWrapperClass]),b.ContentWrapper),l=I("div",R([b.Backdrop,t.backdropClass,$.Hidden]),b.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:r,bottomSheetContentWrapper:c,bottomSheetContainerGapFiller:o}}function Xt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:o,bottomSheetContentWrapper:i,bottomSheetContainerGapFiller:r}){t.appendChild(n),e.appendChild(o),n.appendChild(e),n.appendChild(i),n.appendChild(r)}function jt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:o,bottomSheetContainer:i,bottomSheetHandle:r,bottomSheetContainerGapFiller:c,bottomSheetContentWrapper:l}=t,{animationFrame:a}=e,p=new V(r),g=new V(l),u=new V(c),C=n.dragTriggers.reduce((T,k)=>{const B=o.querySelectorAll(k);if(!B.length)return T;const j=Array.from(B).map(F=>F instanceof HTMLElement?new V(F):null).filter(F=>!!F);return[...T,...j]},[]),H=new V(window),s=Ft(H,i,n,e.draggingState),v=Rt(H,i,n,e.draggingState,a),O=Wt(H,i,n,e.draggingState,a,e.onClose,e.bottomSheetState);function A(T){T.target instanceof Element&&!o.contains(T.target)&&e.onClose()}function E(T){_t(e.draggingState,T.target,t.bottomSheetContentWrapper)}function x(){n.draggable&&(p.addEventListeners({onStart:E}),C.forEach(T=>{T.addEventListeners({onStart:E,onStartOptions:{eventPhase:P.Target}})})),n.draggable&&n.backgroundDraggable&&(g.addEventListeners({onStart:E,onStartOptions:{eventPhase:P.Target}}),u.addEventListeners({onStart:E})),n.draggable&&H.addEventListeners({onStart:s,onMove:v,onEnd:O}),n.draggable&&window.document.addEventListener("keyup",T=>{T.key==="Escape"&&e.onClose()}),n.shouldCloseOnOutsideClick&&window.document.addEventListener("click",A),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 k=_(t.bottomSheetContentWrapper);It(k)}})}function _(T){let k=[...Array.from(T.childNodes).reverse()];for(;k.length;){const B=k.shift();if(Nt(B))return B;B&&(k=[...k,...Array.from(B.childNodes).reverse()])}return null}function X(){p.removeEventListeners({onStart:E}),g.removeEventListeners({onStart:E}),u.removeEventListeners({onStart:E}),C.forEach(T=>{T.removeEventListeners({onStart:E})}),H.removeEventListeners({onStart:s,onMove:v,onEnd:O}),window.removeEventListener("click",A)}return{attachEventListeners:x,clearEventListeners:X}}class Kt{constructor(){W(this,"animationId");W(this,"isInProgress");W(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,o=!1){this.isInProgress=!0;const i=r=>{this.startedAt||(this.startedAt=r);const c=r-this.startedAt,a=e===0?1:Q(c/e,2),p=a>=1&&!o;n(a),p?this.stop():this.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}stop(){this.isInProgress=!1,this.startedAt=null,S(this.animationId)&&cancelAnimationFrame(this.animationId)}}function zt(t){const{startY:n,endY:e,bottomSheetContainer:o,animationFrame:i,onEnd:r,animationTimingFunction:c,animationDuration:l}=t,a=Et(n,e);i.stop();let p=!1;i.start(g=>{Z(o,{y:n+a*c(g)}),!p&&g>=1&&(r==null||r(),p=!0)},l)}const st=(t,n)=>e=>{zt({...e,animationTimingFunction:t,animationDuration:n})},M={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function qt(t){return!(!S(t)||t>1||t<0)}function Jt(t,n){const e={set(o,i,r,c){return n(i,r),Reflect.set(o,i,r,c)}};return new Proxy(t,e)}function Qt(...t){console.error(t)}const N={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Ot(t){for(const n of Object.values(N))if(n===t)return!0;return!1}function ct(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&S(t.p1x)&&S(t.p1y)&&S(t.p2x)&&S(t.p2y))}function U(t,n,e,o){return function(a){return l(r(a))};function r(a){let p=0,g=1,u=a,C;if(a===0||a===1)return a;for(;p<g;){if(C=c(u),Math.abs(C-a)<.001)return u;a>C?p=u:g=u,u=(g+p)/2}return u}function c(a){return 3*t*a*Math.pow(1-a,2)+3*e*Math.pow(a,2)*(1-a)+Math.pow(a,3)}function l(a){return 3*n*a*Math.pow(1-a,2)+3*o*Math.pow(a,2)*(1-a)+Math.pow(a,3)}}const Zt=U(.25,.1,.25,1),tn=U(.42,0,1,1),At=U(.42,0,.58,1),pt=U(.4,.1,.6,1),nn=U(.45,1.5,.55,1);function en(t){switch(t){case N.EASE:return Zt;case N.EASE_IN:return tn;case N.EASE_OUT:return At;case N.EASE_IN_OUT:return pt;case N.SPRING:return nn;default:return pt}}function Tt(t){return typeof t=="boolean"}const Lt={ariaLabel:"Bottom sheet",content:"",defaultPosition:M.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 rn(t){const n={...Lt},e=Object.entries(t).reduce((i,r)=>{const[c,l]=r;return ot(l)&&(i[c]=l),i},{});return{...n,...e}}function at(t){if(ct(t)){const{p1x:n,p1y:e,p2x:o,p2y:i}=t;return U(n,e,o,i)}return Ot(t)?en(t):At}function on(t,n,e){function o(i,r){switch(i){case"content":y(r)&&(t.bottomSheetContentWrapper.innerHTML=r);break;case"width":y(r)&&(t.bottomSheetContainer.style.width=r);break;case"shouldShowHandle":Tt(r)||z(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(r)||z(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":y(r)&&(t.bottomSheetContainer.style.borderRadius=r);break;case"backdropColor":y(r)&&(t.bottomSheetBackdrop.style.backgroundColor=r);break;case"backDropTransition":y(r)&&(t.bottomSheetBackdrop.style.transition=r);break;case"rootClass":if(!y(r))return;G(t.bottomSheetRoot,e.rootClass,r);break;case"containerClass":if(!y(r))return;G(t.bottomSheetContainer,e.containerClass,r);break;case"handleClass":if(!y(r))return;G(t.bottomSheetHandle,e.handleClass,r);break;case"contentWrapperClass":if(!y(r))return;G(t.bottomSheetContentWrapper,e.contentWrapperClass,r);break;case"backdropClass":if(!y(r))return;G(t.bottomSheetBackdrop,e.backdropClass,r);break;case"draggingAnimationTimings":if(ct(r)){const c=at(r),l=st(c,e.draggingAnimationDuration);n.translateContainer=l}break;case"draggingAnimationDuration":if(S(r)){const c=at(e.draggingAnimationTimings),l=st(c,r);n.translateContainer=l}break}}return o}function sn(t){const n=rn(t),e=at(t.draggingAnimationTimings),i={isMounted:!1,translateContainer:st(e,n.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 Kt,a={animationFrame:l,onClose:E,bottomSheetState:i,draggingState:r,snapTo:lt,moveUp:F,moveDown:Dt},{elements:p,eventHandlers:g}=Vt(n,a),u=Jt(n,on(p,i,n)),{bottomSheetBackdrop:C,bottomSheetRoot:H,bottomSheetContainer:s}=p,v=d=>{const f=d??window.document.body;f.appendChild(H),f.appendChild(C);const h=window.innerHeight;Z(s,{y:h}),g.attachEventListeners(),i.isMounted=!0},O=()=>{g.clearEventListeners(),Object.values(p).forEach(d=>{d.remove()}),c(),i.isMounted=!1},A=()=>{var D;if(x()||Qt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),_())return;u.shouldShowBackdrop&&nt(C,!0),nt([s],!0),Z(s,{y:s.clientHeight});const f=window.innerHeight,h=ft(f,s.clientHeight,u.marginTop,u.defaultPosition),m=Y(s).y;i.translateContainer({startY:m,endY:h,animationFrame:l,bottomSheetContainer:s,onEnd:t.afterOpen}),p.bottomSheetHandle.focus();const w=document.body.style.overflowY;r.originalDocumentOverflowY=w||"initial";const L=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=L||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain"};function E(){var h;if(X())return;(h=t.beforeClose)==null||h.call(t);const d=Y(s).y,f=s.clientHeight;i.translateContainer({startY:d,endY:f,animationFrame:l,bottomSheetContainer:s,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),nt([C,s],!1)}}),c()}function x(){return i.isMounted}function _(){const d=Y(s).y,f=window.innerHeight,h=s.clientHeight>=f?f:s.clientHeight;return d<h}function X(){return!_()}function T(){const d=Y(s).y,f=s.clientHeight,h=window.innerHeight;if(d<=5&&d>=-5)return M.CONTENT_HEIGHT;const m=f-d;if(m===h/2)return M.MIDDLE;const w=h-u.marginTop,L=10;return m<=w+L&&m>=w-L?M.TOP:M.CLOSED}function k(){return s.clientHeight}function B(d){if(!_())return;const f=Y(s).y,m=s.clientHeight-f,w=window.innerHeight-d,L=Pt(m,w),D=J(m,w);i.translateContainer({startY:f,endY:f+(L.isUp?-D:D),animationFrame:l,bottomSheetContainer:s})}function j(d,{viewportHeight:f,visibleHeight:h}){let m=null;for(const w of d){const L=w*f,D=J(h,L);(m===null||D<m)&&(m=D)}return{minOffset:m}}function F(){const d=[...u.snapPoints].reverse(),f=Y(s).y,h=s.clientHeight,m=h-f;if(!u.expandable&&m>=h)return;const w=window.innerHeight,L=gt("above",{visibleHeight:m,viewportHeight:w},d),{minOffset:D}=j(L,{visibleHeight:m,viewportHeight:w});if(D===null&&m<w-u.marginTop){i.translateContainer({startY:f,endY:ft(w,h,u.marginTop,"top"),animationFrame:l,bottomSheetContainer:s});return}S(D)&&i.translateContainer({startY:f,endY:f-D,animationFrame:l,bottomSheetContainer:s})}function Dt(){const d=Y(s).y,h=s.clientHeight-d;if(h<1)return;const m=window.innerHeight,w=gt("below",{visibleHeight:h,viewportHeight:m},u.snapPoints),{minOffset:L}=j(w,{visibleHeight:h,viewportHeight:m});S(L)&&i.translateContainer({startY:d,endY:d+L,animationFrame:l,bottomSheetContainer:s})}function lt(d){const f=window.innerHeight;if(!qt(d))return;const h=Q(f*d,2);B(h)}return{props:u,elements:p,mount:v,unmount:O,open:A,close:E,getIsMounted:x,getIsOpen:_,getIsClosed:X,getPosition:T,getHeight:k,moveTo:B,snapTo:lt}}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:()=>M.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=Lt;exports.BOTTOM_SHEET_POSITION=M;exports.BOTTOM_SHEET_SELECTORS=Mt;exports.COMMON_ANIMATION_KEYS=N;exports.ClassNames=b;exports.EventPhase=P;exports.ResetClassNames=q;exports.UtilClassNames=$;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=an;exports.eventPhaseToEnum=it;exports.isAnimationTimingPoints=ct;exports.isCommonAnimationTimingsKey=Ot;
2
+ "use strict";var St=Object.defineProperty;var kt=(t,n,e)=>n in t?St(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var W=(t,n,e)=>kt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(t){return typeof t=="string"}function Bt(t,n){return t.classList.contains(tt(n))}function K(t,n){t.classList.add(tt(n))}function et(t,n){t.classList.remove(tt(n))}function G(t,n,e){y(e)&&(y(n)&&et(t,n),K(t,e))}function tt(t){return y(t)?t.trim().replace(/\./g,""):""}function R(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function Yt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const ut="open",dt="hidden";function nt(t,n){const e=n;if(Array.isArray(t)){t.forEach(o=>{z(o,e),o.setAttribute("aria-modal",e?"true":"false")});return}z(t,e),t.setAttribute("aria-modal",e?"true":"false")}function z(t,n){n?(K(t,ut),et(t,dt)):(K(t,dt),et(t,ut))}function bt(t){return t instanceof HTMLElement}function S(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){bt(t)&&t.focus()}function Nt(t){if(!bt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),o=S(e)?parseInt(e,10):-1,r=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),c=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return r||c||o>-1}var b=(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))(b||{}),q=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(q||{}),$=(t=>(t.Hidden="hidden",t))($||{});function I(t,n,e){const o=document.createElement(t);return n.split(" ").forEach(r=>{K(o,r)}),y(e)&&o.setAttribute("data-testid",e),o}const Mt={CONTENTS_WRAPPER:Yt([b.Root,b.ContentWrapper])};function ft(t,n,e,o){switch(o){case"content-height":return n>=t?vt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Ct(t,n){const e=n<t,o=n>t;return{isUp:e,isDown:o,stayedSame:n===t}}function Et(t,n){return n<t?-(t-n):n-t}function J(t,n){return t>n?t-n:n-t}function Pt(t,n){const e=t<n,o=t>n;return{isUp:e,isDown:o,stayedSame:t===n}}function gt(t,n,e){const o=t==="above";return e.filter(i=>{const r=i*n.viewportHeight;return o?n.visibleHeight<r:n.visibleHeight>r})}function vt(t,n,e){return-(t-n)+e}function ht(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function wt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let o;for(;(o=n.exec(t))!==null;){const i=o[1],r=o[2].split(",").map(c=>c.trim());e.push({type:i,values:r})}return e}function xt(t){const n=t.style.transform,e=wt(n);return{transform:n,transformValues:e}}function Ht(t,n){const e=t.find(o=>o.type.startsWith(n));return e||null}const rt="translate";function Y(t){const n=t.style.transform,e=wt(n),o=Ht(e,rt);return yt(o??{type:rt,values:[]})}function Z(t,{x:n,y:e}){const{transform:o,transformValues:i}=xt(t),r=Ht(i,rt);if(r){const c=yt(r);t.style.transform=`translate(${n??c.x??0}px,${e??c.y??0}px)`;return}if(o){t.style.transform=`${o}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function yt(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:ht(n)??0,y:ht(e)??0}}function ot(t){return t!=null}function mt(t,{min:n,max:e}){return ot(e)&&t>=e?e:ot(n)&&t<=n?n:t}const _t=(t,n,e)=>{n instanceof HTMLElement&&!Bt(n,b.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,o)=>i=>{o.startY=t.getCoordinates(i).y,o.containerStartTranslate=Y(n),e.onDragStart()},Rt=(t,n,e,o,i)=>r=>{Ut(r,t,e,o,i,n,e.marginTop)};function Ut(t,n,e,o,i,r,c){if(!o.isDragging||!S(o.startY))return;const l=n.getCoordinates(t).y,a=Et(o.startY,l),p=window.innerHeight,g=r.clientHeight,u=g-(o.containerStartTranslate.y+a);if(u>=p)return;const C=Ct(o.startY,l);if(C.isUp&&!e.expandable&&u>=g)return;i.start(()=>{Z(r,{y:o.containerStartTranslate.y+a})},0);const H=p-c,s=g-o.containerStartTranslate.y;if(C.isUp){const v=H-s,O=H-u,A=mt(1-Q(O/v,2),{min:0,max:1});e.onDragMove(C,A)}else if(C.isDown){const v=mt(Q(1-u/s,2),{min:0,max:1});e.onDragMove(C,v)}}const Wt=(t,n,e,o,i,r,c)=>l=>{if(!o.isDragging||(o.isDragging=!1,!S(o.startY)))return;e.onDragEnd();const a=o.startY,p=t.getCoordinates(l).y,g=Y(n).y,u=Ct(a,p),C=window.innerHeight,H=n.clientHeight;if(u.isUp){const s=[...e.snapPoints].sort((A,E)=>A-E),v=H+-g;if(!e.expandable&&v>=H)return;for(const A of s){const E=A*window.innerHeight;if(v<=E){const x=J(v,E);c.translateContainer({startY:g,endY:g-x,animationFrame:i,bottomSheetContainer:n});return}}const O=vt(C,H,e.marginTop);c.translateContainer({startY:g,endY:O,animationFrame:i,bottomSheetContainer:n})}else if(u.isDown){const s=[...e.snapPoints].sort((v,O)=>O-v);for(const v of s){const O=v*window.innerHeight,A=H+-g;if(A>=O){const E=J(A,O);c.translateContainer({startY:g,endY:g+E,animationFrame:i,bottomSheetContainer:n});return}}r()}};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 it(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gt={eventPhase:P.All};class V{constructor(n){W(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Gt,onMove:o,onEnd:i}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}){n&&this.currentTarget.addEventListener("touchstart",r=>{if(e.eventPhase===P.All){n(r);return}it(r.eventPhase)===e.eventPhase&&n(r)},{passive:!0}),o&&this.currentTarget.addEventListener("touchmove",o),i&&this.currentTarget.addEventListener("touchend",i)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:o,onEnd:i}){n&&this.currentTarget.addEventListener("mousedown",r=>{if(e.eventPhase===P.All){n(r);return}it(r.eventPhase)===e.eventPhase&&n(r)},{passive:!0}),o&&this.currentTarget.addEventListener("mousemove",o),i&&this.currentTarget.addEventListener("mouseup",r=>{i(r)})}removeEventListeners({onStart:n,onMove:e,onEnd:o}){n&&this.currentTarget.removeEventListener("touchstart",n),o&&this.currentTarget.removeEventListener("touchend",o),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),o&&this.currentTarget.removeEventListener("mouseup",o)}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 Vt(t,n){const e=$t(t);Xt(e),e.bottomSheetContainer.style.width=t.width;const o=document.createElement("div");o.innerHTML=t.content??"";const i=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${i}px`,e.bottomSheetContentWrapper.appendChild(o);const r=jt({bottomSheetElements:e,bottomSheetProps:t,options:n});return{elements:e,eventHandlers:r}}function $t(t){const n=I("dialog",R([b.Root,q.Dialog,t.rootClass]),b.Root);n.ariaLabel=t.ariaLabel;const e=I("section",R([b.Container,t.containerClass]),b.Container);t.containerBorderRadius&&(e.style.borderRadius=t.containerBorderRadius);const o=I("div",b.GapFiller,b.GapFiller),i=I("button",R([b.Handle,q.Button,t.shouldShowHandle?null:$.Hidden,t.handleClass]),b.Handle);i.setAttribute("type","button"),i.ariaLabel="bottom sheet close button";const r=I("span",R([b.HandleBar,t.shouldShowHandle?null:$.Hidden]),b.HandleBar),c=I("article",R([b.ContentWrapper,t.contentWrapperClass]),b.ContentWrapper),l=I("div",R([b.Backdrop,t.backdropClass,$.Hidden]),b.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:r,bottomSheetContentWrapper:c,bottomSheetContainerGapFiller:o}}function Xt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:o,bottomSheetContentWrapper:i,bottomSheetContainerGapFiller:r}){t.appendChild(n),e.appendChild(o),n.appendChild(e),n.appendChild(i),n.appendChild(r)}function jt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:o,bottomSheetContainer:i,bottomSheetHandle:r,bottomSheetContainerGapFiller:c,bottomSheetContentWrapper:l}=t,{animationFrame:a}=e,p=new V(r),g=new V(l),u=new V(c),C=n.dragTriggers.reduce((T,k)=>{const B=o.querySelectorAll(k);if(!B.length)return T;const j=Array.from(B).map(F=>F instanceof HTMLElement?new V(F):null).filter(F=>!!F);return[...T,...j]},[]),H=new V(window),s=Ft(H,i,n,e.draggingState),v=Rt(H,i,n,e.draggingState,a),O=Wt(H,i,n,e.draggingState,a,e.onClose,e.bottomSheetState);function A(T){T.target instanceof Element&&!o.contains(T.target)&&e.onClose()}function E(T){_t(e.draggingState,T.target,t.bottomSheetContentWrapper)}function x(){n.draggable&&(p.addEventListeners({onStart:E}),C.forEach(T=>{T.addEventListeners({onStart:E,onStartOptions:{eventPhase:P.Target}})})),n.draggable&&n.backgroundDraggable&&(g.addEventListeners({onStart:E,onStartOptions:{eventPhase:P.Target}}),u.addEventListeners({onStart:E})),n.draggable&&H.addEventListeners({onStart:s,onMove:v,onEnd:O}),n.draggable&&window.document.addEventListener("keyup",T=>{T.key==="Escape"&&e.onClose()}),n.shouldCloseOnOutsideClick&&window.document.addEventListener("click",A),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 k=_(t.bottomSheetContentWrapper);It(k)}})}function _(T){let k=[...Array.from(T.childNodes).reverse()];for(;k.length;){const B=k.shift();if(Nt(B))return B;B&&(k=[...k,...Array.from(B.childNodes).reverse()])}return null}function X(){p.removeEventListeners({onStart:E}),g.removeEventListeners({onStart:E}),u.removeEventListeners({onStart:E}),C.forEach(T=>{T.removeEventListeners({onStart:E})}),H.removeEventListeners({onStart:s,onMove:v,onEnd:O}),window.removeEventListener("click",A)}return{attachEventListeners:x,clearEventListeners:X}}class Kt{constructor(){W(this,"animationId");W(this,"isInProgress");W(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,o=!1){this.isInProgress=!0;const i=r=>{this.startedAt||(this.startedAt=r);const c=r-this.startedAt,a=e===0?1:Q(c/e,2),p=a>=1&&!o;n(a),p?this.stop():this.animationId=requestAnimationFrame(i)};this.animationId=requestAnimationFrame(i)}stop(){this.isInProgress=!1,this.startedAt=null,S(this.animationId)&&cancelAnimationFrame(this.animationId)}}function zt(t){const{startY:n,endY:e,bottomSheetContainer:o,animationFrame:i,onEnd:r,animationTimingFunction:c,animationDuration:l}=t,a=Et(n,e);i.stop();let p=!1;i.start(g=>{Z(o,{y:n+a*c(g)}),!p&&g>=1&&(r==null||r(),p=!0)},l)}const st=(t,n)=>e=>{zt({...e,animationTimingFunction:t,animationDuration:n})},M={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function qt(t){return!(!S(t)||t>1||t<0)}function Jt(t,n){const e={set(o,i,r,c){return n(i,r),Reflect.set(o,i,r,c)}};return new Proxy(t,e)}function Qt(...t){console.error(t)}const N={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Ot(t){for(const n of Object.values(N))if(n===t)return!0;return!1}function ct(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&S(t.p1x)&&S(t.p1y)&&S(t.p2x)&&S(t.p2y))}function U(t,n,e,o){return function(a){return l(r(a))};function r(a){let p=0,g=1,u=a,C;if(a===0||a===1)return a;for(;p<g;){if(C=c(u),Math.abs(C-a)<.001)return u;a>C?p=u:g=u,u=(g+p)/2}return u}function c(a){return 3*t*a*Math.pow(1-a,2)+3*e*Math.pow(a,2)*(1-a)+Math.pow(a,3)}function l(a){return 3*n*a*Math.pow(1-a,2)+3*o*Math.pow(a,2)*(1-a)+Math.pow(a,3)}}const pt=U(.25,.1,.25,1),Zt=U(.42,0,1,1),At=U(.42,0,.58,1),tn=U(.4,.1,.6,1),nn=U(.45,1.5,.55,1);function en(t){switch(t){case N.EASE:return pt;case N.EASE_IN:return Zt;case N.EASE_OUT:return At;case N.EASE_IN_OUT:return tn;case N.SPRING:return nn;default:return pt}}function Tt(t){return typeof t=="boolean"}const Lt={ariaLabel:"Bottom sheet",content:"",defaultPosition:M.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 rn(t){const n={...Lt},e=Object.entries(t).reduce((i,r)=>{const[c,l]=r;return ot(l)&&(i[c]=l),i},{});return{...n,...e}}function at(t){if(ct(t)){const{p1x:n,p1y:e,p2x:o,p2y:i}=t;return U(n,e,o,i)}return Ot(t)?en(t):At}function on(t,n,e){function o(i,r){switch(i){case"content":y(r)&&(t.bottomSheetContentWrapper.innerHTML=r);break;case"width":y(r)&&(t.bottomSheetContainer.style.width=r);break;case"shouldShowHandle":Tt(r)||z(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(r)||z(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":y(r)&&(t.bottomSheetContainer.style.borderRadius=r);break;case"backdropColor":y(r)&&(t.bottomSheetBackdrop.style.backgroundColor=r);break;case"backDropTransition":y(r)&&(t.bottomSheetBackdrop.style.transition=r);break;case"rootClass":if(!y(r))return;G(t.bottomSheetRoot,e.rootClass,r);break;case"containerClass":if(!y(r))return;G(t.bottomSheetContainer,e.containerClass,r);break;case"handleClass":if(!y(r))return;G(t.bottomSheetHandle,e.handleClass,r);break;case"contentWrapperClass":if(!y(r))return;G(t.bottomSheetContentWrapper,e.contentWrapperClass,r);break;case"backdropClass":if(!y(r))return;G(t.bottomSheetBackdrop,e.backdropClass,r);break;case"draggingAnimationTimings":if(ct(r)){const c=at(r),l=st(c,e.draggingAnimationDuration);n.translateContainer=l}break;case"draggingAnimationDuration":if(S(r)){const c=at(e.draggingAnimationTimings),l=st(c,r);n.translateContainer=l}break}}return o}function sn(t){const n=rn(t),e=at(t.draggingAnimationTimings),i={isMounted:!1,translateContainer:st(e,n.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 Kt,a={animationFrame:l,onClose:E,bottomSheetState:i,draggingState:r,snapTo:lt,moveUp:F,moveDown:Dt},{elements:p,eventHandlers:g}=Vt(n,a),u=Jt(n,on(p,i,n)),{bottomSheetBackdrop:C,bottomSheetRoot:H,bottomSheetContainer:s}=p,v=d=>{const f=d??window.document.body;f.appendChild(H),f.appendChild(C);const h=window.innerHeight;Z(s,{y:h}),g.attachEventListeners(),i.isMounted=!0},O=()=>{g.clearEventListeners(),Object.values(p).forEach(d=>{d.remove()}),c(),i.isMounted=!1},A=()=>{var D;if(x()||Qt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),_())return;u.shouldShowBackdrop&&nt(C,!0),nt([s],!0),Z(s,{y:s.clientHeight});const f=window.innerHeight,h=ft(f,s.clientHeight,u.marginTop,u.defaultPosition),m=Y(s).y;i.translateContainer({startY:m,endY:h,animationFrame:l,bottomSheetContainer:s,onEnd:t.afterOpen}),p.bottomSheetHandle.focus();const w=document.body.style.overflowY;r.originalDocumentOverflowY=w||"initial";const L=document.body.style.overscrollBehavior;r.originalDocumentOverscrollBehavior=L||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain"};function E(){var h;if(X())return;(h=t.beforeClose)==null||h.call(t);const d=Y(s).y,f=s.clientHeight;i.translateContainer({startY:d,endY:f,animationFrame:l,bottomSheetContainer:s,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),nt([C,s],!1)}}),c()}function x(){return i.isMounted}function _(){const d=Y(s).y,f=window.innerHeight,h=s.clientHeight>=f?f:s.clientHeight;return d<h}function X(){return!_()}function T(){const d=Y(s).y,f=s.clientHeight,h=window.innerHeight;if(d<=5&&d>=-5)return M.CONTENT_HEIGHT;const m=f-d;if(m===h/2)return M.MIDDLE;const w=h-u.marginTop,L=10;return m<=w+L&&m>=w-L?M.TOP:M.CLOSED}function k(){return s.clientHeight}function B(d){if(!_())return;const f=Y(s).y,m=s.clientHeight-f,w=window.innerHeight-d,L=Pt(m,w),D=J(m,w);i.translateContainer({startY:f,endY:f+(L.isUp?-D:D),animationFrame:l,bottomSheetContainer:s})}function j(d,{viewportHeight:f,visibleHeight:h}){let m=null;for(const w of d){const L=w*f,D=J(h,L);(m===null||D<m)&&(m=D)}return{minOffset:m}}function F(){const d=[...u.snapPoints].reverse(),f=Y(s).y,h=s.clientHeight,m=h-f;if(!u.expandable&&m>=h)return;const w=window.innerHeight,L=gt("above",{visibleHeight:m,viewportHeight:w},d),{minOffset:D}=j(L,{visibleHeight:m,viewportHeight:w});if(D===null&&m<w-u.marginTop){i.translateContainer({startY:f,endY:ft(w,h,u.marginTop,"top"),animationFrame:l,bottomSheetContainer:s});return}S(D)&&i.translateContainer({startY:f,endY:f-D,animationFrame:l,bottomSheetContainer:s})}function Dt(){const d=Y(s).y,h=s.clientHeight-d;if(h<1)return;const m=window.innerHeight,w=gt("below",{visibleHeight:h,viewportHeight:m},u.snapPoints),{minOffset:L}=j(w,{visibleHeight:h,viewportHeight:m});S(L)&&i.translateContainer({startY:d,endY:d+L,animationFrame:l,bottomSheetContainer:s})}function lt(d){const f=window.innerHeight;if(!qt(d))return;const h=Q(f*d,2);B(h)}return{props:u,elements:p,mount:v,unmount:O,open:A,close:E,getIsMounted:x,getIsOpen:_,getIsClosed:X,getPosition:T,getHeight:k,moveTo:B,snapTo:lt}}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:()=>M.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=Lt;exports.BOTTOM_SHEET_POSITION=M;exports.BOTTOM_SHEET_SELECTORS=Mt;exports.COMMON_ANIMATION_KEYS=N;exports.ClassNames=b;exports.EventPhase=P;exports.ResetClassNames=q;exports.UtilClassNames=$;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=an;exports.eventPhaseToEnum=it;exports.isAnimationTimingPoints=ct;exports.isCommonAnimationTimingsKey=Ot;
@@ -1,7 +1,7 @@
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
  var At = Object.defineProperty;
3
3
  var Dt = (t, n, e) => n in t ? At(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
4
- var U = (t, n, e) => (Dt(t, typeof n != "symbol" ? n + "" : n, e), e);
4
+ var U = (t, n, e) => Dt(t, typeof n != "symbol" ? n + "" : n, e);
5
5
  function y(t) {
6
6
  return typeof t == "string";
7
7
  }
@@ -747,17 +747,17 @@ function W(t, n, e, o) {
747
747
  return 3 * n * a * Math.pow(1 - a, 2) + 3 * o * Math.pow(a, 2) * (1 - a) + Math.pow(a, 3);
748
748
  }
749
749
  }
750
- const Jt = W(0.25, 0.1, 0.25, 1), Qt = W(0.42, 0, 1, 1), Lt = W(0.42, 0, 0.58, 1), mt = W(0.4, 0.1, 0.6, 1), Zt = W(0.45, 1.5, 0.55, 1);
750
+ const mt = W(0.25, 0.1, 0.25, 1), Jt = W(0.42, 0, 1, 1), Lt = W(0.42, 0, 0.58, 1), Qt = W(0.4, 0.1, 0.6, 1), Zt = W(0.45, 1.5, 0.55, 1);
751
751
  function tn(t) {
752
752
  switch (t) {
753
753
  case F.EASE:
754
- return Jt;
754
+ return mt;
755
755
  case F.EASE_IN:
756
- return Qt;
756
+ return Jt;
757
757
  case F.EASE_OUT:
758
758
  return Lt;
759
759
  case F.EASE_IN_OUT:
760
- return mt;
760
+ return Qt;
761
761
  case F.SPRING:
762
762
  return Zt;
763
763
  default:
@@ -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
- (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),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(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||{}),V=(n=>(n.Hidden="hidden",n))(V||{});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 ${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 jn(n,t){const e=Vn(n);$n(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 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 o=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 r=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:r,bottomSheetContentWrapper:c,bottomSheetContainerGapFiller:o}}function $n({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 $(r),g=new $(l),u=new $(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 $(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),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 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 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):An}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;j(n.bottomSheetRoot,e.rootClass,r);break;case"containerClass":if(!C(r))return;j(n.bottomSheetContainer,e.containerClass,r);break;case"handleClass":if(!C(r))return;j(n.bottomSheetHandle,e.handleClass,r);break;case"contentWrapperClass":if(!C(r))return;j(n.bottomSheetContentWrapper,e.contentWrapperClass,r);break;case"backdropClass":if(!C(r))return;j(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}=jn(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=V,h.createBottomSheet=it,h.createPlaceholderBottomSheet=st,h.eventPhaseToEnum=cn,h.isAnimationTimingPoints=un,h.isCommonAnimationTimingsKey=On,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
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
+ /*$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"})});
@@ -1,6 +1,6 @@
1
- import { CSSColor, CSSUnit } from '../utils/types/css-attribute';
2
- import { AnimationTimingPoints, CommonAnimation } from '../utils/animation/animation.type';
3
1
  import { DraggingDirection } from '../calculator/position-calculator.type';
2
+ import { AnimationTimingPoints, CommonAnimation } from '../utils/animation/animation.type';
3
+ import { CSSColor, CSSUnit } from '../utils/types/css-attribute';
4
4
 
5
5
  export type RequiredBottomSheetProps = Required<BottomSheetCoreProps>;
6
6
  export interface BottomSheetCoreProps {
@@ -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"}
@@ -1,5 +1,5 @@
1
- import { Coordinates, Position } from '../animation/animation.type';
2
1
  import { translateContainerWithAnim } from '../animation/animation';
2
+ import { Coordinates, Position } from '../animation/animation.type';
3
3
 
4
4
  export interface BottomSheetState {
5
5
  isMounted: boolean;
@@ -1,6 +1,6 @@
1
- import { BottomSheetState } from './bottom-sheet-state.type';
2
- import { BottomSheetPosition, BottomSheetCoreProps } from './bottom-sheet-props.type';
3
1
  import { BottomSheetElements } from '../initializer/bottom-sheet-initializer';
2
+ import { BottomSheetPosition, BottomSheetCoreProps } from './bottom-sheet-props.type';
3
+ import { BottomSheetState } from './bottom-sheet-state.type';
4
4
 
5
5
  export interface BottomSheetCore {
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { TransformValue } from './transform';
2
1
  import { Coordinates } from '../../animation/animation.type';
2
+ import { TransformValue } from './transform';
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,5 +1,5 @@
1
- import { EventPhase } from './EventPhase';
2
1
  import { Coordinates } from '../../animation/animation.type';
2
+ import { EventPhase } from './EventPhase';
3
3
 
4
4
  export interface AddEventListenersParams {
5
5
  onStart?: EventCallback;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainsheet/core",
3
- "version": "0.7.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",