import{j as d}from"./jsx-runtime-Dfk2JFgj.js";import{r as h}from"./index-CWN_QRa1.js";import{a as b}from"./index-B-lxVbXh.js";import{C as i}from"./CheckGroup-BpaEcK_0.js";import"./v4-CtRu48qb.js";const{useArgs:O}=__STORYBOOK_MODULE_PREVIEW_API__,w={title:"Components/Checkbox",component:i},f=o=>{const[{checked:n},c]=O(),r=()=>c({checked:!n});return d.jsx(i,{...o,checked:n,onChange:r})},s=f.bind({});s.args={id:"checkb",label:"label checkbox",checked:!1,isIndeterminate:!1,isDisabled:!1,onClick:b("CheckBox clicked")};const S=o=>{const n=[{label:"Option_one",value:"1"},{label:"Option_two",value:"2"},{label:"Option_three",value:"3"},{label:"Option_four",value:"4"}],[c,r]=h.useState(new Array(n.length).fill(!1)),x=l=>{const a=c.map((t,_)=>_===l?!t:t);r(a)};return d.jsx(d.Fragment,{children:n.map(({label:l,value:a},t)=>h.createElement(i,{...o,key:a,id:a,label:l,value:a,checked:c[t],onChange:()=>x(t)}))})},e=S.bind({});e.parameters={controls:{include:["isDisabled"]}};e.args={isDisabled:!1,onClick:b("CheckBox clicked")};var p,k,u;s.parameters={...s.parameters,docs:{...(p=s.parameters)==null?void 0:p.docs,source:{originalSource:`args => {
  const [{
    checked
  }, updateArgs] = useArgs();
  const handleChange = () => updateArgs({
    checked: !checked
  });
  return <Checkbox {...args} checked={checked} onChange={handleChange} />;
}`,...(u=(k=s.parameters)==null?void 0:k.docs)==null?void 0:u.source}}};var m,C,g;e.parameters={...e.parameters,docs:{...(m=e.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
  const list = [{
    label: "Option_one",
    value: "1"
  }, {
    label: "Option_two",
    value: "2"
  }, {
    label: "Option_three",
    value: "3"
  }, {
    label: "Option_four",
    value: "4"
  }];
  const [checkedState, setCheckedState] = useState(new Array(list.length).fill(false));
  const handleOnChange = position => {
    const updatedCheckedState = checkedState.map((item, index) => index === position ? !item : item);
    setCheckedState(updatedCheckedState);
  };
  return <>
            {list.map(({
      label,
      value
    }, index) => <Checkbox {...args} key={value} id={value} label={label} value={value} checked={checkedState[index]} onChange={() => handleOnChange(index)} />)}
        </>;
}`,...(g=(C=e.parameters)==null?void 0:C.docs)==null?void 0:g.source}}};const D=["Primary","CheckList"];export{e as CheckList,s as Primary,D as __namedExportsOrder,w as default};
