{"version":3,"sources":["../src/components/Accordion/AccordionItem/useAccordionItem.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport {\n  useAccordionItem_unstable,\n  useAccordionItemContext_unstable,\n  useAccordionItemContextValues_unstable,\n} from '@fluentui/react-accordion';\n\nimport type { AccordionItemProps, AccordionItemState, AccordionItemContextValues } from './AccordionItem.types';\nimport { stringifyDataAttribute } from '../../../utils';\n\n/**\n * Returns the state for an AccordionItem component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderAccordionItem`.\n */\nexport const useAccordionItem = (props: AccordionItemProps, ref: React.Ref<HTMLElement>): AccordionItemState => {\n  const state: AccordionItemState = useAccordionItem_unstable(props, ref);\n\n  // Set data attributes for open and disabled states to simplify styling of these states.\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-disabled'] = stringifyDataAttribute(state.disabled);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-open'] = stringifyDataAttribute(state.open);\n\n  return state;\n};\n\n/**\n * Returns the context values provided by the nearest AccordionItem, enabling child components to read item-level state such as whether the item is open or disabled.\n */\nexport const useAccordionItemContext = useAccordionItemContext_unstable;\n\n/**\n * Maps AccordionItem state to the context values passed down to child components.\n */\nexport const useAccordionItemContextValues = useAccordionItemContextValues_unstable as (\n  state: AccordionItemState,\n) => AccordionItemContextValues;\n"],"names":["useAccordionItem","useAccordionItemContext","useAccordionItemContextValues","props","ref","state","useAccordionItem_unstable","root","stringifyDataAttribute","disabled","open","useAccordionItemContext_unstable","useAccordionItemContextValues_unstable"],"mappings":"AAAA;;;;;;;;;;;;IAgBaA,gBAAgB;eAAhBA;;IAeAC,uBAAuB;eAAvBA;;IAKAC,6BAA6B;eAA7BA;;;gCA7BN;uBAGgC;AAMhC,MAAMF,mBAAmB,CAACG,OAA2BC;IAC1D,MAAMC,QAA4BC,IAAAA,yCAAyB,EAACH,OAAOC;IAEnE,wFAAwF;IACxF,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,QAAQ;IACnE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,YAAY,GAAGC,IAAAA,6BAAsB,EAACH,MAAMK,IAAI;IAE3D,OAAOL;AACT;AAKO,MAAMJ,0BAA0BU,gDAAgC;AAKhE,MAAMT,gCAAgCU,sDAAsC"}