{"version":3,"sources":["../src/components/Accordion/useAccordion.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useAccordionBase_unstable, useAccordionContextValues_unstable } from '@fluentui/react-accordion';\n\nimport type { AccordionProps, AccordionState, AccordionContextValues } from './Accordion.types';\nimport { toDataAttributeValue } 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'] = toDataAttributeValue(state.collapsible);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-multiple'] = toDataAttributeValue(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 { useAccordionContext_unstable as useAccordionContext } from '@fluentui/react-accordion';\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","useAccordionContext_unstable","useAccordionContextValues","props","ref","state","useAccordionBase_unstable","root","toDataAttributeValue","collapsible","multiple","useAccordionContextValues_unstable"],"mappings":"AAAA;;;;;;;;;;;;IAYaA,YAAY;eAAZA;;IAe4BC,mBAAmB;eAAnDC,4CAA4B;;IAKxBC,yBAAyB;eAAzBA;;;gCA7BiE;uBAGzC;AAM9B,MAAMH,eAAe,CAACI,OAAuBC;IAClD,MAAMC,QAAwBC,IAAAA,yCAAyB,EAACH,OAAOC;IAE/D,+FAA+F;IAC/F,oDAAoD;IACpDC,MAAME,IAAI,CAAC,mBAAmB,GAAGC,IAAAA,2BAAoB,EAACH,MAAMI,WAAW;IACvE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,2BAAoB,EAACH,MAAMK,QAAQ;IAEjE,OAAOL;AACT;AAUO,MAAMH,4BAA4BS,kDAAkC"}