@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.
- package/dist/components/form/MemberIdInput.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/formats/ssn.format.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/validations/other/ssn.schema.d.ts +1 -1
- package/dist/components/form/NewOneClickForm/core/validations/other/ssn.schema.mjs +1 -1
- package/dist/components/form/SSNInput.d.ts +1 -1
- package/dist/components/form/SSNInput.mjs +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useRef as
|
|
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
|
|
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
|
|
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
|
|
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};
|