@materializecss/materialize 2.0.3-beta → 2.0.4

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 (66) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +16 -18
  3. package/dist/css/materialize.css +73 -26
  4. package/dist/css/materialize.min.css +3 -3
  5. package/dist/js/materialize.js +560 -2015
  6. package/dist/js/materialize.min.js +3 -3
  7. package/dist/js/materialize.min.js.map +1 -1
  8. package/dist/src/buttons.d.ts.map +1 -1
  9. package/dist/src/cards.d.ts.map +1 -1
  10. package/dist/src/collapsible.d.ts +1 -0
  11. package/dist/src/collapsible.d.ts.map +1 -1
  12. package/dist/src/dropdown.d.ts +1 -0
  13. package/dist/src/dropdown.d.ts.map +1 -1
  14. package/dist/src/global.d.ts.map +1 -1
  15. package/dist/src/materialbox.d.ts +14 -10
  16. package/dist/src/materialbox.d.ts.map +1 -1
  17. package/dist/src/modal.d.ts.map +1 -1
  18. package/dist/src/range.d.ts.map +1 -1
  19. package/dist/src/scrollspy.d.ts.map +1 -1
  20. package/dist/src/sidenav.d.ts +25 -25
  21. package/dist/src/sidenav.d.ts.map +1 -1
  22. package/dist/src/slider.d.ts +12 -12
  23. package/dist/src/slider.d.ts.map +1 -1
  24. package/dist/src/tabs.d.ts +1 -1
  25. package/dist/src/tabs.d.ts.map +1 -1
  26. package/dist/src/toasts.d.ts +7 -2
  27. package/dist/src/toasts.d.ts.map +1 -1
  28. package/dist/src/tooltip.d.ts.map +1 -1
  29. package/package.json +29 -44
  30. package/sass/components/_collapsible.scss +14 -2
  31. package/sass/components/_materialbox.scss +2 -2
  32. package/sass/components/_modal.scss +0 -1
  33. package/sass/components/_tooltip.scss +18 -8
  34. package/sass/components/_variables.scss +2 -2
  35. package/Gruntfile.js +0 -385
  36. package/src/autocomplete.ts +0 -553
  37. package/src/bounding.ts +0 -6
  38. package/src/buttons.ts +0 -260
  39. package/src/cards.ts +0 -53
  40. package/src/carousel.ts +0 -676
  41. package/src/characterCounter.ts +0 -117
  42. package/src/chips.ts +0 -439
  43. package/src/collapsible.ts +0 -249
  44. package/src/component.ts +0 -120
  45. package/src/datepicker.ts +0 -1076
  46. package/src/dropdown.ts +0 -644
  47. package/src/edges.ts +0 -6
  48. package/src/forms.ts +0 -132
  49. package/src/global.ts +0 -114
  50. package/src/index.ts +0 -26
  51. package/src/materialbox.ts +0 -404
  52. package/src/modal.ts +0 -341
  53. package/src/parallax.ts +0 -149
  54. package/src/pushpin.ts +0 -165
  55. package/src/range.ts +0 -198
  56. package/src/scrollspy.ts +0 -263
  57. package/src/select.ts +0 -484
  58. package/src/sidenav.ts +0 -543
  59. package/src/slider.ts +0 -474
  60. package/src/tabs.ts +0 -347
  61. package/src/tapTarget.ts +0 -273
  62. package/src/timepicker.ts +0 -832
  63. package/src/toasts.ts +0 -290
  64. package/src/tooltip.ts +0 -366
  65. package/src/utils.ts +0 -271
  66. package/src/waves.ts +0 -70
