@rogieking/figui3 1.1.0 → 1.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.
package/example.html CHANGED
@@ -89,6 +89,7 @@
89
89
  <fig-field style="width:300px;">
90
90
  <label>Hue slider</label>
91
91
  <fig-slider type="hue"
92
+ style="--bg-hue: linear-gradient(90deg in lch longer hue,#fc38ff, #abff57)"
92
93
  variant="minimal"
93
94
  value="55"></fig-slider>
94
95
  </fig-field>
@@ -131,10 +132,11 @@
131
132
  transform="100"
132
133
  type="number"
133
134
  autoresize="true"
134
- value="0.5"
135
- text="true">
135
+ value="0.5">
136
136
  <span slot="append">%</span>
137
137
  </fig-input-text>
138
+
139
+
138
140
  <br />
139
141
  <details>
140
142
  <summary>Details</summary>
package/fig.css CHANGED
@@ -2195,7 +2195,7 @@ fig-field,
2195
2195
 
2196
2196
  &[direction="horizontal"] {
2197
2197
  gap: var(--spacer-2);
2198
- align-items: flex-start;
2198
+ align-items: center;
2199
2199
  flex-direction: row;
2200
2200
 
2201
2201
  & > label {
package/fig.js CHANGED
@@ -928,6 +928,7 @@ class FigInputText extends HTMLElement {
928
928
  let value = e.target.value;
929
929
  if (this.type === "number") {
930
930
  value = this.#sanitizeInput(value);
931
+ //value = Number(value);
931
932
  value = value / (this.transform || 1);
932
933
  }
933
934
  this.setAttribute("value", value);
@@ -966,10 +967,10 @@ class FigInputText extends HTMLElement {
966
967
  if (this.type === "number") {
967
968
  sanitized = Number(sanitized);
968
969
  if (typeof this.min === "number") {
969
- sanitized = Math.max(this.min, sanitized);
970
+ sanitized = Math.max(this.#transformNumber(this.min), sanitized);
970
971
  }
971
972
  if (typeof this.max === "number") {
972
- sanitized = Math.min(this.max, sanitized);
973
+ sanitized = Math.min(this.#transformNumber(this.max), sanitized);
973
974
  }
974
975
  }
975
976
  return sanitized;
@@ -1012,8 +1013,10 @@ class FigInputText extends HTMLElement {
1012
1013
  let sanitized = this.#sanitizeInput(value);
1013
1014
  this.value = sanitized;
1014
1015
  this.input.value = this.#transformNumber(sanitized);
1016
+ } else {
1017
+ this.value = value;
1018
+ this.input.value = value;
1015
1019
  }
1016
- this.value = value;
1017
1020
  this.dispatchEvent(new CustomEvent("input", { bubbles: true }));
1018
1021
  break;
1019
1022
  case "min":
@@ -1500,14 +1503,16 @@ class FigComboInput extends HTMLElement {
1500
1503
  </div>`;
1501
1504
  requestAnimationFrame(() => {
1502
1505
  this.input = this.querySelector("fig-input-text");
1503
- this.select = this.querySelector("fig-dropdown");
1506
+ this.dropdown = this.querySelector("fig-dropdown");
1504
1507
 
1505
- this.select.addEventListener("input", this.handleSelectInput.bind(this));
1508
+ this.dropdown.addEventListener(
1509
+ "input",
1510
+ this.handleSelectInput.bind(this)
1511
+ );
1506
1512
  });
1507
1513
  }
1508
1514
  handleSelectInput(e) {
1509
- this.value = e.target.parentNode.value;
1510
- this.setAttribute("value", this.value);
1515
+ this.setAttribute("value", e.target.closest("fig-dropdown").value);
1511
1516
  }
1512
1517
  handleInput(e) {
1513
1518
  this.value = this.input.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.1.00",
3
+ "version": "1.1.1",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {