import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { MatRadioChange } from '@angular/material/radio';
import { DomSanitizer } from '@angular/platform-browser';
import { TsReactiveFormBaseComponent, TsStyleThemeTypes } from '@terminus/ui/utilities';
/**
* Define the allowed keys for an item passed to the {@link TsRadioComponent}
*/
export interface TsRadioOption {
[key: string]: any;
/**
* Define if the item is disabled
*/
disabled?: boolean;
/**
* Define the template for the content (used if type is visual)
*/
template?: string;
}
/**
* The change event as TsRadioChange. Used by {@link TsRadioGroupComponent}
*/
export declare class TsRadioChange {
source: TsRadioGroupComponent;
value: any;
constructor(source: TsRadioGroupComponent, value: any);
}
/**
* Expose the formatter function type used by {@link TsRadioGroupComponent}
*/
export declare type TsRadioFormatFn = (v: TsRadioOption) => string;
/**
* The radio UI Component
*
* @example
*
*
* https://getterminus.github.io/ui-demos-release/components/radio-group
*/
export declare class TsRadioGroupComponent extends TsReactiveFormBaseComponent implements OnInit, OnDestroy {
private changeDetectorRef;
domSanitizer: DomSanitizer;
/**
* Define the default component ID
*/
protected _uid: string;
/**
* Define the ripple color.
* TODO: abstract out to a service or utility function or set as a global default for ripples
*/
rippleColor: string;
/**
* Getter to determine if the group is required
*/
get isRequired(): boolean;
/**
* Used to set the 'aria-label' attribute on the underlying input element.
*/
ariaLabel: string | undefined;
/**
* The 'aria-labelledby' attribute takes precedence as the element's text alternative.
*/
ariaLabelledby: string | undefined;
/**
* The 'aria-describedby' attribute is read after the element's label and field type.
*/
ariaDescribedby: string | undefined;
/**
* Define if the radio contents should be centered (used with the visual radio group layout)
*/
centeredContent: boolean;
/**
* Define a function to retrieve the UI value for an option
*
* @param value
*/
set formatUILabelFn(value: TsRadioFormatFn);
get formatUILabelFn(): TsRadioFormatFn;
private _formatUILabelFn;
/**
* Define a function to retrieve the UI value for an option
*
* @param value
*/
set formatUISubLabelFn(value: TsRadioFormatFn);
get formatUISubLabelFn(): TsRadioFormatFn;
private _formatUISubLabelFn;
/**
* Define a function to retrieve the UI value for an option
*
* @param value
*/
set formatModelValueFn(value: TsRadioFormatFn);
get formatModelValueFn(): TsRadioFormatFn;
private _formatModelValueFn;
/**
* Define an ID for the component
*
* @param value
*/
set id(value: string);
get id(): string;
protected _id: string;
/**
* Define if the radio group is disabled
*/
isDisabled: boolean;
/**
* Define if the radio group is visual (boxes) or standard (text)
*/
isVisual: boolean;
/**
* Define a label for the radio group
*/
label: string;
/**
* The HTML name attribute applied to radio buttons in this group.
*
* @param value
*/
set name(value: string);
get name(): string;
private _name;
/**
* Define whether a validation or a hint needed.
*/
noValidationOrHint: boolean;
/**
* Accept an array of radio options in the {@link TsRadioOption} format
*
* @param value
*/
set options(value: TsRadioOption[]);
get options(): TsRadioOption[];
private _options;
/**
* Define if the visual style should be large or small
*/
small: boolean;
/**
* Define the theme. {@link TsStyleThemeTypes}
*/
theme: TsStyleThemeTypes;
/**
* Emit event when a selection occurs. {@link TsRadioChange}
*/
readonly selectionChange: EventEmitter;
constructor(changeDetectorRef: ChangeDetectorRef, domSanitizer: DomSanitizer);
/**
* Update the change detector if the control value changes
*/
ngOnInit(): void;
/**
* Needed for untilComponentDestroyed
*/
ngOnDestroy(): void;
/**
* Retrieve a value determined by the passed in formatter
*
* @param option - The radio option
* @param formatter - The formatter function used to retrieve the value
* @returns The retrieved value
*/
retrieveValue(option: TsRadioOption, formatter?: TsRadioFormatFn): TsRadioOption | string;
/**
* Handle changes
*
* @param option - The selected option
*/
radioGroupChange(option: MatRadioChange): void;
/**
* Handles changes for visual radio groups
*
* @param option - The selected option
*/
visualRadioGroupChange(option: TsRadioOption): void;
/**
* Function for tracking for-loops changes
*
* @param index - The item index
* @returns The unique ID
*/
trackByFn(index: any): number;
}