import{i as l}from"./_virtual___federation_fn_import-DB-0B1B_.js";import{j as e}from"./jsx-runtime-u17CrQMm.js";import{e as h,u as S}from"./index.esm-CTnR63pP.js";import{as as x}from"./index-KpBDpTrU.js";import{S as j}from"./sortable-list-BlHb6Qrt.js";import"./error-boundary-DgBD6_Zp.js";const{SectionListSection:v,SectionListSectionContent:L,SectionListSectionHeader:f,SectionListSectionTitle:b,SwitchFieldController:y}=await l("@baseplate-dev/ui-components");function Q({control:t}){return e.jsxs(v,{children:[e.jsx(f,{children:e.jsx(b,{children:"GraphQL"})}),e.jsx(L,{className:"space-y-4",children:e.jsx(y,{label:"Expose in GraphQL schema",control:t,name:"isExposed",description:"Whether to expose this enum in the GraphQL schema"})})]})}function C(t){return t.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}const{modelEnumValueEntityType:N}=await l("@baseplate-dev/project-builder-lib"),{Button:c,InputFieldController:o,SectionListSection:E,SectionListSectionContent:g,SectionListSectionDescription:w,SectionListSectionHeader:V,SectionListSectionTitle:$}=await l("@baseplate-dev/ui-components");function H({control:t,setValue:r}){const{fields:n,remove:i,append:m,move:d}=h({control:t,name:"values"}),a=S({control:t,name:"values"}),p=n.map((u,s)=>({id:u.id,element:e.jsxs("div",{className:"grid grid-cols-[repeat(3,minmax(130px,1fr))_40px] items-start gap-3 border-b pb-4",children:[e.jsx(o,{control:t,name:`values.${s}.name`,label:"Value Name"}),e.jsx(o,{control:t,name:`values.${s}.friendlyName`,label:"Friendly Name",onFocus:()=>{!a[s].friendlyName&&a[s].name&&r(`values.${s}.friendlyName`,C(a[s].name))}}),e.jsx(o,{control:t,name:`values.${s}.description`,label:"Optional Description",placeholder:"Enter description"}),e.jsxs(c,{className:"mt-6",variant:"ghost",size:"icon",onClick:()=>{i(s)},children:[e.jsx(x,{}),e.jsx("div",{className:"sr-only",children:"Delete Enum"})]})]})}));return e.jsxs(E,{children:[e.jsxs(V,{children:[e.jsx($,{children:"Enum Values"}),e.jsx(w,{children:"Configure the allowed values for this enum."})]}),e.jsxs(g,{className:"space-y-4",children:[n.length===0?e.jsx("p",{className:"pt-4 text-style-muted",children:"Add some values to get started"}):e.jsx(j,{listItems:p,sortItems:d}),e.jsx(c,{size:"sm",variant:"secondary",onClick:()=>{m({id:N.generateNewId(),name:"",friendlyName:"",description:""})},children:"Add Value"})]})]})}export{Q as E,H as a};
//# sourceMappingURL=enum-values-section-CDBP6I6b.js.map
