@materializecss/materialize 1.2.2 → 2.0.1-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 (90) hide show
  1. package/Gruntfile.js +68 -313
  2. package/README.md +26 -14
  3. package/dist/css/materialize.css +1009 -1822
  4. package/dist/css/materialize.min.css +2 -8
  5. package/dist/js/materialize.js +8414 -12299
  6. package/dist/js/materialize.min.js +8968 -2
  7. package/dist/js/materialize.min.js.map +1 -0
  8. package/package.json +13 -9
  9. package/sass/components/_badges.scss +12 -2
  10. package/sass/components/_buttons.scss +16 -11
  11. package/sass/components/_cards.scss +14 -9
  12. package/sass/components/_carousel.scss +5 -2
  13. package/sass/components/_chips.scss +3 -3
  14. package/sass/components/_collapsible.scss +22 -8
  15. package/sass/components/_collection.scss +14 -6
  16. package/sass/components/_datepicker.scss +30 -11
  17. package/sass/components/_dropdown.scss +6 -4
  18. package/sass/components/_global.scss +132 -111
  19. package/sass/components/_grid.scss +119 -98
  20. package/sass/components/_modal.scss +3 -3
  21. package/sass/components/_navbar.scss +31 -17
  22. package/sass/components/_normalize.scss +26 -124
  23. package/sass/components/_sidenav.scss +21 -20
  24. package/sass/components/_slider.scss +27 -7
  25. package/sass/components/_table_of_contents.scss +12 -12
  26. package/sass/components/_tabs.scss +47 -16
  27. package/sass/components/_tapTarget.scss +6 -6
  28. package/sass/components/_theme_variables.scss +98 -0
  29. package/sass/components/_timepicker.scss +54 -46
  30. package/sass/components/_toast.scss +3 -3
  31. package/sass/components/_tooltip.scss +4 -5
  32. package/sass/components/_typography.scss +1 -1
  33. package/sass/components/_variables.scss +185 -120
  34. package/sass/components/forms/_checkboxes.scss +9 -9
  35. package/sass/components/forms/_file-input.scss +9 -7
  36. package/sass/components/forms/_input-fields.scss +173 -234
  37. package/sass/components/forms/_radio-buttons.scss +1 -1
  38. package/sass/components/forms/_range.scss +11 -11
  39. package/sass/components/forms/_select.scss +29 -19
  40. package/sass/components/forms/_switches.scss +22 -18
  41. package/sass/materialize.scss +1 -1
  42. package/src/autocomplete.ts +459 -0
  43. package/src/bounding.ts +6 -0
  44. package/{js/buttons.js → src/buttons.ts} +103 -162
  45. package/src/cards.ts +54 -0
  46. package/{js/carousel.js → src/carousel.ts} +137 -262
  47. package/src/characterCounter.ts +88 -0
  48. package/src/chips.ts +350 -0
  49. package/src/collapsible.ts +184 -0
  50. package/{js/component.js → src/component.ts} +6 -19
  51. package/{js/datepicker.js → src/datepicker.ts} +213 -299
  52. package/{js/dropdown.js → src/dropdown.ts} +140 -254
  53. package/src/edges.ts +6 -0
  54. package/src/forms.ts +120 -0
  55. package/src/global.ts +385 -0
  56. package/src/materialbox.ts +348 -0
  57. package/src/modal.ts +256 -0
  58. package/{js/parallax.js → src/parallax.ts} +47 -60
  59. package/{js/pushpin.js → src/pushpin.ts} +19 -47
  60. package/{js/range.js → src/range.ts} +58 -139
  61. package/{js/scrollspy.js → src/scrollspy.ts} +81 -153
  62. package/src/select.ts +448 -0
  63. package/{js/sidenav.js → src/sidenav.ts} +96 -202
  64. package/src/slider.ts +415 -0
  65. package/src/tabs.ts +293 -0
  66. package/src/tapTarget.ts +240 -0
  67. package/{js/timepicker.js → src/timepicker.ts} +268 -272
  68. package/{js/toasts.js → src/toasts.ts} +75 -134
  69. package/{js/tooltip.js → src/tooltip.ts} +59 -96
  70. package/src/waves.ts +70 -0
  71. package/extras/noUiSlider/nouislider.css +0 -404
  72. package/extras/noUiSlider/nouislider.js +0 -2147
  73. package/extras/noUiSlider/nouislider.min.js +0 -1
  74. package/js/anime.min.js +0 -34
  75. package/js/autocomplete.js +0 -479
  76. package/js/cards.js +0 -40
  77. package/js/cash.js +0 -960
  78. package/js/characterCounter.js +0 -136
  79. package/js/chips.js +0 -486
  80. package/js/collapsible.js +0 -275
  81. package/js/forms.js +0 -285
  82. package/js/global.js +0 -428
  83. package/js/materialbox.js +0 -453
  84. package/js/modal.js +0 -382
  85. package/js/select.js +0 -391
  86. package/js/slider.js +0 -497
  87. package/js/tabs.js +0 -402
  88. package/js/tapTarget.js +0 -315
  89. package/js/waves.js +0 -615
  90. package/sass/components/_waves.scss +0 -187
