{"version":3,"sources":["../src/components/Badge/CounterBadge/useCounterBadge.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useCounterBadgeBase_unstable } from '@fluentui/react-badge';\n\nimport { toDataAttributeValue } from '../../../utils';\nimport type { CounterBadgeProps, CounterBadgeState } from './CounterBadge.types';\n\n/**\n * Returns the state for a CounterBadge component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderCounterBadge`.\n */\nexport const useCounterBadge = (props: CounterBadgeProps, ref: React.Ref<HTMLDivElement>): CounterBadgeState => {\n  const state = useCounterBadgeBase_unstable(props, ref);\n  const overflowCount = props.overflowCount ?? 99;\n\n  return {\n    ...state,\n    root: {\n      ...state.root,\n      'data-count': String(state.count),\n      'data-dot': toDataAttributeValue(state.dot),\n      'data-hidden': toDataAttributeValue(!state.root.children && state.root.children !== 0 && !state.dot),\n      'data-overflowed': toDataAttributeValue(state.count > overflowCount),\n    },\n  };\n};\n"],"names":["useCounterBadge","props","ref","state","useCounterBadgeBase_unstable","overflowCount","root","String","count","toDataAttributeValue","dot","children"],"mappings":"AAAA;;;;;+BAYaA;;;eAAAA;;;4BATgC;uBAER;AAO9B,MAAMA,kBAAkB,CAACC,OAA0BC;IACxD,MAAMC,QAAQC,IAAAA,wCAA4B,EAACH,OAAOC;IAClD,MAAMG,gBAAgBJ,MAAMI,aAAa,IAAI;IAE7C,OAAO;QACL,GAAGF,KAAK;QACRG,MAAM;YACJ,GAAGH,MAAMG,IAAI;YACb,cAAcC,OAAOJ,MAAMK,KAAK;YAChC,YAAYC,IAAAA,2BAAoB,EAACN,MAAMO,GAAG;YAC1C,eAAeD,IAAAA,2BAAoB,EAAC,CAACN,MAAMG,IAAI,CAACK,QAAQ,IAAIR,MAAMG,IAAI,CAACK,QAAQ,KAAK,KAAK,CAACR,MAAMO,GAAG;YACnG,mBAAmBD,IAAAA,2BAAoB,EAACN,MAAMK,KAAK,GAAGH;QACxD;IACF;AACF"}