package/src/toasts.ts DELETED
@@ -1,290 +0,0 @@
1
- import anim from "animejs";
2
-
3
- import { BaseOptions } from "./component";
4
-
5
- export interface ToastOptions extends BaseOptions {
6
- /**
7
- * The content of the Toast.
8
- * @default ""
9
- */
10
- text: string;
11
- /**
12
- * Length in ms the Toast stays before dismissal.
13
- * @default 4000
14
- */
15
- displayLength: number;
16
- /**
17
- * Transition in duration in milliseconds.
18
- * @default 300
19
- */
20
- inDuration: number;
21
- /**
22
- * Transition out duration in milliseconds.
23
- * @default 375
24
- */
25
- outDuration: number;
26
- /**
27
- * Classes to be added to the toast element.
28
- * @default ""
29
- */
30
- classes: string;
31
- /**
32
- * Callback function called when toast is dismissed.
33
- * @default null
34
- */
35
- completeCallback: () => void;
36
- /**
37
- * The percentage of the toast's width it takes fora drag
38
- * to dismiss a Toast.
39
- * @default 0.8
40
- */
41
- activationPercent: number;
42
- }
43
-
44
- let _defaults: ToastOptions = {
45
- text: '',
46
- displayLength: 4000,
47
- inDuration: 300,
48
- outDuration: 375,
49
- classes: '',
50
- completeCallback: null,
51
- activationPercent: 0.8
52
- };
53
-
54
- export class Toast {
55
- /** The toast element. */
56
- el: HTMLDivElement;
57
- /**
58
- * The remaining amount of time in ms that the toast
59
- * will stay before dismissal.
60
- */
61
- timeRemaining: number;
62
- /**
63
- * Describes the current pan state of the Toast.
64
- */
65
- panning: boolean;
66
- options: ToastOptions;
67
- message: string;
68
- counterInterval: NodeJS.Timeout;
69
- wasSwiped: boolean;
70
- startingXPos: number;
71
- xPos: number;
72
- time: number;
73
- deltaX: number;
74
- velocityX: number;
75
-
76
- static _toasts: Toast[];
77
- static _container: any;
78
- static _draggedToast: Toast;
79
-
80
- constructor(options: Partial<ToastOptions>) {
81
- this.options = {
82
- ...Toast.defaults,
83
- ...options
84
- };
85
- this.message = this.options.text;
86
- this.panning = false;
87
- this.timeRemaining = this.options.displayLength;
88
- if (Toast._toasts.length === 0) {
89
- Toast._createContainer();
90
- }
91
- // Create new toast
92
- Toast._toasts.push(this);
93
- let toastElement = this._createToast();
94
- (toastElement as any).M_Toast = this;
95
- this.el = toastElement;
96
- this._animateIn();
97
- this._setTimer();
98
- }
99
-
100
- static get defaults(): ToastOptions {
101
- return _defaults;
102
- }
103
-
104
- static getInstance(el: HTMLElement): Toast {
105
- return (el as any).M_Toast;
106
- }
107
-
108
- static _createContainer() {
109
- const container = document.createElement('div');
110
- container.setAttribute('id', 'toast-container');
111
- // Add event handler
112
- container.addEventListener('touchstart', Toast._onDragStart);
113
- container.addEventListener('touchmove', Toast._onDragMove);
114
- container.addEventListener('touchend', Toast._onDragEnd);
115
- container.addEventListener('mousedown', Toast._onDragStart);
116
- document.addEventListener('mousemove', Toast._onDragMove);
117
- document.addEventListener('mouseup', Toast._onDragEnd);
118
- document.body.appendChild(container);
119
- Toast._container = container;
120
- }
121
-
122
- static _removeContainer() {
123
- document.removeEventListener('mousemove', Toast._onDragMove);
124
- document.removeEventListener('mouseup', Toast._onDragEnd);
125
- Toast._container.remove();
126
- Toast._container = null;
127
- }
128
-
129
- static _onDragStart(e: TouchEvent | MouseEvent) {
130
- if (e.target && (<HTMLElement>e.target).closest('.toast')) {
131
- const toastElem = (<HTMLElement>e.target).closest('.toast');
132
- const toast: Toast = (toastElem as any).M_Toast;
133
- toast.panning = true;
134
- Toast._draggedToast = toast;
135
- toast.el.classList.add('panning');
136
- toast.el.style.transition = '';
137
- toast.startingXPos = Toast._xPos(e);
138
- toast.time = Date.now();
139
- toast.xPos = Toast._xPos(e);
140
- }
141
- }
142
-
143
- static _onDragMove(e: TouchEvent | MouseEvent) {
144
- if (!!Toast._draggedToast) {
145
- e.preventDefault();
146
- const toast = Toast._draggedToast;
147
- toast.deltaX = Math.abs(toast.xPos - Toast._xPos(e));
148
- toast.xPos = Toast._xPos(e);
149
- toast.velocityX = toast.deltaX / (Date.now() - toast.time);
150
- toast.time = Date.now();
151
-
152
- const totalDeltaX = toast.xPos - toast.startingXPos;
153
- const activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
154
- toast.el.style.transform = `translateX(${totalDeltaX}px)`;
155
- toast.el.style.opacity = (1 - Math.abs(totalDeltaX / activationDistance)).toString();
156
- }
157
- }
158
-
159
- static _onDragEnd() {
160
- if (!!Toast._draggedToast) {
161
- let toast = Toast._draggedToast;
162
- toast.panning = false;
163
- toast.el.classList.remove('panning');
164
-
165
- let totalDeltaX = toast.xPos - toast.startingXPos;
166
- let activationDistance = toast.el.offsetWidth * toast.options.activationPercent;
167
- let shouldBeDismissed = Math.abs(totalDeltaX) > activationDistance || toast.velocityX > 1;
168
-
169
- // Remove toast
170
- if (shouldBeDismissed) {
171
- toast.wasSwiped = true;
172
- toast.dismiss();
173
- // Animate toast back to original position
174
- }
175
- else {
176
- toast.el.style.transition = 'transform .2s, opacity .2s';
177
- toast.el.style.transform = '';
178
- toast.el.style.opacity = '';
179
- }
180
- Toast._draggedToast = null;
181
- }
182
- }
183
-
184
- static _xPos(e: TouchEvent | MouseEvent) {
185
- if (e.type.startsWith("touch") && (e as TouchEvent).targetTouches.length >= 1) {
186
- return (e as TouchEvent).targetTouches[0].clientX;
187
- }
188
- // mouse event
189
- return (e as MouseEvent).clientX;
190
- }
191
-
192
- /**
193
- * dismiss all toasts.
194
- */
195
- static dismissAll() {
196
- for (let toastIndex in Toast._toasts) {
197
- Toast._toasts[toastIndex].dismiss();
198
- }
199
- }
200
-
201
- _createToast() {
202
- const toast = document.createElement('div');
203
- toast.classList.add('toast');
204
- toast.setAttribute('role', 'alert');
205
- toast.setAttribute('aria-live', 'assertive');
206
- toast.setAttribute('aria-atomic', 'true');
207
-
208
- // Add custom classes onto toast
209
- if (this.options.classes.length > 0) {
210
- toast.classList.add(...this.options.classes.split(' '));
211
- }
212
-
213
- // Set text content
214
- else toast.innerText = this.message;
215
-
216
- // Append toast
217
- Toast._container.appendChild(toast);
218
- return toast;
219
- }
220
-
221
- _animateIn() {
222
- // Animate toast in
223
- anim({
224
- targets: this.el,
225
- top: 0,
226
- opacity: 1,
227
- duration: this.options.inDuration,
228
- easing: 'easeOutCubic'
229
- });
230
- }
231
-
232
- /**
233
- * Create setInterval which automatically removes toast when timeRemaining >= 0
234
- * has been reached.
235
- */
236
- _setTimer() {
237
- if (this.timeRemaining !== Infinity) {
238
- this.counterInterval = setInterval(() => {
239
- // If toast is not being dragged, decrease its time remaining
240
- if (!this.panning) {
241
- this.timeRemaining -= 20;
242
- }
243
- // Animate toast out
244
- if (this.timeRemaining <= 0) {
245
- this.dismiss();
246
- }
247
- }, 20);
248
- }
249
- }
250
-
251
- /**
252
- * Dismiss toast with animation.
253
- */
254
- dismiss() {
255
- window.clearInterval(this.counterInterval);
256
- let activationDistance = this.el.offsetWidth * this.options.activationPercent;
257
-
258
- if (this.wasSwiped) {
259
- this.el.style.transition = 'transform .05s, opacity .05s';
260
- this.el.style.transform = `translateX(${activationDistance}px)`;
261
- this.el.style.opacity = '0';
262
- }
263
-
264
- anim({
265
- targets: this.el,
266
- opacity: 0,
267
- marginTop: -40,
268
- duration: this.options.outDuration,
269
- easing: 'easeOutExpo',
270
- complete: () => {
271
- // Call the optional callback
272
- if (typeof this.options.completeCallback === 'function') {
273
- this.options.completeCallback();
274
- }
275
- // Remove toast from DOM
276
- this.el.remove();
277
- Toast._toasts.splice(Toast._toasts.indexOf(this), 1);
278
- if (Toast._toasts.length === 0) {
279
- Toast._removeContainer();
280
- }
281
- }
282
- });
283
- }
284
-
285
- static {
286
- Toast._toasts = [];
287
- Toast._container = null;
288
- Toast._draggedToast = null;
289
- }
290
- }
package/src/tooltip.ts DELETED
@@ -1,366 +0,0 @@
1
- import anim from "animejs";
2
-
3
- import { Utils } from "./utils";
4
- import { Bounding } from "./bounding";
5
- import { Component, BaseOptions, InitElements, MElement } from "./component";
6
-
7
- export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
8
-
9
- export interface TooltipOptions extends BaseOptions {
10
- /**
11
- * Delay time before tooltip disappears.
12
- * @default 200
13
- */
14
- exitDelay: number;
15
- /**
16
- * Delay time before tooltip appears.
17
- * @default 0
18
- */
19
- enterDelay: number;
20
- /**
21
- * Element Id for the tooltip.
22
- * @default ""
23
- */
24
- tooltipId?: string;
25
- /**
26
- * Text string for the tooltip.
27
- * @default ""
28
- */
29
- text: string;
30
- /**
31
- * Set distance tooltip appears away from its activator
32
- * excluding transitionMovement.
33
- * @default 5
34
- */
35
- margin: number;
36
- /**
37
- * Enter transition duration.
38
- * @default 300
39
- */
40
- inDuration: number;
41
- /**
42
- * Opacity of the tooltip.
43
- * @default 1
44
- */
45
- opacity: number;
46
- /**
47
- * Exit transition duration.
48
- * @default 250
49
- */
50
- outDuration: number;
51
- /**
52
- * Set the direction of the tooltip.
53
- * @default 'bottom'
54
- */
55
- position: TooltipPosition;
56
- /**
57
- * Amount in px that the tooltip moves during its transition.
58
- * @default 10
59
- */
60
- transitionMovement: number;
61
- }
62
-
63
- const _defaults: TooltipOptions = {
64
- exitDelay: 200,
65
- enterDelay: 0,
66
- text: '',
67
- margin: 5,
68
- inDuration: 250,
69
- outDuration: 200,
70
- position: 'bottom' as TooltipPosition,
71
- transitionMovement: 10,
72
- opacity: 1
73
- };
74
-
75
- export class Tooltip extends Component<TooltipOptions> {
76
- /**
77
- * If tooltip is open.
78
- */
79
- isOpen: boolean;
80
- /**
81
- * If tooltip is hovered.
82
- */
83
- isHovered: boolean;
84
- /**
85
- * If tooltip is focused.
86
- */
87
- isFocused: boolean;
88
- tooltipEl: HTMLElement;
89
- private _exitDelayTimeout: string | number | NodeJS.Timeout;
90
- private _enterDelayTimeout: string | number | NodeJS.Timeout;
91
- xMovement: number;
92
- yMovement: number;
93
-
94
- constructor(el: HTMLElement, options: Partial<TooltipOptions>) {
95
- super(el, options, Tooltip);
96
- (this.el as any).M_Tooltip = this;
97
-
98
- this.options = {
99
- ...Tooltip.defaults,
100
- ...this._getAttributeOptions(),
101
- ...options
102
- };
103
-
104
- this.isOpen = false;
105
- this.isHovered = false;
106
- this.isFocused = false;
107
- this._appendTooltipEl();
108
- this._setupEventHandlers();
109
- }
110
-
111
- static get defaults(): TooltipOptions {
112
- return _defaults;
113
- }
114
-
115
- /**
116
- * Initializes instance of Tooltip.
117
- * @param el HTML element.
118
- * @param options Component options.
119
- */
120
- static init(el: HTMLElement, options?: Partial<TooltipOptions>): Tooltip;
121
- /**
122
- * Initializes instances of Tooltip.
123
- * @param els HTML elements.
124
- * @param options Component options.
125
- */
126
- static init(els: InitElements<MElement>, options?: Partial<TooltipOptions>): Tooltip[];
127
- /**
128
- * Initializes instances of Tooltip.
129
- * @param els HTML elements.
130
- * @param options Component options.
131
- */
132
- static init(els: HTMLElement | InitElements<MElement>, options: Partial<TooltipOptions> = {}): Tooltip | Tooltip[] {
133
- return super.init(els, options, Tooltip);
134
- }
135
-
136
- static getInstance(el: HTMLElement): Tooltip {
137
- return (el as any).M_Tooltip;
138
- }
139
-
140
- destroy() {
141
- this.tooltipEl.remove();
142
- this._removeEventHandlers();
143
- (this.el as any).M_Tooltip = undefined;
144
- }
145
-
146
- _appendTooltipEl() {
147
- this.tooltipEl = document.createElement('div');
148
- this.tooltipEl.classList.add('material-tooltip');
149
-
150
- const tooltipContentEl = this.options.tooltipId
151
- ? document.getElementById(this.options.tooltipId)
152
- : document.createElement('div');
153
- this.tooltipEl.append( tooltipContentEl);
154
- tooltipContentEl.style.display = "";
155
-
156
- tooltipContentEl.classList.add('tooltip-content');
157
- this._setTooltipContent(tooltipContentEl);
158
- this.tooltipEl.appendChild(tooltipContentEl);
159
- document.body.appendChild(this.tooltipEl);
160
- }
161
-
162
- _setTooltipContent(tooltipContentEl: HTMLElement) {
163
- if (this.options.tooltipId)
164
- return;
165
- tooltipContentEl.innerText = this.options.text;
166
- }
167
-
168
- _updateTooltipContent() {
169
- this._setTooltipContent(this.tooltipEl.querySelector('.tooltip-content'));
170
- }
171
-
172
- _setupEventHandlers() {
173
- this.el.addEventListener('mouseenter', this._handleMouseEnter);
174
- this.el.addEventListener('mouseleave', this._handleMouseLeave);
175
- this.el.addEventListener('focus', this._handleFocus, true);
176
- this.el.addEventListener('blur', this._handleBlur, true);
177
- }
178
-
179
- _removeEventHandlers() {
180
- this.el.removeEventListener('mouseenter', this._handleMouseEnter);
181
- this.el.removeEventListener('mouseleave', this._handleMouseLeave);
182
- this.el.removeEventListener('focus', this._handleFocus, true);
183
- this.el.removeEventListener('blur', this._handleBlur, true);
184
- }
185
-
186
- /**
187
- * Show tooltip.
188
- */
189
- open = (isManual: boolean) => {
190
- if (this.isOpen) return;
191
- isManual = isManual === undefined ? true : undefined; // Default value true
192
- this.isOpen = true;
193
- // Update tooltip content with HTML attribute options
194
- this.options = {...this.options, ...this._getAttributeOptions()};
195
- this._updateTooltipContent();
196
- this._setEnterDelayTimeout(isManual);
197
- }
198
-
199
- /**
200
- * Hide tooltip.
201
- */
202
- close = () => {
203
- if (!this.isOpen) return;
204
- this.isHovered = false;
205
- this.isFocused = false;
206
- this.isOpen = false;
207
- this._setExitDelayTimeout();
208
- }
209
-
210
- _setExitDelayTimeout() {
211
- clearTimeout(this._exitDelayTimeout);
212
- this._exitDelayTimeout = setTimeout(() => {
213
- if (this.isHovered || this.isFocused) return;
214
- this._animateOut();
215
- }, this.options.exitDelay);
216
- }
217
-
218
- _setEnterDelayTimeout(isManual) {
219
- clearTimeout(this._enterDelayTimeout);
220
- this._enterDelayTimeout = setTimeout(() => {
221
- if (!this.isHovered && !this.isFocused && !isManual) return;
222
- this._animateIn();
223
- }, this.options.enterDelay);
224
- }
225
-
226
- _positionTooltip() {
227
- const tooltip: HTMLElement = this.tooltipEl;
228
- const origin = (this.el as HTMLElement),
229
- originHeight = origin.offsetHeight,
230
- originWidth = origin.offsetWidth,
231
- tooltipHeight = tooltip.offsetHeight,
232
- tooltipWidth = tooltip.offsetWidth,
233
- margin = this.options.margin;
234
-
235
- (this.xMovement = 0), (this.yMovement = 0);
236
-
237
- let targetTop = origin.getBoundingClientRect().top + Utils.getDocumentScrollTop();
238
- let targetLeft = origin.getBoundingClientRect().left + Utils.getDocumentScrollLeft();
239
- if (this.options.position === 'top') {
240
- targetTop += -tooltipHeight - margin;
241
- targetLeft += originWidth / 2 - tooltipWidth / 2;
242
- this.yMovement = -this.options.transitionMovement;
243
- } else if (this.options.position === 'right') {
244
- targetTop += originHeight / 2 - tooltipHeight / 2;
245
- targetLeft += originWidth + margin;
246
- this.xMovement = this.options.transitionMovement;
247
- } else if (this.options.position === 'left') {
248
- targetTop += originHeight / 2 - tooltipHeight / 2;
249
- targetLeft += -tooltipWidth - margin;
250
- this.xMovement = -this.options.transitionMovement;
251
- } else {
252
- targetTop += originHeight + margin;
253
- targetLeft += originWidth / 2 - tooltipWidth / 2;
254
- this.yMovement = this.options.transitionMovement;
255
- }
256
-
257
- const newCoordinates = this._repositionWithinScreen(
258
- targetLeft,
259
- targetTop,
260
- tooltipWidth,
261
- tooltipHeight
262
- );
263
-
264
- tooltip.style.top = newCoordinates.y+'px';
265
- tooltip.style.left = newCoordinates.x+'px';
266
- }
267
-
268
- _repositionWithinScreen(x: number, y: number, width: number, height: number) {
269
- const scrollLeft = Utils.getDocumentScrollLeft();
270
- const scrollTop = Utils.getDocumentScrollTop();
271
- let newX = x - scrollLeft;
272
- let newY = y - scrollTop;
273
-
274
- const bounding: Bounding = {
275
- left: newX,
276
- top: newY,
277
- width: width,
278
- height: height
279
- };
280
- const offset = this.options.margin + this.options.transitionMovement;
281
- const edges = Utils.checkWithinContainer(document.body, bounding, offset);
282
-
283
- if (edges.left) {
284
- newX = offset;
285
- } else if (edges.right) {
286
- newX -= newX + width - window.innerWidth;
287
- }
288
- if (edges.top) {
289
- newY = offset;
290
- } else if (edges.bottom) {
291
- newY -= newY + height - window.innerHeight;
292
- }
293
- return {
294
- x: newX + scrollLeft,
295
- y: newY + scrollTop
296
- };
297
- }
298
-
299
- _animateIn() {
300
- this._positionTooltip();
301
- this.tooltipEl.style.visibility = 'visible';
302
- anim.remove(this.tooltipEl);
303
- anim({
304
- targets: this.tooltipEl,
305
- opacity: this.options.opacity || 1,
306
- translateX: this.xMovement,
307
- translateY: this.yMovement,
308
- duration: this.options.inDuration,
309
- easing: 'easeOutCubic'
310
- });
311
- }
312
-
313
- _animateOut() {
314
- anim.remove(this.tooltipEl);
315
- anim({
316
- targets: this.tooltipEl,
317
- opacity: 0,
318
- translateX: 0,
319
- translateY: 0,
320
- duration: this.options.outDuration,
321
- easing: 'easeOutCubic'
322
- });
323
- }
324
-
325
- _handleMouseEnter = () => {
326
- this.isHovered = true;
327
- this.isFocused = false; // Allows close of tooltip when opened by focus.
328
- this.open(false);
329
- }
330
-
331
- _handleMouseLeave = () => {
332
- this.isHovered = false;
333
- this.isFocused = false; // Allows close of tooltip when opened by focus.
334
- this.close();
335
- }
336
-
337
- _handleFocus = () => {
338
- if (Utils.tabPressed) {
339
- this.isFocused = true;
340
- this.open(false);
341
- }
342
- }
343
-
344
- _handleBlur = () => {
345
- this.isFocused = false;
346
- this.close();
347
- }
348
-
349
- _getAttributeOptions(): Partial<TooltipOptions> {
350
- let attributeOptions: Partial<TooltipOptions> = { };
351
- const tooltipTextOption = this.el.getAttribute('data-tooltip');
352
- const tooltipId = this.el.getAttribute('data-tooltip-id');
353
- const positionOption = this.el.getAttribute('data-position');
354
- if (tooltipTextOption) {
355
- attributeOptions.text = tooltipTextOption;
356
- }
357
- if (positionOption) {
358
- attributeOptions.position = positionOption as TooltipPosition;
359
- }
360
- if (tooltipId) {
361
- attributeOptions.tooltipId = tooltipId;
362
- }
363
-
364
- return attributeOptions;
365
- }
366
- }