{"version":3,"sources":["../src/components/Card/useCard.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useCardBase_unstable } from '@fluentui/react-card';\n\nimport type { CardContextValue, CardProps, CardState } from './Card.types';\nimport { toDataAttributeValue } from '../../utils/toDataAttributeValue';\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'] = toDataAttributeValue(state.selected);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-disabled'] = toDataAttributeValue(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 { useCardContext_unstable as useCardContext } from '@fluentui/react-card';\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","useCardContext_unstable","useCardContextValue","props","ref","state","useCardBase_unstable","root","toDataAttributeValue","selected","disabled","selectableA11yProps"],"mappings":"AAAA;;;;;;;;;;;;IAYaA,OAAO;eAAPA;;IAeuBC,cAAc;eAAzCC,kCAAuB;;IAKnBC,mBAAmB;eAAnBA;;;2BA7BwB;sCAGA;AAM9B,MAAMH,UAAU,CAACI,OAAkBC;IACxC,MAAMC,QAAmBC,IAAAA,+BAAoB,EAACH,OAAOC;IAErD,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,0CAAoB,EAACH,MAAMI,QAAQ;IACjE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,0CAAoB,EAACH,MAAMK,QAAQ;IAEjE,OAAOL;AACT;AAWO,MAAMH,sBAAsB,CAAC,EAAES,mBAAmB,EAAa;IACpE,OAAO;QAAEA;IAAoB;AAC/B"}