import e from"react";import{transformValidator as r}from"../FormBuilderTransformer/ValidatorTransformer.js";import{FormControl as a}from"../../../../../../../node_modules/@chakra-ui/form-control/dist/esm/form-control.js";import{FormLabel as t}from"../../../../../../../node_modules/@chakra-ui/form-control/dist/esm/form-label.js";import{Select as l}from"../../../../../../../node_modules/@chakra-ui/select/dist/esm/select.js";import{Checkbox as o}from"../../../../../../../node_modules/@chakra-ui/checkbox/dist/esm/checkbox.js";import{RadioGroup as m}from"../../../../../../../node_modules/@chakra-ui/radio/dist/esm/radio-group.js";import{Stack as n}from"../../../../../../../node_modules/@chakra-ui/layout/dist/esm/stack.js";import{Radio as i}from"../../../../../../../node_modules/@chakra-ui/radio/dist/esm/radio.js";import{Input as d}from"../../../../../../../node_modules/@chakra-ui/input/dist/esm/input.js";import{Textarea as c}from"../../../../../../../node_modules/@chakra-ui/textarea/dist/esm/textarea.js";var s=function(s){var u,p,f=s.field,h=s.register,v=s.errors,k=f.label,E=r(f.validators);return e.createElement(a,{key:f.id},e.createElement(t,{htmlFor:k},f.label),function(){switch(f.type){case"text":return e.createElement(d,{type:"text",name:k,placeholder:f.placeholder,defaultValue:f.value,ref:h(E.validator)});case"textarea":return e.createElement(c,{name:k,ref:h,placeholder:f.placeholder,defaultValue:f.value,style:{height:150}});case"email":case"number":return e.createElement(d,{type:"text",name:k,placeholder:f.placeholder,defaultValue:f.value,ref:h(E.validator)});case"date":return e.createElement(d,{type:"date",name:k,placeholder:f.placeholder,defaultValue:f.value,ref:h(E.validator)});case"radio":return e.createElement("div",null,e.createElement(m,{defaultValue:""},e.createElement(n,{spacing:5,direction:"row"},f.options.split(";").map((function(r){return e.createElement(i,{key:r,ref:h(E.validator),type:"radio",value:r,name:k,size:"lg"},r)})))));case"checkbox":return e.createElement("div",null,f.options.split(";").map((function(r){return e.createElement("div",{key:r},e.createElement(o,{name:k,placeholder:f.placeholder,value:r,ref:h(E.validator)},r))})));case"select":return e.createElement(l,{name:k,placeholder:f.placeholder,ref:h(E.validator)},e.createElement("option",{key:f.placeholder,value:"-"}," ",f.placeholder," "),f.options.split(";").map((function(r){return e.createElement("option",{key:r,value:r}," ",r," ")})));default:return null}}(),v[k]?e.createElement("span",{className:"error"}," ",null===(u=E.message)||void 0===u?void 0:u[null===(p=v[k])||void 0===p?void 0:p.type]," "):null)};export{s as FieldComponent};
//# sourceMappingURL=Field.js.map
