@rogieking/figui3 1.9.4 → 1.9.6

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/components.css CHANGED
@@ -666,7 +666,6 @@ input[type="text"][list] {
666
666
  ::picker(select) {
667
667
  position-area: auto;
668
668
  align-self: auto;
669
- position-try-fallbacks: none;
670
669
  max-block-size: 100vh;
671
670
  appearance: base-select;
672
671
  scrollbar-width: thin;
@@ -2389,7 +2388,6 @@ fig-input-color {
2389
2388
  & fig-input-text:not([type]),
2390
2389
  & fig-input-text[type="text"],
2391
2390
  & fig-input-number {
2392
- flex-basis: 6em;
2393
2391
  display: inline-flex;
2394
2392
  flex-direction: column;
2395
2393
  align-items: stretch;
@@ -2402,9 +2400,15 @@ fig-input-color {
2402
2400
 
2403
2401
  & fig-input-text[type="number"],
2404
2402
  & fig-input-number {
2405
- width: 3.5rem;
2403
+ width: 3rem;
2406
2404
  display: inline-flex;
2407
2405
  }
2406
+ & > * {
2407
+ flex: 1;
2408
+ fig-input-text {
2409
+ flex: 1;
2410
+ }
2411
+ }
2408
2412
  }
2409
2413
 
2410
2414
  fig-slider {
@@ -2416,7 +2420,7 @@ fig-slider {
2416
2420
 
2417
2421
  & fig-input-text[type="number"],
2418
2422
  & fig-input-number {
2419
- width: 3.5rem;
2423
+ width: 3rem;
2420
2424
  }
2421
2425
  }
2422
2426
 
package/example.html CHANGED
@@ -25,11 +25,34 @@
25
25
 
26
26
  <h2><label>Effects/</label>UI3 Components</h2>
27
27
  <fig-spinner></fig-spinner>
28
+
29
+ <fig-button icon="true"
30
+ variant="ghost"
31
+ type="select"
32
+ style="position: absolute; right: 0;">
33
+ <svg width="24"
34
+ height="24"
35
+ viewBox="0 0 24 24"
36
+ fill="none"
37
+ xmlns="http://www.w3.org/2000/svg">
38
+ <path fill-rule="evenodd"
39
+ clip-rule="evenodd"
40
+ d="M9.64645 11.1464C9.84171 10.9512 10.1583 10.9512 10.3536 11.1464L12 12.7929L13.6464 11.1464C13.8417 10.9512 14.1583 10.9512 14.3536 11.1464C14.5488 11.3417 14.5488 11.6583 14.3536 11.8536L12.3536 13.8536C12.1583 14.0488 11.8417 14.0488 11.6464 13.8536L9.64645 11.8536C9.45118 11.6583 9.45118 11.3417 9.64645 11.1464Z"
41
+ fill="currentColor"
42
+ fill-opacity="0.9" />
43
+ </svg>
44
+ <fig-dropdown variant="neue">
45
+ <option>One if by sea</option>
46
+ <option>Two if by land</option>
47
+ </fig-dropdown>
48
+ </fig-button>
28
49
  </fig-header>
29
50
 
30
51
  <br /><br /><br /><br /><br /><br /><br /><br />
31
52
 
32
53
 
54
+
55
+
33
56
  <fig-field direction="horizontal">
34
57
  <label>Position</label>
35
58
  <fig-dropdown value="outside"
@@ -39,16 +62,30 @@
39
62
  <option value="outside">Outside</option>
40
63
  </fig-dropdown>
41
64
  </fig-field>
42
-
43
- <fig-field direction="horizontal">
44
- <label>Position</label>
45
- <fig-dropdown value="outside">
46
- <option value="inside">Inside</option>
47
- <option value="center">Center</option>
48
- <option value="outside">Outside</option>
49
- </fig-dropdown>
65
+ <fig-field direction="horizontal"
66
+ style="width: 320px;">
67
+ <label>Color</label>
68
+ <fig-input-color alpha="true"
69
+ full
70
+ text="true"
71
+ value="#000000"></fig-input-color>
72
+ </fig-field>
73
+ <fig-field direction="horizontal"
74
+ style="width: 320px;">
75
+ <label>Opacity</label>
76
+ <fig-slider alpha="true"
77
+ text="true"
78
+ value="50"
79
+ full
80
+ variant="neue"
81
+ min="0"
82
+ max="100"
83
+ step="1"
84
+ units="%"></fig-slider>
50
85
  </fig-field>
51
86
 
87
+ <br /><br /><br /><br /><br /><br /><br /><br />
88
+
52
89
 
53
90
 
54
91
 
package/fig.js CHANGED
@@ -1814,14 +1814,13 @@ class FigInputColor extends HTMLElement {
1814
1814
  </fig-input-text>`;
1815
1815
  if (this.getAttribute("alpha") === "true") {
1816
1816
  label += `<fig-tooltip text="Opacity">
1817
- <fig-input-text
1817
+ <fig-input-number
1818
1818
  placeholder="##"
1819
- type="number"
1820
1819
  min="0"
1821
1820
  max="100"
1822
- value="${this.alpha}">
1823
- <span slot="append">%</slot>
1824
- </fig-input-text>
1821
+ value="${this.alpha}"
1822
+ units="%">
1823
+ </fig-input-number>
1825
1824
  </fig-tooltip>`;
1826
1825
  }
1827
1826
  html = `<div class="input-combo">
@@ -1836,7 +1835,7 @@ class FigInputColor extends HTMLElement {
1836
1835
  requestAnimationFrame(() => {
1837
1836
  this.#swatch = this.querySelector("fig-chit[type=color]");
1838
1837
  this.#textInput = this.querySelector("fig-input-text:not([type=number])");
1839
- this.#alphaInput = this.querySelector("fig-input-text[type=number]");
1838
+ this.#alphaInput = this.querySelector("fig-input-number");
1840
1839
 
1841
1840
  this.#swatch.disabled = this.hasAttribute("disabled");
1842
1841
  this.#swatch.addEventListener("input", this.#handleInput.bind(this));
@@ -1898,7 +1897,9 @@ class FigInputColor extends HTMLElement {
1898
1897
  #handleAlphaInput(event) {
1899
1898
  //do not propagate to onInput handler for web component
1900
1899
  event.stopPropagation();
1901
- const alpha = Math.round((event.target.value / 100) * 255);
1900
+ // fig-input-number stores numeric value internally, ensure it's a number
1901
+ const alphaValue = Number(event.target.value) || 0;
1902
+ const alpha = Math.round((alphaValue / 100) * 255);
1902
1903
  const alphaHex = alpha.toString(16).padStart(2, "0");
1903
1904
  this.#setValues(this.hexOpaque + alphaHex);
1904
1905
  this.#emitInputEvent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {