@angular/material 13.2.5 → 13.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/checkbox/_checkbox-theme.scss +0 -6
  2. package/dialog/dialog-config.d.ts +2 -0
  3. package/dialog/dialog-container.d.ts +1 -4
  4. package/dialog/dialog.d.ts +12 -6
  5. package/dialog/testing/dialog-opener.d.ts +33 -0
  6. package/dialog/testing/public-api.d.ts +1 -0
  7. package/esm2020/bottom-sheet/bottom-sheet-animations.mjs +10 -4
  8. package/esm2020/button/button.mjs +3 -3
  9. package/esm2020/core/version.mjs +1 -1
  10. package/esm2020/dialog/dialog-animations.mjs +10 -4
  11. package/esm2020/dialog/dialog-config.mjs +3 -1
  12. package/esm2020/dialog/dialog-container.mjs +14 -14
  13. package/esm2020/dialog/dialog.mjs +14 -30
  14. package/esm2020/dialog/testing/dialog-opener.mjs +67 -0
  15. package/esm2020/dialog/testing/public-api.mjs +2 -1
  16. package/esm2020/expansion/expansion-panel.mjs +3 -3
  17. package/esm2020/select/select.mjs +12 -2
  18. package/esm2020/slide-toggle/slide-toggle.mjs +3 -2
  19. package/esm2020/tooltip/testing/tooltip-harness.mjs +12 -7
  20. package/esm2020/tooltip/tooltip.mjs +90 -38
  21. package/fesm2015/bottom-sheet.mjs +9 -3
  22. package/fesm2015/bottom-sheet.mjs.map +1 -1
  23. package/fesm2015/button.mjs +2 -2
  24. package/fesm2015/button.mjs.map +1 -1
  25. package/fesm2015/core.mjs +1 -1
  26. package/fesm2015/core.mjs.map +1 -1
  27. package/fesm2015/dialog/testing.mjs +65 -2
  28. package/fesm2015/dialog/testing.mjs.map +1 -1
  29. package/fesm2015/dialog.mjs +37 -45
  30. package/fesm2015/dialog.mjs.map +1 -1
  31. package/fesm2015/expansion.mjs +2 -2
  32. package/fesm2015/expansion.mjs.map +1 -1
  33. package/fesm2015/select.mjs +11 -1
  34. package/fesm2015/select.mjs.map +1 -1
  35. package/fesm2015/slide-toggle.mjs +2 -1
  36. package/fesm2015/slide-toggle.mjs.map +1 -1
  37. package/fesm2015/tooltip/testing.mjs +11 -8
  38. package/fesm2015/tooltip/testing.mjs.map +1 -1
  39. package/fesm2015/tooltip.mjs +112 -62
  40. package/fesm2015/tooltip.mjs.map +1 -1
  41. package/fesm2020/bottom-sheet.mjs +9 -3
  42. package/fesm2020/bottom-sheet.mjs.map +1 -1
  43. package/fesm2020/button.mjs +2 -2
  44. package/fesm2020/button.mjs.map +1 -1
  45. package/fesm2020/core.mjs +1 -1
  46. package/fesm2020/core.mjs.map +1 -1
  47. package/fesm2020/dialog/testing.mjs +65 -1
  48. package/fesm2020/dialog/testing.mjs.map +1 -1
  49. package/fesm2020/dialog.mjs +37 -45
  50. package/fesm2020/dialog.mjs.map +1 -1
  51. package/fesm2020/expansion.mjs +2 -2
  52. package/fesm2020/expansion.mjs.map +1 -1
  53. package/fesm2020/select.mjs +11 -1
  54. package/fesm2020/select.mjs.map +1 -1
  55. package/fesm2020/slide-toggle.mjs +2 -1
  56. package/fesm2020/slide-toggle.mjs.map +1 -1
  57. package/fesm2020/tooltip/testing.mjs +11 -6
  58. package/fesm2020/tooltip/testing.mjs.map +1 -1
  59. package/fesm2020/tooltip.mjs +107 -54
  60. package/fesm2020/tooltip.mjs.map +1 -1
  61. package/package.json +2 -2
  62. package/prebuilt-themes/deeppurple-amber.css +1 -1
  63. package/prebuilt-themes/indigo-pink.css +1 -1
  64. package/prebuilt-themes/pink-bluegrey.css +1 -1
  65. package/prebuilt-themes/purple-green.css +1 -1
  66. package/schematics/ng-add/index.js +1 -1
  67. package/schematics/ng-add/index.mjs +1 -1
  68. package/select/select.d.ts +5 -0
  69. package/tooltip/testing/tooltip-harness.d.ts +6 -0
  70. package/tooltip/tooltip.d.ts +23 -7
