@materializecss/materialize 2.0.3-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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v2.0.3-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
  */
@@ -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
  }
@@ -8483,7 +8483,7 @@ class Tooltip extends component_1.Component {
8483
8483
  this.close();
8484
8484
  };
8485
8485
  this.el.M_Tooltip = this;
8486
- this.options = Object.assign(Object.assign({}, Tooltip.defaults), options);
8486
+ this.options = Object.assign(Object.assign(Object.assign({}, Tooltip.defaults), this._getAttributeOptions()), options);
8487
8487
  this.isOpen = false;
8488
8488
  this.isHovered = false;
8489
8489
  this.isFocused = false;
@@ -8512,13 +8512,19 @@ class Tooltip extends component_1.Component {
8512
8512
  _appendTooltipEl() {
8513
8513
  this.tooltipEl = document.createElement('div');
8514
8514
  this.tooltipEl.classList.add('material-tooltip');
8515
- 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 = "";
8516
8520
  tooltipContentEl.classList.add('tooltip-content');
8517
8521
  this._setTooltipContent(tooltipContentEl);
8518
8522
  this.tooltipEl.appendChild(tooltipContentEl);
8519
8523
  document.body.appendChild(this.tooltipEl);
8520
8524
  }
8521
8525
  _setTooltipContent(tooltipContentEl) {
8526
+ if (this.options.tooltipId)
8527
+ return;
8522
8528
  tooltipContentEl.innerText = this.options.text;
8523
8529
  }
8524
8530
  _updateTooltipContent() {
@@ -8637,8 +8643,9 @@ class Tooltip extends component_1.Component {
8637
8643
  });
8638
8644
  }
8639
8645
  _getAttributeOptions() {
8640
- const attributeOptions = {};
8646
+ let attributeOptions = {};
8641
8647
  const tooltipTextOption = this.el.getAttribute('data-tooltip');
8648
+ const tooltipId = this.el.getAttribute('data-tooltip-id');
8642
8649
  const positionOption = this.el.getAttribute('data-position');
8643
8650
  if (tooltipTextOption) {
8644
8651
  attributeOptions.text = tooltipTextOption;
@@ -8646,6 +8653,9 @@ class Tooltip extends component_1.Component {
8646
8653
  if (positionOption) {
8647
8654
  attributeOptions.position = positionOption;
8648
8655
  }
8656
+ if (tooltipId) {
8657
+ attributeOptions.tooltipId = tooltipId;
8658
+ }
8649
8659
  return attributeOptions;
8650
8660
  }
8651
8661
  }
@@ -9102,7 +9112,7 @@ class M {
9102
9112
  }
9103
9113
  }
9104
9114
  exports.M = M;
9105
- M.version = '2.0.3-alpha';
9115
+ M.version = '2.0.3-beta';
9106
9116
  M.Autocomplete = autocomplete_1.Autocomplete;
9107
9117
  M.Tabs = tabs_1.Tabs;
9108
9118
  M.Carousel = carousel_1.Carousel;