{"version":3,"sources":["../src/components/ToggleButton/useToggleButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useToggleButtonBase_unstable } from '@fluentui/react-button';\n\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Returns the state for a ToggleButton component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderToggleButton`.\n */\nexport const useToggleButton = (\n  props: ToggleButtonProps,\n  ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n  const state: ToggleButtonState = useToggleButtonBase_unstable(props, ref);\n\n  // Set data attributes for disabled, disabledFocusable, iconOnly, and checked 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-disabled-focusable'] = stringifyDataAttribute(state.disabledFocusable);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-icon-only'] = stringifyDataAttribute(state.iconOnly);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-checked'] = stringifyDataAttribute(state.checked);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-icon-position'] = state.icon ? state.iconPosition : undefined;\n\n  return state;\n};\n"],"names":["useToggleButton","props","ref","state","useToggleButtonBase_unstable","root","stringifyDataAttribute","disabled","disabledFocusable","iconOnly","checked","icon","iconPosition","undefined"],"mappings":"AAAA;;;;;+BAYaA;;;eAAAA;;;6BATgC;uBAGN;AAMhC,MAAMA,kBAAkB,CAC7BC,OACAC;IAEA,MAAMC,QAA2BC,IAAAA,yCAA4B,EAACH,OAAOC;IAErE,yHAAyH;IACzH,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,QAAQ;IACnE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,0BAA0B,GAAGC,IAAAA,6BAAsB,EAACH,MAAMK,iBAAiB;IACtF,oDAAoD;IACpDL,MAAME,IAAI,CAAC,iBAAiB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMM,QAAQ;IACpE,oDAAoD;IACpDN,MAAME,IAAI,CAAC,eAAe,GAAGC,IAAAA,6BAAsB,EAACH,MAAMO,OAAO;IACjE,oDAAoD;IACpDP,MAAME,IAAI,CAAC,qBAAqB,GAAGF,MAAMQ,IAAI,GAAGR,MAAMS,YAAY,GAAGC;IAErE,OAAOV;AACT"}