primeng
Version:
PrimeNG is a premium UI library for Angular featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock,
161 lines (157 loc) • 6.29 kB
TypeScript
import { ToggleSwitchPassThrough, ToggleSwitchChangeEvent, ToggleSwitchHandleTemplateContext } from 'primeng/types/toggleswitch';
export * from 'primeng/types/toggleswitch';
import * as _angular_core from '@angular/core';
import { Provider, TemplateRef, ElementRef } from '@angular/core';
import { BaseEditableHolder } from 'primeng/baseeditableholder';
import * as i1 from 'primeng/bind';
import { Bind } from 'primeng/bind';
import { InputSize } from 'primeng/types/shared';
import { BaseStyle } from 'primeng/base';
import * as i2 from 'primeng/api';
/**
*
* ToggleSwitch is used to select a boolean value.
*
* [Live Demo](https://www.primeng.org/toggleswitch/)
*
* @module toggleswitchstyle
*
*/
declare enum ToggleSwitchClasses {
/**
* Class name of the root element
*/
root = "p-toggleswitch",
/**
* Class name of the input element
*/
input = "p-toggleswitch-input",
/**
* Class name of the slider element
*/
slider = "p-toggleswitch-slider"
}
declare class ToggleSwitchStyle extends BaseStyle {
name: string;
style: string;
classes: {
root: ({ instance }: {
instance: any;
}) => (string | {
'p-toggleswitch-checked': any;
'p-disabled': any;
'p-invalid': any;
})[];
input: string;
slider: string;
handle: string;
};
inlineStyles: {
root: {
position: string;
};
};
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleSwitchStyle, never>;
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ToggleSwitchStyle>;
}
interface ToggleSwitchStyle extends BaseStyle {
}
declare const TOGGLESWITCH_VALUE_ACCESSOR: Provider;
/**
* ToggleSwitch is used to select a boolean value.
* @group Components
*/
declare class ToggleSwitch extends BaseEditableHolder<ToggleSwitchPassThrough> {
componentName: string;
$pcToggleSwitch: ToggleSwitch | undefined;
bindDirectiveInstance: Bind;
_componentStyle: ToggleSwitchStyle;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex: _angular_core.InputSignalWithTransform<number | undefined, unknown>;
/**
* Identifier of the input element.
* @group Props
*/
inputId: _angular_core.InputSignal<string | undefined>;
/**
* When present, it specifies that the component cannot be edited.
* @group Props
*/
readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
/**
* Value in checked state.
* @group Props
*/
trueValue: _angular_core.InputSignal<any>;
/**
* Value in unchecked state.
* @group Props
*/
falseValue: _angular_core.InputSignal<any>;
/**
* Used to define a string that autocomplete attribute the current element.
* @group Props
*/
ariaLabel: _angular_core.InputSignal<string | undefined>;
/**
* Specifies the size of the component.
* @defaultValue undefined
* @group Props
*/
size: _angular_core.InputSignal<InputSize | undefined>;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
*/
ariaLabelledBy: _angular_core.InputSignal<string | undefined>;
/**
* When present, it specifies that the component should automatically get focus on load.
* @group Props
*/
autofocus: _angular_core.InputSignalWithTransform<boolean, unknown>;
/**
* Callback to invoke when the on value change.
* @param {ToggleSwitchChangeEvent} event - Custom change event.
* @group Emits
*/
onChange: _angular_core.OutputEmitterRef<ToggleSwitchChangeEvent>;
/**
* Custom handle template.
* @param {ToggleSwitchHandleTemplateContext} context - handle context.
* @see {@link ToggleSwitchHandleTemplateContext}
* @group Templates
*/
handleTemplate: _angular_core.Signal<TemplateRef<ToggleSwitchHandleTemplateContext> | undefined>;
inputEl: _angular_core.Signal<ElementRef<any>>;
focused: _angular_core.WritableSignal<boolean>;
$checked: _angular_core.Signal<boolean>;
attrRequired: _angular_core.Signal<"" | undefined>;
attrDisabled: _angular_core.Signal<"" | undefined>;
dataP: _angular_core.Signal<string>;
onAfterViewChecked(): void;
onHostClick(event: MouseEvent): void;
onClick(event: Event): void;
onFocus(): void;
onBlur(): void;
getHandleContext(): {
checked: boolean;
};
/**
* @override
*
* @see {@link BaseEditableHolder.writeControlValue}
* Writes the value to the control.
*/
writeControlValue(value: any, setModelValue: (value: any) => void): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleSwitch, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleSwitch, "p-toggleswitch, p-toggle-switch", never, { "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "trueValue": { "alias": "trueValue"; "required": false; "isSignal": true; }; "falseValue": { "alias": "falseValue"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, ["handleTemplate"], never, true, [{ directive: typeof i1.Bind; inputs: {}; outputs: {}; }]>;
}
declare class ToggleSwitchModule {
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleSwitchModule, never>;
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<ToggleSwitchModule, never, [typeof ToggleSwitch, typeof i2.SharedModule], [typeof ToggleSwitch, typeof i2.SharedModule]>;
static ɵinj: _angular_core.ɵɵInjectorDeclaration<ToggleSwitchModule>;
}
export { TOGGLESWITCH_VALUE_ACCESSOR, ToggleSwitch, ToggleSwitchClasses, ToggleSwitchModule, ToggleSwitchStyle };