index.d.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import * as i0 from '@angular/core';
  2. import { InjectionToken, OnDestroy, AfterContentInit, OnChanges, ChangeDetectorRef, ElementRef, EventEmitter, SimpleChanges, Provider } from '@angular/core';
  3. import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors, CheckboxRequiredValidator } from '@angular/forms';
  4. import { FocusMonitor } from '@angular/cdk/a11y';
  5. import { T as ThemePalette } from '../palette.d-BSSFKjO6.js';
  6. import { M as MatCommonModule } from '../common-module.d-C8xzHJDr.js';
  7. import '@angular/cdk/bidi';
  8. /** Default `mat-slide-toggle` options that can be overridden. */
  9. interface MatSlideToggleDefaultOptions {
  10. /** Whether toggle action triggers value changes in slide toggle. */
  11. disableToggleValue?: boolean;
  12. /**
  13. * Default theme color of the slide toggle. This API is supported in M2 themes only,
  14. * it has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/slide-toggle/styling.
  15. *
  16. * For information on applying color variants in M3, see
  17. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  18. */
  19. color?: ThemePalette;
  20. /** Whether to hide the icon inside the slide toggle. */
  21. hideIcon?: boolean;
  22. /** Whether disabled slide toggles should remain interactive. */
  23. disabledInteractive?: boolean;
  24. }
  25. /** Injection token to be used to override the default options for `mat-slide-toggle`. */
  26. declare const MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS: InjectionToken<MatSlideToggleDefaultOptions>;
  27. /**
  28. * @deprecated Will stop being exported.
  29. * @breaking-change 19.0.0
  30. */
  31. declare const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: {
  32. provide: i0.InjectionToken<readonly ControlValueAccessor[]>;
  33. useExisting: i0.Type<any>;
  34. multi: boolean;
  35. };
  36. /** Change event object emitted by a slide toggle. */
  37. declare class MatSlideToggleChange {
  38. /** The source slide toggle of the event. */
  39. source: MatSlideToggle;
  40. /** The new `checked` value of the slide toggle. */
  41. checked: boolean;
  42. constructor(
  43. /** The source slide toggle of the event. */
  44. source: MatSlideToggle,
  45. /** The new `checked` value of the slide toggle. */
  46. checked: boolean);
  47. }
  48. declare class MatSlideToggle implements OnDestroy, AfterContentInit, OnChanges, ControlValueAccessor, Validator {
  49. private _elementRef;
  50. protected _focusMonitor: FocusMonitor;
  51. protected _changeDetectorRef: ChangeDetectorRef;
  52. defaults: MatSlideToggleDefaultOptions;
  53. private _onChange;
  54. private _onTouched;
  55. private _validatorOnChange;
  56. private _uniqueId;
  57. private _checked;
  58. private _createChangeEvent;
  59. /** Unique ID for the label element. */
  60. _labelId: string;
  61. /** Returns the unique id for the visual hidden button. */
  62. get buttonId(): string;
  63. /** Reference to the MDC switch element. */
  64. _switchElement: ElementRef<HTMLElement>;
  65. /** Focuses the slide-toggle. */
  66. focus(): void;
  67. /** Whether noop animations are enabled. */
  68. _noopAnimations: boolean;
  69. /** Whether the slide toggle is currently focused. */
  70. _focused: boolean;
  71. /** Name value will be applied to the input element if present. */
  72. name: string | null;
  73. /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */
  74. id: string;
  75. /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */
  76. labelPosition: 'before' | 'after';
  77. /** Used to set the aria-label attribute on the underlying input element. */
  78. ariaLabel: string | null;
  79. /** Used to set the aria-labelledby attribute on the underlying input element. */
  80. ariaLabelledby: string | null;
  81. /** Used to set the aria-describedby attribute on the underlying input element. */
  82. ariaDescribedby: string;
  83. /** Whether the slide-toggle is required. */
  84. required: boolean;
  85. /**
  86. * Theme color of the slide toggle. This API is supported in M2 themes only,
  87. * it has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/slide-toggle/styling.
  88. *
  89. * For information on applying color variants in M3, see
  90. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  91. */
  92. color: string | undefined;
  93. /** Whether the slide toggle is disabled. */
  94. disabled: boolean;
  95. /** Whether the slide toggle has a ripple. */
  96. disableRipple: boolean;
  97. /** Tabindex of slide toggle. */
  98. tabIndex: number;
  99. /** Whether the slide-toggle element is checked or not. */
  100. get checked(): boolean;
  101. set checked(value: boolean);
  102. /** Whether to hide the icon inside of the slide toggle. */
  103. hideIcon: boolean;
  104. /** Whether the slide toggle should remain interactive when it is disabled. */
  105. disabledInteractive: boolean;
  106. /** An event will be dispatched each time the slide-toggle changes its value. */
  107. readonly change: EventEmitter<MatSlideToggleChange>;
  108. /**
  109. * An event will be dispatched each time the slide-toggle input is toggled.
  110. * This event is always emitted when the user toggles the slide toggle, but this does not mean
  111. * the slide toggle's value has changed.
  112. */
  113. readonly toggleChange: EventEmitter<void>;
  114. /** Returns the unique id for the visual hidden input. */
  115. get inputId(): string;
  116. constructor(...args: unknown[]);
  117. ngAfterContentInit(): void;
  118. ngOnChanges(changes: SimpleChanges): void;
  119. ngOnDestroy(): void;
  120. /** Implemented as part of ControlValueAccessor. */
  121. writeValue(value: any): void;
  122. /** Implemented as part of ControlValueAccessor. */
  123. registerOnChange(fn: any): void;
  124. /** Implemented as part of ControlValueAccessor. */
  125. registerOnTouched(fn: any): void;
  126. /** Implemented as a part of Validator. */
  127. validate(control: AbstractControl<boolean>): ValidationErrors | null;
  128. /** Implemented as a part of Validator. */
  129. registerOnValidatorChange(fn: () => void): void;
  130. /** Implemented as a part of ControlValueAccessor. */
  131. setDisabledState(isDisabled: boolean): void;
  132. /** Toggles the checked state of the slide-toggle. */
  133. toggle(): void;
  134. /**
  135. * Emits a change event on the `change` output. Also notifies the FormControl about the change.
  136. */
  137. protected _emitChangeEvent(): void;
  138. /** Method being called whenever the underlying button is clicked. */
  139. _handleClick(): void;
  140. _getAriaLabelledBy(): string | null;
  141. static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggle, never>;
  142. static ɵcmp: i0.ɵɵComponentDeclaration<MatSlideToggle, "mat-slide-toggle", ["matSlideToggle"], { "name": { "alias": "name"; "required": false; }; "id": { "alias": "id"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; }; "required": { "alias": "required"; "required": false; }; "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "hideIcon": { "alias": "hideIcon"; "required": false; }; "disabledInteractive": { "alias": "disabledInteractive"; "required": false; }; }, { "change": "change"; "toggleChange": "toggleChange"; }, never, ["*"], true, never>;
  143. static ngAcceptInputType_required: unknown;
  144. static ngAcceptInputType_disabled: unknown;
  145. static ngAcceptInputType_disableRipple: unknown;
  146. static ngAcceptInputType_tabIndex: unknown;
  147. static ngAcceptInputType_checked: unknown;
  148. static ngAcceptInputType_hideIcon: unknown;
  149. static ngAcceptInputType_disabledInteractive: unknown;
  150. }
  151. /**
  152. * @deprecated No longer used, `MatCheckbox` implements required validation directly.
  153. * @breaking-change 19.0.0
  154. */
  155. declare const MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR: Provider;
  156. /**
  157. * Validator for Material slide-toggle components with the required attribute in a
  158. * template-driven form. The default validator for required form controls asserts
  159. * that the control value is not undefined but that is not appropriate for a slide-toggle
  160. * where the value is always defined.
  161. *
  162. * Required slide-toggle form controls are valid when checked.
  163. *
  164. * @deprecated No longer used, `MatCheckbox` implements required validation directly.
  165. * @breaking-change 19.0.0
  166. */
  167. declare class MatSlideToggleRequiredValidator extends CheckboxRequiredValidator {
  168. static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggleRequiredValidator, never>;
  169. static ɵdir: i0.ɵɵDirectiveDeclaration<MatSlideToggleRequiredValidator, "mat-slide-toggle[required][formControlName], mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]", never, {}, {}, never, never, true, never>;
  170. }
  171. /**
  172. * @deprecated No longer used, `MatSlideToggle` implements required validation directly.
  173. * @breaking-change 19.0.0
  174. */
  175. declare class _MatSlideToggleRequiredValidatorModule {
  176. static ɵfac: i0.ɵɵFactoryDeclaration<_MatSlideToggleRequiredValidatorModule, never>;
  177. static ɵmod: i0.ɵɵNgModuleDeclaration<_MatSlideToggleRequiredValidatorModule, never, [typeof MatSlideToggleRequiredValidator], [typeof MatSlideToggleRequiredValidator]>;
  178. static ɵinj: i0.ɵɵInjectorDeclaration<_MatSlideToggleRequiredValidatorModule>;
  179. }
  180. declare class MatSlideToggleModule {
  181. static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggleModule, never>;
  182. static ɵmod: i0.ɵɵNgModuleDeclaration<MatSlideToggleModule, never, [typeof MatSlideToggle, typeof MatCommonModule], [typeof MatSlideToggle, typeof MatCommonModule]>;
  183. static ɵinj: i0.ɵɵInjectorDeclaration<MatSlideToggleModule>;
  184. }
  185. export { MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS, MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR, MAT_SLIDE_TOGGLE_VALUE_ACCESSOR, MatSlideToggle, MatSlideToggleChange, MatSlideToggleModule, MatSlideToggleRequiredValidator, _MatSlideToggleRequiredValidatorModule };
  186. export type { MatSlideToggleDefaultOptions };