@materializecss/materialize 2.0.0-alpha → 2.0.2-alpha
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.
- package/Gruntfile.js +7 -4
- package/README.md +24 -12
- package/dist/css/materialize.css +90 -86
- package/dist/css/materialize.min.css +2 -2
- package/dist/js/materialize.js +2869 -2764
- package/dist/js/materialize.min.js +2 -2
- package/dist/js/materialize.min.js.map +1 -1
- package/package.json +1 -1
- package/sass/components/_collapsible.scss +0 -41
- package/sass/components/_global.scss +3 -2
- package/sass/components/_icons-material-design.scss +2 -1
- package/sass/components/_navbar.scss +6 -3
- package/sass/components/_sidenav.scss +66 -37
- package/sass/components/_theme_variables.scss +98 -0
- package/sass/components/_typography.scss +2 -2
- package/sass/components/forms/_input-fields.scss +4 -10
- package/sass/materialize.scss +0 -4
- package/src/autocomplete.ts +188 -94
- package/src/buttons.ts +225 -260
- package/src/cards.ts +5 -6
- package/src/carousel.ts +611 -542
- package/src/characterCounter.ts +50 -21
- package/src/chips.ts +152 -63
- package/src/collapsible.ts +97 -32
- package/src/component.ts +99 -10
- package/src/datepicker.ts +905 -726
- package/src/dropdown.ts +576 -484
- package/src/edges.ts +4 -4
- package/src/forms.ts +17 -14
- package/src/global.ts +56 -325
- package/src/materialbox.ts +354 -298
- package/src/modal.ts +296 -211
- package/src/parallax.ts +129 -105
- package/src/pushpin.ts +148 -103
- package/src/range.ts +166 -150
- package/src/scrollspy.ts +214 -174
- package/src/select.ts +434 -398
- package/src/sidenav.ts +447 -381
- package/src/slider.ts +421 -362
- package/src/tabs.ts +284 -227
- package/src/tapTarget.ts +246 -213
- package/src/timepicker.ts +738 -614
- package/src/toasts.ts +254 -230
- package/src/tooltip.ts +315 -252
- package/src/utils.ts +271 -0
- package/src/waves.ts +10 -10
package/src/buttons.ts
CHANGED
|
@@ -1,295 +1,260 @@
|
|
|
1
|
-
import { Component } from "./component";
|
|
2
1
|
import anim from "animejs";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
3
|
+
import { Component, BaseOptions, InitElements, MElement, Openable } from "./component";
|
|
4
|
+
|
|
5
|
+
export interface FloatingActionButtonOptions extends BaseOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Direction FAB menu opens.
|
|
8
|
+
* @default "top"
|
|
9
|
+
*/
|
|
10
|
+
direction: "top" | "right" | "bottom" | "left";
|
|
11
|
+
/**
|
|
12
|
+
* true: FAB menu appears on hover, false: FAB menu appears on click.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
hoverEnabled: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Enable transit the FAB into a toolbar on click.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
toolbarEnabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let _defaults: FloatingActionButtonOptions = {
|
|
24
|
+
direction: 'top',
|
|
25
|
+
hoverEnabled: true,
|
|
26
|
+
toolbarEnabled: false
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export class FloatingActionButton extends Component<FloatingActionButtonOptions> implements Openable {
|
|
30
|
+
/**
|
|
31
|
+
* Describes open/close state of FAB.
|
|
32
|
+
*/
|
|
33
|
+
isOpen: boolean;
|
|
34
|
+
|
|
35
|
+
private _anchor: HTMLAnchorElement;
|
|
36
|
+
private _menu: HTMLElement|null;
|
|
37
|
+
private _floatingBtns: HTMLElement[];
|
|
38
|
+
private _floatingBtnsReverse: HTMLElement[];
|
|
39
|
+
|
|
40
|
+
offsetY: number;
|
|
41
|
+
offsetX: number;
|
|
42
|
+
btnBottom: number;
|
|
43
|
+
btnLeft: number;
|
|
44
|
+
btnWidth: number;
|
|
45
|
+
|
|
46
|
+
constructor(el: HTMLElement, options: Partial<FloatingActionButtonOptions>) {
|
|
47
|
+
super(el, options, FloatingActionButton);
|
|
48
|
+
(this.el as any).M_FloatingActionButton = this;
|
|
49
|
+
|
|
50
|
+
this.options = {
|
|
51
|
+
...FloatingActionButton.defaults,
|
|
52
|
+
...options
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.isOpen = false;
|
|
56
|
+
this._anchor = this.el.querySelector('a');
|
|
57
|
+
this._menu = this.el.querySelector('ul');
|
|
58
|
+
this._floatingBtns = Array.from(this.el.querySelectorAll('ul .btn-floating'));
|
|
59
|
+
this._floatingBtnsReverse = this._floatingBtns.reverse();
|
|
60
|
+
this.offsetY = 0;
|
|
61
|
+
this.offsetX = 0;
|
|
62
|
+
|
|
63
|
+
this.el.classList.add(`direction-${this.options.direction}`);
|
|
64
|
+
if (this.options.direction === 'top')
|
|
65
|
+
this.offsetY = 40;
|
|
66
|
+
else if (this.options.direction === 'right')
|
|
67
|
+
this.offsetX = -40;
|
|
68
|
+
else if (this.options.direction === 'bottom')
|
|
69
|
+
this.offsetY = -40;
|
|
70
|
+
else
|
|
71
|
+
this.offsetX = 40;
|
|
72
|
+
this._setupEventHandlers();
|
|
73
|
+
}
|
|
52
74
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
static get defaults() {
|
|
76
|
+
return _defaults;
|
|
77
|
+
}
|
|
56
78
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Initializes instance of FloatingActionButton.
|
|
81
|
+
* @param el HTML element.
|
|
82
|
+
* @param options Component options.
|
|
83
|
+
*/
|
|
84
|
+
static init(el: HTMLElement, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton
|
|
85
|
+
/**
|
|
86
|
+
* Initializes instances of FloatingActionButton.
|
|
87
|
+
* @param els HTML elements.
|
|
88
|
+
* @param options Component options.
|
|
89
|
+
*/
|
|
90
|
+
static init(els: InitElements<MElement>, options?: Partial<FloatingActionButtonOptions>): FloatingActionButton[];
|
|
91
|
+
/**
|
|
92
|
+
* Initializes instances of FloatingActionButton.
|
|
93
|
+
* @param els HTML elements.
|
|
94
|
+
* @param options Component options.
|
|
95
|
+
*/
|
|
96
|
+
static init(els: HTMLElement | InitElements<MElement>, options: Partial<FloatingActionButtonOptions> = {}): FloatingActionButton | FloatingActionButton[] {
|
|
97
|
+
return super.init(els, options, FloatingActionButton);
|
|
98
|
+
}
|
|
60
99
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
100
|
+
static getInstance(el: HTMLElement): FloatingActionButton {
|
|
101
|
+
return (el as any).M_FloatingActionButton;
|
|
102
|
+
}
|
|
65
103
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
104
|
+
destroy() {
|
|
105
|
+
this._removeEventHandlers();
|
|
106
|
+
(this.el as any).M_FloatingActionButton = undefined;
|
|
107
|
+
}
|
|
70
108
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.el.addEventListener('mouseenter', this._handleOpenBound);
|
|
78
|
-
this.el.addEventListener('mouseleave', this._handleCloseBound);
|
|
79
|
-
} else {
|
|
80
|
-
this.el.addEventListener('click', this._handleFABClickBound);
|
|
81
|
-
}
|
|
109
|
+
_setupEventHandlers() {
|
|
110
|
+
if (this.options.hoverEnabled && !this.options.toolbarEnabled) {
|
|
111
|
+
this.el.addEventListener('mouseenter', this.open);
|
|
112
|
+
this.el.addEventListener('mouseleave', this.close);
|
|
113
|
+
} else {
|
|
114
|
+
this.el.addEventListener('click', this._handleFABClick);
|
|
82
115
|
}
|
|
116
|
+
}
|
|
83
117
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
118
|
+
_removeEventHandlers() {
|
|
119
|
+
if (this.options.hoverEnabled && !this.options.toolbarEnabled) {
|
|
120
|
+
this.el.removeEventListener('mouseenter', this.open);
|
|
121
|
+
this.el.removeEventListener('mouseleave', this.close);
|
|
122
|
+
} else {
|
|
123
|
+
this.el.removeEventListener('click', this._handleFABClick);
|
|
91
124
|
}
|
|
125
|
+
}
|
|
92
126
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
127
|
+
_handleFABClick = () => {
|
|
128
|
+
if (this.isOpen) {
|
|
129
|
+
this.close();
|
|
130
|
+
} else {
|
|
131
|
+
this.open();
|
|
99
132
|
}
|
|
133
|
+
}
|
|
100
134
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!elem.closest(this.$menu)) {
|
|
106
|
-
this.close();
|
|
107
|
-
}*/
|
|
108
|
-
}
|
|
135
|
+
_handleDocumentClick = (e: MouseEvent) => {
|
|
136
|
+
const elem = e.target;
|
|
137
|
+
if (elem !== this._menu) this.close;
|
|
138
|
+
}
|
|
109
139
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.
|
|
117
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Open FAB.
|
|
142
|
+
*/
|
|
143
|
+
open = (): void => {
|
|
144
|
+
if (this.isOpen) return;
|
|
145
|
+
if (this.options.toolbarEnabled)
|
|
146
|
+
this._animateInToolbar();
|
|
147
|
+
else
|
|
148
|
+
this._animateInFAB();
|
|
149
|
+
this.isOpen = true;
|
|
150
|
+
}
|
|
118
151
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this._animateOutFAB();
|
|
128
|
-
}
|
|
129
|
-
this.isOpen = false;
|
|
152
|
+
/**
|
|
153
|
+
* Close FAB.
|
|
154
|
+
*/
|
|
155
|
+
close = (): void => {
|
|
156
|
+
if (!this.isOpen) return;
|
|
157
|
+
if (this.options.toolbarEnabled) {
|
|
158
|
+
window.removeEventListener('scroll', this.close, true);
|
|
159
|
+
document.body.removeEventListener('click', this._handleDocumentClick, true);
|
|
130
160
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
this.el.classList.add('active');
|
|
134
|
-
let time = 0;
|
|
135
|
-
this._floatingBtnsReverse.forEach((el) => {
|
|
136
|
-
anim({
|
|
137
|
-
targets: el,
|
|
138
|
-
opacity: 1,
|
|
139
|
-
scale: [0.4, 1],
|
|
140
|
-
translateY: [this.offsetY, 0],
|
|
141
|
-
translateX: [this.offsetX, 0],
|
|
142
|
-
duration: 275,
|
|
143
|
-
delay: time,
|
|
144
|
-
easing: 'easeInOutQuad'
|
|
145
|
-
});
|
|
146
|
-
time += 40;
|
|
147
|
-
});
|
|
161
|
+
else {
|
|
162
|
+
this._animateOutFAB();
|
|
148
163
|
}
|
|
164
|
+
this.isOpen = false;
|
|
165
|
+
}
|
|
149
166
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
});
|
|
167
|
+
_animateInFAB() {
|
|
168
|
+
this.el.classList.add('active');
|
|
169
|
+
let time = 0;
|
|
170
|
+
this._floatingBtnsReverse.forEach((el) => {
|
|
171
|
+
anim({
|
|
172
|
+
targets: el,
|
|
173
|
+
opacity: 1,
|
|
174
|
+
scale: [0.4, 1],
|
|
175
|
+
translateY: [this.offsetY, 0],
|
|
176
|
+
translateX: [this.offsetX, 0],
|
|
177
|
+
duration: 275,
|
|
178
|
+
delay: time,
|
|
179
|
+
easing: 'easeInOutQuad'
|
|
165
180
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
let scaleFactor;
|
|
170
|
-
let windowWidth = window.innerWidth;
|
|
171
|
-
let windowHeight = window.innerHeight;
|
|
172
|
-
let btnRect = this.el.getBoundingClientRect();
|
|
173
|
-
|
|
174
|
-
const backdrop = document.createElement('div');
|
|
175
|
-
backdrop.classList.add('fab-backdrop'); // $('<div class="fab-backdrop"></div>');
|
|
176
|
-
|
|
177
|
-
const fabColor = getComputedStyle(this._anchor).backgroundColor; // css('background-color');
|
|
178
|
-
|
|
179
|
-
this._anchor.append(backdrop);
|
|
180
|
-
|
|
181
|
-
this.offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
|
|
182
|
-
this.offsetY = windowHeight - btnRect.bottom;
|
|
183
|
-
scaleFactor = windowWidth / backdrop[0].clientWidth;
|
|
184
|
-
this.btnBottom = btnRect.bottom;
|
|
185
|
-
this.btnLeft = btnRect.left;
|
|
186
|
-
this.btnWidth = btnRect.width;
|
|
187
|
-
|
|
188
|
-
// Set initial state
|
|
189
|
-
this.el.classList.add('active');
|
|
190
|
-
this.el.style.textAlign = 'center';
|
|
191
|
-
this.el.style.width = '100%';
|
|
192
|
-
this.el.style.bottom = '0';
|
|
193
|
-
this.el.style.left = '0';
|
|
194
|
-
this.el.style.transform = 'translateX(' + this.offsetX + 'px)';
|
|
195
|
-
this.el.style.transition = 'none';
|
|
196
|
-
|
|
197
|
-
this._anchor.style.transform = `translateY(${this.offsetY}px`;
|
|
198
|
-
this._anchor.style.transition = 'none';
|
|
181
|
+
time += 40;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
199
184
|
|
|
200
|
-
|
|
185
|
+
_animateOutFAB() {
|
|
186
|
+
this._floatingBtnsReverse.forEach((el) => {
|
|
187
|
+
anim.remove(el);
|
|
188
|
+
anim({
|
|
189
|
+
targets: el,
|
|
190
|
+
opacity: 0,
|
|
191
|
+
scale: 0.4,
|
|
192
|
+
translateY: this.offsetY,
|
|
193
|
+
translateX: this.offsetX,
|
|
194
|
+
duration: 175,
|
|
195
|
+
easing: 'easeOutQuad',
|
|
196
|
+
complete: () => {
|
|
197
|
+
this.el.classList.remove('active');
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
}
|
|
201
202
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
_animateInToolbar() {
|
|
204
|
+
let scaleFactor;
|
|
205
|
+
let windowWidth = window.innerWidth;
|
|
206
|
+
let windowHeight = window.innerHeight;
|
|
207
|
+
let btnRect = this.el.getBoundingClientRect();
|
|
205
208
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this._anchor.style.transition = 'transform .2s';
|
|
209
|
+
const backdrop = document.createElement('div');
|
|
210
|
+
backdrop.classList.add('fab-backdrop'); // $('<div class="fab-backdrop"></div>');
|
|
209
211
|
|
|
210
|
-
|
|
211
|
-
this.el.style.overflow = 'hidden';
|
|
212
|
-
this.el.style.backgroundColor = fabColor;
|
|
212
|
+
const fabColor = getComputedStyle(this._anchor).backgroundColor; // css('background-color');
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
backdrop.style.transition = 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)';
|
|
214
|
+
this._anchor.append(backdrop);
|
|
216
215
|
|
|
217
|
-
|
|
216
|
+
this.offsetX = btnRect.left - windowWidth / 2 + btnRect.width / 2;
|
|
217
|
+
this.offsetY = windowHeight - btnRect.bottom;
|
|
218
|
+
scaleFactor = windowWidth / backdrop[0].clientWidth;
|
|
219
|
+
this.btnBottom = btnRect.bottom;
|
|
220
|
+
this.btnLeft = btnRect.left;
|
|
221
|
+
this.btnWidth = btnRect.width;
|
|
218
222
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
// Set initial state
|
|
224
|
+
this.el.classList.add('active');
|
|
225
|
+
this.el.style.textAlign = 'center';
|
|
226
|
+
this.el.style.width = '100%';
|
|
227
|
+
this.el.style.bottom = '0';
|
|
228
|
+
this.el.style.left = '0';
|
|
229
|
+
this.el.style.transform = 'translateX(' + this.offsetX + 'px)';
|
|
230
|
+
this.el.style.transition = 'none';
|
|
226
231
|
|
|
232
|
+
this._anchor.style.transform = `translateY(${this.offsetY}px`;
|
|
233
|
+
this._anchor.style.transition = 'none';
|
|
227
234
|
|
|
235
|
+
backdrop.style.backgroundColor = fabColor;
|
|
228
236
|
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
this.el.style.transform = '';
|
|
239
|
+
this.el.style.transition = 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s';
|
|
229
240
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
let windowWidth = window.innerWidth;
|
|
234
|
-
let windowHeight = window.innerHeight;
|
|
235
|
-
let backdrop = this.$el.find('.fab-backdrop');
|
|
236
|
-
let fabColor = this.$anchor.css('background-color');
|
|
241
|
+
this._anchor.style.overflow = 'visible';
|
|
242
|
+
this._anchor.style.transform = '';
|
|
243
|
+
this._anchor.style.transition = 'transform .2s';
|
|
237
244
|
|
|
238
|
-
|
|
239
|
-
|
|
245
|
+
setTimeout(() => {
|
|
246
|
+
this.el.style.overflow = 'hidden';
|
|
247
|
+
this.el.style.backgroundColor = fabColor;
|
|
240
248
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this.$el.css({
|
|
244
|
-
'background-color': 'transparent',
|
|
245
|
-
transition: 'none'
|
|
246
|
-
});
|
|
247
|
-
// this.$anchor.css({
|
|
248
|
-
// transition: 'none'
|
|
249
|
-
// });
|
|
250
|
-
backdrop.css({
|
|
251
|
-
transform: 'scale(0)',
|
|
252
|
-
'background-color': fabColor
|
|
253
|
-
});
|
|
249
|
+
backdrop.style.transform = 'scale(' + scaleFactor + ')';
|
|
250
|
+
backdrop.style.transition = 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)';
|
|
254
251
|
|
|
255
|
-
|
|
256
|
-
// .children('li')
|
|
257
|
-
// .children('a')
|
|
258
|
-
// .css({
|
|
259
|
-
// opacity: ''
|
|
260
|
-
// });
|
|
252
|
+
this._menu.querySelectorAll('li > a').forEach((a: HTMLAnchorElement) => a.style.opacity = '1');
|
|
261
253
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
'text-align': '',
|
|
268
|
-
width: '',
|
|
269
|
-
bottom: '',
|
|
270
|
-
left: '',
|
|
271
|
-
overflow: '',
|
|
272
|
-
'background-color': '',
|
|
273
|
-
transform: 'translate3d(' + -this.offsetX + 'px,0,0)'
|
|
274
|
-
});
|
|
275
|
-
// this.$anchor.css({
|
|
276
|
-
// overflow: '',
|
|
277
|
-
// transform: 'translate3d(0,' + this.offsetY + 'px,0)'
|
|
278
|
-
// });
|
|
279
|
-
|
|
280
|
-
setTimeout(() => {
|
|
281
|
-
this.$el.css({
|
|
282
|
-
transform: 'translate3d(0,0,0)',
|
|
283
|
-
transition: 'transform .2s'
|
|
284
|
-
});
|
|
285
|
-
// this.$anchor.css({
|
|
286
|
-
// transform: 'translate3d(0,0,0)',
|
|
287
|
-
// transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
|
|
288
|
-
// });
|
|
289
|
-
}, 20);
|
|
290
|
-
}, 200);
|
|
291
|
-
*/
|
|
292
|
-
}
|
|
254
|
+
// Scroll to close.
|
|
255
|
+
window.addEventListener('scroll', this.close, true);
|
|
256
|
+
document.body.addEventListener('click', this._handleDocumentClick, true);
|
|
257
|
+
}, 100);
|
|
258
|
+
}, 0);
|
|
293
259
|
}
|
|
294
|
-
|
|
295
|
-
|
|
260
|
+
}
|
package/src/cards.ts
CHANGED
|
@@ -15,7 +15,7 @@ export class Cards {
|
|
|
15
15
|
if (!cardReveal) return;
|
|
16
16
|
const initialOverflow = getComputedStyle(card).overflow;
|
|
17
17
|
|
|
18
|
-
// Close Card
|
|
18
|
+
// Close Card
|
|
19
19
|
const closeArea = cardReveal.querySelector('.card-reveal .card-title');
|
|
20
20
|
if (trigger === closeArea || closeArea.contains(trigger)) {
|
|
21
21
|
anim({
|
|
@@ -29,7 +29,7 @@ export class Cards {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// Reveal Card
|
|
34
34
|
const activators = card.querySelectorAll('.activator');
|
|
35
35
|
activators.forEach(activator => {
|
|
@@ -44,11 +44,10 @@ export class Cards {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
|
|
49
|
+
});
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
}
|
|
54
|
-
|