@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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v2.0.2-alpha (https://materializecss.github.io/materialize)
2
+ * Materialize v2.0.3-beta (https://materializecss.github.io/materialize)
3
3
  * Copyright 2014-2023 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
5
5
  */
@@ -3616,7 +3616,7 @@ class Datepicker extends component_1.Component {
3616
3616
  */
3617
3617
  setInputValue() {
3618
3618
  this.el.value = this.toString();
3619
- this.el.dispatchEvent(new CustomEvent('change', { detail: { firedBy: this } }));
3619
+ this.el.dispatchEvent(new CustomEvent('change', { bubbles: true, cancelable: true, composed: true, detail: { firedBy: this } }));
3620
3620
  }
3621
3621
  _renderDateDisplay() {
3622
3622
  let displayDate = Datepicker._isDate(this.date) ? this.date : new Date();
@@ -3894,8 +3894,8 @@ class Datepicker extends component_1.Component {
3894
3894
  dropdownOptions: { container: document.body, constrainWidth: false }
3895
3895
  });
3896
3896
  // Add change handlers for select
3897
- yearSelect.addEventListener('change', () => this._handleYearChange);
3898
- monthSelect.addEventListener('change', () => this._handleMonthChange);
3897
+ yearSelect.addEventListener('change', this._handleYearChange);
3898
+ monthSelect.addEventListener('change', this._handleMonthChange);
3899
3899
  if (typeof this.options.onDraw === 'function') {
3900
3900
  this.options.onDraw.call(this);
3901
3901
  }
@@ -4510,9 +4510,6 @@ class Dropdown extends component_1.Component {
4510
4510
  }
4511
4511
  exports.Dropdown = Dropdown;
4512
4512
  Dropdown._dropdowns = [];
4513
- (() => {
4514
- Dropdown._dropdowns = [];
4515
- })();
4516
4513
 
4517
4514
 
4518
4515
  /***/ }),
@@ -4619,29 +4616,35 @@ class Forms {
4619
4616
  }
4620
4617
  });
4621
4618
  document.querySelectorAll('.materialize-textarea').forEach((textArea) => {
4622
- // Save Data in Element
4623
- textArea.setAttribute('original-height', textArea.getBoundingClientRect().height.toString());
4624
- textArea.setAttribute('previous-length', textArea.value.length.toString());
4625
4619
  Forms.textareaAutoResize(textArea);
4626
- textArea.addEventListener('keyup', e => Forms.textareaAutoResize(textArea));
4627
- textArea.addEventListener('keydown', e => Forms.textareaAutoResize(textArea));
4628
4620
  });
4629
4621
  // File Input Path
4630
4622
  document.querySelectorAll('.file-field input[type="file"]').forEach((fileInput) => {
4631
- fileInput.addEventListener('change', e => {
4632
- const fileField = fileInput.closest('.file-field');
4633
- const pathInput = fileField.querySelector('input.file-path');
4634
- const files = fileInput.files;
4635
- const filenames = [];
4636
- for (let i = 0; i < files.length; i++) {
4637
- filenames.push(files[i].name);
4638
- }
4639
- pathInput.value = filenames.join(', ');
4640
- pathInput.dispatchEvent(new Event('change'));
4641
- });
4623
+ Forms.InitFileInputPath(fileInput);
4642
4624
  });
4643
4625
  });
4644
4626
  }
4627
+ static InitTextarea(textarea) {
4628
+ // Save Data in Element
4629
+ textarea.setAttribute('original-height', textarea.getBoundingClientRect().height.toString());
4630
+ textarea.setAttribute('previous-length', textarea.value.length.toString());
4631
+ Forms.textareaAutoResize(textarea);
4632
+ textarea.addEventListener('keyup', e => Forms.textareaAutoResize(textarea));
4633
+ textarea.addEventListener('keydown', e => Forms.textareaAutoResize(textarea));
4634
+ }
4635
+ static InitFileInputPath(fileInput) {
4636
+ fileInput.addEventListener('change', e => {
4637
+ const fileField = fileInput.closest('.file-field');
4638
+ const pathInput = fileField.querySelector('input.file-path');
4639
+ const files = fileInput.files;
4640
+ const filenames = [];
4641
+ for (let i = 0; i < files.length; i++) {
4642
+ filenames.push(files[i].name);
4643
+ }
4644
+ pathInput.value = filenames.join(', ');
4645
+ pathInput.dispatchEvent(new Event('change', { bubbles: true, cancelable: true, composed: true }));
4646
+ });
4647
+ }
4645
4648
  }
4646
4649
  exports.Forms = Forms;
4647
4650
 
