{"version":3,"file":"ng-forge-dynamic-forms-primeng-lazy-textarea.mjs","mappings":";;;;;;;;;;;;AAsCmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDE;;YAKA;;AACA;;AAEnB;AACE;AACA;;;AAKA;;;;AAhES;;;;;;;;;;;;;;;;;;;;;;;;AA1BF;AACT;AACA;AACA;;;;;;;;;;;;;;;;;;;;AAoBC;;AAEF;;;ACUa;;AAGH;;AAEU;;AAEA;;;AAPA;;;;;;;;;;;;;;;;;;;;;;;AAVlB;;;;AA3BS","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-primeng/src/lib/fields/textarea/prime-textarea-control.component.ts","../../../../packages/dynamic-forms-primeng/src/lib/fields/textarea/prime-textarea.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, model } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { FormValueControl } from '@angular/forms/signals';\nimport { NgForgeField, setupMetaTracking, TextareaMeta } from '@ng-forge/dynamic-forms/integration';\nimport { TextareaModule } from 'primeng/textarea';\n\n/**\n * PrimeNG textarea wrapper implementing FormValueControl. Rendered inside\n * `df-prime-textarea` — picks up meta + aria from the ambient parent\n * NgForgeField via `setupMetaTracking` (selector: `'textarea'`).\n */\n@Component({\n  selector: 'df-prime-textarea-control',\n  imports: [TextareaModule, FormsModule],\n  template: `\n    <textarea\n      pInputTextarea\n      [id]=\"inputId()\"\n      [ngModel]=\"value()\"\n      (ngModelChange)=\"value.set($event)\"\n      [placeholder]=\"placeholder()\"\n      [attr.minlength]=\"minLength()\"\n      [attr.maxlength]=\"maxLength()\"\n      [attr.tabindex]=\"tabIndex()\"\n      [autoResize]=\"autoResize()\"\n      [disabled]=\"disabled()\"\n      [readonly]=\"readonly()\"\n      [invalid]=\"ariaInvalid()\"\n      [class]=\"styleClass()\"\n      [attr.aria-invalid]=\"ariaInvalid()\"\n      [attr.aria-required]=\"ariaRequired()\"\n      [attr.aria-describedby]=\"ariaDescribedBy()\"\n      (blur)=\"onBlur()\"\n    ></textarea>\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PrimeTextareaControlComponent implements FormValueControl<string> {\n  private readonly elementRef = inject(ElementRef<HTMLElement>);\n  private readonly parentField = inject(NgForgeField, { optional: true });\n\n  // ─────────────────────────────────────────────────────────────────────────────\n  // FormValueControl implementation\n  // ─────────────────────────────────────────────────────────────────────────────\n\n  /** The value of the textarea - required by FormValueControl */\n  readonly value = model<string>('');\n\n  /** Tracks whether the field has been touched - used by Field directive */\n  readonly touched = model<boolean>(false);\n\n  /** Whether the field is disabled */\n  readonly disabled = input<boolean>(false);\n\n  /** Whether the field is readonly */\n  readonly readonly = input<boolean>(false);\n\n  /** Whether the field is invalid (from Field directive) */\n  readonly invalid = input<boolean>(false);\n\n  /** Whether the field is required (from Field directive) */\n  readonly required = input<boolean>(false);\n\n  // ─────────────────────────────────────────────────────────────────────────────\n  // PrimeNG-specific props\n  // ─────────────────────────────────────────────────────────────────────────────\n\n  /** Id forwarded onto the inner <textarea> so the parent `<label [for]>` resolves correctly. */\n  readonly inputId = input<string>('');\n  readonly placeholder = input<string>('');\n  readonly rows = input<number>(4);\n  readonly cols = input<number | undefined>(undefined);\n  // Length-validator → DOM wiring uses Signal Forms's setInputOnDirectives to copy\n  // FieldState.maxLength/minLength onto these camelCase-named inputs automatically.\n  // The match must be exact-case — renaming these to lowercase would silently break the\n  // wiring. The Ionic adapter takes the alternate strategy (direct template binding)\n  // because <ion-input> / <ion-textarea> use lowercase property names we cannot rename.\n  // See packages/dynamic-forms-ionic/src/lib/fields/input/ionic-input.component.ts.\n  readonly maxLength = input<number | undefined>(undefined);\n  readonly minLength = input<number | undefined>(undefined);\n  readonly tabIndex = input<number | undefined>(undefined);\n  readonly autoResize = input<boolean>(false);\n  readonly styleClass = input<string>('');\n\n  // Meta + aria-describedby read from the ambient parent NgForgeField.\n  protected readonly meta = computed<TextareaMeta | undefined>(() => this.parentField?.meta() as TextareaMeta | undefined);\n  protected readonly ariaDescribedBy = computed<string | null>(() => this.parentField?.ariaDescribedBy() ?? null);\n\n  // Aria signals read from the ambient parent NgForgeField — matches the\n  // pattern in prime-datepicker-control / prime-select-control. Standalone\n  // use (no parent) lands false / null.\n  protected readonly ariaInvalid = computed<boolean>(() => this.parentField?.ariaInvalid() ?? false);\n  protected readonly ariaRequired = computed<true | null>(() => this.parentField?.ariaRequired() ?? null);\n\n  constructor() {\n    this.parentField?.markClaimed();\n    setupMetaTracking(this.elementRef, this.meta, { selector: 'textarea' });\n  }\n\n  /** Marks the field as touched when textarea loses focus */\n  onBlur(): void {\n    this.touched.set(true);\n    this.parentField?.field()().markAsTouched();\n  }\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { PrimeTextareaProps } from './prime-textarea.type';\nimport { AsyncPipe } from '@angular/common';\nimport { PrimeTextareaControlComponent } from './prime-textarea-control.component';\n\n@Component({\n  selector: 'df-prime-textarea',\n  imports: [DynamicTextPipe, AsyncPipe, FormField, PrimeTextareaControlComponent],\n  styleUrl: '../../styles/_form-field.scss',\n  hostDirectives: [NgForgeFieldHost],\n  template: `\n    <div class=\"df-prime-field\">\n      @if (ngf.label()) {\n        <label [for]=\"inputId()\" class=\"df-prime-label\">{{ ngf.label() | dynamicText | async }}</label>\n      }\n\n      <df-prime-textarea-control\n        [inputId]=\"inputId()\"\n        [formField]=\"ngf.field()\"\n        [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n        [rows]=\"props()?.rows || 4\"\n        [cols]=\"props()?.cols\"\n        [tabIndex]=\"ngf.tabIndex()\"\n        [autoResize]=\"props()?.autoResize ?? false\"\n        [styleClass]=\"textareaClasses()\"\n      />\n\n      @if (ngf.errorsToDisplay()[0]; as error) {\n        <small class=\"p-error\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</small>\n      } @else if (props()?.hint; as hint) {\n        <small class=\"df-prime-hint\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</small>\n      }\n    </div>\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  styles: [\n    `\n      :host([hidden]) {\n        display: none !important;\n      }\n    `,\n  ],\n})\nexport default class PrimeTextareaFieldComponent {\n  protected readonly ngf = injectNgForgeField<string>();\n\n  readonly props = input<PrimeTextareaProps>();\n\n  protected readonly textareaClasses = computed(() => this.props()?.styleClass ?? '');\n\n  protected readonly inputId = computed(() => `${this.ngf.key()}-textarea`);\n}\n"]}