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"./RangeSlider-BUc61tOj.js";var o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;t((()=>{o=e(n(),1),i(),s=r(),{action:c}=__STORYBOOK_MODULE_ACTIONS__,{expect:l,fn:u,userEvent:d,within:f}=__STORYBOOK_MODULE_TEST__,p=u(c(`change`)),m=u(c(`commit`)),h={title:`Components/Slider/RangeSlider`,component:a,decorators:[e=>(0,s.jsx)(`div`,{style:{padding:`32px`,maxWidth:`400px`},children:(0,s.jsx)(e,{})})],args:{"aria-label":`Sample`,onValueChange:p,onValueCommit:m}},g={play:async({canvasElement:e,step:t})=>{let[n,r]=f(e).getAllByRole(`slider`);l(n).not.toBeNull(),l(r).not.toBeNull(),await t(`Initial state`,async()=>{l(n).toHaveAttribute(`aria-valuenow`,`0`),l(r).toHaveAttribute(`aria-valuenow`,`100`)}),await t(`Move first thumb and verify value updates`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`1`),l(p).toBeCalledWith([1,100]),l(m).toBeCalledWith([1,100])}),await t(`Move second thumb and verify value updates`,async()=>{r.focus(),await d.keyboard(`{ArrowLeft}`),l(r).toHaveAttribute(`aria-valuenow`,`99`),l(p).toBeCalledWith([1,99]),l(m).toBeCalledWith([1,99])})}},_={args:{defaultValue:[25,75]},play:async({canvasElement:e,step:t})=>{let[n,r]=f(e).getAllByRole(`slider`);l(n).not.toBeNull(),l(r).not.toBeNull(),await t(`Initial state`,async()=>{l(n).toHaveAttribute(`aria-valuenow`,`25`),l(r).toHaveAttribute(`aria-valuenow`,`75`)}),await t(`Move first thumb and verify value updates`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`26`),l(p).toBeCalledWith([26,75]),l(m).toBeCalledWith([26,75])}),await t(`Move second thumb and verify value updates`,async()=>{r.focus(),await d.keyboard(`{ArrowLeft}`),l(r).toHaveAttribute(`aria-valuenow`,`74`),l(p).toBeCalledWith([26,74]),l(m).toBeCalledWith([26,74])})}},v={render:function(e){let[t,n]=(0,o.useState)([25,75]);return(0,s.jsx)(a,{...e,value:t,onValueChange:t=>{n(t),e.onValueChange?.(t)}})},play:async({canvasElement:e,step:t})=>{let[n,r]=f(e).getAllByRole(`slider`);l(n).not.toBeNull(),l(r).not.toBeNull(),await t(`Initial state`,async()=>{l(n).toHaveAttribute(`aria-valuenow`,`25`),l(r).toHaveAttribute(`aria-valuenow`,`75`)}),await t(`Move first thumb and verify value updates`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`26`),l(p).toBeCalledWith([26,75]),l(m).toBeCalledWith([26,75])}),await t(`Move second thumb and verify value updates`,async()=>{r.focus(),await d.keyboard(`{ArrowLeft}`),l(r).toHaveAttribute(`aria-valuenow`,`74`),l(p).toBeCalledWith([26,74]),l(m).toBeCalledWith([26,74])})}},y={args:{defaultValue:[1,4],minStepsBetweenThumbs:2,step:1},play:async({canvasElement:e,step:t})=>{let[n,r]=f(e).getAllByRole(`slider`);await l(n).not.toBeNull(),await l(r).not.toBeNull(),await t(`Initial state with minimum steps`,async()=>{await l(n).toHaveAttribute(`aria-valuenow`,`1`),await l(r).toHaveAttribute(`aria-valuenow`,`4`)}),await t(`Verify minimum steps constraint`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`.repeat(3)),await l(n).toHaveAttribute(`aria-valuenow`,`2`),r.focus(),await d.keyboard(`{ArrowLeft}`),await l(r).toHaveAttribute(`aria-valuenow`,`4`),await l(p).toHaveBeenNthCalledWith(1,[2,4])})}},g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const [min, max] = canvas.getAllByRole('slider');
    expect(min).not.toBeNull();
    expect(max).not.toBeNull();
    await step('Initial state', async () => {
      expect(min).toHaveAttribute('aria-valuenow', '0');
      expect(max).toHaveAttribute('aria-valuenow', '100');
    });
    await step('Move first thumb and verify value updates', async () => {
      min.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(min).toHaveAttribute('aria-valuenow', '1');
      expect(onValueChange).toBeCalledWith([1, 100]);
      expect(onValueCommit).toBeCalledWith([1, 100]);
    });
    await step('Move second thumb and verify value updates', async () => {
      max.focus();
      await userEvent.keyboard('{ArrowLeft}');
      expect(max).toHaveAttribute('aria-valuenow', '99');
      expect(onValueChange).toBeCalledWith([1, 99]);
      expect(onValueCommit).toBeCalledWith([1, 99]);
    });
  }
}`,...g.parameters?.docs?.source}}},_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`{
  args: {
    defaultValue: [25, 75]
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const [min, max] = canvas.getAllByRole('slider');
    expect(min).not.toBeNull();
    expect(max).not.toBeNull();
    await step('Initial state', async () => {
      expect(min).toHaveAttribute('aria-valuenow', '25');
      expect(max).toHaveAttribute('aria-valuenow', '75');
    });
    await step('Move first thumb and verify value updates', async () => {
      min.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(min).toHaveAttribute('aria-valuenow', '26');
      expect(onValueChange).toBeCalledWith([26, 75]);
      expect(onValueCommit).toBeCalledWith([26, 75]);
    });
    await step('Move second thumb and verify value updates', async () => {
      max.focus();
      await userEvent.keyboard('{ArrowLeft}');
      expect(max).toHaveAttribute('aria-valuenow', '74');
      expect(onValueChange).toBeCalledWith([26, 74]);
      expect(onValueCommit).toBeCalledWith([26, 74]);
    });
  }
}`,..._.parameters?.docs?.source}}},v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
  render: function Render(args) {
    const [value, setValue] = useState<RangeSliderValue>([25, 75]);
    return <RangeSlider {...args} value={value} onValueChange={value => {
      setValue(value);
      args.onValueChange?.(value);
    }} />;
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const [min, max] = canvas.getAllByRole('slider');
    expect(min).not.toBeNull();
    expect(max).not.toBeNull();
    await step('Initial state', async () => {
      expect(min).toHaveAttribute('aria-valuenow', '25');
      expect(max).toHaveAttribute('aria-valuenow', '75');
    });
    await step('Move first thumb and verify value updates', async () => {
      min.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(min).toHaveAttribute('aria-valuenow', '26');
      expect(onValueChange).toBeCalledWith([26, 75]);
      expect(onValueCommit).toBeCalledWith([26, 75]);
    });
    await step('Move second thumb and verify value updates', async () => {
      max.focus();
      await userEvent.keyboard('{ArrowLeft}');
      expect(max).toHaveAttribute('aria-valuenow', '74');
      expect(onValueChange).toBeCalledWith([26, 74]);
      expect(onValueCommit).toBeCalledWith([26, 74]);
    });
  }
}`,...v.parameters?.docs?.source}}},y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
  args: {
    defaultValue: [1, 4],
    minStepsBetweenThumbs: 2,
    step: 1
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const [min, max] = canvas.getAllByRole('slider');
    await expect(min).not.toBeNull();
    await expect(max).not.toBeNull();
    await step('Initial state with minimum steps', async () => {
      await expect(min).toHaveAttribute('aria-valuenow', '1');
      await expect(max).toHaveAttribute('aria-valuenow', '4');
    });
    await step('Verify minimum steps constraint', async () => {
      min.focus();
      await userEvent.keyboard('{ArrowRight}'.repeat(3));
      await expect(min).toHaveAttribute('aria-valuenow', '2');
      max.focus();
      await userEvent.keyboard('{ArrowLeft}');
      await expect(max).toHaveAttribute('aria-valuenow', '4');
      await expect(onValueChange).toHaveBeenNthCalledWith(1, [2, 4]);
    });
  }
}`,...y.parameters?.docs?.source}}},b=[`Uncontrolled`,`UncontrolledWithDefault`,`Controlled`,`WithMinStepsBetweenThumbs`]}))();export{v as Controlled,g as Uncontrolled,_ as UncontrolledWithDefault,y as WithMinStepsBetweenThumbs,b as __namedExportsOrder,h as default};