import{n as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n}from"./react-C21x__mS.js";import{n as r}from"./iframe-DaN-XFub.js";import{n as i,t as a}from"./MultiSelect-B-wX6JPo.js";var o=t({Basic:()=>d,Empty:()=>m,ErrorState:()=>p,Loading:()=>f,__namedExportsOrder:()=>h,default:()=>u}),s,c,l,u,d,f,p,m,h;function g(){return(g=e((()=>{s=n(),i(),c=r(),l=[{code:`MOW`,label:`Москва`},{code:`SPB`,label:`Санкт-Петербург`},{code:`EKB`,label:`Екатеринбург`},{code:`KZN`,label:`Казань`},{code:`NSK`,label:`Новосибирск`}],u={title:`Shared/UI/MultiSelect`,component:a,args:{label:`Города`,description:`Выберите несколько значений.`,placeholder:`Начните вводить`,value:[],onChange:()=>{},codeKey:`code`,textKey:`label`,items:l,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`]}}},d={render:e=>{let[t,n]=(0,s.useState)([l[1]]),[r,i]=(0,s.useState)(``),o=(0,s.useMemo)(()=>{let e=r.trim().toLowerCase();return e?l.filter(t=>t.label.toLowerCase().includes(e)||t.code.toLowerCase().includes(e)):l},[r]);return(0,c.jsx)(a,{...e,value:t,items:o,query:r,onQuery:i,onChange:n})}},f={render:e=>{let[t,n]=(0,s.useState)([]);return(0,c.jsx)(a,{...e,value:t,items:[],isLoading:!0,onChange:n})}},p={render:e=>{let[t,n]=(0,s.useState)([]);return(0,c.jsx)(a,{...e,value:t,items:[],error:`Ошибка загрузки`,onChange:n})}},m={render:e=>{let[t,n]=(0,s.useState)([]);return(0,c.jsx)(a,{...e,value:t,items:[],onChange:n})}},d.parameters={...d.parameters,docs:{...d.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} />;
  }
}`,...d.parameters?.docs?.source}}},f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
  render: args => {
    const [value, setValue] = useState<CollectionItem[]>([]);
    return <MultiSelect {...args} value={value} items={[]} isLoading 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={[]} error="Ошибка загрузки" 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={[]} onChange={setValue} />;
  }
}`,...m.parameters?.docs?.source}}},h=[`Basic`,`Loading`,`ErrorState`,`Empty`]})))()}export{o as a,f as i,m as n,g as o,p as r,d as t};