import{j as e,c as i,am as v,r as l,a8 as g,A as C,y as N,B as n,T as o}from"./main-TIUJvpaR.js";import{D as S}from"./datatable-page-with-header-layout-Bbr3vl7W.js";function w({onSubmit:t,form:s,title:a,tabs:r,children:c,actions:d,isLoading:x=!1,disableSaveWhenNotDirty:m=!1,wrapInContainer:u=!0,submitButtonText:p,className:j,containerClassName:h,navbar:y}){const f=m?Object.keys(s.formState.dirtyFields).length:!0,b=e.jsx(n,{variant:"flat",color:"primary",type:"submit",disabled:x||!f,children:p??e.jsx(o,{message:"Save"})});return e.jsxs(v,{onSubmit:t,onBeforeSubmit:()=>s.clearErrors(),form:s,className:i("flex h-full flex-col",j),children:[y,e.jsx(D,{endActions:e.jsxs(l.Fragment,{children:[d,b]}),border:r?"border-none":void 0,children:a}),r&&e.jsx("div",{className:"flex-shrink-0",children:r}),e.jsx("div",{className:"overflow-y-auto",children:e.jsx("div",{className:i(u?"container mx-auto px-24 py-56":void 0,h),children:c})})]})}function D({children:t,endActions:s,border:a}){return e.jsx(S,{showSidebarToggleButton:!0,title:t,rightContent:s,border:a})}function R({label:t,children:s,margin:a="mb-48",labelMargin:r="mb-16"}){return e.jsxs("section",{className:i(a),children:[e.jsx("div",{className:i(r,"text-lg font-semibold"),children:t}),s]})}function k({saveButton:t,isLoading:s}){const{formState:a,reset:r}=g();return e.jsx(C,{children:a.isDirty&&e.jsxs(l.Fragment,{children:[e.jsx("div",{className:"invisible h-92"}),e.jsxs(N.div,{initial:{y:100,opacity:0},animate:{y:0,opacity:1},exit:{y:100,opacity:0},transition:{duration:.2},className:"fixed bottom-0 left-0 right-0 z-20 flex items-center justify-center gap-16 border-t bg px-12 py-28 shadow-[rgba(0,0,0,0.2)_0px_0px_10px]",children:[e.jsx(n,{variant:"outline",onClick:()=>r(),children:e.jsx(o,{message:"Cancel"})}),t??e.jsx(n,{variant:"flat",color:"primary",type:"submit",disabled:s,children:e.jsx(o,{message:"Save changes"})})]},"dirty-panel")]})})}export{w as C,k as D,D as a,R as b};
