@pickaxeproject/react 0.0.39 → 0.0.40
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("react"),s=require("react-dom"),a=require("./index.js"),i=require("../../../hooks/core/useOutsideAlerter.js"),o=require("../../../common/utils.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("react"),s=require("react-dom"),a=require("./index.js"),i=require("../../../hooks/core/useOutsideAlerter.js"),o=require("../../../common/utils.js"),l=require("framer-motion"),n=require("../../../common/cn.js");const c=t.forwardRef(((c,u)=>{var{children:d,className:m,avoidOverflow:f=!1}=c,b=e.__rest(c,["children","className","avoidOverflow"]);const p=document.createElement("div"),x=t.useRef(),v=t.useRef(p),{closeOnOutsideClick:y,setIsOpen:h}=t.useContext(a.ModalContext);return i.useOutsideAlerter({ref:x,callback:()=>{y&&h(!1)}}),t.useEffect((()=>{const e=document.querySelector("main"),r=null==e?void 0:e.getAttribute("class"),t=v.current;return t.setAttribute("id",o.randomStr(5)+"-modal"),t.setAttribute("class","fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm bg-black/20"+(r?` ${r}`:"")),document.body.appendChild(t),()=>{document.body.removeChild(t)}}),[]),v.current?s.createPortal(r.jsx(l.motion.div,Object.assign({initial:{y:300,opacity:0},animate:{y:0,opacity:1},exit:{y:300,opacity:0},transition:{type:"spring",stiffness:260,damping:20},className:n.default(f&&"max-h-[100vh] overflow-auto scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px]",m,"p-0")},{children:r.jsx("div",Object.assign({ref:e=>{e&&(x.current=e,"function"==typeof u?u(e):u&&(u.current=e))}},b,{className:n.default("animate-fade-in flex flex-col rounded border border-transparent shadow-md",m)},{children:d}))})),v.current):r.jsx(r.Fragment,{children:null})}));c.displayName="ModalBody",exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as r}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t}from"react/jsx-runtime";import{forwardRef as o,useRef as i,useContext as
|
|
1
|
+
import{__rest as r}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t}from"react/jsx-runtime";import{forwardRef as o,useRef as i,useContext as a,useEffect as l}from"react";import{createPortal as s}from"react-dom";import{ModalContext as c}from"./index.js";import{useOutsideAlerter as n}from"../../../hooks/core/useOutsideAlerter.js";import{randomStr as m}from"../../../common/utils.js";import{motion as d}from"framer-motion";import u from"../../../common/cn.js";const f=o(((o,f)=>{var{children:p,className:b,avoidOverflow:h=!1}=o,y=r(o,["children","className","avoidOverflow"]);const v=document.createElement("div"),x=i(),j=i(v),{closeOnOutsideClick:O,setIsOpen:g}=a(c);return n({ref:x,callback:()=>{O&&g(!1)}}),l((()=>{const r=document.querySelector("main"),e=null==r?void 0:r.getAttribute("class"),t=j.current;return t.setAttribute("id",m(5)+"-modal"),t.setAttribute("class","fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm bg-black/20"+(e?` ${e}`:"")),document.body.appendChild(t),()=>{document.body.removeChild(t)}}),[]),j.current?s(e(d.div,Object.assign({initial:{y:300,opacity:0},animate:{y:0,opacity:1},exit:{y:300,opacity:0},transition:{type:"spring",stiffness:260,damping:20},className:u(h&&"max-h-[100vh] overflow-auto scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px]",b,"p-0")},{children:e("div",Object.assign({ref:r=>{r&&(x.current=r,"function"==typeof f?f(r):f&&(f.current=r))}},y,{className:u("animate-fade-in flex flex-col rounded border border-transparent shadow-md",b)},{children:p}))})),j.current):e(t,{children:null})}));f.displayName="ModalBody";export{f as default};
|