react-pulsable
Advanced tools
Comparing version 0.0.81 to 0.0.82
@@ -1,2 +0,2 @@ | ||
"use strict";var v=Object.create;var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var E=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),C=(s,t)=>{for(var i in t)u(s,i,{get:t[i],enumerable:!0})},f=(s,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of L(t))!A.call(s,r)&&r!==i&&u(s,r,{get:()=>t[r],enumerable:!(n=y(t,r))||n.enumerable});return s};var N=(s,t,i)=>(i=s!=null?v(S(s)):{},f(t||!s||!s.__esModule?u(i,"default",{value:s,enumerable:!0}):i,s)),g=s=>f(u({},"__esModule",{value:!0}),s);var m=E((j,d)=>{(function(){"use strict";var s={}.hasOwnProperty,t="[native code]";function i(){for(var n=[],r=0;r<arguments.length;r++){var l=arguments[r];if(l){var c=typeof l;if(c==="string"||c==="number")n.push(l);else if(Array.isArray(l)){if(l.length){var a=i.apply(null,l);a&&n.push(a)}}else if(c==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){n.push(l.toString());continue}for(var p in l)s.call(l,p)&&l[p]&&n.push(p)}}}return n.join(" ")}typeof d<"u"&&d.exports?(i.default=i,d.exports=i):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return i}):window.classNames=i})()});var q={};C(q,{default:()=>x});module.exports=g(q);var o=require("react"),h=N(m());var b=require("react/jsx-runtime"),w=({children:s,isLoading:t,backgroundColor:i})=>{let n=(0,o.useRef)(null),[r,l]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{if(l(!0),t){if(!n.current)return;n.current.querySelectorAll(".pulsable").forEach(a=>{if(a.classList.add("pulse-element"),a.childNodes.forEach(e=>{e.classList&&!e.classList.contains("pulse-child")&&(e.classList.add("pulse-child-element"),e?.hasAttribute("disabled")||(e.classList.add("pulse-has-disabled-attr"),e.setAttribute("disabled","true")))}),!a.querySelector(".pulse-child")){let e=document.createElement("div");e.style.backgroundColor=i||"#bebebe82",a.classList.contains("pulsable-circle")?e.classList.add("pulse-child","pulse-animate","pulse-child-circle"):e.classList.add("pulse-child","pulse-animate","pulse-child-rect"),a.parentNode?.appendChild(e),a.appendChild(e)}}),l(!1)}else{if(!n.current)return;n.current.querySelectorAll(".pulse-child").forEach(e=>{e.parentNode?.removeChild(e)}),n.current.querySelectorAll(".pulse-element").forEach(e=>{e.classList&&e.classList.remove("pulse-element")}),n.current.querySelectorAll(".pulse-child-element").forEach(e=>{e.classList.remove("pulse-child-element"),e.classList.contains("pulse-has-disabled-attr")&&(e.removeAttribute("disabled"),e.classList.remove("pulse-has-disabled-attr"))}),l(!1)}},[t,n.current]),(0,b.jsx)("div",{ref:n,className:(0,h.default)("pulse-container",{"pulse-calculating pulse-container-css":t&&r,"pulse-container-css":t}),children:s})},x=w; | ||
"use strict";var v=Object.create;var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var A=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),C=(s,t)=>{for(var i in t)u(s,i,{get:t[i],enumerable:!0})},f=(s,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!E.call(s,r)&&r!==i&&u(s,r,{get:()=>t[r],enumerable:!(n=y(t,r))||n.enumerable});return s};var N=(s,t,i)=>(i=s!=null?v(L(s)):{},f(t||!s||!s.__esModule?u(i,"default",{value:s,enumerable:!0}):i,s)),w=s=>f(u({},"__esModule",{value:!0}),s);var m=A((P,d)=>{(function(){"use strict";var s={}.hasOwnProperty,t="[native code]";function i(){for(var n=[],r=0;r<arguments.length;r++){var l=arguments[r];if(l){var c=typeof l;if(c==="string"||c==="number")n.push(l);else if(Array.isArray(l)){if(l.length){var a=i.apply(null,l);a&&n.push(a)}}else if(c==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){n.push(l.toString());continue}for(var p in l)s.call(l,p)&&l[p]&&n.push(p)}}}return n.join(" ")}typeof d<"u"&&d.exports?(i.default=i,d.exports=i):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return i}):window.classNames=i})()});var q={};C(q,{default:()=>g});module.exports=w(q);var o=require("react"),h=N(m());var b=require("react/jsx-runtime"),x=({children:s,isLoading:t,backgroundColor:i})=>{let n=(0,o.useRef)(null),[r,l]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{if(l(!0),t){if(!n.current)return;n.current.querySelectorAll(".pulsable").forEach(a=>{if(a.classList.add("pulse-element"),a.childNodes.forEach(e=>{e.classList&&!e.classList.contains("pulse-child")&&(e.classList.add("pulse-child-element"),e?.hasAttribute("disabled")||(e.classList.add("pulse-has-disabled-attr"),e.setAttribute("disabled","true")))}),!a.querySelector(".pulse-child")){let e=document.createElement("div");e.style.backgroundColor=i||"#bebebe82",a.classList.contains("pulsable-circle")?e.classList.add("pulse-child","pulse-animate","pulse-child-circle"):e.classList.add("pulse-child","pulse-animate","pulse-child-rect"),a.parentNode?.appendChild(e),a.appendChild(e)}}),l(!1)}else{if(!n.current)return;n.current.querySelectorAll(".pulse-child").forEach(e=>{e.parentNode?.removeChild(e)}),n.current.querySelectorAll(".pulse-element").forEach(e=>{e.classList&&e.classList.remove("pulse-element")}),n.current.querySelectorAll(".pulse-child-element").forEach(e=>{e.classList.remove("pulse-child-element"),e.classList.contains("pulse-has-disabled-attr")&&(e.removeAttribute("disabled"),e.classList.remove("pulse-has-disabled-attr"))}),l(!1)}},[t,n.current]),(0,b.jsx)("div",{ref:n,className:(0,h.default)("pulse-container",{"pulse-calculating pulse-container-css":t&&r,"pulse-container-css":t}),children:s})},g=x; | ||
/*! Bundled license information: | ||
@@ -3,0 +3,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.81", | ||
"version": "0.0.82", | ||
"description": "This is a simple react component that can be used to wrap other components and add a pulsing/skeleton effect to them.", | ||
@@ -8,0 +8,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
14105