@@ -1,9 +1,6 @@
1
- (function($, anim) {
2
- 'use strict';
1
+ import anim from "animejs";
3
2
 
4
- let _defaults = {
5
- html: '',
6
- unsafeHTML: '',
3
+ let _defaults = {
7
4
  text: '',
8
5
  displayLength: 4000,
9
6
  inDuration: 300,
@@ -13,46 +10,46 @@
13
10
  activationPercent: 0.8
14
11
  };
15
12
 
16
- class Toast {
17
- constructor(options) {
18
- /**
19
- * Options for the toast
20
- * @member Toast#options
21
- */
22
- this.options = $.extend({}, Toast.defaults, options);
23
- this.htmlMessage = this.options.html;
13
+ export class Toast {
14
+ static _toasts: Toast[];
15
+ static _container: any;
16
+ static _draggedToast: Toast;
17
+ options: any;
18
+ message: string;
19
+ panning: boolean;
20
+ timeRemaining: number;
21
+ el: HTMLDivElement;
22
+ counterInterval: NodeJS.Timeout;
23
+ wasSwiped: any;
24
+ startingXPos: number;
25
+ xPos: any;
26
+ time: number;
27
+ deltaX: number;
28
+ velocityX: number;
29
+
30
+ constructor(options: any) {
31
+ this.options = {...Toast.defaults, ...options};
32
+ //this.htmlMessage = this.options.html;
24
33
  // Warn when using html
25
- if (!!this.options.html)
26
- console.warn(
27
- 'The html option is deprecated and will be removed in the future. See https://github.com/materializecss/materialize/pull/49'
28
- );
34
+ // if (!!this.options.html)
35
+ // console.warn(
36
+ // 'The html option is deprecated and will be removed in the future. See https://github.com/materializecss/materialize/pull/49'
37
+ // );
29
38
  // If the new unsafeHTML is used, prefer that
30
- if (!!this.options.unsafeHTML) {
31
- this.htmlMessage = this.options.unsafeHTML;
32
- }
39
+ // if (!!this.options.unsafeHTML) {
40
+ // this.htmlMessage = this.options.unsafeHTML;
41
+ // }
33
42
  this.message = this.options.text;
34
-
35
- /**
36
- * Describes current pan state toast
37
- * @type {Boolean}
38
- */
39
43
  this.panning = false;
40
-
41
- /**
42
- * Time remaining until toast is removed
43
- */
44
44
  this.timeRemaining = this.options.displayLength;
45
-
46
45
  if (Toast._toasts.length === 0) {
47
46
  Toast._createContainer();
48
47
  }
49
-
50
48
  // Create new toast
51
49
  Toast._toasts.push(this);
52
50
  let toastElement = this._createToast();
53
- toastElement.M_Toast = this;
51
+ (toastElement as any).M_Toast = this;
54
52
  this.el = toastElement;
55
- this.$el = $(toastElement);
56
53
  this._animateIn();
57
54
  this._setTimer();
58
55
  }
@@ -61,54 +58,36 @@
61
58
  return _defaults;
62
59
  }
63
60
 
64
- /**
65
- * Get Instance
66
- */
67
61
  static getInstance(el) {
68
62
  let domElem = !!el.jquery ? el[0] : el;
69
63
  return domElem.M_Toast;
70
64
  }
71
65
 
72
- /**
73
- * Append toast container and add event handlers
74
- */
75
66
  static _createContainer() {
76
- let container = document.createElement('div');
67
+ const container = document.createElement('div');
77
68
  container.setAttribute('id', 'toast-container');
78
-
79
69
  // Add event handler
80
70
  container.addEventListener('touchstart', Toast._onDragStart);
81
71
  container.addEventListener('touchmove', Toast._onDragMove);
82
72
  container.addEventListener('touchend', Toast._onDragEnd);
83
-
84
73
  container.addEventListener('mousedown', Toast._onDragStart);
85
74
  document.addEventListener('mousemove', Toast._onDragMove);
86
75
  document.addEventListener('mouseup', Toast._onDragEnd);
87
-
88
76
  document.body.appendChild(container);
89
77
  Toast._container = container;
90
78
  }
91
79
 
92
- /**
93
- * Remove toast container and event handlers
94
- */
95
80
  static _removeContainer() {
96
- // Add event handler
97
81
  document.removeEventListener('mousemove', Toast._onDragMove);
98
82
  document.removeEventListener('mouseup', Toast._onDragEnd);
99
-
100
- $(Toast._container).remove();
83
+ Toast._container.remove();
101
84
  Toast._container = null;
102
85
  }
103
86
 
104
- /**
105
- * Begin drag handler
106
- * @param {Event} e
107
- */
108
87
  static _onDragStart(e) {
109
- if (e.target && $(e.target).closest('.toast').length) {
110
- let $toast = $(e.target).closest('.toast');
111
- let toast = $toast[0].M_Toast;
88
+ if (e.target && (<HTMLElement>e.target).closest('.toast')) {
89
+ const toastElem = (<HTMLElement>e.target).closest('.toast');
90
+ const toast: Toast = (toastElem as any).M_Toast;
112
91
  toast.panning = true;
113
92
  Toast._draggedToast = toast;
114
93
  toast.el.classList.add('panning');
@@ -119,29 +98,22 @@
119
98
  }
120
99
  }
121
100
 
122
- /**
123
- * Drag move handler
124
- * @param {Event} e
125
- */
126
101
  static _onDragMove(e) {
127
102
  if (!!Toast._draggedToast) {
128
103
  e.preventDefault();
129
- let toast = Toast._draggedToast;
104
+ const toast = Toast._draggedToast;
130
105
  toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
131
106
  toast.xPos = Toast._xPos(e);
132
107
  toast.velocityX = toast.deltaX / (Date.now() - toast.time);
133
108
  toast.time = Date.now();
134
109
 
135
- let totalDeltaX = toast.xPos - toast.startingXPos;
136
- let activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
110
+ const totalDeltaX = toast.xPos - toast.startingXPos;
111
+ const activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
137
112
  toast.el.style.transform = `translateX(${totalDeltaX}px)`;
138
- toast.el.style.opacity = 1 - Math.abs(totalDeltaX / activationDistance);
113
+ toast.el.style.opacity = (1 - Math.abs(totalDeltaX / activationDistance)).toString();
139
114
  }
140
115
  }
141
116
 
142
- /**
143
- * End drag handler
144
- */
145
117
  static _onDragEnd() {
146
118
  if (!!Toast._draggedToast) {
147
119
  let toast = Toast._draggedToast;
@@ -156,9 +128,9 @@
156
128
  if (shouldBeDismissed) {
157
129
  toast.wasSwiped = true;
158
130
  toast.dismiss();
159
-
160
131
  // Animate toast back to original position
161
- } else {
132
+ }
133
+ else {
162
134
  toast.el.style.transition = 'transform .2s, opacity .2s';
163
135
  toast.el.style.transform = '';
164
136
  toast.el.style.opacity = '';
@@ -167,10 +139,6 @@
167
139
  }
168
140
  }
169
141
 
170
- /**
171
- * Get x position of mouse or touch event
172
- * @param {Event} e
173
- */
174
142
  static _xPos(e) {
175
143
  if (e.targetTouches && e.targetTouches.length >= 1) {
176
144
  return e.targetTouches[0].clientX;
@@ -179,59 +147,53 @@
179
147
  return e.clientX;
180
148
  }
181
149
 
182
- /**
183
- * Remove all toasts
184
- */
185
150
  static dismissAll() {
186
151
  for (let toastIndex in Toast._toasts) {
187
152
  Toast._toasts[toastIndex].dismiss();
188
153
  }
189
154
  }
190
155
 
191
- /**
192
- * Create toast and append it to toast container
193
- */
194
156
  _createToast() {
195
- let toast = document.createElement('div');
157
+ const toast = document.createElement('div');
196
158
  toast.classList.add('toast');
197
159
  toast.setAttribute('role', 'alert');
198
160
  toast.setAttribute('aria-live', 'assertive');
199
- toast.setAttribute('aria-atomic', true);
161
+ toast.setAttribute('aria-atomic', 'true');
200
162
 
201
163
  // Add custom classes onto toast
202
- if (!!this.options.classes.length) {
203
- $(toast).addClass(this.options.classes);
164
+ if (this.options.classes.length > 0) {
165
+ toast.classList.add(...this.options.classes.split(' '));
204
166
  }
205
167
 
206
168
  // Set safe text content
207
- toast.textContent = this.message;
208
- if (
209
- typeof HTMLElement === 'object'
210
- ? this.htmlMessage instanceof HTMLElement
211
- : this.htmlMessage &&
212
- typeof this.htmlMessage === 'object' &&
213
- this.htmlMessage !== null &&
214
- this.htmlMessage.nodeType === 1 &&
215
- typeof this.htmlMessage.nodeName === 'string'
216
- ) {
217
- //if the htmlMessage is an HTML node, append it directly
218
- toast.appendChild(this.htmlMessage);
219
- } else if (!!this.htmlMessage.jquery) {
220
- // Check if it is jQuery object, append the node
221
- $(toast).append(this.htmlMessage[0]);
222
- } else {
223
- // Append as unsanitized html;
224
- $(toast).append(this.htmlMessage);
225
- }
169
+ toast.innerText = this.message;
170
+
171
+ // if (
172
+ // typeof HTMLElement === 'object'
173
+ // ? this.htmlMessage instanceof HTMLElement
174
+ // : this.htmlMessage &&
175
+ // typeof this.htmlMessage === 'object' &&
176
+ // this.htmlMessage !== null &&
177
+ // this.htmlMessage.nodeType === 1 &&
178
+ // typeof this.htmlMessage.nodeName === 'string'
179
+ // ) {
180
+ // //if the htmlMessage is an HTML node, append it directly
181
+ // toast.appendChild(this.htmlMessage);
182
+ // }
183
+ // else if (!!this.htmlMessage.jquery) {
184
+ // // Check if it is jQuery object, append the node
185
+ // $(toast).append(this.htmlMessage[0]);
186
+ // }
187
+ // else {
188
+ // // Append as unsanitized html;
189
+ // $(toast).append(this.htmlMessage);
190
+ // }
226
191
 
227
192
  // Append toast
228
193
  Toast._container.appendChild(toast);
229
194
  return toast;
230
195
  }
231
196
 
232
- /**
233
- * Animate in toast
234
- */
235
197
  _animateIn() {
236
198
  // Animate toast in
237
199
  anim({
@@ -254,7 +216,6 @@
254
216
  if (!this.panning) {
255
217
  this.timeRemaining -= 20;
256
218
  }
257
-
258
219
  // Animate toast out
259
220
  if (this.timeRemaining <= 0) {
260
221
  this.dismiss();
@@ -273,7 +234,7 @@
273
234
  if (this.wasSwiped) {
274
235
  this.el.style.transition = 'transform .05s, opacity .05s';
275
236
  this.el.style.transform = `translateX(${activationDistance}px)`;
276
- this.el.style.opacity = 0;
237
+ this.el.style.opacity = '0';
277
238
  }
278
239
 
279
240
  anim({
@@ -288,7 +249,7 @@
288
249
  this.options.completeCallback();
289
250
  }
290
251
  // Remove toast from DOM
291
- this.$el.remove();
252
+ this.el.remove();
292
253
  Toast._toasts.splice(Toast._toasts.indexOf(this), 1);
293
254
  if (Toast._toasts.length === 0) {
294
255
  Toast._removeContainer();
@@ -296,30 +257,10 @@
296
257
  }
297
258
  });
298
259
  }
299
- }
300
-
301
- /**
302
- * @static
303
- * @memberof Toast
304
- * @type {Array.<Toast>}
305
- */
306
- Toast._toasts = [];
307
-
308
- /**
309
- * @static
310
- * @memberof Toast
311
- */
312
- Toast._container = null;
313
260
 
314
- /**
315
- * @static
316
- * @memberof Toast
317
- * @type {Toast}
318
- */
319
- Toast._draggedToast = null;
320
-
321
- M.Toast = Toast;
322
- M.toast = function(options) {
323
- return new Toast(options);
324
- };
325
- })(cash, M.anime);
261
+ static {
262
+ Toast._toasts = [];
263
+ Toast._container = null;
264
+ Toast._draggedToast = null;
265
+ }
266
+ }
@@ -1,12 +1,14 @@
1
- (function($, anim) {
2
- 'use strict';
1
+ import { Component } from "./component";
2
+ import { M } from "./global";
3
+ import anim from "animejs";
4
+ import { Bounding } from "./bounding";
3
5
 
4
- let _defaults = {
6
+ const _defaults = {
5
7
  exitDelay: 200,
6
8
  enterDelay: 0,
7
- html: null,
9
+ //html: null,
8
10
  text: '',
9
- unsafeHTML: null,
11
+ //unsafeHTML: null,
10
12
  margin: 5,
11
13
  inDuration: 250,
12
14
  outDuration: 200,
@@ -14,23 +16,24 @@
14
16
  transitionMovement: 10
15
17
  };
16
18
 
17
- /**
18
- * @class
19
- *
20
- */
21
- class Tooltip extends Component {
22
- /**
23
- * Construct Tooltip instance
24
- * @constructor
25
- * @param {Element} el
26
- * @param {Object} options
27
- */
19
+ export class Tooltip extends Component {
20
+ isOpen: boolean;
21
+ isHovered: boolean;
22
+ isFocused: boolean;
23
+ tooltipEl: HTMLElement;
24
+ private _handleMouseEnterBound: any;
25
+ private _handleMouseLeaveBound: any;
26
+ private _handleFocusBound: any;
27
+ private _handleBlurBound: any;
28
+ private _exitDelayTimeout: string | number | NodeJS.Timeout;
29
+ private _enterDelayTimeout: string | number | NodeJS.Timeout;
30
+ xMovement: number;
31
+ yMovement: number;
32
+
28
33
  constructor(el, options) {
29
34
  super(Tooltip, el, options);
30
-
31
- this.el.M_Tooltip = this;
32
- this.options = $.extend({}, Tooltip.defaults, options);
33
-
35
+ (this.el as any).M_Tooltip = this;
36
+ this.options = {...Tooltip.defaults, ...options};
34
37
  this.isOpen = false;
35
38
  this.isHovered = false;
36
39
  this.isFocused = false;
@@ -46,38 +49,31 @@
46
49
  return super.init(this, els, options);
47
50
  }
48
51
 
49
- /**
50
- * Get Instance
51
- */
52
52
  static getInstance(el) {
53
- let domElem = !!el.jquery ? el[0] : el;
53
+ const domElem = !!el.jquery ? el[0] : el;
54
54
  return domElem.M_Tooltip;
55
55
  }
56
56
 
57
- /**
58
- * Teardown component
59
- */
60
57
  destroy() {
61
- $(this.tooltipEl).remove();
58
+ this.tooltipEl.remove();
62
59
  this._removeEventHandlers();
63
- this.el.M_Tooltip = undefined;
60
+ (this.el as any).M_Tooltip = undefined;
64
61
  }
65
62
 
66
63
  _appendTooltipEl() {
67
- let tooltipEl = document.createElement('div');
68
- tooltipEl.classList.add('material-tooltip');
69
- this.tooltipEl = tooltipEl;
64
+ this.tooltipEl = document.createElement('div');
65
+ this.tooltipEl.classList.add('material-tooltip');
70
66
 
71
- let tooltipContentEl = document.createElement('div');
67
+ const tooltipContentEl = document.createElement('div');
72
68
  tooltipContentEl.classList.add('tooltip-content');
73
69
  this._setTooltipContent(tooltipContentEl);
74
-
75
- tooltipEl.appendChild(tooltipContentEl);
76
- document.body.appendChild(tooltipEl);
70
+ this.tooltipEl.appendChild(tooltipContentEl);
71
+ document.body.appendChild(this.tooltipEl);
77
72
  }
78
73
 
79
- _setTooltipContent(tooltipContentEl) {
80
- tooltipContentEl.textContent = this.options.text;
74
+ _setTooltipContent(tooltipContentEl: HTMLElement) {
75
+ tooltipContentEl.innerText = this.options.text;
76
+ /*
81
77
  if (!!this.options.html) {
82
78
  // Warn when using html
83
79
  console.warn(
@@ -88,6 +84,7 @@
88
84
  if (!!this.options.unsafeHTML) {
89
85
  $(tooltipContentEl).append(this.options.unsafeHTML);
90
86
  }
87
+ */
91
88
  }
92
89
 
93
90
  _updateTooltipContent() {
@@ -113,75 +110,52 @@
113
110
  }
114
111
 
115
112
  open(isManual) {
116
- if (this.isOpen) {
117
- return;
118
- }
113
+ if (this.isOpen) return;
119
114
  isManual = isManual === undefined ? true : undefined; // Default value true
120
115
  this.isOpen = true;
121
116
  // Update tooltip content with HTML attribute options
122
- this.options = $.extend({}, this.options, this._getAttributeOptions());
117
+ this.options = {...this.options, ...this._getAttributeOptions()};
123
118
  this._updateTooltipContent();
124
119
  this._setEnterDelayTimeout(isManual);
125
120
  }
126
121
 
127
122
  close() {
128
- if (!this.isOpen) {
129
- return;
130
- }
131
-
123
+ if (!this.isOpen) return;
132
124
  this.isHovered = false;
133
125
  this.isFocused = false;
134
126
  this.isOpen = false;
135
127
  this._setExitDelayTimeout();
136
128
  }
137
129
 
138
- /**
139
- * Create timeout which delays when the tooltip closes
140
- */
141
130
  _setExitDelayTimeout() {
142
131
  clearTimeout(this._exitDelayTimeout);
143
-
144
132
  this._exitDelayTimeout = setTimeout(() => {
145
- if (this.isHovered || this.isFocused) {
146
- return;
147
- }
148
-
133
+ if (this.isHovered || this.isFocused) return;
149
134
  this._animateOut();
150
135
  }, this.options.exitDelay);
151
136
  }
152
137
 
153
- /**
154
- * Create timeout which delays when the toast closes
155
- */
156
138
  _setEnterDelayTimeout(isManual) {
157
139
  clearTimeout(this._enterDelayTimeout);
158
-
159
140
  this._enterDelayTimeout = setTimeout(() => {
160
- if (!this.isHovered && !this.isFocused && !isManual) {
161
- return;
162
- }
163
-
141
+ if (!this.isHovered && !this.isFocused && !isManual) return;
164
142
  this._animateIn();
165
143
  }, this.options.enterDelay);
166
144
  }
167
145
 
168
146
  _positionTooltip() {
169
- let origin = this.el,
170
- tooltip = this.tooltipEl,
147
+ const tooltip: HTMLElement = this.tooltipEl;
148
+ const origin = (this.el as HTMLElement),
171
149
  originHeight = origin.offsetHeight,
172
150
  originWidth = origin.offsetWidth,
173
151
  tooltipHeight = tooltip.offsetHeight,
174
152
  tooltipWidth = tooltip.offsetWidth,
175
- newCoordinates,
176
- margin = this.options.margin,
177
- targetTop,
178
- targetLeft;
153
+ margin = this.options.margin;
179
154
 
180
155
  (this.xMovement = 0), (this.yMovement = 0);
181
156
 
182
- targetTop = origin.getBoundingClientRect().top + M.getDocumentScrollTop();
183
- targetLeft = origin.getBoundingClientRect().left + M.getDocumentScrollLeft();
184
-
157
+ let targetTop = origin.getBoundingClientRect().top + M.getDocumentScrollTop();
158
+ let targetLeft = origin.getBoundingClientRect().left + M.getDocumentScrollLeft();
185
159
  if (this.options.position === 'top') {
186
160
  targetTop += -tooltipHeight - margin;
187
161
  targetLeft += originWidth / 2 - tooltipWidth / 2;
@@ -200,46 +174,42 @@
200
174
  this.yMovement = this.options.transitionMovement;
201
175
  }
202
176
 
203
- newCoordinates = this._repositionWithinScreen(
177
+ const newCoordinates = this._repositionWithinScreen(
204
178
  targetLeft,
205
179
  targetTop,
206
180
  tooltipWidth,
207
181
  tooltipHeight
208
182
  );
209
- $(tooltip).css({
210
- top: newCoordinates.y + 'px',
211
- left: newCoordinates.x + 'px'
212
- });
183
+
184
+ tooltip.style.top = newCoordinates.y+'px';
185
+ tooltip.style.left = newCoordinates.x+'px';
213
186
  }
214
187
 
215
188
  _repositionWithinScreen(x, y, width, height) {
216
- let scrollLeft = M.getDocumentScrollLeft();
217
- let scrollTop = M.getDocumentScrollTop();
189
+ const scrollLeft = M.getDocumentScrollLeft();
190
+ const scrollTop = M.getDocumentScrollTop();
218
191
  let newX = x - scrollLeft;
219
192
  let newY = y - scrollTop;
220
193
 
221
- let bounding = {
194
+ const bounding: Bounding = {
222
195
  left: newX,
223
196
  top: newY,
224
197
  width: width,
225
198
  height: height
226
199
  };
227
-
228
- let offset = this.options.margin + this.options.transitionMovement;
229
- let edges = M.checkWithinContainer(document.body, bounding, offset);
200
+ const offset = this.options.margin + this.options.transitionMovement;
201
+ const edges = M.checkWithinContainer(document.body, bounding, offset);
230
202
 
231
203
  if (edges.left) {
232
204
  newX = offset;
233
205
  } else if (edges.right) {
234
206
  newX -= newX + width - window.innerWidth;
235
207
  }
236
-
237
208
  if (edges.top) {
238
209
  newY = offset;
239
210
  } else if (edges.bottom) {
240
211
  newY -= newY + height - window.innerHeight;
241
212
  }
242
-
243
213
  return {
244
214
  x: newX + scrollLeft,
245
215
  y: newY + scrollTop
@@ -297,24 +267,17 @@
297
267
  }
298
268
 
299
269
  _getAttributeOptions() {
300
- let attributeOptions = {};
301
- let tooltipTextOption = this.el.getAttribute('data-tooltip');
302
- let positionOption = this.el.getAttribute('data-position');
303
-
270
+ const attributeOptions = {};
271
+ const tooltipTextOption = this.el.getAttribute('data-tooltip');
272
+ const positionOption = this.el.getAttribute('data-position');
304
273
  if (tooltipTextOption) {
305
- attributeOptions.text = tooltipTextOption;
274
+ (attributeOptions as any).text = tooltipTextOption;
306
275
  }
307
-
308
276
  if (positionOption) {
309
- attributeOptions.position = positionOption;
277
+ (attributeOptions as any).position = positionOption;
310
278
  }
311
279
  return attributeOptions;
312
280
  }
313
281
  }
314
282
 
315
- M.Tooltip = Tooltip;
316
283
 
317
- if (M.jQueryLoaded) {
318
- M.initializeJqueryWrapper(Tooltip, 'tooltip', 'M_Tooltip');
319
- }
320
- })(cash, M.anime);