import{j as a,d as n,cE as m}from"./index-BGoV7aa6.js";const d=o=>{const{isEdit:t,formik:e,close:i,additionalFormInput:r}=o,s=l=>{l.key==="Escape"&&i()};return a.jsx(n.Modal,{className:"snapshot-creation-modal",close:i,title:`${t?"Edit":"Create"} snapshot`,buttonRow:a.jsxs(a.Fragment,{children:[a.jsx(n.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:i,children:"Cancel"}),a.jsx(n.ActionButton,{appearance:"positive",loading:e.isSubmitting,disabled:!e.isValid||e.isSubmitting,onClick:()=>void e.submitForm(),children:t?"Save changes":"Create snapshot"})]}),onKeyDown:s,children:a.jsxs(n.Form,{onSubmit:e.handleSubmit,className:"snapshot-creation-form",children:[a.jsx(n.Input,{id:"name",name:"name",type:"text",label:"Snapshot name",onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.name,error:(e.touched.name||t)&&e.errors.name?a.jsx("span",{className:"name-error",children:e.errors.name}):null,takeFocus:!0}),a.jsxs(n.Row,{className:"expiration-wrapper",children:[a.jsx(n.Col,{size:6,children:a.jsx(n.Input,{id:"expirationDate",name:"expirationDate",type:"date",label:"Expiry date",min:m(),onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.expirationDate??"",error:e.touched.expirationDate?e.errors.expirationDate:null})}),a.jsx(n.Col,{size:6,children:a.jsx(n.Input,{id:"expirationTime",name:"expirationTime",type:"time",label:"Expiry time",onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.expirationTime??"",error:e.touched.expirationTime?e.errors.expirationTime:null})})]}),r]})})};export{d as S};
