{"version":3,"file":"label.cjs","sources":["../../../components/label/label.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps, useRender } from '@base-ui/react';\nimport { cx } from 'class-variance-authority';\nimport styles from './label.module.css';\n\nexport interface LabelProps extends useRender.ComponentProps<'label'> {\n  /**\n   * Whether the labelled control is required. When `false`, an `(optional)`\n   * indicator (see `optionalText`) is rendered next to the label.\n   */\n  required?: boolean;\n  /**\n   * Text rendered next to the label when `required={false}`.\n   * @default \"(optional)\"\n   */\n  optionalText?: string;\n  /**\n   * Text rendered next to the label when `required={true}`. No indicator is\n   * rendered if this is omitted — preserving apsara's existing behaviour of\n   * not surfacing a required marker by default. Pass any non-empty string\n   * (`\"(required)\"`, `\"*\"`, etc.) to opt in.\n   */\n  requiredText?: string;\n}\n\nexport function Label({\n  className,\n  required,\n  render,\n  ref,\n  children,\n  optionalText = '(optional)',\n  requiredText,\n  ...props\n}: LabelProps) {\n  const content = (\n    <>\n      {children}\n      {required === false && (\n        <span className={styles.optional} data-slot='label-indicator'>\n          {optionalText}\n        </span>\n      )}\n      {required === true && requiredText && (\n        <span className={styles.optional} data-slot='label-indicator'>\n          {requiredText}\n        </span>\n      )}\n    </>\n  );\n\n  const labelProps = {\n    'data-slot': 'label',\n    className: cx(styles.label, className),\n    children: content\n  };\n\n  const element = useRender({\n    defaultTagName: 'label',\n    ref,\n    render,\n    props: mergeProps<'label'>(labelProps, props)\n  });\n\n  return element;\n}\n\nLabel.displayName = 'Label';\n"],"names":[],"mappings":";;;;;;;;AA0BM;;AA0BJ;AACE;;AAEA;;;AAIA;;;AAGA;AACD;AAED;AACF;AAEA;;"}