@rogieking/figui3 2.31.2 → 2.32.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 (2) hide show
  1. package/fig.js +8 -0
  2. package/package.json +1 -1
package/fig.js CHANGED
@@ -2740,6 +2740,8 @@ class FigInputText extends HTMLElement {
2740
2740
  this.type = this.getAttribute("type") || "text";
2741
2741
  this.placeholder = this.getAttribute("placeholder") || "";
2742
2742
  this.name = this.getAttribute("name") || null;
2743
+ this.readonly =
2744
+ this.hasAttribute("readonly") && this.getAttribute("readonly") !== "false";
2743
2745
 
2744
2746
  if (this.type === "number") {
2745
2747
  if (this.getAttribute("step")) {
@@ -2796,6 +2798,7 @@ class FigInputText extends HTMLElement {
2796
2798
  }
2797
2799
 
2798
2800
  this.input = this.querySelector("input,textarea");
2801
+ this.input.readOnly = this.readonly;
2799
2802
 
2800
2803
  if (this.type === "number") {
2801
2804
  if (this.getAttribute("min")) {
@@ -2931,6 +2934,7 @@ class FigInputText extends HTMLElement {
2931
2934
  "placeholder",
2932
2935
  "label",
2933
2936
  "disabled",
2937
+ "readonly",
2934
2938
  "type",
2935
2939
  "step",
2936
2940
  "min",
@@ -2947,6 +2951,10 @@ class FigInputText extends HTMLElement {
2947
2951
  this.disabled = this.input.disabled =
2948
2952
  newValue !== null && newValue !== "false";
2949
2953
  break;
2954
+ case "readonly":
2955
+ this.readonly = newValue !== null && newValue !== "false";
2956
+ this.input.readOnly = this.readonly;
2957
+ break;
2950
2958
  case "transform":
2951
2959
  if (this.type === "number") {
2952
2960
  this.transform = Number(newValue) || 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.31.2",
3
+ "version": "2.32.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",