diff --git a/README.md b/README.md index ca287b6..88c7c4f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ 1. 基于 React hooks 2. 体积小,不依赖第三方库 -3. 支持静态调用 ## Props 定义 @@ -35,11 +34,6 @@ type Props = { maskClass?: string, /** 弹框自定义偏移 type Offset = { x?: number; y?: number }; */ offset?: Offset, - /** - * 弹框挂载节点 - * @default document.body - */ - mountContainer?: MountContainerType, /** * 点击外部区域是否关闭 * @default true @@ -51,7 +45,7 @@ type Props = { * */ closeOnMaskClick?: boolean, /** - * 入场动画是否开启 + * 入场过渡动画是否开启 * @default true * */ transition?: boolean, diff --git a/demo/App1.tsx b/demo/App1.tsx index d7a513f..9c25763 100644 --- a/demo/App1.tsx +++ b/demo/App1.tsx @@ -85,7 +85,7 @@ export default function App() { - +
{var r=n(294),o=n(935),i=n(152),c=n(168),l=n(438),a=n(394),u=n(289),s=n(519),f=n(762),p=n(462),d=n(942),m=n(925),h=n(10),v=r.createElement("svg",(0,p.Z)({viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},{width:"1em",height:"1em",fill:"currentColor"}),r.createElement("path",{d:"M240.512 180.181333l271.530667 271.488 271.530666-271.488a42.666667 42.666667 0 0 1 56.32-3.541333l4.010667 3.541333a42.666667 42.666667 0 0 1 0 60.330667l-271.530667 271.530667 271.530667 271.530666a42.666667 42.666667 0 0 1-56.32 63.872l-4.010667-3.541333-271.530666-271.530667-271.530667 271.530667-4.010667 3.541333a42.666667 42.666667 0 0 1-56.32-63.872l271.488-271.530666-271.488-271.530667a42.666667 42.666667 0 0 1 60.330667-60.330667z","p-id":"2884"})),g=function(e){return r.createElement("div",e,v)};g.displayName="Close";const b=g;function y(e){var t=(0,r.useRef)(e);return t.current=e,t}const w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=(0,r.useRef)(!1);(0,r.useEffect)((function(){if(n.current)return e();n.current=!0}),t)};var O=n(2),E=function(e){var t,n=e.current;return n instanceof HTMLElement?t=n:n.current?t=n.current:"function"==typeof n&&(t=n()),t},x=function(e,t){return e?"function"==typeof e?e():e&&"current"in e?e.current:e:t},j=function(e,t,n){if("object"===(0,O.Z)(t)&&t)for(var r=0,o=Object.keys(t);r4&&void 0!==arguments[4]?arguments[4]:220,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=(0,r.useState)(t),u=(0,i.Z)(a,2),s=u[0],f=u[1],p=y(e),d=(0,r.useRef)(0),m=y(n),h=y(o);return(0,r.useLayoutEffect)((function(){var e=E(p);t&&e instanceof Element&&(j(e,m.current,h.current),f(!0),d.current=window.setTimeout((function(){j(e,h.current,m.current)}),l))}),[t,s,m,h,p,l]),w((function(){if(!t&&s){var e=E(p);d.current=window.setTimeout((function(){j(e,m.current,h.current),d.current=window.setTimeout((function(){f(!1)}),c)}),l)}}),[t]),(0,r.useEffect)((function(){return function(){d.current&&clearTimeout(d.current)}}),[]),s||t}var k=["children","visible","style","hideOverflow"];function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:void 0,i=y(n),c=y(t),l=y(e),a=y(o);(0,r.useEffect)((function(){var e=x(l.current,window);if(null!=e&&e.addEventListener){var t=function(e){var t;return null===(t=i.current)||void 0===t?void 0:t.call(i,e)},n=c.current,r=a.current;return e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}}}),[])}var M=function(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e},z=function(e){return M(e).getComputedStyle(e)},_=function(e){return e?(e.nodeName||"").toLowerCase():""},I=function(e){return e&&"html"!==_(e)?e.assignedSlot||e.parentNode||function(e){return function(e){return(H(e)?e.ownerDocument:e.document)||window.document}(e).documentElement}(e):e},H=function(e){return e instanceof M(e).Element||e instanceof Element},B=function(e){return e instanceof M(e).HTMLElement||e instanceof HTMLElement},F=function(e){return["table","td","th"].indexOf(_(e))>=0},V=function(e){return B(e)&&"fixed"!==z(e).position?e.offsetParent:null},Y=function(e){var t=0;return function(e,t){var n=M(e);null==t||t(e);for(var r=V(e);r&&F(r)&&"static"===z(r).position;)null==t||t(r),r=V(r);r||function(e,t){null==t||t(e);for(var n=I(e);B(n)&&["html","body"].indexOf(_(n))<0;){null==t||t(n);var r=z(n);if("none"!==r.transform||"none"!==r.perspective||r.willChange&&"auto"!==r.willChange)return n;n=I(n)}}(e,t)}(e,(function(e){t+=e.offsetTop})),t},A=12;function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function q(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:window,n=e;n&&n!==t&&U(n);){var r=window.getComputedStyle(n),o=r.overflowY;if(J.test(o))return n;n=n.parentNode}return t}var K=["placement","content","arrow","visible","closable","onVisibleChange","onClose","className","style","children","mask","maskStyle","maskClass","closeOnClickOutside","closeOnMaskClick","transition","transitionDuration","offset"];function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t4&&void 0!==arguments[4]?arguments[4]:"bottom",i=arguments.length>5?arguments[5]:void 0,c=e.getBoundingClientRect(),l=t.getBoundingClientRect(),a=n.getBoundingClientRect(),u="body"===_(n),s=z(t).position,f="fixed"===s,p=r instanceof Element?r.scrollTop:r.pageYOffset,d="fixed"===s||r instanceof Element,m=d?l.top:u?l.top+p:Y(t),h=m,v=l.height+m,g=l.left-(d?0:a.left),b=l.width,y=l.height,w={top:{top:h-c.height-A,left:g+b/2-c.width/2},bottom:{top:v+A,left:g+b/2-c.width/2},left:{top:h+y/2-c.height/2,left:g-c.width-A},right:{top:h+y/2-c.height/2,left:g+b+A},"top-right":{top:h-c.height-A,left:g+b-c.width},"top-left":{top:h-c.height-A,left:g},"bottom-right":{top:v+A,left:g+b-c.width},"bottom-left":{top:v+A,left:g},"right-top":{top:h,left:g+b+A},"left-top":{top:h,left:g-c.width-A},"right-bottom":{top:v-c.height,left:g+b+A},"left-bottom":{top:v-c.height,left:g-c.width-A}},O={x:i.x||0,y:i.y||0},E=w[o];return{position:f?"fixed":"absolute",top:E.top+O.y,left:E.left+O.x}}(r,e,document.body,t,n,ne.current),c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,o=e.getBoundingClientRect(),c=t.split("-"),l=(0,i.Z)(c,2),a=l[0],u=l[1],s={top:"1px 1px 1px 0px rgba(0, 0, 0, 0.05)",right:"-1px 1px 1px 0px rgba(0, 0, 0, 0.05)",bottom:"-1px -1px 1px 0px rgba(0, 0, 0, 0.05)",left:"1px -1px 1px 0px rgba(0, 0, 0, 0.05)"},f=(0,d.Z)({boxShadow:s[a]},N(a),-r/2);if(u)return q((0,d.Z)({},u,2*n),f);var p={};return["bottom","top"].includes(a)&&(p.right=(o.width-r)/2),["left","right"].includes(a)&&(p.top=(o.height-r)/2),q(q({},p),f)}(r,n,A);j(r,{top:o.top+"px",left:o.left+"px",position:o.position}),H&&!ae.current&&(ae.current=!0,j(r,$),r.__oh__=r.offsetHeight,j(r,{transitionProperty:te})),le(c)}),[H,n,ne]),se=function(){var e=U.current,t=G(e);ue(e,t)},fe=(0,r.useCallback)((function(e){var t,n=Q.current,r=U.current;!n||n.contains(e.target)||r.contains(e.target)||null===(t=re.current)||void 0===t||t.call(re)}),[re]);L((function(){return window}),"resize",u?se:void 0),L((function(){return G(U.current)}),"scroll",u?se:void 0),L((function(){return document}),"click",S?fe:void 0),(0,r.useLayoutEffect)((function(){var e=U.current,t=G(e);u&&ue(e,t)}),[ue,u]);var pe=(0,r.useMemo)((function(){return function(e){var t=e.split("-"),n="";return t[0]&&(n+=R[t[0]]),t[1]&&(n+=" "+t[1]),n}(n)}),[n]),de=Z((function(){return H?Q.current:null}),u,$,ee,F);return w((function(){null==f||f(u),u||(ae.current=!1)}),[u]),r.createElement(r.Fragment,null,r.createElement(T,{visible:x&&u,className:P,style:k,onClick:function(){M&&(null==v||v())}}),r.cloneElement(E,{ref:U}),o.createPortal(r.createElement(r.Fragment,null,(H&&de||!H&&u)&&r.createElement("div",(0,p.Z)({},J,{ref:Q,className:(0,h.Z)(g,"w-popover"),style:X({position:"absolute",background:"#fff",zIndex:1e3,transformOrigin:pe,transitionDuration:"".concat(F,"ms"),willChange:H?te:"unset"},O)}),a&&r.createElement("div",{className:(0,h.Z)("w-popover__arrow"),style:X({position:"absolute",width:6,height:6,zIndex:-1,background:"inherit",transform:"rotate(45deg)"},ce)}),s&&r.createElement(b,{className:(0,h.Z)("w-popover__close"),onClick:v,style:{position:"absolute",zIndex:10,top:6,right:6,cursor:"pointer",color:"rgb(0,0,0)",opacity:.35,display:"flex",alignItems:"center",justifyContent:"center"}}),c)),document.body))};var re,oe=["title","padding","background","border","height","children"],ie=l.ZP.div(re||(re=(0,c.Z)(["\n font-size: 14px;\n\n .title {\n padding: 12px 8px 6px;\n color: #969696;\n font-size: 14px;\n }\n\n .main {\n border: solid 1px #eee;\n border-right: none;\n border-left: none;\n }\n\n img {\n max-width: 100%;\n }\n"])));function ce(e){var t=e.title,n=void 0===t?"":t,o=e.padding,i=void 0===o?"12px":o,c=e.background,l=void 0===c?"#fff":c,a=e.border,u=e.height,s=e.children,f=(0,m.Z)(e,oe);return r.createElement(ie,f,n&&r.createElement("div",{className:"title"},n),r.createElement("div",{className:"main",style:{padding:i,background:l,border:a,height:u}},s))}var le,ae=n(215),ue=["children"],se=(0,l.vJ)(le||(le=(0,c.Z)(["\n body {\n background-color: rgb(245, 247, 250);\n font-size: 14px;\n margin:0;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', STHeiti,\n 'Microsoft Yahei', Tahoma, Simsun, sans-serif;\n line-height: 1.5715;\n }\n *{\n box-sizing: border-box;;\n }\n"]))),fe=function(){return document.documentElement.style.getPropertyValue("--uc-color")||"#005cff"};function pe(e){var t=e.children;return(0,m.Z)(e,ue),r.createElement(r.Fragment,null,r.createElement(se,null),r.createElement(ae.Z,{color:fe()},t))}fe();var de,me=["title","hoverDelay","placement","arrow","offset","className","style","children"];function he(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t11&&(c.current=0),l()}},"Try to click me")))),r.createElement(ce,{title:"Tooltip"},r.createElement(u.Z,null,r.createElement(f.Z,null,r.createElement(ye,{title:"This's a tooltip ",placement:"top"},r.createElement(s.Z,{type:"primary"},"Tooltip at top")),r.createElement(ye,{title:"This's a tooltip ",placement:"bottom"},r.createElement(s.Z,{type:"primary"},"Tooltip at bottom")),r.createElement(ye,{title:"This's a tooltip ",placement:"right"},r.createElement(s.Z,{type:"primary"},"Tooltip at right"))))),r.createElement(ce,{title:"Scroll"},r.createElement("div",{style:{height:200,width:"100%",border:"1px solid #666",textAlign:"center",overflowY:"scroll",position:"relative"}},r.createElement("div",{style:{height:"120vh",background:"#00bc8d"}},r.createElement(ne,{placement:"bottom",visible:!0,content:"I'm here ",style:{padding:6}},r.createElement(s.Z,{outlined:!0,onClick:function(){return o(!0)}},"hi, there~")),r.createElement(ne,{placement:"bottom",visible:!0,content:"I'm here abs",style:{padding:6}},r.createElement(s.Z,{outlined:!0,onClick:function(){return o(!0)},style:{position:"absolute",left:50,top:50}},"hi, here~")),r.createElement(ne,{placement:"right",visible:!0,content:"I'm here fixed",style:{padding:6,background:"#666",color:"#fff"}},r.createElement(s.Z,{outlined:!0,style:{position:"fixed",bottom:100,left:150}},"hi, there~"))))),r.createElement("div",{style:{height:"110vh"}}))}(0,o.render)(r.createElement(xe,null),document.querySelector("#root"))}},e=>{e.O(0,[736],(()=>(27,e(e.s=27)))),e.O()}]); \ No newline at end of file +"use strict";(self.webpackChunkw_popover=self.webpackChunkw_popover||[]).push([[826],{27:(e,t,n)=>{var r=n(294),o=n(935),i=n(152),c=n(168),l=n(438),a=n(394),u=n(289),s=n(519),f=n(762),p=n(462),d=n(942),m=n(925),h=n(10),v=r.createElement("svg",(0,p.Z)({viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},{width:"1em",height:"1em",fill:"currentColor"}),r.createElement("path",{d:"M240.512 180.181333l271.530667 271.488 271.530666-271.488a42.666667 42.666667 0 0 1 56.32-3.541333l4.010667 3.541333a42.666667 42.666667 0 0 1 0 60.330667l-271.530667 271.530667 271.530667 271.530666a42.666667 42.666667 0 0 1-56.32 63.872l-4.010667-3.541333-271.530666-271.530667-271.530667 271.530667-4.010667 3.541333a42.666667 42.666667 0 0 1-56.32-63.872l271.488-271.530666-271.488-271.530667a42.666667 42.666667 0 0 1 60.330667-60.330667z","p-id":"2884"})),g=function(e){return r.createElement("div",e,v)};g.displayName="Close";const b=g;function y(e){var t=(0,r.useRef)(e);return t.current=e,t}const w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=(0,r.useRef)(!1);(0,r.useEffect)((function(){if(n.current)return e();n.current=!0}),t)};var O=n(2),E=function(e){var t,n=e.current;return n instanceof HTMLElement?t=n:n.current?t=n.current:"function"==typeof n&&(t=n()),t},x=function(e,t){return e?"function"==typeof e?e():e&&"current"in e?e.current:e:t},j=function(e,t,n){if("object"===(0,O.Z)(t)&&t)for(var r=0,o=Object.keys(t);r4&&void 0!==arguments[4]?arguments[4]:220,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=(0,r.useState)(t),u=(0,i.Z)(a,2),s=u[0],f=u[1],p=y(e),d=(0,r.useRef)(0),m=y(n),h=y(o);return(0,r.useLayoutEffect)((function(){var e=E(p);t&&e instanceof Element&&(j(e,m.current,h.current),f(!0),d.current=window.setTimeout((function(){j(e,h.current,m.current)}),l))}),[t,s,m,h,p,l]),w((function(){if(!t&&s){var e=E(p);d.current=window.setTimeout((function(){j(e,m.current,h.current),d.current=window.setTimeout((function(){f(!1)}),c)}),l)}}),[t]),(0,r.useEffect)((function(){return function(){d.current&&clearTimeout(d.current)}}),[]),s||t}var k=["children","visible","style","hideOverflow"];function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:void 0,i=y(n),c=y(t),l=y(e),a=y(o);(0,r.useEffect)((function(){var e=x(l.current,window);if(null!=e&&e.addEventListener){var t=function(e){var t;return null===(t=i.current)||void 0===t?void 0:t.call(i,e)},n=c.current,r=a.current;return e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}}}),[])}var M=function(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e},z=function(e){return M(e).getComputedStyle(e)},_=function(e){return e?(e.nodeName||"").toLowerCase():""},I=function(e){return e&&"html"!==_(e)?e.assignedSlot||e.parentNode||function(e){return function(e){return(H(e)?e.ownerDocument:e.document)||window.document}(e).documentElement}(e):e},H=function(e){return e instanceof M(e).Element||e instanceof Element},B=function(e){return e instanceof M(e).HTMLElement||e instanceof HTMLElement},F=function(e){return["table","td","th"].indexOf(_(e))>=0},V=function(e){return B(e)&&"fixed"!==z(e).position?e.offsetParent:null},Y=function(e){var t=0;return function(e,t){var n=M(e);null==t||t(e);for(var r=V(e);r&&F(r)&&"static"===z(r).position;)null==t||t(r),r=V(r);r||function(e,t){null==t||t(e);for(var n=I(e);B(n)&&["html","body"].indexOf(_(n))<0;){null==t||t(n);var r=z(n);if("none"!==r.transform||"none"!==r.perspective||r.willChange&&"auto"!==r.willChange)return n;n=I(n)}}(e,t)}(e,(function(e){t+=e.offsetTop})),t},A=12;function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function q(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:window,n=e;n&&n!==t&&U(n);){var r=window.getComputedStyle(n),o=r.overflowY;if(J.test(o))return n;n=n.parentNode}return t}var K=["placement","content","arrow","visible","closable","onVisibleChange","onClose","className","style","children","mask","maskStyle","maskClass","closeOnClickOutside","closeOnMaskClick","transition","transitionDuration","offset"];function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t4&&void 0!==arguments[4]?arguments[4]:"bottom",i=arguments.length>5?arguments[5]:void 0,c=e.getBoundingClientRect(),l=t.getBoundingClientRect(),a=n.getBoundingClientRect(),u="body"===_(n),s=z(t).position,f="fixed"===s,p=r instanceof Element?r.scrollTop:r.pageYOffset,d="fixed"===s||r instanceof Element,m=d?l.top:u?l.top+p:Y(t),h=m,v=l.height+m,g=l.left-(d?0:a.left),b=l.width,y=l.height,w={top:{top:h-c.height-A,left:g+b/2-c.width/2},bottom:{top:v+A,left:g+b/2-c.width/2},left:{top:h+y/2-c.height/2,left:g-c.width-A},right:{top:h+y/2-c.height/2,left:g+b+A},"top-right":{top:h-c.height-A,left:g+b-c.width},"top-left":{top:h-c.height-A,left:g},"bottom-right":{top:v+A,left:g+b-c.width},"bottom-left":{top:v+A,left:g},"right-top":{top:h,left:g+b+A},"left-top":{top:h,left:g-c.width-A},"right-bottom":{top:v-c.height,left:g+b+A},"left-bottom":{top:v-c.height,left:g-c.width-A}},O={x:i.x||0,y:i.y||0},E=w[o];return{position:f?"fixed":"absolute",top:E.top+O.y,left:E.left+O.x}}(r,e,document.body,t,n,ne.current),c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,o=e.getBoundingClientRect(),c=t.split("-"),l=(0,i.Z)(c,2),a=l[0],u=l[1],s={top:"1px 1px 1px 0px rgba(0, 0, 0, 0.05)",right:"-1px 1px 1px 0px rgba(0, 0, 0, 0.05)",bottom:"-1px -1px 1px 0px rgba(0, 0, 0, 0.05)",left:"1px -1px 1px 0px rgba(0, 0, 0, 0.05)"},f=(0,d.Z)({boxShadow:s[a]},N(a),-r/2);if(u)return q((0,d.Z)({},u,2*n),f);var p={};return["bottom","top"].includes(a)&&(p.right=(o.width-r)/2),["left","right"].includes(a)&&(p.top=(o.height-r)/2),q(q({},p),f)}(r,n,A);j(r,{top:o.top+"px",left:o.left+"px",position:o.position}),H&&!ae.current&&(ae.current=!0,j(r,$),r.__oh__=r.offsetHeight,j(r,{transitionProperty:te})),le(c)}),[H,n,ne]),se=function(){var e=U.current,t=G(e);ue(e,t)},fe=(0,r.useCallback)((function(e){var t,n=Q.current,r=U.current;!n||n.contains(e.target)||r.contains(e.target)||null===(t=re.current)||void 0===t||t.call(re)}),[re]);L((function(){return window}),"resize",u?se:void 0),L((function(){return G(U.current)}),"scroll",u?se:void 0),L((function(){return document}),"click",S?fe:void 0),(0,r.useLayoutEffect)((function(){var e=U.current,t=G(e);u&&ue(e,t)}),[ue,u]);var pe=(0,r.useMemo)((function(){return function(e){var t=e.split("-"),n="";return t[0]&&(n+=R[t[0]]),t[1]&&(n+=" "+t[1]),n}(n)}),[n]),de=Z((function(){return H?Q.current:null}),u,$,ee,F);return w((function(){null==f||f(u),u||(ae.current=!1)}),[u]),r.createElement(r.Fragment,null,r.createElement(T,{visible:x&&u,className:P,style:k,onClick:function(){M&&(null==v||v())}}),r.cloneElement(E,{ref:U}),o.createPortal(r.createElement(r.Fragment,null,(H&&de||!H&&u)&&r.createElement("div",(0,p.Z)({},J,{ref:Q,className:(0,h.Z)(g,"w-popover"),style:X({position:"absolute",background:"#fff",zIndex:1e3,transformOrigin:pe,transitionDuration:"".concat(F,"ms"),willChange:H?te:"unset"},O)}),a&&r.createElement("div",{className:(0,h.Z)("w-popover__arrow"),style:X({position:"absolute",width:6,height:6,zIndex:-1,background:"inherit",transform:"rotate(45deg)"},ce)}),s&&r.createElement(b,{className:(0,h.Z)("w-popover__close"),onClick:v,style:{position:"absolute",zIndex:10,top:6,right:6,cursor:"pointer",color:"rgb(0,0,0)",opacity:.35,display:"flex",alignItems:"center",justifyContent:"center"}}),c)),document.body))};var re,oe=["title","padding","background","border","height","children"],ie=l.ZP.div(re||(re=(0,c.Z)(["\n font-size: 14px;\n\n .title {\n padding: 12px 8px 6px;\n color: #969696;\n font-size: 14px;\n }\n\n .main {\n border: solid 1px #eee;\n border-right: none;\n border-left: none;\n }\n\n img {\n max-width: 100%;\n }\n"])));function ce(e){var t=e.title,n=void 0===t?"":t,o=e.padding,i=void 0===o?"12px":o,c=e.background,l=void 0===c?"#fff":c,a=e.border,u=e.height,s=e.children,f=(0,m.Z)(e,oe);return r.createElement(ie,f,n&&r.createElement("div",{className:"title"},n),r.createElement("div",{className:"main",style:{padding:i,background:l,border:a,height:u}},s))}var le,ae=n(215),ue=["children"],se=(0,l.vJ)(le||(le=(0,c.Z)(["\n body {\n background-color: rgb(245, 247, 250);\n font-size: 14px;\n margin:0;\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', STHeiti,\n 'Microsoft Yahei', Tahoma, Simsun, sans-serif;\n line-height: 1.5715;\n }\n *{\n box-sizing: border-box;;\n }\n"]))),fe=function(){return document.documentElement.style.getPropertyValue("--uc-color")||"#005cff"};function pe(e){var t=e.children;return(0,m.Z)(e,ue),r.createElement(r.Fragment,null,r.createElement(se,null),r.createElement(ae.Z,{color:fe()},t))}fe();var de,me=["title","hoverDelay","placement","arrow","offset","className","style","children"];function he(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t11&&(c.current=0),l()}},"Try to click me")))),r.createElement(ce,{title:"Tooltip"},r.createElement(u.Z,null,r.createElement(f.Z,null,r.createElement(ye,{title:"This's a tooltip ",placement:"top"},r.createElement(s.Z,{type:"primary"},"Tooltip at top")),r.createElement(ye,{title:"This's a tooltip ",placement:"bottom"},r.createElement(s.Z,{type:"primary"},"Tooltip at bottom")),r.createElement(ye,{title:"This's a tooltip ",placement:"right"},r.createElement(s.Z,{type:"primary"},"Tooltip at right"))))),r.createElement(ce,{title:"Scroll (the green block is scrollable)"},r.createElement("div",{style:{height:200,width:"100%",border:"1px solid #666",textAlign:"center",overflowY:"scroll",position:"relative"}},r.createElement("div",{style:{height:"120vh",background:"#00bc8d"}},r.createElement(ne,{placement:"bottom",visible:!0,content:"I'm here ",style:{padding:6}},r.createElement(s.Z,{outlined:!0,onClick:function(){return o(!0)}},"hi, there~")),r.createElement(ne,{placement:"bottom",visible:!0,content:"I'm here abs",style:{padding:6}},r.createElement(s.Z,{outlined:!0,onClick:function(){return o(!0)},style:{position:"absolute",left:50,top:50}},"hi, here~")),r.createElement(ne,{placement:"right",visible:!0,content:"I'm here fixed",style:{padding:6,background:"#666",color:"#fff"}},r.createElement(s.Z,{outlined:!0,style:{position:"fixed",bottom:100,left:150}},"hi, there~"))))),r.createElement("div",{style:{height:"110vh"}}))}(0,o.render)(r.createElement(xe,null),document.querySelector("#root"))}},e=>{e.O(0,[736],(()=>(27,e(e.s=27)))),e.O()}]); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 6859844..2939f8d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file