@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
3 lines (2 loc) • 3.19 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.RippleCmnChunk={}))}(this,(function(e){var t=function(e,t,n){var o=function(){n(),e.removeEventListener(t,o,!1)},i=function(){return e.addEventListener(t,o,!1)};return i(),{remove:i}},n=function(e,n){return function(r){var a,s=r.target,c=s.document||s.ownerDocument;if((a=n.container?n.container(s):function(e,t){if(e.closest)return e.closest(t);for(var n=Element.prototype.matches?function(e,t){return e.matches(t)}:function(e,t){return e.msMatchesSelector(t)},o=e;o;){if(n(o,t))return o;o=o.parentElement}}(s,e))&&!(/focus/i.test(r.type)&&a.classList.contains("k-ripple-target")))if(s.classList.contains("k-checkbox")||s.classList.contains("k-radio"))r.target.classList.remove("k-ripple-focus"),"animationend"!==r.type&&r.target.classList.add("k-ripple-focus");else{a.classList.add("k-ripple-target");var u=function(e){var t=e.createElement("div");t.className="k-ripple";var n=e.createElement("div");return n.className="k-ripple-blob",t.appendChild(n),[t,n]}(c),l=u[0],p=u[1],d={animated:!1,released:!1,blob:p,container:a,ripple:l},f={focusin:"focusout",keydown:"keyup",mousedown:"mouseup",pointerdown:"pointerup",touchdown:"touchup",animationstart:"animationend"}[r.type];t(r.currentTarget,f,(function(){return i(d)})),a.appendChild(l),window.getComputedStyle(l).getPropertyValue("opacity");var h=a.getBoundingClientRect(),m=0,v=0;/mouse|pointer|touch/.test(r.type)?(m=r.clientX-h.left,v=r.clientY-h.top):(m=h.width/2,v=h.height/2);var g=m-(m<h.width/2?h.width:0),y=v-(v<h.height/2?h.height:0),b=2*Math.sqrt(g*g+y*y);if(p.style.width=p.style.height=b+"px",p.offsetWidth<0)throw new Error("Inconceivable!");p.style.cssText="\n width: "+b+"px;\n height: "+b+"px;\n transform: translate(-50%, -50%) scale(1);\n left: "+m+"px;\n top: "+v+"px;\n ",setTimeout((function(){return o(d)}),500)}}},o=function(e){e.animated=!0,r(e)},i=function(e){e.released=!0,r(e)},r=function(e){if(e.released&&e.animated){var n=e.blob,o=e.ripple,i=e.container;i&&t(i,"blur",(function(){return i.classList.remove("k-ripple-target")})),n&&(t(n,"transitionend",(function(){o&&o.parentNode&&o.parentNode.removeChild(o)})),n.style.transition="opacity 200ms linear",n.style.opacity="0")}};e.__meta__={id:"ripple.cmn.chunk",name:"RippleCmnChunk",category:"web",description:"A reusable outputed chunk of code",depends:[],hidden:!0,chunk:!0},e.r=function(e,t){var o,i=(o=t.map((function(t){var o={events:["mousedown","touchdown"],global:!1},i=t.selector,r=t.options,a=void 0===r?o:r,s=n(i,a),c=a.events||o.events,u=a.global?document.body:e;return c.forEach((function(e){return u.addEventListener(e,s,!1)})),{events:c,options:a,activator:s}})),[].concat.apply([],o));return function(){if(e){i.forEach((function(t){var n=t.events,o=t.options,i=t.activator,r=o.global?document.body:e;n.forEach((function(e){return r.removeEventListener(e,i,!1)}))})),e=null}}}}));
//# sourceMappingURL=kendo.ripple.cmn.chunk.min.js.map