UNPKG

@funidata/ngx-fudis

Version:

Funidata Design System.

137 lines (136 loc) 3.62 kB
import { FormControl, FormGroup } from '@angular/forms'; import { MatDateFormats } from '@angular/material/core'; export declare const fudisInputSizeArray: readonly ["sm", "md", "lg"]; export declare const fudisSelectionGroupInputSizeArray: readonly ["sm", "md", "lg", "full-width"]; export type FudisInputSize = (typeof fudisInputSizeArray)[number]; /** * Input size options used by CheckboxGroup and RadioButtonGroup */ export type FudisSelectionGroupInputSize = (typeof fudisSelectionGroupInputSizeArray)[number]; export type FudisInputType = 'email' | 'number' | 'password' | 'tel' | 'text' | 'url'; export type FudisCheckboxOption<T extends object> = T & { /** * Unique id for single checkbox */ id?: string; /** * Visible label that is shown in the UI */ label?: string; /** * Is option selected */ value?: boolean | null | undefined; /** * To store additional data */ [key: string]: unknown; }; export type FudisCheckboxGroupOption<T extends object> = T & { /** * Unique id for single checkbox group option */ id?: string; /** * Name for the group of checkboxes */ groupName?: string; /** * If using FormGroup, name of the option */ controlName?: string; /** * Visible label that is shown in the UI */ label: string; /** * Is option selected */ value?: boolean | null | undefined; /** * To store additional data */ [key: string]: unknown; }; export type FudisRadioButtonOption<T extends object> = T & { /** * Generated id for single radio option */ id?: string; /** * Underlying value of the option */ value: string | boolean | null | unknown; /** * Value that is shown in the UI */ label: string; /** * To store additional data */ [key: string]: unknown; }; export type FudisSelectVariant = 'dropdown' | 'autocompleteDropdown' | 'autocompleteType'; export type FudisSelectOption<T extends object> = T & { /** * Underlying value of the option */ value: any; /** * Value that is shown in the UI */ label: string; /** * Secondary, optional label for the option */ subLabel?: string; /** * Is option disabled in the dropdown */ disabled?: boolean; /** * To store additional data */ [key: string]: unknown; }; export type FudisLocalizedTextGroupFormGroupOptions = { controlName: 'fi'; label: 'FI'; } | { controlName: 'sv'; label: 'SV'; } | { controlName: 'en'; label: 'EN'; } | { controlName: string; label: string; }; export interface FudisLocalizedTextGroupDefaultFormGroup { fi: FormControl<string | null>; en: FormControl<string | null>; sv: FormControl<string | null>; } export type FudisLocalizedTextGroupFormGroup<T> = { [K in keyof T]: FormControl<string | null>; }; export type FudisCheckboxGroupFormGroup<T> = { [K in keyof T]: FormControl<boolean | null>; }; export type FudisCheckboxChangeEvent = { checkbox: FudisCheckboxGroupOption<object> | FudisCheckboxOption<object>; control: FormControl<boolean | null>; }; export type FudisCheckboxGroupChangeEvent = { changedControlName: string; formGroup: FormGroup; }; export type FudisRadioButtonChangeEvent = { option: FudisRadioButtonOption<object>; control: FormControl<unknown>; }; export declare const FudisDateInputFormat: { dateInput: string; monthYearLabel: string; }; export declare const FUDIS_DATE_FORMATS: MatDateFormats;