@verifiedinc-public/shared-ui-elements 1.3.3 → 2.0.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.
Files changed (116) hide show
  1. package/README.md +3 -29
  2. package/dist/components/index.mjs +1 -0
  3. package/dist/hooks/index.mjs +1 -0
  4. package/dist/index.mjs +1 -0
  5. package/dist/shared/index-CTvz4BbG.mjs +105 -0
  6. package/dist/shared/phone.schema-XBbyizhq.mjs +1 -0
  7. package/dist/shared/shadows-fgmuXym6.mjs +1 -0
  8. package/dist/shared/unix.schema-CMYTtXco.mjs +1 -0
  9. package/dist/shared/useQRCode-DXiPIj-D.mjs +1 -0
  10. package/dist/shared/useSearchParams-CW9y02Ym.mjs +1 -0
  11. package/dist/styles/index.mjs +1 -0
  12. package/dist/utils/masks/index.mjs +1 -0
  13. package/dist/utils/string/index.mjs +1 -0
  14. package/dist/validations/index.mjs +1 -0
  15. package/package.json +29 -8
  16. package/dist/shared-ui-elements.mjs +0 -105
  17. package/src/components/Alert/Alert.tsx +0 -8
  18. package/src/components/Alert/FullWidthAlert.tsx +0 -27
  19. package/src/components/Alert/index.ts +0 -2
  20. package/src/components/Backdrop/index.tsx +0 -34
  21. package/src/components/Banners/Banner.tsx +0 -42
  22. package/src/components/Banners/ExactBirthdayBanner.tsx +0 -18
  23. package/src/components/Banners/ResendPhoneBanner.tsx +0 -55
  24. package/src/components/Banners/TestPhoneNumbersBanner.tsx +0 -25
  25. package/src/components/Banners/index.tsx +0 -4
  26. package/src/components/Button/index.tsx +0 -8
  27. package/src/components/CredentialRequestsEditor/CredentialRequestsEditor.context.tsx +0 -98
  28. package/src/components/CredentialRequestsEditor/components/CredentialRequestsField.tsx +0 -103
  29. package/src/components/CredentialRequestsEditor/components/DataFieldAccordion.tsx +0 -337
  30. package/src/components/CredentialRequestsEditor/components/DataFieldDeleteModal.tsx +0 -64
  31. package/src/components/CredentialRequestsEditor/components/DataFieldDescription.tsx +0 -68
  32. package/src/components/CredentialRequestsEditor/components/DataFieldMandatory.tsx +0 -84
  33. package/src/components/CredentialRequestsEditor/components/DataFieldMulti.tsx +0 -74
  34. package/src/components/CredentialRequestsEditor/components/DataFieldOptionType.tsx +0 -84
  35. package/src/components/CredentialRequestsEditor/components/DataFieldSection.tsx +0 -48
  36. package/src/components/CredentialRequestsEditor/components/DataFieldUserInput.tsx +0 -71
  37. package/src/components/CredentialRequestsEditor/components/RadioOption.tsx +0 -89
  38. package/src/components/CredentialRequestsEditor/contexts/CredentialRequestFieldContext.tsx +0 -36
  39. package/src/components/CredentialRequestsEditor/index.tsx +0 -15
  40. package/src/components/CredentialRequestsEditor/types/compositeCredentialSchema.ts +0 -1
  41. package/src/components/CredentialRequestsEditor/types/credentialSchemasDto.ts +0 -3
  42. package/src/components/CredentialRequestsEditor/types/form.ts +0 -28
  43. package/src/components/CredentialRequestsEditor/types/mandatoryEnum.ts +0 -5
  44. package/src/components/CredentialRequestsEditor/utils/buildDataFieldValue.ts +0 -65
  45. package/src/components/CredentialRequestsEditor/utils/prettyField.ts +0 -16
  46. package/src/components/Image.tsx +0 -10
  47. package/src/components/QRCodeDisplay/index.tsx +0 -50
  48. package/src/components/RequiredLabel/index.tsx +0 -15
  49. package/src/components/Snackbar/index.tsx +0 -156
  50. package/src/components/TextField/index.tsx +0 -8
  51. package/src/components/Tip/index.tsx +0 -18
  52. package/src/components/Typography/index.tsx +0 -8
  53. package/src/components/When.tsx +0 -28
  54. package/src/components/form/CountrySelector.tsx +0 -96
  55. package/src/components/form/DataFieldClearAdornment.tsx +0 -28
  56. package/src/components/form/DateInput.tsx +0 -78
  57. package/src/components/form/DefaultInput.tsx +0 -26
  58. package/src/components/form/InputMask.tsx +0 -41
  59. package/src/components/form/OTPInput.tsx +0 -254
  60. package/src/components/form/PhoneInput.tsx +0 -152
  61. package/src/components/form/SSNInput.tsx +0 -99
  62. package/src/components/form/SelectInput.tsx +0 -101
  63. package/src/components/form/TextMaskCustom.tsx +0 -48
  64. package/src/components/form/index.ts +0 -5
  65. package/src/components/index.ts +0 -13
  66. package/src/components/terms/AcceptTermsNotice.tsx +0 -27
  67. package/src/components/terms/LegalLink.tsx +0 -22
  68. package/src/components/verified/VerifiedImage.tsx +0 -272
  69. package/src/components/verified/VerifiedIncLogo.tsx +0 -11
  70. package/src/components/verified/index.ts +0 -2
  71. package/src/hooks/index.ts +0 -6
  72. package/src/hooks/useCallbackRef.ts +0 -22
  73. package/src/hooks/useCopyToClipboard.ts +0 -76
  74. package/src/hooks/useDisclosure.ts +0 -96
  75. package/src/hooks/useLocalStorage.ts +0 -24
  76. package/src/hooks/usePrevious.ts +0 -17
  77. package/src/hooks/useQRCode.ts +0 -62
  78. package/src/hooks/useSearchParams.ts +0 -7
  79. package/src/index.ts +0 -13
  80. package/src/stories/components/Alert.stories.tsx +0 -41
  81. package/src/stories/components/Button.stories.ts +0 -49
  82. package/src/stories/components/CredentialRequestsEditor.stories.tsx +0 -98
  83. package/src/stories/components/QRCodeDisplay.stories.tsx +0 -60
  84. package/src/stories/components/TextField.stories.ts +0 -59
  85. package/src/stories/components/Typography.stories.ts +0 -140
  86. package/src/stories/components/VerifiedImage.stories.tsx +0 -32
  87. package/src/stories/components/form/DateInput.stories.ts +0 -36
  88. package/src/stories/components/form/OTPInput.stories.tsx +0 -90
  89. package/src/stories/components/form/PhoneInput.stories.tsx +0 -34
  90. package/src/stories/components/form/SSNInput.stories.ts +0 -30
  91. package/src/stories/components/form/SelectInput.stories.ts +0 -39
  92. package/src/stories/hooks/useCopyToClipboard.stories.tsx +0 -45
  93. package/src/styles/colors.ts +0 -60
  94. package/src/styles/index.ts +0 -3
  95. package/src/styles/shadows.ts +0 -6
  96. package/src/styles/theme.ts +0 -257
  97. package/src/styles/typography.ts +0 -86
  98. package/src/utils/date.ts +0 -32
  99. package/src/utils/index.ts +0 -6
  100. package/src/utils/masks/index.ts +0 -6
  101. package/src/utils/omitProperty.ts +0 -19
  102. package/src/utils/phone.ts +0 -76
  103. package/src/utils/ssn.ts +0 -8
  104. package/src/utils/string/index.ts +0 -2
  105. package/src/utils/string/toCapitalize.ts +0 -13
  106. package/src/utils/string/toSentenceCase.ts +0 -7
  107. package/src/utils/wrapPromise.ts +0 -19
  108. package/src/validations/date.schema.ts +0 -18
  109. package/src/validations/description.schema.ts +0 -5
  110. package/src/validations/email.schema.ts +0 -3
  111. package/src/validations/field.schema.ts +0 -3
  112. package/src/validations/index.ts +0 -8
  113. package/src/validations/phone.schema.ts +0 -6
  114. package/src/validations/ssn.schema.ts +0 -24
  115. package/src/validations/state.schema.ts +0 -3
  116. package/src/validations/unix.schema.ts +0 -11
