{"version":3,"sources":["../src/components/Checkbox/useCheckbox.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useCheckboxBase_unstable } from '@fluentui/react-checkbox';\nimport type { CheckboxProps, CheckboxState } from './Checkbox.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Create the state required to render Checkbox.\n *\n * The returned state can be modified with hooks,\n * before being passed to renderCheckbox_unstable.\n *\n * @param props - props from this instance of Checkbox\n * @param ref - reference to root HTMLInputElement of Checkbox\n */\nexport const useCheckbox = (props: CheckboxProps, ref: React.Ref<HTMLInputElement>): CheckboxState => {\n  const state: CheckboxState = useCheckboxBase_unstable(props, ref);\n\n  // Set data attributes for disabled 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-checked'] = stringifyDataAttribute(state.checked);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-label-position'] = state.labelPosition;\n\n  return state;\n};\n"],"names":["useCheckbox","props","ref","state","useCheckboxBase_unstable","root","stringifyDataAttribute","disabled","checked","labelPosition"],"mappings":"AAAA;;;;;+BAgBaA;;;eAAAA;;;+BAb4B;uBAEF;AAWhC,MAAMA,cAAc,CAACC,OAAsBC;IAChD,MAAMC,QAAuBC,IAAAA,uCAAwB,EAACH,OAAOC;IAE7D,2FAA2F;IAC3F,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,QAAQ;IACnE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,eAAe,GAAGC,IAAAA,6BAAsB,EAACH,MAAMK,OAAO;IACjE,oDAAoD;IACpDL,MAAME,IAAI,CAAC,sBAAsB,GAAGF,MAAMM,aAAa;IAEvD,OAAON;AACT"}