import{a as e,c as t,i as n}from"./preload-helper-B45gAKPr.js";import{pn as r,t as i}from"./iframe-CMLjY6eW.js";import{n as a,t as o}from"./MultiSelect-EUq0nGvq.js";var s=e({Basic:()=>f,Empty:()=>h,ErrorState:()=>m,Loading:()=>p,__namedExportsOrder:()=>g,default:()=>d}),c,l,u,d,f,p,m,h,g,_=n((()=>{c=t(r(),1),a(),l=i(),u=[{code:`MOW`,label:`Москва`},{code:`SPB`,label:`Санкт-Петербург`},{code:`EKB`,label:`Екатеринбург`},{code:`KZN`,label:`Казань`},{code:`NSK`,label:`Новосибирск`}],d={title:`Shared/UI/MultiSelect`,component:o,args:{label:`Города`,description:`Выберите несколько значений.`,placeholder:`Начните вводить`,value:[],onChange:()=>{},codeKey:`code`,textKey:`label`,items:u,query:``,onQuery:()=>{},onOpen:()=>{},onClose:()=>{},size:`md`,disabled:!1},parameters:{atomicCanvas:!0,layout:`padded`},argTypes:{value:{control:!1},onChange:{control:!1},items:{control:!1},onQuery:{control:!1},onOpen:{control:!1},onClose:{control:!1},renderToken:{control:!1},renderToolbar:{control:!1},renderItem:{control:!1},size:{control:`select`,options:[`xs`,`sm`,`md`,`lg`,`xl`]}}},f={render:e=>{let[t,n]=(0,c.useState)([u[1]]),[r,i]=(0,c.useState)(``),a=(0,c.useMemo)(()=>{let e=r.trim().toLowerCase();return e?u.filter(t=>t.label.toLowerCase().includes(e)||t.code.toLowerCase().includes(e)):u},[r]);return(0,l.jsx)(o,{...e,value:t,items:a,query:r,onQuery:i,onChange:n})}},p={render:e=>{let[t,n]=(0,c.useState)([]);return(0,l.jsx)(o,{...e,value:t,items:[],isLoading:!0,onChange:n})}},m={render:e=>{let[t,n]=(0,c.useState)([]);return(0,l.jsx)(o,{...e,value:t,items:[],error:`Ошибка загрузки`,onChange:n})}},h={render:e=>{let[t,n]=(0,c.useState)([]);return(0,l.jsx)(o,{...e,value:t,items:[],onChange:n})}},f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState<CollectionItem[]>([catalog[1]]);
    const [query, setQuery] = useState("");
    const filteredItems = useMemo(() => {
      const needle = query.trim().toLowerCase();
      if (!needle) {
        return catalog;
      }
      return catalog.filter(item => item.label.toLowerCase().includes(needle) || item.code.toLowerCase().includes(needle));
    }, [query]);
    return <MultiSelect {...args} value={value} items={filteredItems} query={query} onQuery={setQuery} onChange={setValue} />;
  }
}`,...f.parameters?.docs?.source}}},p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState<CollectionItem[]>([]);
    return <MultiSelect {...args} value={value} items={[]} isLoading onChange={setValue} />;
  }
}`,...p.parameters?.docs?.source}}},m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState<CollectionItem[]>([]);
    return <MultiSelect {...args} value={value} items={[]} error="Ошибка загрузки" onChange={setValue} />;
  }
}`,...m.parameters?.docs?.source}}},h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState<CollectionItem[]>([]);
    return <MultiSelect {...args} value={value} items={[]} onChange={setValue} />;
  }
}`,...h.parameters?.docs?.source}}},g=[`Basic`,`Loading`,`ErrorState`,`Empty`]}));_();export{f as Basic,h as Empty,m as ErrorState,p as Loading,g as __namedExportsOrder,d as default,_ as n,s as t};