@@ -1 +1 @@
1
- {"version":3,"file":"slide-toggle.mjs","sources":["../../../../../../src/material/slide-toggle/slide-toggle-config.ts","../../../../../../src/material/slide-toggle/slide-toggle.ts","../../../../../../src/material/slide-toggle/slide-toggle.html","../../../../../../src/material/slide-toggle/slide-toggle-required-validator.ts","../../../../../../src/material/slide-toggle/slide-toggle-module.ts","../../../../../../src/material/slide-toggle/public-api.ts","../../../../../../src/material/slide-toggle/index.ts","../../../../../../src/material/slide-toggle/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/** Default `mat-slide-toggle` options that can be overridden. */\nexport interface MatSlideToggleDefaultOptions {\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/** Injection token to be used to override the default options for `mat-slide-toggle`. */\nexport const MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = new InjectionToken<MatSlideToggleDefaultOptions>(\n 'mat-slide-toggle-default-options',\n {\n providedIn: 'root',\n factory: () => ({disableToggleValue: false}),\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 {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n ViewEncapsulation,\n Optional,\n Inject,\n} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {\n CanColor,\n CanDisable,\n CanDisableRipple,\n HasTabIndex,\n mixinColor,\n mixinDisabled,\n mixinDisableRipple,\n mixinTabIndex,\n} from '@angular/material/core';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\nimport {\n MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,\n MatSlideToggleDefaultOptions,\n} from './slide-toggle-config';\n\n// Increasing integer for generating unique ids for slide-toggle components.\nlet nextUniqueId = 0;\n\n/** @docs-private */\nexport const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatSlideToggle),\n multi: true,\n};\n\n/** Change event object emitted by a MatSlideToggle. */\nexport class MatSlideToggleChange {\n constructor(\n /** The source MatSlideToggle of the event. */\n public source: MatSlideToggle,\n /** The new `checked` value of the MatSlideToggle. */\n public checked: boolean,\n ) {}\n}\n\n// Boilerplate for applying mixins to MatSlideToggle.\n/** @docs-private */\nconst _MatSlideToggleBase = mixinTabIndex(\n mixinColor(\n mixinDisableRipple(\n mixinDisabled(\n class {\n constructor(public _elementRef: ElementRef) {}\n },\n ),\n ),\n ),\n);\n\n/** Represents a slidable \"switch\" toggle that can be moved between on and off. */\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 '[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_SLIDE_TOGGLE_VALUE_ACCESSOR],\n inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatSlideToggle\n extends _MatSlideToggleBase\n implements\n OnDestroy,\n AfterContentInit,\n ControlValueAccessor,\n CanDisable,\n CanColor,\n HasTabIndex,\n CanDisableRipple\n{\n private _onChange = (_: any) => {};\n private _onTouched = () => {};\n\n private _uniqueId: string = `mat-slide-toggle-${++nextUniqueId}`;\n private _required: boolean = false;\n private _checked: boolean = false;\n\n /** Whether noop animations are enabled. */\n _noopAnimations: boolean;\n\n /** Reference to the thumb HTMLElement. */\n @ViewChild('thumbContainer') _thumbEl: ElementRef;\n\n /** Reference to the thumb bar HTMLElement. */\n @ViewChild('toggleBar') _thumbBarEl: ElementRef;\n\n /** Name value will be applied to the input element if present. */\n @Input() name: string | null = null;\n\n /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */\n @Input() id: string = this._uniqueId;\n\n /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /** Used to set the aria-label attribute on the underlying input element. */\n @Input('aria-label') ariaLabel: string | null = null;\n\n /** Used to set the aria-labelledby attribute on the underlying input element. */\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n\n /** Used to set the aria-describedby attribute on the underlying input element. */\n @Input('aria-describedby') ariaDescribedby: string;\n\n /** Whether the slide-toggle is required. */\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: BooleanInput) {\n this._required = coerceBooleanProperty(value);\n }\n\n /** Whether the slide-toggle element is checked or not. */\n @Input()\n get checked(): boolean {\n return this._checked;\n }\n set checked(value: BooleanInput) {\n this._checked = coerceBooleanProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n /** An event will be dispatched each time the slide-toggle changes its value. */\n @Output() readonly change: EventEmitter<MatSlideToggleChange> =\n new EventEmitter<MatSlideToggleChange>();\n\n /**\n * An event will be dispatched each time the slide-toggle input is toggled.\n * This event is always emitted when the user toggles the slide toggle, but this does not mean\n * the slide toggle's value has changed.\n */\n @Output() readonly toggleChange: EventEmitter<void> = new EventEmitter<void>();\n\n /** Returns the unique id for the visual hidden input. */\n get inputId(): string {\n return `${this.id || this._uniqueId}-input`;\n }\n\n /** Reference to the underlying input element. */\n @ViewChild('input') _inputElement: ElementRef<HTMLInputElement>;\n\n constructor(\n elementRef: ElementRef,\n private _focusMonitor: FocusMonitor,\n private _changeDetectorRef: ChangeDetectorRef,\n @Attribute('tabindex') tabIndex: string,\n @Inject(MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS)\n public defaults: MatSlideToggleDefaultOptions,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string,\n ) {\n super(elementRef);\n this.tabIndex = parseInt(tabIndex) || 0;\n this.color = this.defaultColor = defaults.color || 'accent';\n this._noopAnimations = animationMode === 'NoopAnimations';\n }\n\n ngAfterContentInit() {\n this._focusMonitor.monitor(this._elementRef, true).subscribe(focusOrigin => {\n if (!focusOrigin) {\n // When a focused element becomes disabled, the browser *immediately* fires a blur event.\n // Angular does not expect events to be raised during change detection, so any state\n // change (such as a form control's 'ng-touched') will cause a changed-after-checked\n // error. See https://github.com/angular/angular/issues/17793. To work around this,\n // we defer telling the form control it has been touched until the next tick.\n Promise.resolve().then(() => this._onTouched());\n }\n });\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\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 /** Implemented as part of ControlValueAccessor. */\n writeValue(value: any): void {\n this.checked = !!value;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /** Implemented as a part of ControlValueAccessor. */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this._changeDetectorRef.markForCheck();\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 /** Toggles the checked state of the slide-toggle. */\n toggle(): void {\n this.checked = !this.checked;\n this._onChange(this.checked);\n }\n\n /**\n * Emits a change event on the `change` output. Also notifies the FormControl about the change.\n */\n private _emitChangeEvent() {\n this._onChange(this.checked);\n this.change.emit(new MatSlideToggleChange(this, this.checked));\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","<label [attr.for]=\"inputId\" class=\"mat-slide-toggle-label\" #label>\n <span #toggleBar class=\"mat-slide-toggle-bar\"\n [class.mat-slide-toggle-bar-no-side-margin]=\"!labelContent.textContent || !labelContent.textContent.trim()\">\n\n <input #input class=\"mat-slide-toggle-input cdk-visually-hidden\" type=\"checkbox\"\n role=\"switch\"\n [id]=\"inputId\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [attr.name]=\"name\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n (change)=\"_onChangeEvent($event)\"\n (click)=\"_onInputClick($event)\">\n\n <span class=\"mat-slide-toggle-thumb-container\" #thumbContainer>\n <span class=\"mat-slide-toggle-thumb\"></span>\n <span class=\"mat-slide-toggle-ripple mat-focus-indicator\" mat-ripple\n [matRippleTrigger]=\"label\"\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleCentered]=\"true\"\n [matRippleRadius]=\"20\"\n [matRippleAnimation]=\"{enterDuration: _noopAnimations ? 0 : 150}\">\n\n <span class=\"mat-ripple-element mat-slide-toggle-persistent-ripple\"></span>\n </span>\n </span>\n\n </span>\n\n <span class=\"mat-slide-toggle-content\" #labelContent (cdkObserveContent)=\"_onLabelTextChange()\">\n <!-- Add an invisible span so JAWS can read the label -->\n <span style=\"display:none\">&nbsp;</span>\n <ng-content></ng-content>\n </span>\n</label>\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 {Directive, forwardRef, Provider} from '@angular/core';\nimport {CheckboxRequiredValidator, NG_VALIDATORS} from '@angular/forms';\n\nexport const MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR: Provider = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => MatSlideToggleRequiredValidator),\n multi: true,\n};\n\n/**\n * Validator for Material slide-toggle components with the required attribute in a\n * template-driven form. The default validator for required form controls asserts\n * that the control value is not undefined but that is not appropriate for a slide-toggle\n * where the value is always defined.\n *\n * Required slide-toggle form controls are valid when checked.\n */\n@Directive({\n selector: `mat-slide-toggle[required][formControlName],\n mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]`,\n providers: [MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR],\n})\nexport class MatSlideToggleRequiredValidator extends CheckboxRequiredValidator {}\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 {MatSlideToggle} from './slide-toggle';\nimport {MatSlideToggleRequiredValidator} from './slide-toggle-required-validator';\n\n/** This module is used by both original and MDC-based slide-toggle implementations. */\n@NgModule({\n exports: [MatSlideToggleRequiredValidator],\n declarations: [MatSlideToggleRequiredValidator],\n})\nexport class _MatSlideToggleRequiredValidatorModule {}\n\n@NgModule({\n imports: [\n _MatSlideToggleRequiredValidatorModule,\n MatRippleModule,\n MatCommonModule,\n ObserversModule,\n ],\n exports: [_MatSlideToggleRequiredValidatorModule, MatSlideToggle, MatCommonModule],\n declarations: [MatSlideToggle],\n})\nexport class MatSlideToggleModule {}\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\nexport * from './slide-toggle-module';\nexport * from './slide-toggle';\nexport * from './slide-toggle-config';\nexport * from './slide-toggle-required-validator';\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\nexport * from './public-api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAmBA;MACa,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC,EAClC;IACE,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAC,CAAC;CAC7C;;ACmBH;AACA,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ErLpB;;;;;;;MAWa,mCAAmC,GAAa;IAC3D,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,MAAM,+BAA+B,CAAC;IAC9D,KAAK,EAAE,IAAI;EACX;AAEF;;;;;;;;MAaa,wCAAwC,yBAAyB;;4HAAjE,+BAA+B;gHAA/B,+BAA+B,kKAF/B,CAAC,mCAAmC,CAAC;2FAErC,+BAA+B;kBAL3C,SAAS;mBAAC;oBACT,QAAQ,EAAE;0FAC8E;oBACxF,SAAS,EAAE,CAAC,mCAAmC,CAAC;iBACjD;;;AC7BD;;;;;;;AAcA;MAKa,sCAAsC;;mIAAtC,sCAAsC;oIAAtC,sCAAsC,iBAFlC,+BAA+B,aADpC,+BAA+B;oIAG9B,sCAAsC;2FAAtC,sCAAsC;kBAJlD,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,+BAA+B,CAAC;oBAC1C,YAAY,EAAE,CAAC,+BAA+B,CAAC;iBAChD;;MAaY,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAFhB,cAAc,aAVlB,sCAAsC,EAK/C,eAAe;QACf,eAAe;QACf,eAAe,aAPN,sCAAsC,EASC,cAAc,EAAE,eAAe;kHAGtE,oBAAoB,YATtB;YACP,sCAAsC;YACtC,eAAe;YACf,eAAe;YACf,eAAe;SAChB,EARU,sCAAsC,EASiB,eAAe;2FAGtE,oBAAoB;kBAVhC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,sCAAsC;wBACtC,eAAe;wBACf,eAAe;wBACf,eAAe;qBAChB;oBACD,OAAO,EAAE,CAAC,sCAAsC,EAAE,cAAc,EAAE,eAAe,CAAC;oBAClF,YAAY,EAAE,CAAC,cAAc,CAAC;iBAC/B;;;AC9BD;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"slide-toggle.mjs","sources":["../../../../../../src/material/slide-toggle/slide-toggle-config.ts","../../../../../../src/material/slide-toggle/slide-toggle.ts","../../../../../../src/material/slide-toggle/slide-toggle.html","../../../../../../src/material/slide-toggle/slide-toggle-required-validator.ts","../../../../../../src/material/slide-toggle/slide-toggle-module.ts","../../../../../../src/material/slide-toggle/public-api.ts","../../../../../../src/material/slide-toggle/index.ts","../../../../../../src/material/slide-toggle/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/** Default `mat-slide-toggle` options that can be overridden. */\nexport interface MatSlideToggleDefaultOptions {\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/** Injection token to be used to override the default options for `mat-slide-toggle`. */\nexport const MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS = new InjectionToken<MatSlideToggleDefaultOptions>(\n 'mat-slide-toggle-default-options',\n {\n providedIn: 'root',\n factory: () => ({disableToggleValue: false}),\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 {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n ViewEncapsulation,\n Optional,\n Inject,\n} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {\n CanColor,\n CanDisable,\n CanDisableRipple,\n HasTabIndex,\n mixinColor,\n mixinDisabled,\n mixinDisableRipple,\n mixinTabIndex,\n} from '@angular/material/core';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\nimport {\n MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,\n MatSlideToggleDefaultOptions,\n} from './slide-toggle-config';\n\n// Increasing integer for generating unique ids for slide-toggle components.\nlet nextUniqueId = 0;\n\n/** @docs-private */\nexport const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatSlideToggle),\n multi: true,\n};\n\n/** Change event object emitted by a MatSlideToggle. */\nexport class MatSlideToggleChange {\n constructor(\n /** The source MatSlideToggle of the event. */\n public source: MatSlideToggle,\n /** The new `checked` value of the MatSlideToggle. */\n public checked: boolean,\n ) {}\n}\n\n// Boilerplate for applying mixins to MatSlideToggle.\n/** @docs-private */\nconst _MatSlideToggleBase = mixinTabIndex(\n mixinColor(\n mixinDisableRipple(\n mixinDisabled(\n class {\n constructor(public _elementRef: ElementRef) {}\n },\n ),\n ),\n ),\n);\n\n/** Represents a slidable \"switch\" toggle that can be moved between on and off. */\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_SLIDE_TOGGLE_VALUE_ACCESSOR],\n inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatSlideToggle\n extends _MatSlideToggleBase\n implements\n OnDestroy,\n AfterContentInit,\n ControlValueAccessor,\n CanDisable,\n CanColor,\n HasTabIndex,\n CanDisableRipple\n{\n private _onChange = (_: any) => {};\n private _onTouched = () => {};\n\n private _uniqueId: string = `mat-slide-toggle-${++nextUniqueId}`;\n private _required: boolean = false;\n private _checked: boolean = false;\n\n /** Whether noop animations are enabled. */\n _noopAnimations: boolean;\n\n /** Reference to the thumb HTMLElement. */\n @ViewChild('thumbContainer') _thumbEl: ElementRef;\n\n /** Reference to the thumb bar HTMLElement. */\n @ViewChild('toggleBar') _thumbBarEl: ElementRef;\n\n /** Name value will be applied to the input element if present. */\n @Input() name: string | null = null;\n\n /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */\n @Input() id: string = this._uniqueId;\n\n /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /** Used to set the aria-label attribute on the underlying input element. */\n @Input('aria-label') ariaLabel: string | null = null;\n\n /** Used to set the aria-labelledby attribute on the underlying input element. */\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n\n /** Used to set the aria-describedby attribute on the underlying input element. */\n @Input('aria-describedby') ariaDescribedby: string;\n\n /** Whether the slide-toggle is required. */\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: BooleanInput) {\n this._required = coerceBooleanProperty(value);\n }\n\n /** Whether the slide-toggle element is checked or not. */\n @Input()\n get checked(): boolean {\n return this._checked;\n }\n set checked(value: BooleanInput) {\n this._checked = coerceBooleanProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n /** An event will be dispatched each time the slide-toggle changes its value. */\n @Output() readonly change: EventEmitter<MatSlideToggleChange> =\n new EventEmitter<MatSlideToggleChange>();\n\n /**\n * An event will be dispatched each time the slide-toggle input is toggled.\n * This event is always emitted when the user toggles the slide toggle, but this does not mean\n * the slide toggle's value has changed.\n */\n @Output() readonly toggleChange: EventEmitter<void> = new EventEmitter<void>();\n\n /** Returns the unique id for the visual hidden input. */\n get inputId(): string {\n return `${this.id || this._uniqueId}-input`;\n }\n\n /** Reference to the underlying input element. */\n @ViewChild('input') _inputElement: ElementRef<HTMLInputElement>;\n\n constructor(\n elementRef: ElementRef,\n private _focusMonitor: FocusMonitor,\n private _changeDetectorRef: ChangeDetectorRef,\n @Attribute('tabindex') tabIndex: string,\n @Inject(MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS)\n public defaults: MatSlideToggleDefaultOptions,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string,\n ) {\n super(elementRef);\n this.tabIndex = parseInt(tabIndex) || 0;\n this.color = this.defaultColor = defaults.color || 'accent';\n this._noopAnimations = animationMode === 'NoopAnimations';\n }\n\n ngAfterContentInit() {\n this._focusMonitor.monitor(this._elementRef, true).subscribe(focusOrigin => {\n if (!focusOrigin) {\n // When a focused element becomes disabled, the browser *immediately* fires a blur event.\n // Angular does not expect events to be raised during change detection, so any state\n // change (such as a form control's 'ng-touched') will cause a changed-after-checked\n // error. See https://github.com/angular/angular/issues/17793. To work around this,\n // we defer telling the form control it has been touched until the next tick.\n Promise.resolve().then(() => this._onTouched());\n }\n });\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\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 /** Implemented as part of ControlValueAccessor. */\n writeValue(value: any): void {\n this.checked = !!value;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /** Implemented as a part of ControlValueAccessor. */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this._changeDetectorRef.markForCheck();\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 /** Toggles the checked state of the slide-toggle. */\n toggle(): void {\n this.checked = !this.checked;\n this._onChange(this.checked);\n }\n\n /**\n * Emits a change event on the `change` output. Also notifies the FormControl about the change.\n */\n private _emitChangeEvent() {\n this._onChange(this.checked);\n this.change.emit(new MatSlideToggleChange(this, this.checked));\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","<label [attr.for]=\"inputId\" class=\"mat-slide-toggle-label\" #label>\n <span #toggleBar class=\"mat-slide-toggle-bar\"\n [class.mat-slide-toggle-bar-no-side-margin]=\"!labelContent.textContent || !labelContent.textContent.trim()\">\n\n <input #input class=\"mat-slide-toggle-input cdk-visually-hidden\" type=\"checkbox\"\n role=\"switch\"\n [id]=\"inputId\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [attr.name]=\"name\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n (change)=\"_onChangeEvent($event)\"\n (click)=\"_onInputClick($event)\">\n\n <span class=\"mat-slide-toggle-thumb-container\" #thumbContainer>\n <span class=\"mat-slide-toggle-thumb\"></span>\n <span class=\"mat-slide-toggle-ripple mat-focus-indicator\" mat-ripple\n [matRippleTrigger]=\"label\"\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleCentered]=\"true\"\n [matRippleRadius]=\"20\"\n [matRippleAnimation]=\"{enterDuration: _noopAnimations ? 0 : 150}\">\n\n <span class=\"mat-ripple-element mat-slide-toggle-persistent-ripple\"></span>\n </span>\n </span>\n\n </span>\n\n <span class=\"mat-slide-toggle-content\" #labelContent (cdkObserveContent)=\"_onLabelTextChange()\">\n <!-- Add an invisible span so JAWS can read the label -->\n <span style=\"display:none\">&nbsp;</span>\n <ng-content></ng-content>\n </span>\n</label>\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 {Directive, forwardRef, Provider} from '@angular/core';\nimport {CheckboxRequiredValidator, NG_VALIDATORS} from '@angular/forms';\n\nexport const MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR: Provider = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => MatSlideToggleRequiredValidator),\n multi: true,\n};\n\n/**\n * Validator for Material slide-toggle components with the required attribute in a\n * template-driven form. The default validator for required form controls asserts\n * that the control value is not undefined but that is not appropriate for a slide-toggle\n * where the value is always defined.\n *\n * Required slide-toggle form controls are valid when checked.\n */\n@Directive({\n selector: `mat-slide-toggle[required][formControlName],\n mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]`,\n providers: [MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR],\n})\nexport class MatSlideToggleRequiredValidator extends CheckboxRequiredValidator {}\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 {MatSlideToggle} from './slide-toggle';\nimport {MatSlideToggleRequiredValidator} from './slide-toggle-required-validator';\n\n/** This module is used by both original and MDC-based slide-toggle implementations. */\n@NgModule({\n exports: [MatSlideToggleRequiredValidator],\n declarations: [MatSlideToggleRequiredValidator],\n})\nexport class _MatSlideToggleRequiredValidatorModule {}\n\n@NgModule({\n imports: [\n _MatSlideToggleRequiredValidatorModule,\n MatRippleModule,\n MatCommonModule,\n ObserversModule,\n ],\n exports: [_MatSlideToggleRequiredValidatorModule, MatSlideToggle, MatCommonModule],\n declarations: [MatSlideToggle],\n})\nexport class MatSlideToggleModule {}\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\nexport * from './slide-toggle-module';\nexport * from './slide-toggle';\nexport * from './slide-toggle-config';\nexport * from './slide-toggle-required-validator';\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\nexport * from './public-api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAmBA;MACa,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC,EAClC;IACE,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAC,CAAC;CAC7C;;ACm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ltipHarnessBase extends ComponentHarness {
5
5
  /** Shows the tooltip. */
6
6
  show() {
7
- var _a;
8
7
  return __awaiter(this, void 0, void 0, function* () {
9
8
  const host = yield this.host();
10
9
  // We need to dispatch both `touchstart` and a hover event, because the tooltip binds
11
10
  // different events depending on the device. The `changedTouches` is there in case the
12
11
  // element has ripples.
13
- // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.
14
- yield ((_a = host.dispatchEvent) === null || _a === void 0 ? void 0 : _a.call(host, 'touchstart', { changedTouches: [] }));
12
+ yield host.dispatchEvent('touchstart', { changedTouches: [] });
15
13
  yield host.hover();
14
+ const panel = yield this._optionalPanel();
15
+ yield (panel === null || panel === void 0 ? void 0 : panel.dispatchEvent('animationend', { animationName: this._showAnimationName }));
16
16
  });
17
17
  }
18
18
  /** Hides the tooltip. */
19
19
  hide() {
20
- var _a;
21
20
  return __awaiter(this, void 0, void 0, function* () {
22
21
  const host = yield this.host();
23
22
  // We need to dispatch both `touchstart` and a hover event, because
24
23
  // the tooltip binds different events depending on the device.
25
- // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.
26
- yield ((_a = host.dispatchEvent) === null || _a === void 0 ? void 0 : _a.call(host, 'touchend'));
24
+ yield host.dispatchEvent('touchend');
27
25
  yield host.mouseAway();
28
- yield this.forceStabilize(); // Needed in order to flush the `hide` animation.
26
+ const panel = yield this._optionalPanel();
27
+ yield (panel === null || panel === void 0 ? void 0 : panel.dispatchEvent('animationend', { animationName: this._hideAnimationName }));
29
28
  });
30
29
  }
31
30
  /** Gets whether the tooltip is open. */
32
31
  isOpen() {
33
32
  return __awaiter(this, void 0, void 0, function* () {
34
- return !!(yield this._optionalPanel());
33
+ const panel = yield this._optionalPanel();
34
+ return !!panel && !(yield panel.hasClass(this._hiddenClass));
35
35
  });
36
36
  }
37
37
  /** Gets a promise for the tooltip panel's text. */
@@ -47,6 +47,9 @@ class MatTooltipHarness extends _MatTooltipHarnessBase {
47
47
  constructor() {
48
48
  super(...arguments);
49
49
  this._optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');
50
+ this._hiddenClass = 'mat-tooltip-hide';
51
+ this._showAnimationName = 'mat-tooltip-show';
52
+ this._hideAnimationName = 'mat-tooltip-hide';
50
53
  }
51
54
  /**
52
55
  * Gets a `HarnessPredicate` that can be used to search
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/tooltip/testing/tooltip-harness.ts","../../../../../../../src/material/tooltip/testing/public-api.ts","../../../../../../../src/material/tooltip/testing/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 {\n AsyncFactoryFn,\n ComponentHarness,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {TooltipHarnessFilters} from './tooltip-harness-filters';\n\nexport abstract class _MatTooltipHarnessBase extends ComponentHarness {\n protected abstract _optionalPanel: AsyncFactoryFn<TestElement | null>;\n\n /** Shows the tooltip. */\n async show(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because the tooltip binds\n // different events depending on the device. The `changedTouches` is there in case the\n // element has ripples.\n // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.\n await host.dispatchEvent?.('touchstart', {changedTouches: []});\n await host.hover();\n }\n\n /** Hides the tooltip. */\n async hide(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because\n // the tooltip binds different events depending on the device.\n // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.\n await host.dispatchEvent?.('touchend');\n await host.mouseAway();\n await this.forceStabilize(); // Needed in order to flush the `hide` animation.\n }\n\n /** Gets whether the tooltip is open. */\n async isOpen(): Promise<boolean> {\n return !!(await this._optionalPanel());\n }\n\n /** Gets a promise for the tooltip panel's text. */\n async getTooltipText(): Promise<string> {\n const panel = await this._optionalPanel();\n return panel ? panel.text() : '';\n }\n}\n\n/** Harness for interacting with a standard mat-tooltip in tests. */\nexport class MatTooltipHarness extends _MatTooltipHarnessBase {\n protected _optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');\n static hostSelector = '.mat-tooltip-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search\n * for a tooltip trigger with specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TooltipHarnessFilters = {}): HarnessPredicate<MatTooltipHarness> {\n return new HarnessPredicate(MatTooltipHarness, options);\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\nexport * from './tooltip-harness';\nexport * from './tooltip-harness-filters';\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\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAgBsB,+BAA+B,gBAAgB;;IAI7D,IAAI;;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;;YAM/B,OAAM,MAAA,IAAI,CAAC,aAAa,+CAAlB,IAAI,EAAiB,YAAY,EAAE,EAAC,cAAc,EAAE,EAAE,EAAC,CAAC,CAAA,CAAC;YAC/D,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;;KACpB;;IAGK,IAAI;;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;YAK/B,OAAM,MAAA,IAAI,CAAC,aAAa,+CAAlB,IAAI,EAAiB,UAAU,CAAC,CAAA,CAAC;YACvC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;;KAC7B;;IAGK,MAAM;;YACV,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;SACxC;KAAA;;IAGK,cAAc;;YAClB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;SAClC;KAAA;CACF;AAED;MACa,0BAA0B,sBAAsB;IAA7D;;QACY,mBAAc,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;KAYjG;;;;;;;IAHC,OAAO,IAAI,CAAC,UAAiC,EAAE;QAC7C,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;KACzD;;AAVM,8BAAY,GAAG,sBAAsB;;AC1D9C;;;;;;;;ACAA;;;;;;;;;;"}
1
+ {"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/tooltip/testing/tooltip-harness.ts","../../../../../../../src/material/tooltip/testing/public-api.ts","../../../../../../../src/material/tooltip/testing/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 {\n AsyncFactoryFn,\n ComponentHarness,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {TooltipHarnessFilters} from './tooltip-harness-filters';\n\nexport abstract class _MatTooltipHarnessBase extends ComponentHarness {\n protected abstract _optionalPanel: AsyncFactoryFn<TestElement | null>;\n protected abstract _hiddenClass: string;\n protected abstract _showAnimationName: string;\n protected abstract _hideAnimationName: string;\n\n /** Shows the tooltip. */\n async show(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because the tooltip binds\n // different events depending on the device. The `changedTouches` is there in case the\n // element has ripples.\n await host.dispatchEvent('touchstart', {changedTouches: []});\n await host.hover();\n const panel = await this._optionalPanel();\n await panel?.dispatchEvent('animationend', {animationName: this._showAnimationName});\n }\n\n /** Hides the tooltip. */\n async hide(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because\n // the tooltip binds different events depending on the device.\n await host.dispatchEvent('touchend');\n await host.mouseAway();\n const panel = await this._optionalPanel();\n await panel?.dispatchEvent('animationend', {animationName: this._hideAnimationName});\n }\n\n /** Gets whether the tooltip is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._optionalPanel();\n return !!panel && !(await panel.hasClass(this._hiddenClass));\n }\n\n /** Gets a promise for the tooltip panel's text. */\n async getTooltipText(): Promise<string> {\n const panel = await this._optionalPanel();\n return panel ? panel.text() : '';\n }\n}\n\n/** Harness for interacting with a standard mat-tooltip in tests. */\nexport class MatTooltipHarness extends _MatTooltipHarnessBase {\n protected _optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');\n protected _hiddenClass = 'mat-tooltip-hide';\n protected _showAnimationName = 'mat-tooltip-show';\n protected _hideAnimationName = 'mat-tooltip-hide';\n static hostSelector = '.mat-tooltip-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search\n * for a tooltip trigger with specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TooltipHarnessFilters = {}): HarnessPredicate<MatTooltipHarness> {\n return new HarnessPredicate(MatTooltipHarness, options);\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\nexport * from './tooltip-harness';\nexport * from './tooltip-harness-filters';\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\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAgBsB,+BAA+B,gBAAgB;;IAO7D,IAAI;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;YAK/B,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,EA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GAAG,kBAAkB,CAAC;KAYnD;;;;;;;IAHC,OAAO,IAAI,CAAC,UAAiC,EAAE;QAC7C,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;KACzD;;AAVM,8BAAY,GAAG,sBAAsB;;AClE9C;;;;;;;;ACAA;;;;;;;;;;"}
@@ -5,7 +5,7 @@ import { A11yModule } from '@angular/cdk/a11y';
5
5
  import * as i7 from '@angular/common';
6
6
  import { DOCUMENT, CommonModule } from '@angular/common';
7
7
  import * as i0 from '@angular/core';
8
- import { InjectionToken, Directive, Inject, Input, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
8
+ import { InjectionToken, Directive, Inject, Input, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
9
9
  import { MatCommonModule } from '@angular/material/core';
10
10
  import * as i2 from '@angular/cdk/scrolling';
11
11
  import { CdkScrollableModule } from '@angular/cdk/scrolling';
@@ -16,35 +16,11 @@ import { Breakpoints } from '@angular/cdk/layout';
16
16
  import * as i3 from '@angular/cdk/platform';
17
17
  import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
18
18
  import { ComponentPortal } from '@angular/cdk/portal';
19
+ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
19
20
  import { Subject } from 'rxjs';
20
21
  import { takeUntil, take } from 'rxjs/operators';
21
- import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
22
22
  import * as i5 from '@angular/cdk/bidi';
23
-
24
- /**
25
- * @license
26
- * Copyright Google LLC All Rights Reserved.
27
- *
28
- * Use of this source code is governed by an MIT-style license that can be
29
- * found in the LICENSE file at https://angular.io/license
30
- */
31
- /**
32
- * Animations used by MatTooltip.
33
- * @docs-private
34
- */
35
- const matTooltipAnimations = {
36
- /** Animation that transitions a tooltip in and out. */
37
- tooltipState: trigger('state', [
38
- state('initial, void, hidden', style({ opacity: 0, transform: 'scale(0)' })),
39
- state('visible', style({ transform: 'scale(1)' })),
40
- transition('* => visible', animate('200ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
41
- style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
42
- style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
43
- style({ opacity: 1, transform: 'scale(1)', offset: 1 }),
44
- ]))),
45
- transition('* => hidden', animate('100ms cubic-bezier(0, 0, 0.2, 1)', style({ opacity: 0 }))),
46
- ]),
47
- };
23
+ import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
48
24
 
49
25
  /** Time in ms to throttle repositioning after scroll events. */
50
26
  const SCROLL_THROTTLE_MS = 20;
@@ -697,14 +673,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
697
673
  }] }];
698
674
  } });
