{"version":3,"sources":["../src/components/Card/useCard.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useCardBase_unstable, useCardContext_unstable } from '@fluentui/react-card';\n\nimport type { CardContextValue, CardProps, CardState } from './Card.types';\nimport { stringifyDataAttribute } from '../../utils/stringifyDataAttribute';\n\n/**\n * Returns the state for a Card component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderCard`.\n */\nexport const useCard = (props: CardProps, ref: React.Ref<HTMLDivElement>): CardState => {\n  const state: CardState = useCardBase_unstable(props, ref);\n\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-selected'] = stringifyDataAttribute(state.selected);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-disabled'] = stringifyDataAttribute(state.disabled);\n\n  return state;\n};\n\n/**\n * Returns the context value provided by the nearest Card, enabling child components to\n * read card-level state such as the selectable accessibility properties.\n */\nexport const useCardContext = useCardContext_unstable;\n\n/**\n * Maps Card state to the context value passed down to child components.\n */\nexport const useCardContextValue = ({ selectableA11yProps }: CardState): CardContextValue => {\n  return { selectableA11yProps };\n};\n"],"names":["useCard","useCardContext","useCardContextValue","props","ref","state","useCardBase_unstable","root","stringifyDataAttribute","selected","disabled","useCardContext_unstable","selectableA11yProps"],"mappings":"AAAA;;;;;;;;;;;;IAYaA,OAAO;eAAPA;;IAeAC,cAAc;eAAdA;;IAKAC,mBAAmB;eAAnBA;;;2BA7BiD;wCAGvB;AAMhC,MAAMF,UAAU,CAACG,OAAkBC;IACxC,MAAMC,QAAmBC,IAAAA,+BAAoB,EAACH,OAAOC;IAErD,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,8CAAsB,EAACH,MAAMI,QAAQ;IACnE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,8CAAsB,EAACH,MAAMK,QAAQ;IAEnE,OAAOL;AACT;AAMO,MAAMJ,iBAAiBU,kCAAuB;AAK9C,MAAMT,sBAAsB,CAAC,EAAEU,mBAAmB,EAAa;IACpE,OAAO;QAAEA;IAAoB;AAC/B"}