/** * Copyright (c) 2026, Salesforce, Inc., * All rights reserved. * For full license text, see the LICENSE.txt file */ import { booleanAttribute, ChangeDetectionStrategy, Component, input } from '@angular/core'; import { HlmField, HlmFieldImports } from '@spartan-ng/styles/field'; @Component({ selector: 'app-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [HlmFieldImports], hostDirectives: [HlmField], host: { 'data-slot': 'field', '[attr.data-invalid]': 'error() ? true : null', }, templateUrl: './field.html', }) export class FieldComponent { readonly label = input(''); readonly description = input(''); readonly error = input(null); readonly required = input(false, { transform: booleanAttribute }); readonly htmlFor = input(null); } export const FieldImports = [FieldComponent] as const;