@haiilo/catalyst 2.1.0 → 2.1.1

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.
@@ -6452,13 +6452,14 @@ CatToggle.style = catToggleCss;
6452
6452
 
6453
6453
  const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
6454
6454
 
6455
- const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{position:absolute;font-size:0.875rem;line-height:1rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:20rem}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
6455
+ const catTooltipCss = ":host{display:contents}:host([hidden]){display:none}.tooltip{position:absolute;font-size:0.875rem;line-height:1rem;font-weight:500;background-color:rgb(var(--cat-bg-tooltip, 0, 0, 0));border-radius:var(--cat-border-radius-m, 0.25rem);color:rgb(var(--cat-font-color-tooltip, 255, 255, 255));transition:opacity 0.25s linear, visibility 0.25s linear;visibility:hidden;opacity:0;box-shadow:rgba(0, 0, 0, 0.08) 0 1px 8px 0;z-index:200;max-width:20rem}.tooltip-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.tooltip-show{opacity:1;visibility:visible}.tooltip-round{border-radius:10rem}.tooltip-s{padding:0.375rem 0.5rem}.tooltip-s.tooltip-round{padding:0.375rem 0.75rem}.tooltip-m{padding:0.75rem}.tooltip-m.tooltip-round{padding:0.75rem 1rem}.tooltip-l{padding:1rem}.tooltip-l.tooltip-round{padding:1rem 1.5rem}.tooltip-trigger{display:inline-block}.tooltip-trigger:focus{outline:none}";
6456
6456
 
6457
6457
  let nextUniqueId = 0;
6458
6458
  const CatTooltip = class {
6459
6459
  constructor(hostRef) {
6460
6460
  index.registerInstance(this, hostRef);
6461
6461
  this.id = `cat-tooltip-${nextUniqueId++}`;
6462
+ this.hidden = false;
6462
6463
  /**
6463
6464
  * The content of the tooltip.
6464
6465
  */
@@ -6517,6 +6518,9 @@ const CatTooltip = class {
6517
6518
  (_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('mouseleave', this.hideListener.bind(this));
6518
6519
  }
6519
6520
  }
6521
+ componentWillRender() {
6522
+ this.hidden = !this.content || this.disabled;
6523
+ }
6520
6524
  disconnectedCallback() {
6521
6525
  var _a, _b, _c, _d, _e, _f;
6522
6526
  if (isTouchDevice) {
@@ -6532,11 +6536,12 @@ const CatTooltip = class {
6532
6536
  }
6533
6537
  }
6534
6538
  render() {
6535
- return (index.h(index.Host, null, index.h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" }, index.h("slot", null)), this.content && !this.disabled && (index.h("div", { ref: el => (this.tooltip = el), id: this.id, class: {
6539
+ return (index.h(index.Host, null, index.h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" }, index.h("slot", null)), index.h("div", { ref: el => (this.tooltip = el), id: this.id, "aria-hidden": this.hidden, class: {
6536
6540
  tooltip: true,
6541
+ 'tooltip-hidden': this.hidden,
6537
6542
  'tooltip-round': this.round,
6538
6543
  [`tooltip-${this.size}`]: Boolean(this.size)
6539
- } }, this.content))));
6544
+ } }, this.content)));
6540
6545
  }
6541
6546
  get isTabbable() {
6542
6547
  return firstTabbable.firstTabbable(this.trigger);
@@ -6559,8 +6564,7 @@ const CatTooltip = class {
6559
6564
  showListener() {
6560
6565
  window.clearTimeout(this.hideTimeout);
6561
6566
  this.showTimeout = window.setTimeout(() => {
6562
- var _a;
6563
- (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
6567
+ this.showTooltip();
6564
6568
  }, this.showDelay);
6565
6569
  }
6566
6570
  hideListener() {
@@ -6573,8 +6577,7 @@ const CatTooltip = class {
6573
6577
  touchStartListener(event) {
6574
6578
  event.stopPropagation();
6575
6579
  this.touchTimeout = window.setTimeout(() => {
6576
- var _a;
6577
- (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show');
6580
+ this.showTooltip();
6578
6581
  }, this.longTouchDuration);
6579
6582
  }
6580
6583
  touchEndListener() {
@@ -6586,6 +6589,10 @@ const CatTooltip = class {
6586
6589
  var _a;
6587
6590
  (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
6588
6591
  }
6592
+ showTooltip() {
6593
+ var _a;
6594
+ !this.hidden && ((_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show'));
6595
+ }
6589
6596
  };
6590
6597
  CatTooltip.OFFSET = 4;
6591
6598
  CatTooltip.style = catTooltipCss;