@verifiedinc-public/shared-ui-elements 3.4.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/animation/index.mjs +1 -1
- package/dist/components/chart/index.mjs +1 -0
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/date-Cq0LS2Mr.mjs +1 -0
- package/dist/shared/index-CDq4CkLc.mjs +2 -0
- package/dist/shared/index-DiQVZ8e9.mjs +104 -0
- package/dist/shared/motions-CpxgbzKX.mjs +1 -0
- package/dist/shared/useCopyToClipboard-BALOSYVW.mjs +1 -0
- package/dist/shared/useIntersectionObserver-CbpWuEs0.mjs +1 -0
- package/dist/shared/useOnClickOutside-P5GTcgh8.mjs +1 -0
- package/dist/shared/usePrevious-A8he0cAZ.mjs +1 -0
- package/package.json +1 -1
- package/dist/shared/index-CmfEgJAn.mjs +0 -105
- package/dist/shared/useIntersectionObserver-BX_TdOtC.mjs +0 -1
- package/dist/shared/useOnClickOutside-1j2klMbE.mjs +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{j as p}from"./jsx-runtime-jmtevAuS.mjs";import{Box as r,Stack as c,TableBody as f,TableRow as m,TableCell as i,Typography as d,Button as l}from"@mui/material";import{u as M}from"./useCounter-BV32zXDQ.mjs";import{motion as o}from"framer-motion";function w({children:a,from:t,to:e,map:s}){const{ref:n}=M({from:t,to:e,map:s});return p.jsx(r,{ref:n,component:"span",children:a})}const P=o.create(r),b=o.create(c),u=o.create(f,{forwardMotionProps:!1}),x=o.create(m,{forwardMotionProps:!1}),y=o.create(i,{forwardMotionProps:!1}),B=o.create(d,{forwardMotionProps:!1}),T=o.create(l,{forwardMotionProps:!1});export{w as C,P as M,b as a,u as b,x as c,y as d,B as e,T as f};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function l({type:n="text/plain"}){return{copy:async t=>{var a;if((a=navigator.clipboard)!=null&&a.write){const e={};switch(n){case"text/html":e["text/plain"]=new Blob([t],{type:"text/plain"}),e[n]=new Blob([t],{type:n});break;default:e[n]=new Blob([t],{type:n})}const o=[new ClipboardItem(e)];await navigator.clipboard.write(o)}else{const e=document.createElement("textarea");t instanceof Blob?e.value=await t.text():e.value=t.toString(),e.select(),document.execCommand("copy")}}}}export{l as u};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{useRef as y,useInsertionEffect as C,useCallback as w,useState as d,useId as x,useEffect as h,useLayoutEffect as S}from"react";function A(e){return{set:r=>{const o=typeof r=="string"?r:JSON.stringify(r);localStorage.setItem(e,o)},get:()=>{const r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return r}return null},remove:()=>{localStorage.removeItem(e)}}}function b(e,r=[]){const o=y(()=>{throw new Error("Cannot call an event handler while rendering.")});return C(()=>{o.current=e}),w((...t)=>{var s;return(s=o.current)==null?void 0:s.call(o,...t)},r)}function k(e={}){const{onClose:r,onOpen:o,open:t,id:s}=e,n=b(o),i=b(r),[a,l]=d(e.defaultOpen??!1),c=t??a,u=t!==void 0,m=x(),f=s??`disclosure-${m}`,v=w(()=>{u||l(!1),i?.()},[u,i]),p=w(()=>{u||l(!0),n?.()},[u,n]),E=w(()=>{c?v():p()},[c,p,v]);function T(g={}){return{...g,"aria-expanded":c,"aria-controls":f,onClick(O){var I;(I=g.onClick)==null||I.call(g,O),E()}}}function L(g={}){return{...g,hidden:!c,id:f}}return{open:c,onOpen:p,onClose:v,onToggle:E,isControlled:u,getButtonProps:T,getDisclosureProps:L}}function z(e){return new URLSearchParams(e??window.location.search)}function D(e,r=250){const[o,t]=d(e);return h(()=>{const s=setTimeout(()=>{t(e)},r);return()=>{clearTimeout(s)}},[e,r]),o}function P(e,r={removeOnUnmount:!1}){const[o,t]=d("loading"),s=y(r);return h(()=>{let n=document.querySelector(`script[src="${e}"]`);const i=n?.getAttribute("data-status");if(i){t(i);return}if(n===null){n=document.createElement("script"),n.src=e,n.async=!0,n.setAttribute("data-status","loading"),document.body.appendChild(n);const a=()=>{n?.setAttribute("data-status","ready"),t("ready"),c()},l=()=>{n?.setAttribute("data-status","error"),t("error"),c()},c=()=>{n?.removeEventListener("load",a),n?.removeEventListener("error",l)};n.addEventListener("load",a),n.addEventListener("error",l);const u=s.current.removeOnUnmount;return()=>{u&&(n?.remove(),c())}}else t("unknown")},[e]),o}function W(e,r=500){const[o,t]=d(e),s=y(Date.now());return h(()=>{const n=Date.now(),i=n-s.current;if(i>=r)s.current=n,t(e);else{const a=r-i,l=window.setTimeout(()=>{s.current=Date.now(),t(e)},a);return()=>{window.clearTimeout(l)}}},[e,r]),o}function j(e){const[r,o]=d(()=>typeof e=="boolean"?e:!!e),t=w(s=>{if(typeof s=="boolean"){o(s);return}o(n=>!n)},[]);return[r,t]}function U(){const[e,r]=d({x:0,y:0}),o=w((...t)=>{if(t.length===1&&typeof t[0]=="object")window.scrollTo(t[0]);else if(t.length===2)window.scrollTo(t[0],t[1]);else throw new Error("Invalid arguments passed to scrollTo. Expected either ScrollToOptions object or x,y coordinates. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return S(()=>{const t=()=>{r({x:window.scrollX,y:window.scrollY})};return t(),window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}},[]),{...e,scrollTo:o}}function H(){const[e,r]=d({width:window.innerWidth,height:window.innerHeight});return S(()=>{const o=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),e}function N(e,{threshold:r=0,root:o=null,rootMargin:t="0%",freezeOnceVisible:s=!1}={}){const[n,i]=d({isIntersecting:!1,entry:null});return h(()=>{const a=e?.current;let l;if(a){if(s&&n.isIntersecting)return;const c=m=>{const[f]=m;i({isIntersecting:f.isIntersecting,entry:f})},u=new IntersectionObserver(c,{threshold:r,root:o,rootMargin:t});u.observe(a),l=()=>{u.disconnect()}}return()=>{l&&l()}},[e,r,o,t,s,n.isIntersecting]),n}export{k as a,b,z as c,D as d,P as e,W as f,j as g,U as h,H as i,N as j,A as u};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{useMemo as f,useEffect as h}from"react";import*as w from"qrcode";function m(e){const n=f(()=>w.create(e.data),[e.data]).modules.data;return f(()=>{const r=e.size/Math.sqrt(n.length);let s=`<svg viewBox="0 0 ${e.size} ${e.size}" xmlns="http://www.w3.org/2000/svg">`;const o=e.imageSize,i=(e.size-o)/2,a=(e.size-o)/2;for(let t=0;t<n.length;t++){const c=t%Math.sqrt(n.length)*r,u=Math.floor(t/Math.sqrt(n.length))*r,l=r/2,d=n[t]===1,g=c+r>=i&&c<i+o&&u+r>=a&&u<a+o;!d||g||(s+=`<rect x="${c}" y="${u}" width="${r}" height="${r}" rx="${l}" ry="${l}" fill='${e.fill||"#000000"}' />`)}return s+="</svg>",s},[n,e])}function $(e,n,r="mousedown",s={}){h(()=>{const o=i=>{const a=i.target;!a||!a.isConnected||(Array.isArray(e)?e.filter(t=>!!t.current).every(t=>t.current&&!t.current.contains(a)):e.current&&!e.current.contains(a))&&n(i)};return window.addEventListener(r,o,s),()=>{window.removeEventListener(r,o,s)}},[s,r,n,e])}export{$ as a,m as u};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import o from"react";function n(e){const[t,r]=o.useState(e),[u,s]=o.useState();return e!==t&&(s(t),r(e)),u}export{n as u};
|