primereact
Version:
PrimeReact is an open source UI library for React featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime
2 lines (1 loc) • 2.14 kB
JavaScript
this.primereact=this.primereact||{},this.primereact.ripple=function(e,t,r,n,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=o(t),a=c(r),l=i.memo(i.forwardRef((function(){var e=i.useRef(null),t=i.useRef(null),r=function(){return e.current&&e.current.parentElement},c=function(){t.current&&(t.current.addEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.addEventListener("touchstart",o))},o=function(e){l(e),e.preventDefault()},l=function(r){if(e.current&&"none"!==getComputedStyle(e.current,null).display){if(u.DomHandler.removeClass(e.current,"p-ink-active"),!u.DomHandler.getHeight(e.current)&&!u.DomHandler.getWidth(e.current)){var n=Math.max(u.DomHandler.getOuterWidth(t.current),u.DomHandler.getOuterHeight(t.current));e.current.style.height=n+"px",e.current.style.width=n+"px"}var c=u.DomHandler.getOffset(t.current),o=r.pageX-c.left+document.body.scrollTop-u.DomHandler.getWidth(e.current)/2,i=r.pageY-c.top+document.body.scrollLeft-u.DomHandler.getHeight(e.current)/2;e.current.style.top=i+"px",e.current.style.left=o+"px",u.DomHandler.addClass(e.current,"p-ink-active")}};return n.useMountEffect((function(){e.current&&(t.current=r(),c())})),n.useUpdateEffect((function(){e.current&&!t.current&&(t.current=r(),c())})),n.useUnmountEffect((function(){e.current&&(t.current=null,t.current&&(t.current.removeEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.removeEventListener("touchstart",o)))})),a.default.ripple?i.createElement("span",{role:"presentation",ref:e,className:"p-ink",onAnimationEnd:function(e){u.DomHandler.removeClass(e.currentTarget,"p-ink-active")}}):null})));return l.displayName="Ripple",l.defaultProps={__TYPE:"Ripple"},e.Ripple=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.utils);