import{r as n,j as e}from"./wp-i18n-shim-DUX0OV_V.js";import{S as N,a as g,b as v,c as C,f as i}from"./select-BFNitOb0.js";const W=({value:d,onValueChange:t,error:l,placeholder:x="Select or create user",label:o="",wpUsers:a=[],onCreateNew:$,showCreateOption:m=!0,createOptionText:h="Create New WordPress User",displayFormat:j=r=>`${r.first_name} (${r.email})`,required:p=!1,disabled:f=!1,className:c="",...S})=>{const[r,u]=n.useState(a);n.useEffect(()=>{u(a)},[a]);const b=s=>{t(s)};return e.jsxs("div",{className:`${c}`,children:[e.jsxs("label",{className:"rtrb-label",children:[o,p&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),e.jsxs(N,{value:d||"",onValueChange:b,disabled:f,...S,children:[e.jsx(g,{className:`h-[45px] rounded-[8px] shadow-none border border-border ${c}`,children:e.jsx(v,{placeholder:x})}),e.jsxs(C,{children:[r.map(s=>e.jsx(i,{value:String(s.id),children:j(s)},s.id)),m&&e.jsx(i,{value:"create_new",className:"text-primary flex items-center gap-2",children:e.jsx("span",{children:h})})]})]}),l&&e.jsx("p",{className:"text-sm text-red-500",children:l})]})};export{W};
//# sourceMappingURL=WpUserSelectField-JRPQcyDm.js.map
