@verifiedinc-public/shared-ui-elements 7.5.0 → 7.6.0
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/chart/index.mjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/text-to-signup/magic-button.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/useGoogleFont.d.ts +15 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{TTSBigNumbers-BUle44HP.mjs → TTSBigNumbers-CWUApa7c.mjs} +1 -1
- package/dist/shared/{magic-legal-language-DcIwLpwF.mjs → magic-legal-language-sjTBW3F2.mjs} +13 -13
- package/dist/shared/{magic-link-D4unsrIC.mjs → magic-link-Dr2o0qhW.mjs} +1 -1
- package/dist/shared/magic-qr-code-DEnCvbjS.mjs +1 -0
- package/package.json +1 -1
- package/dist/shared/magic-qr-code-syY72Rcb.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useRef as m,useInsertionEffect as C,useCallback as w,useState as d,useId as k,useEffect as
|
|
1
|
+
"use strict";import{useRef as m,useInsertionEffect as C,useCallback as w,useState as d,useId as k,useEffect as v,useLayoutEffect as I,useSyncExternalStore as A,useMemo as $}from"react";import{g as S}from"./magic-qr-code-DEnCvbjS.mjs";import N from"libphonenumber-js";function P(e){return{set:t=>{const o=typeof t=="string"?t:JSON.stringify(t);localStorage.setItem(e,o)},get:()=>{const t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return t}return null},remove:()=>{localStorage.removeItem(e)}}}function E(e,t=[]){const o=m(()=>{throw new Error("Cannot call an event handler while rendering.")});return C(()=>{o.current=e}),w((...r)=>{var i;return(i=o.current)==null?void 0:i.call(o,...r)},t)}function H(e={}){const{onClose:t,onOpen:o,open:r,id:i}=e,n=E(o),s=E(t),[c,u]=d(e.defaultOpen??!1),a=r??c,l=r!==void 0,p=k(),f=i??`disclosure-${p}`,h=w(()=>{l||u(!1),s?.()},[l,s]),y=w(()=>{l||u(!0),n?.()},[l,n]),b=w(()=>{a?h():y()},[a,y,h]);function T(g={}){return{...g,"aria-expanded":a,"aria-controls":f,onClick(x){var L;(L=g.onClick)==null||L.call(g,x),b()}}}function O(g={}){return{...g,hidden:!a,id:f}}return{open:a,onOpen:y,onClose:h,onToggle:b,isControlled:l,getButtonProps:T,getDisclosureProps:O}}function U(e){return new URLSearchParams(e??window.location.search)}function j(e,t={addToHead:!1,removeOnUnmount:!1,nonce:void 0}){const[o,r]=d("loading"),i=m(t);return v(()=>{let n=document.querySelector(`script[src="${e}"]`);const s=n?.getAttribute("data-status");if(s){r(s);return}if(n===null){n=document.createElement("script"),n.src=e,n.async=!0,n.setAttribute("data-status","loading"),i.current.nonce&&n.setAttribute("nonce",i.current.nonce),i.current.addToHead?document.head.appendChild(n):document.body.appendChild(n);const c=()=>{n?.setAttribute("data-status","ready"),r("ready"),a()},u=()=>{n?.setAttribute("data-status","error"),r("error"),a()},a=()=>{n?.removeEventListener("load",c),n?.removeEventListener("error",u)};n.addEventListener("load",c),n.addEventListener("error",u);const l=i.current.removeOnUnmount;return()=>{l&&(n?.remove(),a())}}else r("unknown")},[e]),o}function z(e,t=500){const[o,r]=d(e),i=m(Date.now());return v(()=>{const n=Date.now(),s=n-i.current;if(s>=t)i.current=n,r(e);else{const c=t-s,u=window.setTimeout(()=>{i.current=Date.now(),r(e)},c);return()=>{window.clearTimeout(u)}}},[e,t]),o}function D(e){const[t,o]=d(()=>typeof e=="boolean"?e:!!e),r=w(i=>{if(typeof i=="boolean"){o(i);return}o(n=>!n)},[]);return[t,r]}function M(){const[e,t]=d({x:0,y:0}),o=w((...r)=>{if(r.length===1&&typeof r[0]=="object")window.scrollTo(r[0]);else if(r.length===2)window.scrollTo(r[0],r[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 I(()=>{const r=()=>{t({x:window.scrollX,y:window.scrollY})};return r(),window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}},[]),{...e,scrollTo:o}}function W(){const[e,t]=d({width:window.innerWidth,height:window.innerHeight});return I(()=>{const o=()=>{t({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),e}function J(e,{threshold:t=0,root:o=null,rootMargin:r="0%",freezeOnceVisible:i=!1}={}){const[n,s]=d({isIntersecting:!1,entry:null});return v(()=>{const c=e?.current;let u;if(c){if(i&&n.isIntersecting)return;const a=p=>{const[f]=p;s({isIntersecting:f.isIntersecting,entry:f})},l=new IntersectionObserver(a,{threshold:t,root:o,rootMargin:r});l.observe(c),u=()=>{l.disconnect()}}return()=>{u&&u()}},[e,t,o,r,i,n.isIntersecting]),n}function R(){return A(e=>typeof window>"u"?()=>{}:(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),()=>typeof navigator>"u"?!0:navigator.onLine,()=>!0)}function q(e,t=500,o){const r=m(),i=$(()=>{const n=S(e,t,o),s=(...c)=>n(...c);return s.cancel=()=>{n.cancel()},s.isPending=()=>!!r.current,s.flush=()=>n.flush(),s},[e,t,o]);return v(()=>{r.current=S(e,t,o)},[e,t,o]),v(()=>()=>{r.current&&r.current.cancel()},[]),i}function B({phoneNumber:e,keyword:t,text:o="Text",signature:r="to"}){var i;e&&(e=((i=N(e))==null?void 0:i.format("NATIONAL").replace("(","").replace(")","").replace(" ","-"))??e);const n={text:o,keyword:t,phoneNumber:e,signature:r};return{...n,displayValue:`${n.text} ${n.keyword} ${n.signature} ${n.phoneNumber}`}}function V(e,t){return`${e}/tts/${t}`}export{H as a,E as b,U as c,j as d,z as e,D as f,M as g,W as h,J as i,R as j,q as k,B as l,V as m,P as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{_ as B,g as C,i as N}from"./_getTag-DML0OnZi.mjs";import{t as F,_ as R}from"./_baseIsEqual-BNqcL4o7.mjs";import{useState as v,useEffect as h,useMemo as y,useRef as j}from"react";import{m as I}from"./makeGoogleFont-pok2oDWs.mjs";import*as W from"qrcode";import G from"qr-code-styling";import{j as H}from"./jsx-runtime-Bwwz4kRH.mjs";import{g as J}from"./generateKeyFromString-D1AuwK4y.mjs";var Q=B,_=function(){return Q.Date.now()},K=_,P=N,b=K,E=F,U="Expected a function",V=Math.max,X=Math.min;function Y(o,e,n){var r,a,u,c,i,s,t=0,m=!1,l=!1,g=!0;if(typeof o!="function")throw new TypeError(U);e=E(e)||0,P(n)&&(m=!!n.leading,l="maxWait"in n,u=l?V(E(n.maxWait)||0,e):u,g="trailing"in n?!!n.trailing:g);function O(d){var f=r,p=a;return r=a=void 0,t=d,c=o.apply(p,f),c}function A(d){return t=d,i=setTimeout(w,e),m?O(d):c}function M(d){var f=d-s,p=d-t,$=e-f;return l?X($,u-p):$}function q(d){var f=d-s,p=d-t;return s===void 0||f>=e||f<0||l&&p>=u}function w(){var d=b();if(q(d))return L(d);i=setTimeout(w,M(d))}function L(d){return i=void 0,g&&r?O(d):(r=a=void 0,c)}function z(){i!==void 0&&clearTimeout(i),t=0,r=s=a=i=void 0}function D(){return i===void 0?c:L(b())}function x(){var d=b(),f=q(d);if(r=arguments,a=this,s=d,f){if(i===void 0)return A(s);if(l)return clearTimeout(i),i=setTimeout(w,e),O(s)}return i===void 0&&(i=setTimeout(w,e)),c}return x.cancel=z,x.flush=D,x}var Z=Y;const tt=C(Z);function ot(o,e){const[n,r]=v("idle"),[a,u]=v(null);return h(()=>{if(!o||!e){r("idle"),u(null);return}const c=`google-font-${o.replace(/\s+/g,"-").toLowerCase()}`,i=document.getElementById(c);if(i){const s=i.getAttribute("data-status"),t=i.getAttribute("data-css-content");s==="loaded"&&t?(r("loaded"),u(t)):s==="error"?(r("error"),u(null)):r("loading");return}return r("loading"),u(null),(async()=>{try{const s=I(o),t=await fetch(s);if(!t.ok)throw new Error(`Failed to fetch font CSS: ${t.statusText}`);const m=await t.text(),l=document.createElement("style");l.id=c,l.textContent=m,l.setAttribute("data-status","loaded"),l.setAttribute("data-css-content",m),document.head.appendChild(l),r("loaded"),u(m)}catch(s){console.error(`Failed to load Google Font ${o}:`,s);const t=document.createElement("style");t.id=c,t.setAttribute("data-status","error"),document.head.appendChild(t),r("error"),u(null)}})(),()=>{const s=document.getElementById(c);s&&document.head.removeChild(s)}},[o,e]),{status:n,isLoading:n==="loading",isLoaded:n==="loaded",hasError:n==="error",cssContent:a}}function nt(o){const e=y(()=>W.create(o.data),[o.data]).modules.data;return y(()=>{const n=o.size/Math.sqrt(e.length);let r=`<svg viewBox="0 0 ${o.size} ${o.size}" xmlns="http://www.w3.org/2000/svg">`;const a=o.imageSize,u=(o.size-a)/2,c=(o.size-a)/2;for(let i=0;i<e.length;i++){const s=i%Math.sqrt(e.length)*n,t=Math.floor(i/Math.sqrt(e.length))*n,m=n/2,l=e[i]===1,g=s+n>=u&&s<u+a&&t+n>=c&&t<c+a;!l||g||(r+=`<rect x="${s}" y="${t}" width="${n}" height="${n}" rx="${m}" ry="${m}" fill='${o.fill||"#000000"}' />`)}return r+="</svg>",r},[e,o])}function et(o,e=250){const[n,r]=v(o);return h(()=>{const a=setTimeout(()=>{r(o)},e);return()=>{clearTimeout(a)}},[o,e]),n}function rt(o,e,n="mousedown",r={},a=null){h(()=>{const u=c=>{const i=c.target;!i||!i.isConnected||(Array.isArray(o)?o.filter(s=>!!s.current).every(s=>s.current&&!s.current.contains(i)):o.current&&!o.current.contains(i))&&e(c)};return(a??window).addEventListener(n,u,r),()=>{(a??window).removeEventListener(n,u,r)}},[r,n,e,o])}var it=R;function st(o,e){return it(o,e)}var at=st;const k=C(at);function T({options:o,className:e}){function n(t){return{width:t?.width??300,height:t?.height??300,type:t?.type??"svg",data:t?.data,image:t?.image,qrOptions:{typeNumber:0,mode:"Byte",errorCorrectionLevel:"Q",...t?.qrOptions},imageOptions:{crossOrigin:"anonymous",margin:20,...t?.imageOptions},dotsOptions:{color:"#000000",type:"square",...t?.dotsOptions},cornersSquareOptions:t?.cornersSquareOptions,cornersDotOptions:t?.cornersDotOptions,backgroundOptions:{...t?.backgroundOptions}}}const[r]=v(n(o)),[a]=v(new G(r)),u=j(null),c=y(()=>()=>H.jsx("div",{className:e,ref:u},"qr-code"),[e]),i=async t=>await a.getRawData(t),s=async(t,m)=>{await a.download({name:t,extension:m})};return h(()=>{u.current&&a.append(u.current)},[a,u]),h(()=>{a&&(k(r,n(o))||a.update(n(o)))},[a,r,o]),{Component:c,getRawData:i,download:s}}function S({magicLink:o,brandLogo:e}){const n=y(()=>({options:{type:"svg",shape:"square",width:1024,height:1024,data:o,qrOptions:{errorCorrectionLevel:"H"},image:e??void 0,dotsOptions:{type:"dots",color:"#000000"},cornersSquareOptions:{type:"dot",color:"#000000"},cornersDotOptions:{type:"dot",color:"#000000"},backgroundOptions:{color:"#00000000"}}}),[e,o]),r=y(()=>J(JSON.stringify(n)),[n]);return{options:n,key:r}}function ut({magicLink:o,brandLogo:e}){const{options:n,key:r}=S({magicLink:o,brandLogo:e});return{qrcode:T(n),key:r}}export{nt as a,et as b,rt as c,T as d,ut as e,S as f,tt as g,k as i,ot as u};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";import{_ as R,g as $,i as j}from"./_getTag-DML0OnZi.mjs";import{t as A,_ as B}from"./_baseIsEqual-BNqcL4o7.mjs";import{useMemo as g,useState as q,useEffect as y,useRef as W}from"react";import*as _ from"qrcode";import H from"qr-code-styling";import{j as J}from"./jsx-runtime-Bwwz4kRH.mjs";import{g as Q}from"./generateKeyFromString-D1AuwK4y.mjs";var F=R,G=function(){return F.Date.now()},I=G,K=j,x=I,b=A,P="Expected a function",U=Math.max,V=Math.min;function X(n,o,i){var e,s,c,d,r,u,t=0,m=!1,f=!1,p=!0;if(typeof n!="function")throw new TypeError(P);o=b(o)||0,K(i)&&(m=!!i.leading,f="maxWait"in i,c=f?U(b(i.maxWait)||0,o):c,p="trailing"in i?!!i.trailing:p);function w(a){var l=e,v=s;return e=s=void 0,t=a,d=n.apply(v,l),d}function S(a){return t=a,r=setTimeout(h,o),m?w(a):d}function E(a){var l=a-u,v=a-t,T=o-l;return f?V(T,c-v):T}function L(a){var l=a-u,v=a-t;return u===void 0||l>=o||l<0||f&&v>=c}function h(){var a=x();if(L(a))return k(a);r=setTimeout(h,E(a))}function k(a){return r=void 0,p&&e?w(a):(e=s=void 0,d)}function C(){r!==void 0&&clearTimeout(r),t=0,e=u=s=r=void 0}function N(){return r===void 0?d:k(x())}function O(){var a=x(),l=L(a);if(e=arguments,s=this,u=a,l){if(r===void 0)return S(u);if(f)return clearTimeout(r),r=setTimeout(h,o),w(u)}return r===void 0&&(r=setTimeout(h,o)),d}return O.cancel=C,O.flush=N,O}var Y=X;const Z=$(Y);function tt(n){const o=g(()=>_.create(n.data),[n.data]).modules.data;return g(()=>{const i=n.size/Math.sqrt(o.length);let e=`<svg viewBox="0 0 ${n.size} ${n.size}" xmlns="http://www.w3.org/2000/svg">`;const s=n.imageSize,c=(n.size-s)/2,d=(n.size-s)/2;for(let r=0;r<o.length;r++){const u=r%Math.sqrt(o.length)*i,t=Math.floor(r/Math.sqrt(o.length))*i,m=i/2,f=o[r]===1,p=u+i>=c&&u<c+s&&t+i>=d&&t<d+s;!f||p||(e+=`<rect x="${u}" y="${t}" width="${i}" height="${i}" rx="${m}" ry="${m}" fill='${n.fill||"#000000"}' />`)}return e+="</svg>",e},[o,n])}function nt(n,o=250){const[i,e]=q(n);return y(()=>{const s=setTimeout(()=>{e(n)},o);return()=>{clearTimeout(s)}},[n,o]),i}function ot(n,o,i="mousedown",e={},s=null){y(()=>{const c=d=>{const r=d.target;!r||!r.isConnected||(Array.isArray(n)?n.filter(u=>!!u.current).every(u=>u.current&&!u.current.contains(r)):n.current&&!n.current.contains(r))&&o(d)};return(s??window).addEventListener(i,c,e),()=>{(s??window).removeEventListener(i,c,e)}},[e,i,o,n])}var it=B;function rt(n,o){return it(n,o)}var et=rt;const M=$(et);function z({options:n,className:o}){function i(t){return{width:t?.width??300,height:t?.height??300,type:t?.type??"svg",data:t?.data,image:t?.image,qrOptions:{typeNumber:0,mode:"Byte",errorCorrectionLevel:"Q",...t?.qrOptions},imageOptions:{crossOrigin:"anonymous",margin:20,...t?.imageOptions},dotsOptions:{color:"#000000",type:"square",...t?.dotsOptions},cornersSquareOptions:t?.cornersSquareOptions,cornersDotOptions:t?.cornersDotOptions,backgroundOptions:{...t?.backgroundOptions}}}const[e]=q(i(n)),[s]=q(new H(e)),c=W(null),d=g(()=>()=>J.jsx("div",{className:o,ref:c},"qr-code"),[o]),r=async t=>await s.getRawData(t),u=async(t,m)=>{await s.download({name:t,extension:m})};return y(()=>{c.current&&s.append(c.current)},[s,c]),y(()=>{s&&(M(e,i(n))||s.update(i(n)))},[s,e,n]),{Component:d,getRawData:r,download:u}}function D({magicLink:n,brandLogo:o}){const i=g(()=>({options:{type:"svg",shape:"square",width:1024,height:1024,data:n,qrOptions:{errorCorrectionLevel:"H"},image:o??void 0,dotsOptions:{type:"dots",color:"#000000"},cornersSquareOptions:{type:"dot",color:"#000000"},cornersDotOptions:{type:"dot",color:"#000000"},backgroundOptions:{color:"#00000000"}}}),[o,n]),e=g(()=>Q(JSON.stringify(i)),[i]);return{options:i,key:e}}function st({magicLink:n,brandLogo:o}){const{options:i,key:e}=D({magicLink:n,brandLogo:o});return{qrcode:z(i),key:e}}export{nt as a,ot as b,z as c,st as d,D as e,Z as f,M as i,tt as u};
|