@verifiedinc-public/shared-ui-elements 12.1.0 → 12.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/form/AddressInput/index.d.ts +1 -0
- package/dist/components/form/AddressInput/index.mjs +1 -1
- package/dist/components/form/NewOneClickForm/core/form/formFieldBuilder.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/core/form.context.d.ts +1 -0
- package/dist/components/form/NewOneClickForm/react/core/form.context.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/address.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/date.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/healthInsurance.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/phone.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/select.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/ssn.field.mjs +1 -1
- package/dist/components/form/NewOneClickForm/react/ui/fields/input/text.field.mjs +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export type AddressInputProps = {
|
|
|
12
12
|
variant?: TextFieldProps['variant'];
|
|
13
13
|
size?: TextFieldProps['size'];
|
|
14
14
|
helperText?: TextFieldProps['helperText'];
|
|
15
|
+
onBlur?: TextFieldProps['onBlur'];
|
|
15
16
|
inputProps?: TextFieldProps['inputProps'];
|
|
16
17
|
InputProps?: TextFieldProps['InputProps'];
|
|
17
18
|
ClearAdornment?: ComponentType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Box as d,Autocomplete as
|
|
1
|
+
"use strict";import{Box as d,Autocomplete as T,Typography as k,TextField as j,useTheme as S,Paper as V}from"@mui/material";import u from"@mui/material/Unstable_Grid2";import{useDataFieldAddressInput as F}from"./hook.mjs";import{AddressInputProvider as G}from"./context.mjs";import{jsx as t,jsxs as z}from"react/jsx-runtime";function B(o){const n=S();return z(V,{...o,children:[o.children,t(d,{sx:a=>({display:"flex",justifyContent:"flex-end",p:1,pt:"1px",...a.applyStyles("dark",{opacity:.8})}),children:t("img",{src:n.palette.mode==="dark"?"https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-non-white3_hdpi.png":"https://maps.gstatic.com/mapfiles/api-3/images/powered-by-google-on-white3_hdpi.png",alt:"",width:"120",height:"14"})})]})}function D({defaultValue:o,onChange:n,label:a,error:c,disabled:i,variant:g,size:h,helperText:m,inputProps:f,InputProps:P,ClearAdornment:r,onBlur:x}){const{value:v,inputValue:b,suggestions:y,isPending:s,isFetchingPlace:p,handleInputChange:C,handleOptionChange:I,handleClear:w}=F({defaultValue:o,onChange:n});return t(d,{width:"100%",children:t(T,{disableClearable:!0,freeSolo:!0,isOptionEqualToValue:(e,l)=>e?.value===l?.value,getOptionLabel:e=>typeof e=="string"?e:e?.title,filterOptions:e=>e,options:s?[]:y.map(e=>({title:e.placePrediction.text.text??"",value:e.placePrediction.place??""})),autoComplete:!0,includeInputInList:!0,filterSelectedOptions:!0,noOptionsText:"No locations",value:v,inputValue:b,loading:s||p,disabled:p||i,onChange:(e,l)=>{e.preventDefault(),e.stopPropagation(),!i&&(!l||typeof l=="string"||I(l).catch(console.error))},onInputChange:(e,l)=>{C(l)},renderInput:e=>t(j,{id:e.id,disabled:e.disabled,label:a,variant:g,size:h,error:c,helperText:m,onBlur:x,inputProps:{...e.inputProps,tabIndex:0,autoCapitalize:"off",autoComplete:"street-address address-level2 address-level1 postal-code",...f},InputProps:{...e.InputProps,disableInjectingGlobalStyles:!0,endAdornment:r?t(r,{onClick:()=>{w()}}):void 0,...P},fullWidth:!0,multiline:!0}),renderOption:(e,l)=>{const{key:A,...O}=e;return t("li",{...O,children:t(u,{container:!0,sx:{alignItems:"flex-start"},children:t(u,{sx:{width:"100%",wordWrap:"break-word"},children:t(k,{variant:"body2",sx:{color:"text.secondary",textAlign:"left"},children:l?.title})})})},A)},PaperComponent:B})})}function L(o){const{service:n,...a}=o;return t(G,{googlePlacesAutocompletePlaces:n.googlePlacesAutocompletePlaces,googlePlacesGetPlace:n.googlePlacesGetPlace,children:t(D,{...a})})}export{L as AddressInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import h from"lodash/cloneDeep";import{z as d}from"zod";import{fields as m}from"../fields/index.mjs";import{FormField as y}from"./formField.mjs";import{normalizeCredentialType as b}from"./utils.mjs";import{fieldInputTypes as f}from"../fields/constants.mjs";function p(n){if(n instanceof d.ZodObject){const t=n.shape;return Object.fromEntries(Object.entries(t).map(([o,e])=>[o,p(e)]))}if(!(n instanceof d.ZodOptional||n instanceof d.ZodNullable)){if(n instanceof d.ZodEffects)return p(n.innerType());if(n instanceof d.ZodDefault)return n._def.defaultValue();if(n instanceof d.ZodLiteral)return n.value;if(n instanceof d.ZodString)return""}}class j{createFromCredential(t,o,e,a){var s;const u=m[t.type];if(!u)throw new Error(`Invalid credential type: ${t.type}`);const r=u.key;let i;if(u.characteristics.inputType===f.composite)if(t.value&&Object.keys(t.value).length>0)if(o&&Object.keys(o).length>0){const c={};Object.keys(o).forEach(l=>{l in t.value&&(c[l]=t.value[l])}),i=Object.keys(c).length>0?c:void 0}else i=t.value;else i=void 0;else i=(s=t.value)==null?void 0:s[r];return new y(t.uuid,i,i,u,{children:o,allowUserInput:e?.allowUserInput??!0,mandatory:e?.mandatory??"no",multi:e?.multi??!1,variants:a,description:e?.description})}createFromSchema(t,o){let e,a;const s={allowUserInput:t.allowUserInput??!0,mandatory:t.mandatory??"no",multi:t.multi??!1,description:t.description};if(o.characteristics.inputType===f.composite&&t.children){const r={};for(const i of t.children){const c=b(i.type),l=m[c];if(l){const v=this.createFromSchema(i,l);r[l.key]=v}}a=Object.keys(r).length>0?r:void 0}if(o.characteristics.inputType===f.composite)if(a&&Object.keys(a).length>0){const r={};Object.entries(a).forEach(([i,c])=>{r[i]=c.defaultValue}),e=r}else e=p(o.zodSchema);else e="";const u=typeof e=="object"&&e!==null?h(e):e;return new y(void 0,e,u,o,{children:a,allowUserInput:s.allowUserInput,mandatory:s.mandatory,multi:s.multi,variants:void 0,description:s.description})}}export{j as FormFieldBuilder};
|
|
@@ -12,6 +12,7 @@ export interface FormContextValue {
|
|
|
12
12
|
setFieldTouched: (path: string, touched: boolean) => void;
|
|
13
13
|
getField: (path: string) => FormField | undefined;
|
|
14
14
|
validateForm: () => boolean;
|
|
15
|
+
touchAllFields: () => void;
|
|
15
16
|
resetForm: () => void;
|
|
16
17
|
submitForm: () => Promise<void>;
|
|
17
18
|
replaceFieldWithVariant: (fieldPath: string, variantId: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as
|
|
1
|
+
"use strict";import{useState as T,useCallback as i,useContext as W,createContext as K}from"react";import{jsx as N}from"react/jsx-runtime";const O=K(null),q=()=>{const m=W(O);if(!m)throw new Error("useForm must be used within a FormProvider");return m},R=({children:m,form:x,onSubmit:h})=>{const[n,l]=T({form:x,isSubmitting:!1,isSubmitSuccess:!1}),s=i(e=>{var t;if(!n.form)return;const r=e.split(".");if(r.length===1){const a=r[0],w=n.form.fields[a];if(w)return w;for(const g of Object.values(n.form.fields))if(g.children){for(const E of Object.values(g.children))if(E.id===a)return E}return}const[o,...c]=r,f=n.form.fields[o];if(!(f!=null&&f.children))return;let u=f;for(const a of c){if(!((t=u?.children)!=null&&t[a]))return;u=u.children[a]}return u},[n.form]),b=i(()=>n.form?n.form.isValid:!1,[n.form]),y=i(e=>{l(t=>({...t,form:e}))},[]),j=i(e=>{if(!n.form)return null;const t=e.split(".");if(t.length<2)return null;const r=t.slice(0,-1).join("."),o=t[t.length-1],c=s(r);if(!c||c.schema.characteristics.inputType!=="composite")throw new Error(`Parent field not found: ${r}`);return{parentField:c,childKey:o}},[n.form,s]),S=i(e=>{if(!e.children)return{};const t={};return Object.entries(e.children).forEach(([r,o])=>{t[r]=o.value}),t},[]),v=i(e=>{const t=j(e);if(t){const{parentField:r}=t,o=S(r);r.value=Object.keys(o).length>0?o:{};const c=e.split(".");if(c.length>2){const f=c.slice(0,-1).join(".");v(f)}}},[j,S]),V=i((e,t)=>{const r=s(e);if(!r){console.warn(`Attempted to update non-existent field: ${e}`);return}r.value!==t&&(r.value=t,v(e),l(o=>o.form?{...o,form:o.form}:o))},[s,v]),P=i((e,t)=>{const r=s(e);if(!r){console.warn(`Attempted to set touched state for non-existent field: ${e}`);return}r.touched!==t&&(r.touched=t,l(o=>o.form?{...o,form:o.form}:o))},[s]),p=i(()=>{l(e=>{if(!e.form)return e;const t=r=>{r.touched=!0,r.children&&Object.values(r.children).forEach(t)};return Object.values(e.form.fields).forEach(t),{...e,form:e.form}})},[]),$=i(()=>{l(e=>{if(!e.form)return e;const t=r=>{r.value=r.defaultValue,r.touched=!1,r.children&&Object.values(r.children).forEach(t)};return Object.values(e.form.fields).forEach(t),{...e,isSubmitting:!1,isSubmitSuccess:!1}})},[]),F=i(e=>{l(t=>({...t,isSubmitting:e}))},[]),d=i(e=>{l(t=>({...t,isSubmitSuccess:e}))},[]),A=i(async()=>{if(n.form){if(!b()){p();return}F(!0),d(!1);try{h&&(await h(n.form),d(!0))}catch(e){console.error("Form submission failed:",e),d(!1)}finally{F(!1)}}},[n.form,h,b,p,F,d]),C=i((e,t)=>{l(r=>{if(!r.form)return console.warn("No form instance available"),r;const o=s(e);return o?(o.replaceWithVariant(t),{...r,form:r.form}):(console.warn(`Field ${e} not found`),r)})},[s]),k={state:n,setForm:y,updateFieldValue:V,setFieldTouched:P,getField:s,validateForm:b,touchAllFields:p,resetForm:$,submitForm:A,replaceFieldWithVariant:C};return N(O.Provider,{value:k,children:m})};export{R as FormProvider,q as useForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{AddressInput as
|
|
1
|
+
"use strict";import{AddressInput as k}from"../../../../../AddressInput/index.mjs";import{useFormField as A}from"../../../core/field.hook.mjs";import{useOneClickForm as b}from"../../form.context.mjs";import{FieldLabel as z}from"./label.mjs";import{ClearFieldAdornment as F}from"./clear-field-adornment.mjs";import{jsx as t}from"react/jsx-runtime";import{fieldInputTypes as I}from"../../../../core/fields/constants.mjs";function T({fieldKey:i}){var n,u,s,d,a,r;const{options:v}=b(),{field:e,setChildValue:o,setTouched:h}=A({key:i});if(e?.schema.characteristics.inputType!==I.composite)return null;const P=(n=e.errorMessage)==null?void 0:n.toLowerCase().startsWith("line 2"),c=(e.touched||e.isDirty)&&!!e.errors&&!P;return t(k,{label:t(z,{fieldKey:i}),helperText:c?e.errorMessage??e?.description:e?.description,error:c,onBlur:()=>h(!0),disabled:e.isDisabled,defaultValue:{line1:(u=e?.value)==null?void 0:u.line1,city:(s=e?.value)==null?void 0:s.city,state:(d=e?.value)==null?void 0:d.state,zipCode:(a=e?.value)==null?void 0:a.zipCode,country:((r=e?.value)==null?void 0:r.country)??"US"},onChange:l=>{var p,y,m,f,g;typeof l!="string"&&(l===null&&Object.keys(e?.value??{}).forEach(C=>{C!=="line2"&&o(C,"")}),typeof((p=e?.value)==null?void 0:p.line1)=="string"&&o("line1",l?.line1??""),typeof((y=e?.value)==null?void 0:y.city)=="string"&&o("city",l?.city??""),typeof((m=e?.value)==null?void 0:m.state)=="string"&&o("state",l?.state??""),typeof((f=e?.value)==null?void 0:f.zipCode)=="string"&&o("zipCode",l?.zipCode??""),typeof((g=e?.value)==null?void 0:g.country)=="string"&&o("country",l?.country??""))},InputProps:{"data-mask-me":!0},ClearAdornment:function({onClick:l}){return t(F,{fieldKey:i,onClick:l,ignoreKeys:["line2"]})},service:{googlePlacesAutocompletePlaces:v.servicePaths.googlePlacesAutocompletePlaces,googlePlacesGetPlace:v.servicePaths.googlePlacesGetPlace}})}export{T as AddressInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useRef as
|
|
1
|
+
"use strict";import{useRef as B,useState as I}from"react";import{Box as V}from"@mui/material";import{validateTimestamp as K,USDateSchema as N}from"../../../../../../../validations/date.schema.mjs";import{formatDateMMDDYYYY as O}from"../../../../../../../utils/date.mjs";import{credentialKeys as P}from"../../../../core/fields/index.mjs";import{useFormField as E}from"../../../core/field.hook.mjs";import{useOneClickForm as R}from"../../form.context.mjs";import{getAutoCompleteAttributeValue as j}from"../shared.mjs";import{FieldLabel as z}from"./label.mjs";import{ClearFieldAdornment as L}from"./clear-field-adornment.mjs";import{jsx as o}from"react/jsx-runtime";import{fieldInputTypes as q}from"../../../../core/fields/constants.mjs";import{DateInput as G}from"../../../../../DateInput/index.mjs";function H({fieldKey:n}){var u,m,p;const{options:c}=R(),{field:e,setValue:r,setTouched:v}=E({key:n}),y=B(null),f=/^•{4}-\d{2}-\d{2}$/.test(e?.value??""),b=K(e?.defaultValue??""),[k,d]=I(()=>{const t=e?.value;if(!t)return"";const i=/^•{4}-(\d{2})-(\d{2})$/.exec(t);if(i)return`${i[1]}/${i[2]}/1900`;const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);return a?`${a[2]}/${a[3]}/${a[1]}`:O(t)});if(!e||e.schema.characteristics.inputType!==q.date)return null;const D=(e.touched||e.isDirty)&&!e.isValid,l=e.schema.key===P.birthDate,s=new Date,S=1900,$=1,T=1,F=l?s.getUTCFullYear()-18:s.getUTCFullYear()+100,Y=l?s.getUTCMonth()+1:12,x=l?s.getUTCDate():31,U=new Date(S,$-1,T),w=new Date(F,Y-1,x),M=t=>{if(e.isDisabled)return;if(f){d(""),r("");return}const i=N.safeParse(t),a=t.replace(/[^0-9]/g,"");if(d(t),a.length<=0)return r("");if(!i.success)return r("NaN");const[h,g,C]=t.split("/").map(Number);r(b?String(Date.UTC(C,h-1,g,12,0,0,0)):`${String(C).padStart(4,"0")}-${String(h).padStart(2,"0")}-${String(g).padStart(2,"0")}`)},A=()=>{d(""),r("")};return o(V,{width:"100%",children:o(G,{inputRef:y,variant:"outlined",size:"small",autoComplete:j(e.schema.key),label:o(z,{fieldKey:n}),value:k,onChange:M,onBlur:()=>v(!0),error:D,helperText:D&&(u=e.errorMessage)!=null&&u.length?e.errorMessage:e?.description,placeholder:e.schema.characteristics.placeholder,pickerClickOutsideBoundaryElement:c.features.datePickerClickOutsideBoundaryElement,pickerDefaultSelectedDate:new Date("08/01/1989"),minDate:U,maxDate:w,disabled:e.isDisabled,redactYear:f||l&&((p=(m=c.features.field)==null?void 0:m.dob)==null?void 0:p.redactYear),InputProps:{"data-mask-me":!0,endAdornment:o(L,{fieldKey:n,onClick:A,disabled:e.isDisabled})}})})}export{H as DateInputField};
|
package/dist/components/form/NewOneClickForm/react/ui/fields/input/healthInsurance.field.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as
|
|
1
|
+
"use strict";import{useState as P,useRef as O,useCallback as S,createElement as j}from"react";import{Stack as U,Autocomplete as K,TextField as W,Box as Q,Avatar as G,Typography as z,InputAdornment as J,IconButton as N}from"@mui/material";import{Close as X}from"@mui/icons-material";import{useQuery as Y}from"@tanstack/react-query";import{useDebounceValue as Z}from"../../../../../../../hooks/useDebounceValue.mjs";import{MemberIdInput as $}from"../../../../../MemberIdInput/index.mjs";import{useFormField as _}from"../../../core/field.hook.mjs";import{useOneClickForm as ee}from"../../form.context.mjs";import{jsxs as M,jsx as n,Fragment as B}from"react/jsx-runtime";const k=20;function re(d){const{options:a}=ee(),t=Z(d,300),[b,h]=P([]),[u,i]=P(!0),[v,f]=P(!1),c=O(0),{isLoading:x}=Y({queryKey:["insurance-providers",t],queryFn:async({signal:m})=>{var o,l;const s=await((l=(o=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:l.call(o,{search:t||void 0,limit:k,skip:0},m))??[];return c.current=s.length,h(s),i(s.length>=k),s},refetchOnMount:!0,enabled:!!a.servicePaths.oneClickHealthProviderPayers}),y=S(async()=>{var m,o;if(!(v||!u)){f(!0);try{const l=await((o=(m=a.servicePaths).oneClickHealthProviderPayers)==null?void 0:o.call(m,{search:t||void 0,limit:k,skip:c.current}))??[];h(s=>[...s,...l]),c.current+=l.length,i(l.length>=k)}finally{f(!1)}}},[v,u,t,a.servicePaths]);return{providers:b,isLoading:x,isLoadingMore:v,hasMore:u,loadMore:y}}function V({children:d,required:a}){return a?M(B,{children:[d," ",n(z,{"data-asterisk":!0,component:"span",color:"error",variant:"subtitle2",sx:{fontSize:"inherit"},children:"\u273D"})]}):n(B,{children:d})}function ie({fieldKey:d}){var a,t,b,h,u;const{field:i,setValue:v,setTouched:f}=_({key:d}),[c,x]=P(""),{providers:y,isLoading:m,isLoadingMore:o,hasMore:l,loadMore:s}=re(c),w=O(null),E=S(e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight>=r.scrollHeight-50&&l&&!o&&s()},[l,o,s]);if(!i)return null;const p=i.value;if(!p)return null;const C=e=>{v({...p,...e})},q=(i.touched||i.isDirty)&&!i.isValid,T=((t=(a=i.errors)==null?void 0:a.error)==null?void 0:t.issues)??[],D=((b=T.find(e=>e.path.join(".")==="payer.name"))==null?void 0:b.message)??((h=T.find(e=>e.path[0]==="payer"))==null?void 0:h.message),F=(u=T.find(e=>e.path[0]==="memberId"))==null?void 0:u.message,L=q&&!!D,A=q&&!!F,H=y.find(e=>e.verifiedId===p.payer.verifiedId)??p.payer;return M(U,{spacing:2,children:[n(K,{fullWidth:!0,disabled:i.isDisabled,options:y,loading:m||o,filterOptions:e=>e,value:H.verifiedId?H:null,inputValue:c,onInputChange:(e,r)=>{x(r)},onChange:(e,r)=>{C(r?{payer:{name:r.name,logoUrl:r.logoUrl,verifiedId:r.verifiedId},memberId:""}:{payer:{name:"",logoUrl:void 0,verifiedId:""},memberId:""})},isOptionEqualToValue:(e,r)=>!!e&&!!r&&e.verifiedId===r.verifiedId,getOptionLabel:e=>e.name,ListboxProps:{ref:w,onScroll:E},renderOption:(e,r)=>{var g,I;return j(Q,{component:"li",...e,key:r.verifiedId},M(U,{direction:"row",spacing:1.5,alignItems:"center",children:[n(G,{src:r.logoUrl??void 0,alt:(g=r.name[0])==null?void 0:g.toUpperCase(),sx:{width:32,height:32,borderRadius:1,bgcolor:"primary.main"},slotProps:{img:{onError:R=>{R.currentTarget.style.display="none"}}},children:(I=r.name[0])==null?void 0:I.toUpperCase()}),n(z,{sx:{textAlign:"left"},children:r.name})]}))},renderInput:e=>n(W,{...e,label:n(V,{required:i.isRequired,children:"Insurer"}),error:L,helperText:L?D:"The company that provides your health insurance",placeholder:"Search...",size:"small",InputLabelProps:{shrink:!0},InputProps:{...e.InputProps,"data-mask-me":!0,endAdornment:e.InputProps.endAdornment},inputProps:{...e.inputProps,onBlur:r=>{var g,I;(I=(g=e.inputProps).onBlur)==null||I.call(g,r),f(!0)}}})}),n($,{fullWidth:!0,label:n(V,{required:i.isRequired,children:"Member ID"}),placeholder:"Enter member ID",size:"small",disabled:i.isDisabled,value:p.memberId,onChange:e=>C({memberId:e.target.value}),onBlur:()=>f(!0),error:A,helperText:A?F:"From your health insurance ID card",InputProps:{"data-mask-me":!0,endAdornment:p.memberId?n(J,{position:"end",children:n(N,{tabIndex:-1,"aria-label":"clear member id",edge:"end",size:"small",disabled:i.isDisabled,onClick:()=>C({memberId:""}),children:n(X,{fontSize:"small"})})}):null}})]})}export{ie as HealthInsuranceInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Box as a}from"@mui/material";import{PhoneInput as
|
|
1
|
+
"use strict";import{Box as a}from"@mui/material";import{PhoneInput as n}from"../../../../../PhoneInput.mjs";import{useFormField as u}from"../../../core/field.hook.mjs";import{FieldLabel as d}from"./label.mjs";import{jsx as i}from"react/jsx-runtime";function m({fieldKey:l}){const{field:e,setValue:o,setTouched:r}=u({key:l});if(!e)return null;const t=(e.touched||e.isDirty)&&!e.isValid;return i(a,{width:"100%",children:i(n,{variant:"outlined",size:"small",label:i(d,{fieldKey:l}),value:e.value||"",onChange:s=>{e.isDisabled||o(s)},onBlur:()=>r(!0),error:t,helperText:e.description,disabled:e.isDisabled,shouldHaveClearButton:!0,shouldHaveSelectCountryButton:!1,InputLabelProps:{shrink:!0}})})}export{m as PhoneInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Box as
|
|
1
|
+
"use strict";import{Box as m,Autocomplete as f,TextField as h}from"@mui/material";import{useFormField as v}from"../../../core/field.hook.mjs";import{FieldLabel as b}from"./label.mjs";import{jsx as t}from"react/jsx-runtime";import{fieldInputTypes as P}from"../../../../core/fields/constants.mjs";function x({fieldKey:o}){const{field:e,setValue:s,setTouched:p}=v({key:o});if(e?.schema.characteristics.inputType!==P.select)return null;const r=e.schema.characteristics.options||[],d=r.find(i=>i.value===e.value)??null,c=(e.touched||e.isDirty)&&!e.isValid,a={variant:"outlined",size:"small",label:t(b,{fieldKey:o}),error:c,helperText:e.description,inputProps:{tabIndex:0},fullWidth:!0};return t(m,{width:"100%",children:t(f,{disablePortal:!0,autoHighlight:!0,options:r,isOptionEqualToValue:(i,l)=>i?.value===l?.value,value:d,onChange:(i,l)=>{if(!e.isDisabled){if(!l){s("");return}s(l.value)}},renderInput:i=>t(h,{...i,...a,inputProps:{...i.inputProps,...a.inputProps,onBlur:l=>{var n,u;(u=(n=i.inputProps).onBlur)==null||u.call(n,l),p(!0)}},InputLabelProps:{"data-mask-me":!0,shrink:!0,...a.InputLabelProps}}),disabled:e.isDisabled})})}export{x as SelectInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useRef as
|
|
1
|
+
"use strict";import{useRef as d}from"react";import{Box as m}from"@mui/material";import{SSNInput as u}from"../../../../../SSNInput.mjs";import{useFormField as p}from"../../../core/field.hook.mjs";import{getAutoCompleteAttributeValue as f}from"../shared.mjs";import{FieldLabel as c}from"./label.mjs";import{ClearFieldAdornment as h}from"./clear-field-adornment.mjs";import{jsx as t}from"react/jsx-runtime";function b({fieldKey:o}){const{field:e,setValue:i,setTouched:l}=p({key:o}),r=d(null);if(!e)return null;const a=n=>{e.isDisabled||i(n.target.value)},s=(e.touched||e.isDirty)&&!e.isValid;return t(m,{width:"100%",children:t(u,{inputRef:r,variant:"outlined",size:"small",autoComplete:f(e.schema.key),label:t(c,{fieldKey:o}),value:e.value||"",onChange:a,onBlur:()=>l(!0),error:s,helperText:e?.description,shouldHaveCloseAdornment:!1,disabled:e.isDisabled,InputProps:{"data-mask-me":!0,endAdornment:t(h,{fieldKey:o})}})})}export{b as SSNInputField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useRef as n}from"react";import{Box as
|
|
1
|
+
"use strict";import{useRef as n}from"react";import{Box as d,TextField as m}from"@mui/material";import{useFormField as f}from"../../../core/field.hook.mjs";import{getAutoCompleteAttributeValue as p}from"../shared.mjs";import{FieldLabel as c}from"./label.mjs";import{ClearFieldAdornment as h}from"./clear-field-adornment.mjs";import{jsx as t}from"react/jsx-runtime";function b({fieldKey:i}){const{field:e,setValue:l,setTouched:r}=f({key:i}),o=n(null);if(!e)return null;const a=(e.touched||e.isDirty)&&!e.isValid,s={inputRef:o,variant:"outlined",size:"small",autoComplete:p(e.schema.key),label:t(c,{fieldKey:i}),value:e.value||"",onChange:u=>{e.isDisabled||l(u.target.value)},onBlur:()=>r(!0),error:a,helperText:e?.description,InputProps:{"data-mask-me":!0,endAdornment:t(h,{fieldKey:i,onClick:()=>{o.current&&(o.current.value="")}})},inputProps:{tabIndex:0,autoCorrect:"off",autoCapitalize:"off"},fullWidth:!0,disabled:e.isDisabled};return t(d,{width:"100%",children:t(m,{...s})})}export{b as TextInputField};
|