{"version":3,"file":"ng-primitives-form-field.mjs","sources":["../../../../packages/ng-primitives/form-field/src/form-field/form-field-state.ts","../../../../packages/ng-primitives/form-field/src/description/description-state.ts","../../../../packages/ng-primitives/form-field/src/description/description.ts","../../../../packages/ng-primitives/form-field/src/error/error-state.ts","../../../../packages/ng-primitives/form-field/src/error/error.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control-state.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.ts","../../../../packages/ng-primitives/form-field/src/form-field/form-field.ts","../../../../packages/ng-primitives/form-field/src/label/label-state.ts","../../../../packages/ng-primitives/form-field/src/label/label.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import {\n  EffectRef,\n  Injector,\n  Signal,\n  computed,\n  effect,\n  inject,\n  signal,\n  untracked,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding, onDestroy } from 'ng-primitives/state';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\n\n/**\n * The state interface for the FormField primitive.\n */\nexport interface NgpFormFieldState {\n  /**\n   * The form labels.\n   */\n  readonly labels: Signal<string[]>;\n  /**\n   * The form descriptions.\n   */\n  readonly descriptions: Signal<string[]>;\n  /**\n   * The id of the associated form control.\n   */\n  readonly formControl: Signal<string | null>;\n  /**\n   * The validation error messages.\n   */\n  readonly errors: Signal<string[]>;\n  /**\n   * Whether the control is pristine.\n   */\n  readonly pristine: Signal<boolean | null>;\n  /**\n   * Whether the control is touched.\n   */\n  readonly touched: Signal<boolean | null>;\n  /**\n   * Whether the control is dirty.\n   */\n  readonly dirty: Signal<boolean | null>;\n  /**\n   * Whether the control is valid.\n   */\n  readonly valid: Signal<boolean | null>;\n  /**\n   * Whether the control is invalid.\n   */\n  readonly invalid: Signal<boolean | null>;\n  /**\n   * Whether the control is pending.\n   */\n  readonly pending: Signal<boolean | null>;\n  /**\n   * Whether the control is disabled.\n   */\n  readonly disabled: Signal<boolean | null>;\n  /**\n   * Register the id of the associated form control, and the `NgControl` bound to it if any.\n   */\n  setFormControl(id: string, ngControl?: NgControl | null): void;\n  /**\n   * Register a label with the form field.\n   */\n  addLabel(label: string): void;\n  /**\n   * Register a description with the form field.\n   */\n  addDescription(description: string): void;\n  /**\n   * Remove the associated form control. With an id, only that registration is removed.\n   */\n  removeFormControl(id?: string): void;\n  /**\n   * Remove a label from the form field.\n   */\n  removeLabel(label: string): void;\n  /**\n   * Remove a description from the form field.\n   */\n  removeDescription(description: string): void;\n}\n\n/**\n * The props interface for the FormField primitive.\n */\nexport interface NgpFormFieldProps {\n  /**\n   * Find any NgControl within the form field.\n   */\n  readonly ngControl: Signal<NgControl | undefined>;\n}\n\nexport const [NgpFormFieldStateToken, ngpFormField, injectFormFieldState, provideFormFieldState] =\n  createPrimitive('NgpFormField', ({ ngControl }: NgpFormFieldProps) => {\n    const element = injectElementRef();\n    const injector = inject(Injector);\n\n    // Store the form labels\n    const labels = signal<string[]>([]);\n\n    // Store the form descriptions\n    const descriptions = signal<string[]>([]);\n\n    // Store the registered form controls; the most recent one is the active one\n    const registrations = signal<{ id: string; ngControl: NgControl | null }[]>([]);\n    const formControl = computed(() => registrations().at(-1)?.id ?? null);\n\n    // A control in the form field's own template wins over a registered one: a custom control\n    // may render an inner input bound to a proxy control that carries none of the validators.\n    const resolvedControl = computed(\n      () => ngControl() ?? registrations().at(-1)?.ngControl ?? null,\n    );\n\n    // Store the validation error messages\n    const errors = signal<string[]>([]);\n\n    // Form control state signals\n    const pristine = signal<boolean | null>(null);\n    const touched = signal<boolean | null>(null);\n    const dirty = signal<boolean | null>(null);\n    const valid = signal<boolean | null>(null);\n    const invalid = signal<boolean | null>(null);\n    const pending = signal<boolean | null>(null);\n    const disabled = signal<boolean | null>(null);\n\n    // Store the current status subscription\n    let subscription: Subscription | undefined;\n    let statusEffect: EffectRef | undefined;\n\n    // Host bindings\n    dataBinding(element, 'data-invalid', invalid);\n    dataBinding(element, 'data-valid', valid);\n    dataBinding(element, 'data-touched', touched);\n    dataBinding(element, 'data-pristine', pristine);\n    dataBinding(element, 'data-dirty', dirty);\n    dataBinding(element, 'data-pending', pending);\n    dataBinding(element, 'data-disabled', disabled);\n\n    function updateStatus(): void {\n      const control = resolvedControl();\n\n      if (!control) {\n        return;\n      }\n\n      // Wrap in try-catch to handle signal-forms interop controls where\n      // the `field` input may not be available yet (throws NG0950).\n      // Reading the signal still establishes a dependency, so the effect\n      // will re-run when the input becomes available.\n      try {\n        const controlPristine = control.pristine;\n        const controlTouched = control.touched;\n        const controlDirty = control.dirty;\n        const controlValid = control.valid;\n        const controlInvalid = control.invalid;\n        const controlPending = control.pending;\n        const controlDisabled = control.disabled;\n        const controlErrors = control.errors;\n\n        untracked(() => {\n          pristine.set(controlPristine);\n          touched.set(controlTouched);\n          dirty.set(controlDirty);\n          valid.set(controlValid);\n          invalid.set(controlInvalid);\n          pending.set(controlPending);\n          disabled.set(controlDisabled);\n          errors.set(controlErrors ? Object.keys(controlErrors) : []);\n        });\n      } catch {\n        // NG0950: Required input not available yet. The effect will re-run\n        // when the signal input becomes available.\n      }\n    }\n\n    // Without a control, the status of a control that left must not linger.\n    function clearStatus(): void {\n      pristine.set(null);\n      touched.set(null);\n      dirty.set(null);\n      valid.set(null);\n      invalid.set(null);\n      pending.set(null);\n      disabled.set(null);\n      errors.set([]);\n    }\n\n    function setupSubscriptions(control: NgControl | null): void {\n      // Unsubscribe from the previous subscriptions.\n      subscription?.unsubscribe();\n      statusEffect?.destroy();\n      statusEffect = undefined;\n\n      if (!control) {\n        clearStatus();\n        return;\n      }\n\n      // For signal-forms interop controls, use an effect to reactively track status.\n      // For classic controls, also use an effect but additionally subscribe to events.\n      statusEffect = effect(\n        () => {\n          updateStatus();\n        },\n        { injector },\n      );\n\n      // Classic controls also have an events observable we can subscribe to.\n      const underlyingControl = control?.control;\n      if (underlyingControl?.events) {\n        subscription = underlyingControl.events.subscribe(() => updateStatus());\n      }\n    }\n\n    // Setup subscriptions when ngControl changes\n    onChange(resolvedControl, setupSubscriptions);\n\n    // Cleanup subscription on destroy\n    onDestroy(() => subscription?.unsubscribe());\n\n    // Methods\n    function setFormControl(id: string, control: NgControl | null = null): void {\n      // Untracked so a consumer calling this from an effect doesn't re-trigger it on our own write.\n      const others = untracked(registrations).filter(registration => registration.id !== id);\n\n      if (ngDevMode && others.some(registration => registration.ngControl !== control)) {\n        console.warn(\n          `[ngpFormField]: A second form control (\"${id}\") registered with this form field. A form field holds one control; the most recent one is used.`,\n        );\n      }\n\n      registrations.set([...others, { id, ngControl: control }]);\n    }\n\n    function addLabel(label: string): void {\n      if (labels().includes(label)) {\n        return;\n      }\n\n      labels.update(currentLabels => [...currentLabels, label]);\n    }\n\n    function addDescription(description: string): void {\n      if (descriptions().includes(description)) {\n        return;\n      }\n\n      descriptions.update(currentDescriptions => [...currentDescriptions, description]);\n    }\n\n    function removeFormControl(id?: string): void {\n      registrations.update(current =>\n        id === undefined ? [] : current.filter(registration => registration.id !== id),\n      );\n    }\n\n    function removeLabel(label: string): void {\n      labels.update(currentLabels => currentLabels.filter(l => l !== label));\n    }\n\n    function removeDescription(description: string): void {\n      descriptions.update(currentDescriptions =>\n        currentDescriptions.filter(d => d !== description),\n      );\n    }\n\n    return {\n      labels,\n      descriptions,\n      formControl,\n      errors,\n      pristine,\n      touched,\n      dirty,\n      valid,\n      invalid,\n      pending,\n      disabled,\n      setFormControl,\n      addLabel,\n      addDescription,\n      removeFormControl,\n      removeLabel,\n      removeDescription,\n    } satisfies NgpFormFieldState;\n  });\n","import { signal, Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding, onDestroy } from 'ng-primitives/state';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The state interface for the Description primitive.\n */\nexport interface NgpDescriptionState {\n  /**\n   * The id of the description.\n   */\n  readonly id: Signal<string>;\n}\n\n/**\n * The props interface for the Description primitive.\n */\nexport interface NgpDescriptionProps {\n  /**\n   * The id of the description.\n   */\n  readonly id: Signal<string>;\n}\n\nexport const [\n  NgpDescriptionStateToken,\n  ngpDescription,\n  injectDescriptionState,\n  provideDescriptionState,\n] = createPrimitive(\n  'NgpDescription',\n  ({ id = signal(uniqueId('ngp-description')) }: NgpDescriptionProps) => {\n    const element = injectElementRef();\n    const formField = injectFormFieldState({ optional: true });\n\n    // Host bindings\n    attrBinding(element, 'id', id);\n    dataBinding(element, 'data-invalid', () => (formField()?.invalid() ? '' : null));\n    dataBinding(element, 'data-valid', () => (formField()?.valid() ? '' : null));\n    dataBinding(element, 'data-touched', () => (formField()?.touched() ? '' : null));\n    dataBinding(element, 'data-pristine', () => (formField()?.pristine() ? '' : null));\n    dataBinding(element, 'data-dirty', () => (formField()?.dirty() ? '' : null));\n    dataBinding(element, 'data-pending', () => (formField()?.pending() ? '' : null));\n    dataBinding(element, 'data-disabled', () => (formField()?.disabled() ? '' : null));\n\n    // Register with form field and cleanup on destroy\n    formField()?.addDescription(id());\n    onDestroy(() => formField()?.removeDescription(id()));\n\n    onChange(id, (newId, oldId) => {\n      if (oldId) {\n        formField()?.removeDescription(oldId);\n      }\n      formField()?.addDescription(newId);\n    });\n\n    return { id } satisfies NgpDescriptionState;\n  },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpDescription, provideDescriptionState } from './description-state';\n\n/**\n * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.\n */\n@Directive({\n  selector: '[ngpDescription]',\n  exportAs: 'ngpDescription',\n  providers: [provideDescriptionState()],\n})\nexport class NgpDescription {\n  /**\n   * The id of the description. If not provided, a unique id will be generated.\n   */\n  readonly id = input<string>(uniqueId('ngp-description'));\n\n  /**\n   * The description state.\n   */\n  constructor() {\n    ngpDescription({ id: this.id });\n  }\n}\n","import { Signal, computed, signal } from '@angular/core';\nimport { explicitEffect, injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding, onDestroy } from 'ng-primitives/state';\nimport { onBooleanChange } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The state interface for the Error primitive.\n */\nexport interface NgpErrorState {\n  /**\n   * The id of the error message.\n   */\n  readonly id: Signal<string>;\n  /**\n   * Determine if there is an error message.\n   */\n  readonly hasError: Signal<boolean>;\n  /**\n   * Determine whether the validator associated with this error is failing.\n   */\n  readonly state: Signal<'fail' | 'pass'>;\n}\n\n/**\n * The props interface for the Error primitive.\n */\nexport interface NgpErrorProps {\n  /**\n   * The id of the error message.\n   */\n  readonly id: Signal<string>;\n  /**\n   * The validator associated with the error message.\n   */\n  readonly validator?: Signal<string | null>;\n}\n\nexport const [NgpErrorStateToken, ngpError, injectErrorState, provideErrorState] = createPrimitive(\n  'NgpError',\n  ({ id, validator = signal(null) }: NgpErrorProps) => {\n    const element = injectElementRef();\n    const formField = injectFormFieldState({ optional: true });\n\n    // Determine if there is an error message\n    const hasError = computed(() => {\n      const errors = formField()?.errors() ?? [];\n      const validatorValue = validator();\n\n      return validatorValue ? errors?.includes(validatorValue) : errors?.length > 0;\n    });\n\n    // Determine whether the validator associated with this error is failing\n    const state = computed(() => (hasError() ? 'fail' : 'pass'));\n\n    // Host bindings\n    attrBinding(element, 'id', id);\n    dataBinding(element, 'data-invalid', () => (formField()?.invalid() ? '' : null));\n    dataBinding(element, 'data-valid', () => (formField()?.valid() ? '' : null));\n    dataBinding(element, 'data-touched', () => (formField()?.touched() ? '' : null));\n    dataBinding(element, 'data-pristine', () => (formField()?.pristine() ? '' : null));\n    dataBinding(element, 'data-dirty', () => (formField()?.dirty() ? '' : null));\n    dataBinding(element, 'data-pending', () => (formField()?.pending() ? '' : null));\n    dataBinding(element, 'data-disabled', () => (formField()?.disabled() ? '' : null));\n    dataBinding(element, 'data-validator', state);\n\n    let currentId = id();\n\n    // Register/unregister with form field based on error state\n    function registerError(): void {\n      formField()?.addDescription(currentId);\n    }\n\n    function unregisterError(): void {\n      formField()?.removeDescription(currentId);\n    }\n\n    // Update error registration when hasError changes\n    onBooleanChange(hasError, registerError, unregisterError);\n\n    function updateIdRegistration(newId: string, oldId?: string): void {\n      if (oldId && hasError()) {\n        formField()?.removeDescription(oldId);\n      }\n      currentId = newId;\n      if (hasError()) {\n        formField()?.addDescription(newId);\n      }\n    }\n\n    // Watch for id changes to update registration\n    explicitEffect([id], () => updateIdRegistration(id(), currentId));\n\n    // Cleanup on destroy\n    onDestroy(() => {\n      if (hasError()) {\n        formField()?.removeDescription(currentId);\n      }\n    });\n\n    return {\n      id,\n      hasError,\n      state,\n    } satisfies NgpErrorState;\n  },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpError, provideErrorState } from './error-state';\n\n/**\n * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.\n */\n@Directive({\n  selector: '[ngpError]',\n  exportAs: 'ngpError',\n  providers: [provideErrorState()],\n})\nexport class NgpError {\n  /**\n   * The id of the error message. If not provided, a unique id will be generated.\n   */\n  readonly id = input<string>(uniqueId('ngp-error'));\n\n  /**\n   * The validator associated with the error message.\n   */\n  readonly validator = input<string | null>(null, {\n    alias: 'ngpErrorValidator',\n  });\n\n  /**\n   * The error state.\n   */\n  constructor() {\n    ngpError({ id: this.id, validator: this.validator });\n  }\n}\n","import { Injector, Signal, computed, inject, signal } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { explicitEffect, injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, dataBinding } from 'ng-primitives/state';\nimport { NgpControlStatus, controlStatus } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\ninterface NgpFormControlProps {\n  /**\n   * The id of the form control.\n   */\n\n  readonly id: Signal<string>;\n  /**\n   * Whether the form control is disabled by a parent.\n   */\n  readonly disabled?: Signal<boolean>;\n}\n\nexport function ngpFormControl({\n  id,\n  disabled = signal(false),\n}: NgpFormControlProps): Signal<NgpControlStatus> {\n  const elementRef = injectElementRef();\n  // Access the form field that the form control is associated with.\n  const formField = injectFormFieldState({ optional: true });\n  // Access the form control status.\n  const status = controlStatus();\n  const injector = inject(Injector);\n  // Determine the aria-labelledby attribute value.\n  const ariaLabelledBy = computed(() => {\n    const labels = formField()?.labels() ?? [];\n    return labels.length > 0 ? labels.join(' ') : null;\n  });\n  // Determine the aria-describedby attribute value.\n  const ariaDescribedBy = computed(() => {\n    const descriptions = formField()?.descriptions() ?? [];\n    return descriptions.length > 0 ? descriptions.join(' ') : null;\n  });\n\n  const supportsDisabledAttribute = 'disabled' in elementRef.nativeElement;\n\n  // Host bindings\n  // The status has to be part of this, not just the parent's input: a form control disabled by\n  // reactive or signal forms disables the element itself, and a binding that ignored the status\n  // would immediately remove that again and leave a disabled control editable.\n  attrBinding(elementRef, 'disabled', () =>\n    supportsDisabledAttribute && (disabled() || status().disabled) ? '' : null,\n  );\n\n  explicitEffect([id], ([id], onCleanup) => {\n    // The NgControl goes to the form field, whose content query cannot see a control inside a\n    // child component. It is read here, not at construction, where a custom control's NgControl\n    // is still being built; effects also run during server rendering, unlike onMount.\n    formField()?.setFormControl(id, injector.get(NgControl, null));\n    onCleanup(() => formField()?.removeFormControl(id));\n  });\n\n  attrBinding(elementRef, 'id', id);\n  attrBinding(elementRef, 'aria-labelledby', ariaLabelledBy);\n  attrBinding(elementRef, 'aria-describedby', ariaDescribedBy);\n  // Expose the validity to assistive technology once the control has been\n  // touched; a pristine/untouched control never advertises aria-invalid.\n  attrBinding(elementRef, 'aria-invalid', () =>\n    status().invalid && status().touched ? 'true' : null,\n  );\n  dataBinding(elementRef, 'data-invalid', () => status().invalid);\n  dataBinding(elementRef, 'data-valid', () => status().valid);\n  dataBinding(elementRef, 'data-touched', () => status().touched);\n  dataBinding(elementRef, 'data-pristine', () => status().pristine);\n  dataBinding(elementRef, 'data-dirty', () => status().dirty);\n  dataBinding(elementRef, 'data-pending', () => status().pending);\n  dataBinding(elementRef, 'data-disabled', () => disabled() || status().disabled);\n\n  return computed(() => ({ ...status(), disabled: status().disabled || disabled() }));\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpFormControl } from './form-control-state';\n\n/**\n * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.\n *\n * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field.\n */\n@Directive({\n  selector: '[ngpFormControl]',\n  exportAs: 'ngpFormControl',\n})\nexport class NgpFormControl {\n  /**\n   * The id of the form control. If not provided, a unique id will be generated.\n   */\n  readonly id = input<string>(uniqueId('ngp-form-control'));\n\n  /**\n   * Whether the form control is disabled by a parent.\n   */\n  readonly disabled = input<boolean, BooleanInput>(false, {\n    alias: 'ngpFormControlDisabled',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * The status of the form control.\n   */\n  readonly status = ngpFormControl({ id: this.id, disabled: this.disabled });\n}\n","import { Directive, contentChild } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { ngpFormField, provideFormFieldState } from './form-field-state';\n\n/**\n * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.\n */\n@Directive({\n  selector: '[ngpFormField]',\n  exportAs: 'ngpFormField',\n  providers: [provideFormFieldState()],\n})\nexport class NgpFormField {\n  /**\n   * Find any NgControl within the form field.\n   * @internal\n   */\n  private readonly ngControl = contentChild(NgControl);\n\n  /**\n   * The form field state.\n   */\n  constructor() {\n    ngpFormField({ ngControl: this.ngControl });\n  }\n}\n","import { Signal, computed } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n  attrBinding,\n  createPrimitive,\n  dataBinding,\n  listener,\n  onDestroy,\n} from 'ng-primitives/state';\nimport { onChange } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The state interface for the Label primitive.\n */\nexport interface NgpLabelState {\n  /**\n   * The id of the label.\n   */\n  readonly id: Signal<string>;\n  /**\n   * The htmlFor attribute value.\n   */\n  readonly htmlFor: Signal<string | null>;\n}\n\n/**\n * The props interface for the Label primitive.\n */\nexport interface NgpLabelProps {\n  /**\n   * The id of the label.\n   */\n  readonly id: Signal<string>;\n}\n\nexport const [NgpLabelStateToken, ngpLabel, injectLabelState, provideLabelState] = createPrimitive(\n  'NgpLabel',\n  ({ id }: NgpLabelProps) => {\n    const element = injectElementRef();\n    const formField = injectFormFieldState({ optional: true });\n\n    // Derive the for attribute value if the label is an HTML label element\n    const htmlFor = computed(() => formField()?.formControl() ?? null);\n\n    // Determine if the label is an HTML label element\n    const isLabel = element.nativeElement instanceof HTMLLabelElement;\n\n    // Host bindings\n    attrBinding(element, 'id', id);\n    attrBinding(element, 'for', htmlFor);\n    dataBinding(element, 'data-invalid', () => (formField()?.invalid() ? '' : null));\n    dataBinding(element, 'data-valid', () => (formField()?.valid() ? '' : null));\n    dataBinding(element, 'data-touched', () => (formField()?.touched() ? '' : null));\n    dataBinding(element, 'data-pristine', () => (formField()?.pristine() ? '' : null));\n    dataBinding(element, 'data-dirty', () => (formField()?.dirty() ? '' : null));\n    dataBinding(element, 'data-pending', () => (formField()?.pending() ? '' : null));\n    dataBinding(element, 'data-disabled', () => (formField()?.disabled() ? '' : null));\n\n    function onClick(event: MouseEvent): void {\n      // by default a label will perform a click on the associated form control, however\n      // this only works if the associated form control is an input element which may not always\n      // be the case, so we prevent the default behavior and handle the click event ourselves.\n      // This was inspired by the HeadlessUI approach:\n      // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58\n      if (isLabel) {\n        event.preventDefault();\n      }\n\n      // to find the associated form control we can lookup via the known id\n      const targetId = htmlFor();\n\n      if (!targetId) {\n        return;\n      }\n\n      const target = document.getElementById(targetId);\n\n      if (!target) {\n        return;\n      }\n\n      // if the target is disabled then do nothing\n      const disabled = target.getAttribute('disabled');\n      const ariaDisabled = target.getAttribute('aria-disabled');\n\n      if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {\n        return;\n      }\n\n      // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes\n      if (\n        (target instanceof HTMLInputElement &&\n          (target.type === 'radio' || target.type === 'checkbox')) ||\n        target.role === 'radio' ||\n        target.role === 'checkbox' ||\n        target.role === 'switch'\n      ) {\n        target.click();\n      }\n\n      // Move focus to the element, this allows you to start using keyboard shortcuts since the\n      // bound element is now focused.\n      target.focus({ preventScroll: true });\n    }\n\n    // Event listeners\n    listener(element, 'click', onClick);\n\n    // Register with form field and cleanup on destroy\n    formField()?.addLabel(id());\n    onDestroy(() => formField()?.removeLabel(id()));\n\n    // any time the id changes we need to update the registration with the form field\n    onChange(id, (newId, oldId) => {\n      if (oldId) {\n        formField()?.removeLabel(oldId);\n      }\n      formField()?.addLabel(newId);\n    });\n\n    return {\n      id,\n      htmlFor,\n    } satisfies NgpLabelState;\n  },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpLabel, provideLabelState } from './label-state';\n\n/**\n * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.\n */\n@Directive({\n  selector: '[ngpLabel]',\n  exportAs: 'ngpLabel',\n  providers: [provideLabelState()],\n})\nexport class NgpLabel {\n  /**\n   * The id of the label. If not provided, a unique id will be generated.\n   */\n  readonly id = input<string>(uniqueId('ngp-label'));\n\n  /**\n   * The label state.\n   */\n  constructor() {\n    ngpLabel({ id: this.id });\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAoGa,CAAC,sBAAsB,EAAE,YAAY,EAA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