{"version":3,"sources":["../src/components/Toolbar/useToolbar.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport {\n  useToolbarBase_unstable,\n  useToolbarContext_unstable,\n  useToolbarContextValues_unstable,\n} from '@fluentui/react-toolbar';\n\nimport type { ToolbarProps, ToolbarState, ToolbarContextValues } from './Toolbar.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Returns the state for a Toolbar component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderToolbar`.\n */\nexport const useToolbar = (props: ToolbarProps, ref: React.Ref<HTMLElement>): ToolbarState => {\n  const state: ToolbarState = useToolbarBase_unstable(props, ref);\n\n  // eslint-disable-next-line react-hooks/immutability\n  state.root.focusgroup = `toolbar ${state.vertical ? 'block' : 'inline'} wrap`;\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-vertical'] = stringifyDataAttribute(state.vertical);\n\n  return state;\n};\n\n/**\n * Returns the context of the toolbar, which is used to pass information about the toolbar to its children.\n */\nexport const useToolbarContext = useToolbarContext_unstable;\n\n/**\n * Maps the state of the toolbar to the values that are passed through context to its children.\n */\nexport const useToolbarContextValues = useToolbarContextValues_unstable as (\n  state: ToolbarState,\n) => ToolbarContextValues;\n"],"names":["useToolbar","useToolbarContext","useToolbarContextValues","props","ref","state","useToolbarBase_unstable","root","focusgroup","vertical","stringifyDataAttribute","useToolbarContext_unstable","useToolbarContextValues_unstable"],"mappings":"AAAA;;;;;;;;;;;;IAgBaA,UAAU;eAAVA;;IAcAC,iBAAiB;eAAjBA;;IAKAC,uBAAuB;eAAvBA;;;8BA5BN;uBAGgC;AAMhC,MAAMF,aAAa,CAACG,OAAqBC;IAC9C,MAAMC,QAAsBC,IAAAA,qCAAuB,EAACH,OAAOC;IAE3D,oDAAoD;IACpDC,MAAME,IAAI,CAACC,UAAU,GAAG,CAAC,QAAQ,EAAEH,MAAMI,QAAQ,GAAG,UAAU,SAAS,KAAK,CAAC;IAC7E,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGG,IAAAA,6BAAsB,EAACL,MAAMI,QAAQ;IAEnE,OAAOJ;AACT;AAKO,MAAMJ,oBAAoBU,wCAA0B;AAKpD,MAAMT,0BAA0BU,8CAAgC"}