@rogieking/figui3 11.6.7 → 11.6.8

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.
package/fig.js CHANGED
@@ -15078,6 +15078,7 @@ class FigMediaControls extends HTMLElement {
15078
15078
  if (!this.#playBtn) return;
15079
15079
  const playing = this.playing;
15080
15080
  this.#playBtn.setAttribute("aria-label", playing ? "Pause" : "Play");
15081
+ this.#playBtn.toggleAttribute("selected", playing);
15081
15082
  this.#playTooltip?.setAttribute("text", playing ? "Pause" : "Play");
15082
15083
  const icon = this.#playBtn.querySelector("fig-icon");
15083
15084
  if (icon) {
@@ -15829,9 +15830,10 @@ const FIG_INPUT_FILE_VIDEO_EXTENSIONS = [
15829
15830
  * @attr {string} accepts - Native file chooser filter.
15830
15831
  * @attr {boolean} preview - Preview supported files or show their media-specific icon.
15831
15832
  * @attr {string} label - Upload button label. Defaults by known file type.
15833
+ * @attr {boolean} remove - Show the remove button for a selected file. Defaults to true.
15832
15834
  */
15833
15835
  class FigInputFile extends HTMLElement {
15834
- static observedAttributes = ["accepts", "preview", "label", "disabled", "multiple", "variant", "url", "filename"];
15836
+ static observedAttributes = ["accepts", "preview", "label", "disabled", "multiple", "variant", "url", "filename", "remove"];
15835
15837
 
15836
15838
  #fileInput = null;
15837
15839
  #filenameEl = null;
@@ -15884,6 +15886,10 @@ class FigInputFile extends HTMLElement {
15884
15886
  );
15885
15887
  }
15886
15888
 
15889
+ get #removeEnabled() {
15890
+ return this.getAttribute("remove") !== "false";
15891
+ }
15892
+
15887
15893
  get #largePreviewEnabled() {
15888
15894
  return this.getAttribute("preview")?.toLowerCase() === "large";
15889
15895
  }
@@ -16543,18 +16549,20 @@ class FigInputFile extends HTMLElement {
16543
16549
  this.appendChild(this.#uploadBtn);
16544
16550
  }
16545
16551
 
16546
- const clearTooltip = document.createElement("fig-tooltip");
16547
- clearTooltip.setAttribute("text", "Remove");
16548
- this.#clearBtn = document.createElement("fig-button");
16549
- this.#clearBtn.setAttribute("variant", variant === "overlay" ? "overlay" : "ghost");
16550
- this.#clearBtn.setAttribute("icon", "true");
16551
- this.#clearBtn.setAttribute("aria-label", "Remove");
16552
- this.#clearBtn.className = "fig-input-file-clear";
16553
- if (disabled) this.#clearBtn.setAttribute("disabled", "");
16554
- this.#clearBtn.replaceChildren(createFigIcon("minus"));
16555
- this.#clearBtn.addEventListener("click", this.#onClear);
16556
- clearTooltip.appendChild(this.#clearBtn);
16557
- this.appendChild(clearTooltip);
16552
+ if (this.#removeEnabled) {
16553
+ const clearTooltip = document.createElement("fig-tooltip");
16554
+ clearTooltip.setAttribute("text", "Remove");
16555
+ this.#clearBtn = document.createElement("fig-button");
16556
+ this.#clearBtn.setAttribute("variant", variant === "overlay" ? "overlay" : "ghost");
16557
+ this.#clearBtn.setAttribute("icon", "true");
16558
+ this.#clearBtn.setAttribute("aria-label", "Remove");
16559
+ this.#clearBtn.className = "fig-input-file-clear";
16560
+ if (disabled) this.#clearBtn.setAttribute("disabled", "");
16561
+ this.#clearBtn.replaceChildren(createFigIcon("minus"));
16562
+ this.#clearBtn.addEventListener("click", this.#onClear);
16563
+ clearTooltip.appendChild(this.#clearBtn);
16564
+ this.appendChild(clearTooltip);
16565
+ }
16558
16566
  if (showsAudioPreview) this.#renderAudioPreview();
16559
16567
  } else {
16560
16568
  const tooltipText = accepts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "11.6.7",
3
+ "version": "11.6.8",
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": "SEE LICENSE IN LICENSE",