import { Component, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { FormFieldComponent } from '@shared/ui/molecules/form-field/form-field.component'; import { TextInputComponent } from '@shared/ui/atoms/text-input/text-input.component'; export interface AdresValue { straat: string; postcode: string; woonplaats: string; } export type AdresErrors = Partial>; /** Organism: the editable address block (straat / postcode / woonplaats), grouped in a fieldset/legend. Pure & presentational — values in via `value`, errors in via `errors`, every keystroke out via `fieldChange`. No store, no services, no internal state; the container owns the Model and decides what a change means (registratie-wizard dispatches SetField; change-request-form sets its props). Composes the form-field molecule (×3) so labels/error wiring stay consistent. */ @Component({ selector: 'app-address-fields', imports: [FormsModule, FormFieldComponent, TextInputComponent], // No scoped `fieldset` reset here: the fieldset must keep CIBG's // `.form-horizontal fieldset` grey-box padding/margin. A local `fieldset{padding:0}` // would tie on specificity and (injected later) win, flattening the padding. styles: [ ` legend { padding: 0; font-weight: var(--rhc-text-font-weight-semi-bold); margin-block-end: var(--rhc-space-max-md); } `, ], template: `
{{ legend() }}
`, }) export class AddressFieldsComponent { value = input.required(); errors = input({}); /** Prefix for field ids/labels — keeps them unique if two blocks ever co-exist. */ idPrefix = input('adres'); legend = input($localize`:@@address.legend:Adres`); fieldChange = output<{ key: keyof AdresValue; value: string }>(); }