UNPKG

react-ios-scroll-lock

Version:

A lightweight CSS-only scroll lock solution for iOS Safari and Android

27 lines (26 loc) 7.95 kB
(function(E,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(E=typeof globalThis<"u"?globalThis:E||self,v(E.IosScrollLock={},E.React))})(this,function(E,v){"use strict";function z(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var T={exports:{}},b={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var w;function J(){if(w)return b;w=1;var a=Symbol.for("react.transitional.element"),m=Symbol.for("react.fragment");function u(f,s,t){var o=null;if(t!==void 0&&(o=""+t),s.key!==void 0&&(o=""+s.key),"key"in s){t={};for(var i in s)i!=="key"&&(t[i]=s[i])}else t=s;return s=t.ref,{$$typeof:a,type:f,key:o,ref:s!==void 0?s:null,props:t}}return b.Fragment=m,b.jsx=u,b.jsxs=u,b}var R={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var g;function V(){return g||(g=1,process.env.NODE_ENV!=="production"&&function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case ne:return"Profiler";case te:return"StrictMode";case le:return"Suspense";case ce:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case re:return"Portal";case ae:return(e.displayName||"Context")+".Provider";case oe:return(e._context.displayName||"Context")+".Consumer";case se:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ue:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case D:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function m(e){return""+e}function u(e){try{m(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),m(e)}}function f(e){if(e===j)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===D)return"<...>";try{var r=a(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=k.A;return e===null?null:e.getOwner()}function t(){return Error("react-stack-top-frame")}function o(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function i(e,r){function n(){M||(M=!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)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function K(){var e=a(this.type);return $[e]||($[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function ee(e,r,n,l,p,d,x,P){return n=d.ref,e={$$typeof:F,type:e,key:r,props:d,_owner:p},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:K}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function Y(e,r,n,l,p,d,x,P){var c=r.children;if(c!==void 0)if(l)if(de(c)){for(l=0;l<c.length;l++)I(c[l]);Object.freeze&&Object.freeze(c)}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 I(c);if(L.call(r,"key")){c=a(e);var _=Object.keys(r).filter(function(me){return me!=="key"});l=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",U[c+l]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,l,c,_,c),U[c+l]=!0)}if(c=null,n!==void 0&&(u(n),c=""+n),o(r)&&(u(r.key),c=""+r.key),"key"in r){n={};for(var A in r)A!=="key"&&(n[A]=r[A])}else n=r;return c&&i(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),ee(e,c,d,p,s(),n,x,P)}function I(e){typeof e=="object"&&e!==null&&e.$$typeof===F&&e._store&&(e._store.validated=1)}var O=v,F=Symbol.for("react.transitional.element"),re=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),oe=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),le=Symbol.for("react.suspense"),ce=Symbol.for("react.suspense_list"),ue=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),fe=Symbol.for("react.client.reference"),k=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,de=Array.isArray,y=console.createTask?console.createTask:function(){return null};O={"react-stack-bottom-frame":function(e){return e()}};var M,$={},W=O["react-stack-bottom-frame"].bind(O,t)(),q=y(f(t)),U={};R.Fragment=j,R.jsx=function(e,r,n,l,p){var d=1e4>k.recentlyCreatedOwnerStacks++;return Y(e,r,n,!1,l,p,d?Error("react-stack-top-frame"):W,d?y(f(e)):q)},R.jsxs=function(e,r,n,l,p){var d=1e4>k.recentlyCreatedOwnerStacks++;return Y(e,r,n,!0,l,p,d?Error("react-stack-top-frame"):W,d?y(f(e)):q)}}()),R}var N;function G(){return N||(N=1,process.env.NODE_ENV==="production"?T.exports=J():T.exports=V()),T.exports}var S=G(),h={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */var C;function X(){return C||(C=1,function(a){(function(){var m={}.hasOwnProperty;function u(){for(var t="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(t=s(t,f(i)))}return t}function f(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return u.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var o="";for(var i in t)m.call(t,i)&&t[i]&&(o=s(o,i));return o}function s(t,o){return o?t?t+" "+o:t+o:t}a.exports?(u.default=u,a.exports=u):window.classNames=u})()}(h)),h.exports}var B=X();const H=z(B);function Z({children:a,isOpen:m=!1,isInline:u=!1,className:f="",bgColor:s=""}){Promise.resolve().then(()=>Q);const t=H({isl_holder:!0,"isl_holder--contents":u,"isl_holder--open":m,[f]:!!f}),o=s?{"--isl-bg":s}:void 0;return S.jsx("div",{className:t,style:o,children:S.jsx("div",{className:"isl_scroller",children:S.jsx("div",{className:"isl_scroller_inner",children:S.jsx("div",{className:"isl_scroller_content",children:a})})})})}const Q=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));E.IosScrollLock=Z,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});