react-pulsable
Advanced tools
Comparing version 0.0.88 to 0.0.91
@@ -1,2 +0,20 @@ | ||
"use strict";var y=Object.create;var u=Object.defineProperty;var v=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),w=(s,t)=>{for(var n in t)u(s,n,{get:t[n],enumerable:!0})},f=(s,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of L(t))!A.call(s,i)&&i!==n&&u(s,i,{get:()=>t[i],enumerable:!(r=v(t,i))||r.enumerable});return s};var x=(s,t,n)=>(n=s!=null?y(S(s)):{},f(t||!s||!s.__esModule?u(n,"default",{value:s,enumerable:!0}):n,s)),C=s=>f(u({},"__esModule",{value:!0}),s);var m=E((z,d)=>{(function(){"use strict";var s={}.hasOwnProperty,t="[native code]";function n(){for(var r=[],i=0;i<arguments.length;i++){var l=arguments[i];if(l){var o=typeof l;if(o==="string"||o==="number")r.push(l);else if(Array.isArray(l)){if(l.length){var e=n.apply(null,l);e&&r.push(e)}}else if(o==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){r.push(l.toString());continue}for(var p in l)s.call(l,p)&&l[p]&&r.push(p)}}}return r.join(" ")}typeof d<"u"&&d.exports?(n.default=n,d.exports=n):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return n}):window.classNames=n})()});var k={};w(k,{default:()=>g});module.exports=C(k);var c=require("react"),h=x(m());var b=require("react/jsx-runtime"),N=({children:s,isLoading:t,backgroundColor:n,noRadius:r=!1})=>{let i=(0,c.useRef)(null),[l,o]=(0,c.useState)(!0);return(0,c.useEffect)(()=>{if(o(!0),t){if(!i.current)return;i.current.querySelectorAll(".pulsable").forEach(e=>{if(e.classList.add("pulse-element"),e.hasAttribute("disabled")||(e.classList.add("pulse-has-disabled-attr"),e.setAttribute("disabled","true")),e.childNodes.forEach(a=>{a.classList&&!a.classList.contains("pulse-child")&&(a.classList.add("pulse-child-element"),a?.hasAttribute("disabled")||(a.classList.add("pulse-has-disabled-attr"),a.setAttribute("disabled","true")))}),!e.querySelector(".pulse-child")){let a=document.createElement("div");a.style.backgroundColor=n||"#bebebe82",e.classList.contains("pulsable-circle")?a.classList.add("pulse-child","pulse-animate","pulse-child-circle"):e.classList.contains("pulsable-hidden")?a.classList.add("pulse-child","pulse-animate","pulse-child-hidden"):r?a.classList.add("pulse-child","pulse-animate","pulse-child-rect-sharp"):a.classList.add("pulse-child","pulse-animate","pulse-child-rect"),e.parentNode?.appendChild(a),e.appendChild(a)}}),o(!1)}else{if(!i.current)return;i.current.querySelectorAll(".pulse-child").forEach(e=>{e.parentNode?.removeChild(e)}),i.current.querySelectorAll(".pulse-element").forEach(e=>{e.classList&&e.classList.remove("pulse-element")}),i.current.querySelectorAll(".pulse-has-disabled-attr").forEach(e=>{e.removeAttribute("disabled"),e.classList.remove("pulse-has-disabled-attr")}),i.current.querySelectorAll(".pulse-child-element").forEach(e=>{e.classList.remove("pulse-child-element")}),o(!1)}},[t,i.current]),(0,b.jsx)("div",{ref:i,className:(0,h.default)("pulse-container",{"pulse-calculating pulse-container-css":t&&l,"pulse-container-css":t}),children:s})},g=N; | ||
"use strict";var w=Object.create;var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),S=(e,t)=>{for(var a in t)u(e,a,{get:t[a],enumerable:!0})},f=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of g(t))!k.call(e,s)&&s!==a&&u(e,s,{get:()=>t[s],enumerable:!(o=y(t,s))||o.enumerable});return e};var E=(e,t,a)=>(a=e!=null?w(x(e)):{},f(t||!e||!e.__esModule?u(a,"default",{value:e,enumerable:!0}):a,e)),A=e=>f(u({},"__esModule",{value:!0}),e);var m=L((P,d)=>{(function(){"use strict";var e={}.hasOwnProperty,t="[native code]";function a(){for(var o=[],s=0;s<arguments.length;s++){var l=arguments[s];if(l){var c=typeof l;if(c==="string"||c==="number")o.push(l);else if(Array.isArray(l)){if(l.length){var i=a.apply(null,l);i&&o.push(i)}}else if(c==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){o.push(l.toString());continue}for(var n in l)e.call(l,n)&&l[n]&&o.push(n)}}}return o.join(" ")}typeof d<"u"&&d.exports?(a.default=a,d.exports=a):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return a}):window.classNames=a})()});var N={};S(N,{default:()=>C});module.exports=A(N);var p=require("react"),b=E(m());var h=` | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="40%" | ||
height="40%" | ||
viewBox="0 0 180.119 139.794" | ||
> | ||
<g transform="translate(-13.59 -66.639)" paintOrder="fill markers stroke"> | ||
<path fill="#d0d0d0" d="M13.591 66.639H193.71v139.794H13.591z" /> | ||
<path | ||
d="m118.507 133.514-34.249 34.249-15.968-15.968-41.938 41.937H178.726z" | ||
opacity=".675" | ||
fill="#fff" | ||
/> | ||
<circle cx="58.217" cy="108.555" r="11.773" opacity=".675" fill="#fff" /> | ||
<path fill="none" d="M26.111 77.634h152.614v116.099H26.111z" /> | ||
</g> | ||
</svg> | ||
`;var v=require("react/jsx-runtime"),z=({children:e,isLoading:t,backgroundColor:a,noRadius:o=!1})=>{let s=(0,p.useRef)(null),[l,c]=(0,p.useState)(!0);return(0,p.useEffect)(()=>{if(c(!0),t){if(!s.current)return;let i=document.createElement("div");i.classList.add("pulse-svg-cont"),i.innerHTML=h,s.current.querySelectorAll(".pulsable").forEach(n=>{if(n.classList.add("pulse-element"),n.hasAttribute("disabled")||(n.classList.add("pulse-has-disabled-attr"),n.setAttribute("disabled","true")),n.childNodes.forEach(r=>{r.classList&&!r.classList.contains("pulse-child")&&(r.classList.add("pulse-child-element"),r?.hasAttribute("disabled")||(r.classList.add("pulse-has-disabled-attr"),r.setAttribute("disabled","true")))}),!n.querySelector(".pulse-child")){let r=document.createElement("div");r.style.backgroundColor=a||"#bebebe82",n.classList.contains("pulsable-circle")?r.classList.add("pulse-child","pulse-animate","pulse-child-circle"):n.classList.contains("pulsable-hidden")?r.classList.add("pulse-child","pulse-animate","pulse-child-hidden"):o?r.classList.add("pulse-child","pulse-animate","pulse-child-rect-sharp"):r.classList.add("pulse-child","pulse-animate","pulse-child-rect"),n.classList.contains("pulsable-img")&&r.appendChild(i),n.parentNode?.appendChild(r),n.appendChild(r)}}),c(!1)}else{if(!s.current)return;s.current.querySelectorAll(".pulse-child").forEach(i=>{i.parentNode?.removeChild(i)}),s.current.querySelectorAll(".pulse-element").forEach(i=>{i.classList&&i.classList.remove("pulse-element")}),s.current.querySelectorAll(".pulse-has-disabled-attr").forEach(i=>{i.removeAttribute("disabled"),i.classList.remove("pulse-has-disabled-attr")}),s.current.querySelectorAll(".pulse-child-element").forEach(i=>{i.classList.remove("pulse-child-element")}),c(!1)}},[t,s.current]),(0,v.jsx)("div",{ref:s,className:(0,b.default)("pulse-container",{"pulse-calculating pulse-container-css":t&&l,"pulse-container-css":t}),children:e})},C=z; | ||
/*! Bundled license information: | ||
@@ -3,0 +21,0 @@ |
@@ -5,6 +5,6 @@ { | ||
"license": "MIT", | ||
"version": "0.0.88", | ||
"version": "0.0.91", | ||
"description": "This is a simple react component that can be used to wrap other components and add a pulsing/skeleton effect to them.", | ||
"private": false, | ||
"types": "./dist/@types/index.d.ts", | ||
"types": "./dist/@types/pulsable.d.ts", | ||
"main": "./dist/index.js", | ||
@@ -29,3 +29,3 @@ "module": "./dist/index.mjs", | ||
"type": "git", | ||
"url": "git+https://github.com/abdheshnayak/react-pulsable.git" | ||
"url": "git+https://github.com/OpenSource-HQ/react-pulsable.git" | ||
}, | ||
@@ -59,3 +59,3 @@ "keywords": [ | ||
"dev:build": "npm run build", | ||
"tsc": "tsc --emitDeclarationOnly --outDir ./dist/@types", | ||
"tsc": "tsc --emitDeclarationOnly --p tsconfig-compile.json --outDir ./dist/@types ", | ||
"build:css": "tailwindcss -i ./src/scss/build.scss -o ./src/css/index.scss" | ||
@@ -62,0 +62,0 @@ }, |
@@ -111,2 +111,3 @@ # React Pulsable | ||
- if you want to hide some components while loading add class name "pulsable-hidden" | ||
- if you want to add image icon in skeleton add class name "pulsable-img" | ||
@@ -113,0 +114,0 @@ #### Example 2 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18916
99
123
8