{"version":3,"sources":["../src/components/Accordion/useAccordion.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport {\n  useAccordionBase_unstable,\n  useAccordionContext_unstable,\n  useAccordionContextValues_unstable,\n} from '@fluentui/react-accordion';\n\nimport type { AccordionProps, AccordionState, AccordionContextValues } from './Accordion.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Returns the state for an Accordion component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderAccordion`.\n */\nexport const useAccordion = (props: AccordionProps, ref: React.Ref<HTMLElement>): AccordionState => {\n  const state: AccordionState = useAccordionBase_unstable(props, ref);\n\n  // Set data attributes for collapsible and multiple states to simplify styling of these states.\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-collapsible'] = stringifyDataAttribute(state.collapsible);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-multiple'] = stringifyDataAttribute(state.multiple);\n\n  return state;\n};\n\n/**\n * Returns the context of the accordion, which is used to pass information about the accordion to its children. This is used when a child component needs to know about the state of the accordion, such as whether it is collapsible or allows multiple items to be expanded.\n */\nexport const useAccordionContext = useAccordionContext_unstable;\n\n/**\n * Maps the state of the accordion to the values that are passed through context to its children. This is used when a child component needs to know about the state of the accordion, such as whether it is collapsible or allows multiple items to be expanded.\n */\nexport const useAccordionContextValues = useAccordionContextValues_unstable as (\n  state: AccordionState,\n) => AccordionContextValues;\n"],"names":["useAccordion","useAccordionContext","useAccordionContextValues","props","ref","state","useAccordionBase_unstable","root","stringifyDataAttribute","collapsible","multiple","useAccordionContext_unstable","useAccordionContextValues_unstable"],"mappings":"AAAA;;;;;;;;;;;;IAgBaA,YAAY;eAAZA;;IAeAC,mBAAmB;eAAnBA;;IAKAC,yBAAyB;eAAzBA;;;gCA7BN;uBAGgC;AAMhC,MAAMF,eAAe,CAACG,OAAuBC;IAClD,MAAMC,QAAwBC,IAAAA,yCAAyB,EAACH,OAAOC;IAE/D,+FAA+F;IAC/F,oDAAoD;IACpDC,MAAME,IAAI,CAAC,mBAAmB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,WAAW;IACzE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMK,QAAQ;IAEnE,OAAOL;AACT;AAKO,MAAMJ,sBAAsBU,4CAA4B;AAKxD,MAAMT,4BAA4BU,kDAAkC"}