{"version":3,"file":"legacy-slide-toggle.mjs","sources":["../../../../../../src/material/legacy-slide-toggle/slide-toggle-config.ts","../../../../../../src/material/legacy-slide-toggle/slide-toggle.ts","../../../../../../src/material/legacy-slide-toggle/slide-toggle.html","../../../../../../src/material/legacy-slide-toggle/slide-toggle-module.ts","../../../../../../src/material/legacy-slide-toggle/legacy-slide-toggle_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {InjectionToken} from '@angular/core';\nimport {ThemePalette} from '@angular/material/core';\n\n/**\n * Default `mat-slide-toggle` options that can be overridden.\n * @deprecated Use `MatSlideToggleDefaultOptions` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport interface MatLegacySlideToggleDefaultOptions {\n /** Whether toggle action triggers value changes in slide toggle. */\n disableToggleValue?: boolean;\n\n /** Default color for slide toggles. */\n color?: ThemePalette;\n}\n\n/**\n * Injection token to be used to override the default options for `mat-slide-toggle`\n * @deprecated Use `MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport const MAT_LEGACY_SLIDE_TOGGLE_DEFAULT_OPTIONS =\n new InjectionToken('mat-slide-toggle-default-options', {\n providedIn: 'root',\n factory: () => ({disableToggleValue: false}),\n });\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';\nimport {\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n forwardRef,\n Inject,\n Optional,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\nimport {\n MAT_LEGACY_SLIDE_TOGGLE_DEFAULT_OPTIONS,\n MatLegacySlideToggleDefaultOptions,\n} from './slide-toggle-config';\nimport {_MatSlideToggleBase} from '@angular/material/slide-toggle';\n\n/**\n * @docs-private\n * @deprecated Use `MAT_SLIDE_TOGGLE_VALUE_ACCESSOR` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport const MAT_LEGACY_SLIDE_TOGGLE_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatLegacySlideToggle),\n multi: true,\n};\n\n/**\n * Change event object emitted by a slide toggle.\n * @deprecated Use `MatSlideToggleChange` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport class MatLegacySlideToggleChange {\n constructor(\n /** The source slide toggle of the event. */\n public source: MatLegacySlideToggle,\n /** The new `checked` value of the slide toggle. */\n public checked: boolean,\n ) {}\n}\n\n/**\n * Represents a slidable \"switch\" toggle that can be moved between on and off.\n * @deprecated Use `MatSlideToggle` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\n@Component({\n selector: 'mat-slide-toggle',\n exportAs: 'matSlideToggle',\n host: {\n 'class': 'mat-slide-toggle',\n '[id]': 'id',\n // Needs to be removed since it causes some a11y issues (see #21266).\n '[attr.tabindex]': 'null',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[attr.name]': 'null',\n '[class.mat-checked]': 'checked',\n '[class.mat-disabled]': 'disabled',\n '[class.mat-slide-toggle-label-before]': 'labelPosition == \"before\"',\n '[class._mat-animation-noopable]': '_noopAnimations',\n },\n templateUrl: 'slide-toggle.html',\n styleUrls: ['slide-toggle.css'],\n providers: [MAT_LEGACY_SLIDE_TOGGLE_VALUE_ACCESSOR],\n inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatLegacySlideToggle extends _MatSlideToggleBase {\n /** Reference to the underlying input element. */\n @ViewChild('input') _inputElement: ElementRef;\n\n constructor(\n elementRef: ElementRef,\n focusMonitor: FocusMonitor,\n changeDetectorRef: ChangeDetectorRef,\n @Attribute('tabindex') tabIndex: string,\n @Inject(MAT_LEGACY_SLIDE_TOGGLE_DEFAULT_OPTIONS)\n defaults: MatLegacySlideToggleDefaultOptions,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string,\n ) {\n super(\n elementRef,\n focusMonitor,\n changeDetectorRef,\n tabIndex,\n defaults,\n animationMode,\n 'mat-slide-toggle-',\n );\n }\n\n protected _createChangeEvent(isChecked: boolean) {\n return new MatLegacySlideToggleChange(this, isChecked);\n }\n\n /** Method being called whenever the underlying input emits a change event. */\n _onChangeEvent(event: Event) {\n // We always have to stop propagation on the change event.\n // Otherwise the change event, from the input element, will bubble up and\n // emit its event object to the component's `change` output.\n event.stopPropagation();\n this.toggleChange.emit();\n\n // When the slide toggle's config disables toggle change event by setting\n // `disableToggleValue: true`, the slide toggle's value does not change, and the\n // checked state of the underlying input needs to be changed back.\n if (this.defaults.disableToggleValue) {\n this._inputElement.nativeElement.checked = this.checked;\n return;\n }\n\n // Sync the value from the underlying input element with the component instance.\n this.checked = this._inputElement.nativeElement.checked;\n\n // Emit our custom change event only if the underlying input emitted one. This ensures that\n // there is no change event, when the checked state changes programmatically.\n this._emitChangeEvent();\n }\n\n /** Method being called whenever the slide-toggle has been clicked. */\n _onInputClick(event: Event) {\n // We have to stop propagation for click events on the visual hidden input element.\n // By default, when a user clicks on a label element, a generated click event will be\n // dispatched on the associated input element. Since we are using a label element as our\n // root container, the click event on the `slide-toggle` will be executed twice.\n // The real click event will bubble up, and the generated click event also tries to bubble up.\n // This will lead to multiple click events.\n // Preventing bubbling for the second event will solve that issue.\n event.stopPropagation();\n }\n\n /** Focuses the slide-toggle. */\n focus(options?: FocusOptions, origin?: FocusOrigin): void {\n if (origin) {\n this._focusMonitor.focusVia(this._inputElement, origin, options);\n } else {\n this._inputElement.nativeElement.focus(options);\n }\n }\n\n /** Method being called whenever the label text changes. */\n _onLabelTextChange() {\n // Since the event of the `cdkObserveContent` directive runs outside of the zone, the\n // slide-toggle component will be only marked for check, but no actual change detection runs\n // automatically. Instead of going back into the zone in order to trigger a change detection\n // which causes *all* components to be checked (if explicitly marked or not using OnPush),\n // we only trigger an explicit change detection for the slide-toggle view and its children.\n this._changeDetectorRef.detectChanges();\n }\n}\n","\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ObserversModule} from '@angular/cdk/observers';\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule, MatRippleModule} from '@angular/material/core';\nimport {MatLegacySlideToggle} from './slide-toggle';\nimport {_MatSlideToggleRequiredValidatorModule} from '@angular/material/slide-toggle';\n\n/**\n * @deprecated Use `MatSlideToggleModule` from `@angular/material/slide-toggle` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\n@NgModule({\n imports: [\n _MatSlideToggleRequiredValidatorModule,\n MatRippleModule,\n MatCommonModule,\n ObserversModule,\n ],\n exports: [_MatSlideToggleRequiredValidatorModule, MatLegacySlideToggle, MatCommonModule],\n declarations: [MatLegacySlideToggle],\n})\nexport class MatLegacySlideToggleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAuBA;;;;AAIG;MACU,uCAAuC,GAClD,IAAI,cAAc,CAAqC,kCAAkC,EAAE;AACzF,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAC,C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