@saas-ui/forms 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
- import*as e from"react";import{useFormContext as r,get as l,Controller as a,useFieldArray as t,useForm as n,FormProvider as i,useWatch as s}from"react-hook-form";import{FormControl as m,FormLabel as o,Text as c,forwardRef as u,Switch as d,Checkbox as p,Box as f,FormHelperText as h,FormErrorMessage as b,useMergeRefs as E,Input as y,Textarea as v,useTheme as x,SimpleGrid as g,chakra as V,useStyles as k}from"@chakra-ui/react";import{NumberInput as I}from"@saas-ui/number-input";import{PasswordInput as C}from"@saas-ui/password-input";import{RadioInput as F}from"@saas-ui/radio";import{PinInput as L}from"@saas-ui/pin-input";import{Select as N,NativeSelect as O}from"@saas-ui/select";import{reach as S}from"yup";import{yupResolver as w}from"@hookform/resolvers/yup";import{chakra as R,forwardRef as U}from"@chakra-ui/system";import{MinusIcon as D,AddIcon as j}from"@chakra-ui/icons";import{IconButton as M,Button as P}from"@saas-ui/button";import{createContext as $}from"@chakra-ui/react-utils";export*from"@saas-ui/input-right-button";function q(){return q=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var l=arguments[r];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e},q.apply(this,arguments)}function A(e,r){if(null==e)return{};var l,a,t={},n=Object.keys(e);for(a=0;a<n.length;a++)r.indexOf(l=n[a])>=0||(t[l]=e[l]);return t}const B=["name","label","placeholder"],T=l=>{let{name:a,label:t}=l,n=A(l,B);const{getValues:i}=r();/*#__PURE__*/return e.createElement(m,n,t?/*#__PURE__*/e.createElement(o,{htmlFor:a},t):null,/*#__PURE__*/e.createElement(c,{fontSize:"md"},i(a)))},G=["name","label","help","variant","hideLabel","children"],_=["name","label","help","isDisabled","isInvalid","isReadOnly","isRequired","rules","variant"],z=["name","rules"],H=["ref"],J=["name","rules"],K=["ref"],Q=["label"],W=["label"],X={},Y="text",Z=a=>{const{name:t,label:n,help:i,variant:s,hideLabel:c,children:u}=a,d=A(a,G),{formState:p}=r(),E=((e,r)=>l(r.errors,e))(t,p);/*#__PURE__*/return e.createElement(m,q({variant:s},d,{isInvalid:!!E}),n&&!c?/*#__PURE__*/e.createElement(o,{variant:s},n):null,/*#__PURE__*/e.createElement(f,null,u,!i||null!=E&&E.message?null:/*#__PURE__*/e.createElement(h,null,i),(null==E?void 0:E.message)&&/*#__PURE__*/e.createElement(b,null,null==E?void 0:E.message)))},ee=u((r,l)=>{const{type:a=Y}=r,t=(e=>X[e]||X[Y])(a);/*#__PURE__*/return e.createElement(t,q({ref:l},r))}),re=l=>u((t,n)=>{let{name:i,rules:s}=t,m=A(t,z);const{control:o}=r();/*#__PURE__*/return e.createElement(a,{name:i,control:o,rules:s,render:r=>{let{field:{ref:a}}=r,t=A(r.field,H);/*#__PURE__*/return e.createElement(l,q({},t,m,{ref:E(n,a)}))}})}),le=l=>u((a,t)=>{let{name:n,rules:i}=a,s=A(a,J);const{register:m}=r(),o=m(n,i),{ref:c}=o,u=A(o,K);/*#__PURE__*/return e.createElement(l,q({},u,s,{ref:E(t,c)}))}),ae=(r,l,a)=>{let t;t=null!=a&&a.isControlled?re(l):le(l);const n=((r,{displayName:l,hideLabel:a,BaseField:t})=>{const n=u((l,n)=>{const{name:i,label:s,help:m,isDisabled:o,isInvalid:c,isReadOnly:u,isRequired:d,rules:p,variant:f}=l,h=A(l,_),b=q({required:d},p);/*#__PURE__*/return e.createElement(t,{name:i,label:s,help:m,hideLabel:a,isDisabled:o,isInvalid:c,isReadOnly:u,isRequired:d,variant:f},/*#__PURE__*/e.createElement(r,q({ref:n,name:i,label:s,rules:b},h)))});return n.displayName=l,n})(t,{displayName:`${r.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}Field`,hideLabel:null==a?void 0:a.hideLabel,BaseField:(null==a?void 0:a.BaseField)||Z});return X[r]=n,n},te=ae("text",y),ne=ae("number",I,{isControlled:!0}),ie=ae("password",C),se=ae("textarea",v),me=ae("switch",u((r,l)=>{let{label:a}=r,t=A(r,Q);/*#__PURE__*/return e.createElement(d,q({ref:l},t),a)}),{isControlled:!0,hideLabel:!0}),oe=ae("select",N,{isControlled:!0}),ce=ae("checkbox",u((r,l)=>{let{label:a}=r,t=A(r,W);/*#__PURE__*/return e.createElement(p,q({ref:l},t),a)}),{hideLabel:!0}),ue=ae("radio",F,{isControlled:!0}),de=ae("pin",L,{isControlled:!0}),pe=ae("native-select",O,{isControlled:!0}),fe=e=>{var r;if(null!=(r=e.spec.meta)&&r.type)return e.spec.meta.type;switch(e.type){case"array":return"array";case"object":return"object";case"number":return"number";case"date":return"date";default:return"text"}},he=(e,r)=>{for(const a of e.tests){var l;if(null!=(l=a.OPTIONS)&&l.params[r])return a.OPTIONS.params[r]}},be=e=>{const r=[];let l={};l="array"===e.type?e.innerType.fields:e.fields;for(const e in l){const a=l[e],t={};"array"===a.type&&(t.min=he(a,"min"),t.max=he(a,"max")),r.push(q({name:e,label:a.spec.label||e,type:fe(a)},t))}return r},Ee=["children"],ye=({children:r})=>/*#__PURE__*/e.createElement(V.div,null,r),ve=r=>{var l,a,t;let{children:n}=r,i=A(r,Ee);const s=q({},null!=(l=null==(a=x().components)||null==(t=a.FormLayout)?void 0:t.defaultProps)?l:{spacing:4},i);/*#__PURE__*/return e.createElement(g,s,e.Children.map(n,r=>e.isValidElement(r)?/*#__PURE__*/e.createElement(ye,null,r):r))},xe=(r,l)=>e.Children.map(l,l=>e.isValidElement(l)&&l.props.name?e.cloneElement(l,q({},l.props,{name:`${r}.${l.props.name}`})):l),[ge,Ve]=$({name:"ArrayFieldContext"}),[ke,Ie]=$({name:"ArrayFieldRowContext"}),Ce=({name:e,defaultValue:l={},keyName:a,min:n,max:i})=>{const{control:s}=r();return q({},t({control:s,name:e,keyName:a}),{name:e,defaultValue:l,min:n,max:i})},Fe=({index:l})=>{const{clearErrors:a}=r(),{name:t,remove:n,fields:i}=Ve();return e.useEffect(()=>{a(t)},[]),{index:l,isFirst:0===l,isLast:l===i.length-1,name:`${t}.${l}`,remove:e.useCallback(()=>{a(t),n(l)},[l])}},Le=()=>{const{isFirst:e,remove:r}=Ie(),{min:l,fields:a}=Ve();return{onClick:()=>r(),isDisabled:e&&!!(l&&a.length<=l)}},Ne=()=>{const{append:e,defaultValue:r,max:l,fields:a}=Ve();return{onClick:()=>e(r,{shouldFocus:!1}),isDisabled:!!(l&&a.length>=l)}},Oe=["children","columns","spacing"],Se=["children"],we=["name","defaultValue","keyName","min","max","children"],Re=({children:r,columns:l,spacing:a,index:t})=>/*#__PURE__*/e.createElement(De,{index:t},/*#__PURE__*/e.createElement(Ue,{columns:l,spacing:a},r),/*#__PURE__*/e.createElement(je,null)),Ue=r=>{let{children:l,columns:a,spacing:t}=r,n=A(r,Oe);const{name:i}=Ie();/*#__PURE__*/return e.createElement(ve,q({flex:"1",columns:a,gridGap:t,mr:"2"},n),xe(i,l))},De=({children:r,index:l})=>{const a=Fe({index:l});/*#__PURE__*/return e.createElement(ke,{value:a},/*#__PURE__*/e.createElement(R.div,{__css:{display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%",mb:4}},r))},je=r=>/*#__PURE__*/e.createElement(M,q({icon:/*#__PURE__*/e.createElement(D,null),"aria-label":"Remove row"},Le(),r)),Me=r=>/*#__PURE__*/e.createElement(M,q({icon:/*#__PURE__*/e.createElement(j,null),"aria-label":"Add row",float:"right"},Ne(),r)),Pe=r=>{const{children:l}=r,a=A(r,Se);/*#__PURE__*/return e.createElement(qe,a,/*#__PURE__*/e.createElement($e,null,r=>/*#__PURE__*/e.createElement(e.Fragment,null,r.map(({id:r},a)=>/*#__PURE__*/e.createElement(Re,{key:r,index:a},l)))),/*#__PURE__*/e.createElement(Me,null))},$e=({children:e})=>{const{fields:r}=Ve();return e(r)},qe=r=>{let{name:l,defaultValue:a,keyName:t,min:n,max:i,children:s}=r,m=A(r,we);const o=Ce({name:l,defaultValue:a,keyName:t,min:n,max:i});/*#__PURE__*/return e.createElement(ge,{value:o},/*#__PURE__*/e.createElement(Z,q({name:l},m),s))},Ae=["name","label","hideLabel","children","columns","spacing"],Be=r=>{const l=k();/*#__PURE__*/return e.createElement(o,q({as:"legend",sx:l.legend},r))},Te=r=>{const{name:l,label:a,hideLabel:t,children:n,columns:i,spacing:s}=r,o=A(r,Ae);/*#__PURE__*/return e.createElement(m,q({name:l,as:"fieldset"},o),/*#__PURE__*/e.createElement(Be,{display:t?"none":"block"},a),/*#__PURE__*/e.createElement(ve,{columns:i,gridGap:s},xe(l,n)))},Ge=["name","type"],_e=["schema"],ze=["name","type","defaultValue"],He=(r,l)=>be(((e,r)=>S(e,r))(r,l)).map(r=>{let{name:l,type:a}=r,t=A(r,Ge);/*#__PURE__*/return e.createElement(ee,q({key:l,name:l,type:a},t))}),Je=r=>{let{schema:l}=r,a=A(r,_e);/*#__PURE__*/return e.createElement(ve,a,be(l).map(r=>{let{name:a,type:t}=r,n=A(r,ze);return"array"===t?/*#__PURE__*/e.createElement(Pe,q({name:a},n),He(l,a)):"object"===t?/*#__PURE__*/e.createElement(Te,q({name:a},n),He(l,a)):/*#__PURE__*/e.createElement(ee,q({key:a,name:a,type:t},n))}))},Ke=["mode","resolver","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","schema","defaultValues","onSubmit","onError","formRef","children"],Qe=u((r,l)=>{const{mode:a="all",resolver:t,reValidateMode:s,shouldFocusError:m,shouldUnregister:o,shouldUseNativeValidation:c,criteriaMode:u,delayError:d,schema:p,defaultValues:f,onSubmit:h,onError:b,formRef:E,children:y}=r,v=A(r,Ke),x={mode:a,resolver:t,defaultValues:f,reValidateMode:s,shouldFocusError:m,shouldUnregister:o,shouldUseNativeValidation:c,criteriaMode:u,delayError:d};p&&(x.resolver=w(p));const g=n(x),{handleSubmit:k}=g;return e.useImperativeHandle(l,()=>g,[l,g]),/*#__PURE__*/e.createElement(i,g,/*#__PURE__*/e.createElement(V.form,q({ref:E,onSubmit:k(h,b)},v),y))}),We=["children","disableIfUntouched","disableIfInvalid"],Xe=U((l,a)=>{const{children:t,disableIfUntouched:n,disableIfInvalid:i}=l,s=A(l,We),{formState:m}=r();/*#__PURE__*/return e.createElement(P,q({type:"submit",isLoading:m.isSubmitting,isPrimary:!0,ref:a,isDisabled:n&&!m.isDirty||i&&!m.isValid},s),t)});Xe.defaultProps={label:"Submit",disableIfUntouched:!1,disableIfInvalid:!1};const Ye=["schema","submitLabel"],Ze=u((r,l)=>{const{schema:a,submitLabel:t="Submit"}=r,n=A(r,Ye);/*#__PURE__*/return e.createElement(Qe,q({},n,{schema:a,ref:l}),/*#__PURE__*/e.createElement(ve,null,/*#__PURE__*/e.createElement(Je,{schema:a}),t&&/*#__PURE__*/e.createElement(Xe,{label:t})))}),er=({children:e,name:l,defaultValue:a,isDisabled:t,isExact:n,condition:i=(e=>!!e)})=>i(s({name:l,defaultValue:a,disabled:t,exact:n}),r())?e:null;export{Pe as ArrayField,Me as ArrayFieldAddButton,qe as ArrayFieldContainer,ge as ArrayFieldProvider,je as ArrayFieldRemoveButton,Re as ArrayFieldRow,De as ArrayFieldRowContainer,Ue as ArrayFieldRowFields,ke as ArrayFieldRowProvider,$e as ArrayFieldRows,Ze as AutoForm,Z as BaseField,ce as CheckboxField,T as DisplayField,er as DisplayIf,ee as Field,Je as Fields,Qe as Form,ve as FormLayout,Be as FormLegend,te as InputField,pe as NativeSelectField,ne as NumberInputField,Te as ObjectField,ie as PasswordInputFIeld,de as PinField,ue as RadioField,oe as SelectField,Xe as SubmitButton,me as SwitchField,se as TextareaField,ae as registerFieldType,Ce as useArrayField,Ne as useArrayFieldAddButton,Ve as useArrayFieldContext,Le as useArrayFieldRemoveButton,Fe as useArrayFieldRow,Ie as useArrayFieldRowContext,re as withControlledInput,le as withUncontrolledInput};
1
+ import*as e from"react";import{useFormContext as t,get as r,Controller as n,useFieldArray as a,useForm as l,FormProvider as i,useWatch as o}from"react-hook-form";import{FormControl as s,FormLabel as c,Text as u,forwardRef as p,Switch as m,Checkbox as d,Box as f,FormHelperText as h,FormErrorMessage as v,useMergeRefs as b,Input as y,Textarea as _,useTheme as g,SimpleGrid as E,chakra as x,useStyles as S,Collapse as j}from"@chakra-ui/react";import{NumberInput as N}from"@saas-ui/number-input";import{PasswordInput as C}from"@saas-ui/password-input";import{RadioInput as O}from"@saas-ui/radio";import{PinInput as w}from"@saas-ui/pin-input";import{Select as A,NativeSelect as k}from"@saas-ui/select";import{reach as F}from"yup";import{yupResolver as I}from"@hookform/resolvers/yup";import{chakra as V,forwardRef as z,useMultiStyleConfig as L,omitThemingProps as D,StylesProvider as P,useStyles as R}from"@chakra-ui/system";import{MinusIcon as U,AddIcon as M,Icon as $,CheckIcon as B}from"@chakra-ui/icons";import{IconButton as T,Button as q}from"@saas-ui/button";import{createContext as G}from"@chakra-ui/react-utils";import{getChildrenOfType as W,getChildOfType as H}from"@saas-ui/react-utils";export*from"@saas-ui/input-right-button";function J(){return J=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},J.apply(this,arguments)}function K(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(r=l[n])>=0||(a[r]=e[r]);return a}const Q=["name","label","placeholder"],X=t=>{let{name:r,label:n}=t,a=K(t,Q);/*#__PURE__*/return e.createElement(s,a,n?/*#__PURE__*/e.createElement(c,{htmlFor:r},n):null,/*#__PURE__*/e.createElement(u,{fontSize:"md"},/*#__PURE__*/e.createElement(Y,{name:r})))},Y=({name:e})=>{const{getValues:r}=t();return r(e)||null},Z=["name","label","help","variant","hideLabel","children"],ee=["name","label","help","isDisabled","isInvalid","isReadOnly","isRequired","rules","variant"],te=["name","rules"],re=["ref"],ne=["name","rules"],ae=["ref"],le=["label"],ie=["label"],oe={},se="text",ce=n=>{const{name:a,label:l,help:i,variant:o,hideLabel:u,children:p}=n,m=K(n,Z),{formState:d}=t(),b=((e,t)=>r(t.errors,e))(a,d);/*#__PURE__*/return e.createElement(s,J({variant:o},m,{isInvalid:!!b}),l&&!u?/*#__PURE__*/e.createElement(c,{variant:o},l):null,/*#__PURE__*/e.createElement(f,null,p,!i||null!=b&&b.message?null:/*#__PURE__*/e.createElement(h,null,i),(null==b?void 0:b.message)&&/*#__PURE__*/e.createElement(v,null,null==b?void 0:b.message)))},ue=p((t,r)=>{const{type:n=se}=t,a=(e=>oe[e]||oe[se])(n);/*#__PURE__*/return e.createElement(a,J({ref:r},t))}),pe=r=>p((a,l)=>{let{name:i,rules:o}=a,s=K(a,te);const{control:c}=t();/*#__PURE__*/return e.createElement(n,{name:i,control:c,rules:o,render:t=>{let{field:{ref:n}}=t,a=K(t.field,re);/*#__PURE__*/return e.createElement(r,J({},a,s,{ref:b(l,n)}))}})}),me=r=>p((n,a)=>{let{name:l,rules:i}=n,o=K(n,ne);const{register:s}=t(),c=s(l,i),{ref:u}=c,p=K(c,ae);/*#__PURE__*/return e.createElement(r,J({},p,o,{ref:b(a,u)}))}),de=(t,r,n)=>{let a;a=null!=n&&n.isControlled?pe(r):me(r);const l=((t,{displayName:r,hideLabel:n,BaseField:a})=>{const l=p((r,l)=>{const{name:i,label:o,help:s,isDisabled:c,isInvalid:u,isReadOnly:p,isRequired:m,rules:d,variant:f}=r,h=K(r,ee),v=J({required:m},d);/*#__PURE__*/return e.createElement(a,{name:i,label:o,help:s,hideLabel:n,isDisabled:c,isInvalid:u,isReadOnly:p,isRequired:m,variant:f},/*#__PURE__*/e.createElement(t,J({ref:l,name:i,label:o,rules:v},h)))});return l.displayName=r,l})(a,{displayName:`${t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}Field`,hideLabel:null==n?void 0:n.hideLabel,BaseField:(null==n?void 0:n.BaseField)||ce});return oe[t]=l,l},fe=de("text",y),he=de("number",N,{isControlled:!0}),ve=de("password",C),be=de("textarea",_),ye=de("switch",p((t,r)=>{let{label:n}=t,a=K(t,le);/*#__PURE__*/return e.createElement(m,J({ref:r},a),n)}),{isControlled:!0,hideLabel:!0}),_e=de("select",A,{isControlled:!0}),ge=de("checkbox",p((t,r)=>{let{label:n}=t,a=K(t,ie);/*#__PURE__*/return e.createElement(d,J({ref:r},a),n)}),{hideLabel:!0}),Ee=de("radio",O,{isControlled:!0}),xe=de("pin",w,{isControlled:!0}),Se=de("native-select",k,{isControlled:!0}),je=e=>{var t;if(null!=(t=e.spec.meta)&&t.type)return e.spec.meta.type;switch(e.type){case"array":return"array";case"object":return"object";case"number":return"number";case"date":return"date";default:return"text"}},Ne=(e,t)=>{for(const n of e.tests){var r;if(null!=(r=n.OPTIONS)&&r.params[t])return n.OPTIONS.params[t]}},Ce=e=>{const t=[];let r={};r="array"===e.type?e.innerType.fields:e.fields;for(const e in r){const n=r[e],a={};"array"===n.type&&(a.min=Ne(n,"min"),a.max=Ne(n,"max")),t.push(J({name:e,label:n.spec.label||e,type:je(n)},a))}return t},Oe=["children"],we=({children:t})=>/*#__PURE__*/e.createElement(x.div,null,t),Ae=t=>{var r,n,a;let{children:l}=t,i=K(t,Oe);const o=J({},null!=(r=null==(n=g().components)||null==(a=n.FormLayout)?void 0:a.defaultProps)?r:{spacing:4},i);/*#__PURE__*/return e.createElement(E,o,e.Children.map(l,t=>e.isValidElement(t)?/*#__PURE__*/e.createElement(we,null,t):t))},ke=(t,r)=>e.Children.map(r,r=>e.isValidElement(r)&&r.props.name?e.cloneElement(r,J({},r.props,{name:`${t}.${r.props.name}`})):r),[Fe,Ie]=G({name:"ArrayFieldContext"}),[Ve,ze]=G({name:"ArrayFieldRowContext"}),Le=({name:e,defaultValue:r={},keyName:n,min:l,max:i})=>{const{control:o}=t();return J({},a({control:o,name:e,keyName:n}),{name:e,defaultValue:r,min:l,max:i})},De=({index:r})=>{const{clearErrors:n}=t(),{name:a,remove:l,fields:i}=Ie();return e.useEffect(()=>{n(a)},[]),{index:r,isFirst:0===r,isLast:r===i.length-1,name:`${a}.${r}`,remove:e.useCallback(()=>{n(a),l(r)},[r])}},Pe=()=>{const{isFirst:e,remove:t}=ze(),{min:r,fields:n}=Ie();return{onClick:()=>t(),isDisabled:e&&!!(r&&n.length<=r)}},Re=()=>{const{append:e,defaultValue:t,max:r,fields:n}=Ie();return{onClick:()=>e(t,{shouldFocus:!1}),isDisabled:!!(r&&n.length>=r)}},Ue=["children","columns","spacing"],Me=["children"],$e=["name","defaultValue","keyName","min","max","children"],Be=({children:t,columns:r,spacing:n,index:a})=>/*#__PURE__*/e.createElement(qe,{index:a},/*#__PURE__*/e.createElement(Te,{columns:r,spacing:n},t),/*#__PURE__*/e.createElement(Ge,null)),Te=t=>{let{children:r,columns:n,spacing:a}=t,l=K(t,Ue);const{name:i}=ze();/*#__PURE__*/return e.createElement(Ae,J({flex:"1",columns:n,gridGap:a,mr:"2"},l),ke(i,r))},qe=({children:t,index:r})=>{const n=De({index:r});/*#__PURE__*/return e.createElement(Ve,{value:n},/*#__PURE__*/e.createElement(V.div,{__css:{display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%",mb:4}},t))},Ge=t=>/*#__PURE__*/e.createElement(T,J({icon:/*#__PURE__*/e.createElement(U,null),"aria-label":"Remove row"},Pe(),t)),We=t=>/*#__PURE__*/e.createElement(T,J({icon:/*#__PURE__*/e.createElement(M,null),"aria-label":"Add row",float:"right"},Re(),t)),He=t=>{const{children:r}=t,n=K(t,Me);/*#__PURE__*/return e.createElement(Ke,n,/*#__PURE__*/e.createElement(Je,null,t=>/*#__PURE__*/e.createElement(e.Fragment,null,t.map(({id:t},n)=>/*#__PURE__*/e.createElement(Be,{key:t,index:n},r)))),/*#__PURE__*/e.createElement(We,null))},Je=({children:e})=>{const{fields:t}=Ie();return e(t)},Ke=t=>{let{name:r,defaultValue:n,keyName:a,min:l,max:i,children:o}=t,s=K(t,$e);const c=Le({name:r,defaultValue:n,keyName:a,min:l,max:i});/*#__PURE__*/return e.createElement(Fe,{value:c},/*#__PURE__*/e.createElement(ce,J({name:r},s),o))},Qe=["name","label","hideLabel","children","columns","spacing"],Xe=t=>{const r=S();/*#__PURE__*/return e.createElement(c,J({as:"legend",sx:r.legend},t))},Ye=t=>{const{name:r,label:n,hideLabel:a,children:l,columns:i,spacing:o}=t,c=K(t,Qe);/*#__PURE__*/return e.createElement(s,J({name:r,as:"fieldset"},c),/*#__PURE__*/e.createElement(Xe,{display:a?"none":"block"},n),/*#__PURE__*/e.createElement(Ae,{columns:i,gridGap:o},ke(r,l)))},Ze=["name","type"],et=["schema"],tt=["name","type","defaultValue"],rt=(t,r)=>Ce(((e,t)=>F(e,t))(t,r)).map(t=>{let{name:r,type:n}=t,a=K(t,Ze);/*#__PURE__*/return e.createElement(ue,J({key:r,name:r,type:n},a))}),nt=t=>{let{schema:r}=t,n=K(t,et);/*#__PURE__*/return e.createElement(Ae,n,Ce(r).map(t=>{let{name:n,type:a}=t,l=K(t,tt);return"array"===a?/*#__PURE__*/e.createElement(He,J({name:n},l),rt(r,n)):"object"===a?/*#__PURE__*/e.createElement(Ye,J({name:n},l),rt(r,n)):/*#__PURE__*/e.createElement(ue,J({key:n,name:n,type:a},l))}))},at=["mode","resolver","reValidateMode","shouldFocusError","shouldUnregister","shouldUseNativeValidation","criteriaMode","delayError","schema","defaultValues","onSubmit","onError","formRef","children"],lt=p((t,r)=>{const{mode:n="all",resolver:a,reValidateMode:o,shouldFocusError:s,shouldUnregister:c,shouldUseNativeValidation:u,criteriaMode:p,delayError:m,schema:d,defaultValues:f,onSubmit:h,onError:v,formRef:b,children:y}=t,_=K(t,at),g={mode:n,resolver:a,defaultValues:f,reValidateMode:o,shouldFocusError:s,shouldUnregister:c,shouldUseNativeValidation:u,criteriaMode:p,delayError:m};d&&(g.resolver=I(d));const E=l(g),{handleSubmit:S}=E;return e.useImperativeHandle(r,()=>E,[r,E]),/*#__PURE__*/e.createElement(i,E,/*#__PURE__*/e.createElement(x.form,J({ref:b,onSubmit:S(h,v)},_),y))}),it=["children","disableIfUntouched","disableIfInvalid"],ot=z((r,n)=>{const{children:a,disableIfUntouched:l,disableIfInvalid:i}=r,o=K(r,it),{formState:s}=t();/*#__PURE__*/return e.createElement(q,J({type:"submit",isLoading:s.isSubmitting,isPrimary:!0,ref:n,isDisabled:l&&!s.isDirty||i&&!s.isValid},o),a)});ot.defaultProps={label:"Submit",disableIfUntouched:!1,disableIfInvalid:!1};const st=["schema","submitLabel"],ct=p((t,r)=>{const{schema:n,submitLabel:a="Submit"}=t,l=K(t,st);/*#__PURE__*/return e.createElement(lt,J({},l,{schema:n,ref:r}),/*#__PURE__*/e.createElement(Ae,null,/*#__PURE__*/e.createElement(nt,{schema:n}),a&&/*#__PURE__*/e.createElement(ot,{label:a})))}),ut=({children:e,name:r,defaultValue:n,isDisabled:a,isExact:l,condition:i=(e=>!!e)})=>i(o({name:r,defaultValue:n,disabled:a,exact:l}),t())?e:null;var pt,mt,dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ft(e){return"function"==typeof e}pt=function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,a="[object Arguments]",l="[object Function]",i="[object Object]",o=/^\[object .+?Constructor\]$/,s=/^(?:0|[1-9]\d*)$/,c={};c["[object Float32Array]"]=c["[object Float64Array]"]=c["[object Int8Array]"]=c["[object Int16Array]"]=c["[object Int32Array]"]=c["[object Uint8Array]"]=c["[object Uint8ClampedArray]"]=c["[object Uint16Array]"]=c["[object Uint32Array]"]=!0,c[a]=c["[object Array]"]=c["[object ArrayBuffer]"]=c["[object Boolean]"]=c["[object DataView]"]=c["[object Date]"]=c["[object Error]"]=c[l]=c["[object Map]"]=c["[object Number]"]=c[i]=c["[object RegExp]"]=c["[object Set]"]=c["[object String]"]=c["[object WeakMap]"]=!1;var u="object"==typeof dt&&dt&&dt.Object===Object&&dt,p="object"==typeof self&&self&&self.Object===Object&&self,m=u||p||Function("return this")(),d=t&&!t.nodeType&&t,f=d&&e&&!e.nodeType&&e,h=f&&f.exports===d,v=h&&u.process,b=function(){try{return f&&f.require&&f.require("util").types||v&&v.binding&&v.binding("util")}catch(e){}}(),y=b&&b.isTypedArray;function _(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var g,E,x,S=Array.prototype,j=Object.prototype,N=m["__core-js_shared__"],C=Function.prototype.toString,O=j.hasOwnProperty,w=(g=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",A=j.toString,k=C.call(Object),F=RegExp("^"+C.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),I=h?m.Buffer:void 0,V=m.Symbol,z=m.Uint8Array,L=(E=Object.getPrototypeOf,x=Object,function(e){return E(x(e))}),D=Object.create,P=j.propertyIsEnumerable,R=S.splice,U=V?V.toStringTag:void 0,M=function(){try{var e=ie(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),$=I?I.isBuffer:void 0,B=Math.max,T=Date.now,q=ie(m,"Map"),G=ie(Object,"create"),W=function(){function e(){}return function(t){if(!ye(t))return{};if(D)return D(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function H(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function J(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function K(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Q(e){var t=this.__data__=new J(e);this.size=t.size}function X(e,t,r){(void 0!==r&&!pe(e[t],r)||void 0===r&&!(t in e))&&ee(e,t,r)}function Y(e,t,r){var n=e[t];O.call(e,t)&&pe(n,r)&&(void 0!==r||t in e)||ee(e,t,r)}function Z(e,t){for(var r=e.length;r--;)if(pe(e[r][0],t))return r;return-1}function ee(e,t,r){"__proto__"==t&&M?M(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function te(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":U&&U in Object(e)?function(e){var t=O.call(e,U),r=e[U];try{e[U]=void 0;var n=!0}catch(e){}var a=A.call(e);return n&&(t?e[U]=r:delete e[U]),a}(e):function(e){return A.call(e)}(e)}function re(e){return _e(e)&&te(e)==a}function ne(e,t,r,n,a){e!==t&&function(e,t,r){for(var n=-1,a=Object(e),l=r(e),i=l.length;i--;){var o=l[++n];if(!1===t(a[o],o))break}}(t,function(l,o){if(a||(a=new Q),ye(l))!function(e,t,r,n,a,l,o){var s=ce(e,r),c=ce(t,r),u=o.get(c);if(u)X(e,r,u);else{var p,m,d,f,h=l?l(s,c,r+"",e,t,o):void 0,v=void 0===h;if(v){var b=de(c),y=!b&&he(c),_=!b&&!y&&ge(c);h=c,b||y||_?de(s)?h=s:_e(f=s)&&fe(f)?h=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(s):y?(v=!1,h=c.slice()):_?(v=!1,d=new(m=(p=c).buffer).constructor(m.byteLength),new z(d).set(new z(m)),h=new p.constructor(d,p.byteOffset,p.length)):h=[]:function(e){if(!_e(e)||te(e)!=i)return!1;var t=L(e);if(null===t)return!0;var r=O.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&C.call(r)==k}(c)||me(c)?(h=s,me(s)?h=function(e){return function(e,t,r,n){var a=!r;r||(r={});for(var l=-1,i=t.length;++l<i;){var o=t[l],s=void 0;void 0===s&&(s=e[o]),a?ee(r,o,s):Y(r,o,s)}return r}(e,Ee(e))}(s):ye(s)&&!ve(s)||(h=function(e){return"function"!=typeof e.constructor||se(e)?{}:W(L(e))}(c))):v=!1}v&&(o.set(c,h),a(h,c,n,l,o),o.delete(c)),X(e,r,h)}}(e,t,o,r,ne,n,a);else{var s=n?n(ce(e,o),l,o+"",e,t,a):void 0;void 0===s&&(s=l),X(e,o,s)}},Ee)}H.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},H.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},H.prototype.get=function(e){var t=this.__data__;if(G){var n=t[e];return n===r?void 0:n}return O.call(t,e)?t[e]:void 0},H.prototype.has=function(e){var t=this.__data__;return G?void 0!==t[e]:O.call(t,e)},H.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=G&&void 0===t?r:t,this},J.prototype.clear=function(){this.__data__=[],this.size=0},J.prototype.delete=function(e){var t=this.__data__,r=Z(t,e);return!(r<0||(r==t.length-1?t.pop():R.call(t,r,1),--this.size,0))},J.prototype.get=function(e){var t=this.__data__,r=Z(t,e);return r<0?void 0:t[r][1]},J.prototype.has=function(e){return Z(this.__data__,e)>-1},J.prototype.set=function(e,t){var r=this.__data__,n=Z(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},K.prototype.clear=function(){this.size=0,this.__data__={hash:new H,map:new(q||J),string:new H}},K.prototype.delete=function(e){var t=le(this,e).delete(e);return this.size-=t?1:0,t},K.prototype.get=function(e){return le(this,e).get(e)},K.prototype.has=function(e){return le(this,e).has(e)},K.prototype.set=function(e,t){var r=le(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Q.prototype.clear=function(){this.__data__=new J,this.size=0},Q.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Q.prototype.get=function(e){return this.__data__.get(e)},Q.prototype.has=function(e){return this.__data__.has(e)},Q.prototype.set=function(e,t){var r=this.__data__;if(r instanceof J){var n=r.__data__;if(!q||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new K(n)}return r.set(e,t),this.size=r.size,this};var ae=M?function(e,t){return M(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:je;function le(e,t){var r,n,a=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?a["string"==typeof t?"string":"hash"]:a.map}function ie(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!ye(e)||function(e){return!!w&&w in e}(e))&&(ve(e)?F:o).test(function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(r)?r:void 0}function oe(e,t){var r=typeof e;return!!(t=null==t?n:t)&&("number"==r||"symbol"!=r&&s.test(e))&&e>-1&&e%1==0&&e<t}function se(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||j)}function ce(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ue=function(e){var t=0,r=0;return function(){var n=T(),a=16-(n-r);if(r=n,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ae);function pe(e,t){return e===t||e!=e&&t!=t}var me=re(function(){return arguments}())?re:function(e){return _e(e)&&O.call(e,"callee")&&!P.call(e,"callee")},de=Array.isArray;function fe(e){return null!=e&&be(e.length)&&!ve(e)}var he=$||function(){return!1};function ve(e){if(!ye(e))return!1;var t=te(e);return t==l||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function ye(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var ge=y?function(e){return function(t){return e(t)}}(y):function(e){return _e(e)&&be(e.length)&&!!c[te(e)]};function Ee(e){return fe(e)?function(e,t){var r=de(e),n=!r&&me(e),a=!r&&!n&&he(e),l=!r&&!n&&!a&&ge(e),i=r||n||a||l,o=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],s=o.length;for(var c in e)i&&("length"==c||a&&("offset"==c||"parent"==c)||l&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||oe(c,s))||o.push(c);return o}(e):function(e){if(!ye(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=se(e),r=[];for(var n in e)("constructor"!=n||!t&&O.call(e,n))&&r.push(n);return r}(e)}var xe,Se=(xe=function(e,t,r,n){ne(e,t,r,n)},function(e,t){return ue(function(e,t,r){return t=B(void 0===t?e.length-1:t,0),function(){for(var n=arguments,a=-1,l=B(n.length-t,0),i=Array(l);++a<l;)i[a]=n[t+a];a=-1;for(var o=Array(t+1);++a<t;)o[a]=n[a];return o[t]=r(i),_(e,this,o)}}(e,void 0,je),e+"")}(function(e,t){var r=-1,n=t.length,a=n>1?t[n-1]:void 0,l=n>2?t[2]:void 0;for(a=xe.length>3&&"function"==typeof a?(n--,a):void 0,l&&function(e,t,r){if(!ye(r))return!1;var n=typeof t;return!!("number"==n?fe(r)&&oe(t,r.length):"string"==n&&t in r)&&pe(r[t],e)}(t[0],t[1],l)&&(a=n<3?void 0:a,n=1),e=Object(e);++r<n;){var i=t[r];i&&xe(e,i,r,a)}return e}));function je(e){return e}e.exports=Se},pt(mt={exports:{}},mt.exports);var ht="production"!==process.env.NODE_ENV;process;var vt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")};function bt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){t.some(function(t){return null==t||t(e),null==e?void 0:e.defaultPrevented})}}Object.freeze(["base","sm","md","lg","xl","2xl"]);var yt="production"!==process.env.NODE_ENV;process;var _t=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(Boolean).join(" ")};function gt(){return gt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gt.apply(this,arguments)}function Et(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(r=l[n])>=0||(a[r]=e[r]);return a}Object.freeze(["base","sm","md","lg","xl","2xl"]);const[xt,St]=G({name:"StepperContext",errorMessage:"useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`"});function jt(t){const{step:r}=t,[n,a]=e.useState(-1),l=e.useRef([]),[,i]=e.useState(Date.now()),o=e.useCallback(e=>{const t=[...l.current];-1===t.indexOf(e)&&t.push(e),l.current=t,i(Date.now())},[l,i]),s=e=>{const t=l.current.indexOf(e);-1!==t&&a(t)};return e.useLayoutEffect(()=>{"string"==typeof r?s(r):"number"==typeof r?a(r):-1===n&&a(0)},[r]),{stepsRef:l,activeStep:l.current[n],activeIndex:n,isFirstStep:0===n,isLastStep:n===l.current.length-1,isCompleted:n>=l.current.length,setIndex:a,setStep:s,nextStep:()=>{a(n+1)},prevStep:()=>{a(n-1)},registerStep:o,unregisterStep:e=>{l.current=l.current.slice(l.current.indexOf(e),1)}}}function Nt(t){const{name:r,isActive:n,isCompleted:a}=t,{registerStep:l,unregisterStep:i,activeStep:o}=St();return e.useEffect(()=>{if(r)return l(r),()=>{i(r)}},[]),{isActive:r?o===r:n,isCompleted:a}}const Ct=["children","orientation"],Ot=["children","orientation","stepComponent"],wt=["children","isOpen"],At=["icon","isActive","isCompleted","className"],kt=["title","icon","isActive","isCompleted"],Ft=["isActive"],It=z((t,r)=>{const n=L("Stepper",t),a=D(t),{children:l,orientation:i}=a,o=Et(a,Ct),s=jt(t),c=gt({display:"flex",flexDirection:"column"},n.container);return e.createElement(P,{value:n},/*#__PURE__*/e.createElement(xt,{value:s},/*#__PURE__*/e.createElement(V.div,gt({ref:r,__css:c},o,{className:_t("saas-stepper__container",t.className)}),/*#__PURE__*/e.createElement(Vt,{orientation:i},l))))});yt&&(It.displayName="Stepper");const Vt=t=>{var r,n;const{children:a,orientation:l,stepComponent:i}=t,o=Et(t,Ot),s=R(),{activeIndex:c}=St(),u=gt({display:"flex",flexDirection:"row",alignItems:"center"},s.steps),p="vertical"===l,m=i||Dt,d=W(a,m),f=d.reduce((t,r,n,a)=>(t.push(/*#__PURE__*/e.createElement(m,gt({key:n},r.props,{icon:r.props.icon||n+1,isActive:c===n,isCompleted:r.props.isCompleted||c>n}))),"vertical"===l&&t.push(/*#__PURE__*/e.createElement(zt,{isOpen:c===n},r.props.children)),n<a.length-1&&t.push(/*#__PURE__*/e.createElement(Pt,{key:`separator-${n}`,isActive:n<c})),t),[]),h=H(a,Ut),v=c>=d.length?h:p?null:null==(r=d[c])||null==(n=r.props)?void 0:n.children;return e.createElement(e.Fragment,null,/*#__PURE__*/e.createElement(V.div,gt({__css:u},o,{className:_t("saas-stepper__steps",t.className)}),f),v&&/*#__PURE__*/e.createElement(zt,null,v))};yt&&(Vt.displayName="StepperSteps");const zt=t=>{const{children:r,isOpen:n=!0}=t,a=Et(t,wt),l=R();return e.createElement(V.div,gt({__css:l.content},a,{className:_t("saas-stepper__content",t.className)}),/*#__PURE__*/e.createElement(j,{in:n},r))};yt&&(zt.displayName="StepperContent");const Lt=t=>{const{icon:r,isCompleted:n,className:a}=t,l=Et(t,At),i=gt({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"full",fontSize:"1em",me:2},R().icon);let o;return o=n?/*#__PURE__*/e.createElement($,{as:B}):r,/*#__PURE__*/e.createElement(V.div,gt({__css:i},l,{className:_t("saas-stepper__icon",a)}),o)};yt&&(Lt.displayName="StepperIcon");const Dt=t=>{const{title:r,icon:n,isActive:a,isCompleted:l}=t,i=Et(t,kt),o=Nt(t),s=gt({display:"flex",alignItems:"center",flexDirection:"row"},R().step);return e.createElement(V.div,gt({__css:s,"data-active":o.isActive,"data-completed":o.isCompleted},i,{className:_t("saas-stepper__step",t.className)}),/*#__PURE__*/e.createElement(Lt,{icon:n,isActive:a,isCompleted:l}),r&&/*#__PURE__*/e.createElement(Rt,null,r))};yt&&(Dt.displayName="StepperStep");const Pt=t=>{const{isActive:r}=t,n=Et(t,Ft),a=gt({flex:1,borderTopWidth:"1px",mx:2},R().separator);return e.createElement(V.div,gt({"data-active":r},n,{className:_t("saas-stepper__separator",t.className),__css:a}))};yt&&(Pt.displayName="StepperSeparator");const Rt=t=>{const r=R();return e.createElement(V.p,gt({},t,{__css:r.title,className:_t("saas-stepper__title",t.className)}))};yt&&(Rt.displayName="StepperStepTitle");const Ut=t=>{const r=R();return e.createElement(V.div,gt({__css:r.completed},t,{className:_t("saas-stepper__completed",t.className)}))};yt&&(Ut.displayName="StepperCompleted");const[Mt,$t]=G({name:"StepFormContext",errorMessage:"useStepFormContext: `context` is undefined. Seems you forgot to wrap step form components in `<StepForm />`"});function Bt(t){const r=jt(t),{activeStep:n,isLastStep:a,nextStep:l}=r,[i,o]=e.useState({}),s=e.useCallback(async e=>{if(a)return null==t.onSubmit?void 0:t.onSubmit(e).then(()=>{u(J({},i[n],{isCompleted:!0}))}).then(l);l()},[n,a]),c=e.useCallback(e=>{const t=i[n];return{onSubmit:s,schema:null==t?void 0:t.schema}},[i,s,n]),u=e.useCallback(e=>{o(t=>J({},t,{[e.name]:e}))},[i]);return J({getFormProps:c,updateStep:u,steps:i},r)}function Tt(t){const{name:r,schema:n}=t,a=Nt({name:r}),{steps:l,updateStep:i}=$t();return e.useEffect(()=>{i({name:r,schema:n})},[r,n]),J({},a,l[r]||{})}const qt=["children","onSubmit"],Gt=["getFormProps"],Wt=["name","schema","children","className"],Ht=["label","submitLabel"],Jt=e.forwardRef((t,r)=>{const{children:n}=t,a=K(t,qt),l=Bt(t),{getFormProps:i}=l,o=K(l,Gt),s=e.useMemo(()=>o,[o]);/*#__PURE__*/return e.createElement(xt,{value:s},/*#__PURE__*/e.createElement(Mt,{value:s},/*#__PURE__*/e.createElement(lt,J({ref:r},a,i(t)),function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return ft(e)?e.apply(void 0,r):e}(n,l))))}),Kt=t=>{const r=L("Stepper",t),{children:n}=t,a=e.Children.map(n,t=>{if(e.isValidElement(t)&&(null==t?void 0:t.type)===Qt){const{isCompleted:r}=Tt(t.props);/*#__PURE__*/return e.createElement(Dt,{name:t.props.name,title:t.props.title,isCompleted:r},t.props.children)}return t});/*#__PURE__*/return e.createElement(P,{value:r},/*#__PURE__*/e.createElement(Vt,J({mb:"4"},t),a))},Qt=t=>{const{name:r,schema:n,children:a,className:l}=t,i=K(t,Wt),o=Tt({name:r,schema:n}),{isActive:s}=o;return s?/*#__PURE__*/e.createElement(V.div,J({},i,{className:vt("saas-form__step",l)}),a):null};ht&&(Qt.displayName="FormStep");const Xt=t=>{const{isFirstStep:r,isCompleted:n,prevStep:a}=St();/*#__PURE__*/return e.createElement(q,J({isDisabled:r||n,label:"Back"},t,{className:vt("saas-form__prev-button",t.className),onClick:bt(t.onClick,a)}))};ht&&(Xt.displayName="PrevButton");const Yt=t=>{const{label:r="Next",submitLabel:n="Complete"}=t,a=K(t,Ht),{isLastStep:l,isCompleted:i}=St();/*#__PURE__*/return e.createElement(ot,J({isDisabled:i,label:l||i?n:r},a,{className:vt("saas-form__next-button",t.className)}))};ht&&(Yt.displayName="NextButton");export{He as ArrayField,We as ArrayFieldAddButton,Ke as ArrayFieldContainer,Fe as ArrayFieldProvider,Ge as ArrayFieldRemoveButton,Be as ArrayFieldRow,qe as ArrayFieldRowContainer,Te as ArrayFieldRowFields,Ve as ArrayFieldRowProvider,Je as ArrayFieldRows,ct as AutoForm,ce as BaseField,ge as CheckboxField,X as DisplayField,ut as DisplayIf,ue as Field,nt as Fields,lt as Form,Ae as FormLayout,Xe as FormLegend,Qt as FormStep,Kt as FormStepper,Y as FormValue,fe as InputField,Se as NativeSelectField,Yt as NextButton,he as NumberInputField,Ye as ObjectField,ve as PasswordInputFIeld,xe as PinField,Xt as PrevButton,Ee as RadioField,_e as SelectField,Jt as StepForm,Mt as StepFormProvider,ot as SubmitButton,ye as SwitchField,be as TextareaField,de as registerFieldType,Le as useArrayField,Re as useArrayFieldAddButton,Ie as useArrayFieldContext,Pe as useArrayFieldRemoveButton,De as useArrayFieldRow,ze as useArrayFieldRowContext,Tt as useFormStep,Bt as useStepForm,$t as useStepFormContext,pe as withControlledInput,me as withUncontrolledInput};
2
2
  //# sourceMappingURL=index.modern.js.map