@verifiedinc-public/shared-ui-elements 12.8.0 → 12.8.1
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{useState as
|
|
1
|
+
"use strict";import{useState as N}from"react";import{Stack as k,TextField as o,Box as x}from"@mui/material";import{AddressInput as I}from"../../../../../AddressInput/index.mjs";import{useFormField as q}from"../../../core/field.hook.mjs";import{RequiredLabel as v}from"../shared.mjs";import{useOneClickForm as F}from"../../form.context.mjs";import{jsxs as S,jsx as r}from"react/jsx-runtime";function D({fieldKey:h}){var n,u;const{options:m}=F(),{field:l,setValue:y}=q({key:h}),[P,b]=N({});if(!l)return null;const p=l.value;if(!p)return null;const a=p.employer,t=e=>{b(s=>s[e]?s:{...s,[e]:!0})},d=e=>{y({employer:{...a,...e}})},C=((u=(n=l.errors)==null?void 0:n.error)==null?void 0:u.issues)??[],i=e=>{var s;if(!(!l.touched&&!P[e]))return(s=C.find(z=>z.path[1]===e))==null?void 0:s.message},c=i("name"),f=i("legalName"),g=i("address");return S(k,{spacing:2,children:[r(o,{"data-testid":"data-field-atomic-employer.name",fullWidth:!0,size:"small",label:r(v,{required:l.isRequired,children:"Name"}),value:a.name??"",onChange:e=>{d({name:e.target.value}),t("name")},onBlur:()=>t("name"),error:!!c,helperText:c,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),r(o,{"data-testid":"data-field-atomic-employer.legalName",fullWidth:!0,size:"small",label:"Legal Name",value:a.legalName??"",onChange:e=>{d({legalName:e.target.value||void 0}),t("legalName")},onBlur:()=>t("legalName"),error:!!f,helperText:f,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}}),r(x,{"data-testid":"data-field-composite-employer.address",width:"100%",children:r(I,{size:"small",label:r(v,{required:l.isRequired,children:"Address"}),defaultValue:{line1:a.address.line1,city:a.address.city,state:a.address.state,zipCode:a.address.zipCode,country:a.address.country??"US"},onChange:e=>{if(typeof e=="string")return;const s={line1:e?.line1,line2:a.address.line2??"",city:e?.city,state:e?.state,zipCode:e?.zipCode,country:e?.country==="US"?"US":void 0};d({address:s}),t("address")},onBlur:()=>t("address"),error:!!g,helperText:g,disabled:l.isDisabled,InputProps:{"data-mask-me":!0},service:{googlePlacesAutocompletePlaces:m.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:m.servicePaths.googlePlacesGetPlace}})}),r(o,{"data-testid":"data-field-atomic-employer.address.line2",fullWidth:!0,size:"small",label:"Line 2",value:a.address.line2??"",onChange:e=>d({address:{...a.address,line2:e.target.value}}),disabled:l.isDisabled,InputProps:{"data-mask-me":!0},inputProps:{autoCorrect:"off"}})]})}export{D as EmployerInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Stack as
|
|
1
|
+
"use strict";import{Stack as o,MenuItem as u,Typography as m}from"@mui/material";import{useFormField as f}from"../../../core/field.hook.mjs";import{useOneClickForm as p}from"../../form.context.mjs";import{FieldSectionTitle as v,FieldSectionContent as y,FieldLabelBase as h}from"../style.mjs";import{VariantSelectField as g}from"./variantSelect.field.mjs";import{jsxs as n,jsx as a}from"react/jsx-runtime";import{addressFormat as b}from"../../../../core/formats/address.format.mjs";function s({label:e,value:r,testId:i,fieldValue:t}){return n(o,{direction:"row","data-testid":i,"data-verified-sdk-field-value":t,children:[a(h,{label:e}),a(m,{"data-mask-me":!0,variant:"body1",sx:{fontSize:20,fontWeight:300,wordBreak:"break-word",textAlign:"left"},children:r})]})}function c({item:e}){const{options:r}=p(),i=b(e.address),t=l=>r.features.enableUserPrivacy?void 0:l??void 0;return n(o,{spacing:1.25,children:[a(s,{label:"Name",value:e.name,testId:"data-field-atomic-employer.name",fieldValue:t(e.name)}),e.legalName&&a(s,{label:"Legal Name",value:e.legalName,testId:"data-field-atomic-employer.legalName",fieldValue:t(e.legalName)}),a(s,{label:"Address",value:i??"-",testId:"data-field-composite-employer.address",fieldValue:t(i)})]})}function F({fieldKey:e}){var r;const{field:i}=f({key:e});if(!i)return null;if(!i.hasVariants){const l=(r=i.value)==null?void 0:r.employer;return l?n(o,{spacing:1.25,children:[a(v,{fieldKey:e}),a(y,{spacing:1.25,children:a(c,{item:l})})]}):null}const t=i.variants??[];return a(g,{fieldKey:e,testId:`data-employer-select-${e}`,renderValue:()=>{var l;const d=(l=i.value)==null?void 0:l.employer;return d?a(c,{item:d}):null},children:t.map(l=>a(u,{value:l.id,onClick:d=>d.stopPropagation(),sx:{maxWidth:"100%",whiteSpace:"pre-wrap"},children:a(m,{variant:"body1",fontWeight:500,children:l.displayValue??"-"})},l.id))})}export{F as EmployerField};
|