import{j as t}from"./jsx-runtime-Dfk2JFgj.js";import{r as c}from"./index-CWN_QRa1.js";import{a as S}from"./index-B-lxVbXh.js";import{O as y,p as i,q as a,Q as g,U as s}from"./index-DNsi8NHw.js";import"./v4-CtRu48qb.js";import"./index-CIVavKlu.js";import"./index-DllfNvuz.js";import"./DefaultPropsProvider-BPu7lNPC.js";import"./CheckGroup-BpaEcK_0.js";import"./index-6WYjB5r3.js";import"./index-Bk93qgka.js";import"./index-DnVHLn3F.js";import"./index-Cj3pldWQ.js";import"./tiny-invariant-CopsF_GD.js";import"./iframe-BT4Dhm0c.js";import"./index-DgIb9kCw.js";const L={title:"Components/SubEntityTags",component:y},E=[{id:1,label:"Sub-Entity 1"},{id:2,label:"Sub-Entity 2"},{id:3,label:"Sub-Entity 3"}],n=m=>{const o=c.useRef(null),[r,b]=c.useState(void 0),p=e=>{S("onSubEntityChange")(e)};return t.jsxs(i,{p:2,children:[t.jsx(a,{variant:"h6",gutterBottom:!0,children:"SubEntityTags - Validación de onSubEntityChange"}),t.jsxs(a,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:['- Haz clic en cualquier pill para seleccionar y observa el log del action "onSubEntityChange".',t.jsx("br",{}),"- Usa los botones para probar el método expuesto por ref: selectSubEntityById."]}),t.jsx(i,{mb:2,children:t.jsxs(g,{direction:"row",spacing:1,children:[t.jsx(s,{variant:"outlined",onClick:()=>{var e;return(e=o.current)==null?void 0:e.selectSubEntityById(1)},children:"Select ID 1 (via ref)"}),t.jsx(s,{variant:"outlined",onClick:()=>{var e;return(e=o.current)==null?void 0:e.selectSubEntityById(2)},children:"Select ID 2 (via ref)"}),t.jsx(s,{variant:"outlined",onClick:()=>{var e;return(e=o.current)==null?void 0:e.selectSubEntityById(3)},children:"Select ID 3 (via ref)"})]})}),t.jsxs(i,{mb:2,children:[t.jsx(a,{variant:"subtitle2",children:"Seleccionado:"}),t.jsx(i,{component:"pre",sx:{backgroundColor:"#f5f5f5",p:1,borderRadius:1},children:r?JSON.stringify(r,null,2):"(ninguno)"})]}),t.jsx(y,{ref:o,subEntityTagsList:E,selectedSubEntity:r,setSelectedSubEntity:b,defaultSelectedSubEntityId:1,onSubEntityChange:p})]})};n.parameters={controls:{exclude:["subEntityTagsList","selectedSubEntity","setSelectedSubEntity","defaultSelectedSubEntityId","onSubEntityChange"]}};n.__docgenInfo={description:"",methods:[],displayName:"BasicValidation"};var l,u,d;n.parameters={...n.parameters,docs:{...(l=n.parameters)==null?void 0:l.docs,source:{originalSource:`args => {
  const ref = useRef<SubEntityTagsRef>(null);
  const [selected, setSelected] = useState<SubEntityTag | undefined>(undefined);
  const handleOnChange = (sub: SubEntityTag) => {
    action("onSubEntityChange")(sub);
  };
  return <Box p={2}>
      <Typography variant="h6" gutterBottom>
        SubEntityTags - Validación de onSubEntityChange
      </Typography>
      <Typography variant="body2" color="text.secondary" gutterBottom>
        - Haz clic en cualquier pill para seleccionar y observa el log del action "onSubEntityChange".<br />
        - Usa los botones para probar el método expuesto por ref: selectSubEntityById.
      </Typography>

      <Box mb={2}>
        <Stack direction="row" spacing={1}>
          <Button variant="outlined" onClick={() => ref.current?.selectSubEntityById(1)}>
            Select ID 1 (via ref)
          </Button>
          <Button variant="outlined" onClick={() => ref.current?.selectSubEntityById(2)}>
            Select ID 2 (via ref)
          </Button>
          <Button variant="outlined" onClick={() => ref.current?.selectSubEntityById(3)}>
            Select ID 3 (via ref)
          </Button>
        </Stack>
      </Box>

      <Box mb={2}>
        <Typography variant="subtitle2">Seleccionado:</Typography>
        <Box component="pre" sx={{
        backgroundColor: "#f5f5f5",
        p: 1,
        borderRadius: 1
      }}>
          {selected ? JSON.stringify(selected, null, 2) : "(ninguno)"}
        </Box>
      </Box>

      <SubEntityTags ref={ref} subEntityTagsList={mockSubEntities} selectedSubEntity={selected} setSelectedSubEntity={setSelected} defaultSelectedSubEntityId={1} onSubEntityChange={handleOnChange} />
    </Box>;
}`,...(d=(u=n.parameters)==null?void 0:u.docs)==null?void 0:d.source}}};const N=["BasicValidation"];export{n as BasicValidation,N as __namedExportsOrder,L as default};
