import{j as s,aa as h,d as l}from"./index-3c1b2661.js";import{S as o}from"./updateMaxHeight-4e644a5f.js";const j=({name:a,titleClassName:r,parentItems:u,centerControls:d,controls:m,isLoaded:i,formik:e,renameDisabledReason:t})=>{const c=t===void 0,p=()=>{c&&e.setValues({...e.values,isRenaming:!0})};return s.jsxs("div",{className:"p-panel__header rename-header",children:[s.jsx("h1",{className:"u-off-screen",children:a}),i?s.jsxs("div",{className:h("p-panel__title",r),children:[s.jsx("nav",{className:"p-breadcrumbs","aria-label":"Breadcrumbs",children:s.jsxs("ol",{className:"p-breadcrumbs__items",children:[u.map((n,b)=>s.jsx("li",{className:"p-breadcrumbs__item",children:n},b)),e.values.isRenaming?s.jsxs("li",{className:"p-breadcrumbs__item rename",children:[s.jsx(l.Input,{autoFocus:!0,id:"name",name:"name",className:"name-input",onBlur:e.handleBlur,onChange:e.handleChange,value:e.values.name,error:e.touched.name?e.errors.name:null,onKeyUp:n=>n.key==="Enter"&&void e.submitForm(),type:"text"}),s.jsxs("div",{children:[s.jsx(l.Button,{appearance:"base",className:"cancel",onClick:()=>void e.setFieldValue("isRenaming",!1),children:"Cancel"}),s.jsx(o,{isSubmitting:e.isSubmitting,isDisabled:!e.isValid||a===e.values.name,buttonLabel:"Save",onClick:()=>void e.submitForm()})]})]}):s.jsx("li",{className:"p-breadcrumbs__item name u-truncate",onClick:p,title:a,children:s.jsx(l.Tooltip,{message:!c&&t,position:"btm-left",children:a})})]})},"breadcrumbs"),!e.values.isRenaming&&d]}):s.jsx("h4",{className:"p-panel__title",children:a}),i&&!e.values.isRenaming&&s.jsx("div",{className:"p-panel__controls",children:m})]})};export{j as R};
