UNPKG

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.12 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("primereact/api"),t=require("primereact/hooks"),n=require("primereact/utils");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var o=c(e),a=u(r),i=o.memo(o.forwardRef((function(){var e=o.useRef(null),r=o.useRef(null),u=function(){return e.current&&e.current.parentElement},c=function(){r.current&&(r.current.addEventListener("mousedown",l),n.DomHandler.isTouchDevice()&&r.current.addEventListener("touchstart",i))},i=function(e){l(e),e.preventDefault()},l=function(t){if(e.current&&"none"!==getComputedStyle(e.current,null).display){if(n.DomHandler.removeClass(e.current,"p-ink-active"),!n.DomHandler.getHeight(e.current)&&!n.DomHandler.getWidth(e.current)){var u=Math.max(n.DomHandler.getOuterWidth(r.current),n.DomHandler.getOuterHeight(r.current));e.current.style.height=u+"px",e.current.style.width=u+"px"}var c=n.DomHandler.getOffset(r.current),o=t.pageX-c.left+document.body.scrollTop-n.DomHandler.getWidth(e.current)/2,a=t.pageY-c.top+document.body.scrollLeft-n.DomHandler.getHeight(e.current)/2;e.current.style.top=a+"px",e.current.style.left=o+"px",n.DomHandler.addClass(e.current,"p-ink-active")}};return t.useMountEffect((function(){e.current&&(r.current=u(),c())})),t.useUpdateEffect((function(){e.current&&!r.current&&(r.current=u(),c())})),t.useUnmountEffect((function(){e.current&&(r.current=null,r.current&&(r.current.removeEventListener("mousedown",l),n.DomHandler.isTouchDevice()&&r.current.removeEventListener("touchstart",i)))})),a.default.ripple?o.createElement("span",{role:"presentation",ref:e,className:"p-ink",onAnimationEnd:function(e){n.DomHandler.removeClass(e.currentTarget,"p-ink-active")}}):null})));i.displayName="Ripple",i.defaultProps={__TYPE:"Ripple"},exports.Ripple=i;