ng-primitives 0.92.0 → 0.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/a11y/index.d.ts +3 -1
  2. package/accordion/index.d.ts +8 -1
  3. package/autofill/index.d.ts +4 -0
  4. package/avatar/index.d.ts +11 -2
  5. package/breadcrumbs/index.d.ts +21 -7
  6. package/button/index.d.ts +3 -1
  7. package/checkbox/index.d.ts +3 -1
  8. package/fesm2022/ng-primitives-checkbox.mjs +7 -8
  9. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  10. package/fesm2022/ng-primitives-file-upload.mjs +39 -38
  11. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  12. package/fesm2022/ng-primitives-focus-trap.mjs +107 -138
  13. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  14. package/fesm2022/ng-primitives-form-field.mjs +323 -365
  15. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-interactions.mjs +57 -58
  17. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  18. package/fesm2022/ng-primitives-listbox.mjs +2 -2
  19. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  20. package/fesm2022/ng-primitives-slider.mjs +4 -5
  21. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-state.mjs +28 -5
  23. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-switch.mjs +4 -5
  25. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-tabs.mjs +194 -192
  27. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-toggle-group.mjs +4 -5
  29. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-toggle.mjs +4 -5
  31. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-tooltip.mjs +4 -4
  33. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  35. package/file-upload/index.d.ts +20 -2
  36. package/focus-trap/index.d.ts +33 -75
  37. package/form-field/index.d.ts +320 -123
  38. package/input/index.d.ts +6 -0
  39. package/interactions/index.d.ts +16 -16
  40. package/package.json +1 -1
  41. package/roving-focus/index.d.ts +6 -2
  42. package/schematics/ng-generate/templates/tabs/tabs.__fileSuffix@dasherize__.ts.template +2 -2
  43. package/slider/index.d.ts +14 -6
  44. package/state/index.d.ts +22 -8
  45. package/switch/index.d.ts +8 -4
  46. package/tabs/index.d.ts +333 -84
  47. package/textarea/index.d.ts +6 -0
  48. package/toggle/index.d.ts +5 -3
  49. package/toggle-group/index.d.ts +6 -2
  50. package/toolbar/index.d.ts +5 -0
  51. package/utils/index.d.ts +1 -1
