@verifiedinc-public/shared-ui-elements 12.8.3 → 12.8.4
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,3 +1,3 @@
|
|
|
1
|
-
"use strict";import{useMemo as c}from"react";import{useFormContext as y,useController as h}from"react-hook-form";import{Autocomplete as v,TextField as C}from"@mui/material";import{prettyField as F}from"../utils/prettyField.mjs";import{buildDataFieldValue as x}from"../utils/buildDataFieldValue.mjs";import{useCredentialRequestField as b}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldSection as g}from"./DataFieldSection.mjs";import{jsx as n}from"react/jsx-runtime";function S(){const e=b(),s=y(),p=h({name:`${e?.path}`}),a=c(()=>{const t={PhoneCredential:0,FullNameCredential:1,AddressCredential:2,BirthDateCredential:3,SsnCredential:4,SexCredential:5
|
|
1
|
+
"use strict";import{useMemo as c}from"react";import{useFormContext as y,useController as h}from"react-hook-form";import{Autocomplete as v,TextField as C}from"@mui/material";import{prettyField as F}from"../utils/prettyField.mjs";import{buildDataFieldValue as x}from"../utils/buildDataFieldValue.mjs";import{useCredentialRequestField as b}from"../contexts/CredentialRequestFieldContext.mjs";import{DataFieldSection as g}from"./DataFieldSection.mjs";import{jsx as n}from"react/jsx-runtime";function S(){const e=b(),s=y(),p=h({name:`${e?.path}`}),a=c(()=>{const t={PhoneCredential:0,FullNameCredential:1,AddressCredential:2,BirthDateCredential:3,SsnCredential:4,SexCredential:5},o=e?.path??"",i=e?.index??0,r=o.split(".").slice(0,-1).join("."),m=s.getValues(r),f=new Set(m?.map((l,d)=>d!==i?l.type:null).filter(l=>l!==null)??[]);return Object.keys(t).map(l=>({label:F(l),id:l})).filter(l=>!f.has(l.id)).sort((l,d)=>t[l.id]-t[d.id])},[e,s]),u=c(()=>{var t,o;const i=(o=(t=p.field)==null?void 0:t.value)==null?void 0:o.type;return a?.find(r=>r.id===i)},[p,a]);return n(g,{title:"Field Type",description:"What type of user data this field is for",tip:n("pre",{children:`{
|
|
2
2
|
type: string
|
|
3
|
-
}`}),children:n(v,{value:u,onChange:(t,
|
|
3
|
+
}`}),children:n(v,{value:u,onChange:(t,o)=>{if(!o)return;const i=x(o.id),r={type:i.type,mandatory:i.mandatory,description:i.description,allowUserInput:i.allowUserInput,multi:i.multi,children:i.children};e?.fieldArray.update(e?.index,r)},options:a,disablePortal:!0,renderInput:t=>n(C,{...t,label:"Type",color:"success",size:"small",className:"original",fullWidth:!0,inputProps:{...t.inputProps,"data-testid":"custom-demo-dialog-data-field-type-input"},placeholder:"Choose a type..."}),disabled:(e?.level??0)>0})},JSON.stringify(u))}export{S as DataFieldOptionType};
|