import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{t as r}from"./jsx-runtime-C2wGStra.js";import{n as i,t as a}from"./Button-DqcfuOFN.js";import{n as o,t as s}from"./Dialog-B7WqtEle.js";var c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;t((()=>{c=e(n(),1),i(),o(),l=r(),{expect:u,fn:d,userEvent:f,waitFor:p}=__STORYBOOK_MODULE_TEST__,m=()=>(0,l.jsx)(`div`,{style:{width:`100%`,height:`200px`,background:`linear-gradient(to bottom, color-mix(in srgb, #e0e0e0, transparent), #e0e0e0)`}}),h=(e,t)=>{let[n,r]=(0,c.useState)(t.args.open),i=()=>{r(!1),t.args.onClose?.()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a,{dataset:{testid:`trigger`},onClick:()=>r(!0),children:`Open`}),(0,l.jsx)(e,{args:{...t.args,open:n,onClose:i}})]})},g={title:`Components/Dialog/Tests`,component:s,parameters:{preventIframeFromScrollingParent:!0,docs:{story:{inline:!1,height:600}}},decorators:[h],args:{open:!1,onClose:d(),children:(0,l.jsx)(m,{}),dataset:{testid:`dialog`}},play:async({canvas:e,step:t})=>{await t(`Open dialog`,async()=>{let t=e.getByTestId(`trigger`);return await f.click(t),p(()=>{u(e.getByTestId(`dialog`)).toBeVisible()})})}},_={tags:[`!autodocs`],args:{size:`xs`,title:`Extra Small Dialog`}},v={tags:[`!autodocs`],args:{size:`sm`,title:`Small Dialog`}},y={tags:[`!autodocs`],args:{size:`md`,title:`Medium Dialog`}},b={tags:[`!autodocs`],args:{size:`lg`,title:`Large Dialog`}},x={tags:[`!autodocs`],args:{size:{_:`lg`,"wide-s":`xs`},title:`Width Responsiveness`,description:`Change the window width to see the Dialog width respond to it`}},S={tags:[`!autodocs`],args:{title:`Test Close Overlay`},play:async e=>{await g.play?.(e);let{canvas:t,step:n,args:r}=e;await n(`Close dialog by clicking overlay`,async()=>{let e=t.getByTestId(`dialog-overlay`);return await f.click(e),p(async()=>(await u(t.queryByTestId(`dialog`)).not.toBeInTheDocument(),u(r.onClose).toHaveBeenCalledOnce()))})}},C={tags:[`!autodocs`],args:{title:`Test Close Focus`},play:async e=>{await g.play?.(e);let{canvas:t,step:n,args:r}=e;await n(`Close dialog by pressing space`,async()=>(await f.keyboard(`{Enter}`),p(async()=>(await u(t.queryByTestId(`dialog`)).not.toBeInTheDocument(),u(r.onClose).toHaveBeenCalledOnce()))))}},w={tags:[`!autodocs`],args:{title:`Test Close Keyboard`},play:async e=>{await g.play?.(e);let{canvas:t,step:n,args:r}=e;await n(`Close dialog using escape key`,async()=>(await f.keyboard(`{Escape}`),p(()=>{u(t.queryByTestId(`dialog`)).not.toBeInTheDocument(),u(r.onClose).toHaveBeenCalledOnce()})))}},T={tags:[`!autodocs`],args:{title:`Test Close Button`},play:async e=>{await g.play?.(e);let{canvas:t,step:n,args:r}=e;await n(`Close dialog using close button`,async()=>{let e=await t.findByLabelText(`Close`);return await f.click(e),p(async()=>(await u(t.queryByTestId(`dialog`)).not.toBeInTheDocument(),u(r.onClose).toHaveBeenCalledOnce()))})}},E={tags:[`!autodocs`],args:{title:`Test Close Button`},play:async e=>{await g.play?.(e);let{canvas:t,step:n}=e;await n(`Close dialog using close button`,async()=>{let e=await t.findByTestId(`dialog-close`);return await f.click(e),p(async()=>{await u(t.queryByTestId(`dialog`)).not.toBeInTheDocument()})})}},_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    size: 'xs',
    title: 'Extra Small Dialog'
  }
}`,..._.parameters?.docs?.source}}},v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    size: 'sm',
    title: 'Small Dialog'
  }
}`,...v.parameters?.docs?.source}}},y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    size: 'md',
    title: 'Medium Dialog'
  }
}`,...y.parameters?.docs?.source}}},b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    size: 'lg',
    title: 'Large Dialog'
  }
}`,...b.parameters?.docs?.source}}},x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    size: {
      _: 'lg',
      'wide-s': 'xs'
    },
    title: 'Width Responsiveness',
    description: 'Change the window width to see the Dialog width respond to it'
  }
}`,...x.parameters?.docs?.source},description:{story:`The Dialog component adapts to different screen sizes through responsive size props.
Use an object with breakpoints as keys to specify different sizes at different viewport widths:

