@plainsheet/core 0.7.8 → 0.7.9
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/initializer/bottom-sheet-defaults.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-initializer.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 +195 -179
- package/dist/plainsheet-core.umd.js +2 -2
- package/dist/types/bottom-sheet-props.type.d.ts +4 -3
- package/dist/types/bottom-sheet-props.type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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,wBAuCxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom-sheet-initializer.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-initializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAejE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAOzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,UAAU,uCAAuC;IAC/C,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,aAAa,EAAE,0BAA0B,CAAC;CAC3C;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACrC,OAAO,EAAE,kBAAkB,GAC1B,uCAAuC,
|
|
1
|
+
{"version":3,"file":"bottom-sheet-initializer.d.ts","sourceRoot":"","sources":["../../src/initializer/bottom-sheet-initializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAejE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAOzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,UAAU,uCAAuC;IAC/C,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,aAAa,EAAE,0BAA0B,CAAC;CAC3C;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACrC,OAAO,EAAE,kBAAkB,GAC1B,uCAAuC,CAiDzC;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,WAAW,CAAC;IAC7B,mBAAmB,EAAE,WAAW,CAAC;IACjC,oBAAoB,EAAE,WAAW,CAAC;IAClC,iBAAiB,EAAE,WAAW,CAAC;IAC/B,oBAAoB,EAAE,WAAW,CAAC;IAClC,yBAAyB,EAAE,WAAW,CAAC;IACvC,6BAA6B,EAAE,WAAW,CAAC;CAC5C;AAkHD,MAAM,WAAW,sBAAsB;IACrC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,gBAAgB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,EAAE,CACpB,YAAY,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,KACtD,IAAI,CAAC;IACV,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,2BAA2B,EAAE,MAAM,IAAI,CAAC;IACxC,yBAAyB,EAAE,MAAM,IAAI,CAAC;CACvC"}
|
|
@@ -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,CA0LpB"}
|
|
@@ -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 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
|
+
"use strict";var Bt=Object.defineProperty;var Dt=(t,n,e)=>n in t?Bt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var U=(t,n,e)=>Dt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function w(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(tt(n))}function X(t,n){t.classList.add(tt(n))}function ot(t,n){t.classList.remove(tt(n))}function j(t,n,e){w(e)&&(w(n)&&ot(t,n),X(t,e))}function tt(t){return w(t)?t.trim().replace(/\./g,""):""}function _(t){return t.map(n=>tt(n)).filter(Boolean).join(" ")}function It(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const dt="open",ft="hidden";function rt(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{q(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}q(t,e),t.setAttribute("aria-modal",e?"true":"false")}function q(t,n){n?(X(t,dt),ot(t,ft)):(X(t,ft),ot(t,dt))}function yt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function Nt(t){yt(t)&&t.focus()}function Mt(t){if(!yt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var y=(t=>(t.Backdrop="pbs-backdrop",t.Root="pbs-root",t.Container="pbs-container",t.GapFiller="pbs-gap-filler",t.Handle="pbs-handle",t.HandleBar="pbs-handle-bar",t.ContentWrapper="pbs-content-wrapper",t))(y||{}),J=(t=>(t.Button="pbs-button-reset",t.Dialog="pbs-dialog-reset",t))(J||{}),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)}),w(e)&&r.setAttribute("data-testid",e),r}const Pt={CONTENTS_WRAPPER:It([y.Root,y.ContentWrapper])};function gt(t,n,e,r){switch(r){case"content-height":return n>=t?St(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function Ct(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function Et(t,n){return n<t?-(t-n):n-t}function $(t,n){return t>n?t-n:n-t}function xt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function ht(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function St(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 vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Ft(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function 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=vt(n),r=Ot(e,it);return wt(r??{type:it,values:[]})}function Z(t,{x:n,y:e}){const{transform:r,transformValues:o}=Ft(t),i=Ot(o,it);if(i){const a=wt(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function wt(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:mt(n)??0,y:mt(e)??0}}function at(t){return t!=null}function bt(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const Rt=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,y.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},_t=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=I(n),e.onDragStart()},Gt=(t,n,e,r,o)=>i=>{Ut(i,t,e,r,o,n,e.marginTop)};function Ut(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const u=n.getCoordinates(t).y,s=Et(r.startY,u),b=window.innerHeight,l=i.clientHeight,f=l-(r.containerStartTranslate.y+s);if(f>=b)return;const p=Ct(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 v=b-a,c=l-r.containerStartTranslate.y;if(p.isUp){const T=v-c,O=v-f,k=bt(1-Q(O/T,2),{min:0,max:1});e.onDragMove(p,k)}else if(p.isDown){const T=bt(Q(1-f/c,2),{min:0,max:1});e.onDragMove(p,T)}}const jt=(t,n,e,r,o,i,a)=>u=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,b=t.getCoordinates(u).y,l=I(n).y,f=Ct(s,b),p=window.innerHeight,v=n.clientHeight;if(f.isUp){const c=[...e.snapPoints].sort((k,B)=>k-B),T=v+-l;if(!e.expandable&&T>=v)return;for(const k of c){const B=k*window.innerHeight;if(T<=B){const L=$(T,B);a.translateContainer({startY:l,endY:l-L,animationFrame:o,bottomSheetContainer:n});return}}const O=St(p,v,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,k=v+-l;if(k>=O){const B=$(k,O);a.translateContainer({startY:l,endY:l+B,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const T=v+-l;if(T>=v){const O=$(T,v);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 Wt={eventPhase:x.All};class W{constructor(n){U(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=Wt,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.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function $t(t){const n=N("dialog",_([y.Root,J.Dialog,t.rootClass]),y.Root);n.ariaLabel=t.ariaLabel;const e=N("section",_([y.Container,t.containerClass]),y.Container);t.containerBorderRadius&&(e.style.borderRadius=Ht(t.containerBorderRadius));const r=N("div",y.GapFiller,y.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=N("button",_([y.Handle,J.Button,t.shouldShowHandle?null:V.Hidden,t.handleClass]),y.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=N("span",_([y.HandleBar,t.shouldShowHandle?null:V.Hidden]),y.HandleBar),a=N("article",_([y.ContentWrapper,t.contentWrapperClass]),y.ContentWrapper),u=N("div",_([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 W(i),f=new W(u),p=new W(a),v=n.dragTriggers.reduce((E,H)=>{const C=r.querySelectorAll(H);if(!C.length)return E;const R=Array.from(C).map(d=>d instanceof HTMLElement?new W(d):null).filter(d=>!!d);return[...E,...R]},[]),c=new W(window),T=_t(c,o,n,e.draggingState),O=Gt(c,o,n,e.draggingState,b),k=jt(c,o,n,e.draggingState,b,e.onClose,e.bottomSheetState);function B(E){E.target instanceof Element&&!r.contains(E.target)&&e.onClose()}function L(E){Rt(e.draggingState,E.target,t.bottomSheetContentWrapper)}function F(E){const H=E??n;H.draggable&&(l.addEventListeners({onStart:L}),v.forEach(C=>{C.addEventListeners({onStart:L,onStartOptions:{eventPhase:x.Target}})})),H.draggable&&H.backgroundDraggable&&(f.addEventListeners({onStart:L,onStartOptions:{eventPhase:x.Target}}),p.addEventListeners({onStart:L})),H.draggable&&c.addEventListeners({onStart:T,onMove:O,onEnd:k}),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 R=et(t.bottomSheetContentWrapper);Nt(R)}})}function K(){n.shouldCloseOnOutsideClick?s.addEventListener("click",B):s.style.pointerEvents="none"}function nt(){s.removeEventListener("click",B)}function et(E){let H=[...Array.from(E.childNodes).reverse()];for(;H.length;){const C=H.shift();if(Mt(C))return C;C&&(H=[...H,...Array.from(C.childNodes).reverse()])}return null}function z(){l.removeEventListeners({onStart:L}),f.removeEventListeners({onStart:L}),p.removeEventListeners({onStart:L}),v.forEach(E=>{E.removeEventListeners({onStart:L})}),c.removeEventListeners({onStart:T,onMove:O,onEnd:k})}return{attachEventListeners:F,clearEventListeners:z,attacheOnOpenEventListeners:K,clearOnOpenEventListeners:nt}}class zt{constructor(){U(this,"animationId");U(this,"isInProgress");U(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Q(a/e,2),b=s>=1&&!r;n(s),b?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:u}=t,s=Et(n,e);o.stop();let b=!1;o.start(l=>{Z(r,{y:n+s*a(l)}),!b&&l>=1&&(i==null||i(),b=!0)},u)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},P={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const M={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function kt(t){for(const n of Object.values(M))if(n===t)return!0;return!1}function ut(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function G(t,n,e,r){return function(s){return u(i(s))};function i(s){let b=0,l=1,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=G(.25,.1,.25,1),tn=G(.42,0,1,1),Lt=G(.42,0,.58,1),nn=G(.4,.1,.6,1),en=G(.45,1.5,.55,1);function rn(t){switch(t){case M.EASE:return pt;case M.EASE_IN:return tn;case M.EASE_OUT:return Lt;case M.EASE_IN_OUT:return nn;case M.SPRING:return en;default:return pt}}function Tt(t){return typeof t=="boolean"}const At={ariaLabel:"Bottom sheet",content:"",defaultPosition:P.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function on(t){const n={...At},e=Object.entries(t).reduce((o,i)=>{const[a,u]=i;return at(u)&&(o[a]=u),o},{});return{...n,...e}}function lt(t){if(ut(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return G(n,e,r,o)}return kt(t)?rn(t):Lt}function an(t,n,e,r){function o(i,a){switch(i){case"content":w(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":w(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Tt(a)||q(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Tt(a)||q(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":w(a)&&(t.bottomSheetContainer.style.borderRadius=Ht(a));break;case"containerBackgroundColor":w(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":w(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":w(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!w(a))return;j(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!w(a))return;j(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!w(a))return;j(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!w(a))return;j(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!w(a))return;j(t.bottomSheetBackdrop,e.backdropClass,a);break;case"expandable":r.clearEventListeners(),r.attachEventListeners(e);break;case"preventClosing":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggable":r.clearEventListeners(),r.attachEventListeners(e);break;case"draggingAnimationTimings":if(ut(a)){const u=lt(a),s=ct(u,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const u=lt(e.draggingAnimationTimings),s=ct(u,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=lt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const u=new zt,s={animationFrame:u,onClose:B,bottomSheetState:o,draggingState:i,snapTo:R,moveUp:H,moveDown:C},{elements:b,eventHandlers:l}=Vt(n,s),f=Qt(n,an(b,o,n,l)),{bottomSheetBackdrop:p,bottomSheetRoot:v,bottomSheetContainer:c}=b,T=d=>{const g=d??window.document.body;g.appendChild(v),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},k=()=>{var D;if(L()||Zt('Bottom Sheet is not mounted yet. call the "mount" method first.'),(D=t.beforeOpen)==null||D.call(t),F())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 S=document.body.style.overflowY;i.originalDocumentOverflowY=S||"initial";const A=document.body.style.overscrollBehavior;i.originalDocumentOverscrollBehavior=A||"initial",document.body.style.overflow="hidden",document.body.style.overscrollBehavior="contain",b.bottomSheetHandle.focus(),l.attacheOnOpenEventListeners()};function B(){var 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 L(){return o.isMounted}function F(){const d=I(c).y,g=window.innerHeight,h=c.clientHeight>=g?g:c.clientHeight;return d<=h}function K(){return!F()}function nt(){const d=I(c).y,g=c.clientHeight,h=window.innerHeight;if(d<=5&&d>=-5)return P.CONTENT_HEIGHT;const m=g-d;if(m===h/2)return P.MIDDLE;const S=h-f.marginTop,A=10;return m<=S+A&&m>=S-A?P.TOP:P.CLOSED}function et(){return c.clientHeight}function z(d){if(!F())return;const g=I(c).y,m=c.clientHeight-g,S=window.innerHeight-d,A=xt(m,S),D=$(m,S);o.translateContainer({startY:g,endY:g+(A.isUp?-D:D),animationFrame:u,bottomSheetContainer:c})}function E(d,{viewportHeight:g,visibleHeight:h}){let m=null;for(const S of d){const A=S*g,D=$(h,A);(m===null||D<m)&&(m=D)}return{minOffset:m}}function H(){const d=[...f.snapPoints].reverse(),g=I(c).y,h=c.clientHeight,m=h-g;if(!f.expandable&&m>=h)return;const S=window.innerHeight,A=ht("above",{visibleHeight:m,viewportHeight:S},d),{minOffset:D}=E(A,{visibleHeight:m,viewportHeight:S});if(D===null&&m<S-f.marginTop){o.translateContainer({startY:g,endY:gt(S,h,f.marginTop,"top"),animationFrame:u,bottomSheetContainer:c});return}Y(D)&&o.translateContainer({startY:g,endY:g-D,animationFrame:u,bottomSheetContainer:c})}function C(){const d=I(c).y,h=c.clientHeight-d;if(h<1)return;const m=window.innerHeight,S=ht("below",{visibleHeight:h,viewportHeight:m},f.snapPoints),{minOffset:A}=E(S,{visibleHeight:h,viewportHeight:m});Y(A)&&o.translateContainer({startY:d,endY:d+A,animationFrame:u,bottomSheetContainer:c})}function R(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:k,close:B,getIsMounted:L,getIsOpen:F,getIsClosed:K,getPosition:nt,getHeight:et,moveTo:z,snapTo:R}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>P.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}exports.BOTTOM_SHEET_DEFAULT_PROPS=At;exports.BOTTOM_SHEET_POSITION=P;exports.BOTTOM_SHEET_SELECTORS=Pt;exports.COMMON_ANIMATION_KEYS=M;exports.ClassNames=y;exports.EventPhase=x;exports.ResetClassNames=J;exports.UtilClassNames=V;exports.createBottomSheet=sn;exports.createPlaceholderBottomSheet=cn;exports.eventPhaseToEnum=st;exports.isAnimationTimingPoints=ut;exports.isCommonAnimationTimingsKey=kt;
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
var
|
|
3
|
-
var At = (t, n, e) => n in t ?
|
|
2
|
+
var Lt = Object.defineProperty;
|
|
3
|
+
var At = (t, n, e) => n in t ? Lt(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 H(t) {
|
|
6
6
|
return typeof t == "string";
|
|
7
7
|
}
|
|
8
8
|
function Bt(t, n) {
|
|
@@ -14,11 +14,11 @@ function $(t, n) {
|
|
|
14
14
|
function rt(t, n) {
|
|
15
15
|
t.classList.remove(Z(n));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function U(t, n, e) {
|
|
18
|
+
H(e) && (H(n) && rt(t, n), $(t, e));
|
|
19
19
|
}
|
|
20
20
|
function Z(t) {
|
|
21
|
-
return
|
|
21
|
+
return H(t) ? t.trim().replace(/\./g, "") : "";
|
|
22
22
|
}
|
|
23
23
|
function M(t) {
|
|
24
24
|
return t.map((n) => Z(n)).filter(Boolean).join(" ");
|
|
@@ -40,17 +40,17 @@ function et(t, n) {
|
|
|
40
40
|
function q(t, n) {
|
|
41
41
|
n ? ($(t, lt), rt(t, ut)) : ($(t, ut), rt(t, lt));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function yt(t) {
|
|
44
44
|
return t instanceof HTMLElement;
|
|
45
45
|
}
|
|
46
46
|
function Y(t) {
|
|
47
47
|
return typeof t == "number" && !Number.isNaN(t);
|
|
48
48
|
}
|
|
49
49
|
function Yt(t) {
|
|
50
|
-
|
|
50
|
+
yt(t) && t.focus();
|
|
51
51
|
}
|
|
52
52
|
function It(t) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!yt(t) || t.offsetParent === null || "disabled" in t && t.disabled)
|
|
54
54
|
return !1;
|
|
55
55
|
const e = t.getAttribute("tabindex"), r = Y(e) ? parseInt(e, 10) : -1, i = [
|
|
56
56
|
"INPUT",
|
|
@@ -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 T = /* @__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))(T || {}), 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
|
+
}), H(e) && r.setAttribute("data-testid", e), r;
|
|
72
72
|
}
|
|
73
73
|
const sn = {
|
|
74
74
|
CONTENTS_WRAPPER: Dt([
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
T.Root,
|
|
76
|
+
T.ContentWrapper
|
|
77
77
|
])
|
|
78
78
|
};
|
|
79
79
|
function dt(t, n, e, r) {
|
|
@@ -88,7 +88,7 @@ function dt(t, n, e, r) {
|
|
|
88
88
|
return 0;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ct(t, n) {
|
|
92
92
|
const e = n < t, r = n > t;
|
|
93
93
|
return {
|
|
94
94
|
isUp: e,
|
|
@@ -96,7 +96,7 @@ function yt(t, n) {
|
|
|
96
96
|
stayedSame: n === t
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Tt(t, n) {
|
|
100
100
|
return n < t ? -(t - n) : n - t;
|
|
101
101
|
}
|
|
102
102
|
function V(t, n) {
|
|
@@ -151,7 +151,7 @@ function I(t) {
|
|
|
151
151
|
e,
|
|
152
152
|
it
|
|
153
153
|
);
|
|
154
|
-
return
|
|
154
|
+
return St(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 = St(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 St(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.`
|
|
@@ -195,11 +195,11 @@ function ht(t, {
|
|
|
195
195
|
}) {
|
|
196
196
|
return at(e) && t >= e ? e : at(n) && t <= n ? n : t;
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
n instanceof HTMLElement && !Bt(n,
|
|
198
|
+
const Ft = (t, n, e) => {
|
|
199
|
+
n instanceof HTMLElement && !Bt(n, T.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
|
+
}, Pt = (t, n, e, r, o) => (i) => {
|
|
203
203
|
Rt(
|
|
204
204
|
i,
|
|
205
205
|
t,
|
|
@@ -213,10 +213,10 @@ 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 u = n.getCoordinates(t).y, s =
|
|
216
|
+
const u = n.getCoordinates(t).y, s = Tt(r.startY, u), b = window.innerHeight, l = i.clientHeight, f = l - (r.containerStartTranslate.y + s);
|
|
217
217
|
if (f >= b)
|
|
218
218
|
return;
|
|
219
|
-
const p =
|
|
219
|
+
const p = Ct(r.startY, u);
|
|
220
220
|
if (p.isUp && !e.expandable && f >= l || e.preventClosing && f <= l)
|
|
221
221
|
return;
|
|
222
222
|
o.start(() => {
|
|
@@ -226,16 +226,16 @@ function Rt(t, n, e, r, o, i, a) {
|
|
|
226
226
|
}, 0);
|
|
227
227
|
const w = b - a, c = l - r.containerStartTranslate.y;
|
|
228
228
|
if (p.isUp) {
|
|
229
|
-
const
|
|
230
|
-
1 - J(
|
|
229
|
+
const y = w - c, S = w - f, k = ht(
|
|
230
|
+
1 - J(S / y, 2),
|
|
231
231
|
{
|
|
232
232
|
min: 0,
|
|
233
233
|
max: 1
|
|
234
234
|
}
|
|
235
235
|
);
|
|
236
|
-
e.onDragMove(p,
|
|
236
|
+
e.onDragMove(p, k);
|
|
237
237
|
} else if (p.isDown) {
|
|
238
|
-
const
|
|
238
|
+
const y = ht(
|
|
239
239
|
J(
|
|
240
240
|
1 - f / c,
|
|
241
241
|
2
|
|
@@ -245,57 +245,57 @@ 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, y);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const Gt = (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(u).y, l = I(n).y, f =
|
|
255
|
+
const s = r.startY, b = t.getCoordinates(u).y, l = I(n).y, f = Ct(s, b), p = window.innerHeight, w = n.clientHeight;
|
|
256
256
|
if (f.isUp) {
|
|
257
257
|
const c = [...e.snapPoints].sort(
|
|
258
|
-
(
|
|
259
|
-
),
|
|
260
|
-
if (!e.expandable &&
|
|
258
|
+
(k, B) => k - B
|
|
259
|
+
), y = w + -l;
|
|
260
|
+
if (!e.expandable && y >= w)
|
|
261
261
|
return;
|
|
262
|
-
for (const
|
|
263
|
-
const B =
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
|
|
262
|
+
for (const k of c) {
|
|
263
|
+
const B = k * window.innerHeight;
|
|
264
|
+
if (y <= B) {
|
|
265
|
+
const L = V(
|
|
266
|
+
y,
|
|
267
267
|
B
|
|
268
268
|
);
|
|
269
269
|
a.translateContainer({
|
|
270
270
|
startY: l,
|
|
271
|
-
endY: l -
|
|
271
|
+
endY: l - L,
|
|
272
272
|
animationFrame: o,
|
|
273
273
|
bottomSheetContainer: n
|
|
274
274
|
});
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
const
|
|
278
|
+
const S = Et(
|
|
279
279
|
p,
|
|
280
280
|
w,
|
|
281
281
|
e.marginTop
|
|
282
282
|
);
|
|
283
283
|
a.translateContainer({
|
|
284
284
|
startY: l,
|
|
285
|
-
endY:
|
|
285
|
+
endY: S,
|
|
286
286
|
animationFrame: o,
|
|
287
287
|
bottomSheetContainer: n
|
|
288
288
|
});
|
|
289
289
|
} else if (f.isDown) {
|
|
290
290
|
const c = [...e.snapPoints].sort(
|
|
291
|
-
(
|
|
291
|
+
(y, S) => S - y
|
|
292
292
|
);
|
|
293
|
-
for (const
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
293
|
+
for (const y of c) {
|
|
294
|
+
const S = y * window.innerHeight, k = w + -l;
|
|
295
|
+
if (k >= S) {
|
|
296
296
|
const B = V(
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
k,
|
|
298
|
+
S
|
|
299
299
|
);
|
|
300
300
|
a.translateContainer({
|
|
301
301
|
startY: l,
|
|
@@ -307,12 +307,12 @@ const _t = (t, n, e, r, o, i, a) => (u) => {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
if (e.preventClosing) {
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
310
|
+
const y = w + -l;
|
|
311
|
+
if (y >= w) {
|
|
312
|
+
const S = V(y, w);
|
|
313
313
|
a.translateContainer({
|
|
314
314
|
startY: l,
|
|
315
|
-
endY: l +
|
|
315
|
+
endY: l + S,
|
|
316
316
|
animationFrame: o,
|
|
317
317
|
bottomSheetContainer: n
|
|
318
318
|
});
|
|
@@ -322,7 +322,7 @@ const _t = (t, n, e, r, o, i, a) => (u) => {
|
|
|
322
322
|
i();
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
|
-
var
|
|
325
|
+
var G = /* @__PURE__ */ ((t) => (t[t.All = -1] = "All", t[t.None = 0] = "None", t[t.Capture = 1] = "Capture", t[t.Target = 2] = "Target", t[t.Bubble = 3] = "Bubble", t))(G || {});
|
|
326
326
|
function mt(t) {
|
|
327
327
|
switch (t) {
|
|
328
328
|
case 0:
|
|
@@ -337,17 +337,17 @@ function mt(t) {
|
|
|
337
337
|
return -1;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
const
|
|
341
|
-
eventPhase:
|
|
340
|
+
const _t = {
|
|
341
|
+
eventPhase: G.All
|
|
342
342
|
};
|
|
343
|
-
class
|
|
343
|
+
class W {
|
|
344
344
|
constructor(n) {
|
|
345
345
|
j(this, "currentTarget");
|
|
346
346
|
this.currentTarget = n;
|
|
347
347
|
}
|
|
348
348
|
addEventListeners({
|
|
349
349
|
onStart: n,
|
|
350
|
-
onStartOptions: e =
|
|
350
|
+
onStartOptions: e = _t,
|
|
351
351
|
onMove: r,
|
|
352
352
|
onEnd: o
|
|
353
353
|
}) {
|
|
@@ -362,7 +362,7 @@ class G {
|
|
|
362
362
|
n && this.currentTarget.addEventListener(
|
|
363
363
|
"touchstart",
|
|
364
364
|
(i) => {
|
|
365
|
-
if (e.eventPhase ===
|
|
365
|
+
if (e.eventPhase === G.All) {
|
|
366
366
|
n(i);
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
@@ -382,7 +382,7 @@ class G {
|
|
|
382
382
|
n && this.currentTarget.addEventListener(
|
|
383
383
|
"mousedown",
|
|
384
384
|
(i) => {
|
|
385
|
-
if (e.eventPhase ===
|
|
385
|
+
if (e.eventPhase === G.All) {
|
|
386
386
|
n(i);
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
@@ -433,13 +433,13 @@ class G {
|
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function Ht(t) {
|
|
437
437
|
const n = t;
|
|
438
438
|
return `${n} ${n} 0px 0px`;
|
|
439
439
|
}
|
|
440
440
|
function jt(t, n) {
|
|
441
|
-
const e =
|
|
442
|
-
|
|
441
|
+
const e = Ut(t);
|
|
442
|
+
Wt(e), e.bottomSheetContainer.style.width = t.width;
|
|
443
443
|
const r = document.createElement("div");
|
|
444
444
|
r.innerHTML = t.content ?? "";
|
|
445
445
|
const o = window.innerHeight;
|
|
@@ -449,67 +449,72 @@ function jt(t, n) {
|
|
|
449
449
|
bottomSheetProps: t,
|
|
450
450
|
options: n
|
|
451
451
|
});
|
|
452
|
-
return t.rootStyle && Object.assign(e.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(e.bottomSheetBackdrop.style, t.backdropStyle), t.
|
|
452
|
+
return t.rootStyle && Object.assign(e.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(e.bottomSheetBackdrop.style, t.backdropStyle), t.containerGapFillerStyle && Object.assign(e.bottomSheetContainer.style, t.containerStyle), t.containerStyle && Object.assign(
|
|
453
|
+
e.bottomSheetContainerGapFiller.style,
|
|
454
|
+
t.containerGapFillerStyle
|
|
455
|
+
), t.handleStyle && Object.assign(e.bottomSheetHandleBar.style, t.handleStyle), t.contentWrapperStyle && Object.assign(
|
|
453
456
|
e.bottomSheetContentWrapper.style,
|
|
454
457
|
t.contentWrapperStyle
|
|
455
458
|
), { elements: e, eventHandlers: i };
|
|
456
459
|
}
|
|
457
|
-
function
|
|
460
|
+
function Ut(t) {
|
|
458
461
|
const n = x(
|
|
459
462
|
"dialog",
|
|
460
463
|
M([
|
|
461
|
-
|
|
464
|
+
T.Root,
|
|
462
465
|
ot.Dialog,
|
|
463
466
|
t.rootClass
|
|
464
467
|
]),
|
|
465
|
-
|
|
468
|
+
T.Root
|
|
466
469
|
);
|
|
467
470
|
n.ariaLabel = t.ariaLabel;
|
|
468
471
|
const e = x(
|
|
469
472
|
"section",
|
|
470
|
-
M([
|
|
471
|
-
|
|
473
|
+
M([T.Container, t.containerClass]),
|
|
474
|
+
T.Container
|
|
472
475
|
);
|
|
473
|
-
t.containerBorderRadius && (e.style.borderRadius =
|
|
476
|
+
t.containerBorderRadius && (e.style.borderRadius = Ht(
|
|
474
477
|
t.containerBorderRadius
|
|
475
478
|
));
|
|
476
479
|
const r = x(
|
|
477
480
|
"div",
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
)
|
|
481
|
+
T.GapFiller,
|
|
482
|
+
T.GapFiller
|
|
483
|
+
);
|
|
484
|
+
t.containerBackgroundColor && (e.style.backgroundColor = t.containerBackgroundColor, r.style.backgroundColor = t.containerBackgroundColor);
|
|
485
|
+
const o = x(
|
|
481
486
|
"button",
|
|
482
487
|
M([
|
|
483
|
-
|
|
488
|
+
T.Handle,
|
|
484
489
|
ot.Button,
|
|
485
490
|
t.shouldShowHandle ? null : K.Hidden,
|
|
486
491
|
t.handleClass
|
|
487
492
|
]),
|
|
488
|
-
|
|
493
|
+
T.Handle
|
|
489
494
|
);
|
|
490
495
|
o.setAttribute("type", "button"), o.ariaLabel = "bottom sheet close button";
|
|
491
496
|
const i = x(
|
|
492
497
|
"span",
|
|
493
498
|
M([
|
|
494
|
-
|
|
499
|
+
T.HandleBar,
|
|
495
500
|
t.shouldShowHandle ? null : K.Hidden
|
|
496
501
|
]),
|
|
497
|
-
|
|
502
|
+
T.HandleBar
|
|
498
503
|
), a = x(
|
|
499
504
|
"article",
|
|
500
505
|
M([
|
|
501
|
-
|
|
506
|
+
T.ContentWrapper,
|
|
502
507
|
t.contentWrapperClass
|
|
503
508
|
]),
|
|
504
|
-
|
|
509
|
+
T.ContentWrapper
|
|
505
510
|
), u = x(
|
|
506
511
|
"div",
|
|
507
512
|
M([
|
|
508
|
-
|
|
513
|
+
T.Backdrop,
|
|
509
514
|
t.backdropClass,
|
|
510
515
|
K.Hidden
|
|
511
516
|
]),
|
|
512
|
-
|
|
517
|
+
T.Backdrop
|
|
513
518
|
);
|
|
514
519
|
return t.backdropColor && (u.style.backgroundColor = t.backdropColor), t.backDropTransition && (u.style.transition = t.backDropTransition), {
|
|
515
520
|
bottomSheetRoot: n,
|
|
@@ -521,7 +526,7 @@ function Wt(t) {
|
|
|
521
526
|
bottomSheetContainerGapFiller: r
|
|
522
527
|
};
|
|
523
528
|
}
|
|
524
|
-
function
|
|
529
|
+
function Wt({
|
|
525
530
|
bottomSheetRoot: t,
|
|
526
531
|
bottomSheetContainer: n,
|
|
527
532
|
bottomSheetHandle: e,
|
|
@@ -543,33 +548,33 @@ function Vt({
|
|
|
543
548
|
bottomSheetContainerGapFiller: a,
|
|
544
549
|
bottomSheetContentWrapper: u,
|
|
545
550
|
bottomSheetBackdrop: s
|
|
546
|
-
} = t, { animationFrame: b } = e, l = new
|
|
551
|
+
} = t, { animationFrame: b } = e, l = new W(i), f = new W(
|
|
547
552
|
u
|
|
548
|
-
), p = new
|
|
553
|
+
), p = new W(
|
|
549
554
|
a
|
|
550
555
|
), w = n.dragTriggers.reduce(
|
|
551
|
-
(E,
|
|
552
|
-
const
|
|
553
|
-
if (!
|
|
556
|
+
(E, O) => {
|
|
557
|
+
const C = r.querySelectorAll(O);
|
|
558
|
+
if (!C.length)
|
|
554
559
|
return E;
|
|
555
|
-
const
|
|
556
|
-
return [...E, ...
|
|
560
|
+
const F = Array.from(C).map((d) => d instanceof HTMLElement ? new W(d) : null).filter((d) => !!d);
|
|
561
|
+
return [...E, ...F];
|
|
557
562
|
},
|
|
558
563
|
[]
|
|
559
|
-
), c = new
|
|
564
|
+
), c = new W(
|
|
560
565
|
window
|
|
561
|
-
),
|
|
566
|
+
), y = Mt(
|
|
562
567
|
c,
|
|
563
568
|
o,
|
|
564
569
|
n,
|
|
565
570
|
e.draggingState
|
|
566
|
-
),
|
|
571
|
+
), S = Pt(
|
|
567
572
|
c,
|
|
568
573
|
o,
|
|
569
574
|
n,
|
|
570
575
|
e.draggingState,
|
|
571
576
|
b
|
|
572
|
-
),
|
|
577
|
+
), k = Gt(
|
|
573
578
|
c,
|
|
574
579
|
o,
|
|
575
580
|
n,
|
|
@@ -581,51 +586,51 @@ function Vt({
|
|
|
581
586
|
function B(E) {
|
|
582
587
|
E.target instanceof Element && !r.contains(E.target) && e.onClose();
|
|
583
588
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
589
|
+
function L(E) {
|
|
590
|
+
Ft(
|
|
586
591
|
e.draggingState,
|
|
587
592
|
E.target,
|
|
588
593
|
t.bottomSheetContentWrapper
|
|
589
594
|
);
|
|
590
595
|
}
|
|
591
596
|
function N(E) {
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
onStart:
|
|
595
|
-
}), w.forEach((
|
|
596
|
-
|
|
597
|
-
onStart:
|
|
597
|
+
const O = E ?? n;
|
|
598
|
+
O.draggable && (l.addEventListeners({
|
|
599
|
+
onStart: L
|
|
600
|
+
}), w.forEach((C) => {
|
|
601
|
+
C.addEventListeners({
|
|
602
|
+
onStart: L,
|
|
598
603
|
onStartOptions: {
|
|
599
|
-
eventPhase:
|
|
604
|
+
eventPhase: G.Target
|
|
600
605
|
}
|
|
601
606
|
});
|
|
602
|
-
})),
|
|
603
|
-
onStart:
|
|
607
|
+
})), O.draggable && O.backgroundDraggable && (f.addEventListeners({
|
|
608
|
+
onStart: L,
|
|
604
609
|
onStartOptions: {
|
|
605
|
-
eventPhase:
|
|
610
|
+
eventPhase: G.Target
|
|
606
611
|
}
|
|
607
612
|
}), p.addEventListeners({
|
|
608
|
-
onStart:
|
|
609
|
-
})),
|
|
610
|
-
onStart:
|
|
611
|
-
onMove:
|
|
612
|
-
onEnd:
|
|
613
|
-
}),
|
|
614
|
-
|
|
615
|
-
}), i.addEventListener("keyup", (
|
|
616
|
-
if (
|
|
613
|
+
onStart: L
|
|
614
|
+
})), O.draggable && c.addEventListeners({
|
|
615
|
+
onStart: y,
|
|
616
|
+
onMove: S,
|
|
617
|
+
onEnd: k
|
|
618
|
+
}), O.draggable && window.document.addEventListener("keyup", (C) => {
|
|
619
|
+
C.key === "Escape" && e.onClose();
|
|
620
|
+
}), i.addEventListener("keyup", (C) => {
|
|
621
|
+
if (C.key === "ArrowUp") {
|
|
617
622
|
e.moveUp();
|
|
618
623
|
return;
|
|
619
624
|
}
|
|
620
|
-
if (
|
|
625
|
+
if (C.key === "ArrowDown") {
|
|
621
626
|
e.moveDown();
|
|
622
627
|
return;
|
|
623
628
|
}
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
629
|
+
if (C.shiftKey && C.key === "Tab") {
|
|
630
|
+
const F = nt(
|
|
626
631
|
t.bottomSheetContentWrapper
|
|
627
632
|
);
|
|
628
|
-
Yt(
|
|
633
|
+
Yt(F);
|
|
629
634
|
}
|
|
630
635
|
});
|
|
631
636
|
}
|
|
@@ -636,33 +641,33 @@ function Vt({
|
|
|
636
641
|
s.removeEventListener("click", B);
|
|
637
642
|
}
|
|
638
643
|
function nt(E) {
|
|
639
|
-
let
|
|
640
|
-
for (;
|
|
641
|
-
const
|
|
642
|
-
if (It(
|
|
643
|
-
return
|
|
644
|
-
|
|
645
|
-
...
|
|
646
|
-
...Array.from(
|
|
644
|
+
let O = [...Array.from(E.childNodes).reverse()];
|
|
645
|
+
for (; O.length; ) {
|
|
646
|
+
const C = O.shift();
|
|
647
|
+
if (It(C))
|
|
648
|
+
return C;
|
|
649
|
+
C && (O = [
|
|
650
|
+
...O,
|
|
651
|
+
...Array.from(C.childNodes).reverse()
|
|
647
652
|
]);
|
|
648
653
|
}
|
|
649
654
|
return null;
|
|
650
655
|
}
|
|
651
656
|
function z() {
|
|
652
657
|
l.removeEventListeners({
|
|
653
|
-
onStart:
|
|
658
|
+
onStart: L
|
|
654
659
|
}), f.removeEventListeners({
|
|
655
|
-
onStart:
|
|
660
|
+
onStart: L
|
|
656
661
|
}), p.removeEventListeners({
|
|
657
|
-
onStart:
|
|
662
|
+
onStart: L
|
|
658
663
|
}), w.forEach((E) => {
|
|
659
664
|
E.removeEventListeners({
|
|
660
|
-
onStart:
|
|
665
|
+
onStart: L
|
|
661
666
|
});
|
|
662
667
|
}), c.removeEventListeners({
|
|
663
|
-
onStart:
|
|
664
|
-
onMove:
|
|
665
|
-
onEnd:
|
|
668
|
+
onStart: y,
|
|
669
|
+
onMove: S,
|
|
670
|
+
onEnd: k
|
|
666
671
|
});
|
|
667
672
|
}
|
|
668
673
|
return {
|
|
@@ -706,7 +711,7 @@ function Xt(t) {
|
|
|
706
711
|
onEnd: i,
|
|
707
712
|
animationTimingFunction: a,
|
|
708
713
|
animationDuration: u
|
|
709
|
-
} = t, s =
|
|
714
|
+
} = t, s = Tt(n, e);
|
|
710
715
|
o.stop();
|
|
711
716
|
let b = !1;
|
|
712
717
|
o.start((l) => {
|
|
@@ -741,7 +746,7 @@ function Kt(t, n) {
|
|
|
741
746
|
function qt(...t) {
|
|
742
747
|
console.error(t);
|
|
743
748
|
}
|
|
744
|
-
const
|
|
749
|
+
const P = {
|
|
745
750
|
EASE: "ease",
|
|
746
751
|
EASE_IN: "ease-in",
|
|
747
752
|
EASE_OUT: "ease-out",
|
|
@@ -749,7 +754,7 @@ const F = {
|
|
|
749
754
|
SPRING: "spring"
|
|
750
755
|
};
|
|
751
756
|
function Jt(t) {
|
|
752
|
-
for (const n of Object.values(
|
|
757
|
+
for (const n of Object.values(P))
|
|
753
758
|
if (n === t)
|
|
754
759
|
return !0;
|
|
755
760
|
return !1;
|
|
@@ -757,7 +762,7 @@ function Jt(t) {
|
|
|
757
762
|
function Ot(t) {
|
|
758
763
|
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));
|
|
759
764
|
}
|
|
760
|
-
function
|
|
765
|
+
function _(t, n, e, r) {
|
|
761
766
|
return function(s) {
|
|
762
767
|
return u(i(s));
|
|
763
768
|
};
|
|
@@ -779,18 +784,18 @@ function U(t, n, e, r) {
|
|
|
779
784
|
return 3 * n * s * Math.pow(1 - s, 2) + 3 * r * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
780
785
|
}
|
|
781
786
|
}
|
|
782
|
-
const bt =
|
|
787
|
+
const bt = _(0.25, 0.1, 0.25, 1), Qt = _(0.42, 0, 1, 1), kt = _(0.42, 0, 0.58, 1), Zt = _(0.4, 0.1, 0.6, 1), tn = _(0.45, 1.5, 0.55, 1);
|
|
783
788
|
function nn(t) {
|
|
784
789
|
switch (t) {
|
|
785
|
-
case
|
|
790
|
+
case P.EASE:
|
|
786
791
|
return bt;
|
|
787
|
-
case
|
|
792
|
+
case P.EASE_IN:
|
|
788
793
|
return Qt;
|
|
789
|
-
case
|
|
790
|
-
return
|
|
791
|
-
case
|
|
794
|
+
case P.EASE_OUT:
|
|
795
|
+
return kt;
|
|
796
|
+
case P.EASE_IN_OUT:
|
|
792
797
|
return Zt;
|
|
793
|
-
case
|
|
798
|
+
case P.SPRING:
|
|
794
799
|
return tn;
|
|
795
800
|
default:
|
|
796
801
|
return bt;
|
|
@@ -830,6 +835,7 @@ const en = {
|
|
|
830
835
|
shouldShowHandle: !0,
|
|
831
836
|
backDropTransition: null,
|
|
832
837
|
backdropColor: null,
|
|
838
|
+
containerBackgroundColor: null,
|
|
833
839
|
containerBorderRadius: null,
|
|
834
840
|
rootClass: null,
|
|
835
841
|
containerClass: null,
|
|
@@ -842,7 +848,8 @@ const en = {
|
|
|
842
848
|
containerStyle: {},
|
|
843
849
|
handleStyle: {},
|
|
844
850
|
contentWrapperStyle: {},
|
|
845
|
-
backdropStyle: {}
|
|
851
|
+
backdropStyle: {},
|
|
852
|
+
containerGapFillerStyle: {}
|
|
846
853
|
};
|
|
847
854
|
function rn(t) {
|
|
848
855
|
const n = {
|
|
@@ -862,18 +869,18 @@ function rn(t) {
|
|
|
862
869
|
function ct(t) {
|
|
863
870
|
if (Ot(t)) {
|
|
864
871
|
const { p1x: n, p1y: e, p2x: r, p2y: o } = t;
|
|
865
|
-
return
|
|
872
|
+
return _(n, e, r, o);
|
|
866
873
|
}
|
|
867
|
-
return Jt(t) ? nn(t) :
|
|
874
|
+
return Jt(t) ? nn(t) : kt;
|
|
868
875
|
}
|
|
869
876
|
function on(t, n, e, r) {
|
|
870
877
|
function o(i, a) {
|
|
871
878
|
switch (i) {
|
|
872
879
|
case "content":
|
|
873
|
-
|
|
880
|
+
H(a) && (t.bottomSheetContentWrapper.innerHTML = a);
|
|
874
881
|
break;
|
|
875
882
|
case "width":
|
|
876
|
-
|
|
883
|
+
H(a) && (t.bottomSheetContainer.style.width = a);
|
|
877
884
|
break;
|
|
878
885
|
case "shouldShowHandle":
|
|
879
886
|
pt(a) || q(t.bottomSheetHandle, !1);
|
|
@@ -882,54 +889,57 @@ function on(t, n, e, r) {
|
|
|
882
889
|
pt(a) || q(t.bottomSheetBackdrop, !1);
|
|
883
890
|
break;
|
|
884
891
|
case "containerBorderRadius":
|
|
885
|
-
|
|
892
|
+
H(a) && (t.bottomSheetContainer.style.borderRadius = Ht(a));
|
|
893
|
+
break;
|
|
894
|
+
case "containerBackgroundColor":
|
|
895
|
+
H(a) && (t.bottomSheetContainer.style.backgroundColor = a, t.bottomSheetContainerGapFiller.style.backgroundColor = a);
|
|
886
896
|
break;
|
|
887
897
|
case "backdropColor":
|
|
888
|
-
|
|
898
|
+
H(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
|
|
889
899
|
break;
|
|
890
900
|
case "backDropTransition":
|
|
891
|
-
|
|
901
|
+
H(a) && (t.bottomSheetBackdrop.style.transition = a);
|
|
892
902
|
break;
|
|
893
903
|
case "rootClass":
|
|
894
|
-
if (!
|
|
904
|
+
if (!H(a))
|
|
895
905
|
return;
|
|
896
|
-
|
|
906
|
+
U(
|
|
897
907
|
t.bottomSheetRoot,
|
|
898
908
|
e.rootClass,
|
|
899
909
|
a
|
|
900
910
|
);
|
|
901
911
|
break;
|
|
902
912
|
case "containerClass":
|
|
903
|
-
if (!
|
|
913
|
+
if (!H(a))
|
|
904
914
|
return;
|
|
905
|
-
|
|
915
|
+
U(
|
|
906
916
|
t.bottomSheetContainer,
|
|
907
917
|
e.containerClass,
|
|
908
918
|
a
|
|
909
919
|
);
|
|
910
920
|
break;
|
|
911
921
|
case "handleClass":
|
|
912
|
-
if (!
|
|
922
|
+
if (!H(a))
|
|
913
923
|
return;
|
|
914
|
-
|
|
924
|
+
U(
|
|
915
925
|
t.bottomSheetHandle,
|
|
916
926
|
e.handleClass,
|
|
917
927
|
a
|
|
918
928
|
);
|
|
919
929
|
break;
|
|
920
930
|
case "contentWrapperClass":
|
|
921
|
-
if (!
|
|
931
|
+
if (!H(a))
|
|
922
932
|
return;
|
|
923
|
-
|
|
933
|
+
U(
|
|
924
934
|
t.bottomSheetContentWrapper,
|
|
925
935
|
e.contentWrapperClass,
|
|
926
936
|
a
|
|
927
937
|
);
|
|
928
938
|
break;
|
|
929
939
|
case "backdropClass":
|
|
930
|
-
if (!
|
|
940
|
+
if (!H(a))
|
|
931
941
|
return;
|
|
932
|
-
|
|
942
|
+
U(
|
|
933
943
|
t.bottomSheetBackdrop,
|
|
934
944
|
e.backdropClass,
|
|
935
945
|
a
|
|
@@ -982,6 +992,12 @@ function on(t, n, e, r) {
|
|
|
982
992
|
e.containerStyle
|
|
983
993
|
);
|
|
984
994
|
break;
|
|
995
|
+
case "containerGapFillerStyle":
|
|
996
|
+
e.containerGapFillerStyle && Object.assign(
|
|
997
|
+
t.bottomSheetContainerGapFiller.style,
|
|
998
|
+
e.containerGapFillerStyle
|
|
999
|
+
);
|
|
1000
|
+
break;
|
|
985
1001
|
case "handleStyle":
|
|
986
1002
|
e.handleStyle && Object.assign(
|
|
987
1003
|
t.bottomSheetHandleBar.style,
|
|
@@ -1025,9 +1041,9 @@ function cn(t) {
|
|
|
1025
1041
|
onClose: B,
|
|
1026
1042
|
bottomSheetState: o,
|
|
1027
1043
|
draggingState: i,
|
|
1028
|
-
snapTo:
|
|
1029
|
-
moveUp:
|
|
1030
|
-
moveDown:
|
|
1044
|
+
snapTo: F,
|
|
1045
|
+
moveUp: O,
|
|
1046
|
+
moveDown: C
|
|
1031
1047
|
}, { elements: b, eventHandlers: l } = jt(
|
|
1032
1048
|
n,
|
|
1033
1049
|
s
|
|
@@ -1039,20 +1055,20 @@ function cn(t) {
|
|
|
1039
1055
|
n,
|
|
1040
1056
|
l
|
|
1041
1057
|
)
|
|
1042
|
-
), { bottomSheetBackdrop: p, bottomSheetRoot: w, bottomSheetContainer: c } = b,
|
|
1058
|
+
), { bottomSheetBackdrop: p, bottomSheetRoot: w, bottomSheetContainer: c } = b, y = (d) => {
|
|
1043
1059
|
const g = d ?? window.document.body;
|
|
1044
1060
|
g.appendChild(w), g.appendChild(p);
|
|
1045
1061
|
const h = window.innerHeight;
|
|
1046
1062
|
Q(c, {
|
|
1047
1063
|
y: h
|
|
1048
1064
|
}), l.attachEventListeners(), o.isMounted = !0;
|
|
1049
|
-
},
|
|
1065
|
+
}, S = () => {
|
|
1050
1066
|
l.clearEventListeners(), Object.values(b).forEach((d) => {
|
|
1051
1067
|
d.remove();
|
|
1052
1068
|
}), a(), o.isMounted = !1;
|
|
1053
|
-
},
|
|
1069
|
+
}, k = () => {
|
|
1054
1070
|
var D;
|
|
1055
|
-
if (
|
|
1071
|
+
if (L() || qt(
|
|
1056
1072
|
'Bottom Sheet is not mounted yet. call the "mount" method first.'
|
|
1057
1073
|
), (D = t.beforeOpen) == null || D.call(t), N())
|
|
1058
1074
|
return;
|
|
@@ -1094,7 +1110,7 @@ function cn(t) {
|
|
|
1094
1110
|
}
|
|
1095
1111
|
}), a();
|
|
1096
1112
|
}
|
|
1097
|
-
function
|
|
1113
|
+
function L() {
|
|
1098
1114
|
return o.isMounted;
|
|
1099
1115
|
}
|
|
1100
1116
|
function N() {
|
|
@@ -1144,7 +1160,7 @@ function cn(t) {
|
|
|
1144
1160
|
minOffset: m
|
|
1145
1161
|
};
|
|
1146
1162
|
}
|
|
1147
|
-
function
|
|
1163
|
+
function O() {
|
|
1148
1164
|
const d = [...f.snapPoints].reverse(), g = I(c).y, h = c.clientHeight, m = h - g;
|
|
1149
1165
|
if (!f.expandable && m >= h)
|
|
1150
1166
|
return;
|
|
@@ -1177,7 +1193,7 @@ function cn(t) {
|
|
|
1177
1193
|
bottomSheetContainer: c
|
|
1178
1194
|
});
|
|
1179
1195
|
}
|
|
1180
|
-
function
|
|
1196
|
+
function C() {
|
|
1181
1197
|
const d = I(c).y, h = c.clientHeight - d;
|
|
1182
1198
|
if (h < 1)
|
|
1183
1199
|
return;
|
|
@@ -1196,7 +1212,7 @@ function cn(t) {
|
|
|
1196
1212
|
bottomSheetContainer: c
|
|
1197
1213
|
});
|
|
1198
1214
|
}
|
|
1199
|
-
function
|
|
1215
|
+
function F(d) {
|
|
1200
1216
|
const g = window.innerHeight;
|
|
1201
1217
|
if (!zt(d))
|
|
1202
1218
|
return;
|
|
@@ -1206,17 +1222,17 @@ function cn(t) {
|
|
|
1206
1222
|
return {
|
|
1207
1223
|
props: f,
|
|
1208
1224
|
elements: b,
|
|
1209
|
-
mount:
|
|
1210
|
-
unmount:
|
|
1211
|
-
open:
|
|
1225
|
+
mount: y,
|
|
1226
|
+
unmount: S,
|
|
1227
|
+
open: k,
|
|
1212
1228
|
close: B,
|
|
1213
|
-
getIsMounted:
|
|
1229
|
+
getIsMounted: L,
|
|
1214
1230
|
getIsOpen: N,
|
|
1215
1231
|
getIsClosed: X,
|
|
1216
1232
|
getPosition: tt,
|
|
1217
1233
|
getHeight: nt,
|
|
1218
1234
|
moveTo: z,
|
|
1219
|
-
snapTo:
|
|
1235
|
+
snapTo: F
|
|
1220
1236
|
};
|
|
1221
1237
|
}
|
|
1222
1238
|
function ln() {
|
|
@@ -1256,9 +1272,9 @@ export {
|
|
|
1256
1272
|
en as BOTTOM_SHEET_DEFAULT_PROPS,
|
|
1257
1273
|
R as BOTTOM_SHEET_POSITION,
|
|
1258
1274
|
sn as BOTTOM_SHEET_SELECTORS,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1275
|
+
P as COMMON_ANIMATION_KEYS,
|
|
1276
|
+
T as ClassNames,
|
|
1277
|
+
G as EventPhase,
|
|
1262
1278
|
ot as ResetClassNames,
|
|
1263
1279
|
K as UtilClassNames,
|
|
1264
1280
|
cn as createBottomSheet,
|
|
@@ -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(h,
|
|
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"})});
|
|
2
|
+
(function(h,H){typeof exports=="object"&&typeof module<"u"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):(h=typeof globalThis<"u"?globalThis:h||self,H(h.BottomSheet={}))})(this,function(h){"use strict";var ln=Object.defineProperty;var dn=(h,H,y)=>H in h?ln(h,H,{enumerable:!0,configurable:!0,writable:!0,value:y}):h[H]=y;var K=(h,H,y)=>dn(h,typeof H!="symbol"?H+"":H,y);var H=document.createElement("style");H.textContent=`.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;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(H);function y(t){return typeof t=="string"}function Yt(t,n){return t.classList.contains(q(n))}function $(t,n){t.classList.add(q(n))}function rt(t,n){t.classList.remove(q(n))}function W(t,n,e){y(e)&&(y(n)&&rt(t,n),$(t,e))}function q(t){return y(t)?t.trim().replace(/\./g,""):""}function R(t){return t.map(n=>q(n)).filter(Boolean).join(" ")}function xt(t){return t.map(n=>n==null?void 0:n.trim()).filter(Boolean).map(n=>`.${n}`).join(" ")}const gt="open",ht="hidden";function ot(t,n){const e=n;if(Array.isArray(t)){t.forEach(r=>{J(r,e),r.setAttribute("aria-modal",e?"true":"false")});return}J(t,e),t.setAttribute("aria-modal",e?"true":"false")}function J(t,n){n?($(t,gt),rt(t,ht)):($(t,ht),rt(t,gt))}function bt(t){return t instanceof HTMLElement}function Y(t){return typeof t=="number"&&!Number.isNaN(t)}function It(t){bt(t)&&t.focus()}function Nt(t){if(!bt(t)||t.offsetParent===null||"disabled"in t&&t.disabled)return!1;const e=t.getAttribute("tabindex"),r=Y(e)?parseInt(e,10):-1,i=["INPUT","BUTTON","SELECT","TEXTAREA","A","AREA","IFRAME"].includes(t.tagName),a=t instanceof HTMLAnchorElement&&t.href!==""||t instanceof HTMLAreaElement&&t.href!=="";return i||a||r>-1}var 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||{}),V=(t=>(t.Hidden="hidden",t))(V||{});function M(t,n,e){const r=document.createElement(t);return n.split(" ").forEach(i=>{$(r,i)}),y(e)&&r.setAttribute("data-testid",e),r}const Mt={CONTENTS_WRAPPER:xt([T.Root,T.ContentWrapper])};function mt(t,n,e,r){switch(r){case"content-height":return n>=t?Ct(t,n,e):0;case"middle":return-(t/2-n);case"top":return-(t-n)+e;default:return 0}}function pt(t,n){const e=n<t,r=n>t;return{isUp:e,isDown:r,stayedSame:n===t}}function yt(t,n){return n<t?-(t-n):n-t}function z(t,n){return t>n?t-n:n-t}function Pt(t,n){const e=t<n,r=t>n;return{isUp:e,isDown:r,stayedSame:t===n}}function Tt(t,n,e){const r=t==="above";return e.filter(o=>{const i=o*n.viewportHeight;return r?n.visibleHeight<i:n.visibleHeight>i})}function Ct(t,n,e){return-(t-n)+e}function Et(t){return Number(t.replace("px",""))}function Z(t,...n){return Number(t.toFixed(...n))}function vt(t){const n=/(?<type>\w+)\((?<values>[^)]+)\)/g,e=[];let r;for(;(r=n.exec(t))!==null;){const o=r[1],i=r[2].split(",").map(a=>a.trim());e.push({type:o,values:i})}return e}function Ft(t){const n=t.style.transform,e=vt(n);return{transform:n,transformValues:e}}function wt(t,n){const e=t.find(r=>r.type.startsWith(n));return e||null}const it="translate";function N(t){const n=t.style.transform,e=vt(n),r=wt(e,it);return St(r??{type:it,values:[]})}function tt(t,{x:n,y:e}){const{transform:r,transformValues:o}=Ft(t),i=wt(o,it);if(i){const a=St(i);t.style.transform=`translate(${n??a.x??0}px,${e??a.y??0}px)`;return}if(r){t.style.transform=`${r}, translate(${n??0}px,${e??0}px)`;return}t.style.transform=`translate(${n??0}px,${e??0}px)`}function St(t){if(t.type!=="translate")throw new Error(`Could not get coordinates from ${t.type}, since is not translate.`);const n=t.values[0],e=t.values[1];return{x:Et(n)??0,y:Et(e)??0}}function at(t){return t!=null}function Ot(t,{min:n,max:e}){return at(e)&&t>=e?e:at(n)&&t<=n?n:t}const _t=(t,n,e)=>{n instanceof HTMLElement&&!Yt(n,T.Handle)&&e.scrollTop>=1||(t.isDragging=!0)},Rt=(t,n,e,r)=>o=>{r.startY=t.getCoordinates(o).y,r.containerStartTranslate=N(n),e.onDragStart()},jt=(t,n,e,r,o)=>i=>{Gt(i,t,e,r,o,n,e.marginTop)};function Gt(t,n,e,r,o,i,a){if(!r.isDragging||!Y(r.startY))return;const d=n.getCoordinates(t).y,s=yt(r.startY,d),p=window.innerHeight,l=i.clientHeight,f=l-(r.containerStartTranslate.y+s);if(f>=p)return;const C=pt(r.startY,d);if(C.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(C.isUp){const E=O-c,k=O-f,A=Ot(1-Z(k/E,2),{min:0,max:1});e.onDragMove(C,A)}else if(C.isDown){const E=Ot(Z(1-f/c,2),{min:0,max:1});e.onDragMove(C,E)}}const Ut=(t,n,e,r,o,i,a)=>d=>{if(!r.isDragging||(r.isDragging=!1,!Y(r.startY)))return;e.onDragEnd();const s=r.startY,p=t.getCoordinates(d).y,l=N(n).y,f=pt(s,p),C=window.innerHeight,O=n.clientHeight;if(f.isUp){const c=[...e.snapPoints].sort((A,x)=>A-x),E=O+-l;if(!e.expandable&&E>=O)return;for(const A of c){const x=A*window.innerHeight;if(E<=x){const B=z(E,x);a.translateContainer({startY:l,endY:l-B,animationFrame:o,bottomSheetContainer:n});return}}const k=Ct(C,O,e.marginTop);a.translateContainer({startY:l,endY:k,animationFrame:o,bottomSheetContainer:n})}else if(f.isDown){const c=[...e.snapPoints].sort((E,k)=>k-E);for(const E of c){const k=E*window.innerHeight,A=O+-l;if(A>=k){const x=z(A,k);a.translateContainer({startY:l,endY:l+x,animationFrame:o,bottomSheetContainer:n});return}}if(e.preventClosing){const E=O+-l;if(E>=O){const k=z(E,O);a.translateContainer({startY:l,endY:l+k,animationFrame:o,bottomSheetContainer:n})}return}i()}};var P=(t=>(t[t.All=-1]="All",t[t.None=0]="None",t[t.Capture=1]="Capture",t[t.Target=2]="Target",t[t.Bubble=3]="Bubble",t))(P||{});function st(t){switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return-1}}const $t={eventPhase:P.All};class X{constructor(n){K(this,"currentTarget");this.currentTarget=n}addEventListeners({onStart:n,onStartOptions:e=$t,onMove:r,onEnd:o}){this.addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}),this.addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o})}addTouchEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("touchstart",i=>{if(e.eventPhase===P.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("touchmove",r),o&&this.currentTarget.addEventListener("touchend",o)}addMouseEventListeners({onStart:n,onStartOptions:e,onMove:r,onEnd:o}){n&&this.currentTarget.addEventListener("mousedown",i=>{if(e.eventPhase===P.All){n(i);return}st(i.eventPhase)===e.eventPhase&&n(i)},{passive:!0}),r&&this.currentTarget.addEventListener("mousemove",r),o&&this.currentTarget.addEventListener("mouseup",i=>{o(i)})}removeEventListeners({onStart:n,onMove:e,onEnd:r}){n&&this.currentTarget.removeEventListener("touchstart",n),r&&this.currentTarget.removeEventListener("touchend",r),e&&this.currentTarget.removeEventListener("touchmove",e),n&&this.currentTarget.removeEventListener("mousedown",n),e&&this.currentTarget.removeEventListener("mousemove",e),r&&this.currentTarget.removeEventListener("mouseup",r)}getCoordinates(n){if(n.type==="touchstart"||n.type==="mousedown"){if("touches"in n)return{x:n.touches[0].clientX,y:n.touches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}if(n.type==="touchend"||n.type==="mouseup"||n.type==="mousemove"||n.type==="touchmove"){if("touches"in n)return{x:n.changedTouches[0].clientX,y:n.changedTouches[0].clientY};if(n instanceof MouseEvent)return{x:n.clientX,y:n.clientY}}return{x:0,y:0}}}function kt(t){const n=t;return`${n} ${n} 0px 0px`}function Wt(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.containerGapFillerStyle&&Object.assign(e.bottomSheetContainer.style,t.containerStyle),t.containerStyle&&Object.assign(e.bottomSheetContainerGapFiller.style,t.containerGapFillerStyle),t.handleStyle&&Object.assign(e.bottomSheetHandleBar.style,t.handleStyle),t.contentWrapperStyle&&Object.assign(e.bottomSheetContentWrapper.style,t.contentWrapperStyle),{elements:e,eventHandlers:i}}function Vt(t){const n=M("dialog",R([T.Root,Q.Dialog,t.rootClass]),T.Root);n.ariaLabel=t.ariaLabel;const e=M("section",R([T.Container,t.containerClass]),T.Container);t.containerBorderRadius&&(e.style.borderRadius=kt(t.containerBorderRadius));const r=M("div",T.GapFiller,T.GapFiller);t.containerBackgroundColor&&(e.style.backgroundColor=t.containerBackgroundColor,r.style.backgroundColor=t.containerBackgroundColor);const o=M("button",R([T.Handle,Q.Button,t.shouldShowHandle?null:V.Hidden,t.handleClass]),T.Handle);o.setAttribute("type","button"),o.ariaLabel="bottom sheet close button";const i=M("span",R([T.HandleBar,t.shouldShowHandle?null:V.Hidden]),T.HandleBar),a=M("article",R([T.ContentWrapper,t.contentWrapperClass]),T.ContentWrapper),d=M("div",R([T.Backdrop,t.backdropClass,V.Hidden]),T.Backdrop);return t.backdropColor&&(d.style.backgroundColor=t.backdropColor),t.backDropTransition&&(d.style.transition=t.backDropTransition),{bottomSheetRoot:n,bottomSheetBackdrop:d,bottomSheetContainer:e,bottomSheetHandle:o,bottomSheetHandleBar:i,bottomSheetContentWrapper:a,bottomSheetContainerGapFiller:r}}function 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),C=new X(a),O=n.dragTriggers.reduce((w,L)=>{const v=r.querySelectorAll(L);if(!v.length)return w;const U=Array.from(v).map(u=>u instanceof HTMLElement?new X(u):null).filter(u=>!!u);return[...w,...U]},[]),c=new X(window),E=Rt(c,o,n,e.draggingState),k=jt(c,o,n,e.draggingState,p),A=Ut(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){_t(e.draggingState,w.target,t.bottomSheetContentWrapper)}function G(w){const L=w??n;L.draggable&&(l.addEventListeners({onStart:B}),O.forEach(v=>{v.addEventListeners({onStart:B,onStartOptions:{eventPhase:P.Target}})})),L.draggable&&L.backgroundDraggable&&(f.addEventListeners({onStart:B,onStartOptions:{eventPhase:P.Target}}),C.addEventListeners({onStart:B})),L.draggable&&c.addEventListeners({onStart:E,onMove:k,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 U=ft(t.bottomSheetContentWrapper);It(U)}})}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}),C.removeEventListeners({onStart:B}),O.forEach(w=>{w.removeEventListeners({onStart:B})}),c.removeEventListeners({onStart:E,onMove:k,onEnd:A})}return{attachEventListeners:G,clearEventListeners:et,attacheOnOpenEventListeners:nt,clearOnOpenEventListeners:ut}}class Kt{constructor(){K(this,"animationId");K(this,"isInProgress");K(this,"startedAt");this.animationId=null,this.isInProgress=!1,this.startedAt=null}start(n,e,r=!1){this.isInProgress=!0;const o=i=>{this.startedAt||(this.startedAt=i);const a=i-this.startedAt,s=e===0?1:Z(a/e,2),p=s>=1&&!r;n(s),p?this.stop():this.animationId=requestAnimationFrame(o)};this.animationId=requestAnimationFrame(o)}stop(){this.isInProgress=!1,this.startedAt=null,Y(this.animationId)&&cancelAnimationFrame(this.animationId)}}function qt(t){const{startY:n,endY:e,bottomSheetContainer:r,animationFrame:o,onEnd:i,animationTimingFunction:a,animationDuration:d}=t,s=yt(n,e);o.stop();let p=!1;o.start(l=>{tt(r,{y:n+s*a(l)}),!p&&l>=1&&(i==null||i(),p=!0)},d)}const ct=(t,n)=>e=>{qt({...e,animationTimingFunction:t,animationDuration:n})},F={TOP:"top",MIDDLE:"middle",CONTENT_HEIGHT:"content-height",CLOSED:"closed"};function Jt(t){return!(!Y(t)||t>1||t<0)}function Qt(t,n){const e={set(r,o,i,a){return n(o,i),Reflect.set(r,o,i,a)}};return new Proxy(t,e)}function Zt(...t){console.error(t)}const _={EASE:"ease",EASE_IN:"ease-in",EASE_OUT:"ease-out",EASE_IN_OUT:"ease-in-out",SPRING:"spring"};function Ht(t){for(const n of Object.values(_))if(n===t)return!0;return!1}function lt(t){return!!(t instanceof Object&&"p1x"in t&&"p1y"in t&&"p2x"in t&&"p2y"in t&&Y(t.p1x)&&Y(t.p1y)&&Y(t.p2x)&&Y(t.p2y))}function j(t,n,e,r){return function(s){return d(i(s))};function i(s){let p=0,l=1,f=s,C;if(s===0||s===1)return s;for(;p<l;){if(C=a(f),Math.abs(C-s)<.001)return f;s>C?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 _.EASE:return Lt;case _.EASE_IN:return tn;case _.EASE_OUT:return At;case _.EASE_IN_OUT:return nn;case _.SPRING:return en;default:return Lt}}function Bt(t){return typeof t=="boolean"}const Dt={ariaLabel:"Bottom sheet",content:"",defaultPosition:F.CONTENT_HEIGHT,marginTop:20,snapPoints:[],width:"92%",dragTriggers:[],beforeOpen:()=>{},afterOpen:()=>{},beforeClose:()=>{},afterClose:()=>{},onDragStart:()=>{},onDragMove:()=>{},onDragEnd:()=>{},expandable:!0,preventClosing:!1,draggable:!0,backgroundDraggable:!0,shouldCloseOnOutsideClick:!0,shouldShowBackdrop:!0,shouldShowHandle:!0,backDropTransition:null,backdropColor:null,containerBackgroundColor:null,containerBorderRadius:null,rootClass:null,containerClass:null,handleClass:null,contentWrapperClass:null,backdropClass:null,draggingAnimationTimings:"ease-in-out",draggingAnimationDuration:180,rootStyle:{},containerStyle:{},handleStyle:{},contentWrapperStyle:{},backdropStyle:{},containerGapFillerStyle:{}};function on(t){const n={...Dt},e=Object.entries(t).reduce((o,i)=>{const[a,d]=i;return at(d)&&(o[a]=d),o},{});return{...n,...e}}function dt(t){if(lt(t)){const{p1x:n,p1y:e,p2x:r,p2y:o}=t;return j(n,e,r,o)}return Ht(t)?rn(t):At}function an(t,n,e,r){function o(i,a){switch(i){case"content":y(a)&&(t.bottomSheetContentWrapper.innerHTML=a);break;case"width":y(a)&&(t.bottomSheetContainer.style.width=a);break;case"shouldShowHandle":Bt(a)||J(t.bottomSheetHandle,!1);break;case"shouldShowBackdrop":Bt(a)||J(t.bottomSheetBackdrop,!1);break;case"containerBorderRadius":y(a)&&(t.bottomSheetContainer.style.borderRadius=kt(a));break;case"containerBackgroundColor":y(a)&&(t.bottomSheetContainer.style.backgroundColor=a,t.bottomSheetContainerGapFiller.style.backgroundColor=a);break;case"backdropColor":y(a)&&(t.bottomSheetBackdrop.style.backgroundColor=a);break;case"backDropTransition":y(a)&&(t.bottomSheetBackdrop.style.transition=a);break;case"rootClass":if(!y(a))return;W(t.bottomSheetRoot,e.rootClass,a);break;case"containerClass":if(!y(a))return;W(t.bottomSheetContainer,e.containerClass,a);break;case"handleClass":if(!y(a))return;W(t.bottomSheetHandle,e.handleClass,a);break;case"contentWrapperClass":if(!y(a))return;W(t.bottomSheetContentWrapper,e.contentWrapperClass,a);break;case"backdropClass":if(!y(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(lt(a)){const d=dt(a),s=ct(d,e.draggingAnimationDuration);n.translateContainer=s}break;case"draggingAnimationDuration":if(Y(a)){const d=dt(e.draggingAnimationTimings),s=ct(d,a);n.translateContainer=s}break;case"rootStyle":e.rootStyle&&Object.assign(t.bottomSheetRoot.style,e.rootStyle);break;case"backdropStyle":e.backdropStyle&&Object.assign(t.bottomSheetBackdrop.style,e.backdropStyle);break;case"containerStyle":e.containerStyle&&Object.assign(t.bottomSheetContainer.style,e.containerStyle);break;case"containerGapFillerStyle":e.containerGapFillerStyle&&Object.assign(t.bottomSheetContainerGapFiller.style,e.containerGapFillerStyle);break;case"handleStyle":e.handleStyle&&Object.assign(t.bottomSheetHandleBar.style,e.handleStyle);break;case"contentWrapperStyle":e.contentWrapperStyle&&Object.assign(t.bottomSheetContentWrapper.style,e.contentWrapperStyle);break}}return o}function sn(t){const n=on(t),e=dt(t.draggingAnimationTimings),o={isMounted:!1,translateContainer:ct(e,n.draggingAnimationDuration)},i={startY:null,containerStartTranslate:{x:0,y:0},isDragging:!1,originalDocumentOverflowY:null,originalDocumentOverscrollBehavior:null};function a(){i.originalDocumentOverflowY&&i.originalDocumentOverflowY!=="hidden"&&(document.body.style.overflowY=i.originalDocumentOverflowY),i.originalDocumentOverscrollBehavior&&(document.body.style.position=i.originalDocumentOverscrollBehavior)}const d=new Kt,s={animationFrame:d,onClose:x,bottomSheetState:o,draggingState:i,snapTo:U,moveUp:L,moveDown:v},{elements:p,eventHandlers:l}=Wt(n,s),f=Qt(n,an(p,o,n,l)),{bottomSheetBackdrop:C,bottomSheetRoot:O,bottomSheetContainer:c}=p,E=u=>{const g=u??window.document.body;g.appendChild(O),g.appendChild(C);const b=window.innerHeight;tt(c,{y:b}),l.attachEventListeners(),o.isMounted=!0},k=()=>{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),G())return;ot(C,!0),f.shouldShowBackdrop||$(C,"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([C,c],!1),l.clearOnOpenEventListeners()}}),a()}function B(){return o.isMounted}function G(){const u=N(c).y,g=window.innerHeight,b=c.clientHeight>=g?g:c.clientHeight;return u<=b}function nt(){return!G()}function ut(){const u=N(c).y,g=c.clientHeight,b=window.innerHeight;if(u<=5&&u>=-5)return F.CONTENT_HEIGHT;const m=g-u;if(m===b/2)return F.MIDDLE;const S=b-f.marginTop,D=10;return m<=S+D&&m>=S-D?F.TOP:F.CLOSED}function ft(){return c.clientHeight}function et(u){if(!G())return;const g=N(c).y,m=c.clientHeight-g,S=window.innerHeight-u,D=Pt(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=Tt("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=Tt("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 U(u){const g=window.innerHeight;if(!Jt(u))return;const b=Z(g*u,2);et(b)}return{props:f,elements:p,mount:E,unmount:k,open:A,close:x,getIsMounted:B,getIsOpen:G,getIsClosed:nt,getPosition:ut,getHeight:ft,moveTo:et,snapTo:U}}function cn(){return{elements:{bottomSheetRoot:void 0,bottomSheetBackdrop:void 0,bottomSheetContainer:void 0,bottomSheetHandle:void 0,bottomSheetHandleBar:void 0,bottomSheetContentWrapper:void 0,bottomSheetContainerGapFiller:void 0},mount:()=>{},unmount:()=>{},open:()=>{},close:()=>{},getIsMounted:()=>!1,getHeight:()=>0,getIsOpen:()=>!1,getIsClosed:()=>!0,getPosition:()=>F.CLOSED,moveTo:()=>{},snapTo:()=>{},props:{content:""}}}h.BOTTOM_SHEET_DEFAULT_PROPS=Dt,h.BOTTOM_SHEET_POSITION=F,h.BOTTOM_SHEET_SELECTORS=Mt,h.COMMON_ANIMATION_KEYS=_,h.ClassNames=T,h.EventPhase=P,h.ResetClassNames=Q,h.UtilClassNames=V,h.createBottomSheet=sn,h.createPlaceholderBottomSheet=cn,h.eventPhaseToEnum=st,h.isAnimationTimingPoints=lt,h.isCommonAnimationTimingsKey=Ht,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DraggingDirection } from '../calculator/position-calculator.type';
|
|
2
2
|
import { AnimationTimingPoints, CommonAnimation } from '../utils/animation/animation.type';
|
|
3
|
-
import { CSSColor, CSSUnit } from '../utils/types/css-attribute';
|
|
4
3
|
|
|
5
4
|
export type RequiredBottomSheetProps = Required<BottomSheetCoreProps>;
|
|
6
5
|
export interface BottomSheetCoreProps {
|
|
@@ -58,8 +57,9 @@ export interface BottomSheetCoreProps {
|
|
|
58
57
|
* Border radius will be applied to the upper vertices.
|
|
59
58
|
* ex) If it is 10px, border radius becomes `10px 10px 0px 0px`
|
|
60
59
|
*/
|
|
61
|
-
containerBorderRadius?:
|
|
62
|
-
|
|
60
|
+
containerBorderRadius?: string | null;
|
|
61
|
+
containerBackgroundColor?: string | null;
|
|
62
|
+
backdropColor?: string | null;
|
|
63
63
|
backDropTransition?: string | null;
|
|
64
64
|
rootClass?: string | null;
|
|
65
65
|
containerClass?: string | null;
|
|
@@ -68,6 +68,7 @@ export interface BottomSheetCoreProps {
|
|
|
68
68
|
backdropClass?: string | null;
|
|
69
69
|
rootStyle?: PartialCSSStyles;
|
|
70
70
|
containerStyle?: PartialCSSStyles;
|
|
71
|
+
containerGapFillerStyle?: PartialCSSStyles;
|
|
71
72
|
handleStyle?: PartialCSSStyles;
|
|
72
73
|
contentWrapperStyle?: PartialCSSStyles;
|
|
73
74
|
backdropStyle?: PartialCSSStyles;
|
|
@@ -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;
|
|
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;AAG5C,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,MAAM,GAAG,IAAI,CAAC;IACtC,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,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,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,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"}
|