reaxify 1.3.1 → 1.3.2
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 client";"use strict";const v=require("react/jsx-runtime"),s=require("react"),L=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),F=require("../Portal/index.cjs.js"),E=require("../../hooks/useClasses.cjs.js"),G=require("../../helpers/anchorPointer.cjs.js"),I=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),N=s.createContext({placement:"top",color:"dark",transitionState:"unmounted"});function W(){return s.useContext(N)}function H({open:l=!1,anchorEl:u=null,anchorPointer:r=!1,placement:t="top",color:g="dark",duration:w=300,onEnter:b,onEntering:n,onEntered:
|
|
1
|
+
"use client";"use strict";const v=require("react/jsx-runtime"),s=require("react"),L=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),F=require("../Portal/index.cjs.js"),E=require("../../hooks/useClasses.cjs.js"),G=require("../../helpers/anchorPointer.cjs.js"),I=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),N=s.createContext({placement:"top",color:"dark",transitionState:"unmounted"});function W(){return s.useContext(N)}function H({open:l=!1,anchorEl:u=null,anchorPointer:r=!1,placement:t="top",color:g="dark",duration:w=300,onEnter:b,onEntering:n,onEntered:d,onExit:$,onExiting:B,onExited:S,className:O,children:A}){const c=E(e=>e.tooltip),p=s.useRef(null),y=0,C=16,X={entering:"scale-100 opacity-100",entered:"scale-100 opacity-100",exiting:"scale-75 opacity-0",exited:"scale-75 opacity-0",unmounted:""},Y=s.useMemo(()=>{var f;return[t==="top"||t==="bottom"?"flex-col":"flex-row",{top:"flex-col origin-bottom",bottom:"flex-col-reverse origin-top",start:"flex-row origin-right rtl:origin-left",end:"flex-row-reverse origin-left rtl:origin-right"}[t],(f=c==null?void 0:c.placement)==null?void 0:f[t]]},[t,c==null?void 0:c.placement]),D=s.useCallback(e=>{var a,f,i;(a=p.current)==null||a.style.setProperty("--left",`${e.left}px`),(f=p.current)==null||f.style.setProperty("--right",`${e.right}px`),(i=p.current)==null||i.style.setProperty("--top",`${e.top}px`)},[]),M=s.useCallback(()=>{if(!l||!u||!p.current)return;const e=p.current,a=window.innerWidth,f=window.innerHeight,i=e.offsetWidth,j=e.offsetHeight;let P,R,z,T,k,q;if(r){const o=G.getAnchorPointer(u);if(!o)return;P=o.x,R=o.x,z=o.y,T=o.y,k=o.x,q=o.y}else{const o=u.getBoundingClientRect();P=o.left,R=o.right,z=o.top,T=o.bottom,k=o.left+o.width/2,q=o.top+o.height/2}let h,x,m;switch(t){case"top":h=k-i/2,x=a-k-i/2,m=z-j-y;break;case"bottom":h=k-i/2,x=a-k-i/2,m=T+y;break;case"start":h=P-i-y,x=a-R-y-i,m=q-j/2;break;case"end":h=R+y,x=a-P+y,m=q-j/2;break}h=Math.min(Math.max(h,C),a-i-C),x=Math.min(Math.max(x,C),a-i-C),m=Math.min(Math.max(m,C),f-j-C),D({left:h,right:x,top:m})},[l,u,r,t,D]);return s.useEffect(()=>{M()},[M,A]),s.useEffect(()=>{const e=()=>M();return window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[M]),v.jsx(F,{children:v.jsx(I.default,{nodeRef:p,in:l,timeout:w,unmountOnExit:!0,onEnter:b,onEntering:n,onEntered:d,onExit:$,onExiting:B,onExited:S,children:e=>v.jsx(N.Provider,{value:{placement:t,color:g,transitionState:e},children:v.jsx("div",{ref:p,"data-name":"tooltip","data-open":l,style:{transitionDuration:`${w}ms`},className:L.twMerge("flex items-center justify-center fixed z-1 pointer-events-none top-(--top) left-(--left) right-auto origin-top-left rtl:left-auto rtl:right-(--right) rtl:origin-top-right transition-[scale,opacity]",c==null?void 0:c.base,Y,X[e],O),children:A})})})})}function J({className:l,children:u,...r}){const t=E(b=>{var n;return(n=b.tooltip)==null?void 0:n.content}),{color:g}=W(),w=s.useMemo(()=>{var n;return[{primary:"bg-primary text-white",secondary:"bg-secondary text-white",success:"bg-success text-white",info:"bg-info text-white",warning:"bg-warning text-white",danger:"bg-danger text-white",dark:"bg-dark text-white",light:"bg-light text-dark"}[g],(n=t==null?void 0:t.color)==null?void 0:n[g]]},[g,t==null?void 0:t.color]);return v.jsx("span",{role:"tooltip","data-name":"tooltip-content",className:L.twMerge("relative block size-fit min-w-fit min-h-fit text-sm rounded px-3 py-1 whitespace-nowrap z-1",t==null?void 0:t.base,w,l),...r,children:u})}function K({className:l,...u}){const r=E(n=>{var d;return(d=n.tooltip)==null?void 0:d.arrow}),{color:t,placement:g}=W(),w=s.useMemo(()=>({top:"-translate-y-3/5",bottom:"translate-y-3/5",start:"-translate-x-3/5 rtl:translate-x-3/5",end:"translate-x-3/5 rtl:-translate-x-3/5"})[g],[g]),b=s.useMemo(()=>{var d;return[{primary:"bg-primary",secondary:"bg-secondary",success:"bg-success",info:"bg-info",warning:"bg-warning",danger:"bg-danger",dark:"bg-dark",light:"bg-light"}[t],(d=r==null?void 0:r.color)==null?void 0:d[t]]},[t,r==null?void 0:r.color]);return v.jsx("span",{"data-name":"tooltip-arrow",className:L.twMerge("block size-2.5 min-w-2.5 min-h-2.5 rotate-45 rounded-sm shrink-0",r==null?void 0:r.base,w,b,l),...u})}H.Content=J;H.Arrow=K;module.exports=H;
|
|
@@ -149,7 +149,7 @@ function Z({
|
|
|
149
149
|
role: "tooltip",
|
|
150
150
|
"data-name": "tooltip-content",
|
|
151
151
|
className: $(
|
|
152
|
-
"relative block size-fit min-w-fit min-h-fit text-sm rounded px-
|
|
152
|
+
"relative block size-fit min-w-fit min-h-fit text-sm rounded px-3 py-1 whitespace-nowrap z-1",
|
|
153
153
|
t == null ? void 0 : t.base,
|
|
154
154
|
x,
|
|
155
155
|
l
|
|
@@ -167,10 +167,10 @@ function _({
|
|
|
167
167
|
var g;
|
|
168
168
|
return (g = n.tooltip) == null ? void 0 : g.arrow;
|
|
169
169
|
}), { color: t, placement: p } = B(), x = R(() => ({
|
|
170
|
-
top: "-translate-y-
|
|
171
|
-
bottom: "translate-y-
|
|
172
|
-
start: "-translate-x-
|
|
173
|
-
end: "translate-x-
|
|
170
|
+
top: "-translate-y-3/5",
|
|
171
|
+
bottom: "translate-y-3/5",
|
|
172
|
+
start: "-translate-x-3/5 rtl:translate-x-3/5",
|
|
173
|
+
end: "translate-x-3/5 rtl:-translate-x-3/5"
|
|
174
174
|
})[p], [p]), w = R(() => {
|
|
175
175
|
var g;
|
|
176
176
|
return [{
|
|
@@ -189,7 +189,7 @@ function _({
|
|
|
189
189
|
{
|
|
190
190
|
"data-name": "tooltip-arrow",
|
|
191
191
|
className: $(
|
|
192
|
-
"block size-
|
|
192
|
+
"block size-2.5 min-w-2.5 min-h-2.5 rotate-45 rounded-sm shrink-0",
|
|
193
193
|
r == null ? void 0 : r.base,
|
|
194
194
|
x,
|
|
195
195
|
w,
|