import { forwardRef, type LabelHTMLAttributes, type ForwardedRef } from 'react' import { getFormLabelProps, splitClassNameProp, } from '@pluralsight/headless-styles' import type { FormLabelOptions } from '@pluralsight/headless-styles/types' import { useFormControl } from '../context/FormControl.tsx' interface LabelProps extends Omit, Omit, 'htmlFor'> { children: string } function LabelEl(props: LabelProps, ref: ForwardedRef) { const { kind, ...nativeProps } = props const state = useFormControl() const { value: pandoValue, ...pandoProps } = getFormLabelProps({ classNames: splitClassNameProp(nativeProps.className), htmlFor: nativeProps.htmlFor, kind, required: state.required, value: nativeProps.children, }) return ( ) } export const Label = forwardRef(LabelEl)