@materializecss/materialize 2.0.2-alpha → 2.0.3-beta

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 (99) hide show
  1. package/Gruntfile.js +14 -109
  2. package/README.md +1 -1
  3. package/dist/css/materialize.css +1658 -353
  4. package/dist/css/materialize.min.css +2 -2
  5. package/dist/js/materialize.js +42 -30
  6. package/dist/js/materialize.min.js +2 -2
  7. package/dist/js/materialize.min.js.map +1 -1
  8. package/dist/src/autocomplete.d.ts +143 -0
  9. package/dist/src/autocomplete.d.ts.map +1 -0
  10. package/dist/src/bounding.d.ts +7 -0
  11. package/dist/src/bounding.d.ts.map +1 -0
  12. package/dist/src/buttons.d.ts +65 -0
  13. package/dist/src/buttons.d.ts.map +1 -0
  14. package/dist/src/cards.d.ts +4 -0
  15. package/dist/src/cards.d.ts.map +1 -0
  16. package/dist/src/carousel.d.ts +131 -0
  17. package/dist/src/carousel.d.ts.map +1 -0
  18. package/dist/src/characterCounter.d.ts +37 -0
  19. package/dist/src/characterCounter.d.ts.map +1 -0
  20. package/dist/src/chips.d.ts +131 -0
  21. package/dist/src/chips.d.ts.map +1 -0
  22. package/dist/src/collapsible.d.ts +74 -0
  23. package/dist/src/collapsible.d.ts.map +1 -0
  24. package/dist/src/component.d.ts +74 -0
  25. package/dist/src/component.d.ts.map +1 -0
  26. package/dist/src/datepicker.d.ts +248 -0
  27. package/dist/src/datepicker.d.ts.map +1 -0
  28. package/dist/src/dropdown.d.ts +148 -0
  29. package/dist/src/dropdown.d.ts.map +1 -0
  30. package/dist/src/edges.d.ts +7 -0
  31. package/dist/src/edges.d.ts.map +1 -0
  32. package/dist/src/forms.d.ts +12 -0
  33. package/dist/src/forms.d.ts.map +1 -0
  34. package/dist/src/global.d.ts +60 -0
  35. package/dist/src/global.d.ts.map +1 -0
  36. package/dist/src/index.d.ts +27 -0
  37. package/dist/src/index.d.ts.map +1 -0
  38. package/dist/src/materialbox.d.ts +92 -0
  39. package/dist/src/materialbox.d.ts.map +1 -0
  40. package/dist/src/modal.d.ts +119 -0
  41. package/dist/src/modal.d.ts.map +1 -0
  42. package/dist/src/parallax.d.ts +40 -0
  43. package/dist/src/parallax.d.ts.map +1 -0
  44. package/dist/src/pushpin.d.ts +52 -0
  45. package/dist/src/pushpin.d.ts.map +1 -0
  46. package/dist/src/range.d.ts +41 -0
  47. package/dist/src/range.d.ts.map +1 -0
  48. package/dist/src/scrollspy.d.ts +62 -0
  49. package/dist/src/scrollspy.d.ts.map +1 -0
  50. package/dist/src/select.d.ts +77 -0
  51. package/dist/src/select.d.ts.map +1 -0
  52. package/dist/src/sidenav.d.ts +122 -0
  53. package/dist/src/sidenav.d.ts.map +1 -0
  54. package/dist/src/slider.d.ts +103 -0
  55. package/dist/src/slider.d.ts.map +1 -0
  56. package/dist/src/tabs.d.ts +80 -0
  57. package/dist/src/tabs.d.ts.map +1 -0
  58. package/dist/src/tapTarget.d.ts +59 -0
  59. package/dist/src/tapTarget.d.ts.map +1 -0
  60. package/dist/src/timepicker.d.ts +208 -0
  61. package/dist/src/timepicker.d.ts.map +1 -0
  62. package/dist/src/toasts.d.ts +90 -0
  63. package/dist/src/toasts.d.ts.map +1 -0
  64. package/dist/src/tooltip.d.ts +118 -0
  65. package/dist/src/tooltip.d.ts.map +1 -0
  66. package/dist/src/utils.d.ts +97 -0
  67. package/dist/src/utils.d.ts.map +1 -0
  68. package/dist/src/waves.d.ts +16 -0
  69. package/dist/src/waves.d.ts.map +1 -0
  70. package/package.json +4 -4
  71. package/sass/components/_buttons.scss +158 -73
  72. package/sass/components/_cards.scss +1 -1
  73. package/sass/components/_chips.scss +75 -28
  74. package/sass/components/_global.scss +56 -94
  75. package/sass/components/_grid.scss +28 -47
  76. package/sass/components/_navbar.scss +26 -26
  77. package/sass/components/_preloader.scss +85 -0
  78. package/sass/components/_pulse.scss +1 -0
  79. package/sass/components/_sidenav.scss +3 -14
  80. package/sass/components/_theme_variables.scss +27 -47
  81. package/sass/components/_variables.scss +5 -2
  82. package/sass/components/colors.module.scss +180 -0
  83. package/sass/components/forms/_range.scss +1 -1
  84. package/sass/components/forms/_switches.scss +44 -14
  85. package/sass/components/theme.dark.module.scss +32 -0
  86. package/sass/components/theme.light.module.scss +32 -0
  87. package/sass/components/tokens.module.scss +272 -0
  88. package/sass/components/typography.module.scss +150 -0
  89. package/sass/materialize.scss +7 -1
  90. package/src/carousel.ts +1 -1
  91. package/src/chips.ts +1 -1
  92. package/src/datepicker.ts +5 -5
  93. package/src/dropdown.ts +0 -3
  94. package/src/forms.ts +20 -11
  95. package/src/global.ts +21 -23
  96. package/src/index.ts +26 -0
  97. package/src/select.ts +1 -1
  98. package/src/timepicker.ts +1 -1
  99. package/src/tooltip.ts +28 -8
