UNPKG

carbon-components-angular

Version:
217 lines (213 loc) 7.01 kB
/** * * carbon-angular v0.0.0 | radio-group.component.d.ts * * Copyright 2014, 2025 IBM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { AfterContentInit, EventEmitter, QueryList, AfterViewInit, TemplateRef } from "@angular/core"; import { ControlValueAccessor } from "@angular/forms"; import { Radio } from "./radio.component"; import { RadioChange } from "./radio-change.class"; import * as i0 from "@angular/core"; /** * Get started with importing the module: * * ```typescript * import { RadioModule } from 'carbon-components-angular'; * ``` * * Ex: * * ```html * <cds-radio-group [(ngModel)]="radio"> * <cds-radio *ngFor="let one of manyRadios" [value]="one"> * Radio {{one}} * </cds-radio> * </cds-radio-group> * * Radio selected: {{radio}} * ``` * * ```ts * const manyRadios = ["one", "two", "three", "four", "five", "six"]; * ``` * * [See demo](../../?path=/story/components-radio--basic) */ export declare class RadioGroup implements AfterContentInit, AfterViewInit, ControlValueAccessor { /** * Sets the passed in `Radio` item as the selected input within the `RadioGroup`. */ set selected(selected: Radio | null); /** * Returns the `Radio` that is selected within the `RadioGroup`. */ get selected(): Radio | null; /** * Sets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value. */ set value(newValue: any); /** * Returns the value/state of the selected `Radio` within the `RadioGroup`. */ get value(): any; /** * Replaces the name associated with the `RadioGroup` with the provided parameter. */ set name(name: string); /** * Returns the associated name of the `RadioGroup`. */ get name(): string; /** * Set to true to disable the whole radio group */ set disabled(disabled: boolean); /** * Returns the disabled value for the `RadioGroup`. */ get disabled(): boolean; /** * Returns the skeleton value in the `RadioGroup` if there is one. */ get skeleton(): any; /** * Sets the skeleton value for all `Radio` to the skeleton value of `RadioGroup`. */ set skeleton(value: any); /** * Used for creating the `RadioGroup` 'name' property dynamically. */ static radioGroupCount: number; orientation: "horizontal" | "vertical"; labelPlacement: "right" | "left"; legend: string | TemplateRef<any>; /** * Used to set the `aria-label` attribute on the radio group element. */ ariaLabel: string; /** * Used to set the `aria-labelledby` attribute on the radio group element. */ ariaLabelledby: string; /** * Sets the optional helper text. */ helperText: string | TemplateRef<any>; /** * Set to `true` to show the invalid state. */ invalid: boolean; /** * Value displayed if combobox is in an invalid state. */ invalidText: string | TemplateRef<any>; /** * Set to `true` to show a warning (contents set by warnText) */ warn: boolean; /** * Sets the warning text */ warnText: string | TemplateRef<any>; /** * Emits event notifying other classes of a change using a `RadioChange` class. */ change: EventEmitter<RadioChange>; /** * The `Radio` input items in the `RadioGroup`. */ radios: QueryList<Radio>; /** * Binds 'cds--form-item' value to the class for `RadioGroup`. */ radioButtonGroupClass: boolean; /** * To track whether the `RadioGroup` has been initialized. */ protected isInitialized: boolean; /** * Reflects whether or not the input is disabled and cannot be selected. */ protected _disabled: boolean; /** * Reflects whether or not the dropdown is loading. */ protected _skeleton: boolean; /** * The value of the selected option within the `RadioGroup`. */ protected _value: any; /** * The `Radio` within the `RadioGroup` that is selected. */ protected _selected: Radio; /** * The name attribute associated with the `RadioGroup`. */ protected _name: string; /** * Updates the selected `Radio` to be checked (selected). */ checkSelectedRadio(): void; /** * Use the value of the `RadioGroup` to update the selected radio to the right state (selected state). */ updateSelectedRadioFromValue(): void; /** * `ControlValueAccessor` method to programmatically disable the `RadioGroup`. * * ex: `this.formGroup.get("myRadioGroup").disable();` * * @param isDisabled `true` to disable the inputs */ setDisabledState(isDisabled: boolean): void; /** * Creates a class of `RadioChange` to emit the change in the `RadioGroup`. */ emitChangeEvent(event: RadioChange): void; /** * Synchronizes radio properties. */ updateRadios(): void; /** * Updates the value of the `RadioGroup` using the provided parameter. */ writeValue(value: any): void; ngAfterContentInit(): void; ngAfterViewInit(): void; /** * Used to set method to propagate changes back to the form. */ registerOnChange(fn: any): void; /** * Registers a callback to be triggered when the control has been touched. * @param fn Callback to be triggered when the checkbox is touched. */ registerOnTouched(fn: any): void; focusOut(): void; /** * Needed to properly implement ControlValueAccessor. */ onTouched: () => any; /** * Method set in registerOnChange to propagate changes back to the form. */ propagateChange: (_: any) => void; isTemplate(value: any): boolean; protected updateChildren(): void; protected updateRadioChangeHandler(): void; static ɵfac: i0.ɵɵFactoryDeclaration<RadioGroup, never>; static ɵcmp: i0.ɵɵComponentDeclaration<RadioGroup, "cds-radio-group, ibm-radio-group", never, { "selected": "selected"; "value": "value"; "name": "name"; "disabled": "disabled"; "skeleton": "skeleton"; "orientation": "orientation"; "labelPlacement": "labelPlacement"; "legend": "legend"; "ariaLabel": "ariaLabel"; "ariaLabelledby": "ariaLabelledby"; "helperText": "helperText"; "invalid": "invalid"; "invalidText": "invalidText"; "warn": "warn"; "warnText": "warnText"; }, { "change": "change"; }, ["radios"], ["*"], false>; }