@@ -1 +1 @@
1
- {"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.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.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormField } from './form-field';\n\n/**\n * The state token for the FormField primitive.\n */\nexport const NgpFormFieldStateToken = createStateToken<NgpFormField>('FormField');\n\n/**\n * Provides the FormField state.\n */\nexport const provideFormFieldState = createStateProvider(NgpFormFieldStateToken);\n\n/**\n * Injects the FormField state.\n */\nexport const injectFormFieldState = createStateInjector<NgpFormField>(NgpFormFieldStateToken);\n\n/**\n * The FormField state registration function.\n */\nexport const formFieldState = createState(NgpFormFieldStateToken);\n","import { Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-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 host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\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 * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addDescription(this.id());\n onCleanup(() => this.formField()?.removeDescription(this.id()));\n });\n }\n}\n","import { Directive, OnChanges, OnDestroy, SimpleChanges, computed, input } from '@angular/core';\nimport { onBooleanChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-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 host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\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 * Determine if there is an error message.\n */\n protected readonly hasError = computed(() => {\n const errors = this.formField()?.errors() ?? [];\n const validator = this.validator();\n\n return validator ? errors?.includes(validator) : errors?.length > 0;\n });\n\n /**\n * Determine whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => (this.hasError() ? 'fail' : 'pass'));\n\n constructor() {\n // add or remove the error message when the error state changes\n onBooleanChange(\n this.hasError,\n () => this.formField()?.addDescription(this.id()),\n () => this.formField()?.removeDescription(this.id()),\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField()?.removeDescription(changes['id'].previousValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField()?.removeDescription(this.id());\n }\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormControl } from './form-control';\n\n/**\n * The state token for the FormControl primitive.\n */\nexport const NgpFormControlStateToken = createStateToken<NgpFormControl>('FormControl');\n\n/**\n * Provides the FormControl state.\n */\nexport const provideFormControlState = createStateProvider(NgpFormControlStateToken);\n\n/**\n * Injects the FormControl state.\n */\nexport const injectFormControlState = createStateInjector<NgpFormControl>(NgpFormControlStateToken);\n\n/**\n * The FormControl state registration function.\n */\nexport const formControlState = createState(NgpFormControlStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, signal, Signal } from '@angular/core';\nimport { explicitEffect, injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, dataBinding } from 'ng-primitives/state';\nimport { controlStatus, NgpControlStatus, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\nimport { formControlState, provideFormControlState } 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 providers: [provideFormControlState()],\n host: {\n '[attr.disabled]': 'supportsDisabledAttribute && status().disabled ? \"\" : null',\n },\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: Signal<NgpControlStatus>;\n\n /**\n * The element reference.\n */\n private readonly elementRef = injectElementRef();\n\n /**\n * Whether the element supports the disabled attribute.\n */\n protected readonly supportsDisabledAttribute = 'disabled' in this.elementRef.nativeElement;\n\n /**\n * The state of the form control.\n */\n private readonly state = formControlState<NgpFormControl>(this);\n\n constructor() {\n // Sync the form control state with the control state.\n this.status = ngpFormControl({ id: this.state.id, disabled: this.state.disabled });\n }\n}\n\ninterface NgpFormControlProps {\n id: Signal<string>;\n disabled?: Signal<boolean>;\n}\n\nexport function ngpFormControl({\n id,\n disabled = signal(false),\n}: NgpFormControlProps): Signal<NgpControlStatus> {\n const element = 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 // Determine the aria-labelledby attribute value.\n const ariaLabelledBy = computed(() => formField()?.labels().join(' '));\n // Determine the aria-describedby attribute value.\n const ariaDescribedBy = computed(() => formField()?.descriptions().join(' '));\n\n explicitEffect([id], ([id], onCleanup) => {\n formField()?.setFormControl(id);\n onCleanup(() => formField()?.removeFormControl());\n });\n\n attrBinding(element, 'id', id);\n attrBinding(element, 'aria-labelledby', ariaLabelledBy);\n attrBinding(element, 'aria-describedby', ariaDescribedBy);\n dataBinding(element, 'data-invalid', () => status().invalid);\n dataBinding(element, 'data-valid', () => status().valid);\n dataBinding(element, 'data-touched', () => status().touched);\n dataBinding(element, 'data-pristine', () => status().pristine);\n dataBinding(element, 'data-dirty', () => status().dirty);\n dataBinding(element, 'data-pending', () => status().pending);\n dataBinding(element, 'data-disabled', () => disabled() || status().disabled);\n\n return computed(() => ({ ...status(), disabled: status().disabled || disabled() }));\n}\n","import {\n Directive,\n Injector,\n OnDestroy,\n contentChild,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\nimport { formFieldState, 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 host: {\n '[attr.data-invalid]': 'invalid() ? \"\" : null',\n '[attr.data-valid]': 'valid() ? \"\" : null',\n '[attr.data-touched]': 'touched() ? \"\" : null',\n '[attr.data-pristine]': 'pristine() ? \"\" : null',\n '[attr.data-dirty]': 'dirty() ? \"\" : null',\n '[attr.data-pending]': 'pending() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFormField implements OnDestroy {\n /**\n * Store the form label.\n * @internal\n */\n readonly labels = signal<string[]>([]);\n\n /**\n * Store the form descriptions.\n * @internal\n */\n readonly descriptions = signal<string[]>([]);\n\n /**\n * Store the id of the associated form control.\n * @internal\n */\n readonly formControl = signal<string | null>(null);\n\n /**\n * Find any NgControl within the form field.\n * @internal\n */\n private readonly ngControl = contentChild(NgControl);\n\n /**\n * Store the validation error messages.\n * @internal\n */\n readonly errors = signal<string[]>([]);\n\n /**\n * Whether the control is pristine.\n * @internal\n */\n readonly pristine = signal<boolean | null>(null);\n\n /**\n * Whether the control is touched.\n * @internal\n */\n readonly touched = signal<boolean | null>(null);\n\n /**\n * Whether the control is dirty.\n * @internal\n */\n readonly dirty = signal<boolean | null>(null);\n\n /**\n * Whether the control is valid.\n */\n readonly valid = signal<boolean | null>(null);\n\n /**\n * Whether the control is invalid.\n * @internal\n */\n readonly invalid = signal<boolean | null>(null);\n\n /**\n * Whether the control is pending.\n * @internal\n */\n readonly pending = signal<boolean | null>(null);\n\n /**\n * Whether the control is disabled.\n * @internal\n */\n readonly disabled = signal<boolean | null>(null);\n\n /**\n * Store the current status subscription.\n */\n private subscription?: Subscription;\n\n /**\n * Injector for creating effects outside the constructor.\n */\n private readonly injector = inject(Injector);\n\n /**\n * The form field state.\n */\n protected readonly state = formFieldState<NgpFormField>(this);\n\n constructor() {\n // any time the ngControl changes, setup the subscriptions.\n onChange(this.ngControl, this.setupSubscriptions.bind(this));\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n\n /**\n * Setup a listener for the form control status.\n * @param control\n */\n private setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n this.subscription?.unsubscribe();\n\n if (!control) {\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 effect(\n () => {\n this.updateStatus();\n },\n { injector: this.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 this.subscription = underlyingControl.events.subscribe(() => this.updateStatus());\n }\n }\n\n private updateStatus(): void {\n const control = this.ngControl();\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 pristine = control.pristine;\n const touched = control.touched;\n const dirty = control.dirty;\n const valid = control.valid;\n const invalid = control.invalid;\n const pending = control.pending;\n const disabled = control.disabled;\n const errors = control.errors;\n\n untracked(() => {\n this.pristine.set(pristine);\n this.touched.set(touched);\n this.dirty.set(dirty);\n this.valid.set(valid);\n this.invalid.set(invalid);\n this.pending.set(pending);\n this.disabled.set(disabled);\n this.errors.set(errors ? Object.keys(errors) : []);\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 /**\n * Register the id of the associated form control.\n * @param id\n * @internal\n */\n setFormControl(id: string): void {\n this.formControl.set(id);\n }\n\n /**\n * Register a label with the form field.\n * @param label\n * @internal\n */\n addLabel(label: string): void {\n this.labels.update(labels => [...labels, label]);\n }\n\n /**\n * Register a description with the form field.\n * @param description\n * @internal\n */\n addDescription(description: string): void {\n this.descriptions.update(descriptions => [...descriptions, description]);\n }\n\n /**\n * Remove the associated form control.\n * @internal\n */\n removeFormControl(): void {\n this.formControl.set(null);\n }\n\n /**\n * Remove a label from the form field.\n * @param label\n * @internal\n */\n removeLabel(label: string): void {\n this.labels.update(labels => labels.filter(l => l !== label));\n }\n\n /**\n * Remove a description from the form field.\n * @param description\n * @internal\n */\n removeDescription(description: string): void {\n this.descriptions.update(descriptions => descriptions.filter(d => d !== description));\n }\n}\n","import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-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 host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\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 * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => this.formField()?.formControl());\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addLabel(this.id());\n onCleanup(() => this.formField()?.removeLabel(this.id()));\n });\n }\n\n @HostListener('click', ['$event'])\n protected 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 (this.isLabel) {\n event.preventDefault();\n }\n\n // to find the associated form control we can lookup via the known id\n const targetId = this.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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAe,WAAW,CAAC;AAEjF;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAe,sBAAsB;AAE5F;;AAEG;AACI,MAAM,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC;;ACtBjE;;AAEG;MAeU,cAAc,CAAA;AAUzB,IAAA,WAAA,GAAA;AATA;;AAEG;QACM,IAAA,CAAA,EAAE,GAAG,KAAK,CAAS,QAAQ,CAAC,iBAAiB,CAAC,8CAAC;AACxD;;AAEG;QACgB,IAAA,CAAA,SAAS,GAAG,oBAAoB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAGrE,MAAM,CAAC,SAAS,IAAG;YACjB,IAAI,CAAC,SAAS,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AAC3C,YAAA,SAAS,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,QAAA,CAAC,CAAC;IACJ;8GAfW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAA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EAAA,sCAAA,EAAA,iBAAA,EAAA,oCAAA,EAAA,mBAAA,EAAA,sCAAA,EAAA,oBAAA,EAAA,uCAAA,EAAA,iBAAA,EAAA,oCAAA,EAAA,mBAAA,EAAA,sCAAA,EAAA,oBAAA,EAAA,uCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAfpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,MAAM;AACnB,wBAAA,YAAY,EAAE,WAAW;AACzB,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC7D,wBAAA,mBAAmB,EAAE,kCAAkC;AACvD,wBAAA,qBAAqB,EAAE,oCAAoC;AAC3D,wBAAA,sBAAsB,EAAE,qCAAqC;AAC9D,qBAAA;AACF,iBAAA;;sBA8BE,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC3DnC;;AAEG;;;;"}
1
+ {"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 { Injector, Signal, effect, inject, signal, untracked } 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.\n */\n setFormControl(id: string): 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.\n */\n removeFormControl(): 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 id of the associated form control\n const formControl = signal<string | null>(null);\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\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 = ngControl();\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 function setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n subscription?.unsubscribe();\n\n if (!control) {\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 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(ngControl, setupSubscriptions);\n\n // Cleanup subscription on destroy\n onDestroy(() => subscription?.unsubscribe());\n\n // Methods\n function setFormControl(id: string): void {\n formControl.set(id);\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(): void {\n formControl.set(null);\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 };\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 };\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 };\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 { Signal, computed, signal } from '@angular/core';\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 // 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 attrBinding(elementRef, 'disabled', () => (supportsDisabledAttribute && disabled() ? '' : null));\n\n explicitEffect([id], ([id], onCleanup) => {\n formField()?.setFormControl(id);\n onCleanup(() => formField()?.removeFormControl());\n });\n\n attrBinding(elementRef, 'id', id);\n attrBinding(elementRef, 'aria-labelledby', ariaLabelledBy);\n attrBinding(elementRef, 'aria-describedby', ariaDescribedBy);\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 };\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":";;;;;;;MA2Fa,CAAC,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,CAAC,GAC9F,eAAe,CAAC,cAAc,EAAE,CAAC,EAAE,SAAS,EAAqB,KAAI;AACnE,IAAA,MAAM,OAAO,GAAG,gBAAgB,EAAE;AAClC,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;AAGjC,IAAA,MAAM,MAAM,GAAG,MAAM,CAAW,EAAE,kDAAC;;AAGnC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAW,EAAE,wDAAC;;AAGzC,IAAA,MAAM,WAAW,GAAG,MAAM,CAAgB,IAAI,uDAAC;;AAG/C,IAAA,MAAM,MAAM,GAAG,MAAM,CAAW,EAAE,kDAAC;;AAGnC,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,oDAAC;AAC7C,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,mDAAC;AAC5C,IAAA,MAAM,KAAK,GAAG,MAAM,CAAiB,IAAI,iDAAC;AAC1C,IAAA,MAAM,KAAK,GAAG,MAAM,CAAiB,IAAI,iDAAC;AAC1C,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,mDAAC;AAC5C,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,mDAAC;AAC5C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,oDAAC;;AAG7C,IAAA,IAAI,YAAsC;;AAG1C,IAAA,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC;AAC7C,IAAA,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC;AACzC,IAAA,WAAW,CA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A,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAFR,CAAC,iBAAiB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAErB,QAAQ,EAAA,UAAA,EAAA,CAAA;kBALpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,SAAS,EAAE,CAAC,iBAAiB,EAAE,CAAC;AACjC,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,9 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, signal, ElementRef, Renderer2, DOCUMENT, PLATFORM_ID, Injectable, effect, input, booleanAttribute, output, Directive, HostListener } from '@angular/core';
2
+ import { InjectionToken, inject, signal, ElementRef, Renderer2, DOCUMENT, PLATFORM_ID, Injectable, Injector, input, booleanAttribute, output, Directive, HostListener } from '@angular/core';
3
3
  import { onDomRemoval, injectElementRef } from 'ng-primitives/internal';
4
4
  import { FocusMonitor } from '@angular/cdk/a11y';
5
5
  import { safeTakeUntilDestroyed, onBooleanChange, injectDisposables } from 'ng-primitives/utils';
6
6
  import { isPlatformBrowser } from '@angular/common';
7
+ import { listener, dataBinding } from 'ng-primitives/state';
7
8
 
8
9
  const defaultInteractionsConfig = {
9
10
  disabled: false,
@@ -53,7 +54,7 @@ function isPressEnabled() {
53
54
  /**
54
55
  * @internal
55
56
  */
56
- function ngpFocusVisibleInteraction({ focusChange, disabled = signal(false), }) {
57
+ function ngpFocusVisible({ onFocusChange, disabled = signal(false), }) {
57
58
  const canFocusVisible = isFocusVisibleEnabled();
58
59
  if (!canFocusVisible) {
59
60
  return { isFocused: signal(false) };
@@ -101,7 +102,7 @@ function ngpFocusVisibleInteraction({ focusChange, disabled = signal(false), })
101
102
  return;
102
103
  }
103
104
  isFocused.set(value);
104
- focusChange?.(value);
105
+ onFocusChange?.(value);
105
106
  if (value) {
106
107
  renderer.setAttribute(elementRef.nativeElement, 'data-focus-visible', origin ?? '');
107
108
  }
@@ -145,7 +146,7 @@ function ngpFocusVisibleInteraction({ focusChange, disabled = signal(false), })
145
146
  /**
146
147
  * @internal
147
148
  */
148
- function ngpFocusInteraction({ focus, blur, focusWithin = false, disabled = signal(false), }) {
149
+ function ngpFocus({ onFocus, onBlur, focusWithin = false, disabled = signal(false), }) {
149
150
  const canFocus = isFocusEnabled();
150
151
  if (!canFocus) {
151
152
  return { isFocused: signal(false) };
@@ -175,14 +176,14 @@ function ngpFocusInteraction({ focus, blur, focusWithin = false, disabled = sign
175
176
  }
176
177
  isFocused.set(focusOrigin !== null);
177
178
  if (focusOrigin !== null) {
178
- if (focus) {
179
- focus();
179
+ if (onFocus) {
180
+ onFocus();
180
181
  }
181
182
  renderer.setAttribute(elementRef.nativeElement, 'data-focus', '');
182
183
  }
183
184
  else {
184
- if (blur) {
185
- blur();
185
+ if (onBlur) {
186
+ onBlur();
186
187
  }
187
188
  renderer.removeAttribute(elementRef.nativeElement, 'data-focus');
188
189
  }
@@ -245,7 +246,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
245
246
  * because there is a chance the directive has already been used.
246
247
  * @internal
247
248
  */
248
- function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }) {
249
+ function ngpHover({ onHoverStart, onHoverEnd, disabled = signal(false), }) {
249
250
  const canHover = isHoverEnabled();
250
251
  if (!canHover) {
251
252
  return { hovered: signal(false) };
@@ -258,10 +259,6 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
258
259
  * Access the global pointer events handler.
259
260
  */
260
261
  const globalPointerEvents = inject(GlobalPointerEvents);
261
- /**
262
- * Access the disposable helper.
263
- */
264
- const disposables = injectDisposables();
265
262
  /**
266
263
  * Store the current hover state.
267
264
  */
@@ -273,11 +270,11 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
273
270
  /**
274
271
  * Setup event listeners.
275
272
  */
276
- disposables.addEventListener(elementRef.nativeElement, 'pointerenter', onPointerEnter);
277
- disposables.addEventListener(elementRef.nativeElement, 'pointerleave', onPointerLeave);
278
- disposables.addEventListener(elementRef.nativeElement, 'touchstart', onTouchStart);
279
- disposables.addEventListener(elementRef.nativeElement, 'mouseenter', onMouseEnter);
280
- disposables.addEventListener(elementRef.nativeElement, 'mouseleave', onMouseLeave);
273
+ listener(elementRef.nativeElement, 'pointerenter', onPointerEnter);
274
+ listener(elementRef.nativeElement, 'pointerleave', onPointerLeave);
275
+ listener(elementRef.nativeElement, 'touchstart', onTouchStart);
276
+ listener(elementRef.nativeElement, 'mouseenter', onMouseEnter);
277
+ listener(elementRef.nativeElement, 'mouseleave', onMouseLeave);
281
278
  // anytime the disabled state changes to true, we must reset the hover state
282
279
  if (disabled) {
283
280
  onBooleanChange(disabled, reset);
@@ -285,21 +282,19 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
285
282
  // if the element is removed from the dom, we want to reset the hover state
286
283
  onDomRemoval(elementRef.nativeElement, reset);
287
284
  // anytime the hover state changes we want to update the attribute
288
- effect(() => hovered()
289
- ? elementRef.nativeElement.setAttribute('data-hover', '')
290
- : elementRef.nativeElement.removeAttribute('data-hover'));
285
+ dataBinding(elementRef, 'data-hover', hovered);
291
286
  /**
292
287
  * Reset the hover state.
293
288
  */
294
289
  function reset() {
295
- onHoverEnd('mouse');
290
+ onHoverFinished('mouse');
296
291
  }
297
292
  /**
298
293
  * Trigger the hover start events.
299
294
  * @param event
300
295
  * @param pointerType
301
296
  */
302
- function onHoverStart(event, pointerType) {
297
+ function onHoverBegin(event, pointerType) {
303
298
  if (disabled() ||
304
299
  pointerType === 'touch' ||
305
300
  hovered() ||
@@ -307,28 +302,28 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
307
302
  return;
308
303
  }
309
304
  hovered.set(true);
310
- hoverStart?.();
305
+ onHoverStart?.();
311
306
  }
312
307
  /**
313
308
  * Trigger the hover end events.
314
309
  * @param pointerType
315
310
  */
316
- function onHoverEnd(pointerType) {
311
+ function onHoverFinished(pointerType) {
317
312
  if (pointerType === 'touch' || !hovered()) {
318
313
  return;
319
314
  }
320
315
  hovered.set(false);
321
- hoverEnd?.();
316
+ onHoverEnd?.();
322
317
  }
323
318
  function onPointerEnter(event) {
324
319
  if (globalPointerEvents.ignoreEmulatedMouseEvents && event.pointerType === 'mouse') {
325
320
  return;
326
321
  }
327
- onHoverStart(event, event.pointerType);
322
+ onHoverBegin(event, event.pointerType);
328
323
  }
329
324
  function onPointerLeave(event) {
330
325
  if (!disabled() && event.currentTarget?.contains(event.target)) {
331
- onHoverEnd(event.pointerType);
326
+ onHoverFinished(event.pointerType);
332
327
  }
333
328
  }
334
329
  function onTouchStart() {
@@ -336,13 +331,13 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
336
331
  }
337
332
  function onMouseEnter(event) {
338
333
  if (!ignoreEmulatedMouseEvents && !globalPointerEvents.ignoreEmulatedMouseEvents) {
339
- onHoverStart(event, 'mouse');
334
+ onHoverBegin(event, 'mouse');
340
335
  }
341
336
  ignoreEmulatedMouseEvents = false;
342
337
  }
343
338
  function onMouseLeave(event) {
344
339
  if (!disabled() && event.currentTarget?.contains(event.target)) {
345
- onHoverEnd('mouse');
340
+ onHoverFinished('mouse');
346
341
  }
347
342
  }
348
343
  return { hovered };
@@ -351,23 +346,21 @@ function ngpHoverInteraction({ hoverStart, hoverEnd, disabled = signal(false), }
351
346
  /**
352
347
  * @internal
353
348
  */
354
- function ngpPressInteraction({ pressStart, pressEnd, disabled = signal(false), }) {
349
+ function ngpPress({ onPressStart, onPressEnd, disabled = signal(false), }) {
355
350
  const canPress = isPressEnabled();
356
351
  if (!canPress) {
357
352
  return { pressed: signal(false) };
358
353
  }
359
- const elementRef = inject(ElementRef);
360
- const disposables = injectDisposables();
354
+ const elementRef = injectElementRef();
355
+ const injector = inject(Injector);
361
356
  /**
362
357
  * Whether the element is currently pressed.
363
358
  */
364
359
  const pressed = signal(false, ...(ngDevMode ? [{ debugName: "pressed" }] : []));
365
360
  // setup event listeners
366
- disposables.addEventListener(elementRef.nativeElement, 'pointerdown', onPointerDown);
361
+ listener(elementRef, 'pointerdown', onPointerDown);
367
362
  // anytime the press state changes we want to update the attribute
368
- effect(() => pressed() && !disabled()
369
- ? elementRef.nativeElement.setAttribute('data-press', '')
370
- : elementRef.nativeElement.removeAttribute('data-press'));
363
+ dataBinding(elementRef, 'data-press', () => pressed() && !disabled());
371
364
  /**
372
365
  * Reset the press state.
373
366
  */
@@ -379,7 +372,7 @@ function ngpPressInteraction({ pressStart, pressEnd, disabled = signal(false), }
379
372
  // clear any existing disposables
380
373
  disposableListeners.forEach(dispose => dispose());
381
374
  pressed.set(false);
382
- pressEnd?.();
375
+ onPressEnd?.();
383
376
  }
384
377
  /**
385
378
  * Store the list of disposables.
@@ -393,17 +386,23 @@ function ngpPressInteraction({ pressStart, pressEnd, disabled = signal(false), }
393
386
  disposableListeners.forEach(dispose => dispose());
394
387
  // update the press state
395
388
  pressed.set(true);
396
- pressStart?.();
389
+ onPressStart?.();
397
390
  // setup global event listeners to catch events on elements outside the directive
398
391
  const ownerDocument = elementRef.nativeElement.ownerDocument ?? document;
399
392
  // if the pointer up event happens on any elements, then we are no longer pressing on this element
400
- const pointerUp = disposables.addEventListener(ownerDocument, 'pointerup', () => reset(), false);
393
+ const pointerUp = listener(ownerDocument, 'pointerup', () => reset(), {
394
+ config: false,
395
+ injector,
396
+ });
401
397
  // Instead of relying on the `pointerleave` event, which is not consistently called on iOS Safari,
402
398
  // we use the `pointermove` event to determine if we are still "pressing".
403
399
  // By checking if the target is still within the element, we can determine if the press is ongoing.
404
- const pointerMove = disposables.addEventListener(ownerDocument, 'pointermove', () => onPointerMove, false);
400
+ const pointerMove = listener(ownerDocument, 'pointermove', () => onPointerMove, { config: false, injector });
405
401
  // if the pointer is cancelled, then we are no longer pressing on this element
406
- const pointerCancel = disposables.addEventListener(ownerDocument, 'pointercancel', () => reset(), false);
402
+ const pointerCancel = listener(ownerDocument, 'pointercancel', () => reset(), {
403
+ config: false,
404
+ injector,
405
+ });
407
406
  disposableListeners = [pointerUp, pointerMove, pointerCancel];
408
407
  }
409
408
  function onPointerMove(event) {
@@ -426,16 +425,16 @@ function ngpInteractions({ focus, hover, press, focusWithin, focusVisible, disab
426
425
  return;
427
426
  }
428
427
  if (hover) {
429
- ngpHoverInteraction({ disabled });
428
+ ngpHover({ disabled });
430
429
  }
431
430
  if (press) {
432
- ngpPressInteraction({ disabled });
431
+ ngpPress({ disabled });
433
432
  }
434
433
  if (focus) {
435
- ngpFocusInteraction({ focusWithin, disabled });
434
+ ngpFocus({ focusWithin, disabled });
436
435
  }
437
436
  if (focusVisible) {
438
- ngpFocusVisibleInteraction({ disabled });
437
+ ngpFocusVisible({ disabled });
439
438
  }
440
439
  }
441
440
  /**
@@ -473,9 +472,9 @@ class NgpFocusVisible {
473
472
  alias: 'ngpFocusVisible',
474
473
  });
475
474
  // setup the focus visible listener
476
- ngpFocusVisibleInteraction({
475
+ ngpFocusVisible({
477
476
  disabled: this.disabled,
478
- focusChange: value => this.focusChange.emit(value),
477
+ onFocusChange: value => this.focusChange.emit(value),
479
478
  });
480
479
  }
481
480
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFocusVisible, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -508,10 +507,10 @@ class NgpFocus {
508
507
  */
509
508
  this.focus = output({ alias: 'ngpFocus' });
510
509
  // setup the focus listener
511
- ngpFocusInteraction({
510
+ ngpFocus({
512
511
  disabled: this.disabled,
513
- focus: () => this.focus.emit(true),
514
- blur: () => this.focus.emit(false),
512
+ onFocus: () => this.focus.emit(true),
513
+ onBlur: () => this.focus.emit(false),
515
514
  });
516
515
  }
517
516
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpFocus, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -557,12 +556,12 @@ class NgpHover {
557
556
  */
558
557
  this.hoverChange = output({ alias: 'ngpHover' });
559
558
  // setup the hover listener
560
- ngpHoverInteraction({
561
- hoverStart: () => {
559
+ ngpHover({
560
+ onHoverStart: () => {
562
561
  this.hoverStart.emit();
563
562
  this.hoverChange.emit(true);
564
563
  },
565
- hoverEnd: () => {
564
+ onHoverEnd: () => {
566
565
  this.hoverEnd.emit();
567
566
  this.hoverChange.emit(false);
568
567
  },
@@ -819,12 +818,12 @@ class NgpPress {
819
818
  alias: 'ngpPress',
820
819
  });
821
820
  // setup the press listener
822
- ngpPressInteraction({
823
- pressStart: () => {
821
+ ngpPress({
822
+ onPressStart: () => {
824
823
  this.pressStart.emit();
825
824
  this.pressChange.emit(true);
826
825
  },
827
- pressEnd: () => {
826
+ onPressEnd: () => {
828
827
  this.pressEnd.emit();
829
828
  this.pressChange.emit(false);
830
829
  },
@@ -848,5 +847,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
848
847
  * Generated bundle index. Do not edit.
849
848
  */
850
849
 
851
- export { NgpFocus, NgpFocusVisible, NgpHover, NgpMove, NgpPress, ngpFocusInteraction, ngpFocusVisibleInteraction, ngpHoverInteraction, ngpInteractions, ngpPressInteraction, provideInteractionsConfig, ngpInteractions as setupInteractions };
850
+ export { NgpFocus, NgpFocusVisible, NgpHover, NgpMove, NgpPress, ngpFocus, ngpFocusVisible, ngpHover, ngpInteractions, ngpPress, provideInteractionsConfig, ngpInteractions as setupInteractions };
852
851
  //# sourceMappingURL=ng-primitives-interactions.mjs.map