699
675
  class _TooltipComponentBase {
700
- constructor(_changeDetectorRef) {
676
+ constructor(_changeDetectorRef, animationMode) {
701
677
  this._changeDetectorRef = _changeDetectorRef;
702
678
  /** Property watched by the animation framework to show or hide the tooltip */
703
679
  this._visibility = 'initial';
704
680
  /** Whether interactions on the page should close the tooltip */
705
681
  this._closeOnInteraction = false;
682
+ /** Whether the tooltip is currently visible. */
683
+ this._isVisible = false;
706
684
  /** Subject for notifying that the tooltip has been hidden from the view */
707
685
  this._onHide = new Subject();
686
+ this._animationsDisabled = animationMode === 'NoopAnimations';
708
687
  }
709
688
  /**
710
689
  * Shows the tooltip with an animation originating from the provided origin
@@ -713,15 +692,9 @@ class _TooltipComponentBase {
713
692
  show(delay) {
714
693
  // Cancel the delayed hide if it is scheduled
715
694
  clearTimeout(this._hideTimeoutId);
716
- // Body interactions should cancel the tooltip if there is a delay in showing.
717
- this._closeOnInteraction = true;
718
695
  this._showTimeoutId = setTimeout(() => {
719
- this._visibility = 'visible';
696
+ this._toggleVisibility(true);
720
697
  this._showTimeoutId = undefined;
721
- this._onShow();
722
- // Mark for check so if any parent component has set the
723
- // ChangeDetectionStrategy to OnPush it will be checked anyways
724
- this._markForCheck();
725
698
  }, delay);
726
699
  }
727
700
  /**
@@ -732,11 +705,8 @@ class _TooltipComponentBase {
732
705
  // Cancel the delayed show if it is scheduled
733
706
  clearTimeout(this._showTimeoutId);
734
707
  this._hideTimeoutId = setTimeout(() => {
735
- this._visibility = 'hidden';
708
+ this._toggleVisibility(false);
736
709
  this._hideTimeoutId = undefined;
737
- // Mark for check so if any parent component has set the
738
- // ChangeDetectionStrategy to OnPush it will be checked anyways
739
- this._markForCheck();
740
710
  }, delay);
741
711
  }
742
712
  /** Returns an observable that notifies when the tooltip has been hidden from view. */
@@ -745,7 +715,7 @@ class _TooltipComponentBase {
745
715
  }
746
716
  /** Whether the tooltip is being displayed. */
747
717
  isVisible() {
748
- return this._visibility === 'visible';
718
+ return this._isVisible;
749
719
  }
750
720
  ngOnDestroy() {
751
721
  clearTimeout(this._showTimeoutId);
@@ -753,18 +723,6 @@ class _TooltipComponentBase {
753
723
  this._onHide.complete();
754
724
  this._triggerElement = null;
755
725
  }
756
- _animationStart() {
757
- this._closeOnInteraction = false;
758
- }
759
- _animationDone(event) {
760
- const toState = event.toState;
761
- if (toState === 'hidden' && !this.isVisible()) {
762
- this._onHide.next();
763
- }
764
- if (toState === 'visible' || toState === 'hidden') {
765
- this._closeOnInteraction = true;
766
- }
767
- }
768
726
  /**
769
727
  * Interactions on the HTML body should close the tooltip immediately as defined in the
770
728
  * material design spec.
@@ -794,36 +752,103 @@ class _TooltipComponentBase {
794
752
  * in the mdc-tooltip, not here.
795
753
  */
796
754
  _onShow() { }
755
+ /** Event listener dispatched when an animation on the tooltip finishes. */
756
+ _handleAnimationEnd({ animationName }) {
757
+ if (animationName === this._showAnimation || animationName === this._hideAnimation) {
758
+ this._finalizeAnimation(animationName === this._showAnimation);
759
+ }
760
+ }
761
+ /** Handles the cleanup after an animation has finished. */
762
+ _finalizeAnimation(toVisible) {
763
+ if (toVisible) {
764
+ this._closeOnInteraction = true;
765
+ }
766
+ else if (!this.isVisible()) {
767
+ this._onHide.next();
768
+ }
769
+ }
770
+ /** Toggles the visibility of the tooltip element. */
771
+ _toggleVisibility(isVisible) {
772
+ // We set the classes directly here ourselves so that toggling the tooltip state
773
+ // isn't bound by change detection. This allows us to hide it even if the
774
+ // view ref has been detached from the CD tree.
775
+ const tooltip = this._tooltip.nativeElement;
776
+ const showClass = this._showAnimation;
777
+ const hideClass = this._hideAnimation;
778
+ tooltip.classList.remove(isVisible ? hideClass : showClass);
779
+ tooltip.classList.add(isVisible ? showClass : hideClass);
780
+ this._isVisible = isVisible;
781
+ // It's common for internal apps to disable animations using `* { animation: none !important }`
782
+ // which can break the opening sequence. Try to detect such cases and work around them.
783
+ if (isVisible && !this._animationsDisabled && typeof getComputedStyle === 'function') {
784
+ const styles = getComputedStyle(tooltip);
785
+ // Use `getPropertyValue` to avoid issues with property renaming.
786
+ if (styles.getPropertyValue('animation-duration') === '0s' ||
787
+ styles.getPropertyValue('animation-name') === 'none') {
788
+ this._animationsDisabled = true;
789
+ }
790
+ }
791
+ if (isVisible) {
792
+ this._onShow();
793
+ }
794
+ if (this._animationsDisabled) {
795
+ tooltip.classList.add('_mat-animation-noopable');
796
+ this._finalizeAnimation(isVisible);
797
+ }
798
+ }
797
799
  }
798
- _TooltipComponentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
800
+ _TooltipComponentBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, deps: [{ token: i0.ChangeDetectorRef }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
799
801
  _TooltipComponentBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: _TooltipComponentBase, ngImport: i0 });
800
802
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: _TooltipComponentBase, decorators: [{
801
803
  type: Directive
802
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
804
+ }], ctorParameters: function () {
805
+ return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
806
+ type: Optional
807
+ }, {
808
+ type: Inject,
809
+ args: [ANIMATION_MODULE_TYPE]
810
+ }] }];
811
+ } });
803
812
  /**
804
813
  * Internal component that wraps the tooltip's content.
805
814
  * @docs-private
806
815
  */
