"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react"),F=require("./Field.js"),g=require("react-hook-form");require("react-router-dom");require("../components/Icons/EuiIcon.js");const v=require("../components/Button.js");require("@elastic/eui");require("../node_modules/.pnpm/twin.macro@2.8.2/node_modules/twin.macro/macro.js");require("../node_modules/.pnpm/@elastic_eui@61.0.0_zavqrpf4tc2kjxw3tjmx3rmpbq/node_modules/@elastic/eui/dist/eui_theme_light.js");require("../tailwind.js");const y=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=y(i),E=({data:e=[],onSubmit:n,buttons:s,values:c={},formId:m,onCloseModal:d})=>{const{register:f,handleSubmit:q,formState:{errors:_}}=g.useForm({defaultValues:c});return t.default.createElement(i.Fragment,null,t.default.createElement("form",{onSubmit:q(n),id:m},e==null?void 0:e.map((o,h)=>{var a;const{name:r,type:p,required:j,capitalize:k,initialValue:S,label:b,options:u,...w}=o;return t.default.createElement(F.Field,{key:r,...o,...f(r,j),error:(a=_[r])==null?void 0:a.message,label:b||r},u&&(u==null?void 0:u.map((l,x)=>{if(p==="select")return t.default.createElement("option",{value:l.value,key:l.value},l.label)})))}),t.default.createElement(v.Buttons,{data:s,onCloseModal:d})))};exports.Form=E;
//# sourceMappingURL=Form.js.map
