@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.
Files changed (46) hide show
  1. package/Gruntfile.js +7 -4
  2. package/README.md +24 -12
  3. package/dist/css/materialize.css +90 -86
  4. package/dist/css/materialize.min.css +2 -2
  5. package/dist/js/materialize.js +2869 -2764
  6. package/dist/js/materialize.min.js +2 -2
  7. package/dist/js/materialize.min.js.map +1 -1
  8. package/package.json +1 -1
  9. package/sass/components/_collapsible.scss +0 -41
  10. package/sass/components/_global.scss +3 -2
  11. package/sass/components/_icons-material-design.scss +2 -1
  12. package/sass/components/_navbar.scss +6 -3
  13. package/sass/components/_sidenav.scss +66 -37
  14. package/sass/components/_theme_variables.scss +98 -0
  15. package/sass/components/_typography.scss +2 -2
  16. package/sass/components/forms/_input-fields.scss +4 -10
  17. package/sass/materialize.scss +0 -4
  18. package/src/autocomplete.ts +188 -94
  19. package/src/buttons.ts +225 -260
  20. package/src/cards.ts +5 -6
  21. package/src/carousel.ts +611 -542
  22. package/src/characterCounter.ts +50 -21
  23. package/src/chips.ts +152 -63
  24. package/src/collapsible.ts +97 -32
  25. package/src/component.ts +99 -10
  26. package/src/datepicker.ts +905 -726
  27. package/src/dropdown.ts +576 -484
  28. package/src/edges.ts +4 -4
  29. package/src/forms.ts +17 -14
  30. package/src/global.ts +56 -325
  31. package/src/materialbox.ts +354 -298
  32. package/src/modal.ts +296 -211
  33. package/src/parallax.ts +129 -105
  34. package/src/pushpin.ts +148 -103
  35. package/src/range.ts +166 -150
  36. package/src/scrollspy.ts +214 -174
  37. package/src/select.ts +434 -398
  38. package/src/sidenav.ts +447 -381
  39. package/src/slider.ts +421 -362
  40. package/src/tabs.ts +284 -227
  41. package/src/tapTarget.ts +246 -213
  42. package/src/timepicker.ts +738 -614
  43. package/src/toasts.ts +254 -230
  44. package/src/tooltip.ts +315 -252
  45. package/src/utils.ts +271 -0
  46. package/src/waves.ts +10 -10
package/src/tabs.ts CHANGED
@@ -1,290 +1,347 @@
1
- import { Component } from "./component";
2
- import { Carousel } from "./carousel";
3
1
  import anim from "animejs";
4
2
 
