/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ import { ChangeDetectionStrategy, Component, booleanAttribute, computed, input, model, } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HlmInputGroupImports } from '@spartan-ng/styles/input-group'; import { HlmLabelImports } from '@spartan-ng/styles/label'; import type { AppFieldSize } from '../field-size'; import type { AppFieldAppearance } from '../field-appearance'; import { IconComponent, type AppIconName } from '../icon/icon'; const SIZE_CLASSES: Record = { sm: 'h-6 text-xs', default: 'h-8', lg: 'h-10', }; const APPEARANCE_CLASSES: Record = { outline: '', fill: 'border-transparent bg-muted', }; @Component({ selector: 'app-input', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, HlmInputGroupImports, HlmLabelImports, IconComponent], host: { class: 'block min-w-0' }, templateUrl: './input.html', }) export class InputComponent { readonly value = model(''); readonly placeholder = input(''); readonly label = input(''); readonly type = input('text'); readonly disabled = input(false, { transform: booleanAttribute }); readonly appearance = input('outline'); readonly error = input(false, { transform: booleanAttribute }); readonly errorMessage = input(''); readonly size = input('default'); readonly id = input(''); readonly ariaDescribedby = input(''); // Accessible name for inputs with no visible