import{j as e}from"./jsx-runtime-CnH95YSl.js";import{w as ie,u as le,e as de}from"./index-BJMTVygn.js";import{r as x}from"./index-NdkWRN8K.js";import{a as ue}from"./axeRun-B-LchFqf.js";import{O as pe}from"./OdysseyStorybookThemeDecorator-BuDiOG2V.js";import{f as s}from"./fieldComponentPropsMetaData-BqbNLw6V.js";import{M as l}from"./RadioGroup-BYJZ378_.js";import{M as a}from"./Radio-BdNnpooK.js";import{M as ce}from"./Link-BDoLypER.js";const he={component:l,decorators:[pe],argTypes:{children:{description:"An array of Radio components within the group",table:{type:{summary:"Array<ReactElement<typeof Radio>>"}},type:{required:!0,name:"other",value:"Array<ReactElement<typeof Radio>>"}},defaultValue:{control:"text",description:"The text value of the radio that should be selected by default",table:{type:{summary:"string"}}},errorMessage:s.errorMessage,errorMessageList:s.errorMessageList,hint:s.hint,HintLinkComponent:s.HintLinkComponent,id:s.id,isDisabled:s.isDisabled,isReadOnly:s.isReadOnly,label:{control:"text",description:"The text label for the radio group",table:{type:{summary:"string"}},type:{required:!0,name:"string"}},onChange:{description:"Callback fired when the value of the radio group changes",table:{type:{summary:"func"}}},value:{control:"text",description:"The `value` on the selected radio button",table:{type:{summary:"string"}}}},args:{id:"storybook-radio",label:"Speed"}},t={args:{},render:function(r){return e.jsxs(l,{...r,children:[e.jsx(a,{label:"Light Speed",value:"Light Speed"}),e.jsx(a,{label:"Warp Speed",value:"Warp Speed"}),e.jsx(a,{label:"Ludicrous Speed",value:"Ludicrous Speed"})]})}},u={...t,args:{defaultValue:""}},p={...t,args:{hint:"Select the speed at which you wish to travel.",defaultValue:""}},c={...t,args:{hint:"Select the speed at which you wish to travel.",HintLinkComponent:e.jsx(ce,{href:"/learn-more",children:"Learn more"})}},h={...t,args:{isDisabled:!0,defaultValue:""}},m={...t,args:{isReadOnly:!0,defaultValue:"Warp Speed"}},g={...t,parameters:{docs:{description:{story:"Validation should happen on the group and not individually on each item."}}},args:{errorMessage:"This field is required.",defaultValue:""}},S={...t,args:{errorMessage:"This field is required.",errorMessageList:["Message 1","Message 2"],defaultValue:""}},v={args:{errorMessage:"This field is required."},render:function(r){return e.jsxs(l,{...r,children:[e.jsx(a,{hint:"Hint Text",label:"Light Speed",value:"Light Speed"}),e.jsx(a,{hint:"Hint Text",label:"Warp Speed",value:"Warp Speed"}),e.jsx(a,{hint:"Hint Text",label:"Ludicrous Speed",value:"Ludicrous Speed"})]})}},b={args:{label:"Service Tier"},render:function(r){return e.jsxs(l,{...r,children:[e.jsx(a,{label:"Basic",value:"basic"}),e.jsx(a,{label:"Standard",value:"standard"}),e.jsx(a,{isDisabled:!0,label:"Premium (Unavailable in your region)",value:"premium"})]})}},y={...t,args:{defaultValue:"Warp Speed"}},f={parameters:{docs:{description:{story:"When the component is controlled, the parent component is responsible for managing the state of `RadioGroup`. `onChange` should be used to listen for component changes and to update the values in the `value` prop."}}},args:{value:"Ludicrous Speed"},render:function(r){const[i,d]=x.useState("Ludicrous Speed"),n=x.useCallback((oe,T)=>d(T),[]);return e.jsxs(l,{...r,value:i,onChange:n,children:[e.jsx(a,{label:"Light Speed",value:"Light Speed"}),e.jsx(a,{label:"Warp Speed",value:"Warp Speed"}),e.jsx(a,{label:"Ludicrous Speed",value:"Ludicrous Speed"})]})},play:async({canvasElement:o,step:r})=>{await r("select uncontrolled radio button",async()=>{const i=ie(o),d=i.getByRole("radiogroup"),n=i.getByLabelText("Warp Speed");d&&n&&await le.click(n),await de(n).toBeChecked(),await ue("select uncontrolled radio button")})}},R={parameters:{docs:{description:{story:"A controlled Radio Group with Radio-level hints."}}},args:{value:"Ludicrous Speed"},render:function(r){const[i,d]=x.useState("Turtle Speed"),n=x.useCallback((oe,T)=>d(T),[]);return e.jsxs(l,{...r,onChange:n,value:i,children:[e.jsx(a,{hint:"Hint text",label:"Snail Speed",value:"Snail Speed"}),e.jsx(a,{hint:"Hint text",label:"Turtle Speed",value:"Turtle Speed"}),e.jsx(a,{hint:"Hint text",label:"Rabbit Speed",value:"Rabbit Speed"})]})}};var L,C,k;u.parameters={...u.parameters,docs:{...(L=u.parameters)==null?void 0:L.docs,source:{originalSource:`{
  ...Template,
  args: {
    defaultValue: ""
  } as Story["args"] // This is a hack.,
}`,...(k=(C=u.parameters)==null?void 0:C.docs)==null?void 0:k.source}}};var H,M,j;p.parameters={...p.parameters,docs:{...(H=p.parameters)==null?void 0:H.docs,source:{originalSource:`{
  ...Template,
  args: {
    hint: "Select the speed at which you wish to travel.",
    defaultValue: ""
  } as Story["args"] // This is a hack.,
}`,...(j=(M=p.parameters)==null?void 0:M.docs)==null?void 0:j.source}}};var w,V,W;c.parameters={...c.parameters,docs:{...(w=c.parameters)==null?void 0:w.docs,source:{originalSource:`{
  ...Template,
  args: {
    hint: "Select the speed at which you wish to travel.",
    HintLinkComponent: <Link href="/learn-more">Learn more</Link>
  } as Story["args"] // This is a hack.,
}`,...(W=(V=c.parameters)==null?void 0:V.docs)==null?void 0:W.source}}};var G,E,D;h.parameters={...h.parameters,docs:{...(G=h.parameters)==null?void 0:G.docs,source:{originalSource:`{
  ...Template,
  args: {
    isDisabled: true,
    defaultValue: ""
  } as Story["args"] // This is a hack.,
}`,...(D=(E=h.parameters)==null?void 0:E.docs)==null?void 0:D.source}}};var O,_,q;m.parameters={...m.parameters,docs:{...(O=m.parameters)==null?void 0:O.docs,source:{originalSource:`{
  ...Template,
  args: {
    isReadOnly: true,
    defaultValue: "Warp Speed"
  } as Story["args"] // This is a hack.,
}`,...(q=(_=m.parameters)==null?void 0:_.docs)==null?void 0:q.source}}};var B,I,A;g.parameters={...g.parameters,docs:{...(B=g.parameters)==null?void 0:B.docs,source:{originalSource:`{
  ...Template,
  parameters: {
    docs: {
      description: {
        story: "Validation should happen on the group and not individually on each item."
      }
    }
  },
  args: {
    errorMessage: "This field is required.",
    defaultValue: ""
  } as Story["args"] // This is a hack.,
}`,...(A=(I=g.parameters)==null?void 0:I.docs)==null?void 0:A.source}}};var z,P,U;S.parameters={...S.parameters,docs:{...(z=S.parameters)==null?void 0:z.docs,source:{originalSource:`{
  ...Template,
  args: {
    errorMessage: "This field is required.",
    errorMessageList: ["Message 1", "Message 2"],
    defaultValue: ""
  } as Story["args"] // This is a hack.,
}`,...(U=(P=S.parameters)==null?void 0:P.docs)==null?void 0:U.source}}};var F,J,K;v.parameters={...v.parameters,docs:{...(F=v.parameters)==null?void 0:F.docs,source:{originalSource:`{
  args: {
    errorMessage: "This field is required."
  } as Story["args"],
  render: function C(props) {
    return <RadioGroup {...props}>
        <Radio hint="Hint Text" label="Light Speed" value="Light Speed" />
        <Radio hint="Hint Text" label="Warp Speed" value="Warp Speed" />
        <Radio hint="Hint Text" label="Ludicrous Speed" value="Ludicrous Speed" />
      </RadioGroup>;
  }
}`,...(K=(J=v.parameters)==null?void 0:J.docs)==null?void 0:K.source}}};var N,Q,X;b.parameters={...b.parameters,docs:{...(N=b.parameters)==null?void 0:N.docs,source:{originalSource:`{
  args: {
    label: "Service Tier"
  } as Story["args"],
  render: function C(props) {
    return <RadioGroup {...props}>
        <Radio label="Basic" value="basic" />
        <Radio label="Standard" value="standard" />
        <Radio isDisabled={true} label="Premium (Unavailable in your region)" value="premium" />
      </RadioGroup>;
  }
}`,...(X=(Q=b.parameters)==null?void 0:Q.docs)==null?void 0:X.source}}};var Y,Z,$;y.parameters={...y.parameters,docs:{...(Y=y.parameters)==null?void 0:Y.docs,source:{originalSource:`{
  ...Template,
  args: {
    defaultValue: "Warp Speed"
  } as Story["args"] // This is a hack.,
}`,...($=(Z=y.parameters)==null?void 0:Z.docs)==null?void 0:$.source}}};var ee,ae,re;f.parameters={...f.parameters,docs:{...(ee=f.parameters)==null?void 0:ee.docs,source:{originalSource:`{
  parameters: {
    docs: {
      description: {
        story: "When the component is controlled, the parent component is responsible for managing the state of \`RadioGroup\`. \`onChange\` should be used to listen for component changes and to update the values in the \`value\` prop."
      }
    }
  },
  args: {
    value: "Ludicrous Speed"
  } as Story["args"],
  // This is a hack.,
  render: function C(props) {
    const [value, setValue] = useState("Ludicrous Speed");
    const onChange = useCallback((_event: ChangeEvent<HTMLInputElement>, value: string) => setValue(value), []);
    return <RadioGroup {...{
      ...props,
      value,
      onChange
    }}>
        <Radio label="Light Speed" value="Light Speed" />
        <Radio label="Warp Speed" value="Warp Speed" />
        <Radio label="Ludicrous Speed" value="Ludicrous Speed" />
      </RadioGroup>;
  },
  play: async ({
    canvasElement,
    step
  }) => {
    await step("select uncontrolled radio button", async () => {
      const canvas = within(canvasElement);
      const radiogroup = canvas.getByRole("radiogroup");
      const radio = canvas.getByLabelText("Warp Speed");
      if (radiogroup && radio) {
        await userEvent.click(radio);
      }
      await expect(radio).toBeChecked();
      await axeRun("select uncontrolled radio button");
    });
  }
}`,...(re=(ae=f.parameters)==null?void 0:ae.docs)==null?void 0:re.source}}};var te,ne,se;R.parameters={...R.parameters,docs:{...(te=R.parameters)==null?void 0:te.docs,source:{originalSource:`{
  parameters: {
    docs: {
      description: {
        story: "A controlled Radio Group with Radio-level hints."
      }
    }
  },
  args: {
    value: "Ludicrous Speed"
  } as Story["args"],
  // This is a hack.,
  render: function C(props) {
    const [value, setValue] = useState("Turtle Speed");
    const onChange = useCallback((_event: ChangeEvent<HTMLInputElement>, value: string) => setValue(value), []);
    return <RadioGroup {...props} onChange={onChange} value={value}>
        <Radio hint="Hint text" label="Snail Speed" value="Snail Speed" />
        <Radio hint="Hint text" label="Turtle Speed" value="Turtle Speed" />
        <Radio hint="Hint text" label="Rabbit Speed" value="Rabbit Speed" />
      </RadioGroup>;
  }
}`,...(se=(ne=R.parameters)==null?void 0:ne.docs)==null?void 0:se.source}}};const me=["Default","Hint","HintLink","Disabled","ReadOnly","Error","ErrorsList","ErrorWithIndividualHint","IndividualStates","UncontrolledRadioGroup","ControlledRadioGroup","ControlledRadioGroupWithRadioHints"],Le=Object.freeze(Object.defineProperty({__proto__:null,ControlledRadioGroup:f,ControlledRadioGroupWithRadioHints:R,Default:u,Disabled:h,Error:g,ErrorWithIndividualHint:v,ErrorsList:S,Hint:p,HintLink:c,IndividualStates:b,ReadOnly:m,UncontrolledRadioGroup:y,__namedExportsOrder:me,default:he},Symbol.toStringTag,{value:"Module"}));export{Le as R};