807
816
  class TooltipComponent extends _TooltipComponentBase {
808
- constructor(changeDetectorRef, _breakpointObserver) {
809
- super(changeDetectorRef);
817
+ constructor(changeDetectorRef, _breakpointObserver, animationMode) {
818
+ super(changeDetectorRef, animationMode);
810
819
  this._breakpointObserver = _breakpointObserver;
811
820
  /** Stream that emits whether the user has a handset-sized display. */
812
821
  this._isHandset = this._breakpointObserver.observe(Breakpoints.Handset);
822
+ this._showAnimation = 'mat-tooltip-show';
823
+ this._hideAnimation = 'mat-tooltip-hide';
813
824
  }
814
825
  }
815
- TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i6.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component });
816
- TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: TooltipComponent, selector: "mat-tooltip-component", host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseleave": "_handleMouseLeave($event)" }, properties: { "style.zoom": "_visibility === \"visible\" ? 1 : null" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"mat-tooltip\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\"\n [@state]=\"_visibility\"\n (@state.start)=\"_animationStart()\"\n (@state.done)=\"_animationDone($event)\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}\n"], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i7.AsyncPipe }, animations: [matTooltipAnimations.tooltipState], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
826
+ TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i6.BreakpointObserver }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Component });
827
+ TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: TooltipComponent, selector: "mat-tooltip-component", host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseleave": "_handleMouseLeave($event)" }, properties: { "style.zoom": "isVisible() ? 1 : null" } }, viewQueries: [{ propertyName: "_tooltip", first: true, predicate: ["tooltip"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div #tooltip\n class=\"mat-tooltip\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis;transform:scale(0)}.mat-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-tooltip-show{0%{opacity:0;transform:scale(0)}50%{opacity:.5;transform:scale(0.99)}100%{opacity:1;transform:scale(1)}}@keyframes mat-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1)}}.mat-tooltip-show{animation:mat-tooltip-show 200ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-tooltip-hide{animation:mat-tooltip-hide 100ms cubic-bezier(0, 0, 0.2, 1) forwards}\n"], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
817
828
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: TooltipComponent, decorators: [{
818
829
  type: Component,
819
- args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, animations: [matTooltipAnimations.tooltipState], host: {
830
+ args: [{ selector: 'mat-tooltip-component', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
820
831
  // Forces the element to have a layout in IE and Edge. This fixes issues where the element
821
832
  // won't be rendered if the animations are disabled or there is no web animations polyfill.
822
- '[style.zoom]': '_visibility === "visible" ? 1 : null',
833
+ '[style.zoom]': 'isVisible() ? 1 : null',
823
834
  '(mouseleave)': '_handleMouseLeave($event)',
824
835
  'aria-hidden': 'true',
825
- }, template: "<div class=\"mat-tooltip\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\"\n [@state]=\"_visibility\"\n (@state.start)=\"_animationStart()\"\n (@state.done)=\"_animationDone($event)\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}\n"] }]
826
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i6.BreakpointObserver }]; } });
836
+ }, template: "<div #tooltip\n class=\"mat-tooltip\"\n (animationend)=\"_handleAnimationEnd($event)\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\">{{message}}</div>\n", styles: [".mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis;transform:scale(0)}.mat-tooltip._mat-animation-noopable{animation:none;transform:scale(1)}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}.mat-tooltip-panel-non-interactive{pointer-events:none}@keyframes mat-tooltip-show{0%{opacity:0;transform:scale(0)}50%{opacity:.5;transform:scale(0.99)}100%{opacity:1;transform:scale(1)}}@keyframes mat-tooltip-hide{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(1)}}.mat-tooltip-show{animation:mat-tooltip-show 200ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-tooltip-hide{animation:mat-tooltip-hide 100ms cubic-bezier(0, 0, 0.2, 1) forwards}\n"] }]
837
+ }], ctorParameters: function () {
838
+ return [{ type: i0.ChangeDetectorRef }, { type: i6.BreakpointObserver }, { type: undefined, decorators: [{
839
+ type: Optional
840
+ }, {
841
+ type: Inject,
842
+ args: [ANIMATION_MODULE_TYPE]
843
+ }] }];
844
+ }, propDecorators: { _tooltip: [{
845
+ type: ViewChild,
846
+ args: ['tooltip', {
847
+ // Use a static query here since we interact directly with
848
+ // the DOM which can happen before `ngAfterViewInit`.
849
+ static: true,
850
+ }]
851
+ }] } });
827
852
 
