zero-dependency-bottom-sheet
Version:
A zero-dependency, customizable React bottom sheet component with drag gestures, snap points, and TypeScript support
12 lines (11 loc) • 21.9 kB
JavaScript
import e,{useRef as t,useState as n,useEffect as r}from"react";var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var i={exports:{}},a={},s=e,c=Symbol.for("react.element"),l=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var r,o={},i=null,a=null;for(r in void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(a=t.ref),t)u.call(t,r)&&!p.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:c,type:e,key:i,ref:a,props:o,_owner:f.current}}a.Fragment=l,a.jsx=d,a.jsxs=d;var y={};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function h(e){var o=e.onClose,i=e.isOpen,a=e.initialHeight,s=e.snapPoints,c=function(){var e=t(null),o=n(0),i=o[0],a=o[1];return r((function(){var t=new Blob(["\n self.onmessage = function (e) {\n const { position, target } = e.data;\n const stiffness = 0.2;\n const damping = 0.05;\n let velocity = 0;\n let currentPosition = position;\n\n function animate() {\n const force = (target - currentPosition) * stiffness;\n velocity = velocity * damping + force;\n\n if (Math.abs(velocity) < 0.0001) {\n velocity = 0;\n }\n\n currentPosition += velocity;\n\n self.postMessage({ currentPosition });\n\n if (\n Math.abs(target - currentPosition) > 0.01 ||\n Math.abs(velocity) > 0.01\n ) {\n requestAnimationFrame(animate);\n } else {\n self.postMessage({ currentPosition: target });\n }\n }\n\n animate();\n };\n "],{type:"application/javascript"}),n=URL.createObjectURL(t);return e.current=new Worker(n),e.current.onmessage=function(e){var t=e.data.currentPosition;a(t)},function(){e.current&&(e.current.terminate(),URL.revokeObjectURL(n))}}),[]),{height:i,setHeight:a,startSpringAnimation:function(t){e.current&&e.current.postMessage({position:i,target:t})}}}(),l=c.height,u=c.setHeight,f=c.startSpringAnimation,p=function(e){var t=e.height,o=n(void 0),i=o[0],a=o[1],s=n(!0),c=s[0],l=s[1],u=n(void 0),f=u[0],p=u[1];return r((function(){void 0!==i&&(t-i>0?(c||p(t),l(!0)):(c&&p(t),l(!1))),a(t)}),[t]),{turningPoint:f}}({height:l}).turningPoint,d=function(e){var o=e.height,i=e.setHeight,a=e.onClose,s=e.turningPoint,c=e.startSpringAnimation,l=e.snapPoints,u=e.isOpen,f=e.initialHeight,p=n(!1),d=p[0],y=p[1],h=n(!1),g=h[0],v=h[1],m=n(0),b=m[0],w=m[1],x=n(100),k=x[0],S=x[1],_=t(null),j=t(0),R=t(0),O=t(null),E=function(e){if(d){v((function(e){return!e}));var t=("touches"in e?e.touches[0].pageY:e.pageY)-j.current,n=R.current-t/window.innerHeight*100;n>=0&&n<=k&&i(n)}},P=function(){if(d){y(!1);var e=void 0===s?R.current-o:s-o,t=0;(null==(l=null==(l=null==l?void 0:l.map((function(e){return e>k?k:e})))?void 0:l.map((function(e){return e>k?k:e})))?void 0:l.length)&&(t=l.reduce((function(e,t){return Math.abs(t-o)<Math.abs(e-o)?t:e}))),(null==l?void 0:l.length)?c(t>85?85:t):e>5?a():e<0&&o<k?c(k):o<R.current&&c(R.current)}y(!1)};return r((function(){O.current&&w(O.current.scrollHeight)}),[b]),r((function(){if(_.current){var e=(_.current.scrollHeight+b)/window.innerHeight*100,t=0;f&&(t=f/100*window.innerHeight,t=(t-=b)/window.innerHeight*100);var n=0;n=e>85?85-b/window.innerHeight*100:e-b/window.innerHeight*100,S(n);var r=f&&t<=n?t:n;i(r),_.current.style.height="".concat(r,"vh"),c(r),setTimeout((function(){var e;null===(e=_.current)||void 0===e||e.scrollTo(0,0)}),50)}u||c(0)}),[u,f,b]),r((function(){var e=function(e){return E(e)},t=function(e){return E(e)},n=function(){return P()},r=function(){return P()},o=O.current;return d&&(document.addEventListener("mousemove",e,{passive:!0}),document.addEventListener("mouseup",n),null==o||o.addEventListener("touchmove",t,{passive:!0}),null==o||o.addEventListener("touchend",r)),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n),null==o||o.removeEventListener("touchmove",t),null==o||o.removeEventListener("touchend",r)}}),[d,g]),{handleDragStart:function(e){y(!0);var t="touches"in e?e.touches[0].pageY:e.pageY;j.current=t,R.current=o},isDragging:d,dragRef:O,headerHeight:b,bottomSheetBodyRef:_}}({height:l,setHeight:u,onClose:o,turningPoint:p,startSpringAnimation:f,snapPoints:s,isOpen:i,initialHeight:a}),y=d.handleDragStart,h=d.isDragging,g=d.dragRef,v=d.headerHeight,m=d.bottomSheetBodyRef,b=function(e){var n=e.height,o=e.onClose,i=e.headerHeight,a=t(null);return r((function(){n<=0&&o(),document.body.style.overflow="hidden",a.current&&(a.current.style.height="calc(".concat(n,"vh + ").concat(i,"px)"))}),[n]),{contentRef:a}}({headerHeight:v,height:l,onClose:o}).contentRef;return{isDragging:h,height:l,contentRef:b,handleDragStart:y,dragRef:g,bottomSheetBodyRef:m,headerHeight:v}}"production"!==process.env.NODE_ENV&&function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator;var v=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=v.ReactDebugCurrentFrame,o=r.getStackAddendum();""!==o&&(t+="%s",n=n.concat([o]));var i=n.map((function(e){return String(e)}));i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i)}("error",e,n)}var b;function w(e){return e.displayName||"Context"}function x(e){if(null==e)return null;if("number"==typeof e.tag&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return w(e)+".Consumer";case s:return w(e._context)+".Provider";case l:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:x(e.type)||"Memo";case d:var n=e,y=n._payload,h=n._init;try{return x(h(y))}catch(e){return null}}return null}b=Symbol.for("react.module.reference");var k,S,_,j,R,O,E,P=Object.assign,C=0;function T(){}T.__reactDisabledLog=!0;var N,D=v.ReactCurrentDispatcher;function F(e,t,n){if(void 0===N)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);N=r&&r[1]||""}return"\n"+N+e}var $,H=!1,L="function"==typeof WeakMap?WeakMap:Map;function A(e,t){if(!e||H)return"";var n,r=$.get(e);if(void 0!==r)return r;H=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=D.current,D.current=null,function(){if(0===C){k=console.log,S=console.info,_=console.warn,j=console.error,R=console.group,O=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}C++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),c=n.stack.split("\n"),l=s.length-1,u=c.length-1;l>=1&&u>=0&&s[l]!==c[u];)u--;for(;l>=1&&u>=0;l--,u--)if(s[l]!==c[u]){if(1!==l||1!==u)do{if(l--,--u<0||s[l]!==c[u]){var f="\n"+s[l].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&$.set(e,f),f}}while(l>=1&&u>=0);break}}}finally{H=!1,D.current=o,function(){if(0==--C){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:k}),info:P({},e,{value:S}),warn:P({},e,{value:_}),error:P({},e,{value:j}),group:P({},e,{value:R}),groupCollapsed:P({},e,{value:O}),groupEnd:P({},e,{value:E})})}C<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var p=e?e.displayName||e.name:"",d=p?F(p):"";return"function"==typeof e&&$.set(e,d),d}function I(e,t,n){if(null==e)return"";if("function"==typeof e)return A(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return F(e);switch(e){case u:return F("Suspense");case f:return F("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return A(e.render,!1);case p:return I(e.type,t,n);case d:var o=e,i=o._payload,a=o._init;try{return I(a(i),t,n)}catch(e){}}return""}$=new L;var M=Object.prototype.hasOwnProperty,U={},B=v.ReactDebugCurrentFrame;function Y(e){if(e){var t=e._owner,n=I(e.type,e._source,t?t.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var W=Array.isArray;function z(e){return W(e)}function V(e){return""+e}function q(e){if(function(e){try{return V(e),!1}catch(e){return!0}}(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var J,K,X,G=v.ReactCurrentOwner,Q={key:!0,ref:!0,__self:!0,__source:!0};X={};function Z(e,t,r,o,i){var a,s={},c=null,l=null;for(a in void 0!==r&&(q(r),c=""+r),function(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(q(t.key),c=""+t.key),function(e){if(M.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(l=t.ref,function(e,t){if("string"==typeof e.ref&&G.current&&t&&G.current.stateNode!==t){var n=x(G.current.type);X[n]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(G.current.type),e.ref),X[n]=!0)}}(t,i)),t)M.call(t,a)&&!Q.hasOwnProperty(a)&&(s[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===s[a]&&(s[a]=u[a])}if(c||l){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;c&&function(e,t){var n=function(){J||(J=!0,m("%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://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(s,f),l&&function(e,t){var n=function(){K||(K=!0,m("%s: `ref` 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://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(s,f)}return function(e,t,r,o,i,a,s){var c={$$typeof:n,type:e,key:t,ref:r,props:s,_owner:a,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}(e,c,l,i,o,G.current,s)}var ee,te=v.ReactCurrentOwner,ne=v.ReactDebugCurrentFrame;function re(e){if(e){var t=e._owner,n=I(e.type,e._source,t?t.type:null);ne.setExtraStackFrame(n)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ie(){if(te.current){var e=x(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var ae={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ie();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!ae[n]){ae[n]=!0;var r="";e&&e._owner&&e._owner!==te.current&&(r=" It was passed a child from "+x(e._owner.type)+"."),re(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),re(null)}}}function ce(e,t){if("object"==typeof e)if(z(e))for(var n=0;n<e.length;n++){var r=e[n];oe(r)&&se(r,t)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=g&&e[g]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)oe(i.value)&&se(i.value,t)}}function le(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==l&&n.$$typeof!==p)return;t=n.propTypes}if(t){var r=x(n);!function(e,t,n,r,o){var i=Function.call.bind(M);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var c=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}s=e[a](t,a,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(Y(o),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,a,typeof s),Y(null)),s instanceof Error&&!(s.message in U)&&(U[s.message]=!0,Y(o),m("Failed %s type: %s",n,s.message),Y(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!ee){ee=!0,m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ue={};function fe(e,t,r,y,g,v){var w=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===a||e===i||e===u||e===f||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===s||e.$$typeof===c||e.$$typeof===l||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!w){var k="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S,_=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(g);k+=_||ie(),null===e?S="null":z(e)?S="array":void 0!==e&&e.$$typeof===n?(S="<"+(x(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,k)}var j=Z(e,t,r,g,v);if(null==j)return j;if(w){var R=t.children;if(void 0!==R)if(y)if(z(R)){for(var O=0;O<R.length;O++)ce(R[O],e);Object.freeze&&Object.freeze(R)}else m("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 ce(R,e)}if(M.call(t,"key")){var E=x(e),P=Object.keys(t).filter((function(e){return"key"!==e})),C=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!ue[E+C])m('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',C,E,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",E),ue[E+C]=!0}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){re(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),re(null);break}}null!==e.ref&&(re(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(j):le(j),j}var pe=function(e,t,n){return fe(e,t,n,!1)},de=function(e,t,n){return fe(e,t,n,!0)};y.Fragment=o,y.jsx=pe,y.jsxs=de}(),"production"===process.env.NODE_ENV?i.exports=a:i.exports=y;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".bottom-sheet {\n position: fixed;\n bottom: 0;\n left: 0;\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-direction: column;\n opacity: 0;\n pointer-events: none;\n transition: opacity 50ms linear;\n}\n\n.bottom-sheet.show {\n opacity: 1;\n pointer-events: auto;\n}\n\n.overlay {\n position: fixed;\n top: 0;\n left: 0;\n height: 100vh;\n width: 100%;\n background: #000;\n opacity: 0;\n z-index: 1500;\n transition: opacity 300ms linear;\n}\n\n.bottom-sheet .content {\n height: 0vh;\n max-height: 100vh;\n width: 100%;\n max-width: 1150px;\n background: #c5c5c5;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);\n position: relative;\n transform: translateY(100%);\n transition: transform 0.3s ease;\n z-index: 1501;\n}\n\n.bottom-sheet.show .content {\n transform: translateY(0%);\n}\n\n.bottom-sheet.dragging .content {\n transition: none;\n}\n\n.bottom-sheet.fullscreen .content {\n border-radius: 0;\n transition: border-radius 0.3s linear;\n}\n\n.bottom-sheet .content .header {\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.bottom-sheet .content .header .drag-icon-container {\n display: flex;\n justify-content: center;\n}\n\n.bottom-sheet .content .header .drag-icon {\n padding: 15px;\n cursor: grab;\n user-select: none;\n}\n\n.bottom-sheet .content .header .drag-icon span {\n height: 4px;\n width: 40px;\n display: block;\n border-radius: 50px;\n}\n\n.bottom-sheet .content .bottom-sheet-body {\n overflow-y: auto;\n}\n\n.bottom-sheet .content .bottom-sheet-body::-webkit-scrollbar {\n width: 0;\n}\n");var g=function(t){var n,r=t.onClose,a=t.isOpen,s=t.children,c=t.initialHeight,l=t.backdropColor,u=void 0===l?"black":l,f=t.backdropOpacity,p=void 0===f?.5:f,d=t.borderRadius,y=void 0===d?12:d,v=t.dragAreaColor,m=void 0===v?"#FFF":v,b=t.dragIconColor,w=void 0===b?"#000":b,x=t.closeOnOverlayClick,k=void 0===x||x,S=t.snapPoints,_=t.backgroundColor,j=void 0===_?"#FFF":_,R=h({onClose:r,isOpen:a,initialHeight:c,snapPoints:S}),O=R.isDragging,E=R.height,P=R.contentRef,C=R.handleDragStart,T=R.dragRef,N=R.bottomSheetBodyRef,D=R.headerHeight,F=e.Children.toArray(s).find((function(t){return e.isValidElement(t)&&t.type===g.Header})),$=e.Children.toArray(s).find((function(t){return e.isValidElement(t)&&t.type===g.Body}));return(null==N?void 0:N.current)&&(N.current.style.height="calc(".concat(E,"vh )")),i.exports.jsxs("div",o({"data-testid":"bottom-sheet",className:"bottom-sheet ".concat(a?"show":""," ").concat(E>=100?"fullscreen":""," ").concat(O?"dragging":"")},{children:[(n={className:"overlay",style:{backgroundColor:u,opacity:a?p:0}},k?i.exports.jsx("div",o({"data-testid":"overlay"},n,{onClick:r})):i.exports.jsx("div",o({"data-testid":"overlay"},n))),i.exports.jsxs("div",o({className:"content",ref:P,style:{borderTopLeftRadius:"".concat(y+1,"px"),borderTopRightRadius:"".concat(y+1,"px")}},{children:[i.exports.jsxs("div",o({ref:T,className:"header",onMouseDown:C,onTouchStart:C,style:{borderTopRightRadius:"".concat(E>=100?0:y,"px"),borderTopLeftRadius:"".concat(E>=100?0:y,"px"),backgroundColor:m}},{children:[i.exports.jsx("div",o({className:"drag-icon-container"},{children:i.exports.jsx("div",o({className:"drag-icon"},{children:i.exports.jsx("span",{style:{backgroundColor:w}})}))})),F]})),i.exports.jsx("div",o({style:{overflowY:"scroll",height:"calc(100vh - ".concat(D,"px)"),backgroundColor:j},ref:N},{children:$}))]}))]}))};g.Header=function(e){var t=e.children;return i.exports.jsx(i.exports.Fragment,{children:t})},g.Body=function(e){var t=e.children;return i.exports.jsx("div",o({className:"bottom-sheet-body"},{children:t}))};export{g as BottomSheet};
//# sourceMappingURL=index.esm.js.map