@plainsheet/core 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/event-handlers/dragging-handler.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-defaults.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-props-initializer.d.ts.map +1 -1
- package/dist/plainsheet-core.cjs.js +1 -1
- package/dist/plainsheet-core.es.js +246 -229
- package/dist/plainsheet-core.umd.js +2 -2
- package/dist/types/bottom-sheet-props.type.d.ts +5 -0
- package/dist/types/bottom-sheet-props.type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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,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;
|
|
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;AAyFJ,eAAO,MAAM,aAAa,kBAEP,gBAAgB,wBACT,WAAW,oBACf,QAAQ,CAAC,oBAAoB,CAAC,iBACjC,aAAa,kBACZ,cAAc,WACrB,MAAM,IAAI,oBACD,gBAAgB,aAE5B,QAAQ,SAsHf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom-sheet-defaults.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-defaults.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAGjF,MAAM,MAAM,0BAA0B,GAAG,MAAM,wBAAwB,CAAC;AAExE,eAAO,MAAM,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"bottom-sheet-defaults.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-defaults.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAGjF,MAAM,MAAM,0BAA0B,GAAG,MAAM,wBAAwB,CAAC;AAExE,eAAO,MAAM,0BAA0B,EAAE,wBAqCxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom-sheet-props-initializer.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-props-initializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAezD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAGpC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,GAC1B,wBAAwB,CAuB1B;AAED,wBAAgB,6BAA6B,CAC3C,wBAAwB,EAAE,oBAAoB,CAAC,0BAA0B,CAAC,GACzE,uBAAuB,CAWzB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACjD,aAAa,EAAE,0BAA0B,GACxC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"bottom-sheet-props-initializer.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-props-initializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAezD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAGpC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,GAC1B,wBAAwB,CAuB1B;AAED,wBAAgB,6BAA6B,CAC3C,wBAAwB,EAAE,oBAAoB,CAAC,0BAA0B,CAAC,GACzE,uBAAuB,CAWzB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACjD,aAAa,EAAE,0BAA0B,GACxC,kBAAkB,CA4KpB"}
|
|
@@ -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%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
"use strict";var Bt=Object.defineProperty;var Dt=(t,n,e)=>n in t?Bt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var j=(t,n,e)=>Dt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function O(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(tt(n))}function V(t,n){t.classList.add(tt(n))}function ot(t,n){t.classList.remove(tt(n))}function W(t,n,e){O(e)&&(O(n)&&ot(t,n),V(t,e))}function tt(t){return O(t)?t.trim().replace(/\./g,""):""}function _(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function Pt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const dt="open",ft="hidden";function rt(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{z(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}z(t,e),t.setAttribute("aria-modal",e?"true":"false")}function z(t,n){n?(V(t,dt),ot(t,ft)):(V(t,ft),ot(t,dt))}function yt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){yt(t)&&t.focus()}function Nt(t){if(!yt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var T=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(T||{}),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 r=document.createElement(t);return n.split(" ").forEach(i=>{V(r,i)}),O(e)&&r.setAttribute("data-testid",e),r}const Mt={CONTENTS_WRAPPER:Pt([T.Root,T.ContentWrapper])};function gt(t,n,e,r){switch(r){case"content-height":return n>=t?vt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Et(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Ct(t,n){return n<t?-(t-n):n-t}function J(t,n){return t>n?t-n:n-t}function xt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function ht(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function vt(t,n,e){return-(t-n)+e}function mt(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function St(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Rt(t){const n=t.style.transform,e=St(n);return{transform:n,transformValues:e}}function Ot(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function P(t){const n=t.style.transform,e=St(n),r=Ot(e,it);return wt(r??{type:it,values:[]})}function Z(t,{x:n,y:e}){const{transform:r,transformValues:o}=Rt(t),i=Ot(o,it);if(i){const a=wt(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function wt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:mt(n)??0,y:mt(e)??0}}function at(t){return t!=null}function bt(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Ft=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,T.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},_t=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=P(n),e.onDragStart()},Ut=(t,n,e,r,o)=>i=>{jt(i,t,e,r,o,n,e.marginTop)};function jt(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const l=n.getCoordinates(t).y,s=Ct(r.startY,l),b=window.innerHeight,f=i.clientHeight,d=f-(r.containerStartTranslate.y+s);if(d>=b)return;const p=Et(r.startY,l);if(p.isUp&&!e.expandable&&d>=f)return;o.start(()=>{Z(i,{y:r.containerStartTranslate.y+s})},0);const k=b-a,c=f-r.containerStartTranslate.y;if(p.isUp){const E=k-c,w=k-d,H=bt(1-Q(w/E,2),{min:0,max:1});e.onDragMove(p,H)}else if(p.isDown){const E=bt(Q(1-d/c,2),{min:0,max:1});e.onDragMove(p,E)}}const Wt=(t,n,e,r,o,i,a)=>l=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,b=t.getCoordinates(l).y,f=P(n).y,d=Et(s,b),p=window.innerHeight,k=n.clientHeight;if(d.isUp){const c=[...e.snapPoints].sort((H,B)=>H-B),E=k+-f;if(!e.expandable&&E>=k)return;for(const H of c){const B=H*window.innerHeight;if(E<=B){const L=J(E,B);a.translateContainer({startY:f,endY:f-L,animationFrame:o,bottomSheetContainer:n});return}}const w=vt(p,k,e.marginTop);a.translateContainer({startY:f,endY:w,animationFrame:o,bottomSheetContainer:n})}else if(d.isDown){const c=[...e.snapPoints].sort((E,w)=>w-E);for(const E of c){const w=E*window.innerHeight,H=k+-f;if(H>=w){const B=J(H,w);a.translateContainer({startY:f,endY:f+B,animationFrame:o,bottomSheetContainer:n});return}}i()}};var x=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(x||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gt={eventPhase:x.All};class G{constructor(n){j(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Gt,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function $t(t,n){const e=Vt(t);Xt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Kt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Vt(t){const n=I("dialog",_([T.Root,q.Dialog,t.rootClass]),T.Root);n.ariaLabel=t.ariaLabel;const e=I("section",_([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=I("div",T.GapFiller,T.GapFiller),o=I("button",_([T.Handle,q.Button,t.shouldShowHandle?null:$.Hidden,t.handleClass]),T.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=I("span",_([T.HandleBar,t.shouldShowHandle?null:$.Hidden]),T.HandleBar),a=I("article",_([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),l=I("div",_([T.Backdrop,t.backdropClass,$.Hidden]),T.Backdrop);return t.backdropColor&&(l.style.backgroundColor=t.backdropColor),t.backDropTransition&&(l.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:l,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function Xt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Kt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:s}=t,{animationFrame:b}=e,f=new G(i),d=new G(l),p=new G(a),k=n.dragTriggers.reduce((C,S)=>{const y=r.querySelectorAll(S);if(!y.length)return C;const F=Array.from(y).map(u=>u instanceof HTMLElement?new G(u):null).filter(u=>!!u);return[...C,...F]},[]),c=new G(window),E=_t(c,o,n,e.draggingState),w=Ut(c,o,n,e.draggingState,b),H=Wt(c,o,n,e.draggingState,b,e.onClose,e.bottomSheetState);function B(C){C.target instanceof Element&&!r.contains(C.target)&&e.onClose()}function L(C){Ft(e.draggingState,C.target,t.bottomSheetContentWrapper)}function R(C){const S=C??n;S.draggable&&(f.addEventListeners({onStart:L}),k.forEach(y=>{y.addEventListeners({onStart:L,onStartOptions:{eventPhase:x.Target}})})),S.draggable&&S.backgroundDraggable&&(d.addEventListeners({onStart:L,onStartOptions:{eventPhase:x.Target}}),p.addEventListeners({onStart:L})),S.draggable&&c.addEventListeners({onStart:E,onMove:w,onEnd:H}),S.draggable&&window.document.addEventListener("keyup",y=>{y.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",y=>{if(y.key==="ArrowUp"){e.moveUp();return}if(y.key==="ArrowDown"){e.moveDown();return}if(y.shiftKey&&y.key==="Tab"){const F=et(t.bottomSheetContentWrapper);It(F)}})}function X(){n.shouldCloseOnOutsideClick?s.addEventListener("click",B):s.style.pointerEvents="none"}function nt(){s.removeEventListener("click",B)}function et(C){let S=[...Array.from(C.childNodes).reverse()];for(;S.length;){const y=S.shift();if(Nt(y))return y;y&&(S=[...S,...Array.from(y.childNodes).reverse()])}return null}function K(){f.removeEventListeners({onStart:L}),d.removeEventListeners({onStart:L}),p.removeEventListeners({onStart:L}),k.forEach(C=>{C.removeEventListeners({onStart:L})}),c.removeEventListeners({onStart:E,onMove:w,onEnd:H})}return{attachEventListeners:R,clearEventListeners:K,attacheOnOpenEventListeners:X,clearOnOpenEventListeners:nt}}class zt{constructor(){j(this,"animationId");j(this,"isInProgress");j(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Q(a/e,2),b=s>=1&&!r;n(s),b?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:l}=t,s=Ct(n,e);o.stop();let b=!1;o.start(f=>{Z(r,{y:n+s*a(f)}),!b&&f>=1&&(i==null||i(),b=!0)},l)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},M={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const N={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Lt(t){for(const n of Object.values(N))if(n===t)return!0;return!1}function ut(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function U(t,n,e,r){return function(s){return l(i(s))};function i(s){let b=0,f=1,d=s,p;if(s===0||s===1)return s;for(;b<f;){if(p=a(d),Math.abs(p-s)<.001)return d;s>p?b=d:f=d,d=(f+b)/2}return d}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function l(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const pt=U(.25,.1,.25,1),tn=U(.42,0,1,1),At=U(.42,0,.58,1),nn=U(.4,.1,.6,1),en=U(.45,1.5,.55,1);function rn(t){switch(t){case N.EASE:return pt;case N.EASE_IN:return tn;case N.EASE_OUT:return At;case N.EASE_IN_OUT:return nn;case N.SPRING:return en;default:return pt}}function Tt(t){return typeof t=="boolean"}const kt={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,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{}};function on(t){const n={...kt},e=Object.entries(t).reduce((o,i)=>{const[a,l]=i;return at(l)&&(o[a]=l),o},{});return{...n,...e}}function lt(t){if(ut(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return U(n,e,r,o)}return Lt(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":O(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":O(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Tt(a)||z(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(a)||z(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":O(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"backdropColor":O(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":O(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!O(a))return;W(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!O(a))return;W(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!O(a))return;W(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!O(a))return;W(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!O(a))return;W(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(ut(a)){const l=lt(a),s=ct(l,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const l=lt(e.draggingAnimationTimings),s=ct(l,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=lt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const l=new zt,s={animationFrame:l,onClose:B,bottomSheetState:o,draggingState:i,snapTo:F,moveUp:S,moveDown:y},{elements:b,eventHandlers:f}=$t(n,s),d=Qt(n,an(b,o,n,f)),{bottomSheetBackdrop:p,bottomSheetRoot:k,bottomSheetContainer:c}=b,E=u=>{const g=u??window.document.body;g.appendChild(k),g.appendChild(p);const h=window.innerHeight;Z(c,{y:h}),f.attachEventListeners(),o.isMounted=!0},w=()=>{f.clearEventListeners(),Object.values(b).forEach(u=>{u.remove()}),a(),o.isMounted=!1},H=()=>{var D;if(L()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),R())return;rt(p,!0),d.shouldShowBackdrop||V(p,"transparent"),rt([c],!0),Z(c,{y:c.clientHeight});const g=window.innerHeight,h=gt(g,c.clientHeight,d.marginTop,d.defaultPosition),m=P(c).y;o.translateContainer({startY:m,endY:h,animationFrame:l,bottomSheetContainer:c,onEnd:t.afterOpen});const v=document.body.style.overflowY;i.originalDocumentOverflowY=v||"initial";const A=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=A||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",b.bottomSheetHandle.focus(),f.attacheOnOpenEventListeners()};function B(){var h;if(X())return;(h=t.beforeClose)==null||h.call(t);const u=P(c).y,g=c.clientHeight;o.translateContainer({startY:u,endY:g,animationFrame:l,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),rt([p,c],!1),f.clearOnOpenEventListeners()}}),a()}function L(){return o.isMounted}function R(){const u=P(c).y,g=window.innerHeight,h=c.clientHeight>=g?g:c.clientHeight;return u<=h}function X(){return!R()}function nt(){const u=P(c).y,g=c.clientHeight,h=window.innerHeight;if(u<=5&&u>=-5)return M.CONTENT_HEIGHT;const m=g-u;if(m===h/2)return M.MIDDLE;const v=h-d.marginTop,A=10;return m<=v+A&&m>=v-A?M.TOP:M.CLOSED}function et(){return c.clientHeight}function K(u){if(!R())return;const g=P(c).y,m=c.clientHeight-g,v=window.innerHeight-u,A=xt(m,v),D=J(m,v);o.translateContainer({startY:g,endY:g+(A.isUp?-D:D),animationFrame:l,bottomSheetContainer:c})}function C(u,{viewportHeight:g,visibleHeight:h}){let m=null;for(const v of u){const A=v*g,D=J(h,A);(m===null||D<m)&&(m=D)}return{minOffset:m}}function S(){const u=[...d.snapPoints].reverse(),g=P(c).y,h=c.clientHeight,m=h-g;if(!d.expandable&&m>=h)return;const v=window.innerHeight,A=ht("above",{visibleHeight:m,viewportHeight:v},u),{minOffset:D}=C(A,{visibleHeight:m,viewportHeight:v});if(D===null&&m<v-d.marginTop){o.translateContainer({startY:g,endY:gt(v,h,d.marginTop,"top"),animationFrame:l,bottomSheetContainer:c});return}Y(D)&&o.translateContainer({startY:g,endY:g-D,animationFrame:l,bottomSheetContainer:c})}function y(){const u=P(c).y,h=c.clientHeight-u;if(h<1)return;const m=window.innerHeight,v=ht("below",{visibleHeight:h,viewportHeight:m},d.snapPoints),{minOffset:A}=C(v,{visibleHeight:h,viewportHeight:m});Y(A)&&o.translateContainer({startY:u,endY:u+A,animationFrame:l,bottomSheetContainer:c})}function F(u){const g=window.innerHeight;if(!Jt(u))return;const h=Q(g*u,2);K(h)}return{props:d,elements:b,mount:E,unmount:w,open:H,close:B,getIsMounted:L,getIsOpen:R,getIsClosed:X,getPosition:nt,getHeight:et,moveTo:K,snapTo:F}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>M.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=kt;exports.BOTTOM_SHEET_POSITION=M;exports.BOTTOM_SHEET_SELECTORS=Mt;exports.COMMON_ANIMATION_KEYS=N;exports.ClassNames=T;exports.EventPhase=x;exports.ResetClassNames=q;exports.UtilClassNames=$;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=cn;exports.eventPhaseToEnum=st;exports.isAnimationTimingPoints=ut;exports.isCommonAnimationTimingsKey=Lt;
|
|
2
|
+
"use strict";var Bt=Object.defineProperty;var Dt=(t,n,e)=>n in t?Bt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var j=(t,n,e)=>Dt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function H(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(tt(n))}function X(t,n){t.classList.add(tt(n))}function ot(t,n){t.classList.remove(tt(n))}function W(t,n,e){H(e)&&(H(n)&&ot(t,n),X(t,e))}function tt(t){return H(t)?t.trim().replace(/\./g,""):""}function F(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function It(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const dt="open",ft="hidden";function rt(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?(X(t,dt),ot(t,ft)):(X(t,ft),ot(t,dt))}function yt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function Nt(t){yt(t)&&t.focus()}function Pt(t){if(!yt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var y=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(y||{}),J=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(J||{}),V=(t=>(t.Hidden="hidden",t))(V||{});function N(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{X(r,i)}),H(e)&&r.setAttribute("data-testid",e),r}const Mt={CONTENTS_WRAPPER:It([y.Root,y.ContentWrapper])};function gt(t,n,e,r){switch(r){case"content-height":return n>=t?vt(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Et(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Ct(t,n){return n<t?-(t-n):n-t}function $(t,n){return t>n?t-n:n-t}function xt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function ht(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function vt(t,n,e){return-(t-n)+e}function mt(t){return Number(t.replace("px",""))}function Q(t,...n){return Number(t.toFixed(...n))}function St(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Rt(t){const n=t.style.transform,e=St(n);return{transform:n,transformValues:e}}function Ot(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function I(t){const n=t.style.transform,e=St(n),r=Ot(e,it);return wt(r??{type:it,values:[]})}function Z(t,{x:n,y:e}){const{transform:r,transformValues:o}=Rt(t),i=Ot(o,it);if(i){const a=wt(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function wt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:mt(n)??0,y:mt(e)??0}}function at(t){return t!=null}function bt(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const _t=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,y.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=I(n),e.onDragStart()},Ut=(t,n,e,r,o)=>i=>{jt(i,t,e,r,o,n,e.marginTop)};function jt(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const u=n.getCoordinates(t).y,s=Ct(r.startY,u),b=window.innerHeight,l=i.clientHeight,f=l-(r.containerStartTranslate.y+s);if(f>=b)return;const p=Et(r.startY,u);if(p.isUp&&!e.expandable&&f>=l||e.preventClosing&&f<=l)return;o.start(()=>{Z(i,{y:r.containerStartTranslate.y+s})},0);const S=b-a,c=l-r.containerStartTranslate.y;if(p.isUp){const T=S-c,O=S-f,L=bt(1-Q(O/T,2),{min:0,max:1});e.onDragMove(p,L)}else if(p.isDown){const T=bt(Q(1-f/c,2),{min:0,max:1});e.onDragMove(p,T)}}const Wt=(t,n,e,r,o,i,a)=>u=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,b=t.getCoordinates(u).y,l=I(n).y,f=Et(s,b),p=window.innerHeight,S=n.clientHeight;if(f.isUp){const c=[...e.snapPoints].sort((L,B)=>L-B),T=S+-l;if(!e.expandable&&T>=S)return;for(const L of c){const B=L*window.innerHeight;if(T<=B){const A=$(T,B);a.translateContainer({startY:l,endY:l-A,animationFrame:o,bottomSheetContainer:n});return}}const O=vt(p,S,e.marginTop);a.translateContainer({startY:l,endY:O,animationFrame:o,bottomSheetContainer:n})}else if(f.isDown){const c=[...e.snapPoints].sort((T,O)=>O-T);for(const T of c){const O=T*window.innerHeight,L=S+-l;if(L>=O){const B=$(L,O);a.translateContainer({startY:l,endY:l+B,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const T=S+-l;if(T>=S){const O=$(T,S);a.translateContainer({startY:l,endY:l+O,animationFrame:o,bottomSheetContainer:n})}return}i()}};var x=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(x||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const Gt={eventPhase:x.All};class G{constructor(n){j(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Gt,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===x.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function Vt(t,n){const e=$t(t);Xt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Kt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function $t(t){const n=N("dialog",F([y.Root,J.Dialog,t.rootClass]),y.Root);n.ariaLabel=t.ariaLabel;const e=N("section",F([y.Container,t.containerClass]),y.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=N("div",y.GapFiller,y.GapFiller),o=N("button",F([y.Handle,J.Button,t.shouldShowHandle?null:V.Hidden,t.handleClass]),y.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=N("span",F([y.HandleBar,t.shouldShowHandle?null:V.Hidden]),y.HandleBar),a=N("article",F([y.ContentWrapper,t.contentWrapperClass]),y.ContentWrapper),u=N("div",F([y.Backdrop,t.backdropClass,V.Hidden]),y.Backdrop);return t.backdropColor&&(u.style.backgroundColor=t.backdropColor),t.backDropTransition&&(u.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:u,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function Xt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Kt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:u,bottomSheetBackdrop:s}=t,{animationFrame:b}=e,l=new G(i),f=new G(u),p=new G(a),S=n.dragTriggers.reduce((C,w)=>{const E=r.querySelectorAll(w);if(!E.length)return C;const _=Array.from(E).map(d=>d instanceof HTMLElement?new G(d):null).filter(d=>!!d);return[...C,..._]},[]),c=new G(window),T=Ft(c,o,n,e.draggingState),O=Ut(c,o,n,e.draggingState,b),L=Wt(c,o,n,e.draggingState,b,e.onClose,e.bottomSheetState);function B(C){C.target instanceof Element&&!r.contains(C.target)&&e.onClose()}function A(C){_t(e.draggingState,C.target,t.bottomSheetContentWrapper)}function R(C){const w=C??n;w.draggable&&(l.addEventListeners({onStart:A}),S.forEach(E=>{E.addEventListeners({onStart:A,onStartOptions:{eventPhase:x.Target}})})),w.draggable&&w.backgroundDraggable&&(f.addEventListeners({onStart:A,onStartOptions:{eventPhase:x.Target}}),p.addEventListeners({onStart:A})),w.draggable&&c.addEventListeners({onStart:T,onMove:O,onEnd:L}),w.draggable&&window.document.addEventListener("keyup",E=>{E.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",E=>{if(E.key==="ArrowUp"){e.moveUp();return}if(E.key==="ArrowDown"){e.moveDown();return}if(E.shiftKey&&E.key==="Tab"){const _=et(t.bottomSheetContentWrapper);Nt(_)}})}function K(){n.shouldCloseOnOutsideClick?s.addEventListener("click",B):s.style.pointerEvents="none"}function nt(){s.removeEventListener("click",B)}function et(C){let w=[...Array.from(C.childNodes).reverse()];for(;w.length;){const E=w.shift();if(Pt(E))return E;E&&(w=[...w,...Array.from(E.childNodes).reverse()])}return null}function z(){l.removeEventListeners({onStart:A}),f.removeEventListeners({onStart:A}),p.removeEventListeners({onStart:A}),S.forEach(C=>{C.removeEventListeners({onStart:A})}),c.removeEventListeners({onStart:T,onMove:O,onEnd:L})}return{attachEventListeners:R,clearEventListeners:z,attacheOnOpenEventListeners:K,clearOnOpenEventListeners:nt}}class zt{constructor(){j(this,"animationId");j(this,"isInProgress");j(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Q(a/e,2),b=s>=1&&!r;n(s),b?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:u}=t,s=Ct(n,e);o.stop();let b=!1;o.start(l=>{Z(r,{y:n+s*a(l)}),!b&&l>=1&&(i==null||i(),b=!0)},u)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},M={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const P={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Lt(t){for(const n of Object.values(P))if(n===t)return!0;return!1}function ut(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function U(t,n,e,r){return function(s){return u(i(s))};function i(s){let b=0,l=1,f=s,p;if(s===0||s===1)return s;for(;b<l;){if(p=a(f),Math.abs(p-s)<.001)return f;s>p?b=f:l=f,f=(l+b)/2}return f}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function u(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const pt=U(.25,.1,.25,1),tn=U(.42,0,1,1),At=U(.42,0,.58,1),nn=U(.4,.1,.6,1),en=U(.45,1.5,.55,1);function rn(t){switch(t){case P.EASE:return pt;case P.EASE_IN:return tn;case P.EASE_OUT:return At;case P.EASE_IN_OUT:return nn;case P.SPRING:return en;default:return pt}}function Tt(t){return typeof t=="boolean"}const kt={ariaLabel:"Bottom sheet",content:"",defaultPosition:M.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{}};function on(t){const n={...kt},e=Object.entries(t).reduce((o,i)=>{const[a,u]=i;return at(u)&&(o[a]=u),o},{});return{...n,...e}}function lt(t){if(ut(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return U(n,e,r,o)}return Lt(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":H(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":H(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Tt(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":H(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"backdropColor":H(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":H(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!H(a))return;W(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!H(a))return;W(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!H(a))return;W(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!H(a))return;W(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!H(a))return;W(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(ut(a)){const u=lt(a),s=ct(u,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const u=lt(e.draggingAnimationTimings),s=ct(u,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=lt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const u=new zt,s={animationFrame:u,onClose:B,bottomSheetState:o,draggingState:i,snapTo:_,moveUp:w,moveDown:E},{elements:b,eventHandlers:l}=Vt(n,s),f=Qt(n,an(b,o,n,l)),{bottomSheetBackdrop:p,bottomSheetRoot:S,bottomSheetContainer:c}=b,T=d=>{const g=d??window.document.body;g.appendChild(S),g.appendChild(p);const h=window.innerHeight;Z(c,{y:h}),l.attachEventListeners(),o.isMounted=!0},O=()=>{l.clearEventListeners(),Object.values(b).forEach(d=>{d.remove()}),a(),o.isMounted=!1},L=()=>{var D;if(A()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),R())return;rt(p,!0),f.shouldShowBackdrop||X(p,"transparent"),rt([c],!0),Z(c,{y:c.clientHeight});const g=window.innerHeight,h=gt(g,c.clientHeight,f.marginTop,f.defaultPosition),m=I(c).y;o.translateContainer({startY:m,endY:h,animationFrame:u,bottomSheetContainer:c,onEnd:t.afterOpen});const v=document.body.style.overflowY;i.originalDocumentOverflowY=v||"initial";const k=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=k||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",b.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function B(){var h;if(K())return;(h=t.beforeClose)==null||h.call(t);const d=I(c).y,g=c.clientHeight;o.translateContainer({startY:d,endY:g,animationFrame:u,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),rt([p,c],!1),l.clearOnOpenEventListeners()}}),a()}function A(){return o.isMounted}function R(){const d=I(c).y,g=window.innerHeight,h=c.clientHeight>=g?g:c.clientHeight;return d<=h}function K(){return!R()}function nt(){const d=I(c).y,g=c.clientHeight,h=window.innerHeight;if(d<=5&&d>=-5)return M.CONTENT_HEIGHT;const m=g-d;if(m===h/2)return M.MIDDLE;const v=h-f.marginTop,k=10;return m<=v+k&&m>=v-k?M.TOP:M.CLOSED}function et(){return c.clientHeight}function z(d){if(!R())return;const g=I(c).y,m=c.clientHeight-g,v=window.innerHeight-d,k=xt(m,v),D=$(m,v);o.translateContainer({startY:g,endY:g+(k.isUp?-D:D),animationFrame:u,bottomSheetContainer:c})}function C(d,{viewportHeight:g,visibleHeight:h}){let m=null;for(const v of d){const k=v*g,D=$(h,k);(m===null||D<m)&&(m=D)}return{minOffset:m}}function w(){const d=[...f.snapPoints].reverse(),g=I(c).y,h=c.clientHeight,m=h-g;if(!f.expandable&&m>=h)return;const v=window.innerHeight,k=ht("above",{visibleHeight:m,viewportHeight:v},d),{minOffset:D}=C(k,{visibleHeight:m,viewportHeight:v});if(D===null&&m<v-f.marginTop){o.translateContainer({startY:g,endY:gt(v,h,f.marginTop,"top"),animationFrame:u,bottomSheetContainer:c});return}Y(D)&&o.translateContainer({startY:g,endY:g-D,animationFrame:u,bottomSheetContainer:c})}function E(){const d=I(c).y,h=c.clientHeight-d;if(h<1)return;const m=window.innerHeight,v=ht("below",{visibleHeight:h,viewportHeight:m},f.snapPoints),{minOffset:k}=C(v,{visibleHeight:h,viewportHeight:m});Y(k)&&o.translateContainer({startY:d,endY:d+k,animationFrame:u,bottomSheetContainer:c})}function _(d){const g=window.innerHeight;if(!Jt(d))return;const h=Q(g*d,2);z(h)}return{props:f,elements:b,mount:T,unmount:O,open:L,close:B,getIsMounted:A,getIsOpen:R,getIsClosed:K,getPosition:nt,getHeight:et,moveTo:z,snapTo:_}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>M.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=kt;exports.BOTTOM_SHEET_POSITION=M;exports.BOTTOM_SHEET_SELECTORS=Mt;exports.COMMON_ANIMATION_KEYS=P;exports.ClassNames=y;exports.EventPhase=x;exports.ResetClassNames=J;exports.UtilClassNames=V;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=cn;exports.eventPhaseToEnum=st;exports.isAnimationTimingPoints=ut;exports.isCommonAnimationTimingsKey=Lt;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var kt = Object.defineProperty;
|
|
3
3
|
var At = (t, n, e) => n in t ? kt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
4
4
|
var j = (t, n, e) => At(t, typeof n != "symbol" ? n + "" : n, e);
|
|
5
|
-
function
|
|
5
|
+
function O(t) {
|
|
6
6
|
return typeof t == "string";
|
|
7
7
|
}
|
|
8
8
|
function Bt(t, n) {
|
|
@@ -15,10 +15,10 @@ function rt(t, n) {
|
|
|
15
15
|
t.classList.remove(Z(n));
|
|
16
16
|
}
|
|
17
17
|
function W(t, n, e) {
|
|
18
|
-
|
|
18
|
+
O(e) && (O(n) && rt(t, n), $(t, e));
|
|
19
19
|
}
|
|
20
20
|
function Z(t) {
|
|
21
|
-
return
|
|
21
|
+
return O(t) ? t.trim().replace(/\./g, "") : "";
|
|
22
22
|
}
|
|
23
23
|
function M(t) {
|
|
24
24
|
return t.map((n) => Z(n)).filter(Boolean).join(" ");
|
|
@@ -31,13 +31,13 @@ function et(t, n) {
|
|
|
31
31
|
const e = n;
|
|
32
32
|
if (Array.isArray(t)) {
|
|
33
33
|
t.forEach((r) => {
|
|
34
|
-
|
|
34
|
+
q(r, e), r.setAttribute("aria-modal", e ? "true" : "false");
|
|
35
35
|
});
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
q(t, e), t.setAttribute("aria-modal", e ? "true" : "false");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function q(t, n) {
|
|
41
41
|
n ? ($(t, lt), rt(t, ut)) : ($(t, ut), rt(t, lt));
|
|
42
42
|
}
|
|
43
43
|
function Tt(t) {
|
|
@@ -63,17 +63,17 @@ function It(t) {
|
|
|
63
63
|
].includes(t.tagName), a = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
|
|
64
64
|
return i || a || r > -1;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var C = /* @__PURE__ */ ((t) => (t.Backdrop = "pbs-backdrop", t.Root = "pbs-root", t.Container = "pbs-container", t.GapFiller = "pbs-gap-filler", t.Handle = "pbs-handle", t.HandleBar = "pbs-handle-bar", t.ContentWrapper = "pbs-content-wrapper", t))(C || {}), ot = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(ot || {}), K = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(K || {});
|
|
67
67
|
function x(t, n, e) {
|
|
68
68
|
const r = document.createElement(t);
|
|
69
69
|
return n.split(" ").forEach((i) => {
|
|
70
70
|
$(r, i);
|
|
71
|
-
}),
|
|
71
|
+
}), O(e) && r.setAttribute("data-testid", e), r;
|
|
72
72
|
}
|
|
73
73
|
const sn = {
|
|
74
74
|
CONTENTS_WRAPPER: Dt([
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
C.Root,
|
|
76
|
+
C.ContentWrapper
|
|
77
77
|
])
|
|
78
78
|
};
|
|
79
79
|
function dt(t, n, e, r) {
|
|
@@ -99,7 +99,7 @@ function yt(t, n) {
|
|
|
99
99
|
function Ct(t, n) {
|
|
100
100
|
return n < t ? -(t - n) : n - t;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function V(t, n) {
|
|
103
103
|
return t > n ? t - n : n - t;
|
|
104
104
|
}
|
|
105
105
|
function xt(t, n) {
|
|
@@ -151,7 +151,7 @@ function I(t) {
|
|
|
151
151
|
e,
|
|
152
152
|
it
|
|
153
153
|
);
|
|
154
|
-
return
|
|
154
|
+
return Ht(r ?? {
|
|
155
155
|
type: it,
|
|
156
156
|
values: []
|
|
157
157
|
});
|
|
@@ -165,7 +165,7 @@ function Q(t, { x: n, y: e }) {
|
|
|
165
165
|
it
|
|
166
166
|
);
|
|
167
167
|
if (i) {
|
|
168
|
-
const a =
|
|
168
|
+
const a = Ht(i);
|
|
169
169
|
t.style.transform = `translate(${n ?? a.x ?? 0}px,${e ?? a.y ?? 0}px)`;
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
@@ -175,7 +175,7 @@ function Q(t, { x: n, y: e }) {
|
|
|
175
175
|
}
|
|
176
176
|
t.style.transform = `translate(${n ?? 0}px,${e ?? 0}px)`;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Ht(t) {
|
|
179
179
|
if (t.type !== "translate")
|
|
180
180
|
throw new Error(
|
|
181
181
|
`Could not get coordinates from ${t.type}, since is not translate.`
|
|
@@ -196,7 +196,7 @@ function ht(t, {
|
|
|
196
196
|
return at(e) && t >= e ? e : at(n) && t <= n ? n : t;
|
|
197
197
|
}
|
|
198
198
|
const Pt = (t, n, e) => {
|
|
199
|
-
n instanceof HTMLElement && !Bt(n,
|
|
199
|
+
n instanceof HTMLElement && !Bt(n, C.Handle) && e.scrollTop >= 1 || (t.isDragging = !0);
|
|
200
200
|
}, Mt = (t, n, e, r) => (o) => {
|
|
201
201
|
r.startY = t.getCoordinates(o).y, r.containerStartTranslate = I(n), e.onDragStart();
|
|
202
202
|
}, Ft = (t, n, e, r, o) => (i) => {
|
|
@@ -213,31 +213,31 @@ const Pt = (t, n, e) => {
|
|
|
213
213
|
function Rt(t, n, e, r, o, i, a) {
|
|
214
214
|
if (!r.isDragging || !Y(r.startY))
|
|
215
215
|
return;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
216
|
+
const u = n.getCoordinates(t).y, s = Ct(r.startY, u), b = window.innerHeight, l = i.clientHeight, f = l - (r.containerStartTranslate.y + s);
|
|
217
|
+
if (f >= b)
|
|
218
218
|
return;
|
|
219
|
-
const p = yt(r.startY,
|
|
220
|
-
if (p.isUp && !e.expandable &&
|
|
219
|
+
const p = yt(r.startY, u);
|
|
220
|
+
if (p.isUp && !e.expandable && f >= l || e.preventClosing && f <= l)
|
|
221
221
|
return;
|
|
222
222
|
o.start(() => {
|
|
223
223
|
Q(i, {
|
|
224
224
|
y: r.containerStartTranslate.y + s
|
|
225
225
|
});
|
|
226
226
|
}, 0);
|
|
227
|
-
const
|
|
227
|
+
const w = b - a, c = l - r.containerStartTranslate.y;
|
|
228
228
|
if (p.isUp) {
|
|
229
|
-
const
|
|
230
|
-
1 - J(H /
|
|
229
|
+
const T = w - c, H = w - f, L = ht(
|
|
230
|
+
1 - J(H / T, 2),
|
|
231
231
|
{
|
|
232
232
|
min: 0,
|
|
233
233
|
max: 1
|
|
234
234
|
}
|
|
235
235
|
);
|
|
236
|
-
e.onDragMove(p,
|
|
236
|
+
e.onDragMove(p, L);
|
|
237
237
|
} else if (p.isDown) {
|
|
238
|
-
const
|
|
238
|
+
const T = ht(
|
|
239
239
|
J(
|
|
240
|
-
1 -
|
|
240
|
+
1 - f / c,
|
|
241
241
|
2
|
|
242
242
|
),
|
|
243
243
|
{
|
|
@@ -245,30 +245,30 @@ function Rt(t, n, e, r, o, i, a) {
|
|
|
245
245
|
max: 1
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
|
-
e.onDragMove(p,
|
|
248
|
+
e.onDragMove(p, T);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
const _t = (t, n, e, r, o, i, a) => (
|
|
251
|
+
const _t = (t, n, e, r, o, i, a) => (u) => {
|
|
252
252
|
if (!r.isDragging || (r.isDragging = !1, !Y(r.startY)))
|
|
253
253
|
return;
|
|
254
254
|
e.onDragEnd();
|
|
255
|
-
const s = r.startY, b = t.getCoordinates(
|
|
256
|
-
if (
|
|
255
|
+
const s = r.startY, b = t.getCoordinates(u).y, l = I(n).y, f = yt(s, b), p = window.innerHeight, w = n.clientHeight;
|
|
256
|
+
if (f.isUp) {
|
|
257
257
|
const c = [...e.snapPoints].sort(
|
|
258
|
-
(
|
|
259
|
-
),
|
|
260
|
-
if (!e.expandable &&
|
|
258
|
+
(L, B) => L - B
|
|
259
|
+
), T = w + -l;
|
|
260
|
+
if (!e.expandable && T >= w)
|
|
261
261
|
return;
|
|
262
|
-
for (const
|
|
263
|
-
const B =
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
|
|
262
|
+
for (const L of c) {
|
|
263
|
+
const B = L * window.innerHeight;
|
|
264
|
+
if (T <= B) {
|
|
265
|
+
const k = V(
|
|
266
|
+
T,
|
|
267
267
|
B
|
|
268
268
|
);
|
|
269
269
|
a.translateContainer({
|
|
270
|
-
startY:
|
|
271
|
-
endY:
|
|
270
|
+
startY: l,
|
|
271
|
+
endY: l - k,
|
|
272
272
|
animationFrame: o,
|
|
273
273
|
bottomSheetContainer: n
|
|
274
274
|
});
|
|
@@ -277,35 +277,48 @@ const _t = (t, n, e, r, o, i, a) => (l) => {
|
|
|
277
277
|
}
|
|
278
278
|
const H = Et(
|
|
279
279
|
p,
|
|
280
|
-
|
|
280
|
+
w,
|
|
281
281
|
e.marginTop
|
|
282
282
|
);
|
|
283
283
|
a.translateContainer({
|
|
284
|
-
startY:
|
|
284
|
+
startY: l,
|
|
285
285
|
endY: H,
|
|
286
286
|
animationFrame: o,
|
|
287
287
|
bottomSheetContainer: n
|
|
288
288
|
});
|
|
289
|
-
} else if (
|
|
289
|
+
} else if (f.isDown) {
|
|
290
290
|
const c = [...e.snapPoints].sort(
|
|
291
|
-
(
|
|
291
|
+
(T, H) => H - T
|
|
292
292
|
);
|
|
293
|
-
for (const
|
|
294
|
-
const H =
|
|
295
|
-
if (
|
|
296
|
-
const B =
|
|
297
|
-
|
|
293
|
+
for (const T of c) {
|
|
294
|
+
const H = T * window.innerHeight, L = w + -l;
|
|
295
|
+
if (L >= H) {
|
|
296
|
+
const B = V(
|
|
297
|
+
L,
|
|
298
298
|
H
|
|
299
299
|
);
|
|
300
300
|
a.translateContainer({
|
|
301
|
-
startY:
|
|
302
|
-
endY:
|
|
301
|
+
startY: l,
|
|
302
|
+
endY: l + B,
|
|
303
303
|
animationFrame: o,
|
|
304
304
|
bottomSheetContainer: n
|
|
305
305
|
});
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
+
if (e.preventClosing) {
|
|
310
|
+
const T = w + -l;
|
|
311
|
+
if (T >= w) {
|
|
312
|
+
const H = V(T, w);
|
|
313
|
+
a.translateContainer({
|
|
314
|
+
startY: l,
|
|
315
|
+
endY: l + H,
|
|
316
|
+
animationFrame: o,
|
|
317
|
+
bottomSheetContainer: n
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
309
322
|
i();
|
|
310
323
|
}
|
|
311
324
|
};
|
|
@@ -420,7 +433,7 @@ class G {
|
|
|
420
433
|
};
|
|
421
434
|
}
|
|
422
435
|
}
|
|
423
|
-
function
|
|
436
|
+
function St(t) {
|
|
424
437
|
const n = t;
|
|
425
438
|
return `${n} ${n} 0px 0px`;
|
|
426
439
|
}
|
|
@@ -431,7 +444,7 @@ function jt(t, n) {
|
|
|
431
444
|
r.innerHTML = t.content ?? "";
|
|
432
445
|
const o = window.innerHeight;
|
|
433
446
|
e.bottomSheetContainer.style.maxHeight = `${o}px`, e.bottomSheetContentWrapper.appendChild(r);
|
|
434
|
-
const i =
|
|
447
|
+
const i = Vt({
|
|
435
448
|
bottomSheetElements: e,
|
|
436
449
|
bottomSheetProps: t,
|
|
437
450
|
options: n
|
|
@@ -445,62 +458,62 @@ function Wt(t) {
|
|
|
445
458
|
const n = x(
|
|
446
459
|
"dialog",
|
|
447
460
|
M([
|
|
448
|
-
|
|
461
|
+
C.Root,
|
|
449
462
|
ot.Dialog,
|
|
450
463
|
t.rootClass
|
|
451
464
|
]),
|
|
452
|
-
|
|
465
|
+
C.Root
|
|
453
466
|
);
|
|
454
467
|
n.ariaLabel = t.ariaLabel;
|
|
455
468
|
const e = x(
|
|
456
469
|
"section",
|
|
457
|
-
M([
|
|
458
|
-
|
|
470
|
+
M([C.Container, t.containerClass]),
|
|
471
|
+
C.Container
|
|
459
472
|
);
|
|
460
|
-
t.containerBorderRadius && (e.style.borderRadius =
|
|
473
|
+
t.containerBorderRadius && (e.style.borderRadius = St(
|
|
461
474
|
t.containerBorderRadius
|
|
462
475
|
));
|
|
463
476
|
const r = x(
|
|
464
477
|
"div",
|
|
465
|
-
|
|
466
|
-
|
|
478
|
+
C.GapFiller,
|
|
479
|
+
C.GapFiller
|
|
467
480
|
), o = x(
|
|
468
481
|
"button",
|
|
469
482
|
M([
|
|
470
|
-
|
|
483
|
+
C.Handle,
|
|
471
484
|
ot.Button,
|
|
472
|
-
t.shouldShowHandle ? null :
|
|
485
|
+
t.shouldShowHandle ? null : K.Hidden,
|
|
473
486
|
t.handleClass
|
|
474
487
|
]),
|
|
475
|
-
|
|
488
|
+
C.Handle
|
|
476
489
|
);
|
|
477
490
|
o.setAttribute("type", "button"), o.ariaLabel = "bottom sheet close button";
|
|
478
491
|
const i = x(
|
|
479
492
|
"span",
|
|
480
493
|
M([
|
|
481
|
-
|
|
482
|
-
t.shouldShowHandle ? null :
|
|
494
|
+
C.HandleBar,
|
|
495
|
+
t.shouldShowHandle ? null : K.Hidden
|
|
483
496
|
]),
|
|
484
|
-
|
|
497
|
+
C.HandleBar
|
|
485
498
|
), a = x(
|
|
486
499
|
"article",
|
|
487
500
|
M([
|
|
488
|
-
|
|
501
|
+
C.ContentWrapper,
|
|
489
502
|
t.contentWrapperClass
|
|
490
503
|
]),
|
|
491
|
-
|
|
492
|
-
),
|
|
504
|
+
C.ContentWrapper
|
|
505
|
+
), u = x(
|
|
493
506
|
"div",
|
|
494
507
|
M([
|
|
495
|
-
|
|
508
|
+
C.Backdrop,
|
|
496
509
|
t.backdropClass,
|
|
497
|
-
|
|
510
|
+
K.Hidden
|
|
498
511
|
]),
|
|
499
|
-
|
|
512
|
+
C.Backdrop
|
|
500
513
|
);
|
|
501
|
-
return t.backdropColor && (
|
|
514
|
+
return t.backdropColor && (u.style.backgroundColor = t.backdropColor), t.backDropTransition && (u.style.transition = t.backDropTransition), {
|
|
502
515
|
bottomSheetRoot: n,
|
|
503
|
-
bottomSheetBackdrop:
|
|
516
|
+
bottomSheetBackdrop: u,
|
|
504
517
|
bottomSheetContainer: e,
|
|
505
518
|
bottomSheetHandle: o,
|
|
506
519
|
bottomSheetHandleBar: i,
|
|
@@ -518,7 +531,7 @@ function Gt({
|
|
|
518
531
|
}) {
|
|
519
532
|
t.appendChild(n), e.appendChild(r), n.appendChild(e), n.appendChild(o), n.appendChild(i);
|
|
520
533
|
}
|
|
521
|
-
function
|
|
534
|
+
function Vt({
|
|
522
535
|
bottomSheetElements: t,
|
|
523
536
|
bottomSheetProps: n,
|
|
524
537
|
options: e
|
|
@@ -528,24 +541,24 @@ function $t({
|
|
|
528
541
|
bottomSheetContainer: o,
|
|
529
542
|
bottomSheetHandle: i,
|
|
530
543
|
bottomSheetContainerGapFiller: a,
|
|
531
|
-
bottomSheetContentWrapper:
|
|
544
|
+
bottomSheetContentWrapper: u,
|
|
532
545
|
bottomSheetBackdrop: s
|
|
533
|
-
} = t, { animationFrame: b } = e,
|
|
534
|
-
|
|
546
|
+
} = t, { animationFrame: b } = e, l = new G(i), f = new G(
|
|
547
|
+
u
|
|
535
548
|
), p = new G(
|
|
536
549
|
a
|
|
537
|
-
),
|
|
538
|
-
(E,
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
550
|
+
), w = n.dragTriggers.reduce(
|
|
551
|
+
(E, S) => {
|
|
552
|
+
const y = r.querySelectorAll(S);
|
|
553
|
+
if (!y.length)
|
|
541
554
|
return E;
|
|
542
|
-
const P = Array.from(
|
|
555
|
+
const P = Array.from(y).map((d) => d instanceof HTMLElement ? new G(d) : null).filter((d) => !!d);
|
|
543
556
|
return [...E, ...P];
|
|
544
557
|
},
|
|
545
558
|
[]
|
|
546
559
|
), c = new G(
|
|
547
560
|
window
|
|
548
|
-
),
|
|
561
|
+
), T = Mt(
|
|
549
562
|
c,
|
|
550
563
|
o,
|
|
551
564
|
n,
|
|
@@ -556,7 +569,7 @@ function $t({
|
|
|
556
569
|
n,
|
|
557
570
|
e.draggingState,
|
|
558
571
|
b
|
|
559
|
-
),
|
|
572
|
+
), L = _t(
|
|
560
573
|
c,
|
|
561
574
|
o,
|
|
562
575
|
n,
|
|
@@ -568,7 +581,7 @@ function $t({
|
|
|
568
581
|
function B(E) {
|
|
569
582
|
E.target instanceof Element && !r.contains(E.target) && e.onClose();
|
|
570
583
|
}
|
|
571
|
-
function
|
|
584
|
+
function k(E) {
|
|
572
585
|
Pt(
|
|
573
586
|
e.draggingState,
|
|
574
587
|
E.target,
|
|
@@ -576,39 +589,39 @@ function $t({
|
|
|
576
589
|
);
|
|
577
590
|
}
|
|
578
591
|
function N(E) {
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
onStart:
|
|
582
|
-
}),
|
|
583
|
-
|
|
584
|
-
onStart:
|
|
592
|
+
const S = E ?? n;
|
|
593
|
+
S.draggable && (l.addEventListeners({
|
|
594
|
+
onStart: k
|
|
595
|
+
}), w.forEach((y) => {
|
|
596
|
+
y.addEventListeners({
|
|
597
|
+
onStart: k,
|
|
585
598
|
onStartOptions: {
|
|
586
599
|
eventPhase: _.Target
|
|
587
600
|
}
|
|
588
601
|
});
|
|
589
|
-
})),
|
|
590
|
-
onStart:
|
|
602
|
+
})), S.draggable && S.backgroundDraggable && (f.addEventListeners({
|
|
603
|
+
onStart: k,
|
|
591
604
|
onStartOptions: {
|
|
592
605
|
eventPhase: _.Target
|
|
593
606
|
}
|
|
594
607
|
}), p.addEventListeners({
|
|
595
|
-
onStart:
|
|
596
|
-
})),
|
|
597
|
-
onStart:
|
|
608
|
+
onStart: k
|
|
609
|
+
})), S.draggable && c.addEventListeners({
|
|
610
|
+
onStart: T,
|
|
598
611
|
onMove: H,
|
|
599
|
-
onEnd:
|
|
600
|
-
}),
|
|
601
|
-
|
|
602
|
-
}), i.addEventListener("keyup", (
|
|
603
|
-
if (
|
|
612
|
+
onEnd: L
|
|
613
|
+
}), S.draggable && window.document.addEventListener("keyup", (y) => {
|
|
614
|
+
y.key === "Escape" && e.onClose();
|
|
615
|
+
}), i.addEventListener("keyup", (y) => {
|
|
616
|
+
if (y.key === "ArrowUp") {
|
|
604
617
|
e.moveUp();
|
|
605
618
|
return;
|
|
606
619
|
}
|
|
607
|
-
if (
|
|
620
|
+
if (y.key === "ArrowDown") {
|
|
608
621
|
e.moveDown();
|
|
609
622
|
return;
|
|
610
623
|
}
|
|
611
|
-
if (
|
|
624
|
+
if (y.shiftKey && y.key === "Tab") {
|
|
612
625
|
const P = nt(
|
|
613
626
|
t.bottomSheetContentWrapper
|
|
614
627
|
);
|
|
@@ -616,50 +629,50 @@ function $t({
|
|
|
616
629
|
}
|
|
617
630
|
});
|
|
618
631
|
}
|
|
619
|
-
function
|
|
632
|
+
function X() {
|
|
620
633
|
n.shouldCloseOnOutsideClick ? s.addEventListener("click", B) : s.style.pointerEvents = "none";
|
|
621
634
|
}
|
|
622
635
|
function tt() {
|
|
623
636
|
s.removeEventListener("click", B);
|
|
624
637
|
}
|
|
625
638
|
function nt(E) {
|
|
626
|
-
let
|
|
627
|
-
for (;
|
|
628
|
-
const
|
|
629
|
-
if (It(
|
|
630
|
-
return
|
|
631
|
-
|
|
632
|
-
...
|
|
633
|
-
...Array.from(
|
|
639
|
+
let S = [...Array.from(E.childNodes).reverse()];
|
|
640
|
+
for (; S.length; ) {
|
|
641
|
+
const y = S.shift();
|
|
642
|
+
if (It(y))
|
|
643
|
+
return y;
|
|
644
|
+
y && (S = [
|
|
645
|
+
...S,
|
|
646
|
+
...Array.from(y.childNodes).reverse()
|
|
634
647
|
]);
|
|
635
648
|
}
|
|
636
649
|
return null;
|
|
637
650
|
}
|
|
638
|
-
function
|
|
639
|
-
|
|
640
|
-
onStart:
|
|
641
|
-
}),
|
|
642
|
-
onStart:
|
|
651
|
+
function z() {
|
|
652
|
+
l.removeEventListeners({
|
|
653
|
+
onStart: k
|
|
654
|
+
}), f.removeEventListeners({
|
|
655
|
+
onStart: k
|
|
643
656
|
}), p.removeEventListeners({
|
|
644
|
-
onStart:
|
|
645
|
-
}),
|
|
657
|
+
onStart: k
|
|
658
|
+
}), w.forEach((E) => {
|
|
646
659
|
E.removeEventListeners({
|
|
647
|
-
onStart:
|
|
660
|
+
onStart: k
|
|
648
661
|
});
|
|
649
662
|
}), c.removeEventListeners({
|
|
650
|
-
onStart:
|
|
663
|
+
onStart: T,
|
|
651
664
|
onMove: H,
|
|
652
|
-
onEnd:
|
|
665
|
+
onEnd: L
|
|
653
666
|
});
|
|
654
667
|
}
|
|
655
668
|
return {
|
|
656
669
|
attachEventListeners: N,
|
|
657
|
-
clearEventListeners:
|
|
658
|
-
attacheOnOpenEventListeners:
|
|
670
|
+
clearEventListeners: z,
|
|
671
|
+
attacheOnOpenEventListeners: X,
|
|
659
672
|
clearOnOpenEventListeners: tt
|
|
660
673
|
};
|
|
661
674
|
}
|
|
662
|
-
class
|
|
675
|
+
class $t {
|
|
663
676
|
constructor() {
|
|
664
677
|
j(this, "animationId");
|
|
665
678
|
j(this, "isInProgress");
|
|
@@ -692,15 +705,15 @@ function Xt(t) {
|
|
|
692
705
|
animationFrame: o,
|
|
693
706
|
onEnd: i,
|
|
694
707
|
animationTimingFunction: a,
|
|
695
|
-
animationDuration:
|
|
708
|
+
animationDuration: u
|
|
696
709
|
} = t, s = Ct(n, e);
|
|
697
710
|
o.stop();
|
|
698
711
|
let b = !1;
|
|
699
|
-
o.start((
|
|
712
|
+
o.start((l) => {
|
|
700
713
|
Q(r, {
|
|
701
|
-
y: n + s * a(
|
|
702
|
-
}), !b &&
|
|
703
|
-
},
|
|
714
|
+
y: n + s * a(l)
|
|
715
|
+
}), !b && l >= 1 && (i == null || i(), b = !0);
|
|
716
|
+
}, u);
|
|
704
717
|
}
|
|
705
718
|
const st = (t, n) => (e) => {
|
|
706
719
|
Xt({
|
|
@@ -746,23 +759,23 @@ function Ot(t) {
|
|
|
746
759
|
}
|
|
747
760
|
function U(t, n, e, r) {
|
|
748
761
|
return function(s) {
|
|
749
|
-
return
|
|
762
|
+
return u(i(s));
|
|
750
763
|
};
|
|
751
764
|
function i(s) {
|
|
752
|
-
let b = 0,
|
|
765
|
+
let b = 0, l = 1, f = s, p;
|
|
753
766
|
if (s === 0 || s === 1)
|
|
754
767
|
return s;
|
|
755
|
-
for (; b <
|
|
756
|
-
if (p = a(
|
|
757
|
-
return
|
|
758
|
-
s > p ? b =
|
|
768
|
+
for (; b < l; ) {
|
|
769
|
+
if (p = a(f), Math.abs(p - s) < 1e-3)
|
|
770
|
+
return f;
|
|
771
|
+
s > p ? b = f : l = f, f = (l + b) / 2;
|
|
759
772
|
}
|
|
760
|
-
return
|
|
773
|
+
return f;
|
|
761
774
|
}
|
|
762
775
|
function a(s) {
|
|
763
776
|
return 3 * t * s * Math.pow(1 - s, 2) + 3 * e * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
764
777
|
}
|
|
765
|
-
function
|
|
778
|
+
function u(s) {
|
|
766
779
|
return 3 * n * s * Math.pow(1 - s, 2) + 3 * r * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
767
780
|
}
|
|
768
781
|
}
|
|
@@ -809,6 +822,7 @@ const en = {
|
|
|
809
822
|
onDragEnd: () => {
|
|
810
823
|
},
|
|
811
824
|
expandable: !0,
|
|
825
|
+
preventClosing: !1,
|
|
812
826
|
draggable: !0,
|
|
813
827
|
backgroundDraggable: !0,
|
|
814
828
|
shouldCloseOnOutsideClick: !0,
|
|
@@ -835,8 +849,8 @@ function rn(t) {
|
|
|
835
849
|
...en
|
|
836
850
|
}, e = Object.entries(t).reduce(
|
|
837
851
|
(o, i) => {
|
|
838
|
-
const [a,
|
|
839
|
-
return at(
|
|
852
|
+
const [a, u] = i;
|
|
853
|
+
return at(u) && (o[a] = u), o;
|
|
840
854
|
},
|
|
841
855
|
{}
|
|
842
856
|
);
|
|
@@ -856,28 +870,28 @@ function on(t, n, e, r) {
|
|
|
856
870
|
function o(i, a) {
|
|
857
871
|
switch (i) {
|
|
858
872
|
case "content":
|
|
859
|
-
|
|
873
|
+
O(a) && (t.bottomSheetContentWrapper.innerHTML = a);
|
|
860
874
|
break;
|
|
861
875
|
case "width":
|
|
862
|
-
|
|
876
|
+
O(a) && (t.bottomSheetContainer.style.width = a);
|
|
863
877
|
break;
|
|
864
878
|
case "shouldShowHandle":
|
|
865
|
-
pt(a) ||
|
|
879
|
+
pt(a) || q(t.bottomSheetHandle, !1);
|
|
866
880
|
break;
|
|
867
881
|
case "shouldShowBackdrop":
|
|
868
|
-
pt(a) ||
|
|
882
|
+
pt(a) || q(t.bottomSheetBackdrop, !1);
|
|
869
883
|
break;
|
|
870
884
|
case "containerBorderRadius":
|
|
871
|
-
|
|
885
|
+
O(a) && (t.bottomSheetContainer.style.borderRadius = St(a));
|
|
872
886
|
break;
|
|
873
887
|
case "backdropColor":
|
|
874
|
-
|
|
888
|
+
O(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
|
|
875
889
|
break;
|
|
876
890
|
case "backDropTransition":
|
|
877
|
-
|
|
891
|
+
O(a) && (t.bottomSheetBackdrop.style.transition = a);
|
|
878
892
|
break;
|
|
879
893
|
case "rootClass":
|
|
880
|
-
if (!
|
|
894
|
+
if (!O(a))
|
|
881
895
|
return;
|
|
882
896
|
W(
|
|
883
897
|
t.bottomSheetRoot,
|
|
@@ -886,7 +900,7 @@ function on(t, n, e, r) {
|
|
|
886
900
|
);
|
|
887
901
|
break;
|
|
888
902
|
case "containerClass":
|
|
889
|
-
if (!
|
|
903
|
+
if (!O(a))
|
|
890
904
|
return;
|
|
891
905
|
W(
|
|
892
906
|
t.bottomSheetContainer,
|
|
@@ -895,7 +909,7 @@ function on(t, n, e, r) {
|
|
|
895
909
|
);
|
|
896
910
|
break;
|
|
897
911
|
case "handleClass":
|
|
898
|
-
if (!
|
|
912
|
+
if (!O(a))
|
|
899
913
|
return;
|
|
900
914
|
W(
|
|
901
915
|
t.bottomSheetHandle,
|
|
@@ -904,7 +918,7 @@ function on(t, n, e, r) {
|
|
|
904
918
|
);
|
|
905
919
|
break;
|
|
906
920
|
case "contentWrapperClass":
|
|
907
|
-
if (!
|
|
921
|
+
if (!O(a))
|
|
908
922
|
return;
|
|
909
923
|
W(
|
|
910
924
|
t.bottomSheetContentWrapper,
|
|
@@ -913,7 +927,7 @@ function on(t, n, e, r) {
|
|
|
913
927
|
);
|
|
914
928
|
break;
|
|
915
929
|
case "backdropClass":
|
|
916
|
-
if (!
|
|
930
|
+
if (!O(a))
|
|
917
931
|
return;
|
|
918
932
|
W(
|
|
919
933
|
t.bottomSheetBackdrop,
|
|
@@ -924,13 +938,16 @@ function on(t, n, e, r) {
|
|
|
924
938
|
case "expandable":
|
|
925
939
|
r.clearEventListeners(), r.attachEventListeners(e);
|
|
926
940
|
break;
|
|
941
|
+
case "preventClosing":
|
|
942
|
+
r.clearEventListeners(), r.attachEventListeners(e);
|
|
943
|
+
break;
|
|
927
944
|
case "draggable":
|
|
928
945
|
r.clearEventListeners(), r.attachEventListeners(e);
|
|
929
946
|
break;
|
|
930
947
|
case "draggingAnimationTimings":
|
|
931
948
|
if (Ot(a)) {
|
|
932
|
-
const
|
|
933
|
-
|
|
949
|
+
const u = ct(a), s = st(
|
|
950
|
+
u,
|
|
934
951
|
e.draggingAnimationDuration
|
|
935
952
|
);
|
|
936
953
|
n.translateContainer = s;
|
|
@@ -938,10 +955,10 @@ function on(t, n, e, r) {
|
|
|
938
955
|
break;
|
|
939
956
|
case "draggingAnimationDuration":
|
|
940
957
|
if (Y(a)) {
|
|
941
|
-
const
|
|
958
|
+
const u = ct(
|
|
942
959
|
e.draggingAnimationTimings
|
|
943
960
|
), s = st(
|
|
944
|
-
|
|
961
|
+
u,
|
|
945
962
|
a
|
|
946
963
|
);
|
|
947
964
|
n.translateContainer = s;
|
|
@@ -1003,123 +1020,123 @@ function cn(t) {
|
|
|
1003
1020
|
function a() {
|
|
1004
1021
|
i.originalDocumentOverflowY && i.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = i.originalDocumentOverflowY), i.originalDocumentOverscrollBehavior && (document.body.style.position = i.originalDocumentOverscrollBehavior);
|
|
1005
1022
|
}
|
|
1006
|
-
const
|
|
1007
|
-
animationFrame:
|
|
1023
|
+
const u = new $t(), s = {
|
|
1024
|
+
animationFrame: u,
|
|
1008
1025
|
onClose: B,
|
|
1009
1026
|
bottomSheetState: o,
|
|
1010
1027
|
draggingState: i,
|
|
1011
1028
|
snapTo: P,
|
|
1012
|
-
moveUp:
|
|
1013
|
-
moveDown:
|
|
1014
|
-
}, { elements: b, eventHandlers:
|
|
1029
|
+
moveUp: S,
|
|
1030
|
+
moveDown: y
|
|
1031
|
+
}, { elements: b, eventHandlers: l } = jt(
|
|
1015
1032
|
n,
|
|
1016
1033
|
s
|
|
1017
|
-
),
|
|
1034
|
+
), f = Kt(
|
|
1018
1035
|
n,
|
|
1019
1036
|
on(
|
|
1020
1037
|
b,
|
|
1021
1038
|
o,
|
|
1022
1039
|
n,
|
|
1023
|
-
|
|
1040
|
+
l
|
|
1024
1041
|
)
|
|
1025
|
-
), { bottomSheetBackdrop: p, bottomSheetRoot:
|
|
1026
|
-
const g =
|
|
1027
|
-
g.appendChild(
|
|
1042
|
+
), { bottomSheetBackdrop: p, bottomSheetRoot: w, bottomSheetContainer: c } = b, T = (d) => {
|
|
1043
|
+
const g = d ?? window.document.body;
|
|
1044
|
+
g.appendChild(w), g.appendChild(p);
|
|
1028
1045
|
const h = window.innerHeight;
|
|
1029
1046
|
Q(c, {
|
|
1030
1047
|
y: h
|
|
1031
|
-
}),
|
|
1048
|
+
}), l.attachEventListeners(), o.isMounted = !0;
|
|
1032
1049
|
}, H = () => {
|
|
1033
|
-
|
|
1034
|
-
|
|
1050
|
+
l.clearEventListeners(), Object.values(b).forEach((d) => {
|
|
1051
|
+
d.remove();
|
|
1035
1052
|
}), a(), o.isMounted = !1;
|
|
1036
|
-
},
|
|
1053
|
+
}, L = () => {
|
|
1037
1054
|
var D;
|
|
1038
|
-
if (
|
|
1055
|
+
if (k() || qt(
|
|
1039
1056
|
'Bottom Sheet is not mounted yet. call the "mount" method first.'
|
|
1040
1057
|
), (D = t.beforeOpen) == null || D.call(t), N())
|
|
1041
1058
|
return;
|
|
1042
|
-
et(p, !0),
|
|
1059
|
+
et(p, !0), f.shouldShowBackdrop || $(p, "transparent"), et([c], !0), Q(c, {
|
|
1043
1060
|
y: c.clientHeight
|
|
1044
1061
|
});
|
|
1045
1062
|
const g = window.innerHeight, h = dt(
|
|
1046
1063
|
g,
|
|
1047
1064
|
c.clientHeight,
|
|
1048
|
-
|
|
1049
|
-
|
|
1065
|
+
f.marginTop,
|
|
1066
|
+
f.defaultPosition
|
|
1050
1067
|
), m = I(c).y;
|
|
1051
1068
|
o.translateContainer({
|
|
1052
1069
|
startY: m,
|
|
1053
1070
|
endY: h,
|
|
1054
|
-
animationFrame:
|
|
1071
|
+
animationFrame: u,
|
|
1055
1072
|
bottomSheetContainer: c,
|
|
1056
1073
|
onEnd: t.afterOpen
|
|
1057
1074
|
});
|
|
1058
1075
|
const v = document.body.style.overflowY;
|
|
1059
1076
|
i.originalDocumentOverflowY = v || "initial";
|
|
1060
|
-
const
|
|
1061
|
-
i.originalDocumentOverscrollBehavior =
|
|
1077
|
+
const A = document.body.style.overscrollBehavior;
|
|
1078
|
+
i.originalDocumentOverscrollBehavior = A || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", b.bottomSheetHandle.focus(), l.attacheOnOpenEventListeners();
|
|
1062
1079
|
};
|
|
1063
1080
|
function B() {
|
|
1064
1081
|
var h;
|
|
1065
|
-
if (
|
|
1082
|
+
if (X())
|
|
1066
1083
|
return;
|
|
1067
1084
|
(h = t.beforeClose) == null || h.call(t);
|
|
1068
|
-
const
|
|
1085
|
+
const d = I(c).y, g = c.clientHeight;
|
|
1069
1086
|
o.translateContainer({
|
|
1070
|
-
startY:
|
|
1087
|
+
startY: d,
|
|
1071
1088
|
endY: g,
|
|
1072
|
-
animationFrame:
|
|
1089
|
+
animationFrame: u,
|
|
1073
1090
|
bottomSheetContainer: c,
|
|
1074
1091
|
onEnd: () => {
|
|
1075
1092
|
var m;
|
|
1076
|
-
(m = t.afterClose) == null || m.call(t), et([p, c], !1),
|
|
1093
|
+
(m = t.afterClose) == null || m.call(t), et([p, c], !1), l.clearOnOpenEventListeners();
|
|
1077
1094
|
}
|
|
1078
1095
|
}), a();
|
|
1079
1096
|
}
|
|
1080
|
-
function
|
|
1097
|
+
function k() {
|
|
1081
1098
|
return o.isMounted;
|
|
1082
1099
|
}
|
|
1083
1100
|
function N() {
|
|
1084
|
-
const
|
|
1085
|
-
return
|
|
1101
|
+
const d = I(c).y, g = window.innerHeight, h = c.clientHeight >= g ? g : c.clientHeight;
|
|
1102
|
+
return d <= h;
|
|
1086
1103
|
}
|
|
1087
|
-
function
|
|
1104
|
+
function X() {
|
|
1088
1105
|
return !N();
|
|
1089
1106
|
}
|
|
1090
1107
|
function tt() {
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1108
|
+
const d = I(c).y, g = c.clientHeight, h = window.innerHeight;
|
|
1109
|
+
if (d <= 5 && d >= -5)
|
|
1093
1110
|
return R.CONTENT_HEIGHT;
|
|
1094
|
-
const m = g -
|
|
1111
|
+
const m = g - d;
|
|
1095
1112
|
if (m === h / 2)
|
|
1096
1113
|
return R.MIDDLE;
|
|
1097
|
-
const v = h -
|
|
1098
|
-
return m <= v +
|
|
1114
|
+
const v = h - f.marginTop, A = 10;
|
|
1115
|
+
return m <= v + A && m >= v - A ? R.TOP : R.CLOSED;
|
|
1099
1116
|
}
|
|
1100
1117
|
function nt() {
|
|
1101
1118
|
return c.clientHeight;
|
|
1102
1119
|
}
|
|
1103
|
-
function
|
|
1120
|
+
function z(d) {
|
|
1104
1121
|
if (!N())
|
|
1105
1122
|
return;
|
|
1106
|
-
const g = I(c).y, m = c.clientHeight - g, v = window.innerHeight -
|
|
1123
|
+
const g = I(c).y, m = c.clientHeight - g, v = window.innerHeight - d, A = xt(m, v), D = V(m, v);
|
|
1107
1124
|
o.translateContainer({
|
|
1108
1125
|
startY: g,
|
|
1109
|
-
endY: g + (
|
|
1110
|
-
animationFrame:
|
|
1126
|
+
endY: g + (A.isUp ? -D : D),
|
|
1127
|
+
animationFrame: u,
|
|
1111
1128
|
bottomSheetContainer: c
|
|
1112
1129
|
});
|
|
1113
1130
|
}
|
|
1114
|
-
function E(
|
|
1131
|
+
function E(d, {
|
|
1115
1132
|
viewportHeight: g,
|
|
1116
1133
|
visibleHeight: h
|
|
1117
1134
|
}) {
|
|
1118
1135
|
let m = null;
|
|
1119
|
-
for (const v of
|
|
1120
|
-
const
|
|
1136
|
+
for (const v of d) {
|
|
1137
|
+
const A = v * g, D = V(
|
|
1121
1138
|
h,
|
|
1122
|
-
|
|
1139
|
+
A
|
|
1123
1140
|
);
|
|
1124
1141
|
(m === null || D < m) && (m = D);
|
|
1125
1142
|
}
|
|
@@ -1127,28 +1144,28 @@ function cn(t) {
|
|
|
1127
1144
|
minOffset: m
|
|
1128
1145
|
};
|
|
1129
1146
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1132
|
-
if (!
|
|
1147
|
+
function S() {
|
|
1148
|
+
const d = [...f.snapPoints].reverse(), g = I(c).y, h = c.clientHeight, m = h - g;
|
|
1149
|
+
if (!f.expandable && m >= h)
|
|
1133
1150
|
return;
|
|
1134
|
-
const v = window.innerHeight,
|
|
1151
|
+
const v = window.innerHeight, A = ft(
|
|
1135
1152
|
"above",
|
|
1136
1153
|
{ visibleHeight: m, viewportHeight: v },
|
|
1137
|
-
|
|
1138
|
-
), { minOffset: D } = E(
|
|
1154
|
+
d
|
|
1155
|
+
), { minOffset: D } = E(A, {
|
|
1139
1156
|
visibleHeight: m,
|
|
1140
1157
|
viewportHeight: v
|
|
1141
1158
|
});
|
|
1142
|
-
if (D === null && m < v -
|
|
1159
|
+
if (D === null && m < v - f.marginTop) {
|
|
1143
1160
|
o.translateContainer({
|
|
1144
1161
|
startY: g,
|
|
1145
1162
|
endY: dt(
|
|
1146
1163
|
v,
|
|
1147
1164
|
h,
|
|
1148
|
-
|
|
1165
|
+
f.marginTop,
|
|
1149
1166
|
"top"
|
|
1150
1167
|
),
|
|
1151
|
-
animationFrame:
|
|
1168
|
+
animationFrame: u,
|
|
1152
1169
|
bottomSheetContainer: c
|
|
1153
1170
|
});
|
|
1154
1171
|
return;
|
|
@@ -1156,49 +1173,49 @@ function cn(t) {
|
|
|
1156
1173
|
Y(D) && o.translateContainer({
|
|
1157
1174
|
startY: g,
|
|
1158
1175
|
endY: g - D,
|
|
1159
|
-
animationFrame:
|
|
1176
|
+
animationFrame: u,
|
|
1160
1177
|
bottomSheetContainer: c
|
|
1161
1178
|
});
|
|
1162
1179
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
1180
|
+
function y() {
|
|
1181
|
+
const d = I(c).y, h = c.clientHeight - d;
|
|
1165
1182
|
if (h < 1)
|
|
1166
1183
|
return;
|
|
1167
1184
|
const m = window.innerHeight, v = ft(
|
|
1168
1185
|
"below",
|
|
1169
1186
|
{ visibleHeight: h, viewportHeight: m },
|
|
1170
|
-
|
|
1171
|
-
), { minOffset:
|
|
1187
|
+
f.snapPoints
|
|
1188
|
+
), { minOffset: A } = E(v, {
|
|
1172
1189
|
visibleHeight: h,
|
|
1173
1190
|
viewportHeight: m
|
|
1174
1191
|
});
|
|
1175
|
-
Y(
|
|
1176
|
-
startY:
|
|
1177
|
-
endY:
|
|
1178
|
-
animationFrame:
|
|
1192
|
+
Y(A) && o.translateContainer({
|
|
1193
|
+
startY: d,
|
|
1194
|
+
endY: d + A,
|
|
1195
|
+
animationFrame: u,
|
|
1179
1196
|
bottomSheetContainer: c
|
|
1180
1197
|
});
|
|
1181
1198
|
}
|
|
1182
|
-
function P(
|
|
1199
|
+
function P(d) {
|
|
1183
1200
|
const g = window.innerHeight;
|
|
1184
|
-
if (!zt(
|
|
1201
|
+
if (!zt(d))
|
|
1185
1202
|
return;
|
|
1186
|
-
const h = J(g *
|
|
1187
|
-
|
|
1203
|
+
const h = J(g * d, 2);
|
|
1204
|
+
z(h);
|
|
1188
1205
|
}
|
|
1189
1206
|
return {
|
|
1190
|
-
props:
|
|
1207
|
+
props: f,
|
|
1191
1208
|
elements: b,
|
|
1192
|
-
mount:
|
|
1209
|
+
mount: T,
|
|
1193
1210
|
unmount: H,
|
|
1194
|
-
open:
|
|
1211
|
+
open: L,
|
|
1195
1212
|
close: B,
|
|
1196
|
-
getIsMounted:
|
|
1213
|
+
getIsMounted: k,
|
|
1197
1214
|
getIsOpen: N,
|
|
1198
|
-
getIsClosed:
|
|
1215
|
+
getIsClosed: X,
|
|
1199
1216
|
getPosition: tt,
|
|
1200
1217
|
getHeight: nt,
|
|
1201
|
-
moveTo:
|
|
1218
|
+
moveTo: z,
|
|
1202
1219
|
snapTo: P
|
|
1203
1220
|
};
|
|
1204
1221
|
}
|
|
@@ -1240,10 +1257,10 @@ export {
|
|
|
1240
1257
|
R as BOTTOM_SHEET_POSITION,
|
|
1241
1258
|
sn as BOTTOM_SHEET_SELECTORS,
|
|
1242
1259
|
F as COMMON_ANIMATION_KEYS,
|
|
1243
|
-
|
|
1260
|
+
C as ClassNames,
|
|
1244
1261
|
_ as EventPhase,
|
|
1245
1262
|
ot as ResetClassNames,
|
|
1246
|
-
|
|
1263
|
+
K as UtilClassNames,
|
|
1247
1264
|
cn as createBottomSheet,
|
|
1248
1265
|
ln as createPlaceholderBottomSheet,
|
|
1249
1266
|
mt as eventPhaseToEnum,
|
|
@@ -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%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
(function(
|
|
3
|
-
/*$vite$:1*/`,document.head.appendChild(O);function T(t){return typeof t=="string"}function xt(t,n){return t.classList.contains(K(n))}function $(t,n){t.classList.add(K(n))}function rt(t,n){t.classList.remove(K(n))}function G(t,n,e){T(e)&&(T(n)&&rt(t,n),$(t,e))}function K(t){return T(t)?t.trim().replace(/\./g,""):""}function F(t){return t.map(n=>K(n)).filter(Boolean).join(" ")}function Yt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const ht="open",gt="hidden";function ot(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?($(t,ht),rt(t,gt)):($(t,gt),rt(t,ht))}function mt(t){return t instanceof HTMLElement}function D(t){return typeof t=="number"&&!Number.isNaN(t)}function Pt(t){mt(t)&&t.focus()}function It(t){if(!mt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=D(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var y=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(y||{}),J=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(J||{}),V=(t=>(t.Hidden="hidden",t))(V||{});function N(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{$(r,i)}),T(e)&&r.setAttribute("data-testid",e),r}const Nt={CONTENTS_WRAPPER:Yt([y.Root,y.ContentWrapper])};function bt(t,n,e,r){switch(r){case"content-height":return n>=t?Et(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function pt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Tt(t,n){return n<t?-(t-n):n-t}function Q(t,n){return t>n?t-n:n-t}function Mt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function yt(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function Et(t,n,e){return-(t-n)+e}function Ct(t){return Number(t.replace("px",""))}function Z(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function _t(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function wt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function I(t){const n=t.style.transform,e=vt(n),r=wt(e,it);return St(r??{type:it,values:[]})}function tt(t,{x:n,y:e}){const{transform:r,transformValues:o}=_t(t),i=wt(o,it);if(i){const a=St(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function St(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:Ct(n)??0,y:Ct(e)??0}}function at(t){return t!=null}function Ot(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Rt=(t,n,e)=>{n instanceof HTMLElement&&!xt(n,y.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=I(n),e.onDragStart()},jt=(t,n,e,r,o)=>i=>{Ut(i,t,e,r,o,n,e.marginTop)};function Ut(t,n,e,r,o,i,a){if(!r.isDragging||!D(r.startY))return;const l=n.getCoordinates(t).y,s=Tt(r.startY,l),p=window.innerHeight,f=i.clientHeight,u=f-(r.containerStartTranslate.y+s);if(u>=p)return;const E=pt(r.startY,l);if(E.isUp&&!e.expandable&&u>=f)return;o.start(()=>{tt(i,{y:r.containerStartTranslate.y+s})},0);const x=p-a,c=f-r.containerStartTranslate.y;if(E.isUp){const v=x-c,k=x-u,L=Ot(1-Z(k/v,2),{min:0,max:1});e.onDragMove(E,L)}else if(E.isDown){const v=Ot(Z(1-u/c,2),{min:0,max:1});e.onDragMove(E,v)}}const Wt=(t,n,e,r,o,i,a)=>l=>{if(!r.isDragging||(r.isDragging=!1,!D(r.startY)))return;e.onDragEnd();const s=r.startY,p=t.getCoordinates(l).y,f=I(n).y,u=pt(s,p),E=window.innerHeight,x=n.clientHeight;if(u.isUp){const c=[...e.snapPoints].sort((L,Y)=>L-Y),v=x+-f;if(!e.expandable&&v>=x)return;for(const L of c){const Y=L*window.innerHeight;if(v<=Y){const A=Q(v,Y);a.translateContainer({startY:f,endY:f-A,animationFrame:o,bottomSheetContainer:n});return}}const k=Et(E,x,e.marginTop);a.translateContainer({startY:f,endY:k,animationFrame:o,bottomSheetContainer:n})}else if(u.isDown){const c=[...e.snapPoints].sort((v,k)=>k-v);for(const v of c){const k=v*window.innerHeight,L=x+-f;if(L>=k){const Y=Q(L,k);a.translateContainer({startY:f,endY:f+Y,animationFrame:o,bottomSheetContainer:n});return}}i()}};var M=(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))(M||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:M.All};class z{constructor(n){X(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=$t,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===M.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===M.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function Gt(t,n){const e=Vt(t);zt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Xt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Vt(t){const n=N("dialog",F([y.Root,J.Dialog,t.rootClass]),y.Root);n.ariaLabel=t.ariaLabel;const e=N("section",F([y.Container,t.containerClass]),y.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=N("div",y.GapFiller,y.GapFiller),o=N("button",F([y.Handle,J.Button,t.shouldShowHandle?null:V.Hidden,t.handleClass]),y.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=N("span",F([y.HandleBar,t.shouldShowHandle?null:V.Hidden]),y.HandleBar),a=N("article",F([y.ContentWrapper,t.contentWrapperClass]),y.ContentWrapper),l=N("div",F([y.Backdrop,t.backdropClass,V.Hidden]),y.Backdrop);return t.backdropColor&&(l.style.backgroundColor=t.backdropColor),t.backDropTransition&&(l.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:l,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function zt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Xt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:l,bottomSheetBackdrop:s}=t,{animationFrame:p}=e,f=new z(i),u=new z(l),E=new z(a),x=n.dragTriggers.reduce((w,H)=>{const C=r.querySelectorAll(H);if(!C.length)return w;const W=Array.from(C).map(d=>d instanceof HTMLElement?new z(d):null).filter(d=>!!d);return[...w,...W]},[]),c=new z(window),v=Ft(c,o,n,e.draggingState),k=jt(c,o,n,e.draggingState,p),L=Wt(c,o,n,e.draggingState,p,e.onClose,e.bottomSheetState);function Y(w){w.target instanceof Element&&!r.contains(w.target)&&e.onClose()}function A(w){Rt(e.draggingState,w.target,t.bottomSheetContentWrapper)}function U(w){const H=w??n;H.draggable&&(f.addEventListeners({onStart:A}),x.forEach(C=>{C.addEventListeners({onStart:A,onStartOptions:{eventPhase:M.Target}})})),H.draggable&&H.backgroundDraggable&&(u.addEventListeners({onStart:A,onStartOptions:{eventPhase:M.Target}}),E.addEventListeners({onStart:A})),H.draggable&&c.addEventListeners({onStart:v,onMove:k,onEnd:L}),H.draggable&&window.document.addEventListener("keyup",C=>{C.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",C=>{if(C.key==="ArrowUp"){e.moveUp();return}if(C.key==="ArrowDown"){e.moveDown();return}if(C.shiftKey&&C.key==="Tab"){const W=ft(t.bottomSheetContentWrapper);Pt(W)}})}function nt(){n.shouldCloseOnOutsideClick?s.addEventListener("click",Y):s.style.pointerEvents="none"}function ut(){s.removeEventListener("click",Y)}function ft(w){let H=[...Array.from(w.childNodes).reverse()];for(;H.length;){const C=H.shift();if(It(C))return C;C&&(H=[...H,...Array.from(C.childNodes).reverse()])}return null}function et(){f.removeEventListeners({onStart:A}),u.removeEventListeners({onStart:A}),E.removeEventListeners({onStart:A}),x.forEach(w=>{w.removeEventListeners({onStart:A})}),c.removeEventListeners({onStart:v,onMove:k,onEnd:L})}return{attachEventListeners:U,clearEventListeners:et,attacheOnOpenEventListeners:nt,clearOnOpenEventListeners:ut}}class Kt{constructor(){X(this,"animationId");X(this,"isInProgress");X(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Z(a/e,2),p=s>=1&&!r;n(s),p?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,D(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:l}=t,s=Tt(n,e);o.stop();let p=!1;o.start(f=>{tt(r,{y:n+s*a(f)}),!p&&f>=1&&(i==null||i(),p=!0)},l)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},_={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!D(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const R={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function kt(t){for(const n of Object.values(R))if(n===t)return!0;return!1}function lt(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&D(t.p1x)&&D(t.p1y)&&D(t.p2x)&&D(t.p2y))}function j(t,n,e,r){return function(s){return l(i(s))};function i(s){let p=0,f=1,u=s,E;if(s===0||s===1)return s;for(;p<f;){if(E=a(u),Math.abs(E-s)<.001)return u;s>E?p=u:f=u,u=(f+p)/2}return u}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function l(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const Lt=j(.25,.1,.25,1),tn=j(.42,0,1,1),At=j(.42,0,.58,1),nn=j(.4,.1,.6,1),en=j(.45,1.5,.55,1);function rn(t){switch(t){case R.EASE:return Lt;case R.EASE_IN:return tn;case R.EASE_OUT:return At;case R.EASE_IN_OUT:return nn;case R.SPRING:return en;default:return Lt}}function Bt(t){return typeof t=="boolean"}const Dt={ariaLabel:"Bottom sheet",content:"",defaultPosition:_.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,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{}};function on(t){const n={...Dt},e=Object.entries(t).reduce((o,i)=>{const[a,l]=i;return at(l)&&(o[a]=l),o},{});return{...n,...e}}function dt(t){if(lt(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return kt(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":T(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":T(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Bt(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Bt(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":T(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"backdropColor":T(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":T(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!T(a))return;G(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!T(a))return;G(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!T(a))return;G(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!T(a))return;G(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!T(a))return;G(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(lt(a)){const l=dt(a),s=ct(l,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(D(a)){const l=dt(e.draggingAnimationTimings),s=ct(l,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=dt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const l=new Kt,s={animationFrame:l,onClose:Y,bottomSheetState:o,draggingState:i,snapTo:W,moveUp:H,moveDown:C},{elements:p,eventHandlers:f}=Gt(n,s),u=Qt(n,an(p,o,n,f)),{bottomSheetBackdrop:E,bottomSheetRoot:x,bottomSheetContainer:c}=p,v=d=>{const h=d??window.document.body;h.appendChild(x),h.appendChild(E);const m=window.innerHeight;tt(c,{y:m}),f.attachEventListeners(),o.isMounted=!0},k=()=>{f.clearEventListeners(),Object.values(p).forEach(d=>{d.remove()}),a(),o.isMounted=!1},L=()=>{var P;if(A()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(P=t.beforeOpen)==null||P.call(t),U())return;ot(E,!0),u.shouldShowBackdrop||$(E,"transparent"),ot([c],!0),tt(c,{y:c.clientHeight});const h=window.innerHeight,m=bt(h,c.clientHeight,u.marginTop,u.defaultPosition),b=I(c).y;o.translateContainer({startY:b,endY:m,animationFrame:l,bottomSheetContainer:c,onEnd:t.afterOpen});const S=document.body.style.overflowY;i.originalDocumentOverflowY=S||"initial";const B=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=B||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",p.bottomSheetHandle.focus(),f.attacheOnOpenEventListeners()};function Y(){var m;if(nt())return;(m=t.beforeClose)==null||m.call(t);const d=I(c).y,h=c.clientHeight;o.translateContainer({startY:d,endY:h,animationFrame:l,bottomSheetContainer:c,onEnd:()=>{var b;(b=t.afterClose)==null||b.call(t),ot([E,c],!1),f.clearOnOpenEventListeners()}}),a()}function A(){return o.isMounted}function U(){const d=I(c).y,h=window.innerHeight,m=c.clientHeight>=h?h:c.clientHeight;return d<=m}function nt(){return!U()}function ut(){const d=I(c).y,h=c.clientHeight,m=window.innerHeight;if(d<=5&&d>=-5)return _.CONTENT_HEIGHT;const b=h-d;if(b===m/2)return _.MIDDLE;const S=m-u.marginTop,B=10;return b<=S+B&&b>=S-B?_.TOP:_.CLOSED}function ft(){return c.clientHeight}function et(d){if(!U())return;const h=I(c).y,b=c.clientHeight-h,S=window.innerHeight-d,B=Mt(b,S),P=Q(b,S);o.translateContainer({startY:h,endY:h+(B.isUp?-P:P),animationFrame:l,bottomSheetContainer:c})}function w(d,{viewportHeight:h,visibleHeight:m}){let b=null;for(const S of d){const B=S*h,P=Q(m,B);(b===null||P<b)&&(b=P)}return{minOffset:b}}function H(){const d=[...u.snapPoints].reverse(),h=I(c).y,m=c.clientHeight,b=m-h;if(!u.expandable&&b>=m)return;const S=window.innerHeight,B=yt("above",{visibleHeight:b,viewportHeight:S},d),{minOffset:P}=w(B,{visibleHeight:b,viewportHeight:S});if(P===null&&b<S-u.marginTop){o.translateContainer({startY:h,endY:bt(S,m,u.marginTop,"top"),animationFrame:l,bottomSheetContainer:c});return}D(P)&&o.translateContainer({startY:h,endY:h-P,animationFrame:l,bottomSheetContainer:c})}function C(){const d=I(c).y,m=c.clientHeight-d;if(m<1)return;const b=window.innerHeight,S=yt("below",{visibleHeight:m,viewportHeight:b},u.snapPoints),{minOffset:B}=w(S,{visibleHeight:m,viewportHeight:b});D(B)&&o.translateContainer({startY:d,endY:d+B,animationFrame:l,bottomSheetContainer:c})}function W(d){const h=window.innerHeight;if(!Jt(d))return;const m=Z(h*d,2);et(m)}return{props:u,elements:p,mount:v,unmount:k,open:L,close:Y,getIsMounted:A,getIsOpen:U,getIsClosed:nt,getPosition:ut,getHeight:ft,moveTo:et,snapTo:W}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>_.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}g.BOTTOM_SHEET_DEFAULT_PROPS=Dt,g.BOTTOM_SHEET_POSITION=_,g.BOTTOM_SHEET_SELECTORS=Nt,g.COMMON_ANIMATION_KEYS=R,g.ClassNames=y,g.EventPhase=M,g.ResetClassNames=J,g.UtilClassNames=V,g.createBottomSheet=sn,g.createPlaceholderBottomSheet=cn,g.eventPhaseToEnum=st,g.isAnimationTimingPoints=lt,g.isCommonAnimationTimingsKey=kt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.BottomSheet={}))})(this,function(h){"use strict";var ln=Object.defineProperty;var dn=(h,k,T)=>k in h?ln(h,k,{enumerable:!0,configurable:!0,writable:!0,value:T}):h[k]=T;var K=(h,k,T)=>dn(h,typeof k!="symbol"?k+"":k,T);var k=document.createElement("style");k.textContent=`.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;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(k);function T(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(q(n))}function $(t,n){t.classList.add(q(n))}function rt(t,n){t.classList.remove(q(n))}function G(t,n,e){T(e)&&(T(n)&&rt(t,n),$(t,e))}function q(t){return T(t)?t.trim().replace(/\./g,""):""}function F(t){return t.map(n=>q(n)).filter(Boolean).join(" ")}function xt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const gt="open",ht="hidden";function ot(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{J(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}J(t,e),t.setAttribute("aria-modal",e?"true":"false")}function J(t,n){n?($(t,gt),rt(t,ht)):($(t,ht),rt(t,gt))}function bt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){bt(t)&&t.focus()}function Nt(t){if(!bt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var y=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(y||{}),Q=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(Q||{}),V=(t=>(t.Hidden="hidden",t))(V||{});function P(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{$(r,i)}),T(e)&&r.setAttribute("data-testid",e),r}const Pt={CONTENTS_WRAPPER:xt([y.Root,y.ContentWrapper])};function mt(t,n,e,r){switch(r){case"content-height":return n>=t?Et(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function pt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Tt(t,n){return n<t?-(t-n):n-t}function z(t,n){return t>n?t-n:n-t}function Mt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function yt(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function Et(t,n,e){return-(t-n)+e}function Ct(t){return Number(t.replace("px",""))}function Z(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function _t(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function wt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function N(t){const n=t.style.transform,e=vt(n),r=wt(e,it);return St(r??{type:it,values:[]})}function tt(t,{x:n,y:e}){const{transform:r,transformValues:o}=_t(t),i=wt(o,it);if(i){const a=St(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function St(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:Ct(n)??0,y:Ct(e)??0}}function at(t){return t!=null}function Ot(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Rt=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,y.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Ft=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=N(n),e.onDragStart()},jt=(t,n,e,r,o)=>i=>{Ut(i,t,e,r,o,n,e.marginTop)};function Ut(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const d=n.getCoordinates(t).y,s=Tt(r.startY,d),p=window.innerHeight,l=i.clientHeight,f=l-(r.containerStartTranslate.y+s);if(f>=p)return;const E=pt(r.startY,d);if(E.isUp&&!e.expandable&&f>=l||e.preventClosing&&f<=l)return;o.start(()=>{tt(i,{y:r.containerStartTranslate.y+s})},0);const O=p-a,c=l-r.containerStartTranslate.y;if(E.isUp){const C=O-c,H=O-f,A=Ot(1-Z(H/C,2),{min:0,max:1});e.onDragMove(E,A)}else if(E.isDown){const C=Ot(Z(1-f/c,2),{min:0,max:1});e.onDragMove(E,C)}}const Wt=(t,n,e,r,o,i,a)=>d=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,p=t.getCoordinates(d).y,l=N(n).y,f=pt(s,p),E=window.innerHeight,O=n.clientHeight;if(f.isUp){const c=[...e.snapPoints].sort((A,x)=>A-x),C=O+-l;if(!e.expandable&&C>=O)return;for(const A of c){const x=A*window.innerHeight;if(C<=x){const B=z(C,x);a.translateContainer({startY:l,endY:l-B,animationFrame:o,bottomSheetContainer:n});return}}const H=Et(E,O,e.marginTop);a.translateContainer({startY:l,endY:H,animationFrame:o,bottomSheetContainer:n})}else if(f.isDown){const c=[...e.snapPoints].sort((C,H)=>H-C);for(const C of c){const H=C*window.innerHeight,A=O+-l;if(A>=H){const x=z(A,H);a.translateContainer({startY:l,endY:l+x,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const C=O+-l;if(C>=O){const H=z(C,O);a.translateContainer({startY:l,endY:l+H,animationFrame:o,bottomSheetContainer:n})}return}i()}};var M=(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))(M||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:M.All};class X{constructor(n){K(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=$t,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===M.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===M.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function Ht(t){const n=t;return`${n} ${n} 0px 0px`}function Gt(t,n){const e=Vt(t);zt(e),e.bottomSheetContainer.style.width=t.width;const r=document.createElement("div");r.innerHTML=t.content??"";const o=window.innerHeight;e.bottomSheetContainer.style.maxHeight=`${o}px`,e.bottomSheetContentWrapper.appendChild(r);const i=Xt({bottomSheetElements:e,bottomSheetProps:t,options:n});return t.rootStyle&&Object.assign(e.bottomSheetRoot.style,t.rootStyle),t.backdropStyle&&Object.assign(e.bottomSheetBackdrop.style,t.backdropStyle),t.containerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Vt(t){const n=P("dialog",F([y.Root,Q.Dialog,t.rootClass]),y.Root);n.ariaLabel=t.ariaLabel;const e=P("section",F([y.Container,t.containerClass]),y.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=P("div",y.GapFiller,y.GapFiller),o=P("button",F([y.Handle,Q.Button,t.shouldShowHandle?null:V.Hidden,t.handleClass]),y.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=P("span",F([y.HandleBar,t.shouldShowHandle?null:V.Hidden]),y.HandleBar),a=P("article",F([y.ContentWrapper,t.contentWrapperClass]),y.ContentWrapper),d=P("div",F([y.Backdrop,t.backdropClass,V.Hidden]),y.Backdrop);return t.backdropColor&&(d.style.backgroundColor=t.backdropColor),t.backDropTransition&&(d.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:d,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function zt({bottomSheetRoot:t,bottomSheetContainer:n,bottomSheetHandle:e,bottomSheetHandleBar:r,bottomSheetContentWrapper:o,bottomSheetContainerGapFiller:i}){t.appendChild(n),e.appendChild(r),n.appendChild(e),n.appendChild(o),n.appendChild(i)}function Xt({bottomSheetElements:t,bottomSheetProps:n,options:e}){const{bottomSheetRoot:r,bottomSheetContainer:o,bottomSheetHandle:i,bottomSheetContainerGapFiller:a,bottomSheetContentWrapper:d,bottomSheetBackdrop:s}=t,{animationFrame:p}=e,l=new X(i),f=new X(d),E=new X(a),O=n.dragTriggers.reduce((w,L)=>{const v=r.querySelectorAll(L);if(!v.length)return w;const W=Array.from(v).map(u=>u instanceof HTMLElement?new X(u):null).filter(u=>!!u);return[...w,...W]},[]),c=new X(window),C=Ft(c,o,n,e.draggingState),H=jt(c,o,n,e.draggingState,p),A=Wt(c,o,n,e.draggingState,p,e.onClose,e.bottomSheetState);function x(w){w.target instanceof Element&&!r.contains(w.target)&&e.onClose()}function B(w){Rt(e.draggingState,w.target,t.bottomSheetContentWrapper)}function U(w){const L=w??n;L.draggable&&(l.addEventListeners({onStart:B}),O.forEach(v=>{v.addEventListeners({onStart:B,onStartOptions:{eventPhase:M.Target}})})),L.draggable&&L.backgroundDraggable&&(f.addEventListeners({onStart:B,onStartOptions:{eventPhase:M.Target}}),E.addEventListeners({onStart:B})),L.draggable&&c.addEventListeners({onStart:C,onMove:H,onEnd:A}),L.draggable&&window.document.addEventListener("keyup",v=>{v.key==="Escape"&&e.onClose()}),i.addEventListener("keyup",v=>{if(v.key==="ArrowUp"){e.moveUp();return}if(v.key==="ArrowDown"){e.moveDown();return}if(v.shiftKey&&v.key==="Tab"){const W=ft(t.bottomSheetContentWrapper);It(W)}})}function nt(){n.shouldCloseOnOutsideClick?s.addEventListener("click",x):s.style.pointerEvents="none"}function ut(){s.removeEventListener("click",x)}function ft(w){let L=[...Array.from(w.childNodes).reverse()];for(;L.length;){const v=L.shift();if(Nt(v))return v;v&&(L=[...L,...Array.from(v.childNodes).reverse()])}return null}function et(){l.removeEventListeners({onStart:B}),f.removeEventListeners({onStart:B}),E.removeEventListeners({onStart:B}),O.forEach(w=>{w.removeEventListeners({onStart:B})}),c.removeEventListeners({onStart:C,onMove:H,onEnd:A})}return{attachEventListeners:U,clearEventListeners:et,attacheOnOpenEventListeners:nt,clearOnOpenEventListeners:ut}}class Kt{constructor(){K(this,"animationId");K(this,"isInProgress");K(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Z(a/e,2),p=s>=1&&!r;n(s),p?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:d}=t,s=Tt(n,e);o.stop();let p=!1;o.start(l=>{tt(r,{y:n+s*a(l)}),!p&&l>=1&&(i==null||i(),p=!0)},d)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},_={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const R={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function kt(t){for(const n of Object.values(R))if(n===t)return!0;return!1}function lt(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function j(t,n,e,r){return function(s){return d(i(s))};function i(s){let p=0,l=1,f=s,E;if(s===0||s===1)return s;for(;p<l;){if(E=a(f),Math.abs(E-s)<.001)return f;s>E?p=f:l=f,f=(l+p)/2}return f}function a(s){return 3*t*s*Math.pow(1-s,2)+3*e*Math.pow(s,2)*(1-s)+Math.pow(s,3)}function d(s){return 3*n*s*Math.pow(1-s,2)+3*r*Math.pow(s,2)*(1-s)+Math.pow(s,3)}}const Lt=j(.25,.1,.25,1),tn=j(.42,0,1,1),At=j(.42,0,.58,1),nn=j(.4,.1,.6,1),en=j(.45,1.5,.55,1);function rn(t){switch(t){case R.EASE:return Lt;case R.EASE_IN:return tn;case R.EASE_OUT:return At;case R.EASE_IN_OUT:return nn;case R.SPRING:return en;default:return Lt}}function Bt(t){return typeof t=="boolean"}const Dt={ariaLabel:"Bottom sheet",content:"",defaultPosition:_.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{}};function on(t){const n={...Dt},e=Object.entries(t).reduce((o,i)=>{const[a,d]=i;return at(d)&&(o[a]=d),o},{});return{...n,...e}}function dt(t){if(lt(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return kt(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":T(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":T(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Bt(a)||J(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Bt(a)||J(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":T(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"backdropColor":T(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":T(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!T(a))return;G(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!T(a))return;G(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!T(a))return;G(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!T(a))return;G(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!T(a))return;G(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(lt(a)){const d=dt(a),s=ct(d,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const d=dt(e.draggingAnimationTimings),s=ct(d,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=dt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const d=new Kt,s={animationFrame:d,onClose:x,bottomSheetState:o,draggingState:i,snapTo:W,moveUp:L,moveDown:v},{elements:p,eventHandlers:l}=Gt(n,s),f=Qt(n,an(p,o,n,l)),{bottomSheetBackdrop:E,bottomSheetRoot:O,bottomSheetContainer:c}=p,C=u=>{const g=u??window.document.body;g.appendChild(O),g.appendChild(E);const b=window.innerHeight;tt(c,{y:b}),l.attachEventListeners(),o.isMounted=!0},H=()=>{l.clearEventListeners(),Object.values(p).forEach(u=>{u.remove()}),a(),o.isMounted=!1},A=()=>{var I;if(B()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(I=t.beforeOpen)==null||I.call(t),U())return;ot(E,!0),f.shouldShowBackdrop||$(E,"transparent"),ot([c],!0),tt(c,{y:c.clientHeight});const g=window.innerHeight,b=mt(g,c.clientHeight,f.marginTop,f.defaultPosition),m=N(c).y;o.translateContainer({startY:m,endY:b,animationFrame:d,bottomSheetContainer:c,onEnd:t.afterOpen});const S=document.body.style.overflowY;i.originalDocumentOverflowY=S||"initial";const D=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=D||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",p.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function x(){var b;if(nt())return;(b=t.beforeClose)==null||b.call(t);const u=N(c).y,g=c.clientHeight;o.translateContainer({startY:u,endY:g,animationFrame:d,bottomSheetContainer:c,onEnd:()=>{var m;(m=t.afterClose)==null||m.call(t),ot([E,c],!1),l.clearOnOpenEventListeners()}}),a()}function B(){return o.isMounted}function U(){const u=N(c).y,g=window.innerHeight,b=c.clientHeight>=g?g:c.clientHeight;return u<=b}function nt(){return!U()}function ut(){const u=N(c).y,g=c.clientHeight,b=window.innerHeight;if(u<=5&&u>=-5)return _.CONTENT_HEIGHT;const m=g-u;if(m===b/2)return _.MIDDLE;const S=b-f.marginTop,D=10;return m<=S+D&&m>=S-D?_.TOP:_.CLOSED}function ft(){return c.clientHeight}function et(u){if(!U())return;const g=N(c).y,m=c.clientHeight-g,S=window.innerHeight-u,D=Mt(m,S),I=z(m,S);o.translateContainer({startY:g,endY:g+(D.isUp?-I:I),animationFrame:d,bottomSheetContainer:c})}function w(u,{viewportHeight:g,visibleHeight:b}){let m=null;for(const S of u){const D=S*g,I=z(b,D);(m===null||I<m)&&(m=I)}return{minOffset:m}}function L(){const u=[...f.snapPoints].reverse(),g=N(c).y,b=c.clientHeight,m=b-g;if(!f.expandable&&m>=b)return;const S=window.innerHeight,D=yt("above",{visibleHeight:m,viewportHeight:S},u),{minOffset:I}=w(D,{visibleHeight:m,viewportHeight:S});if(I===null&&m<S-f.marginTop){o.translateContainer({startY:g,endY:mt(S,b,f.marginTop,"top"),animationFrame:d,bottomSheetContainer:c});return}Y(I)&&o.translateContainer({startY:g,endY:g-I,animationFrame:d,bottomSheetContainer:c})}function v(){const u=N(c).y,b=c.clientHeight-u;if(b<1)return;const m=window.innerHeight,S=yt("below",{visibleHeight:b,viewportHeight:m},f.snapPoints),{minOffset:D}=w(S,{visibleHeight:b,viewportHeight:m});Y(D)&&o.translateContainer({startY:u,endY:u+D,animationFrame:d,bottomSheetContainer:c})}function W(u){const g=window.innerHeight;if(!Jt(u))return;const b=Z(g*u,2);et(b)}return{props:f,elements:p,mount:C,unmount:H,open:A,close:x,getIsMounted:B,getIsOpen:U,getIsClosed:nt,getPosition:ut,getHeight:ft,moveTo:et,snapTo:W}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>_.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}h.BOTTOM_SHEET_DEFAULT_PROPS=Dt,h.BOTTOM_SHEET_POSITION=_,h.BOTTOM_SHEET_SELECTORS=Pt,h.COMMON_ANIMATION_KEYS=R,h.ClassNames=y,h.EventPhase=M,h.ResetClassNames=Q,h.UtilClassNames=V,h.createBottomSheet=sn,h.createPlaceholderBottomSheet=cn,h.eventPhaseToEnum=st,h.isAnimationTimingPoints=lt,h.isCommonAnimationTimingsKey=kt,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -20,6 +20,11 @@ export interface BottomSheetCoreProps {
|
|
|
20
20
|
* defaults to true
|
|
21
21
|
*/
|
|
22
22
|
expandable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If it is true, the bottom sheet can not be dragged down below its content height.
|
|
25
|
+
* defaults to false
|
|
26
|
+
*/
|
|
27
|
+
preventClosing?: boolean;
|
|
23
28
|
/**
|
|
24
29
|
* If it is true, the bottom sheet can be dragged. Set false to use the bottom sheet as a blocking dialog.
|
|
25
30
|
* defaults to true
|
|
@@ -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;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,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,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,gBAAgB,CAAC;IACvC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAGjC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IAEpD;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AACD,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,qBAAqB,GACrB,IAAI,CAAC;AAET,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAElC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,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,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;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;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,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,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,gBAAgB,CAAC;IACvC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IAGjC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IAEpD;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AACD,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,qBAAqB,GACrB,IAAI,CAAC;AAET,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAElC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|