{"version":3,"file":"legacy-button.mjs","sources":["../../../../../../src/material/legacy-button/button.ts","../../../../../../src/material/legacy-button/button.html","../../../../../../src/material/legacy-button/button-module.ts","../../../../../../src/material/legacy-button/legacy-button_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 */\n\nimport {FocusMonitor, FocusableOption, FocusOrigin} from '@angular/cdk/a11y';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnDestroy,\n ViewChild,\n ViewEncapsulation,\n Optional,\n Inject,\n Input,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport {\n CanColor,\n CanDisable,\n CanDisableRipple,\n MatRipple,\n mixinColor,\n mixinDisabled,\n mixinDisableRipple,\n} from '@angular/material/core';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\n\n/** Default color palette for round buttons (mat-fab and mat-mini-fab) */\nconst DEFAULT_ROUND_BUTTON_COLOR = 'accent';\n\n/**\n * List of classes to add to button instances based on host attributes to\n * style as different variants.\n */\nconst BUTTON_HOST_ATTRIBUTES = [\n 'mat-button',\n 'mat-flat-button',\n 'mat-icon-button',\n 'mat-raised-button',\n 'mat-stroked-button',\n 'mat-mini-fab',\n 'mat-fab',\n];\n\n// Boilerplate for applying mixins to button.\nconst _MatButtonBase = mixinColor(\n mixinDisabled(\n mixinDisableRipple(\n class {\n constructor(public _elementRef: ElementRef) {}\n },\n ),\n ),\n);\n\n/**\n * Material design button.\n * @deprecated Use `MatButton` from `@angular/material/button` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\n@Component({\n selector: `button[mat-button], button[mat-raised-button], button[mat-icon-button],\n button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],\n button[mat-flat-button]`,\n exportAs: 'matButton',\n host: {\n '[attr.disabled]': 'disabled || null',\n '[class._mat-animation-noopable]': '_animationMode === \"NoopAnimations\"',\n // Add a class for disabled button styling instead of the using attribute\n // selector or pseudo-selector. This allows users to create focusable\n // disabled buttons without recreating the styles.\n '[class.mat-button-disabled]': 'disabled',\n 'class': 'mat-focus-indicator',\n },\n templateUrl: 'button.html',\n styleUrls: ['button.css'],\n inputs: ['disabled', 'disableRipple', 'color'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatLegacyButton\n extends _MatButtonBase\n implements AfterViewInit, OnDestroy, CanDisable, CanColor, CanDisableRipple, FocusableOption\n{\n /** Whether the button is round. */\n readonly isRoundButton: boolean = this._hasHostAttributes('mat-fab', 'mat-mini-fab');\n\n /** Whether the button is icon button. */\n readonly isIconButton: boolean = this._hasHostAttributes('mat-icon-button');\n\n /** Reference to the MatRipple instance of the button. */\n @ViewChild(MatRipple) ripple: MatRipple;\n\n constructor(\n elementRef: ElementRef,\n private _focusMonitor: FocusMonitor,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode: string,\n ) {\n super(elementRef);\n\n // For each of the variant selectors that is present in the button's host\n // attributes, add the correct corresponding class.\n for (const attr of BUTTON_HOST_ATTRIBUTES) {\n if (this._hasHostAttributes(attr)) {\n (this._getHostElement() as HTMLElement).classList.add(attr);\n }\n }\n\n // Add a class that applies to all buttons. This makes it easier to target if somebody\n // wants to target all Material buttons. We do it here rather than `host` to ensure that\n // the class is applied to derived classes.\n elementRef.nativeElement.classList.add('mat-button-base');\n\n if (this.isRoundButton) {\n this.color = DEFAULT_ROUND_BUTTON_COLOR;\n }\n }\n\n ngAfterViewInit() {\n this._focusMonitor.monitor(this._elementRef, true);\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Focuses the button. */\n focus(origin?: FocusOrigin, options?: FocusOptions): void {\n if (origin) {\n this._focusMonitor.focusVia(this._getHostElement(), origin, options);\n } else {\n this._getHostElement().focus(options);\n }\n }\n\n _getHostElement() {\n return this._elementRef.nativeElement;\n }\n\n _isRippleDisabled() {\n return this.disableRipple || this.disabled;\n }\n\n /** Gets whether the button has one of the given attributes. */\n _hasHostAttributes(...attributes: string[]) {\n return attributes.some(attribute => this._getHostElement().hasAttribute(attribute));\n }\n}\n\n/**\n * Material design anchor button.\n * @deprecated Use `MatAnchor` from `@angular/material/button` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\n@Component({\n selector: `a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab],\n a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]`,\n exportAs: 'matButton, matAnchor',\n host: {\n // Note that we ignore the user-specified tabindex when it's disabled for\n // consistency with the `mat-button` applied on native buttons where even\n // though they have an index, they're not tabbable.\n '[attr.tabindex]': 'disabled ? -1 : tabIndex',\n '[attr.disabled]': 'disabled || null',\n '[attr.aria-disabled]': 'disabled.toString()',\n '[class._mat-animation-noopable]': '_animationMode === \"NoopAnimations\"',\n '[class.mat-button-disabled]': 'disabled',\n 'class': 'mat-focus-indicator',\n },\n inputs: ['disabled', 'disableRipple', 'color'],\n templateUrl: 'button.html',\n styleUrls: ['button.css'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatLegacyAnchor extends MatLegacyButton implements AfterViewInit, OnDestroy {\n /** Tabindex of the button. */\n @Input() tabIndex: number;\n\n constructor(\n focusMonitor: FocusMonitor,\n elementRef: ElementRef,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode: string,\n /** @breaking-change 14.0.0 _ngZone will be required. */\n @Optional() private _ngZone?: NgZone,\n ) {\n super(elementRef, focusMonitor, animationMode);\n }\n\n override ngAfterViewInit(): void {\n super.ngAfterViewInit();\n\n /** @breaking-change 14.0.0 _ngZone will be required. */\n if (this._ngZone) {\n this._ngZone.runOutsideAngular(() => {\n this._elementRef.nativeElement.addEventListener('click', this._haltDisabledEvents);\n });\n } else {\n this._elementRef.nativeElement.addEventListener('click', this._haltDisabledEvents);\n }\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this._elementRef.nativeElement.removeEventListener('click', this._haltDisabledEvents);\n }\n\n _haltDisabledEvents = (event: Event): void => {\n // A disabled button shouldn't apply any actions\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n}\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 {NgModule} from '@angular/core';\nimport {MatCommonModule, MatRippleModule} from '@angular/material/core';\nimport {MatLegacyAnchor, MatLegacyButton} from './button';\n\n/**\n * @deprecated Use `MatButtonModule` from `@angular/material/button` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\n@NgModule({\n imports: [MatRippleModule, MatCommonModule],\n exports: [MatLegacyButton, MatLegacyAnchor, MatCommonModule],\n declarations: [MatLegacyButton, MatLegacyAnchor],\n})\nexport class MatLegacyButtonModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiCA;AACA,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;AAGG;AACH,MAAM,sBAAsB,GAAG;IAC7B,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,cAAc;IACd,SAAS;CACV,CAAC;AAEF;AACA,MAAM,cAAc,GAAG,UAAU,CAC/B,aAAa,CACX,kBAAkB,CAChB,MAAA;AACE,IAAA,WAAA,CAAmB,WAAuB,EAAA;QAAvB,IAAW,CAAA,WAAA,GAAX,WAAW,CAAY;KAAI;CAC/C,CACF,CACF,CACF,CAAC;AAEF;;;;AAIG;AAqBG,MAAO,eACX,SAAQ,cAAc,CAAA;AAYtB,IAAA,WAAA,CACE,UAAsB,EACd,aAA2B,EACe,cAAsB,EAAA;QAExE,KAAK,CAAC,UAA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