{"version":3,"file":"ng-forge-dynamic-forms-bootstrap-lazy-button.mjs","mappings":";;;;;;AA4Bc;;AAGH;;IAGA;;AAEA;;AAEA;AACP;AACA;AACA;;;;AAKE;AACA;;;AAGA;AACD;;;;;;AAOD;;AACA;;;AA/BiB","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-bootstrap/src/lib/fields/button/bs-button.component.ts"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { FormEvent } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { injectNgForgeAction, NgForgeActionHost } from '@ng-forge/dynamic-forms/integration';\nimport { BsButtonProps } from './bs-button.type';\n\n@Component({\n  selector: 'df-bs-button',\n  imports: [DynamicTextPipe, AsyncPipe],\n  styleUrl: '../../styles/_form-field.scss',\n  hostDirectives: [NgForgeActionHost],\n  template: `\n    @let buttonId = action.key() + '-button';\n    <button\n      [id]=\"buttonId\"\n      [type]=\"buttonType()\"\n      [disabled]=\"action.disabled()\"\n      [class]=\"buttonClasses()\"\n      [attr.tabindex]=\"action.tabIndex()\"\n      [attr.data-testid]=\"buttonTestId()\"\n      (click)=\"onClick()\"\n    >\n      {{ action.label() | dynamicText | async }}\n    </button>\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class BsButtonFieldComponent<TEvent extends FormEvent> {\n  protected readonly action = injectNgForgeAction<TEvent>();\n\n  readonly props = input<BsButtonProps>();\n\n  /** Resolved button type — defaults to 'button' unless overridden via props. */\n  readonly buttonType = computed(() => this.props()?.type ?? 'button');\n\n  readonly buttonTestId = computed(() => `${this.buttonType()}-${this.action.key()}`);\n\n  readonly buttonClasses = computed(() => {\n    const p = this.props();\n    const variant = p?.variant || 'primary';\n    const outline = p?.outline ? 'outline-' : '';\n\n    return [\n      'btn',\n      `btn-${outline}${variant}`,\n      p?.size === 'sm' && 'btn-sm',\n      p?.size === 'lg' && 'btn-lg',\n      p?.block && 'w-100',\n      p?.active && 'active',\n      this.action.className(),\n    ]\n      .filter(Boolean)\n      .join(' ');\n  });\n\n  /** Submit buttons let the native form handle submission; other buttons dispatch via the directive. */\n  onClick(): void {\n    if (this.buttonType() === 'submit') return;\n    this.action.dispatch();\n  }\n}\n"]}