{"version":3,"sources":["../src/components/Label/useLabel.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useLabelBase_unstable } from '@fluentui/react-label';\n\nimport type { LabelProps, LabelState } from './Label.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Returns the state for a Label component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderLabel`.\n */\nexport const useLabel = (props: LabelProps, ref: React.Ref<HTMLLabelElement>): LabelState => {\n  const state: LabelState = useLabelBase_unstable(props, ref);\n\n  // Set data attribute for disabled state to simplify styling.\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-required'] = stringifyDataAttribute(Boolean(state.required));\n\n  return state;\n};\n"],"names":["useLabel","props","ref","state","useLabelBase_unstable","root","stringifyDataAttribute","disabled","Boolean","required"],"mappings":"AAAA;;;;;+BAYaA;;;eAAAA;;;4BATyB;uBAGC;AAMhC,MAAMA,WAAW,CAACC,OAAmBC;IAC1C,MAAMC,QAAoBC,IAAAA,iCAAqB,EAACH,OAAOC;IAEvD,6DAA6D;IAC7D,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,QAAQ;IACnE,oDAAoD;IACpDJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACE,QAAQL,MAAMM,QAAQ;IAE3E,OAAON;AACT"}