import{ao as e,c7 as d,a_ as v,at as $,ck as k,aq as g,L as C,bU as u}from"./app-k0jcl5PQ.js";import{u as q,F as w}from"./C3DvQ1wU.chunk.js";import{F as P}from"./DV1GpLCe.chunk.js";import{C as F}from"./Bdp-qhf0.chunk.js";import{m as p,C as i}from"./BUELddOb.chunk.js";import{l as c}from"./DLmnDxSd.chunk.js";const y="_dropdownToggle_8yqqg_1",S="_colourButton_8yqqg_4",L="_colourList_8yqqg_11",B="_colourOption_8yqqg_14",T="_selected_8yqqg_19",n={dropdownToggle:y,colourButton:S,colourList:L,colourOption:B,selected:T};j.defaultProps={selection:i.Pink,onSelect:()=>{}};function j(s){function o(){const r=`${n.dropdownToggle} p-0 d-flex align-items-center text-decoration-none h-100`,a=s.disabled?"cursor-default":"";return`${r} ${a}`}function l(r,a){const f=`${n.colourOption} position-relative`,b=s.disabled?"cursor-default":"",N=p(r),_=r===a?`${n.selected} border border-dark`:"";return`${f} ${b} bg-${N} ${_}`}const t={className:"h-100 dropdown"};return s.disabled&&(t.show=!1),e.jsxs(d,{...t,children:[e.jsx(d.Toggle,{id:s.id,variant:"link",className:o(),children:e.jsxs("div",{className:`d-flex align-items-center border border-secondary rounded bg-white h-100 ${n.colourButton}`,children:[e.jsx("div",{className:`px-0 py-1 rounded bg-${p(s.selection)}`,children:" "}),!s.disabled&&e.jsx(v,{svg:F})]})}),e.jsx(d.Menu,{children:e.jsx("ul",{className:`${n.colourList} list-unstyled d-flex flex-wrap px-2 m-0`,children:Object.keys(i).map(r=>{const a=i[r];return e.jsx("li",{className:"m-1",children:e.jsx($,{onClick:()=>s.onSelect(a),className:l(a,s.selection),children:" "})},`${s.id}:${a}`)})})})]})}const G="_groupNameInput_16qng_1",O="_colourPickerContainer_16qng_5",h={groupNameInput:G,colourPickerContainer:O},x="classrooms.classroomGroupDetailsForm",D=C.encloseNamespace(x);function E(s){const o=q();return e.jsxs(k,{children:[e.jsxs("div",{className:"d-flex",children:[e.jsxs("div",{className:"form-group me-2",children:[e.jsx("label",{htmlFor:`${s.isNew?"create":"edit"}-classroom-group`,children:e.jsx(g,{namespace:x,phrase:"colourLabel"})}),e.jsx("div",{className:h.colourPickerContainer,children:e.jsx(j,{onSelect:l=>o.setFieldValue("colour",l),selection:o.values.colour,id:`${s.isNew?"create":"edit"}-classroom-group`})})]}),e.jsxs("div",{className:"form-group w-75",children:[e.jsx("label",{htmlFor:"name",children:e.jsx(g,{namespace:x,phrase:"nameLabel"})}),e.jsx(P,{type:"text",name:"name",id:"name",maxLength:255,className:`${h.groupNameInput}`,placeholder:D("groupNamePlaceholder"),autoFocus:!0,value:o.values.name})]})]}),e.jsxs(u,{children:[e.jsx(u.Cancel,{onClick:s.onClickCancel}),e.jsx(u.Submit,{variant:"dark",isNew:s.isNew})]})]})}const m=C.encloseNamespace("classrooms.classroomValidation"),V=c.object().shape({name:c.string().max(255,()=>m("nameExceeds")).required(()=>m("nameRequired")).default(""),description:c.string().default(""),colour:c.string().required(()=>m("colourRequired")).default(i.Pink)});function A(s){var a;const{group:o,saveGroup:l,onClickCancel:t}=s,r={id:o==null?void 0:o.id,name:o==null?void 0:o.name,description:o==null?void 0:o.description,colour:(a=o==null?void 0:o.metadata)==null?void 0:a.colour};return e.jsx(w,{initialValues:r,validationSchema:V,onSubmit:l,children:e.jsx(E,{isNew:!o,onClickCancel:t})})}export{A as E};
//# sourceMappingURL=CkuFLKlL.chunk.js.map
