@verifiedinc-public/shared-ui-elements 9.6.0 → 9.7.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.
@@ -1 +1 @@
1
- "use strict";import{useRef as m}from"react";import{Box as K,TextField as b}from"@mui/material";import{jsx as y}from"react/jsx-runtime";function M(n){return n.includes("*")||n.includes("\u2022")}function v(n){const t=n.replace(/\*/g,"\u2022");if(t.includes("\u2022"))return t;const s=t.length;return s<=2?t:s<5?"\u2022".repeat(s-2)+t.slice(-2):t.slice(0,2)+"\u2022".repeat(s-4)+t.slice(-2)}function P({onChange:n,label:t="Member ID",value:s,placeholder:k="",InputProps:g,...x}){const h=m(null),f=m(0),i=s??"",d=!M(i)&&(i===""||h.current===i),D=v(i);function a(e){h.current=e,n?.({target:{value:e}})}return y(K,{width:"100%",children:y(b,{...x,label:t,value:D,placeholder:k,onChange:e=>{const l=e.target.value,r=h.current??"",o=v(r),c=f.current;if(!d){a(l.replace(/•/g,""));return}let p;if(l.length>o.length){const u=l.slice(c,c+(l.length-o.length));p=r.slice(0,c)+u.replace(/•/g,"")+r.slice(c)}else if(l.length<o.length){const u=e.target.selectionStart??0,I=o.length-l.length;p=r.slice(0,u)+r.slice(u+I)}else{const u=l[c]??"";p=r.slice(0,c)+u+r.slice(c+1)}a(p)},inputProps:{onKeyDown:e=>{if(f.current=e.currentTarget.selectionStart??0,e.key==="Backspace"||e.key==="Delete"){e.preventDefault(),i!==""&&a("");return}d||e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),a(e.key))}},InputProps:{...g,endAdornment:g?.endAdornment},fullWidth:!0})})}export{P as MemberIdInput};
1
+ "use strict";import{useRef as v,useState as w}from"react";import{Box as z,TextField as A,InputAdornment as j,IconButton as C}from"@mui/material";import{VisibilityOff as F,Visibility as M}from"@mui/icons-material";import{jsx as u,jsxs as P,Fragment as T}from"react/jsx-runtime";function O(l){return l.includes("*")||l.includes("\u2022")}function k(l){const t=l.replace(/\*/g,"\u2022");if(t.includes("\u2022"))return t;const a=t.length;return a<=2?t:a<5?"\u2022".repeat(a-2)+t.slice(-2):t.slice(0,2)+"\u2022".repeat(a-4)+t.slice(-2)}function R({onChange:l,label:t="Member ID",value:a,placeholder:I="",InputProps:g,...D}){const h=v(null),m=v(0),[p,x]=w(!1),n=a??"",y=O(n),S=!y&&n.length>0,b=!y&&(n===""||h.current===n),B=p?n:k(n);function c(e){h.current=e,l?.({target:{value:e}})}return u(z,{width:"100%",children:u(A,{...D,label:t,value:B,placeholder:I,onChange:e=>{if(p){c(e.target.value);return}const r=e.target.value,i=h.current??"",f=k(i),s=m.current;if(!b){c(r.replace(/•/g,""));return}let d;if(r.length>f.length){const o=r.slice(s,s+(r.length-f.length));d=i.slice(0,s)+o.replace(/•/g,"")+i.slice(s)}else if(r.length<f.length){const o=e.target.selectionStart??0,K=f.length-r.length;d=i.slice(0,o)+i.slice(o+K)}else{const o=r[s]??"";d=i.slice(0,s)+o+i.slice(s+1)}c(d)},inputProps:{onKeyDown:e=>{if(m.current=e.currentTarget.selectionStart??0,p){(e.key==="Backspace"||e.key==="Delete")&&(e.preventDefault(),n!==""&&c(""));return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault(),n!==""&&c("");return}b||e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),c(e.key))}},InputProps:{...g,endAdornment:P(T,{children:[S&&u(j,{position:"end",children:u(C,{"aria-label":p?"hide member id":"show member id",edge:"end",size:"small",onClick:()=>x(e=>!e),tabIndex:-1,children:p?u(F,{fontSize:"small"}):u(M,{fontSize:"small"})})}),g?.endAdornment]})},fullWidth:!0})})}export{R as MemberIdInput};
@@ -1 +1 @@
1
- "use strict";const s=e=>e.replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{s as ssnFormat};
1
+ "use strict";const a=e=>e.replace(/\*/g,"\u2022").replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{a as ssnFormat};
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Validation schema for SSN field in forms
4
- * Supports both masked (•••-••-1234) and unmasked (123456789) formats
4
+ * Supports both masked (•••-••-1234 or ***-**-1234) and unmasked (123456789) formats
5
5
  */
6
6
  export declare const ssnSchema: z.ZodEffects<z.ZodString, string, string>;