@@ -5947,7 +5950,7 @@ class FormSelect extends component_1.Component {
5947
5950
  const actualSelectedValues = this.getSelectedValues();
5948
5951
  const selectionHasChanged = !this._arraysEqual(previousSelectedValues, actualSelectedValues);
5949
5952
  if (selectionHasChanged)
5950
- this.el.dispatchEvent(new Event('change')); // trigger('change');
5953
+ this.el.dispatchEvent(new Event('change', { bubbles: true, cancelable: true, composed: true })); // trigger('change');
5951
5954
  }
5952
5955
  if (!this.isMultiple)
5953
5956
  this.dropdown.close();
@@ -7786,7 +7789,7 @@ class Timepicker extends component_1.Component {
7786
7789
  this.el.value = value;
7787
7790
  // Trigger change event
7788
7791
  if (value !== last) {
7789
- this.el.dispatchEvent(new Event('change'));
7792
+ this.el.dispatchEvent(new Event('change', { bubbles: true, cancelable: true, composed: true }));
7790
7793
  }
7791
7794
  this.close();
7792
7795
  this.el.focus();
@@ -8480,7 +8483,7 @@ class Tooltip extends component_1.Component {
8480
8483
  this.close();
8481
8484
  };
8482
8485
  this.el.M_Tooltip = this;
8483
- this.options = Object.assign(Object.assign({}, Tooltip.defaults), options);
8486
+ this.options = Object.assign(Object.assign(Object.assign({}, Tooltip.defaults), this._getAttributeOptions()), options);
8484
8487
  this.isOpen = false;
8485
8488
  this.isHovered = false;
8486
8489
  this.isFocused = false;
@@ -8509,13 +8512,19 @@ class Tooltip extends component_1.Component {
8509
8512
  _appendTooltipEl() {
8510
8513
  this.tooltipEl = document.createElement('div');
8511
8514
  this.tooltipEl.classList.add('material-tooltip');
8512
- const tooltipContentEl = document.createElement('div');
8515
+ const tooltipContentEl = this.options.tooltipId
8516
+ ? document.getElementById(this.options.tooltipId)
8517
+ : document.createElement('div');
8518
+ this.tooltipEl.append(tooltipContentEl);
8519
+ tooltipContentEl.style.display = "";
8513
8520
  tooltipContentEl.classList.add('tooltip-content');
8514
8521
  this._setTooltipContent(tooltipContentEl);
8515
8522
  this.tooltipEl.appendChild(tooltipContentEl);
8516
8523
  document.body.appendChild(this.tooltipEl);
8517
8524
  }
8518
8525
  _setTooltipContent(tooltipContentEl) {
8526
+ if (this.options.tooltipId)
8527
+ return;
8519
8528
  tooltipContentEl.innerText = this.options.text;
8520
8529
  }
8521
8530
  _updateTooltipContent() {
@@ -8634,8 +8643,9 @@ class Tooltip extends component_1.Component {
8634
8643
  });
8635
8644
  }
8636
8645
  _getAttributeOptions() {
8637
- const attributeOptions = {};
8646
+ let attributeOptions = {};
8638
8647
  const tooltipTextOption = this.el.getAttribute('data-tooltip');
8648
+ const tooltipId = this.el.getAttribute('data-tooltip-id');
8639
8649
  const positionOption = this.el.getAttribute('data-position');
8640
8650
  if (tooltipTextOption) {
8641
8651
  attributeOptions.text = tooltipTextOption;
@@ -8643,6 +8653,9 @@ class Tooltip extends component_1.Component {
8643
8653
  if (positionOption) {
8644
8654
  attributeOptions.position = positionOption;
8645
8655
  }
8656
+ if (tooltipId) {
8657
+ attributeOptions.tooltipId = tooltipId;
8658
+ }
8646
8659
  return attributeOptions;
8647
8660
  }
8648
8661
  }
@@ -9099,7 +9112,7 @@ class M {
9099
9112
  }
9100
9113
  }
9101
9114
  exports.M = M;
9102
- M.version = '2.0.2-alpha';
9115
+ M.version = '2.0.3-beta';
9103
9116
  M.Autocomplete = autocomplete_1.Autocomplete;
9104
9117
  M.Tabs = tabs_1.Tabs;
9105
9118
  M.Carousel = carousel_1.Carousel;
@@ -9137,7 +9150,6 @@ M.Utils = utils_1.Utils;
9137
9150
  waves_1.Waves.Init();
9138
9151
  range_1.Range.Init();
9139
9152
  })();
9140
- exports["default"] = M;
9141
9153
 
9142
9154
  })();
9143
9155