{"version":3,"file":"UdpDrawer.mjs","names":["React","useEffect","useState","UdpFluentDrawer","UdpFluentDrawerWebComponent","JSX","UdpWrapperBaseProps","UdpDrawerProps","Partial","children","ReactNode","keepMounted","UdpDrawer","FC","t0","$","_c","props","shouldRender","setShouldRender","open","t1","t2","timeoutId","setTimeout","clearTimeout","t3","t4"],"sources":["../../../src/UI/fluent-web-components/UdpDrawer.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { UdpFluentDrawer as UdpFluentDrawerWebComponent } from '@univerus/udp-react-stencil-component-library';\nimport { type JSX } from '@univerus/udp-react-stencil-component-library';\nimport type { UdpWrapperBaseProps } from './types';\n\ninterface UdpDrawerProps\n  extends Partial<JSX.UdpFluentDrawer>,\n    UdpWrapperBaseProps {\n  children?: React.ReactNode;\n  /**\n   * Keep children mounted while the drawer is closed (the drawer itself stays\n   * hidden). Use when the content is stateful — e.g. a chat panel whose\n   * conversation must survive close/reopen. Default: children unmount after\n   * the exit animation.\n   */\n  keepMounted?: boolean;\n}\n\nexport const UdpDrawer: React.FC<UdpDrawerProps> = ({ keepMounted, ...props }) => {\n  const [shouldRender, setShouldRender] = useState(props.open);\n\n  // Immediately allow rendering when opened (no effect needed)\n  if (props.open && !shouldRender) {\n    setShouldRender(true);\n  }\n\n  // Delay unmounting on close to allow exit animation\n  useEffect(() => {\n    if (!props.open && shouldRender) {\n      const timeoutId = setTimeout(() => {\n        setShouldRender(false);\n      }, 500);\n      return () => clearTimeout(timeoutId);\n    }\n  }, [props.open, shouldRender]);\n\n  return (\n    <UdpFluentDrawerWebComponent {...props}>\n      {keepMounted || shouldRender ? props.children : null}\n    </UdpFluentDrawerWebComponent>\n  );\n};\n"],"mappings":";;;;AAkBA,MAAaY,aAAsCE,OAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAL;CAAA,IAAAM;AAAA,KAAAF,EAAA,OAAAD,IAAA;AAAC,GAAA,CAAAH,gBAAAM,SAAAH;AAAyBC,IAAA,KAAAD;AAAAC,IAAA,KAAAJ;AAAAI,IAAA,KAAAE;QAAA;AAAAN,gBAAAI,EAAA;AAAAE,UAAAF,EAAA;;CAC3E,MAAA,CAAAG,cAAAC,mBAAwCjB,SAASe,MAAKG,KAAM;AAG5D,KAAIH,MAAKG,QAAL,CAAeF,aACjBC,iBAAgB,KAAK;CACtB,IAAAE;CAAA,IAAAC;AAAA,KAAAP,EAAA,OAAAE,MAAAG,QAAAL,EAAA,OAAAG,cAAA;AAGSG,aAAA;AACR,OAAI,CAACJ,MAAKG,QAANF,cAA2B;IAC7B,MAAAK,YAAkBC,iBAAW;AAC3BL,qBAAgB,MAAM;OACrB,IAAI;AAAC,iBACKM,aAAaF,UAAU;;;AAErCD,OAAA,CAACL,MAAKG,MAAOF,aAAa;AAAAH,IAAA,KAAAE,MAAAG;AAAAL,IAAA,KAAAG;AAAAH,IAAA,KAAAM;AAAAN,IAAA,KAAAO;QAAA;AAAAD,OAAAN,EAAA;AAAAO,OAAAP,EAAA;;AAP7Bd,WAAUoB,IAOPC,GAA2B;CAIzB,MAAAI,KAAAf,eAAAO,eAA8BD,MAAKR,WAAnC;CAAmD,IAAAkB;AAAA,KAAAZ,EAAA,OAAAE,SAAAF,EAAA,OAAAW,IAAA;AADtDC,OAAA,sBAAA,cAAC,iBAAgCV,OAC9BS,GAC2B;AAAAX,IAAA,KAAAE;AAAAF,IAAA,KAAAW;AAAAX,IAAA,KAAAY;OAAAA,MAAAZ,EAAA;AAAA,QAF9BY"}