{"version":3,"sources":["../src/components/Drawer/useDrawer.ts"],"sourcesContent":["import type * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport { InlineDrawer, type InlineDrawerProps } from './InlineDrawer';\nimport { OverlayDrawer, type OverlayDrawerProps } from './OverlayDrawer';\nimport type { DrawerProps, DrawerState } from './Drawer.types';\n\n/**\n * Returns the state for a Drawer component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderDrawer`.\n */\nexport const useDrawer = (props: DrawerProps, ref: React.Ref<HTMLElement>): DrawerState => {\n  const { type, ...restProps } = props;\n  const elementType = (type === 'inline' ? InlineDrawer : OverlayDrawer) as React.FC<\n    InlineDrawerProps | OverlayDrawerProps\n  >;\n  const root: InlineDrawerProps | OverlayDrawerProps = slot.always({ ref, ...restProps }, { elementType });\n\n  return {\n    components: { root: elementType },\n    root,\n  };\n};\n"],"names":["useDrawer","props","ref","type","restProps","elementType","InlineDrawer","OverlayDrawer","root","slot","always","components"],"mappings":";;;;+BAWaA;;;eAAAA;;;gCAVQ;8BAEgC;+BACE;AAOhD,MAAMA,YAAY,CAACC,OAAoBC;IAC5C,MAAM,EAAEC,IAAI,EAAE,GAAGC,WAAW,GAAGH;IAC/B,MAAMI,cAAeF,SAAS,WAAWG,0BAAY,GAAGC,4BAAa;IAGrE,MAAMC,OAA+CC,oBAAI,CAACC,MAAM,CAAC;QAAER;QAAK,GAAGE,SAAS;IAAC,GAAG;QAAEC;IAAY;IAEtG,OAAO;QACLM,YAAY;YAAEH,MAAMH;QAAY;QAChCG;IACF;AACF"}