All files / doc/assets FormField-BYt8PKU5.js

0% Statements 0/1
0% Branches 0/1
0% Functions 0/1
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2   
import{P as b}from"./index-CtfpA6-5.js";import{R as e}from"./iframe-Bn_dKj27.js";v.propTypes={action:b.string,method:b.oneOf(["get","post","put"]),onSubmit:b.func,tagName:b.string};function v({action:n,method:r="post",onSubmit:t,tagName:a="form",...f}){const d=a,p=E=>{E.preventDefault(),t(E)};return n?e.createElement(d,{...f,action:n,method:r,...t&&{onSubmit:p}}):e.createElement(d,{...f,...t&&{onSubmit:p}})}v.Submit=function(){return e.createElement("input",{type:"submit"})};v.__docgenInfo={description:"",methods:[{name:"Submit",docblock:null,modifiers:["static"],params:[],returns:null}],displayName:"Form",props:{method:{defaultValue:{value:"'post'",computed:!1},description:"",type:{name:"enum",value:[{value:"'get'",computed:!1},{value:"'post'",computed:!1},{value:"'put'",computed:!1}]},required:!1},tagName:{defaultValue:{value:"'form'",computed:!1},description:"",type:{name:"string"},required:!1},action:{description:"",type:{name:"string"},required:!1},onSubmit:{description:"",type:{name:"func"},required:!1}}};function h(n,r,t="type"){return!!n.find(a=>a[t]===r)}g.Error=i;g.Input=c;g.Label=u;function g({children:n,describedBy:r=null,errorMessage:t=null,label:a,name:f,type:d="text",inputTagName:p="input",tagName:E,...I}){const l=e.useId(),m=`${l}__error`,_=E||"div",q=!!t,s=e.Children.toArray(n).map(o=>o.type===i?e.cloneElement(o,{errorId:m},t):o.type===c?e.cloneElement(o,{id:l,inputTagName:p,name:f,type:d,"aria-describedby":`${m} ${r}`}):o.type===u?e.cloneElement(o,{inputId:l},a):o),y=h(s,i),N=h(s,c),F=h(s,u);return!F&&!N&&!y?e.createElement(_,{...I},e.createElement(u,{inputId:l},a),e.createElement(c,{id:l,inputTagName:p,type:d,"aria-describedby":`${m} ${r}`}),e.createElement(i,{id:m},t),s):!F&&N&&!y?e.createElement(_,{...I},!F&&e.createElement(u,{inputId:l},a),!y&&e.createElement(i,{id:m},t),s):e.createElement(_,{...I},!F&&e.createElement(u,{inputId:l},a),s,!y&&e.createElement(i,{id:m,hasError:q},t))}function c({inputTagName:n,...r}){const t=n||"input";return e.createElement(t,{...r})}function u({inputId:n,tagName:r,...t}){const a=r||"label";return e.createElement(a,{...t,htmlFor:n})}function i({hasError:n,tagName:r,...t}){const a=r||"span";return e.createElement(a,{...t})}g.__docgenInfo={description:"",methods:[{name:"Error",docblock:null,modifiers:["static"],params:[{name:"{ hasError, tagName, ...args }",optional:!1,type:null}],returns:null},{name:"Input",docblock:null,modifiers:["static"],params:[{name:"{ inputTagName, ...args }",optional:!1,type:null}],returns:null},{name:"Label",docblock:null,modifiers:["static"],params:[{name:"{ inputId, tagName, ...args }",optional:!1,type:null}],returns:null}],displayName:"FormField",props:{describedBy:{defaultValue:{value:"null",computed:!1},required:!1},errorMessage:{defaultValue:{value:"null",computed:!1},required:!1},type:{defaultValue:{value:"'text'",computed:!1},required:!1},inputTagName:{defaultValue:{value:"'input'",computed:!1},required:!1}}};c.__docgenInfo={description:"",methods:[],displayName:"FormFieldInput"};u.__docgenInfo={description:"",methods:[],displayName:"FormFieldLabel"};i.__docgenInfo={description:"",methods:[],displayName:"FormFieldError"};export{v as F,g as a};