react-nexalib-popup
Version:
Elevate your React applications with NexaLib – the go-to npm package for crafting dynamic and user-friendly popup modals. With NexaLib, creating customizable and responsive popups becomes a breeze. Streamline your coding and enhance user experience – Nexa
1 lines • 2.89 kB
JavaScript
!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:function(){return a}});var n=require("react"),r=e.n(n);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a=function(e){var t,a,l=e.children,i=e.targetItem,c=e.popupConfig,u=(t=(0,n.useState)(!1),a=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}(t,a)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(t,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=u[0],s=u[1],d=function(){s(!0)},m=function(){s(!1)};return(0,n.useEffect)((function(){var e=document.querySelector("[popup-btn-".concat(i,"]"));if(e)return e.addEventListener("click",d),function(){e.removeEventListener("click",d)}}),[i]),r().createElement("div",null,f&&r().createElement("div",{className:"nexalib-container fixed inset-0 flex items-center justify-center"},r().createElement("div",{className:"nexalib-modal-back absolute inset-0 opacity-60 bg-black",onClick:m}),r().createElement("div",{className:"nexalib-modal-content max-w-[90%] min-w-[50%] relative z-10 bg-white rounded p-4"},r().createElement("span",{className:"nexalib-modal-close-icon absolute right-1 top-0 cursor-pointer text-slate-500",onClick:m},"✘"),r().createElement("div",{className:"nexalib-children max-width-[100%] max-height-[75vh]"},l),c.footerbutton&&r().createElement("div",{className:"w-full border-t-[1px] nexalib-modal-footer-container my-2"},r().createElement("button",{className:"nexalib-modal-close-button button block mx-auto mt-2 cursor-pointer px-5 py-2 font-semibold text-white rounded",style:{backgroundColor:c.color},onClick:m},c.footerbuttontext?c.footerbuttontext:"Close")))))};module.exports=t}();