\`\`\`tsx
<Dialog
  size={{
    _: 'lg',
    'wide-s': 'xs',
  }}
/>
\`\`\``,...x.parameters?.docs?.description}}},S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    title: 'Test Close Overlay'
  },
  play: async ctx => {
    await meta.play?.(ctx);
    const {
      canvas,
      step,
      args
    } = ctx;
    await step('Close dialog by clicking overlay', async () => {
      const overlay = canvas.getByTestId('dialog-overlay');
      await userEvent.click(overlay);
      return waitFor(async () => {
        await expect(canvas.queryByTestId('dialog')).not.toBeInTheDocument();
        return expect(args.onClose).toHaveBeenCalledOnce();
      });
    });
  }
}`,...S.parameters?.docs?.source}}},C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    title: 'Test Close Focus'
  },
  play: async ctx => {
    await meta.play?.(ctx);
    const {
      canvas,
      step,
      args
    } = ctx;
    await step('Close dialog by pressing space', async () => {
      await userEvent.keyboard('{Enter}');
      return waitFor(async () => {
        await expect(canvas.queryByTestId('dialog')).not.toBeInTheDocument();
        return expect(args.onClose).toHaveBeenCalledOnce();
      });
    });
  }
}`,...C.parameters?.docs?.source}}},w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    title: 'Test Close Keyboard'
  },
  play: async ctx => {
    await meta.play?.(ctx);
    const {
      canvas,
      step,
      args
    } = ctx;
    await step('Close dialog using escape key', async () => {
      await userEvent.keyboard('{Escape}');
      return waitFor(() => {
        expect(canvas.queryByTestId('dialog')).not.toBeInTheDocument();
        expect(args.onClose).toHaveBeenCalledOnce();
      });
    });
  }
}`,...w.parameters?.docs?.source}}},T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    title: 'Test Close Button'
  },
  play: async ctx => {
    await meta.play?.(ctx);
    const {
      canvas,
      step,
      args
    } = ctx;
    await step('Close dialog using close button', async () => {
      const closeButton = await canvas.findByLabelText('Close');
      await userEvent.click(closeButton);
      return waitFor(async () => {
        await expect(canvas.queryByTestId('dialog')).not.toBeInTheDocument();
        return expect(args.onClose).toHaveBeenCalledOnce();
      });
    });
  }
}`,...T.parameters?.docs?.source}}},E.parameters={...E.parameters,docs:{...E.parameters?.docs,source:{originalSource:`{
  tags: ['!autodocs'],
  args: {
    title: 'Test Close Button'
  },
  play: async ctx => {
    await meta.play?.(ctx);
    const {
      canvas,
      step
    } = ctx;
    await step('Close dialog using close button', async () => {
      const closeButton = await canvas.findByTestId('dialog-close');
      await userEvent.click(closeButton);
      return waitFor(async () => {
        await expect(canvas.queryByTestId('dialog')).not.toBeInTheDocument();
      });
    });
  }
}`,...E.parameters?.docs?.source}}},D=[`ExtraSmall`,`Small`,`Medium`,`Large`,`WidthResponsiveness`,`TestCloseOverlay`,`TestCloseFocus`,`TestCloseKeyboard`,`TestCloseButton`,`TestCloseButtonTestId`]}))();export{_ as ExtraSmall,b as Large,y as Medium,v as Small,T as TestCloseButton,E as TestCloseButtonTestId,C as TestCloseFocus,w as TestCloseKeyboard,S as TestCloseOverlay,x as WidthResponsiveness,D as __namedExportsOrder,g as default};