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{r as i,t as a}from"./Slider-C-KoI6Ss.js";var o,s,c,l,u,d,f,p,m,h,g,_,v,y;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`,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=f(e).getByRole(`slider`);await t(`Initial state`,async()=>{l(n).toBeInTheDocument(),l(n).toHaveAttribute(`aria-valuemin`,`0`),l(n).toHaveAttribute(`aria-valuemax`,`100`),l(n).toHaveAttribute(`aria-valuenow`,`0`)}),await t(`Move thumb via keyboard interactions`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`1`),l(p).toBeCalledWith(1),l(m).toBeCalledWith(1)})}},_={args:{defaultValue:50},play:async({canvasElement:e,step:t})=>{let n=f(e).getByRole(`slider`);await t(`Initial state`,async()=>{l(n).toBeInTheDocument(),l(n).toHaveAttribute(`aria-valuemin`,`0`),l(n).toHaveAttribute(`aria-valuemax`,`100`),l(n).toHaveAttribute(`aria-valuenow`,`50`)}),await t(`Move thumb via keyboard interactions`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`51`),l(p).toBeCalledWith(51),l(m).toBeCalledWith(51)})}},v={render:function(e){let[t,n]=(0,o.useState)(50);return(0,s.jsx)(a,{...e,value:t,onValueChange:t=>{n(t),e.onValueChange?.(t)}})},play:async({canvasElement:e,step:t})=>{let n=f(e).getByRole(`slider`);await t(`Initial controlled state`,async()=>{l(n).toBeInTheDocument(),l(n).toHaveAttribute(`aria-valuenow`,`50`)}),await t(`Move thumb and verify value updates`,async()=>{n.focus(),await d.keyboard(`{ArrowRight}`),l(n).toHaveAttribute(`aria-valuenow`,`51`),l(p).toBeCalledWith(51),l(m).toBeCalledWith(51)})}},g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const slider = canvas.getByRole('slider');
    await step('Initial state', async () => {
      expect(slider).toBeInTheDocument();
      expect(slider).toHaveAttribute('aria-valuemin', '0');
      expect(slider).toHaveAttribute('aria-valuemax', '100');
      expect(slider).toHaveAttribute('aria-valuenow', '0');
    });
    await step('Move thumb via keyboard interactions', async () => {
      slider.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(slider).toHaveAttribute('aria-valuenow', '1');
      expect(onValueChange).toBeCalledWith(1);
      expect(onValueCommit).toBeCalledWith(1);
    });
  }
}`,...g.parameters?.docs?.source}}},_.parameters={..._.parameters,docs:{..._.parameters?.docs,source:{originalSource:`{
  args: {
    defaultValue: 50
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const slider = canvas.getByRole('slider');
    await step('Initial state', async () => {
      expect(slider).toBeInTheDocument();
      expect(slider).toHaveAttribute('aria-valuemin', '0');
      expect(slider).toHaveAttribute('aria-valuemax', '100');
      expect(slider).toHaveAttribute('aria-valuenow', '50');
    });
    await step('Move thumb via keyboard interactions', async () => {
      slider.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(slider).toHaveAttribute('aria-valuenow', '51');
      expect(onValueChange).toBeCalledWith(51);
      expect(onValueCommit).toBeCalledWith(51);
    });
  }
}`,..._.parameters?.docs?.source}}},v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
  render: function Render(args) {
    const [value, setValue] = useState(50);
    return <Slider {...args} value={value} onValueChange={value => {
      setValue(value);
      args.onValueChange?.(value);
    }} />;
  },
  play: async ({
    canvasElement,
    step
  }) => {
    const canvas = within(canvasElement);
    const slider = canvas.getByRole('slider');
    await step('Initial controlled state', async () => {
      expect(slider).toBeInTheDocument();
      expect(slider).toHaveAttribute('aria-valuenow', '50');
    });
    await step('Move thumb and verify value updates', async () => {
      slider.focus();
      await userEvent.keyboard('{ArrowRight}');
      expect(slider).toHaveAttribute('aria-valuenow', '51');
      expect(onValueChange).toBeCalledWith(51);
      expect(onValueCommit).toBeCalledWith(51);
    });
  }
}`,...v.parameters?.docs?.source}}},y=[`Uncontrolled`,`UncontrolledWithDefault`,`Controlled`]}))();export{v as Controlled,g as Uncontrolled,_ as UncontrolledWithDefault,y as __namedExportsOrder,h as default};