{"version":3,"file":"Label.cjs","names":[],"sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { LabelHTMLAttributes } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Label.module.css\";\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n    /** When `true` appends a danger-colored asterisk marking the field as required. */\n    required?: boolean;\n}\n\n/**\n * A form `<label>`. Associate it with a control via `htmlFor`. When `required`\n * is set, a decorative asterisk (`aria-hidden`) is appended.\n *\n * @param props - {@link LabelProps}.\n * @returns The label element.\n */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(function Label(\n    { required = false, className, children, ...props },\n    ref,\n) {\n    return (\n        <label ref={ref} className={cn(styles.label, className)} {...props}>\n            {children}\n            {required && (\n                <span className={styles.asterisk} aria-hidden>\n                    *\n                </span>\n            )}\n        </label>\n    );\n});\n"],"mappings":"4HAiBA,IAAa,GAAA,EAAQ,EAAA,WAAA,CAAyC,SAC1D,CAAE,WAAW,GAAO,YAAW,WAAU,GAAG,GAC5C,EACF,CACE,OACI,EAAA,EAAA,KAAA,CAAC,QAAD,CAAY,MAAK,UAAW,EAAA,GAAG,EAAA,QAAO,MAAO,CAAS,EAAG,GAAI,EAA7D,SAAA,CACK,EACA,IACG,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,SAAU,cAAA,GAAY,SAAA,GAExC,CAAA,CAEP,GAEf,CAAC"}