@@ -0,0 +1,150 @@
1
+ .display-large{
2
+ font-family: var(--md-sys-typescale-display-large-font-family-name);
3
+ font-style: var(--md-sys-typescale-display-large-font-family-style);
4
+ font-weight: var(--md-sys-typescale-display-large-font-weight);
5
+ font-size: var(--md-sys-typescale-display-large-font-size);
6
+ letter-spacing: var(--md-sys-typescale-display-large-tracking);
7
+ line-height: var(--md-sys-typescale-display-large-height);
8
+ text-transform: var(--md-sys-typescale-display-large-text-transform);
9
+ text-decoration: var(--md-sys-typescale-display-large-text-decoration);
10
+ }
11
+ .display-medium{
12
+ font-family: var(--md-sys-typescale-display-medium-font-family-name);
13
+ font-style: var(--md-sys-typescale-display-medium-font-family-style);
14
+ font-weight: var(--md-sys-typescale-display-medium-font-weight);
15
+ font-size: var(--md-sys-typescale-display-medium-font-size);
16
+ letter-spacing: var(--md-sys-typescale-display-medium-tracking);
17
+ line-height: var(--md-sys-typescale-display-medium-height);
18
+ text-transform: var(--md-sys-typescale-display-medium-text-transform);
19
+ text-decoration: var(--md-sys-typescale-display-medium-text-decoration);
20
+ }
21
+ .display-small{
22
+ font-family: var(--md-sys-typescale-display-small-font-family-name);
23
+ font-style: var(--md-sys-typescale-display-small-font-family-style);
24
+ font-weight: var(--md-sys-typescale-display-small-font-weight);
25
+ font-size: var(--md-sys-typescale-display-small-font-size);
26
+ letter-spacing: var(--md-sys-typescale-display-small-tracking);
27
+ line-height: var(--md-sys-typescale-display-small-height);
28
+ text-transform: var(--md-sys-typescale-display-small-text-transform);
29
+ text-decoration: var(--md-sys-typescale-display-small-text-decoration);
30
+ }
31
+ .headline-large{
32
+ font-family: var(--md-sys-typescale-headline-large-font-family-name);
33
+ font-style: var(--md-sys-typescale-headline-large-font-family-style);
34
+ font-weight: var(--md-sys-typescale-headline-large-font-weight);
35
+ font-size: var(--md-sys-typescale-headline-large-font-size);
36
+ letter-spacing: var(--md-sys-typescale-headline-large-tracking);
37
+ line-height: var(--md-sys-typescale-headline-large-height);
38
+ text-transform: var(--md-sys-typescale-headline-large-text-transform);
39
+ text-decoration: var(--md-sys-typescale-headline-large-text-decoration);
40
+ }
41
+ .headline-medium{
42
+ font-family: var(--md-sys-typescale-headline-medium-font-family-name);
43
+ font-style: var(--md-sys-typescale-headline-medium-font-family-style);
44
+ font-weight: var(--md-sys-typescale-headline-medium-font-weight);
45
+ font-size: var(--md-sys-typescale-headline-medium-font-size);
46
+ letter-spacing: var(--md-sys-typescale-headline-medium-tracking);
47
+ line-height: var(--md-sys-typescale-headline-medium-height);
48
+ text-transform: var(--md-sys-typescale-headline-medium-text-transform);
49
+ text-decoration: var(--md-sys-typescale-headline-medium-text-decoration);
50
+ }
51
+ .headline-small{
52
+ font-family: var(--md-sys-typescale-headline-small-font-family-name);
53
+ font-style: var(--md-sys-typescale-headline-small-font-family-style);
54
+ font-weight: var(--md-sys-typescale-headline-small-font-weight);
55
+ font-size: var(--md-sys-typescale-headline-small-font-size);
56
+ letter-spacing: var(--md-sys-typescale-headline-small-tracking);
57
+ line-height: var(--md-sys-typescale-headline-small-height);
58
+ text-transform: var(--md-sys-typescale-headline-small-text-transform);
59
+ text-decoration: var(--md-sys-typescale-headline-small-text-decoration);
60
+ }
61
+ .body-large{
62
+ font-family: var(--md-sys-typescale-body-large-font-family-name);
63
+ font-style: var(--md-sys-typescale-body-large-font-family-style);
64
+ font-weight: var(--md-sys-typescale-body-large-font-weight);
65
+ font-size: var(--md-sys-typescale-body-large-font-size);
66
+ letter-spacing: var(--md-sys-typescale-body-large-tracking);
67
+ line-height: var(--md-sys-typescale-body-large-height);
68
+ text-transform: var(--md-sys-typescale-body-large-text-transform);
69
+ text-decoration: var(--md-sys-typescale-body-large-text-decoration);
70
+ }
71
+ .body-medium{
72
+ font-family: var(--md-sys-typescale-body-medium-font-family-name);
73
+ font-style: var(--md-sys-typescale-body-medium-font-family-style);
74
+ font-weight: var(--md-sys-typescale-body-medium-font-weight);
75
+ font-size: var(--md-sys-typescale-body-medium-font-size);
76
+ letter-spacing: var(--md-sys-typescale-body-medium-tracking);
77
+ line-height: var(--md-sys-typescale-body-medium-height);
78
+ text-transform: var(--md-sys-typescale-body-medium-text-transform);
79
+ text-decoration: var(--md-sys-typescale-body-medium-text-decoration);
80
+ }
81
+ .body-small{
82
+ font-family: var(--md-sys-typescale-body-small-font-family-name);
83
+ font-style: var(--md-sys-typescale-body-small-font-family-style);
84
+ font-weight: var(--md-sys-typescale-body-small-font-weight);
85
+ font-size: var(--md-sys-typescale-body-small-font-size);
86
+ letter-spacing: var(--md-sys-typescale-body-small-tracking);
87
+ line-height: var(--md-sys-typescale-body-small-height);
88
+ text-transform: var(--md-sys-typescale-body-small-text-transform);
89
+ text-decoration: var(--md-sys-typescale-body-small-text-decoration);
90
+ }
91
+ .label-large{
92
+ font-family: var(--md-sys-typescale-label-large-font-family-name);
93
+ font-style: var(--md-sys-typescale-label-large-font-family-style);
94
+ font-weight: var(--md-sys-typescale-label-large-font-weight);
95
+ font-size: var(--md-sys-typescale-label-large-font-size);
96
+ letter-spacing: var(--md-sys-typescale-label-large-tracking);
97
+ line-height: var(--md-sys-typescale-label-large-height);
98
+ text-transform: var(--md-sys-typescale-label-large-text-transform);
99
+ text-decoration: var(--md-sys-typescale-label-large-text-decoration);
100
+ }
101
+ .label-medium{
102
+ font-family: var(--md-sys-typescale-label-medium-font-family-name);
103
+ font-style: var(--md-sys-typescale-label-medium-font-family-style);
104
+ font-weight: var(--md-sys-typescale-label-medium-font-weight);
105
+ font-size: var(--md-sys-typescale-label-medium-font-size);
106
+ letter-spacing: var(--md-sys-typescale-label-medium-tracking);
107
+ line-height: var(--md-sys-typescale-label-medium-height);
108
+ text-transform: var(--md-sys-typescale-label-medium-text-transform);
109
+ text-decoration: var(--md-sys-typescale-label-medium-text-decoration);
110
+ }
111
+ .label-small{
112
+ font-family: var(--md-sys-typescale-label-small-font-family-name);
113
+ font-style: var(--md-sys-typescale-label-small-font-family-style);
114
+ font-weight: var(--md-sys-typescale-label-small-font-weight);
115
+ font-size: var(--md-sys-typescale-label-small-font-size);
116
+ letter-spacing: var(--md-sys-typescale-label-small-tracking);
117
+ line-height: var(--md-sys-typescale-label-small-height);
118
+ text-transform: var(--md-sys-typescale-label-small-text-transform);
119
+ text-decoration: var(--md-sys-typescale-label-small-text-decoration);
120
+ }
121
+ .title-large{
122
+ font-family: var(--md-sys-typescale-title-large-font-family-name);
123
+ font-style: var(--md-sys-typescale-title-large-font-family-style);
124
+ font-weight: var(--md-sys-typescale-title-large-font-weight);
125
+ font-size: var(--md-sys-typescale-title-large-font-size);
126
+ letter-spacing: var(--md-sys-typescale-title-large-tracking);
127
+ line-height: var(--md-sys-typescale-title-large-height);
128
+ text-transform: var(--md-sys-typescale-title-large-text-transform);
129
+ text-decoration: var(--md-sys-typescale-title-large-text-decoration);
130
+ }
131
+ .title-medium{
132
+ font-family: var(--md-sys-typescale-title-medium-font-family-name);
133
+ font-style: var(--md-sys-typescale-title-medium-font-family-style);
134
+ font-weight: var(--md-sys-typescale-title-medium-font-weight);
135
+ font-size: var(--md-sys-typescale-title-medium-font-size);
136
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking);
137
+ line-height: var(--md-sys-typescale-title-medium-height);
138
+ text-transform: var(--md-sys-typescale-title-medium-text-transform);
139
+ text-decoration: var(--md-sys-typescale-title-medium-text-decoration);
140
+ }
141
+ .title-small{
142
+ font-family: var(--md-sys-typescale-title-small-font-family-name);
143
+ font-style: var(--md-sys-typescale-title-small-font-family-style);
144
+ font-weight: var(--md-sys-typescale-title-small-font-weight);
145
+ font-size: var(--md-sys-typescale-title-small-font-size);
146
+ letter-spacing: var(--md-sys-typescale-title-small-tracking);
147
+ line-height: var(--md-sys-typescale-title-small-height);
148
+ text-transform: var(--md-sys-typescale-title-small-text-transform);
149
+ text-decoration: var(--md-sys-typescale-title-small-text-decoration);
150
+ }
@@ -1,4 +1,11 @@
1
1
  @charset "UTF-8";
