UNPKG

carbon-components-angular

Version:
109 lines (105 loc) 3.54 kB
/** * * carbon-angular v0.0.0 | toggle.component.d.ts * * Copyright 2014, 2024 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 { Checkbox } from "carbon-components-angular/checkbox"; import { ChangeDetectorRef, TemplateRef } from "@angular/core"; import { I18n } from "carbon-components-angular/i18n"; import { Observable } from "rxjs"; import * as i0 from "@angular/core"; /** * Defines the set of states for a toggle component. */ export declare enum ToggleState { Init = 0, Checked = 1, Unchecked = 2 } /** * Get started with importing the module: * * ```typescript * import { ToggleModule } from 'carbon-components-angular'; * ``` * * ```html * <cds-toggle [(ngModel)]="toggleState">Toggle</cds-toggle> * ``` * * [See demo](../../?path=/story/components-toggle--basic) */ export declare class Toggle extends Checkbox { protected changeDetectorRef: ChangeDetectorRef; protected i18n: I18n; /** * Variable used for creating unique ids for toggle components. */ static toggleCount: number; /** * Text that is set on the left side of the toggle. */ set offText(value: string | Observable<string>); get offText(): string | Observable<string>; /** * Text that is set on the right side of the toggle. */ set onText(value: string | Observable<string>); get onText(): string | Observable<string>; /** * Text that is set as the label of the toggle. */ label: string | TemplateRef<any>; /** * Size of the toggle component. */ size: "sm" | "md"; /** * Set to `true` to hide the toggle label & set toggle on/off text to label. */ hideLabel: boolean; skeleton: boolean; toggleClass: boolean; get disabledClass(): boolean; get formItem(): boolean; /** * The unique id allocated to the `Toggle`. */ id: string; protected _offValues: import("carbon-components-angular/i18n").Overridable; protected _onValues: import("carbon-components-angular/i18n").Overridable; /** * Creates an instance of Toggle. */ constructor(changeDetectorRef: ChangeDetectorRef, i18n: I18n); /** * `ControlValueAccessor` method to programmatically disable the toggle input. * * ex: `this.formGroup.get("myToggle").disable();` * * @param isDisabled `true` to disable the input */ setDisabledState(isDisabled: boolean): void; getOffText(): Observable<string>; getOnText(): Observable<string>; getCheckedText(): Observable<string>; /** * Creates instance of `ToggleChange` used to propagate the change event. */ emitChangeEvent(): void; isTemplate(value: any): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<Toggle, never>; static ɵcmp: i0.ɵɵComponentDeclaration<Toggle, "cds-toggle, ibm-toggle", never, { "offText": "offText"; "onText": "onText"; "label": "label"; "size": "size"; "hideLabel": "hideLabel"; "skeleton": "skeleton"; }, {}, never, never, false>; }