source: trip-planner-front/node_modules/@angular/material/fesm2015/button.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 21.4 KB
Line 
1import { Component, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, Optional, Inject, ViewChild, Input, NgModule } from '@angular/core';
2import { mixinColor, mixinDisabled, mixinDisableRipple, MatRipple, MatRippleModule, MatCommonModule } from '@angular/material/core';
3import { FocusMonitor } from '@angular/cdk/a11y';
4import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
5
6/**
7 * @license
8 * Copyright Google LLC All Rights Reserved.
9 *
10 * Use of this source code is governed by an MIT-style license that can be
11 * found in the LICENSE file at https://angular.io/license
12 */
13/** Default color palette for round buttons (mat-fab and mat-mini-fab) */
14const DEFAULT_ROUND_BUTTON_COLOR = 'accent';
15/**
16 * List of classes to add to MatButton instances based on host attributes to
17 * style as different variants.
18 */
19const BUTTON_HOST_ATTRIBUTES = [
20 'mat-button',
21 'mat-flat-button',
22 'mat-icon-button',
23 'mat-raised-button',
24 'mat-stroked-button',
25 'mat-mini-fab',
26 'mat-fab',
27];
28// Boilerplate for applying mixins to MatButton.
29const _MatButtonBase = mixinColor(mixinDisabled(mixinDisableRipple(class {
30 constructor(_elementRef) {
31 this._elementRef = _elementRef;
32 }
33})));
34/**
35 * Material design button.
36 */
37class MatButton extends _MatButtonBase {
38 constructor(elementRef, _focusMonitor, _animationMode) {
39 super(elementRef);
40 this._focusMonitor = _focusMonitor;
41 this._animationMode = _animationMode;
42 /** Whether the button is round. */
43 this.isRoundButton = this._hasHostAttributes('mat-fab', 'mat-mini-fab');
44 /** Whether the button is icon button. */
45 this.isIconButton = this._hasHostAttributes('mat-icon-button');
46 // For each of the variant selectors that is present in the button's host
47 // attributes, add the correct corresponding class.
48 for (const attr of BUTTON_HOST_ATTRIBUTES) {
49 if (this._hasHostAttributes(attr)) {
50 this._getHostElement().classList.add(attr);
51 }
52 }
53 // Add a class that applies to all buttons. This makes it easier to target if somebody
54 // wants to target all Material buttons. We do it here rather than `host` to ensure that
55 // the class is applied to derived classes.
56 elementRef.nativeElement.classList.add('mat-button-base');
57 if (this.isRoundButton) {
58 this.color = DEFAULT_ROUND_BUTTON_COLOR;
59 }
60 }
61 ngAfterViewInit() {
62 this._focusMonitor.monitor(this._elementRef, true);
63 }
64 ngOnDestroy() {
65 this._focusMonitor.stopMonitoring(this._elementRef);
66 }
67 /** Focuses the button. */
68 focus(origin, options) {
69 if (origin) {
70 this._focusMonitor.focusVia(this._getHostElement(), origin, options);
71 }
72 else {
73 this._getHostElement().focus(options);
74 }
75 }
76 _getHostElement() {
77 return this._elementRef.nativeElement;
78 }
79 _isRippleDisabled() {
80 return this.disableRipple || this.disabled;
81 }
82 /** Gets whether the button has one of the given attributes. */
83 _hasHostAttributes(...attributes) {
84 return attributes.some(attribute => this._getHostElement().hasAttribute(attribute));
85 }
86}
87MatButton.decorators = [
88 { type: Component, args: [{
89 selector: `button[mat-button], button[mat-raised-button], button[mat-icon-button],
90 button[mat-fab], button[mat-mini-fab], button[mat-stroked-button],
91 button[mat-flat-button]`,
92 exportAs: 'matButton',
93 host: {
94 '[attr.disabled]': 'disabled || null',
95 '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
96 // Add a class for disabled button styling instead of the using attribute
97 // selector or pseudo-selector. This allows users to create focusabled
98 // disabled buttons without recreating the styles.
99 '[class.mat-button-disabled]': 'disabled',
100 'class': 'mat-focus-indicator',
101 },
102 template: "<span class=\"mat-button-wrapper\"><ng-content></ng-content></span>\n<span matRipple class=\"mat-button-ripple\"\n [class.mat-button-ripple-round]=\"isRoundButton || isIconButton\"\n [matRippleDisabled]=\"_isRippleDisabled()\"\n [matRippleCentered]=\"isIconButton\"\n [matRippleTrigger]=\"_getHostElement()\"></span>\n<span class=\"mat-button-focus-overlay\"></span>\n",
103 inputs: ['disabled', 'disableRipple', 'color'],
104 encapsulation: ViewEncapsulation.None,
105 changeDetection: ChangeDetectionStrategy.OnPush,
106 styles: [".mat-button .mat-button-focus-overlay,.mat-icon-button .mat-button-focus-overlay{opacity:0}.mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay,.mat-stroked-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:.04}@media(hover: none){.mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay,.mat-stroked-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:0}}.mat-button,.mat-icon-button,.mat-stroked-button,.mat-flat-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner{border:0}.mat-button.mat-button-disabled,.mat-icon-button.mat-button-disabled,.mat-stroked-button.mat-button-disabled,.mat-flat-button.mat-button-disabled{cursor:default}.mat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-button.cdk-program-focused .mat-button-focus-overlay,.mat-icon-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-icon-button.cdk-program-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-program-focused .mat-button-focus-overlay,.mat-flat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-flat-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner{border:0}.mat-raised-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-raised-button::-moz-focus-inner{border:0}.mat-raised-button.mat-button-disabled{cursor:default}.mat-raised-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-raised-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-raised-button::-moz-focus-inner{border:0}._mat-animation-noopable.mat-raised-button{transition:none;animation:none}.mat-stroked-button{border:1px solid currentColor;padding:0 15px;line-height:34px}.mat-stroked-button .mat-button-ripple.mat-ripple,.mat-stroked-button .mat-button-focus-overlay{top:-1px;left:-1px;right:-1px;bottom:-1px}.mat-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);min-width:0;border-radius:50%;width:56px;height:56px;padding:0;flex-shrink:0}.mat-fab::-moz-focus-inner{border:0}.mat-fab.mat-button-disabled{cursor:default}.mat-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-fab{transition:none;animation:none}.mat-fab .mat-button-wrapper{padding:16px 0;display:inline-block;line-height:24px}.mat-mini-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);min-width:0;border-radius:50%;width:40px;height:40px;padding:0;flex-shrink:0}.mat-mini-fab::-moz-focus-inner{border:0}.mat-mini-fab.mat-button-disabled{cursor:default}.mat-mini-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-mini-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-mini-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-mini-fab{transition:none;animation:none}.mat-mini-fab .mat-button-wrapper{padding:8px 0;display:inline-block;line-height:24px}.mat-icon-button{padding:0;min-width:0;width:40px;height:40px;flex-shrink:0;line-height:40px;border-radius:50%}.mat-icon-button i,.mat-icon-button .mat-icon{line-height:24px}.mat-button-ripple.mat-ripple,.mat-button-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-ripple.mat-ripple:not(:empty){transform:translateZ(0)}.mat-button-focus-overlay{opacity:0;transition:opacity 200ms cubic-bezier(0.35, 0, 0.25, 1),background-color 200ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-button-focus-overlay{transition:none}.mat-button-ripple-round{border-radius:50%;z-index:1}.mat-button .mat-button-wrapper>*,.mat-flat-button .mat-button-wrapper>*,.mat-stroked-button .mat-button-wrapper>*,.mat-raised-button .mat-button-wrapper>*,.mat-icon-button .mat-button-wrapper>*,.mat-fab .mat-button-wrapper>*,.mat-mini-fab .mat-button-wrapper>*{vertical-align:middle}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button{display:inline-flex;justify-content:center;align-items:center;font-size:inherit;width:2.5em;height:2.5em}.cdk-high-contrast-active .mat-button,.cdk-high-contrast-active .mat-flat-button,.cdk-high-contrast-active .mat-raised-button,.cdk-high-contrast-active .mat-icon-button,.cdk-high-contrast-active .mat-fab,.cdk-high-contrast-active .mat-mini-fab{outline:solid 1px}.cdk-high-contrast-active .mat-button-base.cdk-keyboard-focused,.cdk-high-contrast-active .mat-button-base.cdk-program-focused{outline:solid 3px}\n"]
107 },] }
108];
109MatButton.ctorParameters = () => [
110 { type: ElementRef },
111 { type: FocusMonitor },
112 { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
113];
114MatButton.propDecorators = {
115 ripple: [{ type: ViewChild, args: [MatRipple,] }]
116};
117/**
118 * Material design anchor button.
119 */
120class MatAnchor extends MatButton {
121 constructor(focusMonitor, elementRef, animationMode) {
122 super(elementRef, focusMonitor, animationMode);
123 }
124 _haltDisabledEvents(event) {
125 // A disabled button shouldn't apply any actions
126 if (this.disabled) {
127 event.preventDefault();
128 event.stopImmediatePropagation();
129 }
130 }
131}
132MatAnchor.decorators = [
133 { type: Component, args: [{
134 selector: `a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab],
135 a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]`,
136 exportAs: 'matButton, matAnchor',
137 host: {
138 // Note that we ignore the user-specified tabindex when it's disabled for
139 // consistency with the `mat-button` applied on native buttons where even
140 // though they have an index, they're not tabbable.
141 '[attr.tabindex]': 'disabled ? -1 : (tabIndex || 0)',
142 '[attr.disabled]': 'disabled || null',
143 '[attr.aria-disabled]': 'disabled.toString()',
144 '(click)': '_haltDisabledEvents($event)',
145 '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
146 '[class.mat-button-disabled]': 'disabled',
147 'class': 'mat-focus-indicator',
148 },
149 inputs: ['disabled', 'disableRipple', 'color'],
150 template: "<span class=\"mat-button-wrapper\"><ng-content></ng-content></span>\n<span matRipple class=\"mat-button-ripple\"\n [class.mat-button-ripple-round]=\"isRoundButton || isIconButton\"\n [matRippleDisabled]=\"_isRippleDisabled()\"\n [matRippleCentered]=\"isIconButton\"\n [matRippleTrigger]=\"_getHostElement()\"></span>\n<span class=\"mat-button-focus-overlay\"></span>\n",
151 encapsulation: ViewEncapsulation.None,
152 changeDetection: ChangeDetectionStrategy.OnPush,
153 styles: [".mat-button .mat-button-focus-overlay,.mat-icon-button .mat-button-focus-overlay{opacity:0}.mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay,.mat-stroked-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:.04}@media(hover: none){.mat-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay,.mat-stroked-button:hover:not(.mat-button-disabled) .mat-button-focus-overlay{opacity:0}}.mat-button,.mat-icon-button,.mat-stroked-button,.mat-flat-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible}.mat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner{border:0}.mat-button.mat-button-disabled,.mat-icon-button.mat-button-disabled,.mat-stroked-button.mat-button-disabled,.mat-flat-button.mat-button-disabled{cursor:default}.mat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-button.cdk-program-focused .mat-button-focus-overlay,.mat-icon-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-icon-button.cdk-program-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-stroked-button.cdk-program-focused .mat-button-focus-overlay,.mat-flat-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-flat-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-button::-moz-focus-inner,.mat-icon-button::-moz-focus-inner,.mat-stroked-button::-moz-focus-inner,.mat-flat-button::-moz-focus-inner{border:0}.mat-raised-button{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-raised-button::-moz-focus-inner{border:0}.mat-raised-button.mat-button-disabled{cursor:default}.mat-raised-button.cdk-keyboard-focused .mat-button-focus-overlay,.mat-raised-button.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-raised-button::-moz-focus-inner{border:0}._mat-animation-noopable.mat-raised-button{transition:none;animation:none}.mat-stroked-button{border:1px solid currentColor;padding:0 15px;line-height:34px}.mat-stroked-button .mat-button-ripple.mat-ripple,.mat-stroked-button .mat-button-focus-overlay{top:-1px;left:-1px;right:-1px;bottom:-1px}.mat-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);min-width:0;border-radius:50%;width:56px;height:56px;padding:0;flex-shrink:0}.mat-fab::-moz-focus-inner{border:0}.mat-fab.mat-button-disabled{cursor:default}.mat-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-fab{transition:none;animation:none}.mat-fab .mat-button-wrapper{padding:16px 0;display:inline-block;line-height:24px}.mat-mini-fab{box-sizing:border-box;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;display:inline-block;white-space:nowrap;text-decoration:none;vertical-align:baseline;text-align:center;margin:0;min-width:64px;line-height:36px;padding:0 16px;border-radius:4px;overflow:visible;transform:translate3d(0, 0, 0);transition:background 400ms cubic-bezier(0.25, 0.8, 0.25, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);min-width:0;border-radius:50%;width:40px;height:40px;padding:0;flex-shrink:0}.mat-mini-fab::-moz-focus-inner{border:0}.mat-mini-fab.mat-button-disabled{cursor:default}.mat-mini-fab.cdk-keyboard-focused .mat-button-focus-overlay,.mat-mini-fab.cdk-program-focused .mat-button-focus-overlay{opacity:.12}.mat-mini-fab::-moz-focus-inner{border:0}._mat-animation-noopable.mat-mini-fab{transition:none;animation:none}.mat-mini-fab .mat-button-wrapper{padding:8px 0;display:inline-block;line-height:24px}.mat-icon-button{padding:0;min-width:0;width:40px;height:40px;flex-shrink:0;line-height:40px;border-radius:50%}.mat-icon-button i,.mat-icon-button .mat-icon{line-height:24px}.mat-button-ripple.mat-ripple,.mat-button-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none;border-radius:inherit}.mat-button-ripple.mat-ripple:not(:empty){transform:translateZ(0)}.mat-button-focus-overlay{opacity:0;transition:opacity 200ms cubic-bezier(0.35, 0, 0.25, 1),background-color 200ms cubic-bezier(0.35, 0, 0.25, 1)}._mat-animation-noopable .mat-button-focus-overlay{transition:none}.mat-button-ripple-round{border-radius:50%;z-index:1}.mat-button .mat-button-wrapper>*,.mat-flat-button .mat-button-wrapper>*,.mat-stroked-button .mat-button-wrapper>*,.mat-raised-button .mat-button-wrapper>*,.mat-icon-button .mat-button-wrapper>*,.mat-fab .mat-button-wrapper>*,.mat-mini-fab .mat-button-wrapper>*{vertical-align:middle}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button{display:inline-flex;justify-content:center;align-items:center;font-size:inherit;width:2.5em;height:2.5em}.cdk-high-contrast-active .mat-button,.cdk-high-contrast-active .mat-flat-button,.cdk-high-contrast-active .mat-raised-button,.cdk-high-contrast-active .mat-icon-button,.cdk-high-contrast-active .mat-fab,.cdk-high-contrast-active .mat-mini-fab{outline:solid 1px}.cdk-high-contrast-active .mat-button-base.cdk-keyboard-focused,.cdk-high-contrast-active .mat-button-base.cdk-program-focused{outline:solid 3px}\n"]
154 },] }
155];
156MatAnchor.ctorParameters = () => [
157 { type: FocusMonitor },
158 { type: ElementRef },
159 { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
160];
161MatAnchor.propDecorators = {
162 tabIndex: [{ type: Input }]
163};
164
165/**
166 * @license
167 * Copyright Google LLC All Rights Reserved.
168 *
169 * Use of this source code is governed by an MIT-style license that can be
170 * found in the LICENSE file at https://angular.io/license
171 */
172class MatButtonModule {
173}
174MatButtonModule.decorators = [
175 { type: NgModule, args: [{
176 imports: [
177 MatRippleModule,
178 MatCommonModule,
179 ],
180 exports: [
181 MatButton,
182 MatAnchor,
183 MatCommonModule,
184 ],
185 declarations: [
186 MatButton,
187 MatAnchor,
188 ],
189 },] }
190];
191
192/**
193 * @license
194 * Copyright Google LLC All Rights Reserved.
195 *
196 * Use of this source code is governed by an MIT-style license that can be
197 * found in the LICENSE file at https://angular.io/license
198 */
199
200/**
201 * Generated bundle index. Do not edit.
202 */
203
204export { MatAnchor, MatButton, MatButtonModule };
205//# sourceMappingURL=button.js.map
Note: See TracBrowser for help on using the repository browser.