2
+ @import "components/tokens.module";
3
+ @import "components/colors.module";
4
+ @import "components/typography.module";
5
+ @import "components/theme.light.module";
6
+ @import "components/theme.dark.module";
7
+ @import "components/_theme_variables";
8
+
2
9
  // Color
3
10
  @import "components/color-variables";
4
11
  @import "components/color-classes";
@@ -35,4 +42,3 @@
35
42
  @import "components/pulse";
36
43
  @import "components/datepicker";
37
44
  @import "components/timepicker";
38
- @import "components/_theme_variables";
package/src/carousel.ts CHANGED
@@ -84,7 +84,7 @@ export class Carousel extends Component<CarouselOptions> {
84
84
  velocity: number;
85
85
  frame: number;
86
86
  timestamp: number;
87
- ticker: NodeJS.Timer;
87
+ ticker: string | number | NodeJS.Timeout;
88
88
  amplitude: number;
89
89
  /** The index of the center carousel item. */
90
90
  center: number = 0;
package/src/chips.ts CHANGED
@@ -140,7 +140,7 @@ export class Chips extends Component<ChipsOptions> {
140
140
  * @param el HTML element.
141
141
  * @param options Component options.
142
142
  */
143
- static init(el: HTMLElement, options?: Partial<ChipsOptions>): Chips;
143
+ static init(el: InitElements<MElement>, options?: Partial<ChipsOptions>): Chips;
144
144
  /**
145
145
  * Initializes instances of Chips.
146
146
  * @param els HTML elements.
package/src/datepicker.ts CHANGED
@@ -134,7 +134,7 @@ export interface DatepickerOptions extends BaseOptions {
134
134
  * @default null
135
135
  */
136
136
  onDraw: (() => void) | null;
137
-
137
+
138
138
  /** Field used for internal calculations DO NOT CHANGE IT */
139
139
  minYear?: any;
140
140
  /** Field used for internal calculations DO NOT CHANGE IT */
@@ -261,7 +261,7 @@ export class Datepicker extends Component<DatepickerOptions> {
261
261
  constructor(el: HTMLInputElement, options: Partial<DatepickerOptions>) {
262
262
  super(el, options, Datepicker);
263
263
  (this.el as any).M_Datepicker = this;
264
-
264
+
265
265
  this.options = {
266
266
  ...Datepicker.defaults,
267
267
  ...options
@@ -463,7 +463,7 @@ export class Datepicker extends Component<DatepickerOptions> {
463
463
  */
464
464
  setInputValue() {
465
465
  this.el.value = this.toString();
466
- this.el.dispatchEvent(new CustomEvent('change', {detail: {firedBy: this}}));
466
+ this.el.dispatchEvent(new CustomEvent('change', {bubbles:true, cancelable:true, composed:true, detail: {firedBy: this}}));
467
467
  }
468
468
 
469
469
  _renderDateDisplay() {
@@ -847,8 +847,8 @@ export class Datepicker extends Component<DatepickerOptions> {
847
847
  });
848
848
 
849
849
  // Add change handlers for select
850
- yearSelect.addEventListener('change', () => this._handleYearChange);
851
- monthSelect.addEventListener('change', () => this._handleMonthChange);
850
+ yearSelect.addEventListener('change', this._handleYearChange);
851
+ monthSelect.addEventListener('change', this._handleMonthChange);
852
852
 
853
853
  if (typeof this.options.onDraw === 'function') {
854
854
  this.options.onDraw.call(this);
package/src/dropdown.ts CHANGED
@@ -641,7 +641,4 @@ export class Dropdown extends Component<DropdownOptions> implements Openable {
641
641
  }
642
642
  }
643
643
 
644
- static {
645
- Dropdown._dropdowns = [];
646
- }
647
644
  }
package/src/forms.ts CHANGED
@@ -94,17 +94,28 @@ export class Forms {
94
94
  });
95
95
 
96
96
  document.querySelectorAll('.materialize-textarea').forEach((textArea: HTMLTextAreaElement) => {
97
- // Save Data in Element
98
- textArea.setAttribute('original-height', textArea.getBoundingClientRect().height.toString());
99
- textArea.setAttribute('previous-length', textArea.value.length.toString());
100
- Forms.textareaAutoResize(textArea);
101
-
102
- textArea.addEventListener('keyup', e => Forms.textareaAutoResize(textArea));
103
- textArea.addEventListener('keydown', e => Forms.textareaAutoResize(textArea));
97
+ Forms.textareaAutoResize(textArea);
104
98
  });
105
99
 
106
100
  // File Input Path
107
101
  document.querySelectorAll('.file-field input[type="file"]').forEach((fileInput: HTMLInputElement) => {
102
+ Forms.InitFileInputPath(fileInput);
103
+ });
104
+
105
+ });
106
+ }
107
+
108
+ static InitTextarea(textarea: HTMLTextAreaElement){
109
+ // Save Data in Element
110
+ textarea.setAttribute('original-height', textarea.getBoundingClientRect().height.toString());
111
+ textarea.setAttribute('previous-length', textarea.value.length.toString());
112
+ Forms.textareaAutoResize(textarea);
113
+
114
+ textarea.addEventListener('keyup', e => Forms.textareaAutoResize(textarea));
115
+ textarea.addEventListener('keydown', e => Forms.textareaAutoResize(textarea));
116
+ }
117
+
118
+ static InitFileInputPath(fileInput: HTMLInputElement){
108
119
  fileInput.addEventListener('change', e => {
109
120
  const fileField = fileInput.closest('.file-field');
110
121
  const pathInput = <HTMLInputElement>fileField.querySelector('input.file-path');
@@ -114,10 +125,8 @@ export class Forms {
114
125
  filenames.push(files[i].name);
115
126
  }
116
127
  pathInput.value = filenames.join(', ');
117
- pathInput.dispatchEvent(new Event('change'));
128
+ pathInput.dispatchEvent(new Event('change',{bubbles:true, cancelable:true, composed:true}));
118
129
  });
119
- });
120
-
121
- });
122
130
  }
