@luciodale/swipe-bar 1.2.4 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SwipeBarProvider.d.ts +6 -7
- package/dist/SwipeBarProvider.d.ts.map +1 -1
- package/dist/ToggleBottom.d.ts +1 -1
- package/dist/ToggleBottom.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/swipe-bar.es.js +914 -839
- package/dist/swipe-bar.umd.js +4 -4
- package/dist/swipeSidebarShared.d.ts +12 -0
- package/dist/swipeSidebarShared.d.ts.map +1 -1
- package/dist/useSwipeBarContext.d.ts +58 -42
- package/dist/useSwipeBarContext.d.ts.map +1 -1
- package/dist/useSwipeLeftSidebar.d.ts +1 -1
- package/dist/useSwipeLeftSidebar.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/swipe-bar.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(F,
|
|
1
|
+
(function(F,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(F=typeof globalThis<"u"?globalThis:F||self,u(F.LucioDaleSwipeBar={},F.React))})(this,function(F,u){"use strict";var Se={exports:{}},de={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ie;function rt(){if(Ie)return de;Ie=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,a,o){var g=null;if(o!==void 0&&(g=""+o),a.key!==void 0&&(g=""+a.key),"key"in a){o={};for(var c in a)c!=="key"&&(o[c]=a[c])}else o=a;return a=o.ref,{$$typeof:e,type:i,key:g,ref:a!==void 0?a:null,props:o}}return de.Fragment=t,de.jsx=n,de.jsxs=n,de}var fe={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Me;function it(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===X?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case P:return"Fragment";case M:return"Profiler";case _:return"StrictMode";case H:return"Suspense";case b:return"SuspenseList";case Y:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case x:return"Portal";case D:return r.displayName||"Context";case W:return(r._context.displayName||"Context")+".Consumer";case j:var m=r.render;return r=r.displayName,r||(r=m.displayName||m.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case T:return m=r.displayName||null,m!==null?m:e(r.type)||"Memo";case y:m=r._payload,r=r._init;try{return e(r(m))}catch{}}return null}function t(r){return""+r}function n(r){try{t(r);var m=!1}catch{m=!0}if(m){m=console;var w=m.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return w.call(m,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(r)}}function i(r){if(r===P)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===y)return"<...>";try{var m=e(r);return m?"<"+m+">":"<...>"}catch{return"<...>"}}function a(){var r=V.A;return r===null?null:r.getOwner()}function o(){return Error("react-stack-top-frame")}function g(r){if(G.call(r,"key")){var m=Object.getOwnPropertyDescriptor(r,"key").get;if(m&&m.isReactWarning)return!1}return r.key!==void 0}function c(r,m){function w(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",m))}w.isReactWarning=!0,Object.defineProperty(r,"key",{get:w,configurable:!0})}function f(){var r=e(this.type);return ie[r]||(ie[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function d(r,m,w,C,B,$){var L=w.ref;return r={$$typeof:I,type:r,key:m,props:w,_owner:C},(L!==void 0?L:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:f}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function E(r,m,w,C,B,$){var L=m.children;if(L!==void 0)if(C)if(U(L)){for(C=0;C<L.length;C++)S(L[C]);Object.freeze&&Object.freeze(L)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(L);if(G.call(m,"key")){L=e(r);var ee=Object.keys(m).filter(function(we){return we!=="key"});C=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",q[L+C]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,C,M,ne,M),te[M+C]=!0)}if(M=null,O!==void 0&&(n(O),M=""+O),d(h)&&(n(h.key),M=""+h.key),"key"in h){O={};for(var de in h)de!=="key"&&(O[de]=h[de])}else O=h;return M&&a(O,typeof r=="function"?r.displayName||r.name||"Unknown":r),c(r,M,O,s(),K,$)}function p(r){v(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===w&&(r._payload.status==="fulfilled"?v(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function v(r){return typeof r=="object"&&r!==null&&r.$$typeof===I}var S=l,I=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),D=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),V=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,U=Array.isArray,N=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(r){return r()}};var Z,Q={},J=S.react_stack_bottom_frame.bind(S,o)(),B=N(i(o)),te={};le.Fragment=P,le.jsx=function(r,h,O){var C=1e4>V.recentlyCreatedOwnerStacks++;return T(r,h,O,!1,C?Error("react-stack-top-frame"):J,C?N(i(r)):B)},le.jsxs=function(r,h,O){var C=1e4>V.recentlyCreatedOwnerStacks++;return T(r,h,O,!0,C?Error("react-stack-top-frame"):J,C?N(i(r)):B)}}()),le}process.env.NODE_ENV==="production"?he.exports=qe():he.exports=et();var E=he.exports;const Pe=l.createContext(null),me=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},be={isOpen:!1,anchorState:"closed"},tt=({children:e,sidebarWidthPx:t,transitionMs:n,edgeActivationWidthPx:i,dragActivationDeltaPx:s,showOverlay:o,isAbsolute:d,overlayBackgroundColor:a,toggleIconColor:u,toggleIconSizePx:c,toggleIconEdgeDistancePx:T,showToggle:p,mediaQueryWidth:v,swipeBarZIndex:S,toggleZIndex:I,overlayZIndex:R,fadeContent:P,fadeContentTransitionMs:L,closeSidebarOnOverlayClick:_})=>{var Je,Ke;const[W,D]=l.useState(null),[j,H]=l.useState(!1),[g,x]=l.useState(!1),[w,Y]=l.useState({}),[X,V]=l.useState({}),G=l.useRef(null),U=l.useRef(null),N=l.useRef(null),Z=l.useRef(null),[Q,J]=l.useState({}),[B,te]=l.useState({}),r=l.useRef(new Map),h=l.useRef(null),O=l.useRef([]),C=((Je=Q.primary)==null?void 0:Je.isOpen)??!1,K=((Ke=Q.primary)==null?void 0:Ke.anchorState)??"closed",$=l.useMemo(()=>Object.values(Q).some(f=>f.isOpen),[Q]),M=r.current.get("primary"),ne=(M==null?void 0:M.sidebarRef)??{current:null},de=(M==null?void 0:M.toggleRef)??{current:null},Ee=B.primary??{},[Nt,Ft]=l.useState({sidebarWidthPx:t??ot,sidebarHeightPx:Ce,transitionMs:n??nt,edgeActivationWidthPx:i??rt,dragActivationDeltaPx:s??it,showOverlay:o??st,isAbsolute:d??ct,overlayBackgroundColor:a??Ie,toggleIconColor:u??lt,toggleIconSizePx:c??ut,toggleIconEdgeDistancePx:T??dt,showToggle:p??ft,mediaQueryWidth:v??pe,swipeBarZIndex:S??gt,toggleZIndex:I??ht,overlayZIndex:R??mt,fadeContent:P??pt,fadeContentTransitionMs:L??vt,swipeToOpen:wt,swipeToClose:St,midAnchorPoint:yt,midAnchorPointPx:Ce/3,disabled:!1,closeSidebarOnOverlayClick:_??at}),Ht=l.useCallback((f,m)=>{r.current.set(f,m),J(b=>b[f]?b:{...b,[f]:{...be}})},[]),Gt=l.useCallback(f=>{r.current.delete(f),J(m=>{const b={...m};return delete b[f],b}),te(m=>{const b={...m};return delete b[f],b})},[]),Ut=l.useCallback(f=>r.current.get(f),[]),Zt=l.useCallback((f,m)=>{te(b=>b[f]===m?b:{...b,[f]:m})},[]),q=l.useCallback((f,m)=>{J(b=>{const y=b[f]??be;return y.isOpen===m?b:{...b,[f]:{...y,isOpen:m}}})},[]),ee=l.useCallback((f,m)=>{J(b=>{const y=b[f]??be;return y.anchorState===m?b:{...b,[f]:{...y,anchorState:m}}})},[]);l.useEffect(()=>(j||g||$?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[j,g,$]),l.useEffect(()=>{var f;if(w.fadeContent===!1){const m=(f=G.current)==null?void 0:f.firstElementChild;m&&(m.style.opacity="1")}},[w.fadeContent]),l.useEffect(()=>{var f;if(X.fadeContent===!1){const m=(f=U.current)==null?void 0:f.firstElementChild;m&&(m.style.opacity="1")}},[X.fadeContent]),l.useEffect(()=>{var f;for(const[m,b]of Object.entries(B))if(b.fadeContent===!1){const y=r.current.get(m),A=(f=y==null?void 0:y.sidebarRef.current)==null?void 0:f.firstElementChild;A&&(A.style.opacity="1")}},[B]);const zt=l.useCallback(f=>{Ft(m=>({...m,...f}))},[]),oe=l.useCallback(f=>{const m=O.current,b=m.indexOf(f);b!==-1&&m.splice(b,1),m.push(f),D("bottom")},[]),Qe=l.useCallback(f=>{const m=O.current,b=m.indexOf(f);b!==-1&&m.splice(b,1),J(y=>(Object.entries(y).some(([k,re])=>k!==f&&re.isOpen)||D(null),y))},[]),Vt=l.useCallback((f,m)=>{const b=(y,A,k,re)=>{Se({side:f,ref:y,options:A,toggleRef:k,afterApply:()=>{re(!0),D(f)}})};if(f==="left"){if(w.disabled)return;b(G,w,N,H)}else if(f==="right"){if(X.disabled)return;b(U,X,Z,x)}else if(f==="bottom"){const y=(m==null?void 0:m.id)??"primary",A=B[y],k=r.current.get(y);if(!A||!k||A.disabled)return;const re=A.sidebarHeightPx??0,qt=A.mediaQueryWidth??640,$e=window.innerWidth<qt,en=$e?A.midAnchorPointPx??0:re;$e&&A.midAnchorPoint&&!A.swipeToOpen&&en<re?Xe({ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,afterApply:()=>{q(y,!0),ee(y,"midAnchor"),oe(y)}}):Se({side:f,ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,afterApply:()=>{q(y,!0),ee(y,"open"),oe(y)}})}else me(f)},[w,X,B,q,ee,oe]),Qt=l.useCallback((f,m)=>{if(f!=="bottom")return;const b=(m==null?void 0:m.id)??"primary",y=B[b],A=r.current.get(b);!y||!A||y.disabled||Xe({ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(b,!0),ee(b,"midAnchor"),oe(b)}})},[B,q,ee,oe]),Jt=l.useCallback((f,m)=>{if(f!=="bottom")return;const b=(m==null?void 0:m.id)??"primary",y=B[b],A=r.current.get(b);!y||!A||y.disabled||Se({side:f,ref:A.sidebarRef,options:y,toggleRef:A.toggleRef,afterApply:()=>{q(b,!0),ee(b,"open"),oe(b)}})},[B,q,ee,oe]),Kt=l.useCallback((f,m)=>{const b=(y,A,k,re)=>{De({ref:y,options:A,toggleRef:k,side:f,afterApply:()=>{re(!1),D(null)}})};if(f==="left"){if(w.disabled)return;b(G,w,N,H)}else if(f==="right"){if(X.disabled)return;b(U,X,Z,x)}else if(f==="bottom"){const y=(m==null?void 0:m.id)??"primary",A=B[y],k=r.current.get(y);if(!A||!k||A.disabled)return;De({ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,side:f,afterApply:()=>{q(y,!1),ee(y,"closed"),Qe(y)}})}else me(f)},[w,X,B,q,ee,Qe]),$t=l.useCallback((f,m,b)=>{if(f==="left")Ye({ref:G,toggleRef:N,options:w,translateX:m});else if(f==="right")Ye({ref:U,toggleRef:Z,options:X,translateX:m});else if(f==="bottom"){const y=(b==null?void 0:b.id)??"primary",A=B[y],k=r.current.get(y);if(!A||!k)return;Lt({ref:k.sidebarRef,toggleRef:k.toggleRef,options:A,translateY:m})}else me(f)},[w,X,B]);return E.jsx(Pe.Provider,{value:{lockedSidebar:W,setLockedSidebar:D,leftSidebarRef:G,rightSidebarRef:U,isLeftOpen:j,isRightOpen:g,isBottomOpen:C,bottomAnchorState:K,bottomSidebarRef:ne,bottomToggleRef:de,bottomSidebarOptions:Ee,bottomSidebars:Q,bottomSidebarOptionsMap:B,registerBottomSidebar:Ht,unregisterBottomSidebar:Gt,getBottomSidebarRefs:Ut,activeBottomDragIdRef:h,bottomFocusStackRef:O,openSidebar:Vt,openSidebarFully:Jt,openSidebarToMidAnchor:Qt,closeSidebar:Kt,dragSidebar:$t,globalOptions:Nt,setGlobalOptions:zt,leftSidebarOptions:w,rightSidebarOptions:X,setLeftSidebarOptions:Y,setRightSidebarOptions:V,setBottomSidebarOptionsById:Zt,leftToggleRef:N,rightToggleRef:Z},children:e})},z=()=>{const e=l.useContext(Pe);if(!e)throw new Error("useSwipeBarContext must be used within SwipeBarProvider");return e},nt=300,rt=40,it=20,ot=320,Ce=window.innerHeight,st=!0,at=!0,ct=!1,Ie="rgba(0, 0, 0, 0.5)",ve="rgb(36,36,36)",lt="white",ut=40,dt=40,ft=!0,pe=640,gt=30,ht=15,mt=20,Me=.6,bt=200,vt=100,pt=!1,wt=!0,St=!0,yt=!1,se="cubic-bezier(0.22, 1, 0.36, 1)",_e={width:0,top:0,bottom:0,flexShrink:0,overflowX:"hidden",willChange:"transform"},Rt={transform:"translateX(-100%)"},xt={transform:"translateX(100%)"},Tt={position:"fixed",left:0,top:0,bottom:0},Et={position:"fixed",right:0,top:0,bottom:0},Ot={height:0,left:0,right:0,flexShrink:0,overflowY:"hidden",willChange:"transform"},At={transform:"translateY(100%)"},Pt={position:"fixed",bottom:0,left:0,right:0},Ct={position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:Ie,transitionProperty:"opacity",pointerEvents:"none",opacity:0},It={opacity:1,pointerEvents:"auto"},Le={position:"fixed",top:"50%",transform:"translateY(-50%)",width:"1px",display:"flex",justifyContent:"center"},Mt={position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",height:"1px",display:"flex",alignItems:"center"},_t={position:"relative",cursor:"pointer",display:"flex",height:"72px",alignItems:"center",justifyContent:"center"},we=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},ue=e=>{var t;return(t=e.current)==null?void 0:t.firstElementChild},Se=({ref:e,side:t,options:n,toggleRef:i,afterApply:s})=>{const o=ue(e),d=n.transitionMs?n.transitionMs/2:0;o&&n.fadeContent&&(o.style.opacity="0");let a,u;t==="left"||t==="right"?(a="width",u=n.sidebarWidthPx,o&&u&&(o.style.minWidth=`${u}px`)):t==="bottom"?(a="height",u=n.sidebarHeightPx,o&&u&&(o.style.minHeight=`${u}px`)):we(t),requestAnimationFrame(()=>{if(!e.current)return;const c=`transform ${n.transitionMs}ms ${se}`,T=n.isAbsolute?"":`, ${a} ${n.transitionMs}ms ${se}`;e.current.style.transition=`${c}${T}`,o&&n.fadeContent&&(o.style.transition=`opacity ${n.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(e.current){if(e.current.style.transform=t==="bottom"?"translateY(0px)":"translateX(0px)",!n.isAbsolute)e.current.style[a]=`${u}px`;else if(e.current.style[a]!==`${u}px`){const p=e.current.style.transition;e.current.style.transition=c,e.current.style[a]=`${u}px`,e.current.style.transition=p}i.current&&u&&(i.current.style.opacity="1",t==="left"?i.current.style.transform=`translateY(-50%) translateX(${u}px)`:t==="right"?i.current.style.transform=`translateY(-50%) translateX(-${u}px)`:t==="bottom"&&(i.current.style.transform=`translateX(-50%) translateY(-${u}px)`)),o&&n.fadeContent&&setTimeout(()=>{o.style.opacity="1"},d),s()}})}),setTimeout(()=>{},0)},De=({ref:e,options:t,side:n,toggleRef:i,afterApply:s})=>{const o=ue(e);let d;n==="left"||n==="right"?(d="width",o&&t.sidebarWidthPx&&(o.style.minWidth=`${t.sidebarWidthPx}px`)):n==="bottom"?(d="height",o&&t.sidebarHeightPx&&(o.style.minHeight=`${t.sidebarHeightPx}px`)):we(n),requestAnimationFrame(()=>{if(!e.current)return;const a=`transform ${t.transitionMs}ms ${se}`,u=t.isAbsolute?"":`, ${d} ${t.transitionMs}ms ${se}`;e.current.style.transition=`${a}${u}`,o&&t.fadeContent&&(o.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{e.current&&(n==="left"?(e.current.style.transform="translateX(-100%)",t.isAbsolute||(e.current.style.width="0px")):n==="right"?(e.current.style.transform="translateX(100%)",t.isAbsolute||(e.current.style.width="0px")):n==="bottom"&&(e.current.style.transform="translateY(100%)",t.isAbsolute||(e.current.style.height="0px")),i.current&&(i.current.style.opacity="1",n==="left"||n==="right"?i.current.style.transform="translateY(-50%)":n==="bottom"&&(i.current.style.transform="translateX(-50%)")),o&&t.fadeContent&&(o.style.opacity="0"),s())})})},Xe=({ref:e,options:t,toggleRef:n,afterApply:i})=>{const s=ue(e),o=t.transitionMs?t.transitionMs/2:0;s&&t.fadeContent&&(s.style.opacity="0"),s&&t.midAnchorPointPx&&(s.style.minHeight=`${t.sidebarHeightPx}px`),requestAnimationFrame(()=>{if(!e.current)return;const d=`transform ${t.transitionMs}ms ${se}`,a=t.isAbsolute?"":`, height ${t.transitionMs}ms ${se}`;e.current.style.transition=`${d}${a}`,s&&t.fadeContent&&(s.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(!e.current)return;const u=t.midAnchorPointPx??0,c=t.sidebarHeightPx??0,T=c-u;if(e.current.style.transform=`translateY(${T}px)`,!t.isAbsolute)e.current.style.height=`${c}px`;else if(e.current.style.height!==`${c}px`){const p=e.current.style.transition;e.current.style.transition=d,e.current.style.height=`${c}px`,e.current.style.transition=p}n.current&&(n.current.style.opacity="1",n.current.style.transform=`translateX(-50%) translateY(-${u}px)`),s&&t.fadeContent&&setTimeout(()=>{s.style.opacity="1"},o),i()})}),setTimeout(()=>{},0)},Ye=({ref:e,toggleRef:t,options:n,translateX:i})=>{!e.current||i===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const s=ue(e);if(e.current){if(s&&n.fadeContent&&(s.style.opacity="0"),s&&n.sidebarWidthPx&&(s.style.minWidth=`${n.sidebarWidthPx}px`),!n.isAbsolute){const o=`${n.sidebarWidthPx}px`;e.current.style.width!==o&&(e.current.style.width=o)}e.current.style.transform=`translateX(${i}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateY(-50%) translateX(${i}px)`)}}))},Lt=({ref:e,toggleRef:t,options:n,translateY:i})=>{!e.current||i===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const s=ue(e);if(e.current){if(s&&n.fadeContent&&(s.style.opacity="0"),s&&n.sidebarHeightPx&&(s.style.minHeight=`${n.sidebarHeightPx}px`),!n.isAbsolute){const o=`${n.sidebarHeightPx}px`;e.current.style.height!==o&&(e.current.style.height=o)}e.current.style.transform=`translateY(${i}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateX(-50%) translateY(${i}px)`)}}))},fe=({refs:e,clientX:t,clientY:n,touchId:i,isMouse:s})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:i,isMouse:s,isActivated:!1},e.currentXRef.current=t,e.prevXRef.current=t},Be=({refs:e,clientX:t,clientY:n,touchId:i,isMouse:s})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:i,isMouse:s,isActivated:!1},e.currentYRef.current=n,e.prevYRef.current=n},We=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null,t(null),n()},Dt=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,t(null)},ae=e=>e instanceof Element?!!e.closest("input, textarea, [contenteditable='true']"):!1;function ke(e){let t=e instanceof HTMLElement?e:null;for(;t;){const n=getComputedStyle(t);if((n.overflowY==="auto"||n.overflowY==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}const ye=(e,t)=>{for(let n=0;n<e.length;n++){const i=e[n];if(t==null||i.identifier===t)return i}return null},Re=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n].identifier===t)return!0;return!1},xe=(e,t,n)=>{const{globalOptions:i,setLeftSidebarOptions:s,setRightSidebarOptions:o,setBottomSidebarOptionsById:d}=z(),{sidebarWidthPx:a,sidebarHeightPx:u,transitionMs:c,edgeActivationWidthPx:T,dragActivationDeltaPx:p,showOverlay:v,isAbsolute:S,overlayBackgroundColor:I,toggleIconColor:R,toggleIconSizePx:P,toggleIconEdgeDistancePx:L,showToggle:_,mediaQueryWidth:W,swipeBarZIndex:D,toggleZIndex:j,overlayZIndex:H,fadeContent:g,fadeContentTransitionMs:x,swipeToOpen:w,swipeToClose:Y,midAnchorPoint:X,midAnchorPointPx:V,disabled:G,closeSidebarOnOverlayClick:U}=t,N=l.useMemo(()=>{const Z=u??i.sidebarHeightPx;return{sidebarWidthPx:a??i.sidebarWidthPx,sidebarHeightPx:Z,transitionMs:c??i.transitionMs,edgeActivationWidthPx:T??i.edgeActivationWidthPx,dragActivationDeltaPx:p??i.dragActivationDeltaPx,showOverlay:v??i.showOverlay,isAbsolute:S??i.isAbsolute,overlayBackgroundColor:I??i.overlayBackgroundColor,toggleIconColor:R??i.toggleIconColor,toggleIconSizePx:P??i.toggleIconSizePx,toggleIconEdgeDistancePx:L??i.toggleIconEdgeDistancePx,showToggle:_??i.showToggle,mediaQueryWidth:W??i.mediaQueryWidth,swipeBarZIndex:D??i.swipeBarZIndex,toggleZIndex:j??i.toggleZIndex,overlayZIndex:H??i.overlayZIndex,fadeContent:g??i.fadeContent,fadeContentTransitionMs:x??i.fadeContentTransitionMs,swipeToOpen:w??i.swipeToOpen,swipeToClose:Y??i.swipeToClose,midAnchorPoint:X??i.midAnchorPoint,midAnchorPointPx:V??i.midAnchorPointPx??Math.floor(Z/3),disabled:G??i.disabled,closeSidebarOnOverlayClick:U??i.closeSidebarOnOverlayClick}},[a,u,c,T,p,v,S,I,R,P,L,_,i,W,D,j,H,g,x,w,Y,X,V,G,U]);return l.useEffect(()=>{e==="left"?s(N):e==="right"?o(N):e==="bottom"?d(n??"primary",N):we(e)},[e,n,N,s,o,d]),N};function ge({isCollapsed:e,setCollapsed:t,closeSidebarOnClick:n=!0,transitionMs:i,overlayBackgroundColor:s,overlayZIndex:o}){return E.jsx("div",{style:{transitionDuration:`${i}ms`,...Ct,...e?{}:It,...s?{backgroundColor:s}:{},zIndex:o},onMouseDown:d=>{n&&(d.stopPropagation(),t())}})}function Te({size:e,color:t}){const n=l.useRef(null);return l.useEffect(()=>{const i=()=>{n.current&&(n.current.style.opacity="1")},s=()=>{n.current&&(n.current.style.opacity=`${Me}`)};n.current&&(n.current.addEventListener("mouseenter",i),n.current.addEventListener("mouseleave",s))},[]),E.jsx("div",{style:{..._t},children:E.jsxs("svg",{style:{transition:`opacity ${bt}ms ease`,opacity:`${Me}`},ref:n,"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,children:[E.jsx("g",{strokeWidth:"0"}),E.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round",children:E.jsx("g",{children:E.jsx("path",{clipRule:"evenodd",d:"m9.46967 5.46967c.29289-.29289.76773-.29289 1.06063 0l2.6286 2.62858c.5748.57477 1.0384 1.03835 1.3831 1.44443.355.41812.6278.82432.7818 1.29852.2447.7531.2447 1.5645 0 2.3176-.154.4742-.4268.8804-.7818 1.2985-.3447.4061-.8083.8697-1.3831 1.4444l-2.6286 2.6286c-.2929.2929-.76774.2929-1.06063 0s-.29289-.7677 0-1.0606l2.60593-2.6059c.6027-.6028 1.0225-1.0234 1.3229-1.3773.2947-.3471.4302-.5804.4987-.7912.1469-.4519.1469-.9387 0-1.3906-.0685-.2108-.204-.4441-.4987-.7912-.3004-.3539-.7202-.77451-1.3229-1.37728l-2.60593-2.60589c-.29289-.29289-.29289-.76777 0-1.06066z",fill:t,fillRule:"evenodd"})})})]})})}function je({id:e,toggleRef:t,options:n,showToggle:i=!0,ToggleComponent:s}){var c;const{openSidebar:o,closeSidebar:d,bottomSidebars:a}=z(),u=((c=a[e])==null?void 0:c.isOpen)??!1;return i?E.jsx("div",{ref:t,style:{...Mt,transition:`transform ${n.transitionMs}ms ease, opacity ${n.transitionMs}ms ease`,zIndex:n.toggleZIndex},children:(!u||u&&!n.showOverlay)&&E.jsx("button",{type:"button",onClick:()=>{n.disabled||(u?d("bottom",{id:e}):o("bottom",{id:e}))},disabled:n.disabled,style:{marginBottom:`${n.toggleIconEdgeDistancePx}px`,transform:u?"rotate(90deg)":"rotate(-90deg)"},children:s??E.jsx(Te,{size:n.toggleIconSizePx,color:n.toggleIconColor})})}):null}function ie(e=pe){const t=`(max-width: ${Math.min(e,pe)}px)`,n=()=>typeof window>"u"||typeof window.matchMedia>"u"?!1:window.matchMedia(t).matches,[i,s]=l.useState(n);return l.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia>"u")return;const o=window.matchMedia(t),d=()=>s(o.matches);return d(),o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[t]),i}const Ne=({refs:e,callbacks:t,currentY:n,preventDefault:i,lockPane:s,options:o,scrollableAncestor:d,initialScrollTop:a})=>{if(!e.draggingRef.current)return;const u=n-e.draggingRef.current.startY;if(!e.draggingRef.current.isActivated&&Math.abs(u)>=o.dragActivationDeltaPx){if(d&&t.getIsOpen()){if(d.scrollTop!==a){e.draggingRef.current=null,t.dragSidebar(null);return}const{scrollTop:R,scrollHeight:P,clientHeight:L}=d,_=R>1,W=R+L<P-1;if(u>0&&_||u<0&&W){e.draggingRef.current=null,t.dragSidebar(null);return}}e.draggingRef.current.isActivated=!0,s()}if(!e.draggingRef.current.isActivated)return;e.prevYRef.current=e.currentYRef.current,e.currentYRef.current=n;const c=t.getIsOpen(),T=window.innerHeight;let p=!1;if((c||e.draggingRef.current.startY>=T-o.edgeActivationWidthPx)&&(p=!0),!p){e.draggingRef.current=null,t.dragSidebar(null);return}i();const v=o.sidebarHeightPx,S=o.midAnchorPointPx,I=o.midAnchorPoint&&!o.swipeToOpen&&S<v;if(c)if(I){const R=t.getBottomAnchorState();if(R==="open"){const P=Math.max(0,Math.min(v,u-o.dragActivationDeltaPx));t.dragSidebar(P)}else if(R==="midAnchor"){const P=v-S,L=Math.max(0,Math.min(v,P+u-o.dragActivationDeltaPx));t.dragSidebar(L)}}else{const R=Math.max(0,Math.min(v,u-o.dragActivationDeltaPx));t.dragSidebar(R)}else if(e.draggingRef.current.startY>=T-o.edgeActivationWidthPx)if(I){const R=v-S,P=Math.max(R,Math.min(v,v+u+o.dragActivationDeltaPx));t.dragSidebar(P)}else{const R=Math.max(0,Math.min(v,v+u+o.dragActivationDeltaPx));t.dragSidebar(R)}},Fe=({refs:e,callbacks:t,options:n,onDragEnd:i})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null;return}const s=e.currentYRef.current??e.draggingRef.current.startY,o=e.prevYRef.current??e.draggingRef.current.startY,d=e.draggingRef.current.startY,a=t.getIsOpen(),u=window.innerHeight;e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,i();const c=s<o,T=s>=o,p=d>=u-n.edgeActivationWidthPx,v=n.midAnchorPointPx,S=n.sidebarHeightPx,I=n.midAnchorPoint&&!n.swipeToOpen&&v<S;if(a)if(I){const R=t.getBottomAnchorState(),P=S-v;if(R==="open"){const L=Math.max(0,s-d);T?L>P?t.closeSidebar():t.openToMidAnchor():L<P?t.openSidebarFully():t.closeSidebar(),t.dragSidebar(null)}else if(R==="midAnchor"){const L=S-v,_=Math.max(0,Math.min(S,L+(s-d)));c?_<P?t.openSidebarFully():t.openToMidAnchor():t.closeSidebar(),t.dragSidebar(null)}}else T?t.closeSidebar():t.openSidebar(),t.dragSidebar(null);else p&&c?(I?t.openToMidAnchor():t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Xt(e,t){var H,g;const n=ie(e.mediaQueryWidth),{lockedSidebar:i,setLockedSidebar:s,bottomSidebars:o,openSidebar:d,openSidebarFully:a,closeSidebar:u,dragSidebar:c,openSidebarToMidAnchor:T,activeBottomDragIdRef:p,bottomFocusStackRef:v}=z(),S=((H=o[t])==null?void 0:H.isOpen)??!1,I=((g=o[t])==null?void 0:g.anchorState)??"closed",R=l.useRef(null),P=l.useRef(null),L=l.useRef(null),_=l.useRef(null),W=l.useRef(0),D=l.useRef(null),j=l.useRef(I);l.useEffect(()=>{j.current=I},[I]),l.useEffect(()=>{if(!n||i&&i!=="bottom"||e.disabled)return;const x={getIsOpen:()=>S,openSidebar:()=>d("bottom",{id:t}),openSidebarFully:()=>a("bottom",{id:t}),closeSidebar:()=>u("bottom",{id:t}),dragSidebar:r=>c("bottom",r,{id:t}),getBottomAnchorState:()=>j.current,openToMidAnchor:()=>T("bottom",{id:t})},w={draggingRef:R,currentYRef:P,prevYRef:L},Y=()=>p.current!==null&&p.current!==t,X=()=>{const r=v.current;return r.length===0?!0:r[r.length-1]===t},V=()=>{if(Y()){R.current=null;return}p.current=t,s("bottom");const r=_.current;r&&(D.current=r.style.overflowY,r.style.overflowY="hidden")},G=()=>{p.current===t&&(p.current=null);const r=_.current;r&&D.current!==null&&(r.style.overflowY=D.current,D.current=null)};function U(r){var $;if(i&&i!=="bottom"||Y()||!X()||ae(r.target)||r.changedTouches.length===0)return;const h=r.changedTouches[0],O=window.innerHeight,C=x.getIsOpen(),K=h.clientY>=O-e.edgeActivationWidthPx;C&&!e.swipeToClose||!C&&!e.swipeToOpen||(C||K)&&(_.current=ke(r.target),W.current=(($=_.current)==null?void 0:$.scrollTop)??0,Be({refs:w,clientX:h.clientX,clientY:h.clientY,touchId:h.identifier,isMouse:!1}))}function N(r){if(i&&i!=="bottom")return;if(Y()){R.current=null;return}if(!R.current||R.current.isMouse)return;const h=R.current.activeTouchId,O=ye(r.changedTouches,h);O&&Ne({refs:w,callbacks:x,currentY:O.clientY,preventDefault:()=>r.preventDefault(),lockPane:V,options:e,scrollableAncestor:_.current,initialScrollTop:W.current})}function Z(r){if(i&&i!=="bottom"||!R.current||R.current.isMouse)return;const h=R.current.activeTouchId;Re(r.changedTouches,h)&&Fe({refs:w,callbacks:x,options:e,onDragEnd:G})}function Q(){i&&i!=="bottom"||!R.current||R.current.isMouse||(G(),Dt({refs:w,dragSidebar:x.dragSidebar,onDeactivate:()=>{}}))}function J(r){var K;if(i&&i!=="bottom"||Y()||!X()||ae(r.target)||r.button!==0)return;const h=window.innerHeight,O=x.getIsOpen(),C=r.clientY>=h-e.edgeActivationWidthPx;O&&!e.swipeToClose||!O&&!e.swipeToOpen||(O||C)&&(_.current=ke(r.target),W.current=((K=_.current)==null?void 0:K.scrollTop)??0,Be({refs:w,clientX:r.clientX,clientY:r.clientY,touchId:null,isMouse:!0}))}function B(r){if(!(i&&i!=="bottom")){if(Y()){R.current=null;return}!R.current||!R.current.isMouse||Ne({refs:w,callbacks:x,currentY:r.clientY,preventDefault:()=>r.preventDefault(),lockPane:V,options:e,scrollableAncestor:_.current,initialScrollTop:W.current})}}function te(){i&&i!=="bottom"||!R.current||!R.current.isMouse||Fe({refs:w,callbacks:x,options:e,onDragEnd:G})}return window.addEventListener("touchstart",U,{passive:!0}),window.addEventListener("touchmove",N,{passive:!1}),window.addEventListener("touchend",Z,{passive:!0}),window.addEventListener("touchcancel",Q,{passive:!0}),window.addEventListener("mousedown",J,{passive:!0}),window.addEventListener("mousemove",B,{passive:!1}),window.addEventListener("mouseup",te,{passive:!0}),()=>{window.removeEventListener("touchstart",U),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",Q),window.removeEventListener("mousedown",J),window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",te)}},[t,n,S,d,a,u,c,i,s,e,T,p,v])}function Yt({id:e="primary",className:t,children:n,ToggleComponent:i,...s}){var I;if((n==null?void 0:n.type)===E.Fragment)throw new Error("Fragments is not allowed in SwipeBarBottom");const{bottomSidebars:o,closeSidebar:d,registerBottomSidebar:a,unregisterBottomSidebar:u}=z(),c=l.useRef(null),T=l.useRef(null);l.useEffect(()=>(a(e,{sidebarRef:c,toggleRef:T}),()=>u(e)),[e,a,u]);const p=xe("bottom",s,e),v=ie(p.mediaQueryWidth);Xt(p,e);const S=((I=o[e])==null?void 0:I.isOpen)??!1;return E.jsxs(E.Fragment,{children:[p.showOverlay&&E.jsx(ge,{isCollapsed:!S,setCollapsed:()=>d("bottom",{id:e}),closeSidebarOnClick:p.closeSidebarOnOverlayClick,transitionMs:p.transitionMs,overlayBackgroundColor:p.overlayBackgroundColor,overlayZIndex:p.overlayZIndex}),E.jsx(je,{id:e,toggleRef:T,options:p,showToggle:p.showToggle,ToggleComponent:i}),E.jsx("div",{ref:c,style:{...Ot,...At,...p.isAbsolute||v?Pt:{},...t?{}:{backgroundColor:ve},zIndex:p.swipeBarZIndex},className:t,children:n})]})}function He({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:i,leftToggleRef:s,isLeftOpen:o,closeSidebar:d}=z();return t?E.jsx("div",{ref:s,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,left:0,zIndex:e.toggleZIndex},children:(!o||o&&!e.showOverlay)&&E.jsx("button",{type:"button",onClick:()=>{e.disabled||(o?d("left"):i("left"))},disabled:e.disabled,style:{marginLeft:`${e.toggleIconEdgeDistancePx}px`,...o?{transform:"rotate(180deg)"}:{}},children:n??E.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const Ge=({refs:e,callbacks:t,currentX:n,preventDefault:i,lockPane:s,options:o})=>{if(!e.draggingRef.current)return;const d=n-e.draggingRef.current.startX;if(!e.draggingRef.current.isActivated&&Math.abs(d)>=o.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,s()),!e.draggingRef.current.isActivated)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const a=t.getIsOpen();let u=!1;if((a||e.draggingRef.current.startX<=o.edgeActivationWidthPx)&&(u=!0),!u){e.draggingRef.current=null,t.dragSidebar(null);return}i();const c=o.sidebarWidthPx;if(a){const T=Math.min(0,Math.max(-c,d+o.dragActivationDeltaPx));t.dragSidebar(T)}else if(e.draggingRef.current.startX<=o.edgeActivationWidthPx){const T=Math.min(0,Math.max(-c,-c+d-o.dragActivationDeltaPx));t.dragSidebar(T)}},Ue=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const i=e.currentXRef.current??e.draggingRef.current.startX,s=e.prevXRef.current??e.draggingRef.current.startX,o=e.draggingRef.current.startX,d=t.getIsOpen();e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const a=i>=s,u=i<s,c=o<=n.edgeActivationWidthPx;d?(u?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):c&&a?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Bt(e){const t=ie(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:i,isLeftOpen:s,openSidebar:o,closeSidebar:d,dragSidebar:a,leftSidebarRef:u}=z(),c=l.useRef(null),T=l.useRef(null),p=l.useRef(null);l.useEffect(()=>{if(!t||n&&n!=="left"||e.disabled)return;const v={getIsOpen:()=>s,openSidebar:()=>o("left"),closeSidebar:()=>d("left"),dragSidebar:g=>a("left",g)},S={draggingRef:c,currentXRef:T,prevXRef:p},I=()=>i("left"),R=()=>i(null);function P(g){if(n&&n!=="left"||ae(g.target)||g.changedTouches.length===0)return;const x=g.changedTouches[0],w=v.getIsOpen(),Y=x.clientX<=e.edgeActivationWidthPx;w&&!e.swipeToClose||!w&&!e.swipeToOpen||(w||Y)&&fe({refs:S,clientX:x.clientX,clientY:x.clientY,touchId:x.identifier,isMouse:!1})}function L(g){if(n&&n!=="left"||!c.current||c.current.isMouse)return;const x=c.current.activeTouchId,w=ye(g.changedTouches,x);w&&Ge({refs:S,callbacks:v,currentX:w.clientX,preventDefault:()=>g.preventDefault(),lockPane:I,options:e})}function _(g){if(n&&n!=="left"||!c.current||c.current.isMouse)return;const x=c.current.activeTouchId;Re(g.changedTouches,x)&&Ue({refs:S,callbacks:v,options:e})}function W(){n&&n!=="left"||!c.current||c.current.isMouse||We({refs:S,dragSidebar:v.dragSidebar,onDeactivate:R})}function D(g){if(n&&n!=="left"||ae(g.target)||g.button!==0)return;const x=v.getIsOpen(),w=g.clientX<=e.edgeActivationWidthPx;x&&!e.swipeToClose||!x&&!e.swipeToOpen||(x||w)&&fe({refs:S,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function j(g){n&&n!=="left"||!c.current||!c.current.isMouse||Ge({refs:S,callbacks:v,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:I,options:e})}function H(){n&&n!=="left"||!c.current||!c.current.isMouse||Ue({refs:S,callbacks:v,options:e})}return window.addEventListener("touchstart",P,{passive:!0}),window.addEventListener("touchmove",L,{passive:!1}),window.addEventListener("touchend",_,{passive:!0}),window.addEventListener("touchcancel",W,{passive:!0}),window.addEventListener("mousedown",D,{passive:!0}),window.addEventListener("mousemove",j,{passive:!1}),window.addEventListener("mouseup",H,{passive:!0}),()=>{window.removeEventListener("touchstart",P),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",_),window.removeEventListener("touchcancel",W),window.removeEventListener("mousedown",D),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",H)}},[t,s,o,d,a,n,i,u,e])}function Wt({className:e,children:t,ToggleComponent:n,...i}){if((t==null?void 0:t.type)===E.Fragment)throw new Error("Fragments is not allowed in SwipeBarLeft");const{isLeftOpen:s,closeSidebar:o,leftSidebarRef:d}=z(),a=xe("left",i),u=ie(a.mediaQueryWidth);return Bt(a),E.jsxs(E.Fragment,{children:[a.showOverlay&&E.jsx(ge,{isCollapsed:!s,setCollapsed:()=>o("left"),closeSidebarOnClick:a.closeSidebarOnOverlayClick,transitionMs:a.transitionMs,overlayBackgroundColor:a.overlayBackgroundColor,overlayZIndex:a.overlayZIndex}),E.jsx(He,{options:a,showToggle:a.showToggle,ToggleComponent:n}),E.jsx("div",{ref:d,style:{..._e,...Rt,...a.isAbsolute||u?Tt:{},...e?{}:{backgroundColor:ve},zIndex:a.swipeBarZIndex},className:e,children:t})]})}function Ze({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:i,rightToggleRef:s,isRightOpen:o,closeSidebar:d}=z();return t?E.jsx("div",{ref:s,style:{...Le,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,right:0,zIndex:e.toggleZIndex},children:(!o||o&&!e.showOverlay)&&E.jsx("button",{type:"button",onClick:()=>{e.disabled||(o?d("right"):i("right"))},disabled:e.disabled,style:{marginRight:`${e.toggleIconEdgeDistancePx}px`,...o?{}:{transform:"rotate(180deg)"}},children:n??E.jsx(Te,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const ze=({refs:e,callbacks:t,currentX:n,preventDefault:i,lockPane:s,options:o})=>{if(!e.draggingRef.current)return;const d=window.innerWidth,a=n-e.draggingRef.current.startX,u=e.draggingRef.current.startX>=d-o.edgeActivationWidthPx,c=e.draggingRef.current.isActivated;if(!c&&Math.abs(a)>=o.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,s()),!c)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const T=t.getIsOpen();let p=!1;if((T||u)&&(p=!0),!p){e.draggingRef.current=null,t.dragSidebar(null);return}i();const v=o.sidebarWidthPx;if(T){const S=Math.max(0,Math.min(v,a-o.dragActivationDeltaPx));t.dragSidebar(S)}else{const S=Math.max(0,Math.min(v,v+a+o.dragActivationDeltaPx));t.dragSidebar(S)}},Ve=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const i=e.currentXRef.current??e.draggingRef.current.startX,s=e.prevXRef.current??e.draggingRef.current.startX,o=e.draggingRef.current.startX,d=t.getIsOpen(),a=window.innerWidth;e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const u=i>s,c=i<s,T=o>=a-n.edgeActivationWidthPx;d?(u?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):T&&c?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function kt(e){const t=ie(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:i,isRightOpen:s,openSidebar:o,closeSidebar:d,dragSidebar:a,rightSidebarRef:u}=z(),c=l.useRef(null),T=l.useRef(null),p=l.useRef(null);l.useEffect(()=>{if(!t||n&&n!=="right"||e.disabled)return;const v={getIsOpen:()=>s,openSidebar:()=>o("right"),closeSidebar:()=>d("right"),dragSidebar:g=>a("right",g)},S={draggingRef:c,currentXRef:T,prevXRef:p},I=()=>i("right"),R=()=>i(null);function P(g){if(n&&n!=="right"||ae(g.target)||g.changedTouches.length===0)return;const x=g.changedTouches[0],w=window.innerWidth,Y=v.getIsOpen(),X=x.clientX>=w-e.edgeActivationWidthPx;Y&&!e.swipeToClose||!Y&&!e.swipeToOpen||(Y||X)&&fe({refs:S,clientX:x.clientX,clientY:x.clientY,touchId:x.identifier,isMouse:!1})}function L(g){if(n&&n!=="right"||!c.current||c.current.isMouse)return;const x=c.current.activeTouchId,w=ye(g.changedTouches,x);w&&ze({refs:S,callbacks:v,currentX:w.clientX,preventDefault:()=>g.preventDefault(),lockPane:I,options:e})}function _(g){if(n&&n!=="right"||!c.current||c.current.isMouse)return;const x=c.current.activeTouchId;Re(g.changedTouches,x)&&Ve({refs:S,callbacks:v,options:e})}function W(){n&&n!=="right"||!c.current||c.current.isMouse||We({refs:S,dragSidebar:v.dragSidebar,onDeactivate:R})}function D(g){if(n&&n!=="right"||ae(g.target)||g.button!==0)return;const x=window.innerWidth,w=v.getIsOpen(),Y=g.clientX>=x-e.edgeActivationWidthPx;w&&!e.swipeToClose||!w&&!e.swipeToOpen||(w||Y)&&fe({refs:S,clientX:g.clientX,clientY:g.clientY,touchId:null,isMouse:!0})}function j(g){n&&n!=="right"||!c.current||!c.current.isMouse||ze({refs:S,callbacks:v,currentX:g.clientX,preventDefault:()=>g.preventDefault(),lockPane:I,options:e})}function H(){n&&n!=="right"||!c.current||!c.current.isMouse||Ve({refs:S,callbacks:v,options:e})}return window.addEventListener("touchstart",P,{passive:!0}),window.addEventListener("touchmove",L,{passive:!1}),window.addEventListener("touchend",_,{passive:!0}),window.addEventListener("touchcancel",W,{passive:!0}),window.addEventListener("mousedown",D,{passive:!0}),window.addEventListener("mousemove",j,{passive:!1}),window.addEventListener("mouseup",H,{passive:!0}),()=>{window.removeEventListener("touchstart",P),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",_),window.removeEventListener("touchcancel",W),window.removeEventListener("mousedown",D),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",H)}},[t,s,o,d,a,n,i,u,e])}function jt({className:e,children:t,ToggleComponent:n,...i}){if((t==null?void 0:t.type)===E.Fragment)throw new Error("Fragments is not allowed in SwipeBarRight");const{isRightOpen:s,closeSidebar:o,rightSidebarRef:d}=z(),a=xe("right",i),u=ie(a.mediaQueryWidth);return kt(a),E.jsxs(E.Fragment,{children:[a.showOverlay&&E.jsx(ge,{isCollapsed:!s,setCollapsed:()=>o("right"),closeSidebarOnClick:a.closeSidebarOnOverlayClick,transitionMs:a.transitionMs,overlayBackgroundColor:a.overlayBackgroundColor,overlayZIndex:a.overlayZIndex}),E.jsx(Ze,{options:a,showToggle:a.showToggle,ToggleComponent:n}),E.jsx("div",{ref:d,style:{..._e,...xt,...a.isAbsolute||u?Et:{},...e?{}:{backgroundColor:ve},zIndex:a.swipeBarZIndex},className:e,children:t})]})}F.Overlay=ge,F.SwipeBarBottom=Yt,F.SwipeBarLeft=Wt,F.SwipeBarProvider=tt,F.SwipeBarRight=jt,F.ToggleBottom=je,F.ToggleLeft=He,F.ToggleRight=Ze,F.useMediaQuery=ie,F.useSwipeBarContext=z,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
<%s key={someKey} {...props} />`,C,L,ee,L),q[L+C]=!0)}if(L=null,w!==void 0&&(n(w),L=""+w),g(m)&&(n(m.key),L=""+m.key),"key"in m){w={};for(var he in m)he!=="key"&&(w[he]=m[he])}else w=m;return L&&c(w,typeof r=="function"?r.displayName||r.name||"Unknown":r),d(r,L,w,a(),B,$)}function S(r){p(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===y&&(r._payload.status==="fulfilled"?p(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function p(r){return typeof r=="object"&&r!==null&&r.$$typeof===I}var R=u,I=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),D=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,U=Array.isArray,N=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(r){return r()}};var Z,ie={},K=R.react_stack_bottom_frame.bind(R,o)(),oe=N(i(o)),q={};fe.Fragment=P,fe.jsx=function(r,m,w){var C=1e4>V.recentlyCreatedOwnerStacks++;return E(r,m,w,!1,C?Error("react-stack-top-frame"):K,C?N(i(r)):oe)},fe.jsxs=function(r,m,w){var C=1e4>V.recentlyCreatedOwnerStacks++;return E(r,m,w,!0,C?Error("react-stack-top-frame"):K,C?N(i(r)):oe)}}()),fe}process.env.NODE_ENV==="production"?Se.exports=rt():Se.exports=it();var O=Se.exports;const _e=u.createContext(null),ye=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},be={isOpen:!1,anchorState:"closed",meta:null},ot=({children:e,sidebarWidthPx:t,transitionMs:n,edgeActivationWidthPx:i,dragActivationDeltaPx:a,showOverlay:o,isAbsolute:g,overlayBackgroundColor:c,toggleIconColor:f,toggleIconSizePx:d,toggleIconEdgeDistancePx:E,showToggle:S,mediaQueryWidth:p,swipeBarZIndex:R,toggleZIndex:I,overlayZIndex:x,fadeContent:P,fadeContentTransitionMs:_,closeSidebarOnOverlayClick:M})=>{var et,tt;const[W,D]=u.useState(null),[j,H]=u.useState(!1),[b,T]=u.useState(!1),[y,Y]=u.useState({}),[X,V]=u.useState({}),G=u.useRef(null),U=u.useRef(null),N=u.useRef(null),Z=u.useRef(null),[ie,K]=u.useState(null),[oe,q]=u.useState(null),[r,m]=u.useState({}),[w,C]=u.useState({}),B=u.useRef(new Map),$=u.useRef(null),L=u.useRef([]),ee=((et=r.primary)==null?void 0:et.isOpen)??!1,he=((tt=r.primary)==null?void 0:tt.anchorState)??"closed",we=u.useMemo(()=>Object.values(r).some(l=>l.isOpen),[r]),le=B.current.get("primary"),Ut=(le==null?void 0:le.sidebarRef)??{current:null},Zt=(le==null?void 0:le.toggleRef)??{current:null},zt=w.primary??{},[Vt,Qt]=u.useState({sidebarWidthPx:t??lt,sidebarHeightPx:Le,transitionMs:n??at,edgeActivationWidthPx:i??st,dragActivationDeltaPx:a??ct,showOverlay:o??ut,isAbsolute:g??ft,overlayBackgroundColor:c??De,toggleIconColor:f??gt,toggleIconSizePx:d??ht,toggleIconEdgeDistancePx:E??mt,showToggle:S??bt,mediaQueryWidth:p??xe,swipeBarZIndex:R??vt,toggleZIndex:I??pt,overlayZIndex:x??wt,fadeContent:P??Rt,fadeContentTransitionMs:_??yt,swipeToOpen:xt,swipeToClose:Tt,midAnchorPoint:Et,midAnchorPointPx:Le/3,disabled:!1,closeSidebarOnOverlayClick:M??dt}),Jt=u.useCallback((l,s)=>{B.current.set(l,s),m(h=>h[l]?h:{...h,[l]:{...be}})},[]),Kt=u.useCallback(l=>{B.current.delete(l),m(s=>{const h={...s};return delete h[l],h}),C(s=>{const h={...s};return delete h[l],h})},[]),qt=u.useCallback(l=>B.current.get(l),[]),$t=u.useCallback((l,s)=>{C(h=>h[l]===s?h:{...h,[l]:s})},[]),Q=u.useCallback((l,s)=>{m(h=>{const v=h[l]??be;return v.isOpen===s?h:{...h,[l]:{...v,isOpen:s}}})},[]),J=u.useCallback((l,s)=>{m(h=>{const v=h[l]??be;return v.anchorState===s?h:{...h,[l]:{...v,anchorState:s}}})},[]),me=u.useCallback((l,s)=>{m(h=>{const v=h[l]??be;return v.meta===s?h:{...h,[l]:{...v,meta:s}}})},[]);u.useEffect(()=>(j||b||we?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[j,b,we]),u.useEffect(()=>{var l;if(y.fadeContent===!1){const s=(l=G.current)==null?void 0:l.firstElementChild;s&&(s.style.opacity="1")}},[y.fadeContent]),u.useEffect(()=>{var l;if(X.fadeContent===!1){const s=(l=U.current)==null?void 0:l.firstElementChild;s&&(s.style.opacity="1")}},[X.fadeContent]),u.useEffect(()=>{var l;for(const[s,h]of Object.entries(w))if(h.fadeContent===!1){const v=B.current.get(s),A=(l=v==null?void 0:v.sidebarRef.current)==null?void 0:l.firstElementChild;A&&(A.style.opacity="1")}},[w]);const en=u.useCallback(l=>{Qt(s=>({...s,...l}))},[]),ue=u.useCallback((l,s)=>{const h=l==="left"?K:q;s!=null&&s.resetMeta?h(null):(s==null?void 0:s.meta)!==void 0&&h(s.meta)},[]),te=u.useCallback((l,s)=>{s!=null&&s.resetMeta?me(l,null):(s==null?void 0:s.meta)!==void 0&&me(l,s.meta)},[me]),tn=u.useCallback((l,s)=>{if(l==="left")K(s);else if(l==="right")q(s);else{const h=s;me(h.id,h.meta)}},[me]),ae=u.useCallback(l=>{const s=L.current,h=s.indexOf(l);h!==-1&&s.splice(h,1),s.push(l),D("bottom")},[]),$e=u.useCallback(l=>{const s=L.current,h=s.indexOf(l);h!==-1&&s.splice(h,1),m(v=>(Object.entries(v).some(([k,ne])=>k!==l&&ne.isOpen)||D(null),v))},[]),nn=u.useCallback((l,s)=>{const h=(v,A,k,ne)=>{Ee({side:l,ref:v,options:A,toggleRef:k,afterApply:()=>{ne(!0),D(l)}})};if(l==="left"){if(y.disabled)return;ue("left",s),h(G,y,N,H)}else if(l==="right"){if(X.disabled)return;ue("right",s),h(U,X,Z,T)}else if(l==="bottom"){const v=(s==null?void 0:s.id)??"primary",A=w[v],k=B.current.get(v);if(!A||!k||A.disabled)return;te(v,s);const ne=A.sidebarHeightPx??0,cn=A.mediaQueryWidth??640,nt=window.innerWidth<cn,ln=nt?A.midAnchorPointPx??0:ne;nt&&A.midAnchorPoint&&!A.swipeToOpen&&ln<ne?ke({ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,afterApply:()=>{Q(v,!0),J(v,"midAnchor"),ae(v)}}):Ee({side:l,ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,afterApply:()=>{Q(v,!0),J(v,"open"),ae(v)}})}else ye(l)},[y,X,w,Q,J,ae,ue,te]),rn=u.useCallback((l,s)=>{if(l!=="bottom")return;const h=(s==null?void 0:s.id)??"primary",v=w[h],A=B.current.get(h);!v||!A||v.disabled||(te(h,s),ke({ref:A.sidebarRef,options:v,toggleRef:A.toggleRef,afterApply:()=>{Q(h,!0),J(h,"midAnchor"),ae(h)}}))},[w,Q,J,ae,te]),on=u.useCallback((l,s)=>{if(l!=="bottom")return;const h=(s==null?void 0:s.id)??"primary",v=w[h],A=B.current.get(h);!v||!A||v.disabled||(te(h,s),Ee({side:l,ref:A.sidebarRef,options:v,toggleRef:A.toggleRef,afterApply:()=>{Q(h,!0),J(h,"open"),ae(h)}}))},[w,Q,J,ae,te]),an=u.useCallback((l,s)=>{const h=(v,A,k,ne)=>{We({ref:v,options:A,toggleRef:k,side:l,afterApply:()=>{ne(!1),D(null)}})};if(l==="left"){if(y.disabled)return;ue("left",s),h(G,y,N,H)}else if(l==="right"){if(X.disabled)return;ue("right",s),h(U,X,Z,T)}else if(l==="bottom"){const v=(s==null?void 0:s.id)??"primary",A=w[v],k=B.current.get(v);if(!A||!k||A.disabled)return;te(v,s),We({ref:k.sidebarRef,options:A,toggleRef:k.toggleRef,side:l,afterApply:()=>{Q(v,!1),J(v,"closed"),$e(v)}})}else ye(l)},[y,X,w,Q,J,$e,ue,te]),sn=u.useCallback((l,s,h)=>{if(l==="left")je({ref:G,toggleRef:N,options:y,translateX:s});else if(l==="right")je({ref:U,toggleRef:Z,options:X,translateX:s});else if(l==="bottom"){const v=(h==null?void 0:h.id)??"primary",A=w[v],k=B.current.get(v);if(!A||!k)return;Bt({ref:k.sidebarRef,toggleRef:k.toggleRef,options:A,translateY:s})}else ye(l)},[y,X,w]);return O.jsx(_e.Provider,{value:{lockedSidebar:W,setLockedSidebar:D,leftSidebarRef:G,rightSidebarRef:U,isLeftOpen:j,isRightOpen:b,isBottomOpen:ee,bottomAnchorState:he,bottomSidebarRef:Ut,bottomToggleRef:Zt,bottomSidebarOptions:zt,bottomSidebars:r,bottomSidebarOptionsMap:w,registerBottomSidebar:Jt,unregisterBottomSidebar:Kt,getBottomSidebarRefs:qt,activeBottomDragIdRef:$,bottomFocusStackRef:L,openSidebar:nn,openSidebarFully:on,openSidebarToMidAnchor:rn,closeSidebar:an,dragSidebar:sn,globalOptions:Vt,setGlobalOptions:en,leftSidebarOptions:y,rightSidebarOptions:X,setLeftSidebarOptions:Y,setRightSidebarOptions:V,setBottomSidebarOptionsById:$t,leftToggleRef:N,rightToggleRef:Z,leftMeta:ie,rightMeta:oe,setMeta:tn},children:e})};function z(){const e=u.useContext(_e);if(!e)throw new Error("useSwipeBarContext must be used within SwipeBarProvider");return e}const at=300,st=40,ct=20,lt=320,Le=window.innerHeight,ut=!0,dt=!0,ft=!1,De="rgba(0, 0, 0, 0.5)",Re="rgb(36,36,36)",gt="white",ht=40,mt=40,bt=!0,xe=640,vt=30,pt=15,wt=20,Xe=.6,St=200,yt=100,Rt=!1,xt=!0,Tt=!0,Et=!1,se="cubic-bezier(0.22, 1, 0.36, 1)",Ye={width:0,top:0,bottom:0,flexShrink:0,overflowX:"hidden",willChange:"transform"},Ot={transform:"translateX(-100%)"},At={transform:"translateX(100%)"},Pt={position:"fixed",left:0,top:0,bottom:0},Ct={position:"fixed",right:0,top:0,bottom:0},It={height:0,left:0,right:0,flexShrink:0,overflowY:"hidden",willChange:"transform"},Mt={transform:"translateY(100%)"},_t={position:"fixed",bottom:0,left:0,right:0},Lt={position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:De,transitionProperty:"opacity",pointerEvents:"none",opacity:0},Dt={opacity:1,pointerEvents:"auto"},Be={position:"fixed",top:"50%",transform:"translateY(-50%)",width:"1px",display:"flex",justifyContent:"center"},Xt={position:"fixed",bottom:0,left:"50%",transform:"translateX(-50%)",height:"1px",display:"flex",alignItems:"center"},Yt={position:"relative",cursor:"pointer",display:"flex",height:"72px",alignItems:"center",justifyContent:"center"},Te=e=>{throw new Error(`Unhandled sidebar side: ${e}`)},ge=e=>{var t;return(t=e.current)==null?void 0:t.firstElementChild},Ee=({ref:e,side:t,options:n,toggleRef:i,afterApply:a})=>{const o=ge(e),g=n.transitionMs?n.transitionMs/2:0;o&&n.fadeContent&&(o.style.opacity="0");let c,f;t==="left"||t==="right"?(c="width",f=n.sidebarWidthPx,o&&f&&(o.style.minWidth=`${f}px`)):t==="bottom"?(c="height",f=n.sidebarHeightPx,o&&f&&(o.style.minHeight=`${f}px`)):Te(t),requestAnimationFrame(()=>{if(!e.current)return;const d=`transform ${n.transitionMs}ms ${se}`,E=n.isAbsolute?"":`, ${c} ${n.transitionMs}ms ${se}`;e.current.style.transition=`${d}${E}`,o&&n.fadeContent&&(o.style.transition=`opacity ${n.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(e.current){if(e.current.style.transform=t==="bottom"?"translateY(0px)":"translateX(0px)",!n.isAbsolute)e.current.style[c]=`${f}px`;else if(e.current.style[c]!==`${f}px`){const S=e.current.style.transition;e.current.style.transition=d,e.current.style[c]=`${f}px`,e.current.style.transition=S}i.current&&f&&(i.current.style.opacity="1",t==="left"?i.current.style.transform=`translateY(-50%) translateX(${f}px)`:t==="right"?i.current.style.transform=`translateY(-50%) translateX(-${f}px)`:t==="bottom"&&(i.current.style.transform=`translateX(-50%) translateY(-${f}px)`)),o&&n.fadeContent&&setTimeout(()=>{o.style.opacity="1"},g),a()}})}),setTimeout(()=>{},0)},We=({ref:e,options:t,side:n,toggleRef:i,afterApply:a})=>{const o=ge(e);let g;n==="left"||n==="right"?(g="width",o&&t.sidebarWidthPx&&(o.style.minWidth=`${t.sidebarWidthPx}px`)):n==="bottom"?(g="height",o&&t.sidebarHeightPx&&(o.style.minHeight=`${t.sidebarHeightPx}px`)):Te(n),requestAnimationFrame(()=>{if(!e.current)return;const c=`transform ${t.transitionMs}ms ${se}`,f=t.isAbsolute?"":`, ${g} ${t.transitionMs}ms ${se}`;e.current.style.transition=`${c}${f}`,o&&t.fadeContent&&(o.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{e.current&&(n==="left"?(e.current.style.transform="translateX(-100%)",t.isAbsolute||(e.current.style.width="0px")):n==="right"?(e.current.style.transform="translateX(100%)",t.isAbsolute||(e.current.style.width="0px")):n==="bottom"&&(e.current.style.transform="translateY(100%)",t.isAbsolute||(e.current.style.height="0px")),i.current&&(i.current.style.opacity="1",n==="left"||n==="right"?i.current.style.transform="translateY(-50%)":n==="bottom"&&(i.current.style.transform="translateX(-50%)")),o&&t.fadeContent&&(o.style.opacity="0"),a())})})},ke=({ref:e,options:t,toggleRef:n,afterApply:i})=>{const a=ge(e),o=t.transitionMs?t.transitionMs/2:0;a&&t.fadeContent&&(a.style.opacity="0"),a&&t.midAnchorPointPx&&(a.style.minHeight=`${t.sidebarHeightPx}px`),requestAnimationFrame(()=>{if(!e.current)return;const g=`transform ${t.transitionMs}ms ${se}`,c=t.isAbsolute?"":`, height ${t.transitionMs}ms ${se}`;e.current.style.transition=`${g}${c}`,a&&t.fadeContent&&(a.style.transition=`opacity ${t.fadeContentTransitionMs}ms ease`),requestAnimationFrame(()=>{if(!e.current)return;const f=t.midAnchorPointPx??0,d=t.sidebarHeightPx??0,E=d-f;if(e.current.style.transform=`translateY(${E}px)`,!t.isAbsolute)e.current.style.height=`${d}px`;else if(e.current.style.height!==`${d}px`){const S=e.current.style.transition;e.current.style.transition=g,e.current.style.height=`${d}px`,e.current.style.transition=S}n.current&&(n.current.style.opacity="1",n.current.style.transform=`translateX(-50%) translateY(-${f}px)`),a&&t.fadeContent&&setTimeout(()=>{a.style.opacity="1"},o),i()})}),setTimeout(()=>{},0)},je=({ref:e,toggleRef:t,options:n,translateX:i})=>{!e.current||i===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=ge(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarWidthPx&&(a.style.minWidth=`${n.sidebarWidthPx}px`),!n.isAbsolute){const o=`${n.sidebarWidthPx}px`;e.current.style.width!==o&&(e.current.style.width=o)}e.current.style.transform=`translateX(${i}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateY(-50%) translateX(${i}px)`)}}))},Bt=({ref:e,toggleRef:t,options:n,translateY:i})=>{!e.current||i===null||(e.current.style.transition="none",requestAnimationFrame(()=>{const a=ge(e);if(e.current){if(a&&n.fadeContent&&(a.style.opacity="0"),a&&n.sidebarHeightPx&&(a.style.minHeight=`${n.sidebarHeightPx}px`),!n.isAbsolute){const o=`${n.sidebarHeightPx}px`;e.current.style.height!==o&&(e.current.style.height=o)}e.current.style.transform=`translateY(${i}px)`,t.current&&(t.current.style.opacity="0",t.current.style.transform=`translateX(-50%) translateY(${i}px)`)}}))},ve=({refs:e,clientX:t,clientY:n,touchId:i,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:i,isMouse:a,isActivated:!1},e.currentXRef.current=t,e.prevXRef.current=t},Ne=({refs:e,clientX:t,clientY:n,touchId:i,isMouse:a})=>{e.draggingRef.current={startX:t,startY:n,activeTouchId:i,isMouse:a,isActivated:!1},e.currentYRef.current=n,e.prevYRef.current=n},Fe=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null,t(null),n()},Wt=({refs:e,dragSidebar:t,onDeactivate:n})=>{e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,t(null)},ce=e=>e instanceof Element?!!e.closest("input, textarea, [contenteditable='true']"):!1;function He(e){let t=e instanceof HTMLElement?e:null;for(;t;){const n=getComputedStyle(t);if((n.overflowY==="auto"||n.overflowY==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}const Oe=(e,t)=>{for(let n=0;n<e.length;n++){const i=e[n];if(t==null||i.identifier===t)return i}return null},Ae=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n].identifier===t)return!0;return!1},Pe=(e,t,n)=>{const{globalOptions:i,setLeftSidebarOptions:a,setRightSidebarOptions:o,setBottomSidebarOptionsById:g}=z(),{sidebarWidthPx:c,sidebarHeightPx:f,transitionMs:d,edgeActivationWidthPx:E,dragActivationDeltaPx:S,showOverlay:p,isAbsolute:R,overlayBackgroundColor:I,toggleIconColor:x,toggleIconSizePx:P,toggleIconEdgeDistancePx:_,showToggle:M,mediaQueryWidth:W,swipeBarZIndex:D,toggleZIndex:j,overlayZIndex:H,fadeContent:b,fadeContentTransitionMs:T,swipeToOpen:y,swipeToClose:Y,midAnchorPoint:X,midAnchorPointPx:V,disabled:G,closeSidebarOnOverlayClick:U}=t,N=u.useMemo(()=>{const Z=f??i.sidebarHeightPx;return{sidebarWidthPx:c??i.sidebarWidthPx,sidebarHeightPx:Z,transitionMs:d??i.transitionMs,edgeActivationWidthPx:E??i.edgeActivationWidthPx,dragActivationDeltaPx:S??i.dragActivationDeltaPx,showOverlay:p??i.showOverlay,isAbsolute:R??i.isAbsolute,overlayBackgroundColor:I??i.overlayBackgroundColor,toggleIconColor:x??i.toggleIconColor,toggleIconSizePx:P??i.toggleIconSizePx,toggleIconEdgeDistancePx:_??i.toggleIconEdgeDistancePx,showToggle:M??i.showToggle,mediaQueryWidth:W??i.mediaQueryWidth,swipeBarZIndex:D??i.swipeBarZIndex,toggleZIndex:j??i.toggleZIndex,overlayZIndex:H??i.overlayZIndex,fadeContent:b??i.fadeContent,fadeContentTransitionMs:T??i.fadeContentTransitionMs,swipeToOpen:y??i.swipeToOpen,swipeToClose:Y??i.swipeToClose,midAnchorPoint:X??i.midAnchorPoint,midAnchorPointPx:V??i.midAnchorPointPx??Math.floor(Z/3),disabled:G??i.disabled,closeSidebarOnOverlayClick:U??i.closeSidebarOnOverlayClick}},[c,f,d,E,S,p,R,I,x,P,_,M,i,W,D,j,H,b,T,y,Y,X,V,G,U]);return u.useEffect(()=>{e==="left"?a(N):e==="right"?o(N):e==="bottom"?g(n??"primary",N):Te(e)},[e,n,N,a,o,g]),N};function pe({isCollapsed:e,setCollapsed:t,closeSidebarOnClick:n=!0,transitionMs:i,overlayBackgroundColor:a,overlayZIndex:o}){return O.jsx("div",{style:{transitionDuration:`${i}ms`,...Lt,...e?{}:Dt,...a?{backgroundColor:a}:{},zIndex:o},onMouseDown:g=>{n&&(g.stopPropagation(),t())}})}function Ce({size:e,color:t}){const n=u.useRef(null);return u.useEffect(()=>{const i=()=>{n.current&&(n.current.style.opacity="1")},a=()=>{n.current&&(n.current.style.opacity=`${Xe}`)};n.current&&(n.current.addEventListener("mouseenter",i),n.current.addEventListener("mouseleave",a))},[]),O.jsx("div",{style:{...Yt},children:O.jsxs("svg",{style:{transition:`opacity ${St}ms ease`,opacity:`${Xe}`},ref:n,"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:e,children:[O.jsx("g",{strokeWidth:"0"}),O.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round",children:O.jsx("g",{children:O.jsx("path",{clipRule:"evenodd",d:"m9.46967 5.46967c.29289-.29289.76773-.29289 1.06063 0l2.6286 2.62858c.5748.57477 1.0384 1.03835 1.3831 1.44443.355.41812.6278.82432.7818 1.29852.2447.7531.2447 1.5645 0 2.3176-.154.4742-.4268.8804-.7818 1.2985-.3447.4061-.8083.8697-1.3831 1.4444l-2.6286 2.6286c-.2929.2929-.76774.2929-1.06063 0s-.29289-.7677 0-1.0606l2.60593-2.6059c.6027-.6028 1.0225-1.0234 1.3229-1.3773.2947-.3471.4302-.5804.4987-.7912.1469-.4519.1469-.9387 0-1.3906-.0685-.2108-.204-.4441-.4987-.7912-.3004-.3539-.7202-.77451-1.3229-1.37728l-2.60593-2.60589c-.29289-.29289-.29289-.76777 0-1.06066z",fill:t,fillRule:"evenodd"})})})]})})}function Ge({id:e,toggleRef:t,options:n,showToggle:i=!0,ToggleComponent:a}){var d;const{openSidebar:o,closeSidebar:g,bottomSidebars:c}=z(),f=((d=c[e])==null?void 0:d.isOpen)??!1;return i?O.jsx("div",{ref:t,style:{...Xt,transition:`transform ${n.transitionMs}ms ease, opacity ${n.transitionMs}ms ease`,zIndex:n.toggleZIndex},children:(!f||f&&!n.showOverlay)&&O.jsx("button",{type:"button",onClick:()=>{n.disabled||(f?g("bottom",{id:e}):o("bottom",{id:e}))},disabled:n.disabled,style:{marginBottom:`${n.toggleIconEdgeDistancePx}px`,transform:f?"rotate(90deg)":"rotate(-90deg)"},children:a??O.jsx(Ce,{size:n.toggleIconSizePx,color:n.toggleIconColor})})}):null}function re(e=xe){const t=`(max-width: ${Math.min(e,xe)}px)`,n=()=>typeof window>"u"||typeof window.matchMedia>"u"?!1:window.matchMedia(t).matches,[i,a]=u.useState(n);return u.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia>"u")return;const o=window.matchMedia(t),g=()=>a(o.matches);return g(),o.addEventListener("change",g),()=>o.removeEventListener("change",g)},[t]),i}const Ue=({refs:e,callbacks:t,currentY:n,preventDefault:i,lockPane:a,options:o,scrollableAncestor:g,initialScrollTop:c})=>{if(!e.draggingRef.current)return;const f=n-e.draggingRef.current.startY;if(!e.draggingRef.current.isActivated&&Math.abs(f)>=o.dragActivationDeltaPx){if(g&&t.getIsOpen()){if(g.scrollTop!==c){e.draggingRef.current=null,t.dragSidebar(null);return}const{scrollTop:x,scrollHeight:P,clientHeight:_}=g,M=x>1,W=x+_<P-1;if(f>0&&M||f<0&&W){e.draggingRef.current=null,t.dragSidebar(null);return}}e.draggingRef.current.isActivated=!0,a()}if(!e.draggingRef.current.isActivated)return;e.prevYRef.current=e.currentYRef.current,e.currentYRef.current=n;const d=t.getIsOpen(),E=window.innerHeight;let S=!1;if((d||e.draggingRef.current.startY>=E-o.edgeActivationWidthPx)&&(S=!0),!S){e.draggingRef.current=null,t.dragSidebar(null);return}i();const p=o.sidebarHeightPx,R=o.midAnchorPointPx,I=o.midAnchorPoint&&!o.swipeToOpen&&R<p;if(d)if(I){const x=t.getBottomAnchorState();if(x==="open"){const P=Math.max(0,Math.min(p,f-o.dragActivationDeltaPx));t.dragSidebar(P)}else if(x==="midAnchor"){const P=p-R,_=Math.max(0,Math.min(p,P+f-o.dragActivationDeltaPx));t.dragSidebar(_)}}else{const x=Math.max(0,Math.min(p,f-o.dragActivationDeltaPx));t.dragSidebar(x)}else if(e.draggingRef.current.startY>=E-o.edgeActivationWidthPx)if(I){const x=p-R,P=Math.max(x,Math.min(p,p+f+o.dragActivationDeltaPx));t.dragSidebar(P)}else{const x=Math.max(0,Math.min(p,p+f+o.dragActivationDeltaPx));t.dragSidebar(x)}},Ze=({refs:e,callbacks:t,options:n,onDragEnd:i})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null;return}const a=e.currentYRef.current??e.draggingRef.current.startY,o=e.prevYRef.current??e.draggingRef.current.startY,g=e.draggingRef.current.startY,c=t.getIsOpen(),f=window.innerHeight;e.draggingRef.current=null,e.currentYRef.current=null,e.prevYRef.current=null,i();const d=a<o,E=a>=o,S=g>=f-n.edgeActivationWidthPx,p=n.midAnchorPointPx,R=n.sidebarHeightPx,I=n.midAnchorPoint&&!n.swipeToOpen&&p<R;if(c)if(I){const x=t.getBottomAnchorState(),P=R-p;if(x==="open"){const _=Math.max(0,a-g);E?_>P?t.closeSidebar():t.openToMidAnchor():_<P?t.openSidebarFully():t.closeSidebar(),t.dragSidebar(null)}else if(x==="midAnchor"){const _=R-p,M=Math.max(0,Math.min(R,_+(a-g)));d?M<P?t.openSidebarFully():t.openToMidAnchor():t.closeSidebar(),t.dragSidebar(null)}}else E?t.closeSidebar():t.openSidebar(),t.dragSidebar(null);else S&&d?(I?t.openToMidAnchor():t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function kt(e,t){var H,b;const n=re(e.mediaQueryWidth),{lockedSidebar:i,setLockedSidebar:a,bottomSidebars:o,openSidebar:g,openSidebarFully:c,closeSidebar:f,dragSidebar:d,openSidebarToMidAnchor:E,activeBottomDragIdRef:S,bottomFocusStackRef:p}=z(),R=((H=o[t])==null?void 0:H.isOpen)??!1,I=((b=o[t])==null?void 0:b.anchorState)??"closed",x=u.useRef(null),P=u.useRef(null),_=u.useRef(null),M=u.useRef(null),W=u.useRef(0),D=u.useRef(null),j=u.useRef(I);u.useEffect(()=>{j.current=I},[I]),u.useEffect(()=>{if(!n||i&&i!=="bottom"||e.disabled)return;const T={getIsOpen:()=>R,openSidebar:()=>g("bottom",{id:t}),openSidebarFully:()=>c("bottom",{id:t}),closeSidebar:()=>f("bottom",{id:t}),dragSidebar:r=>d("bottom",r,{id:t}),getBottomAnchorState:()=>j.current,openToMidAnchor:()=>E("bottom",{id:t})},y={draggingRef:x,currentYRef:P,prevYRef:_},Y=()=>S.current!==null&&S.current!==t,X=()=>{const r=p.current;return r.length===0?!0:r[r.length-1]===t},V=()=>{if(Y()){x.current=null;return}S.current=t,a("bottom");const r=M.current;r&&(D.current=r.style.overflowY,r.style.overflowY="hidden")},G=()=>{S.current===t&&(S.current=null);const r=M.current;r&&D.current!==null&&(r.style.overflowY=D.current,D.current=null)};function U(r){var $;if(i&&i!=="bottom"||Y()||!X()||ce(r.target)||r.changedTouches.length===0)return;const m=r.changedTouches[0],w=window.innerHeight,C=T.getIsOpen(),B=m.clientY>=w-e.edgeActivationWidthPx;C&&!e.swipeToClose||!C&&!e.swipeToOpen||(C||B)&&(M.current=He(r.target),W.current=(($=M.current)==null?void 0:$.scrollTop)??0,Ne({refs:y,clientX:m.clientX,clientY:m.clientY,touchId:m.identifier,isMouse:!1}))}function N(r){if(i&&i!=="bottom")return;if(Y()){x.current=null;return}if(!x.current||x.current.isMouse)return;const m=x.current.activeTouchId,w=Oe(r.changedTouches,m);w&&Ue({refs:y,callbacks:T,currentY:w.clientY,preventDefault:()=>r.preventDefault(),lockPane:V,options:e,scrollableAncestor:M.current,initialScrollTop:W.current})}function Z(r){if(i&&i!=="bottom"||!x.current||x.current.isMouse)return;const m=x.current.activeTouchId;Ae(r.changedTouches,m)&&Ze({refs:y,callbacks:T,options:e,onDragEnd:G})}function ie(){i&&i!=="bottom"||!x.current||x.current.isMouse||(G(),Wt({refs:y,dragSidebar:T.dragSidebar,onDeactivate:()=>{}}))}function K(r){var B;if(i&&i!=="bottom"||Y()||!X()||ce(r.target)||r.button!==0)return;const m=window.innerHeight,w=T.getIsOpen(),C=r.clientY>=m-e.edgeActivationWidthPx;w&&!e.swipeToClose||!w&&!e.swipeToOpen||(w||C)&&(M.current=He(r.target),W.current=((B=M.current)==null?void 0:B.scrollTop)??0,Ne({refs:y,clientX:r.clientX,clientY:r.clientY,touchId:null,isMouse:!0}))}function oe(r){if(!(i&&i!=="bottom")){if(Y()){x.current=null;return}!x.current||!x.current.isMouse||Ue({refs:y,callbacks:T,currentY:r.clientY,preventDefault:()=>r.preventDefault(),lockPane:V,options:e,scrollableAncestor:M.current,initialScrollTop:W.current})}}function q(){i&&i!=="bottom"||!x.current||!x.current.isMouse||Ze({refs:y,callbacks:T,options:e,onDragEnd:G})}return window.addEventListener("touchstart",U,{passive:!0}),window.addEventListener("touchmove",N,{passive:!1}),window.addEventListener("touchend",Z,{passive:!0}),window.addEventListener("touchcancel",ie,{passive:!0}),window.addEventListener("mousedown",K,{passive:!0}),window.addEventListener("mousemove",oe,{passive:!1}),window.addEventListener("mouseup",q,{passive:!0}),()=>{window.removeEventListener("touchstart",U),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",Z),window.removeEventListener("touchcancel",ie),window.removeEventListener("mousedown",K),window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",q)}},[t,n,R,g,c,f,d,i,a,e,E,S,p])}function jt({id:e="primary",className:t,children:n,ToggleComponent:i,...a}){var I;if((n==null?void 0:n.type)===O.Fragment)throw new Error("Fragments is not allowed in SwipeBarBottom");const{bottomSidebars:o,closeSidebar:g,registerBottomSidebar:c,unregisterBottomSidebar:f}=z(),d=u.useRef(null),E=u.useRef(null);u.useEffect(()=>(c(e,{sidebarRef:d,toggleRef:E}),()=>f(e)),[e,c,f]);const S=Pe("bottom",a,e),p=re(S.mediaQueryWidth);kt(S,e);const R=((I=o[e])==null?void 0:I.isOpen)??!1;return O.jsxs(O.Fragment,{children:[S.showOverlay&&O.jsx(pe,{isCollapsed:!R,setCollapsed:()=>g("bottom",{id:e}),closeSidebarOnClick:S.closeSidebarOnOverlayClick,transitionMs:S.transitionMs,overlayBackgroundColor:S.overlayBackgroundColor,overlayZIndex:S.overlayZIndex}),O.jsx(Ge,{id:e,toggleRef:E,options:S,showToggle:S.showToggle,ToggleComponent:i}),O.jsx("div",{ref:d,style:{...It,...Mt,...S.isAbsolute||p?_t:{},...t?{}:{backgroundColor:Re},zIndex:S.swipeBarZIndex},className:t,children:n})]})}function ze({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:i,leftToggleRef:a,isLeftOpen:o,closeSidebar:g}=z();return t?O.jsx("div",{ref:a,style:{...Be,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,left:0,zIndex:e.toggleZIndex},children:(!o||o&&!e.showOverlay)&&O.jsx("button",{type:"button",onClick:()=>{e.disabled||(o?g("left"):i("left"))},disabled:e.disabled,style:{marginLeft:`${e.toggleIconEdgeDistancePx}px`,...o?{transform:"rotate(180deg)"}:{}},children:n??O.jsx(Ce,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const Ve=({refs:e,callbacks:t,currentX:n,preventDefault:i,lockPane:a,options:o})=>{if(!e.draggingRef.current)return;const g=n-e.draggingRef.current.startX;if(!e.draggingRef.current.isActivated&&Math.abs(g)>=o.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!e.draggingRef.current.isActivated)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const c=t.getIsOpen();let f=!1;if((c||e.draggingRef.current.startX<=o.edgeActivationWidthPx)&&(f=!0),!f){e.draggingRef.current=null,t.dragSidebar(null);return}i();const d=o.sidebarWidthPx;if(c){const E=Math.min(0,Math.max(-d,g+o.dragActivationDeltaPx));t.dragSidebar(E)}else if(e.draggingRef.current.startX<=o.edgeActivationWidthPx){const E=Math.min(0,Math.max(-d,-d+g-o.dragActivationDeltaPx));t.dragSidebar(E)}},Qe=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const i=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,o=e.draggingRef.current.startX,g=t.getIsOpen();e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const c=i>=a,f=i<a,d=o<=n.edgeActivationWidthPx;g?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):d&&c?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Nt(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:i,isLeftOpen:a,openSidebar:o,closeSidebar:g,dragSidebar:c,leftSidebarRef:f}=z(),d=u.useRef(null),E=u.useRef(null),S=u.useRef(null);u.useEffect(()=>{if(!t||n&&n!=="left"||e.disabled)return;const p={getIsOpen:()=>a,openSidebar:()=>o("left"),closeSidebar:()=>g("left"),dragSidebar:b=>c("left",b)},R={draggingRef:d,currentXRef:E,prevXRef:S},I=()=>i("left"),x=()=>i(null);function P(b){if(n&&n!=="left"||ce(b.target)||b.changedTouches.length===0)return;const T=b.changedTouches[0],y=p.getIsOpen(),Y=T.clientX<=e.edgeActivationWidthPx;y&&!e.swipeToClose||!y&&!e.swipeToOpen||(y||Y)&&ve({refs:R,clientX:T.clientX,clientY:T.clientY,touchId:T.identifier,isMouse:!1})}function _(b){if(n&&n!=="left"||!d.current||d.current.isMouse)return;const T=d.current.activeTouchId,y=Oe(b.changedTouches,T);y&&Ve({refs:R,callbacks:p,currentX:y.clientX,preventDefault:()=>b.preventDefault(),lockPane:I,options:e})}function M(b){if(n&&n!=="left"||!d.current||d.current.isMouse)return;const T=d.current.activeTouchId;Ae(b.changedTouches,T)&&Qe({refs:R,callbacks:p,options:e})}function W(){n&&n!=="left"||!d.current||d.current.isMouse||Fe({refs:R,dragSidebar:p.dragSidebar,onDeactivate:x})}function D(b){if(n&&n!=="left"||ce(b.target)||b.button!==0)return;const T=p.getIsOpen(),y=b.clientX<=e.edgeActivationWidthPx;T&&!e.swipeToClose||!T&&!e.swipeToOpen||(T||y)&&ve({refs:R,clientX:b.clientX,clientY:b.clientY,touchId:null,isMouse:!0})}function j(b){n&&n!=="left"||!d.current||!d.current.isMouse||Ve({refs:R,callbacks:p,currentX:b.clientX,preventDefault:()=>b.preventDefault(),lockPane:I,options:e})}function H(){n&&n!=="left"||!d.current||!d.current.isMouse||Qe({refs:R,callbacks:p,options:e})}return window.addEventListener("touchstart",P,{passive:!0}),window.addEventListener("touchmove",_,{passive:!1}),window.addEventListener("touchend",M,{passive:!0}),window.addEventListener("touchcancel",W,{passive:!0}),window.addEventListener("mousedown",D,{passive:!0}),window.addEventListener("mousemove",j,{passive:!1}),window.addEventListener("mouseup",H,{passive:!0}),()=>{window.removeEventListener("touchstart",P),window.removeEventListener("touchmove",_),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",W),window.removeEventListener("mousedown",D),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",H)}},[t,a,o,g,c,n,i,f,e])}function Ft({className:e,children:t,ToggleComponent:n,...i}){if((t==null?void 0:t.type)===O.Fragment)throw new Error("Fragments is not allowed in SwipeBarLeft");const{isLeftOpen:a,closeSidebar:o,leftSidebarRef:g}=z(),c=Pe("left",i),f=re(c.mediaQueryWidth);return Nt(c),O.jsxs(O.Fragment,{children:[c.showOverlay&&O.jsx(pe,{isCollapsed:!a,setCollapsed:()=>o("left"),closeSidebarOnClick:c.closeSidebarOnOverlayClick,transitionMs:c.transitionMs,overlayBackgroundColor:c.overlayBackgroundColor,overlayZIndex:c.overlayZIndex}),O.jsx(ze,{options:c,showToggle:c.showToggle,ToggleComponent:n}),O.jsx("div",{ref:g,style:{...Ye,...Ot,...c.isAbsolute||f?Pt:{},...e?{}:{backgroundColor:Re},zIndex:c.swipeBarZIndex},className:e,children:t})]})}function Je({options:e,showToggle:t=!0,ToggleComponent:n}){const{openSidebar:i,rightToggleRef:a,isRightOpen:o,closeSidebar:g}=z();return t?O.jsx("div",{ref:a,style:{...Be,transition:`transform ${e.transitionMs}ms ease, opacity ${e.transitionMs}ms ease`,right:0,zIndex:e.toggleZIndex},children:(!o||o&&!e.showOverlay)&&O.jsx("button",{type:"button",onClick:()=>{e.disabled||(o?g("right"):i("right"))},disabled:e.disabled,style:{marginRight:`${e.toggleIconEdgeDistancePx}px`,...o?{}:{transform:"rotate(180deg)"}},children:n??O.jsx(Ce,{size:e.toggleIconSizePx,color:e.toggleIconColor})})}):null}const Ke=({refs:e,callbacks:t,currentX:n,preventDefault:i,lockPane:a,options:o})=>{if(!e.draggingRef.current)return;const g=window.innerWidth,c=n-e.draggingRef.current.startX,f=e.draggingRef.current.startX>=g-o.edgeActivationWidthPx,d=e.draggingRef.current.isActivated;if(!d&&Math.abs(c)>=o.dragActivationDeltaPx&&(e.draggingRef.current.isActivated=!0,a()),!d)return;e.prevXRef.current=e.currentXRef.current,e.currentXRef.current=n;const E=t.getIsOpen();let S=!1;if((E||f)&&(S=!0),!S){e.draggingRef.current=null,t.dragSidebar(null);return}i();const p=o.sidebarWidthPx;if(E){const R=Math.max(0,Math.min(p,c-o.dragActivationDeltaPx));t.dragSidebar(R)}else{const R=Math.max(0,Math.min(p,p+c+o.dragActivationDeltaPx));t.dragSidebar(R)}},qe=({refs:e,callbacks:t,options:n})=>{if(!e.draggingRef.current)return;if(!e.draggingRef.current.isActivated){e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;return}const i=e.currentXRef.current??e.draggingRef.current.startX,a=e.prevXRef.current??e.draggingRef.current.startX,o=e.draggingRef.current.startX,g=t.getIsOpen(),c=window.innerWidth;e.draggingRef.current=null,e.currentXRef.current=null,e.prevXRef.current=null;const f=i>a,d=i<a,E=o>=c-n.edgeActivationWidthPx;g?(f?t.closeSidebar():t.openSidebar(),t.dragSidebar(null)):E&&d?(t.openSidebar(),t.dragSidebar(null)):(t.closeSidebar(),t.dragSidebar(null))};function Ht(e){const t=re(e.mediaQueryWidth),{lockedSidebar:n,setLockedSidebar:i,isRightOpen:a,openSidebar:o,closeSidebar:g,dragSidebar:c,rightSidebarRef:f}=z(),d=u.useRef(null),E=u.useRef(null),S=u.useRef(null);u.useEffect(()=>{if(!t||n&&n!=="right"||e.disabled)return;const p={getIsOpen:()=>a,openSidebar:()=>o("right"),closeSidebar:()=>g("right"),dragSidebar:b=>c("right",b)},R={draggingRef:d,currentXRef:E,prevXRef:S},I=()=>i("right"),x=()=>i(null);function P(b){if(n&&n!=="right"||ce(b.target)||b.changedTouches.length===0)return;const T=b.changedTouches[0],y=window.innerWidth,Y=p.getIsOpen(),X=T.clientX>=y-e.edgeActivationWidthPx;Y&&!e.swipeToClose||!Y&&!e.swipeToOpen||(Y||X)&&ve({refs:R,clientX:T.clientX,clientY:T.clientY,touchId:T.identifier,isMouse:!1})}function _(b){if(n&&n!=="right"||!d.current||d.current.isMouse)return;const T=d.current.activeTouchId,y=Oe(b.changedTouches,T);y&&Ke({refs:R,callbacks:p,currentX:y.clientX,preventDefault:()=>b.preventDefault(),lockPane:I,options:e})}function M(b){if(n&&n!=="right"||!d.current||d.current.isMouse)return;const T=d.current.activeTouchId;Ae(b.changedTouches,T)&&qe({refs:R,callbacks:p,options:e})}function W(){n&&n!=="right"||!d.current||d.current.isMouse||Fe({refs:R,dragSidebar:p.dragSidebar,onDeactivate:x})}function D(b){if(n&&n!=="right"||ce(b.target)||b.button!==0)return;const T=window.innerWidth,y=p.getIsOpen(),Y=b.clientX>=T-e.edgeActivationWidthPx;y&&!e.swipeToClose||!y&&!e.swipeToOpen||(y||Y)&&ve({refs:R,clientX:b.clientX,clientY:b.clientY,touchId:null,isMouse:!0})}function j(b){n&&n!=="right"||!d.current||!d.current.isMouse||Ke({refs:R,callbacks:p,currentX:b.clientX,preventDefault:()=>b.preventDefault(),lockPane:I,options:e})}function H(){n&&n!=="right"||!d.current||!d.current.isMouse||qe({refs:R,callbacks:p,options:e})}return window.addEventListener("touchstart",P,{passive:!0}),window.addEventListener("touchmove",_,{passive:!1}),window.addEventListener("touchend",M,{passive:!0}),window.addEventListener("touchcancel",W,{passive:!0}),window.addEventListener("mousedown",D,{passive:!0}),window.addEventListener("mousemove",j,{passive:!1}),window.addEventListener("mouseup",H,{passive:!0}),()=>{window.removeEventListener("touchstart",P),window.removeEventListener("touchmove",_),window.removeEventListener("touchend",M),window.removeEventListener("touchcancel",W),window.removeEventListener("mousedown",D),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",H)}},[t,a,o,g,c,n,i,f,e])}function Gt({className:e,children:t,ToggleComponent:n,...i}){if((t==null?void 0:t.type)===O.Fragment)throw new Error("Fragments is not allowed in SwipeBarRight");const{isRightOpen:a,closeSidebar:o,rightSidebarRef:g}=z(),c=Pe("right",i),f=re(c.mediaQueryWidth);return Ht(c),O.jsxs(O.Fragment,{children:[c.showOverlay&&O.jsx(pe,{isCollapsed:!a,setCollapsed:()=>o("right"),closeSidebarOnClick:c.closeSidebarOnOverlayClick,transitionMs:c.transitionMs,overlayBackgroundColor:c.overlayBackgroundColor,overlayZIndex:c.overlayZIndex}),O.jsx(Je,{options:c,showToggle:c.showToggle,ToggleComponent:n}),O.jsx("div",{ref:g,style:{...Ye,...At,...c.isAbsolute||f?Ct:{},...e?{}:{backgroundColor:Re},zIndex:c.swipeBarZIndex},className:e,children:t})]})}F.Overlay=pe,F.SwipeBarBottom=jt,F.SwipeBarLeft=Ft,F.SwipeBarProvider=ot,F.SwipeBarRight=Gt,F.ToggleBottom=Ge,F.ToggleLeft=ze,F.ToggleRight=Je,F.useMediaQuery=re,F.useSwipeBarContext=z,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -55,8 +55,20 @@ export type TSwipeSidebar = TSwipeBarOptions & {
|
|
|
55
55
|
ToggleComponent?: ReactElement;
|
|
56
56
|
children?: ReactElement;
|
|
57
57
|
};
|
|
58
|
+
export type TBottomSidebarState = {
|
|
59
|
+
isOpen: boolean;
|
|
60
|
+
anchorState: "closed" | "midAnchor" | "open";
|
|
61
|
+
meta: unknown;
|
|
62
|
+
};
|
|
63
|
+
export type TSidebarMetaMap = {
|
|
64
|
+
left?: unknown;
|
|
65
|
+
right?: unknown;
|
|
66
|
+
bottom?: Record<string, unknown>;
|
|
67
|
+
};
|
|
58
68
|
export type TSidebarOpts = {
|
|
59
69
|
id?: string;
|
|
70
|
+
meta?: unknown;
|
|
71
|
+
resetMeta?: boolean;
|
|
60
72
|
};
|
|
61
73
|
export type TToggle = {
|
|
62
74
|
side: TSidebarSide;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swipeSidebarShared.d.ts","sourceRoot":"","sources":["../src/swipeSidebarShared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,C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>;
|
|
12
|
-
bottomSidebarOptions: import('./swipeSidebarShared').TSwipeBarOptions;
|
|
13
|
-
bottomSidebars: Record<string, {
|
|
14
|
-
isOpen: boolean;
|
|
15
|
-
anchorState: "closed" | "midAnchor" | "open";
|
|
16
|
-
}>;
|
|
17
|
-
bottomSidebarOptionsMap: Record<string, Required<import('./swipeSidebarShared').TSwipeBarOptions>>;
|
|
18
|
-
registerBottomSidebar: (id: string, refs: {
|
|
19
|
-
sidebarRef: import('react').RefObject<HTMLDivElement | null>;
|
|
20
|
-
toggleRef: import('react').RefObject<HTMLDivElement | null>;
|
|
21
|
-
}) => void;
|
|
22
|
-
unregisterBottomSidebar: (id: string) => void;
|
|
23
|
-
getBottomSidebarRefs: (id: string) => {
|
|
24
|
-
sidebarRef: import('react').RefObject<HTMLDivElement | null>;
|
|
25
|
-
toggleRef: import('react').RefObject<HTMLDivElement | null>;
|
|
26
|
-
} | undefined;
|
|
27
|
-
activeBottomDragIdRef: React.RefObject<string | null>;
|
|
28
|
-
bottomFocusStackRef: React.RefObject<string[]>;
|
|
29
|
-
openSidebar: (side: import('./swipeSidebarShared').TSidebarSide, opts?: import('./swipeSidebarShared').TSidebarOpts) => void;
|
|
30
|
-
openSidebarFully: (side: import('./swipeSidebarShared').TSidebarSide, opts?: import('./swipeSidebarShared').TSidebarOpts) => void;
|
|
31
|
-
openSidebarToMidAnchor: (side: import('./swipeSidebarShared').TSidebarSide, opts?: import('./swipeSidebarShared').TSidebarOpts) => void;
|
|
32
|
-
closeSidebar: (side: import('./swipeSidebarShared').TSidebarSide, opts?: import('./swipeSidebarShared').TSidebarOpts) => void;
|
|
33
|
-
dragSidebar: (side: import('./swipeSidebarShared').TSidebarSide, translate: number | null, opts?: import('./swipeSidebarShared').TSidebarOpts) => void;
|
|
34
|
-
globalOptions: Required<import('./swipeSidebarShared').TSwipeBarOptions>;
|
|
35
|
-
setGlobalOptions: (options: Partial<Required<import('./swipeSidebarShared').TSwipeBarOptions>>) => void;
|
|
36
|
-
leftSidebarOptions: import('./swipeSidebarShared').TSwipeBarOptions;
|
|
37
|
-
rightSidebarOptions: import('./swipeSidebarShared').TSwipeBarOptions;
|
|
38
|
-
setLeftSidebarOptions: (options: import('./swipeSidebarShared').TSwipeBarOptions) => void;
|
|
39
|
-
setRightSidebarOptions: (options: import('./swipeSidebarShared').TSwipeBarOptions) => void;
|
|
40
|
-
setBottomSidebarOptionsById: (id: string, options: Required<import('./swipeSidebarShared').TSwipeBarOptions>) => void;
|
|
41
|
-
leftToggleRef: React.RefObject<HTMLDivElement | null>;
|
|
42
|
-
rightToggleRef: React.RefObject<HTMLDivElement | null>;
|
|
1
|
+
import { TSwipeSidebarContextInternal } from './SwipeBarProvider';
|
|
2
|
+
import { TBottomSidebarState, TSidebarMetaMap, TSidebarSide } from './swipeSidebarShared';
|
|
3
|
+
|
|
4
|
+
type TLeftRightOpts<TMap extends TSidebarMetaMap, S extends "left" | "right"> = S extends keyof TMap ? {
|
|
5
|
+
meta?: TMap[S];
|
|
6
|
+
resetMeta?: boolean;
|
|
7
|
+
} : {
|
|
8
|
+
meta?: any;
|
|
9
|
+
resetMeta?: boolean;
|
|
43
10
|
};
|
|
11
|
+
type TBottomSidebarOpts<TMap extends TSidebarMetaMap> = TMap["bottom"] extends Record<string, unknown> ? {
|
|
12
|
+
[K in string & keyof TMap["bottom"]]: {
|
|
13
|
+
id: K;
|
|
14
|
+
meta?: TMap["bottom"][K];
|
|
15
|
+
resetMeta?: boolean;
|
|
16
|
+
};
|
|
17
|
+
}[string & keyof TMap["bottom"]] | {
|
|
18
|
+
id?: string;
|
|
19
|
+
meta?: never;
|
|
20
|
+
resetMeta?: boolean;
|
|
21
|
+
} : {
|
|
22
|
+
id?: string;
|
|
23
|
+
meta?: any;
|
|
24
|
+
resetMeta?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type TSidebarCallOpts<TMap extends TSidebarMetaMap, S extends TSidebarSide> = S extends "left" ? TLeftRightOpts<TMap, "left"> : S extends "right" ? TLeftRightOpts<TMap, "right"> : TBottomSidebarOpts<TMap>;
|
|
27
|
+
type TSidebarFn<TMap extends TSidebarMetaMap> = <S extends TSidebarSide>(side: S, opts?: TSidebarCallOpts<TMap, S>) => void;
|
|
28
|
+
type TLeftRightSetMeta<TMap extends TSidebarMetaMap, S extends "left" | "right"> = S extends keyof TMap ? TMap[S] | null : any;
|
|
29
|
+
type TBottomSetMetaOpts<TMap extends TSidebarMetaMap> = TMap["bottom"] extends Record<string, unknown> ? {
|
|
30
|
+
[K in string & keyof TMap["bottom"]]: {
|
|
31
|
+
id: K;
|
|
32
|
+
meta: TMap["bottom"][K] | null;
|
|
33
|
+
};
|
|
34
|
+
}[string & keyof TMap["bottom"]] | {
|
|
35
|
+
id: string;
|
|
36
|
+
meta: never;
|
|
37
|
+
} : {
|
|
38
|
+
id: string;
|
|
39
|
+
meta: any;
|
|
40
|
+
};
|
|
41
|
+
type TSetMetaCallArg<TMap extends TSidebarMetaMap, S extends TSidebarSide> = S extends "left" ? TLeftRightSetMeta<TMap, "left"> : S extends "right" ? TLeftRightSetMeta<TMap, "right"> : TBottomSetMetaOpts<TMap>;
|
|
42
|
+
type TSetMetaFn<TMap extends TSidebarMetaMap> = <S extends TSidebarSide>(side: S, metaOrOpts: TSetMetaCallArg<TMap, S>) => void;
|
|
43
|
+
type TTypedBottomSidebars<TMap extends TSidebarMetaMap> = TMap["bottom"] extends Record<string, unknown> ? {
|
|
44
|
+
[K in keyof TMap["bottom"]]: TBottomSidebarState & {
|
|
45
|
+
meta: TMap["bottom"][K] | null;
|
|
46
|
+
};
|
|
47
|
+
} & Record<string, TBottomSidebarState> : Record<string, TBottomSidebarState>;
|
|
48
|
+
type TSwipeSidebarContext<TMap extends TSidebarMetaMap = object> = Omit<TSwipeSidebarContextInternal, "openSidebar" | "closeSidebar" | "openSidebarFully" | "openSidebarToMidAnchor" | "setMeta" | "bottomSidebars" | "leftMeta" | "rightMeta"> & {
|
|
49
|
+
openSidebar: TSidebarFn<TMap>;
|
|
50
|
+
closeSidebar: TSidebarFn<TMap>;
|
|
51
|
+
openSidebarFully: TSidebarFn<TMap>;
|
|
52
|
+
openSidebarToMidAnchor: TSidebarFn<TMap>;
|
|
53
|
+
setMeta: TSetMetaFn<TMap>;
|
|
54
|
+
bottomSidebars: TTypedBottomSidebars<TMap>;
|
|
55
|
+
leftMeta: "left" extends keyof TMap ? TMap["left"] | null : any;
|
|
56
|
+
rightMeta: "right" extends keyof TMap ? TMap["right"] | null : any;
|
|
57
|
+
};
|
|
58
|
+
export declare function useSwipeBarContext<TMap extends TSidebarMetaMap = object>(): TSwipeSidebarContext<TMap>;
|
|
59
|
+
export {};
|
|
44
60
|
//# sourceMappingURL=useSwipeBarContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSwipeBarContext.d.ts","sourceRoot":"","sources":["../src/useSwipeBarContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSwipeBarContext.d.ts","sourceRoot":"","sources":["../src/useSwipeBarContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE/F,KAAK,cAAc,CAAC,IAAI,SAAS,eAAe,EAAE,CAAC,SAAS,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,IAAI,GACjG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAExC;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,KAAK,kBAAkB,CAAC,IAAI,SAAS,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,MAAM,CACpF,MAAM,EACN,OAAO,CACP,GAEI;KACC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MAAM,IAAI,IAAI,CACtE,4BAA4B,EAC1B,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,wBAAwB,GACxB,SAAS,GACT,gBAAgB,GAChB,UAAU,GACV,WAAW,CACb,GAAG;IACH,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,gBAAgB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,sBAAsB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1B,cAAc,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE3C,QAAQ,EAAE,MAAM,SAAS,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;IAEhE,SAAS,EAAE,OAAO,SAAS,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;CACnE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,eAAe,GAAG,MAAM,KAK1C,oBAAoB,CAAC,IAAI,CAAC,CACvD"}
|
|
@@ -15,6 +15,6 @@ export type HandleLeftDragEndProps = {
|
|
|
15
15
|
callbacks: TSidebarCallbacks;
|
|
16
16
|
options: Required<TSwipeBarOptions>;
|
|
17
17
|
};
|
|
18
|
-
export declare const handleLeftDragEnd: ({ refs, callbacks, options
|
|
18
|
+
export declare const handleLeftDragEnd: ({ refs, callbacks, options }: HandleLeftDragEndProps) => void;
|
|
19
19
|
export declare function useSwipeLeftSidebar(options: Required<TSwipeBarOptions>): void;
|
|
20
20
|
//# sourceMappingURL=useSwipeLeftSidebar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSwipeLeftSidebar.d.ts","sourceRoot":"","sources":["../src/useSwipeLeftSidebar.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useSwipeLeftSidebar.d.ts","sourceRoot":"","sources":["../src/useSwipeLeftSidebar.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EAEd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAMrB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,mEAOhC,uBAAuB,SAsDzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,SAAS,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACvD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,8BAA8B,sBAAsB,SAwCrF,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,QAsLtE"}
|