828
853
  /**
829
854
  * @license
@@ -847,6 +872,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
847
872
  }]
848
873
  }] });
849
874
 
875
+ /**
876
+ * @license
877
+ * Copyright Google LLC All Rights Reserved.
878
+ *
879
+ * Use of this source code is governed by an MIT-style license that can be
880
+ * found in the LICENSE file at https://angular.io/license
881
+ */
882
+ /**
883
+ * Animations used by MatTooltip.
884
+ * @docs-private
885
+ */
886
+ const matTooltipAnimations = {
887
+ /** Animation that transitions a tooltip in and out. */
888
+ tooltipState: trigger('state', [
889
+ state('initial, void, hidden', style({ opacity: 0, transform: 'scale(0)' })),
890
+ state('visible', style({ transform: 'scale(1)' })),
891
+ transition('* => visible', animate('200ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
892
+ style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
893
+ style({ opacity: 0.5, transform: 'scale(0.99)', offset: 0.5 }),
894
+ style({ opacity: 1, transform: 'scale(1)', offset: 1 }),
895
+ ]))),
896
+ transition('* => hidden', animate('100ms cubic-bezier(0, 0, 0.2, 1)', style({ opacity: 0 }))),
897
+ ]),
898
+ };
899
+
850
900
  /**
851
901
  * @license
852
902
  * Copyright Google LLC All Rights Reserved.