131
+
123
132
  }
package/src/global.ts CHANGED
@@ -26,7 +26,7 @@ import { Range } from './range';
26
26
  import { Utils } from './utils';
27
27
 
28
28
  export class M {
29
- static version = '2.0.2-alpha';
29
+ static version = '2.0.3-beta';
30
30
 
31
31
  static Autocomplete: typeof Autocomplete = Autocomplete;
32
32
  static Tabs: typeof Tabs = Tabs;
@@ -46,7 +46,7 @@ export class M {
46
46
  static Slider: typeof Slider = Slider;
47
47
  static Timepicker: typeof Timepicker = Timepicker;
48
48
  /** Creates a toast. */
49
- static toast: (opt: ToastOptions) => Toast = (opt) => new Toast(opt) ;
49
+ static toast: (opt: Partial<ToastOptions>) => Toast = (opt) => new Toast(opt) ;
50
50
  static Tooltip: typeof Tooltip = Tooltip;
51
51
  static Sidenav: typeof Sidenav = Sidenav;
52
52
  static TapTarget: typeof TapTarget = TapTarget;
@@ -73,24 +73,24 @@ export class M {
73
73
  */
74
74
  static AutoInit(context: HTMLElement = document.body) {
75
75
  let registry = {
76
- Autocomplete: <NodeListOf<HTMLElement>>context.querySelectorAll('.autocomplete:not(.no-autoinit)'),
77
- Carousel: <NodeListOf<HTMLElement>>context.querySelectorAll('.carousel:not(.no-autoinit)'),
78
- Chips: <NodeListOf<HTMLElement>>context.querySelectorAll('.chips:not(.no-autoinit)'),
79
- Collapsible: <NodeListOf<HTMLElement>>context.querySelectorAll('.collapsible:not(.no-autoinit)'),
80
- Datepicker: <NodeListOf<HTMLElement>>context.querySelectorAll('.datepicker:not(.no-autoinit)'),
81
- Dropdown: <NodeListOf<HTMLElement>>context.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'),
82
- Materialbox: <NodeListOf<HTMLElement>>context.querySelectorAll('.materialboxed:not(.no-autoinit)'),
83
- Modal: <NodeListOf<HTMLElement>>context.querySelectorAll('.modal:not(.no-autoinit)'),
84
- Parallax: <NodeListOf<HTMLElement>>context.querySelectorAll('.parallax:not(.no-autoinit)'),
85
- Pushpin: <NodeListOf<HTMLElement>>context.querySelectorAll('.pushpin:not(.no-autoinit)'),
86
- ScrollSpy: <NodeListOf<HTMLElement>>context.querySelectorAll('.scrollspy:not(.no-autoinit)'),
87
- FormSelect: <NodeListOf<HTMLElement>>context.querySelectorAll('select:not(.no-autoinit)'),
88
- Sidenav: <NodeListOf<HTMLElement>>context.querySelectorAll('.sidenav:not(.no-autoinit)'),
89
- Tabs: <NodeListOf<HTMLElement>>context.querySelectorAll('.tabs:not(.no-autoinit)'),
90
- TapTarget: <NodeListOf<HTMLElement>>context.querySelectorAll('.tap-target:not(.no-autoinit)'),
91
- Timepicker: <NodeListOf<HTMLElement>>context.querySelectorAll('.timepicker:not(.no-autoinit)'),
92
- Tooltip: <NodeListOf<HTMLElement>>context.querySelectorAll('.tooltipped:not(.no-autoinit)'),
93
- FloatingActionButton: <NodeListOf<HTMLElement>>context.querySelectorAll('.fixed-action-btn:not(.no-autoinit)'),
76
+ Autocomplete: context.querySelectorAll('.autocomplete:not(.no-autoinit)'),
77
+ Carousel: context.querySelectorAll('.carousel:not(.no-autoinit)'),
78
+ Chips: context.querySelectorAll('.chips:not(.no-autoinit)'),
79
+ Collapsible: context.querySelectorAll('.collapsible:not(.no-autoinit)'),
80
+ Datepicker: context.querySelectorAll('.datepicker:not(.no-autoinit)'),
81
+ Dropdown: context.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'),
82
+ Materialbox: context.querySelectorAll('.materialboxed:not(.no-autoinit)'),
83
+ Modal: context.querySelectorAll('.modal:not(.no-autoinit)'),
84
+ Parallax: context.querySelectorAll('.parallax:not(.no-autoinit)'),
85
+ Pushpin: context.querySelectorAll('.pushpin:not(.no-autoinit)'),
86
+ ScrollSpy: context.querySelectorAll('.scrollspy:not(.no-autoinit)'),
87
+ FormSelect: context.querySelectorAll('select:not(.no-autoinit)'),
88
+ Sidenav: context.querySelectorAll('.sidenav:not(.no-autoinit)'),
89
+ Tabs: context.querySelectorAll('.tabs:not(.no-autoinit)'),
90
+ TapTarget: context.querySelectorAll('.tap-target:not(.no-autoinit)'),
91
+ Timepicker: context.querySelectorAll('.timepicker:not(.no-autoinit)'),
92
+ Tooltip: context.querySelectorAll('.tooltipped:not(.no-autoinit)'),
93
+ FloatingActionButton: context.querySelectorAll('.fixed-action-btn:not(.no-autoinit)'),
94
94
  };
95
95
  M.Autocomplete.init(registry.Autocomplete, {});
96
96
  M.Carousel.init(registry.Carousel, {});
@@ -111,6 +111,4 @@ export class M {
111
111
  M.Tooltip.init(registry.Tooltip, {});
112
112
  M.FloatingActionButton.init(registry.FloatingActionButton, {});
113
113
  }
114
- }
115
-
116
- export default M;
114
+ }
package/src/index.ts ADDED
@@ -0,0 +1,26 @@
1
+ export * from './global';
2
+ export { Autocomplete } from './autocomplete';
3
+ export { FloatingActionButton } from './buttons';
4
+ export { Cards } from './cards';
5
+ export { Carousel } from './carousel';
6
+ export { CharacterCounter } from './characterCounter';
7
+ export { Chips } from './chips';
8
+ export { Collapsible } from './collapsible';
9
+ export { Datepicker } from './datepicker';
10
+ export { Dropdown } from './dropdown';
11
+ export { Forms } from './forms';
12
+ export { Materialbox } from './materialbox';
13
+ export { Modal } from './modal';
14
+ export { Parallax } from './parallax';
15
+ export { Pushpin } from './pushpin';
16
+ export { ScrollSpy } from './scrollspy';
17
+ export { FormSelect } from './select';
18
+ export { Sidenav } from './sidenav';
19
+ export { Slider } from './slider';
20
+ export { Tabs } from './tabs';
21
+ export { TapTarget } from './tapTarget';
22
+ export { Timepicker } from './timepicker';
23
+ export { Toast } from './toasts';
24
+ export { Tooltip } from './tooltip';
25
+ export { Waves } from './waves';
26
+ export { Range } from './range';
package/src/select.ts CHANGED
@@ -160,7 +160,7 @@ export class FormSelect extends Component<FormSelectOptions> {
160
160
  previousSelectedValues,
161
161
  actualSelectedValues
162
162
  );
163
- if (selectionHasChanged) this.el.dispatchEvent(new Event('change')); // trigger('change');
163
+ if (selectionHasChanged) this.el.dispatchEvent(new Event('change',{bubbles:true, cancelable:true, composed:true})); // trigger('change');
164
164
  }
165
165
  if (!this.isMultiple) this.dropdown.close();
166
166
  }
