@rogieking/figui3 4.3.0 → 4.4.0

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 (3) hide show
  1. package/components.css +8 -0
  2. package/fig.js +41 -13
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -1045,11 +1045,18 @@ fig-tab,
1045
1045
  &:hover {
1046
1046
  background-color: var(--figma-color-bg-secondary);
1047
1047
  }
1048
+
1049
+ &[disabled]:not([disabled="false"]) {
1050
+ opacity: 0.4;
1051
+ pointer-events: none;
1052
+ cursor: default;
1053
+ }
1048
1054
  }
1049
1055
 
1050
1056
  fig-tabs,
1051
1057
  .tabs {
1052
1058
  display: flex;
1059
+ width: 100%;
1053
1060
  gap: var(--spacer-1);
1054
1061
  padding: var(--spacer-1) var(--spacer-2);
1055
1062
  }
@@ -1057,6 +1064,7 @@ fig-tabs,
1057
1064
  fig-tab-content,
1058
1065
  .fig-tab-content {
1059
1066
  display: none;
1067
+ width: 100%;
1060
1068
  }
1061
1069
 
1062
1070
  /* Avatar */
package/fig.js CHANGED
@@ -537,7 +537,11 @@ class FigTooltip extends HTMLElement {
537
537
  this.#boundHandleTouchMove = this.#handleTouchMove.bind(this);
538
538
  this.#boundHandleTouchEnd = this.#handleTouchEnd.bind(this);
539
539
  this.#boundHandleTouchCancel = this.#handleTouchCancel.bind(this);
540
- this.#boundHandleDialogClose = () => this.hidePopup();
540
+ this.#boundHandleDialogClose = () => {
541
+ clearTimeout(this.timeout);
542
+ this.destroy();
543
+ this.isOpen = false;
544
+ };
541
545
  }
542
546
  connectedCallback() {
543
547
  this.setup();
@@ -549,6 +553,7 @@ class FigTooltip extends HTMLElement {
549
553
  }
550
554
 
551
555
  disconnectedCallback() {
556
+ clearTimeout(this.timeout);
552
557
  this.destroy();
553
558
  document.removeEventListener(
554
559
  "mousedown",
@@ -708,6 +713,7 @@ class FigTooltip extends HTMLElement {
708
713
  }
709
714
 
710
715
  showPopup() {
716
+ if (this.#parentDialog && !this.#parentDialog.open) return;
711
717
  if (!this.popup) this.render();
712
718
  this.popup.style.display = "block";
713
719
  this.popup.style.visibility = "hidden";
@@ -2531,6 +2537,7 @@ class FigTab extends HTMLElement {
2531
2537
  this.removeEventListener("click", this.#boundHandleClick);
2532
2538
  }
2533
2539
  handleClick() {
2540
+ if (this.hasAttribute("disabled")) return;
2534
2541
  this.selected = true;
2535
2542
  if (this.content) {
2536
2543
  this.content.style.display = "block";
@@ -2636,7 +2643,9 @@ class FigTabs extends HTMLElement {
2636
2643
  if (newIndex !== currentIndex && tabs[newIndex]) {
2637
2644
  tabs.forEach((tab) => tab.removeAttribute("selected"));
2638
2645
  this.selectedTab = tabs[newIndex];
2639
- this.setAttribute("value", tabs[newIndex].getAttribute("value") || "");
2646
+ tabs[newIndex].setAttribute("selected", "true");
2647
+ const val = tabs[newIndex].getAttribute("value");
2648
+ if (val) this.setAttribute("value", val);
2640
2649
  tabs[newIndex].focus();
2641
2650
  }
2642
2651
  }
@@ -2676,19 +2685,19 @@ class FigTabs extends HTMLElement {
2676
2685
 
2677
2686
  handleClick(event) {
2678
2687
  if (this.hasAttribute("disabled")) return;
2679
- const target = event.target;
2680
- if (target.nodeName.toLowerCase() === "fig-tab") {
2681
- const tabs = this.querySelectorAll("fig-tab");
2682
- for (const tab of tabs) {
2683
- if (tab === target) {
2684
- this.selectedTab = tab;
2685
- tab.setAttribute("selected", "true");
2686
- this.setAttribute("value", tab.getAttribute("value") || "");
2687
- } else {
2688
- tab.removeAttribute("selected");
2689
- }
2688
+ const target = event.target.closest("fig-tab");
2689
+ if (!target || !this.contains(target)) return;
2690
+ const tabs = this.querySelectorAll("fig-tab");
2691
+ for (const tab of tabs) {
2692
+ if (tab === target) {
2693
+ this.selectedTab = tab;
2694
+ tab.setAttribute("selected", "true");
2695
+ } else {
2696
+ tab.removeAttribute("selected");
2690
2697
  }
2691
2698
  }
2699
+ const val = target.getAttribute("value");
2700
+ if (val) this.setAttribute("value", val);
2692
2701
  }
2693
2702
  }
2694
2703
  customElements.define("fig-tabs", FigTabs);
@@ -11030,6 +11039,25 @@ customElements.define("fig-header", FigHeader);
11030
11039
  class FigFooter extends HTMLElement {}
11031
11040
  customElements.define("fig-footer", FigFooter);
11032
11041
 
11042
+ /* Presentational elements (CSS-only, no behavior) */
11043
+ class FigSpinner extends HTMLElement {}
11044
+ customElements.define("fig-spinner", FigSpinner);
11045
+
11046
+ class FigIcon extends HTMLElement {}
11047
+ customElements.define("fig-icon", FigIcon);
11048
+
11049
+ class FigContent extends HTMLElement {}
11050
+ customElements.define("fig-content", FigContent);
11051
+
11052
+ class FigTabContent extends HTMLElement {}
11053
+ customElements.define("fig-tab-content", FigTabContent);
11054
+
11055
+ class FigButtonCombo extends HTMLElement {}
11056
+ customElements.define("fig-button-combo", FigButtonCombo);
11057
+
11058
+ class FigInputCombo extends HTMLElement {}
11059
+ customElements.define("fig-input-combo", FigInputCombo);
11060
+
11033
11061
  // FigFillPicker
11034
11062
  /**
11035
11063
  * A comprehensive fill picker component supporting solid colors, gradients, images, video, and webcam.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
6
  "license": "MIT",