{"version":3,"sources":["../src/components/Drawer/OverlayDrawer/useOverlayDrawer.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { slot } from '@fluentui/react-utilities';\n\nimport { Dialog, DialogSurface } from '../../Dialog';\nimport { stringifyDataAttribute } from '../../../utils';\nimport type { OverlayDrawerProps, OverlayDrawerState } from './OverlayDrawer.types';\n\n/**\n * Returns the state for an OverlayDrawer component, given its props and ref.\n */\nexport const useOverlayDrawer = (props: OverlayDrawerProps, ref: React.Ref<HTMLDialogElement>): OverlayDrawerState => {\n  const {\n    open = false,\n    position = 'start',\n    unmountOnClose = true,\n    modalType = 'modal',\n    onOpenChange,\n    ...rootProps\n  } = props;\n\n  const root = slot.always(\n    {\n      ...rootProps,\n      unmountOnClose,\n      'data-open': stringifyDataAttribute(open),\n      'data-position': position,\n      ref,\n    },\n    {\n      elementType: DialogSurface,\n    },\n  );\n\n  const dialog = slot.always(\n    {\n      open,\n      onOpenChange,\n      modalType,\n      unmountOnClose,\n      /**\n       * children is not needed here because we construct the children in the render function,\n       * but it's required by DialogProps\n       */\n      children: null as unknown as JSXElement,\n    },\n    {\n      elementType: Dialog,\n    },\n  );\n\n  return {\n    components: {\n      root: DialogSurface,\n      dialog: Dialog,\n    },\n    root,\n    dialog,\n    modalType,\n    onOpenChange,\n    open,\n    position,\n    unmountOnClose,\n  };\n};\n"],"names":["useOverlayDrawer","props","ref","open","position","unmountOnClose","modalType","onOpenChange","rootProps","root","slot","always","stringifyDataAttribute","elementType","DialogSurface","dialog","children","Dialog","components"],"mappings":";;;;+BAWaA;;;eAAAA;;;gCATQ;wBAEiB;uBACC;AAMhC,MAAMA,mBAAmB,CAACC,OAA2BC;IAC1D,MAAM,EACJC,OAAO,KAAK,EACZC,WAAW,OAAO,EAClBC,iBAAiB,IAAI,EACrBC,YAAY,OAAO,EACnBC,YAAY,EACZ,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,OAAOC,oBAAI,CAACC,MAAM,CACtB;QACE,GAAGH,SAAS;QACZH;QACA,aAAaO,IAAAA,6BAAsB,EAACT;QACpC,iBAAiBC;QACjBF;IACF,GACA;QACEW,aAAaC,qBAAa;IAC5B;IAGF,MAAMC,SAASL,oBAAI,CAACC,MAAM,CACxB;QACER;QACAI;QACAD;QACAD;QACA;;;OAGC,GACDW,UAAU;IACZ,GACA;QACEH,aAAaI,cAAM;IACrB;IAGF,OAAO;QACLC,YAAY;YACVT,MAAMK,qBAAa;YACnBC,QAAQE,cAAM;QAChB;QACAR;QACAM;QACAT;QACAC;QACAJ;QACAC;QACAC;IACF;AACF"}