package/src/timepicker.ts CHANGED
@@ -792,7 +792,7 @@ export class Timepicker extends Component<TimepickerOptions> {
792
792
  this.el.value = value;
793
793
  // Trigger change event
794
794
  if (value !== last) {
795
- this.el.dispatchEvent(new Event('change'));
795
+ this.el.dispatchEvent(new Event('change',{bubbles:true, cancelable:true, composed:true}));
796
796
  }
797
797
  this.close();
798
798
  this.el.focus();
package/src/tooltip.ts CHANGED
@@ -4,6 +4,8 @@ import { Utils } from "./utils";
4
4
  import { Bounding } from "./bounding";
5
5
  import { Component, BaseOptions, InitElements, MElement } from "./component";
6
6
 
7
+ export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
8
+
7
9
  export interface TooltipOptions extends BaseOptions {
8
10
  /**
9
11
  * Delay time before tooltip disappears.
@@ -15,6 +17,11 @@ export interface TooltipOptions extends BaseOptions {
15
17
  * @default 0
16
18
  */
17
19
  enterDelay: number;
20
+ /**
21
+ * Element Id for the tooltip.
22
+ * @default ""
23
+ */
24
+ tooltipId?: string;
18
25
  /**
19
26
  * Text string for the tooltip.
20
27
  * @default ""
@@ -45,7 +52,7 @@ export interface TooltipOptions extends BaseOptions {
45
52
  * Set the direction of the tooltip.
46
53
  * @default 'bottom'
47
54
  */
48
- position: 'top' | 'right' | 'bottom' | 'left';
55
+ position: TooltipPosition;
49
56
  /**
50
57
  * Amount in px that the tooltip moves during its transition.
51
58
  * @default 10
@@ -60,7 +67,7 @@ const _defaults: TooltipOptions = {
60
67
  margin: 5,
61
68
  inDuration: 250,
62
69
  outDuration: 200,
63
- position: 'bottom',
70
+ position: 'bottom' as TooltipPosition,
64
71
  transitionMovement: 10,
65
72
  opacity: 1
66
73
  };
@@ -90,6 +97,7 @@ export class Tooltip extends Component<TooltipOptions> {
90
97
 
91
98
  this.options = {
92
99
  ...Tooltip.defaults,
100
+ ...this._getAttributeOptions(),
93
101
  ...options
94
102
  };
95
103
 
@@ -139,7 +147,12 @@ export class Tooltip extends Component<TooltipOptions> {
139
147
  this.tooltipEl = document.createElement('div');
140
148
  this.tooltipEl.classList.add('material-tooltip');
141
149
 
142
- const tooltipContentEl = document.createElement('div');
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
+
143
156
  tooltipContentEl.classList.add('tooltip-content');
144
157
  this._setTooltipContent(tooltipContentEl);
145
158
  this.tooltipEl.appendChild(tooltipContentEl);
@@ -147,7 +160,9 @@ export class Tooltip extends Component<TooltipOptions> {
147
160
  }
148
161
 
149
162
  _setTooltipContent(tooltipContentEl: HTMLElement) {
150
- tooltipContentEl.innerText = this.options.text;
163
+ if (this.options.tooltipId)
164
+ return;
165
+ tooltipContentEl.innerText = this.options.text;
151
166
  }
152
167
 
153
168
  _updateTooltipContent() {
@@ -331,16 +346,21 @@ export class Tooltip extends Component<TooltipOptions> {
331
346
  this.close();
332
347
  }
333
348
 
334
- _getAttributeOptions() {
335
- const attributeOptions = {};
349
+ _getAttributeOptions(): Partial<TooltipOptions> {
350
+ let attributeOptions: Partial<TooltipOptions> = { };
336
351
  const tooltipTextOption = this.el.getAttribute('data-tooltip');
352
+ const tooltipId = this.el.getAttribute('data-tooltip-id');
337
353
  const positionOption = this.el.getAttribute('data-position');
338
354
  if (tooltipTextOption) {
339
- (attributeOptions as any).text = tooltipTextOption;
355
+ attributeOptions.text = tooltipTextOption;
340
356
  }
341
357
  if (positionOption) {
342
- (attributeOptions as any).position = positionOption;
358
+ attributeOptions.position = positionOption as TooltipPosition;
359
+ }
360
+ if (tooltipId) {
361
+ attributeOptions.tooltipId = tooltipId;
343
362
  }
363
+
344
364
  return attributeOptions;
345
365
  }
346
366
  }