@@ -0,0 +1 @@
1
+ "use strict";import*as o from"zod";const r=o.string().refine(i=>/\+1\d{3}\d{3}\d{4}/.test(i),"Phone is invalid");export{r as p};
@@ -0,0 +1 @@
1
+ "use strict";import{colors as t,createTheme as C}from"@mui/material";const i="rgba(0,0,0,0.26)",r="#ffffff",a="#000000",n="#0dbc3d",o="#5ef06d",l="#008a01",g="#164fd6",s="#657bff",d="#0028a3",h="#eb0d28",f="#ff5952",p="#b00000",m="#F5D328",u="#5ef06d",y="#bea008",c="#625410",b="#09225E",x="#F9F9FB",S="#bdbdbd",k="#797979",W=t.grey[400],w=t.grey[500],z=t.grey[600],e={textDisabled:i,white:r,black:a,green:n,lightGreen:o,darkGreen:l,blue:g,lightBlue:s,darkBlue:d,red:h,lightRed:f,darkRed:p,yellow:m,lightYellow:u,darkYellow:y,warningContrast:c,infoContrast:b,lightGrey:x,grey:S,darkGrey:k,lightGreyContrast:W,greyContrast:w,darkGreyContrast:z},M={h1:{fontSize:"2.125rem",fontWeight:700,letterSpacing:0,lineHeight:1.35},h2:{fontSize:"1.5rem",fontWeight:700,letterSpacing:0,lineHeight:1.33},h3:{fontSize:"1.25rem",fontWeight:700,letterSpacing:0,lineHeight:1.35},h4:{fontSize:"1.25rem",fontWeight:700,letterSpacing:0,lineHeight:1.2},h5:{fontSize:"1rem",fontWeight:700,letterSpacing:0,lineHeight:1.1875},h6:{fontSize:"1rem",fontWeight:700,letterSpacing:"0.15px"},subtitle1:{fontSize:"1rem",fontWeight:700,letterSpacing:0,lineHeight:1.1875},subtitle2:{fontSize:"0.875rem",fontWeight:700,letterSpacing:.1,lineHeight:1.5},body1:{fontSize:"1.25rem",fontWeight:300,letterSpacing:0,lineHeight:1.2},body2:{fontSize:"1rem",fontWeight:400,letterSpacing:0,lineHeight:1.1875},button:{fontWeight:700,letterSpacing:0,lineHeight:1.2,textTransform:"uppercase"},caption:{fontSize:"0.75rem",fontWeight:400,letterSpacing:0,lineHeight:1.25},overline:{fontSize:"0.75rem",fontWeight:400,letterSpacing:0,lineHeight:1.25},label:{fontSize:"0.75rem",fontWeight:700,letterSpacing:1,textTransform:"uppercase"}},T=({primaryFontFace:v})=>C({breakpoints:{values:{xs:0,sm:600,md:900,lg:1200,xl:1536}},typography:{fontFamily:v.style.fontFamily,...M},palette:{text:{disabled:e.textDisabled},primary:{main:e.green,light:e.lightGreen,dark:e.darkGreen,contrastText:e.white},secondary:{main:e.blue,light:e.lightBlue,dark:e.darkBlue,contrastText:e.white},error:{main:e.red,light:e.lightRed,dark:e.darkRed,contrastText:e.white},warning:{main:e.yellow,light:e.yellow,dark:e.darkYellow,contrastText:e.white},success:{main:e.green,light:e.green,dark:e.darkGreen,contrastText:e.white},info:{main:e.blue,light:e.lightBlue,dark:e.darkBlue,contrastText:e.infoContrast},neutral:{main:e.grey,light:e.lightGrey,dark:e.darkGrey},neutralContrast:{main:e.greyContrast,light:e.lightGreyContrast,dark:e.darkGreyContrast},warningContrast:{main:e.warningContrast},infoContrast:{main:e.infoContrast}},components:{MuiAlert:{styleOverrides:{action:{overflowWrap:"normal",display:"flex",alignItems:"center",padding:"8px 0",marginRight:0,"& button, & a":{lineHeight:"0"}}}},MuiAlertTitle:{styleOverrides:{root:{...M.body2,fontSize:"1.1rem",fontWeight:700}}},MuiListItemIcon:{styleOverrides:{root:{minWidth:34}}},MuiListItemText:{styleOverrides:{primary:{fontWeight:800}}},MuiFab:{styleOverrides:{circular:{width:42,height:42},sizeSmall:{width:40,height:40}}},MuiIconButton:{styleOverrides:{root:{"&.Mui-disabled":{svg:{opacity:.4}}}}},MuiButton:{styleOverrides:{root:{fontWeight:800}}},MuiDialog:{defaultProps:{maxWidth:"xs"}},MuiDialogTitle:{styleOverrides:{root:{fontSize:20,fontWeight:800,textAlign:"center"}}},MuiDialogContent:{styleOverrides:{root:{paddingTop:"8px!important",paddingBottom:8}}},MuiDialogActions:{styleOverrides:{root:{paddingLeft:24,paddingRight:24,paddingBottom:24,justifyContent:"space-between","& .MuiButton-root":{marginTop:0}}}},MuiRadio:{styleOverrides:{root:{"&.Mui-disabled":{color:`${e.grey} !important`}}}},MuiTableRow:{styleOverrides:{root:{"& th.MuiTableCell-root":{fontSize:12,fontWeight:700,letterSpacing:1},"& td.MuiTableCell-root":{fontSize:20,fontWeight:300}}}},MuiTextField:{defaultProps:{variant:"outlined",size:"small"}}}}),H="0px -2px 4px -1px rgba(0,0,0,0.2), 0px -4px 5px 0px rgba(0,0,0,0.14), 0px -1px 10px 0px rgba(0,0,0,0.12)",B={bottomSheet:H};export{g as a,a as b,s as c,l as d,d as e,f,n as g,p as h,u as i,y as j,c as k,o as l,b as m,x as n,S as o,k as p,W as q,h as r,w as s,i as t,z as u,e as v,r as w,T as x,m as y,B as z};
@@ -0,0 +1 @@
1
+ "use strict";import*as n from"zod";import{z as t}from"zod";const r=n.string().refine(s=>{if(/^\d{2}\/\d{2}\/\d{4}$/.test(s)){const e=Date.parse(String(new Date(s)));return!isNaN(e)}return!1},"Date is invalid"),a=s=>n.date().refine(e=>e.getTime()<Date.now(),{message:s}),d=n.string().min(3,"Must have enough description"),g=t.string().email(),m=t.string().min(1),o=t.string().regex(/^(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}$/),f=t.string().refine(s=>{const e=/^•••-••-(\d{4})$/,i=/^(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}$/;return e.test(s)||i.test(s)},{message:"Invalid SSN"}),l=t.string().min(2).max(2),p=(s="Invalid Unix string timestamp")=>t.string().refine(e=>/^\d+$/.test(e)&&!isNaN(Number(e))&&e.length>=10&&e.length<=13,s);export{f as M,o as S,r as U,p as a,d,g as e,m as f,a as g,l as s};
@@ -0,0 +1 @@
1
+ "use strict";import{useMemo as $}from"react";import*as f from"qrcode";function u(t){const r=$(()=>f.create(t.data),[t.data]).modules.data;return $(()=>{const s=t.size/Math.sqrt(r.length);let i=`<svg viewBox="0 0 ${t.size} ${t.size}" xmlns="http://www.w3.org/2000/svg">`;const a=t.imageSize,n=(t.size-a)/2,h=(t.size-a)/2;for(let o=0;o<r.length;o++){const e=o%Math.sqrt(r.length)*s,l=Math.floor(o/Math.sqrt(r.length))*s,g=s/2,m=r[o]===1,c=e+s>=n&&e<n+a&&l+s>=h&&l<h+a;!m||c||(i+=`<rect x="${e}" y="${l}" width="${s}" height="${s}" rx="${g}" ry="${g}" fill='${t.fill||"#000000"}' />`)}return i+="</svg>",i},[r,t])}export{u};
@@ -0,0 +1 @@
1
+ "use strict";import{useRef as S,useInsertionEffect as I,useCallback as s,useState as B,useId as O}from"react";function k(n){return{set:e=>{const r=typeof e=="string"?e:JSON.stringify(e);localStorage.setItem(n,r)},get:()=>{const e=localStorage.getItem(n);if(e)try{return JSON.parse(e)}catch{return e}return null},remove:()=>{localStorage.removeItem(n)}}}function P({type:n="text/plain"}){return{copy:async e=>{var r;if((r=navigator.clipboard)!=null&&r.write){const t={};switch(n){case"text/html":t["text/plain"]=new Blob([e],{type:"text/plain"}),t[n]=new Blob([e],{type:n});break;default:t[n]=new Blob([e],{type:n})}const o=[new ClipboardItem(t)];await navigator.clipboard.write(o)}else{const t=document.createElement("textarea");e instanceof Blob?t.value=await e.text():t.value=e.toString(),t.select(),document.execCommand("copy")}}}}function f(n,e=[]){const r=S(()=>{throw new Error("Cannot call an event handler while rendering.")});return I(()=>{r.current=n}),s((...t)=>{var o;return(o=r.current)==null?void 0:o.call(r,...t)},e)}function E(n={}){const{onClose:e,onOpen:r,open:t,id:o}=n,i=f(r),u=f(e),[b,g]=B(n.defaultOpen??!1),a=t??b,l=t!==void 0,y=O(),m=o??`disclosure-${y}`,p=s(()=>{l||g(!1),u?.()},[l,u]),d=s(()=>{l||g(!0),i?.()},[l,i]),w=s(()=>{a?p():d()},[a,d,p]);function x(c={}){return{...c,"aria-expanded":a,"aria-controls":m,onClick(h){var v;(v=c.onClick)==null||v.call(c,h),w()}}}function C(c={}){return{...c,hidden:!a,id:m}}return{open:a,onOpen:d,onClose:p,onToggle:w,isControlled:l,getButtonProps:x,getDisclosureProps:C}}function J(n){return new URLSearchParams(n??window.location.search)}export{P as a,E as b,f as c,J as d,k as u};
@@ -0,0 +1 @@
1
+ "use strict";import{b as a,a as s,v as e,e as r,d as t,p as l,u as o,h as d,j as i,g as n,o as g,s as h,m as k,c as y,l as w,n as G,q as C,f as b,i as m,r as u,z as c,t as f,x as p,k as x,w as B,y as R}from"../shared/shadows-fgmuXym6.mjs";export{a as black,s as blue,e as colors,r as darkBlue,t as darkGreen,l as darkGrey,o as darkGreyContrast,d as darkRed,i as darkYellow,n as green,g as grey,h as greyContrast,k as infoContrast,y as lightBlue,w as lightGreen,G as lightGrey,C as lightGreyContrast,b as lightRed,m as lightYellow,u as red,c as shadows,f as textDisabled,p as theme,x as warningContrast,B as white,R as yellow};
@@ -0,0 +1 @@
1
+ "use strict";const s={DOB_MASK:"99/99/9999"};export{s as masks};
@@ -0,0 +1 @@
1
+ "use strict";function a(e){return e.split(" ").map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1).toLowerCase()}`).join(" ")}function o(e){return`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()}`}export{a as toCapitalize,o as toSentenceCase};
@@ -0,0 +1 @@
1
+ "use strict";import{M as a,S as s,U as e,d as m,e as S,f as t,g as h,a as c,s as i}from"../shared/unix.schema-CMYTtXco.mjs";import{p as o}from"../shared/phone.schema-XBbyizhq.mjs";export{a as MaskedAndUnmaskedSSNSchema,s as SSNSchema,e as USDateSchema,m as descriptionSchema,S as emailSchema,t as fieldSchema,h as getDateSchemaWithPastValidation,c as getUnixSchema,o as phoneSchema,i as stateSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "1.3.3",
3
+ "version": "2.0.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "keywords": [],
@@ -9,19 +9,40 @@
9
9
  "node": ">=20.10.0",
10
10
  "npm": ">=10.x.x"
11
11
  },
12
- "main": "/dist/shared-ui-elements.mjs",
12
+ "main": "/dist/index.mjs",
13
13
  "types": "/dist/index.d.ts",
14
14
  "files": [
15
- "dist",
16
- "src"
15
+ "dist"
17
16
  ],
18
17
  "exports": {
19
18
  ".": {
20
19
  "types": "./dist/index.d.ts",
21
- "import": "./dist/shared-ui-elements.mjs",
22
- "require": "./dist/shared-ui-elements.mjs"
20
+ "import": "./dist/index.mjs"
23
21
  },
24
- "./src": "./src/index.ts"
22
+ "./components": {
23
+ "types": "./dist/components/index.d.ts",
24
+ "import": "./dist/components/index.mjs"
25
+ },
26
+ "./hooks": {
27
+ "types": "./dist/hooks/index.d.ts",
28
+ "import": "./dist/hooks/index.mjs"
29
+ },
30
+ "./styles": {
31
+ "types": "./dist/styles/index.d.ts",
32
+ "import": "./dist/styles/index.mjs"
33
+ },
34
+ "./validations": {
35
+ "types": "./dist/validations/index.d.ts",
36
+ "import": "./dist/validations/index.mjs"
37
+ },
38
+ "./utils": {
39
+ "types": "./dist/utils/index.d.ts",
40
+ "import": "./dist/utils/index.mjs"
41
+ },
42
+ "./utils/*": {
43
+ "types": "./dist/utils/*/index.d.ts",
44
+ "import": "./dist/utils/*/index.mjs"
45
+ }
25
46
  },
26
47
  "scripts": {
27
48
  "vitest": "vitest",
@@ -33,7 +54,7 @@
33
54
  "storybook": "storybook dev -p 6006",
34
55
  "build-storybook": "storybook build",
35
56
  "prebuild": "rm -rf dist",
36
- "build": "tsc && vite build && esbuild dist/shared-ui-elements.mjs --minify --outfile=dist/shared-ui-elements.mjs --allow-overwrite",
57
+ "build": "tsc && vite build && find dist -name '*.mjs' -type f -exec esbuild {} --minify --outfile={} --allow-overwrite \\;",
37
58
  "prepublishOnly": "npm run build",
38
59
  "publish:prerelease": "npm version prerelease --preid=beta && npm publish --tag beta"
39
60
  },