@verifiedinc-public/shared-ui-elements 2.0.0 → 2.2.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/animation/Counter.d.ts +8 -0
- package/dist/components/animation/index.d.ts +2 -0
- package/dist/components/animation/index.mjs +1 -0
- package/dist/components/animation/motions.d.ts +2220 -0
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/useCounter.d.ts +13 -0
- package/dist/hooks/useDebounceValue.d.ts +8 -0
- package/dist/hooks/useIntersectionObserver.d.ts +16 -0
- package/dist/hooks/useOnClickOutside.d.ts +23 -0
- package/dist/hooks/useScript.d.ts +9 -0
- package/dist/hooks/useThrottle.d.ts +7 -0
- package/dist/hooks/useToggle.d.ts +6 -0
- package/dist/hooks/useWindowScroll.d.ts +11 -0
- package/dist/hooks/useWindowSize.d.ts +10 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/index-w5CoDyk5.mjs +105 -0
- package/dist/shared/jsx-runtime-jmtevAuS.mjs +1 -0
- package/dist/shared/useCounter-BV32zXDQ.mjs +1 -0
- package/dist/shared/useIntersectionObserver-BX_TdOtC.mjs +1 -0
- package/package.json +8 -14
- package/dist/shared/index-CTvz4BbG.mjs +0 -105
- package/dist/shared/useSearchParams-CW9y02Ym.mjs +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import N from"react";var E={exports:{}},l={},P;function F(){if(P)return l;P=1;var _=N,k=Symbol.for("react.element"),w=Symbol.for("react.fragment"),S=Object.prototype.hasOwnProperty,j=_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O={key:!0,ref:!0,__self:!0,__source:!0};function v(c,o,m){var i,f={},p=null,g=null;m!==void 0&&(p=""+m),o.key!==void 0&&(p=""+o.key),o.ref!==void 0&&(g=o.ref);for(i in o)S.call(o,i)&&!O.hasOwnProperty(i)&&(f[i]=o[i]);if(c&&c.defaultProps)for(i in o=c.defaultProps,o)f[i]===void 0&&(f[i]=o[i]);return{$$typeof:k,type:c,key:p,ref:g,props:f,_owner:j.current}}return l.Fragment=w,l.jsx=v,l.jsxs=v,l}var D={},T;function yr(){return T||(T=1),D}E.exports=F();var I=E.exports;export{I as j};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{useRef as i,useEffect as f}from"react";import{animate as m}from"framer-motion";function p({from:r,to:n,duration:o=1,map:t}){const e=i(null),u=i(null);return f(()=>{const s=e.current;if(!s)return;const a=m(r,n,{duration:o,onUpdate(c){s.textContent=String(t?t(c):c)}});return u.current=a,()=>{a.stop()}},[r,n,t,o]),{ref:e,controls:u}}export{p as u};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{useRef as y,useInsertionEffect as O,useCallback as w,useState as d,useId as C,useEffect as m,useLayoutEffect as x}from"react";function k(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 A({type:e="text/plain"}){return{copy:async t=>{var o;if((o=navigator.clipboard)!=null&&o.write){const n={};switch(e){case"text/html":n["text/plain"]=new Blob([t],{type:"text/plain"}),n[e]=new Blob([t],{type:e});break;default:n[e]=new Blob([t],{type:e})}const s=[new ClipboardItem(n)];await navigator.clipboard.write(s)}else{const n=document.createElement("textarea");t instanceof Blob?n.value=await t.text():n.value=t.toString(),n.select(),document.execCommand("copy")}}}}function b(e,t=[]){const o=y(()=>{throw new Error("Cannot call an event handler while rendering.")});return O(()=>{o.current=e}),w((...n)=>{var s;return(s=o.current)==null?void 0:s.call(o,...n)},t)}function B(e={}){const{onClose:t,onOpen:o,open:n,id:s}=e,r=b(o),i=b(t),[u,l]=d(e.defaultOpen??!1),c=n??u,a=n!==void 0,g=C(),f=s??`disclosure-${g}`,v=w(()=>{a||l(!1),i?.()},[a,i]),h=w(()=>{a||l(!0),r?.()},[a,r]),E=w(()=>{c?v():h()},[c,h,v]);function S(p={}){return{...p,"aria-expanded":c,"aria-controls":f,onClick(L){var I;(I=p.onClick)==null||I.call(p,L),E()}}}function T(p={}){return{...p,hidden:!c,id:f}}return{open:c,onOpen:h,onClose:v,onToggle:E,isControlled:a,getButtonProps:S,getDisclosureProps:T}}function z(e){return new URLSearchParams(e??window.location.search)}function D(e,t=250){const[o,n]=d(e);return m(()=>{const s=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(s)}},[e,t]),o}function U(e,t={removeOnUnmount:!1}){const[o,n]=d("loading"),s=y(t);return m(()=>{let r=document.querySelector(`script[src="${e}"]`);const i=r?.getAttribute("data-status");if(i){n(i);return}if(r===null){r=document.createElement("script"),r.src=e,r.async=!0,r.setAttribute("data-status","loading"),document.body.appendChild(r);const u=()=>{r?.setAttribute("data-status","ready"),n("ready"),c()},l=()=>{r?.setAttribute("data-status","error"),n("error"),c()},c=()=>{r?.removeEventListener("load",u),r?.removeEventListener("error",l)};r.addEventListener("load",u),r.addEventListener("error",l);const a=s.current.removeOnUnmount;return()=>{a&&(r?.remove(),c())}}else n("unknown")},[e]),o}function W(e,t=500){const[o,n]=d(e),s=y(Date.now());return m(()=>{const r=Date.now(),i=r-s.current;if(i>=t)s.current=r,n(e);else{const u=t-i,l=window.setTimeout(()=>{s.current=Date.now(),n(e)},u);return()=>{window.clearTimeout(l)}}},[e,t]),o}function j(e){const[t,o]=d(()=>typeof e=="boolean"?e:!!e),n=w(s=>{if(typeof s=="boolean"){o(s);return}o(r=>!r)},[]);return[t,n]}function P(){const[e,t]=d({x:0,y:0}),o=w((...n)=>{if(n.length===1&&typeof n[0]=="object")window.scrollTo(n[0]);else if(n.length===2)window.scrollTo(n[0],n[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 x(()=>{const n=()=>{t({x:window.scrollX,y:window.scrollY})};return n(),window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}},[]),{...e,scrollTo:o}}function H(){const[e,t]=d({width:window.innerWidth,height:window.innerHeight});return x(()=>{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:n="0%",freezeOnceVisible:s=!1}={}){const[r,i]=d({isIntersecting:!1,entry:null});return m(()=>{const u=e?.current;let l;if(u){if(s&&r.isIntersecting)return;const c=g=>{const[f]=g;i({isIntersecting:f.isIntersecting,entry:f})},a=new IntersectionObserver(c,{threshold:t,root:o,rootMargin:n});a.observe(u),l=()=>{a.disconnect()}}return()=>{l&&l()}},[e,t,o,n,s,r.isIntersecting]),r}export{A as a,B as b,b as c,z as d,D as e,U as f,W as g,j as h,P as i,H as j,J as k,k as u};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@verifiedinc-public/shared-ui-elements",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.0",
|
4
4
|
"description": "A set of UI components, utilities that is shareable with the core apps.",
|
5
5
|
"private": false,
|
6
6
|
"keywords": [],
|
@@ -23,6 +23,10 @@
|
|
23
23
|
"types": "./dist/components/index.d.ts",
|
24
24
|
"import": "./dist/components/index.mjs"
|
25
25
|
},
|
26
|
+
"./components/*": {
|
27
|
+
"types": "./dist/components/*/index.d.ts",
|
28
|
+
"import": "./dist/components/*/index.mjs"
|
29
|
+
},
|
26
30
|
"./hooks": {
|
27
31
|
"types": "./dist/hooks/index.d.ts",
|
28
32
|
"import": "./dist/hooks/index.mjs"
|
@@ -60,13 +64,6 @@
|
|
60
64
|
},
|
61
65
|
"devDependencies": {
|
62
66
|
"@chromatic-com/storybook": "^2.0.2",
|
63
|
-
"@emotion/react": "^11.11.4",
|
64
|
-
"@emotion/styled": "^11.11.5",
|
65
|
-
"@fontsource/lato": "^5.0.21",
|
66
|
-
"@fontsource/material-icons": "^5.0.18",
|
67
|
-
"@mona-health/react-input-mask": "^3.0.3",
|
68
|
-
"@mui/icons-material": "^5",
|
69
|
-
"@mui/material": "^5",
|
70
67
|
"@storybook/addon-essentials": "^8.3.1",
|
71
68
|
"@storybook/addon-interactions": "^8.3.1",
|
72
69
|
"@storybook/addon-links": "^8.3.1",
|
@@ -95,9 +92,7 @@
|
|
95
92
|
"eslint-plugin-storybook": "^0.8.0",
|
96
93
|
"eslint-plugin-vitest": "^0.0.53",
|
97
94
|
"jsdom": "^24.1.0",
|
98
|
-
"libphonenumber-js": "^1.11.11",
|
99
95
|
"prettier": "^3.1.0",
|
100
|
-
"qrcode": "^1.5.4",
|
101
96
|
"react": "^18",
|
102
97
|
"react-dnd": "^16.0.1",
|
103
98
|
"react-dnd-html5-backend": "^16.0.1",
|
@@ -109,9 +104,7 @@
|
|
109
104
|
"tsx": "^3.12.4",
|
110
105
|
"typescript": "^5.2.2",
|
111
106
|
"vite-plugin-dts": "^4.3.0",
|
112
|
-
"vitest": "^1.6.0"
|
113
|
-
"zod": "^3.23.8",
|
114
|
-
"notistack": "^3.0.1"
|
107
|
+
"vitest": "^1.6.0"
|
115
108
|
},
|
116
109
|
"peerDependencies": {
|
117
110
|
"@emotion/react": "^11.11.4",
|
@@ -122,6 +115,7 @@
|
|
122
115
|
"@mui/icons-material": "^5 || ^6",
|
123
116
|
"@mui/material": "^5 || ^6",
|
124
117
|
"libphonenumber-js": "^1.11.11",
|
118
|
+
"notistack": "^3.0.1",
|
125
119
|
"qrcode": "^1.5.4",
|
126
120
|
"react": "^18",
|
127
121
|
"react-dnd": "^16.0.1",
|
@@ -130,6 +124,6 @@
|
|
130
124
|
"react-hook-form": "^7.52.1",
|
131
125
|
"react-imask": "^7.6.1",
|
132
126
|
"zod": "^3.23.8",
|
133
|
-
"
|
127
|
+
"framer-motion": ">=11.15.0"
|
134
128
|
}
|
135
129
|
}
|