@@ -1 +1 @@
1
- "use strict";import{z as t}from"zod";import{ssnRegex as e}from"../../../../../../utils/ssn.mjs";const i=t.string().refine(s=>/^•••-••-\d{4}$/.test(s)?!0:e.test(s),"Invalid SSN");export{i as ssnSchema};
1
+ "use strict";import{z as e}from"zod";import{ssnRegex as t}from"../../../../../../utils/ssn.mjs";const r=e.string().refine(s=>/^•••-••-\d{4}$/.test(s)||/^\*\*\*-\*\*-\d{4}$/.test(s)?!0:t.test(s),"Invalid SSN");export{r as ssnSchema};
@@ -19,4 +19,4 @@ export type SSNInputProps = TextFieldProps & {
19
19
  * This component manages the input of type SSN.
20
20
  * @constructor
21
21
  */
22
- export declare function SSNInput({ onChange, label, value, shouldHaveCloseAdornment, mask, placeholder, InputProps, ...rest }: SSNInputProps): import("react").JSX.Element;
22
+ export declare function SSNInput({ onChange, label, value, shouldHaveCloseAdornment, mask: maskProp, placeholder, InputProps, ...rest }: SSNInputProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use strict";import{Box as h,TextField as v}from"@mui/material";import{DataFieldClearAdornment as C}from"./DataFieldClearAdornment.mjs";import{TextMaskCustom as _}from"./TextMaskCustom.mjs";import{jsxs as f,Fragment as x,jsx as r}from"react/jsx-runtime";function k({onChange:e,label:o="Social Security number",value:l,shouldHaveCloseAdornment:u=!1,mask:i="XXX-XX-0000",placeholder:s="___-__-____",InputProps:a,...p}){const d=n=>{e?.({target:{value:n}})},t=()=>{d(""),e?.({target:{value:""}})},m={...p,label:o,value:l?.replace(/-/g,"")??"",onChange:((n,c)=>{if(!c)return;const g=l?.replace(/-/g,"")??"";if(n.target.value.replace(/-/g,"").length<g.length){e?.({target:{value:""}});return}e?.({target:{value:n.target.value}})}),placeholder:s,inputProps:{useOnComplete:!1,unmask:!0,lazy:!0,mask:i,definitions:{X:{mask:/[0-9•]/,displayChar:"\u2022"}},placeholderChar:"_",inputMode:"numeric",overwrite:!1,tabIndex:0},InputProps:{...a,inputComponent:_,endAdornment:f(x,{children:[!!u&&r(C,{onClick:t,handleClear:t}),a?.endAdornment]})},fullWidth:!0,sx:{"& input":{letterSpacing:"1px"}}};return r(h,{width:"100%",children:r(v,{...m})})}export{k as SSNInput};
1
+ "use strict";import{useState as b}from"react";import{InputAdornment as k,IconButton as S,Box as I,TextField as X}from"@mui/material";import{VisibilityOff as y,Visibility as A}from"@mui/icons-material";import{DataFieldClearAdornment as z}from"./DataFieldClearAdornment.mjs";import{TextMaskCustom as w}from"./TextMaskCustom.mjs";import{jsxs as F,Fragment as j,jsx as n}from"react/jsx-runtime";function B(e){return e.includes("*")||e.includes("\u2022")}function M(e){return e.replace(/\*/g,"\u2022")}function P({onChange:e,label:s="Social Security number",value:u,shouldHaveCloseAdornment:p=!1,mask:d="XXX-XX-0000",placeholder:m="___-__-____",InputProps:a,...c}){const[l,g]=b(!1),r=u??"",h=!B(r)&&r.replace(/-/g,"").length>0,o=M(r),f=l?"000-00-0000":d,v=t=>{e?.({target:{value:t}})},i=()=>{v(""),e?.({target:{value:""}})},C={...c,label:s,value:o.replace(/-/g,""),onChange:((t,x)=>{if(!x)return;const _=o.replace(/-/g,"");if(t.target.value.replace(/-/g,"").length<_.length){e?.({target:{value:""}});return}e?.({target:{value:t.target.value}})}),placeholder:m,inputProps:{useOnComplete:!1,unmask:!0,lazy:!0,mask:f,definitions:{X:{mask:/[0-9•]/,displayChar:"\u2022"}},placeholderChar:"_",inputMode:"numeric",overwrite:!1,tabIndex:0},InputProps:{...a,inputComponent:w,endAdornment:F(j,{children:[h&&n(k,{position:"end",children:n(S,{"aria-label":l?"hide ssn":"show ssn",edge:"end",size:"small",onClick:()=>g(t=>!t),tabIndex:-1,children:l?n(y,{fontSize:"small"}):n(A,{fontSize:"small"})})}),!!p&&n(z,{onClick:i,handleClear:i}),a?.endAdornment]})},fullWidth:!0,sx:{"& input":{letterSpacing:"1px"}}};return n(I,{width:"100%",children:n(X,{...C})})}export{P as SSNInput};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "9.6.0",
3
+ "version": "9.7.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,