@elcrm/tooltip 0.0.1 → 0.0.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.
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -28,4 +28,4 @@ Check the top-level render call using <`+t+">.")}return r}}function Oe(e,r){{if(
|
|
|
28
28
|
<%s {...props} />
|
|
29
29
|
React keys must be passed directly to JSX without using spread:
|
|
30
30
|
let props = %s;
|
|
31
|
-
<%s key={someKey} {...props} />`,Q,k,hr,k),Pe[k+Q]=!0}}return e===E?cr(v):fr(v),v}}function dr(e,r,t){return Se(e,r,t,!0)}function vr(e,r,t){return Se(e,r,t,!1)}var pr=vr,yr=dr;$.Fragment=E,$.jsx=pr,$.jsxs=yr}()),$}process.env.NODE_ENV==="production"?z.exports=ke():z.exports=De();var Y=z.exports;const Fe={t:"_t_15niz_7"},ne=({content:T,position:d,orientation:P="up",update:E,textAlign:O})=>{const x=w.useRef(null);return w.useEffect(()=>{const l=x.current;l.style.opacity="0",l.style.width="auto",l.style.left="0px",l.style.top="0px";let p={x:0,y:0};const f=l.getBoundingClientRect();let _=d.width/2;l.style.width=f.width+"px";let u=0;switch(P){case"up":u=d.left+_-f.width/2-10,u=window.innerWidth<u+f.width?window.innerWidth-f.width-20:u,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.top-f.height-10+"px",p.x=d.left+_,p.y=d.top-10;break;case"down":u=d.left+_-f.width/2,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.bottom+10+"px";break;case"left":l.style.top=d.top+"px",l.style.left=d.left-f.width-d.width+"px";break;case"right":l.style.top=d.top+"px",l.style.left=d.right+"px";break}l.style.setProperty("--tooltip-arrow-x",p.x+"px"),l.style.setProperty("--tooltip-arrow-y",p.y+"px"),l.style.transition="opacity 0.3s",l.style.textAlign=O,l.style.opacity="1"},[E]),Y.jsx("div",{ref:x,className:Fe.t,children:T})},Ae=({content:T,children:d,className:P,textAlign:E="center",orientation:O="down",dev:x,...l})=>{const[p,f]=w.useState(null),_=R=>{f(
|
|
31
|
+
<%s key={someKey} {...props} />`,Q,k,hr,k),Pe[k+Q]=!0}}return e===E?cr(v):fr(v),v}}function dr(e,r,t){return Se(e,r,t,!0)}function vr(e,r,t){return Se(e,r,t,!1)}var pr=vr,yr=dr;$.Fragment=E,$.jsx=pr,$.jsxs=yr}()),$}process.env.NODE_ENV==="production"?z.exports=ke():z.exports=De();var Y=z.exports;const Fe={t:"_t_15niz_7"},ne=({content:T,position:d,orientation:P="up",update:E,textAlign:O})=>{const x=w.useRef(null);return w.useEffect(()=>{const l=x.current;l.style.opacity="0",l.style.width="auto",l.style.left="0px",l.style.top="0px";let p={x:0,y:0};const f=l.getBoundingClientRect();let _=d.width/2;l.style.width=f.width+"px";let u=0;switch(P){case"up":u=d.left+_-f.width/2-10,u=window.innerWidth<u+f.width?window.innerWidth-f.width-20:u,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.top-f.height-10+"px",p.x=d.left+_,p.y=d.top-10;break;case"down":u=d.left+_-f.width/2,u=u<0?0:u,l.style.left=u+"px",l.style.top=d.bottom+10+"px";break;case"left":l.style.top=d.top+"px",l.style.left=d.left-f.width-d.width+"px";break;case"right":l.style.top=d.top+"px",l.style.left=d.right+"px";break}l.style.setProperty("--tooltip-arrow-x",p.x+"px"),l.style.setProperty("--tooltip-arrow-y",p.y+"px"),l.style.transition="opacity 0.3s",l.style.textAlign=O,l.style.opacity="1"},[E]),Y.jsx("div",{ref:x,className:Fe.t,children:T})},Ae=({content:T,children:d,className:P,textAlign:E="center",orientation:O="down",dev:x,...l})=>{const[p,f]=w.useState(null),_=R=>{f(R.currentTarget)},u=()=>{x||f(null)};return Y.jsxs("span",{className:P,onMouseOver:_,onMouseOut:u,children:[d,p!==null&&je.createPortal(l.element?Y.jsx(l.element,{content:T,position:p.getBoundingClientRect(),textAlign:E,update:Date.now()}):Y.jsx(ne,{update:Date.now(),orientation:O,content:T,textAlign:E,position:p.getBoundingClientRect()}),document.body)]})};m.Item=ne,m.Tooltip=Ae,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|