import{a as e,c as t,i as n}from"./preload-helper-B45gAKPr.js";import{pn as r,t as i}from"./iframe-NOj5DEP4.js";import{a,i as o}from"./popover-C_RA1r_Q.js";import{n as s,t as c}from"./Button-CqbxyL6u.js";import{c as l,t as u}from"./Input-CtFBsQ8Z.js";var d=e({AnchorPlacement:()=>_,Controlled:()=>g,Default:()=>h,WithInteractiveContent:()=>v,__namedExportsOrder:()=>y,default:()=>m}),f,p,m,h,g,_,v,y,b=n((()=>{f=t(r(),1),s(),l(),a(),p=i(),m={title:`Shared/UI/Popover`,component:o,parameters:{atomicCanvas:!0,layout:`centered`}},h={render:()=>(0,p.jsxs)(o,{children:[(0,p.jsx)(o.Trigger,{children:(0,p.jsx)(`button`,{children:`Открыть`})}),(0,p.jsx)(o.Content,{children:e=>(0,p.jsxs)(`div`,{style:{padding:12,maxWidth:160},children:[(0,p.jsx)(`p`,{children:`Пример простого поповера`}),(0,p.jsx)(`button`,{onClick:e.setClose,children:`Закрыть`})]})})]})},g={render:()=>{let[e,t]=(0,f.useState)(!1);return(0,p.jsxs)(o,{open:e,onOpenChange:t,children:[(0,p.jsx)(o.Trigger,{children:(0,p.jsx)(`button`,{children:e?`Закрыть`:`Открыть`})}),(0,p.jsx)(o.Content,{children:(0,p.jsx)(`div`,{style:{padding:12},children:`Контролируемый режим`})})]})}},_={render:()=>(0,p.jsx)(`div`,{style:{display:`flex`,gap:32,flexWrap:`wrap`,justifyContent:`center`},children:[`top`,`bottom`,`left`,`right`,`top-start`,`bottom-end`].map(e=>(0,p.jsxs)(o,{placement:e,children:[(0,p.jsx)(o.Trigger,{children:(0,p.jsx)(`button`,{children:e})}),(0,p.jsx)(o.Content,{children:(0,p.jsx)(`div`,{style:{padding:8},children:e})})]},e))})},v={render:()=>(0,p.jsxs)(o,{children:[(0,p.jsx)(o.Trigger,{children:(0,p.jsx)(`button`,{children:`Форма`})}),(0,p.jsx)(o.Content,{children:e=>(0,p.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e.setClose()},style:{display:`flex`,flexDirection:`column`,gap:8,padding:12,width:180},children:[(0,p.jsx)(u,{label:`Имя`,placeholder:`Введите имя`,value:``,onChange:()=>{}}),(0,p.jsx)(c,{children:`Отправить`})]})})]})},h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
  render: () => <Popover>
            <Popover.Trigger>
                <button>Открыть</button>
            </Popover.Trigger>
            <Popover.Content>
                {ctx => <div style={{
        padding: 12,
        maxWidth: 160
      }}>
                        <p>Пример простого поповера</p>
                        <button onClick={ctx.setClose}>Закрыть</button>
                    </div>}
            </Popover.Content>
        </Popover>
}`,...h.parameters?.docs?.source}}},g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
  render: () => {
    const [open, setOpen] = useState(false);
    return <Popover open={open} onOpenChange={setOpen}>
                <Popover.Trigger>
                    <button>{open ? "Закрыть" : "Открыть"}</button>
                </Popover.Trigger>
                <Popover.Content>
                    <div style={{
          padding: 12
        }}>Контролируемый режим</div>
                </Popover.Content>
            </Popover>;
  }
}`,...g.parameters?.docs?.source}}},_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`{
  render: () => <div style={{
    display: "flex",
    gap: 32,
    flexWrap: "wrap",
    justifyContent: "center"
  }}>
            {["top", "bottom", "left", "right", "top-start", "bottom-end"].map(pos => <Popover key={pos} placement={pos as Placement}>
                    <Popover.Trigger>
                        <button>{pos}</button>
                    </Popover.Trigger>
                    <Popover.Content>
                        <div style={{
          padding: 8
        }}>{pos}</div>
                    </Popover.Content>
                </Popover>)}
        </div>
}`,..._.parameters?.docs?.source}}},v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
  render: () => <Popover>
            <Popover.Trigger>
                <button>Форма</button>
            </Popover.Trigger>
            <Popover.Content>
                {ctx => <form onSubmit={e => {
        e.preventDefault();
        ctx.setClose();
      }} style={{
        display: "flex",
        flexDirection: "column",
        gap: 8,
        padding: 12,
        width: 180
      }}>
                        <Input label="Имя" placeholder="Введите имя" value={""} onChange={() => {}} />
                        <Button>Отправить</Button>
                    </form>}
            </Popover.Content>
        </Popover>
}`,...v.parameters?.docs?.source}}},y=[`Default`,`Controlled`,`AnchorPlacement`,`WithInteractiveContent`]}));b();export{_ as AnchorPlacement,g as Controlled,h as Default,v as WithInteractiveContent,y as __namedExportsOrder,m as default,b as n,d as t};