5
- let _defaults = {
3
+ import { Carousel } from "./carousel";
4
+ import { Component, BaseOptions, InitElements, MElement } from "./component";
5
+
6
+ export interface TabsOptions extends BaseOptions {
7
+ /**
8
+ * Transition duration in milliseconds.
9
+ * @default 300
10
+ */
11
+ duration: number;
12
+ /**
13
+ * Callback for when a new tab content is shown.
14
+ * @default null
15
+ */
16
+ onShow: (newContent: Element) => void;
17
+ /**
18
+ * Set to true to enable swipeable tabs.
19
+ * This also uses the responsiveThreshold option.
20
+ * @default false
21
+ */
22
+ swipeable: boolean;
23
+ /**
24
+ * The maximum width of the screen, in pixels,
25
+ * where the swipeable functionality initializes.
26
+ * @default infinity
27
+ */
28
+ responsiveThreshold: number;
29
+ };
30
+
31
+ let _defaults: TabsOptions = {
6
32
  duration: 300,
7
33
  onShow: null,
8
34
  swipeable: false,
9
- responsiveThreshold: Infinity, // breakpoint for swipeable
35
+ responsiveThreshold: Infinity // breakpoint for swipeable
10
36
  };
11
37
 
12
- export class Tabs extends Component {
13
- el: HTMLElement;
14
- _tabLinks: any;
38
+ export class Tabs extends Component<TabsOptions> {
39
+ _tabLinks: NodeListOf<HTMLAnchorElement>;
15
40
  _index: number;
16
41
  _indicator: any;
17
- _handleWindowResizeBound: (this: Window, ev: UIEvent) => any;
18
- _handleTabClickBound: (this: Window, ev: UIEvent) => any;
19
42
  _tabWidth: number;
20
43
  _tabsWidth: number;
21
44
  _tabsCarousel: any;
22
45
  _activeTabLink: any;
23
46
  _content: any;
24
47
 
25
- constructor(el, options: any) {
26
- super(Tabs, el, options);
27
- (this.el as any).M_Tabs = this;
28
-
29
- this.options = {...Tabs.defaults, ...options};
30
- this._tabLinks = this.el.querySelectorAll('li.tab > a');
31
- this._index = 0;
32
- this._setupActiveTabLink();
33
- if (this.options.swipeable) {
34
- this._setupSwipeableTabs();
35
- } else {
36
- this._setupNormalTabs();
37
- }
38
- // Setup tabs indicator after content to ensure accurate widths
39
- this._setTabsAndTabWidth();
40
- this._createIndicator();
41
- this._setupEventHandlers();
48
+ constructor(el: HTMLElement, options: Partial<TabsOptions>) {
49
+ super(el, options, Tabs);
50
+ (this.el as any).M_Tabs = this;
51
+
52
+ this.options = {
53
+ ...Tabs.defaults,
54
+ ...options
55
+ };
56
+
57
+ this._tabLinks = this.el.querySelectorAll('li.tab > a');
58
+ this._index = 0;
59
+ this._setupActiveTabLink();
60
+ if (this.options.swipeable) {
61
+ this._setupSwipeableTabs();
62
+ } else {
63
+ this._setupNormalTabs();
42
64
  }
65
+ // Setup tabs indicator after content to ensure accurate widths
66
+ this._setTabsAndTabWidth();
67
+ this._createIndicator();
68
+ this._setupEventHandlers();
69
+ }
43
70
 
44
- static get defaults() {
45
- return _defaults;
46
- }
71
+ static get defaults(): TabsOptions {
72
+ return _defaults;
73
+ }
47
74
 
48
- static init(els, options) {
49
- return super.init(this, els, options);
50
- }
75
+ /**
76
+ * Initializes instance of Tabs.
77
+ * @param el HTML element.
78
+ * @param options Component options.
79
+ */
80
+ static init(el: HTMLElement, options?: Partial<TabsOptions>): Tabs;
81
+ /**
82
+ * Initializes instances of Tabs.
83
+ * @param els HTML elements.
84
+ * @param options Component options.
85
+ */
86
+ static init(els: InitElements<MElement>, options?: Partial<TabsOptions>): Tabs[];
87
+ /**
88
+ * Initializes instances of Tabs.
89
+ * @param els HTML elements.
90
+ * @param options Component options.
91
+ */
92
+ static init(els: HTMLElement | InitElements<MElement>, options: Partial<TabsOptions> = {}): Tabs | Tabs[] {
93
+ return super.init(els, options, Tabs);
94
+ }
51
95
 
52
- static getInstance(el) {
53
- const domElem = !!el.jquery ? el[0] : el;
54
- return domElem.M_Tabs;
55
- }
96
+ static getInstance(el: HTMLElement): Tabs {
97
+ return (el as any).M_Tabs;
98
+ }
56
99
 
57
- destroy() {
58
- this._removeEventHandlers();
59
- this._indicator.parentNode.removeChild(this._indicator);
60
- if (this.options.swipeable) {
61
- this._teardownSwipeableTabs();
62
- }
63
- else {
64
- this._teardownNormalTabs();
65
- }
66
- (this.el as any).M_Tabs = undefined;
100
+ destroy() {
101
+ this._removeEventHandlers();
102
+ this._indicator.parentNode.removeChild(this._indicator);
103
+ if (this.options.swipeable) {
104
+ this._teardownSwipeableTabs();
67
105
  }
68
-
69
- _setupEventHandlers() {
70
- this._handleWindowResizeBound = this._handleWindowResize.bind(this);
71
- window.addEventListener('resize', this._handleWindowResizeBound);
72
- this._handleTabClickBound = this._handleTabClick.bind(this);
73
- this.el.addEventListener('click', this._handleTabClickBound);
106
+ else {
107
+ this._teardownNormalTabs();
74
108
  }
109
+ (this.el as any).M_Tabs = undefined;
110
+ }
75
111
 
76
- _removeEventHandlers() {
77
- window.removeEventListener('resize', this._handleWindowResizeBound);
78
- this.el.removeEventListener('click', this._handleTabClickBound);
79
- }
112
+ /**
113
+ * The index of tab that is currently shown.
114
+ */
115
+ get index(){ return this._index; }
80
116
 
81
- _handleWindowResize() {
82
- this._setTabsAndTabWidth();
83
- if (this._tabWidth !== 0 && this._tabsWidth !== 0) {
84
- this._indicator.style.left = this._calcLeftPos(this._activeTabLink)+'px';
85
- this._indicator.style.right = this._calcRightPos(this._activeTabLink)+'px';
86
- }
117
+ _setupEventHandlers() {
118
+ window.addEventListener('resize', this._handleWindowResize);
119
+ this.el.addEventListener('click', this._handleTabClick);
120
+ }
121
+
122
+ _removeEventHandlers() {
123
+ window.removeEventListener('resize', this._handleWindowResize);
124
+ this.el.removeEventListener('click', this._handleTabClick);
125
+ }
126
+
127
+ _handleWindowResize = () => {
128
+ this._setTabsAndTabWidth();
129
+ if (this._tabWidth !== 0 && this._tabsWidth !== 0) {
130
+ this._indicator.style.left = this._calcLeftPos(this._activeTabLink)+'px';
131
+ this._indicator.style.right = this._calcRightPos(this._activeTabLink)+'px';
87
132
  }
133
+ }
88
134
 
89
- _handleTabClick(e) {
90
- const tabLink = e.target;
91
- const tab = tabLink.parentElement;
92
- // Handle click on tab link only
93
- if (!tabLink || !tab.classList.contains('tab')) return;
94
- // is disabled?
95
- if (tab.classList.contains('disabled')) {
96
- e.preventDefault();
97
- return;
98
- }
99
- // Act as regular link if target attribute is specified.
100
- if (tabLink.hasAttribute('target')) return;
101
- // Make the old tab inactive.
102
- this._activeTabLink.classList.remove('active');
103
- const _oldContent = this._content;
104
- // Update the variables with the new link and content
135
+ _handleTabClick = (e: MouseEvent) => {
136
+ const tabLink = e.target as HTMLAnchorElement;
137
+ const tab = tabLink.parentElement;
138
+ // Handle click on tab link only
139
+ if (!tabLink || !tab.classList.contains('tab')) return;
140
+ // is disabled?
141
+ if (tab.classList.contains('disabled')) {
142
+ e.preventDefault();
143
+ return;
144
+ }
145
+ // Act as regular link if target attribute is specified.
146
+ if (tabLink.hasAttribute('target')) return;
147
+ // Make the old tab inactive.
148
+ this._activeTabLink.classList.remove('active');
149
+ const _oldContent = this._content;
150
+ // Update the variables with the new link and content
105
151
 
106
152
  this._activeTabLink = tabLink;
107
- this._content = document.querySelector(tabLink.hash);
153
+ if (tabLink.hash)
154
+ this._content = document.querySelector(tabLink.hash);
108
155
  this._tabLinks = this.el.querySelectorAll('li.tab > a');
109
156
  // Make the tab active
110
157
  this._activeTabLink.classList.add('active');
111
158
  const prevIndex = this._index;
112
159
  this._index = Math.max(Array.from(this._tabLinks).indexOf(tabLink), 0);
113
160
 
114
- // Swap content
115
- if (this.options.swipeable) {
116
- if (this._tabsCarousel) {
117
- this._tabsCarousel.set(this._index, () => {
118
- if (typeof this.options.onShow === 'function')
119
- this.options.onShow.call(this, this._content);
120
- });
121
- }
122
- } else {
123
- if (this._content) {
124
- this._content.style.display = 'block';
125
- this._content.classList.add('active');
161
+ // Swap content
162
+ if (this.options.swipeable) {
163
+ if (this._tabsCarousel) {
164
+ this._tabsCarousel.set(this._index, () => {
126
165
  if (typeof this.options.onShow === 'function')
127
166
  this.options.onShow.call(this, this._content);
128
- if (_oldContent && _oldContent !== this._content) {
129
- _oldContent.style.display = 'none';
130
- _oldContent.classList.remove('active');
131
- }
167
+ });
168
+ }
169
+ } else {
170
+ if (this._content) {
171
+ this._content.style.display = 'block';
172
+ this._content.classList.add('active');
173
+ if (typeof this.options.onShow === 'function')
174
+ this.options.onShow.call(this, this._content);
175
+ if (_oldContent && _oldContent !== this._content) {
176
+ _oldContent.style.display = 'none';
177
+ _oldContent.classList.remove('active');
132
178
  }
133
179
  }
134
- // Update widths after content is swapped (scrollbar bugfix)
135
- this._setTabsAndTabWidth();
136
- this._animateIndicator(prevIndex);
137
- e.preventDefault();
138
180
  }
181
+ // Update widths after content is swapped (scrollbar bugfix)
182
+ this._setTabsAndTabWidth();
183
+ this._animateIndicator(prevIndex);
184
+ e.preventDefault();
185
+ }
139
186
 
140
- _createIndicator() {
141
- const indicator = document.createElement('li');
142
- indicator.classList.add('indicator');
143
- this.el.appendChild(indicator);
144
- this._indicator = indicator;
145
- this._indicator.style.left = this._calcLeftPos(this._activeTabLink)+'px';
146
- this._indicator.style.right = this._calcRightPos(this._activeTabLink)+'px';
147
- }
187
+ _createIndicator() {
188
+ const indicator = document.createElement('li');
189
+ indicator.classList.add('indicator');
190
+ this.el.appendChild(indicator);
191
+ this._indicator = indicator;
192
+ this._indicator.style.left = this._calcLeftPos(this._activeTabLink)+'px';
193
+ this._indicator.style.right = this._calcRightPos(this._activeTabLink)+'px';
194
+ }
148
195
 
149
- _setupActiveTabLink() {
150
- // If the location.hash matches one of the links, use that as the active tab.
151
- this._activeTabLink = Array.from(this._tabLinks).find((a: HTMLAnchorElement) => a.getAttribute('href') === location.hash);
152
- // If no match is found, use the first link or any with class 'active' as the initial active tab.
153
- if (!this._activeTabLink) {
154
- this._activeTabLink = this.el.querySelector('li.tab a.active');
155
- }
156
- if (this._activeTabLink.length === 0) {
157
- this._activeTabLink = this.el.querySelector('li.tab a');
158
- }
159
- Array.from(this._tabLinks).forEach((a: HTMLAnchorElement) => a.classList.remove('active'));
160
- this._activeTabLink.classList.add('active');
196
+ _setupActiveTabLink() {
197
+ // If the location.hash matches one of the links, use that as the active tab.
198
+ this._activeTabLink = Array.from(this._tabLinks).find((a: HTMLAnchorElement) => a.getAttribute('href') === location.hash);
199
+ // If no match is found, use the first link or any with class 'active' as the initial active tab.
200
+ if (!this._activeTabLink) {
201
+ this._activeTabLink = this.el.querySelector('li.tab a.active');
202
+ }
203
+ if (this._activeTabLink.length === 0) {
204
+ this._activeTabLink = this.el.querySelector('li.tab a');
205
+ }
206
+ Array.from(this._tabLinks).forEach((a: HTMLAnchorElement) => a.classList.remove('active'));
207
+ this._activeTabLink.classList.add('active');
161
208
 
162
209
  this._index = Math.max(Array.from(this._tabLinks).indexOf(this._activeTabLink), 0);
163
- if (this._activeTabLink) {
210
+ if (this._activeTabLink && this._activeTabLink.hash) {
164
211
  this._content = document.querySelector(this._activeTabLink.hash);
165
212
  this._content.classList.add('active');
166
213
  }
167
214
  }
168
215
 
169
- _setupSwipeableTabs() {
170
- // Change swipeable according to responsive threshold
171
- if (window.innerWidth > this.options.responsiveThreshold)
172
- this.options.swipeable = false;
216
+ _setupSwipeableTabs() {
217
+ // Change swipeable according to responsive threshold
218
+ if (window.innerWidth > this.options.responsiveThreshold)
219
+ this.options.swipeable = false;
173
220
 
174
221
  const tabsContent = [];
175
222
  this._tabLinks.forEach(a => {
176
- const currContent = document.querySelector(a.hash);
177
- currContent.classList.add('carousel-item');
178
- tabsContent.push(currContent);
179
- });
180
-
181
- // Create Carousel-Wrapper around Tab-Contents
182
- const tabsWrapper = document.createElement('div');
183
- tabsWrapper.classList.add('tabs-content', 'carousel', 'carousel-slider');
184
-
185
- // Wrap around
186
- tabsContent[0].parentElement.insertBefore(tabsWrapper, tabsContent[0]);
187
- tabsContent.forEach(tabContent => {
188
- tabsWrapper.appendChild(tabContent);
189
- tabContent.style.display = '';
190
- });
191
-
192
- // Keep active tab index to set initial carousel slide
193
- const tab = this._activeTabLink.parentElement;
194
- const activeTabIndex = Array.from(tab.parentNode.children).indexOf(tab);
195
-
196
- this._tabsCarousel = Carousel.init(tabsWrapper, {
197
- fullWidth: true,
198
- noWrap: true,
199
- onCycleTo: (item) => {
200
- const prevIndex = this._index;
201
- this._index = Array.from(item.parentNode.children).indexOf(item);
202
- this._activeTabLink.classList.remove('active');
203
- this._activeTabLink = Array.from(this._tabLinks)[this._index];
204
- this._activeTabLink.classList.add('active');
205
- this._animateIndicator(prevIndex);
206
- if (typeof this.options.onShow === 'function')
207
- this.options.onShow.call(this, this._content);
223
+ if (a.hash) {
224
+ const currContent = document.querySelector(a.hash);
225
+ currContent.classList.add('carousel-item');
226
+ tabsContent.push(currContent);
208
227
  }
209
228
  });
210
- // Set initial carousel slide to active tab
211
- this._tabsCarousel.set(activeTabIndex);
212
- }
213
229
 
214
- _teardownSwipeableTabs() {
215
- const tabsWrapper = this._tabsCarousel.el;
216
- this._tabsCarousel.destroy();
217
- // Unwrap
218
- tabsWrapper.after(tabsWrapper.children);
219
- tabsWrapper.remove();
220
- }
230
+ // Create Carousel-Wrapper around Tab-Contents
231
+ const tabsWrapper = document.createElement('div');
232
+ tabsWrapper.classList.add('tabs-content', 'carousel', 'carousel-slider');
233
+
234
+ // Wrap around
235
+ tabsContent[0].parentElement.insertBefore(tabsWrapper, tabsContent[0]);
236
+ tabsContent.forEach(tabContent => {
237
+ tabsWrapper.appendChild(tabContent);
238
+ tabContent.style.display = '';
239
+ });
240
+
241
+ // Keep active tab index to set initial carousel slide
242
+ const tab = this._activeTabLink.parentElement;
243
+ const activeTabIndex = Array.from(tab.parentNode.children).indexOf(tab);
244
+
245
+ this._tabsCarousel = Carousel.init(tabsWrapper, {
246
+ fullWidth: true,
247
+ noWrap: true,
248
+ onCycleTo: (item) => {
249
+ const prevIndex = this._index;
250
+ this._index = Array.from(item.parentNode.children).indexOf(item);
251
+ this._activeTabLink.classList.remove('active');
252
+ this._activeTabLink = Array.from(this._tabLinks)[this._index];
253
+ this._activeTabLink.classList.add('active');
254
+ this._animateIndicator(prevIndex);
255
+ if (typeof this.options.onShow === 'function')
256
+ this.options.onShow.call(this, this._content);
257
+ }
258
+ });
259
+ // Set initial carousel slide to active tab
260
+ this._tabsCarousel.set(activeTabIndex);
261
+ }
221
262
 
222
- _setupNormalTabs() {
223
- // Hide Tabs Content
224
- Array.from(this._tabLinks).forEach(a => {
225
- if (a === this._activeTabLink) return;
226
- if ((<HTMLAnchorElement>a).hash) {
227
- const currContent = document.querySelector((<HTMLAnchorElement>a).hash);
228
- if (currContent) (<HTMLElement>currContent).style.display = 'none';
229
- }
230
- });
231
- }
263
+ _teardownSwipeableTabs() {
264
+ const tabsWrapper = this._tabsCarousel.el;
265
+ this._tabsCarousel.destroy();
266
+ // Unwrap
267
+ tabsWrapper.after(tabsWrapper.children);
268
+ tabsWrapper.remove();
269
+ }
232
270
 
233
- _teardownNormalTabs() {
234
- // show Tabs Content
235
- this._tabLinks.forEach(a => {
236
- if (a.hash) {
237
- const currContent = document.querySelector(a.hash);
238
- if (currContent) currContent.style.display = '';
239
- }
240
- });
241
- }
271
+ _setupNormalTabs() {
272
+ // Hide Tabs Content
273
+ Array.from(this._tabLinks).forEach((a) => {
274
+ if (a === this._activeTabLink) return;
275
+ if ((<HTMLAnchorElement>a).hash) {
276
+ const currContent = document.querySelector((<HTMLAnchorElement>a).hash);
277
+ if (currContent) (<HTMLElement>currContent).style.display = 'none';
278
+ }
279
+ });
280
+ }
242
281
 
243
- _setTabsAndTabWidth() {
244
- this._tabsWidth = this.el.getBoundingClientRect().width;
245
- this._tabWidth = Math.max(this._tabsWidth, this.el.scrollWidth) / this._tabLinks.length;
246
- }
282
+ _teardownNormalTabs() {
283
+ // show Tabs Content
284
+ this._tabLinks.forEach((a) => {
285
+ if (a.hash) {
286
+ const currContent = document.querySelector(a.hash) as HTMLElement;
287
+ if (currContent) currContent.style.display = '';
288
+ }
289
+ });
290
+ }
247
291
 
248
- _calcRightPos(el) {
249
- return Math.ceil(this._tabsWidth - el.offsetLeft - el.getBoundingClientRect().width);
250
- }
292
+ _setTabsAndTabWidth() {
293
+ this._tabsWidth = this.el.getBoundingClientRect().width;
294
+ this._tabWidth = Math.max(this._tabsWidth, this.el.scrollWidth) / this._tabLinks.length;
295
+ }
251
296
 
252
- _calcLeftPos(el) {
253
- return Math.floor(el.offsetLeft);
254
- }
297
+ _calcRightPos(el) {
298
+ return Math.ceil(this._tabsWidth - el.offsetLeft - el.getBoundingClientRect().width);
299
+ }
255
300
 
256
- updateTabIndicator() {
257
- this._setTabsAndTabWidth();
258
- this._animateIndicator(this._index);
259
- }
301
+ _calcLeftPos(el) {
302
+ return Math.floor(el.offsetLeft);
303
+ }
260
304
 
261
- _animateIndicator(prevIndex) {
262
- let leftDelay = 0, rightDelay = 0;
263
-
264
- if (this._index - prevIndex >= 0)
265
- leftDelay = 90;
266
- else
267
- rightDelay = 90;
268
-
269
- const animOptions = {
270
- targets: this._indicator,
271
- left: {
272
- value: this._calcLeftPos(this._activeTabLink),
273
- delay: leftDelay
274
- },
275
- right: {
276
- value: this._calcRightPos(this._activeTabLink),
277
- delay: rightDelay
278
- },
279
- duration: this.options.duration,
280
- easing: 'easeOutQuad'
281
- };
282
- anim.remove(this._indicator);
283
- anim(animOptions);
284
- }
305
+ /**
306
+ * Recalculate tab indicator position. This is useful when
307
+ * the indicator position is not correct.
308
+ */
309
+ updateTabIndicator() {
310
+ this._setTabsAndTabWidth();
311
+ this._animateIndicator(this._index);
312
+ }
285
313
 
286
- select(tabId) {
287
- const tab = Array.from(this._tabLinks).find((a: HTMLAnchorElement) => a.getAttribute('href') === '#'+tabId);
288
- if (tab) (<HTMLAnchorElement>tab).click();
289
- }
314
+ _animateIndicator(prevIndex) {
315
+ let leftDelay = 0, rightDelay = 0;
316
+
317
+ if (this._index - prevIndex >= 0)
318
+ leftDelay = 90;
319
+ else
320
+ rightDelay = 90;
321
+
322
+ const animOptions = {
323
+ targets: this._indicator,
324
+ left: {
325
+ value: this._calcLeftPos(this._activeTabLink),
326
+ delay: leftDelay
327
+ },
328
+ right: {
329
+ value: this._calcRightPos(this._activeTabLink),
330
+ delay: rightDelay
331
+ },
332
+ duration: this.options.duration,
333
+ easing: 'easeOutQuad'
334
+ };
335
+ anim.remove(this._indicator);
336
+ anim(animOptions);
337
+ }
338
+
339
+ /**
340
+ * Show tab content that corresponds to the tab with the id.
341
+ * @param tabId The id of the tab that you want to switch to.
342
+ */
343
+ select(tabId: string) {
344
+ const tab = Array.from(this._tabLinks).find((a: HTMLAnchorElement) => a.getAttribute('href') === '#'+tabId);
345
+ if (tab) (<HTMLAnchorElement>tab).click();
290
346
  }
347
+ }