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,r as s}from"./OnboardingTooltip-CFzGjB8g.js";import{n as c,t as l}from"./IconButton-DZfzVk_P.js";import{n as u,t as d}from"./LayoutFlex-BKX2c6Gj.js";import{n as f,t as p}from"./TokyoUIFav-vlMA44YV.js";function m(e){return new Promise(t=>setTimeout(t,e))}var h,g,_,v,y,b,x,S,C,w;t((()=>{e(n(),1),s(),c(),f(),i(),u(),h=r(),{within:g,userEvent:_,waitFor:v,expect:y}=__STORYBOOK_MODULE_TEST__,b={title:`Components/OnboardingTooltip/Tests`,component:o,parameters:{layout:`centered`,controls:{disable:!0},chromatic:{disableSnapshot:!0}},tags:[`!autodocs`,`!a11y-test`,`test`],decorators:[e=>(0,h.jsx)(`div`,{style:{margin:`100px 0`},children:e()})],args:{title:`Title`,text:`Body text`,actionLabel:`Action label`,disabled:!1,onClose:()=>{},dataset:{testid:`tooltip`},children:(0,h.jsx)(l,{svg:(0,h.jsx)(p,{}),assistiveText:`Favorite`})}},x={play:async({canvasElement:e,step:t})=>{let n=g(e);await t(`wait for tooltip to be visible`,async()=>{await v(()=>y(n.getByTestId(`tooltip`)).toBeVisible())}),await t(`close the tooltip`,()=>{let e=g(n.getByTestId(`tooltip`)).getByTestId(`close`);return _.click(e)}),await t(`wait for tooltip to be hidden`,async()=>{await v(()=>y(n.queryByTestId(`tooltip`)).toBeNull())})}},S={play:async({canvasElement:e,step:t})=>{let n=g(e);await t(`wait for tooltip to be visible`,async()=>{await v(()=>y(n.getByTestId(`tooltip`)).toBeVisible())}),await t(`close the tooltip`,()=>{let e=g(n.getByTestId(`tooltip`)).getByTestId(`action`);return _.click(e)}),await t(`wait for tooltip to be hidden`,async()=>{await v(()=>y(n.queryByTestId(`tooltip`)).toBeNull())})}},C={render:e=>(0,h.jsxs)(d,{gap:`24`,direction:`column`,children:[(0,h.jsx)(a,{children:`Click outside the tooltip`}),(0,h.jsx)(o,{...e,children:(0,h.jsx)(l,{svg:(0,h.jsx)(p,{}),assistiveText:`Favorite`})})]}),play:async({canvasElement:e,step:t})=>{let n=g(e);await t(`wait for tooltip to be visible`,async()=>{await v(()=>y(n.getByTestId(`tooltip`)).toBeVisible())}),await t(`click outside the tooltip`,()=>{let e=n.getByText(`Click outside the tooltip`);return _.click(e)}),await t(`check the tooltip remain open`,async()=>{await m(1e3),await y(n.getByTestId(`tooltip`)).toBeVisible()})}},x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    await step('wait for tooltip to be visible', async () => {
      await waitFor(() => {
        const tooltip = canvas.getByTestId('tooltip');
        return expect(tooltip).toBeVisible();
      });
    });
    await step('close the tooltip', () => {
      const tooltip = within(canvas.getByTestId('tooltip'));
      const closeButton = tooltip.getByTestId('close');
      return userEvent.click(closeButton);
    });
    await step('wait for tooltip to be hidden', async () => {
      await waitFor(() => {
        const tooltip = canvas.queryByTestId('tooltip');
        return expect(tooltip).toBeNull();
      });
    });
  }
}`,...x.parameters?.docs?.source}}},S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    await step('wait for tooltip to be visible', async () => {
      await waitFor(() => {
        const tooltip = canvas.getByTestId('tooltip');
        return expect(tooltip).toBeVisible();
      });
    });
    await step('close the tooltip', () => {
      const tooltip = within(canvas.getByTestId('tooltip'));
      const actionButton = tooltip.getByTestId('action');
      return userEvent.click(actionButton);
    });
    await step('wait for tooltip to be hidden', async () => {
      await waitFor(() => {
        const tooltip = canvas.queryByTestId('tooltip');
        return expect(tooltip).toBeNull();
      });
    });
  }
}`,...S.parameters?.docs?.source}}},C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
  render: args => {
    return <LayoutFlex gap="24" direction="column">
                <Button>Click outside the tooltip</Button>
                <OnboardingTooltip {...args}>
                    <IconButton svg={<TokyoUIFav />} assistiveText="Favorite" />
                </OnboardingTooltip>
            </LayoutFlex>;
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    await step('wait for tooltip to be visible', async () => {
      await waitFor(() => {
        const tooltip = canvas.getByTestId('tooltip');
        return expect(tooltip).toBeVisible();
      });
    });
    await step('click outside the tooltip', () => {
      const outsideButton = canvas.getByText('Click outside the tooltip');
      return userEvent.click(outsideButton);
    });
    await step('check the tooltip remain open', async () => {
      await delay(1000);
      const tooltip = canvas.getByTestId('tooltip');
      await expect(tooltip).toBeVisible();
    });
  }
}`,...C.parameters?.docs?.source}}},w=[`Default`,`CloseWithActionButton`,`DoNotCloseOnInteractionOutside`]}))();export{S as CloseWithActionButton,x as Default,C as DoNotCloseOnInteractionOutside,w as __namedExportsOrder,b as default};